汇融云链2

This commit is contained in:
2023-02-13 18:43:39 +08:00
parent 76dca84266
commit a29788866e
331 changed files with 95753 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
<template>
<view class="content">
<reserve-date
@changeDay='changeDay'
@changeMonth='changeMonth'
:startDate='startDate'
:price='price'
:isNowDate='isNowDate'
:disableBefore='disableBefore'
:endDate='endDate'
:singleElection='singleElection'
:date='date'
/>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import reserveDate from '@/components/reserve-date/reserve-date.vue'
import { formatDate } from '@/common/date';
export default {
data() {
return {
date: '2019-08-07',
price: {
type: true,
data: []
},
isNowDate: true,
disableBefore: false ,
endDate: '',
startDate: '',
singleElection: false
}
},
onLoad(options) {
this.date = this.dateFormat(new Date())
},
async onShow() {
this.date = this.dateFormat(new Date())
},
mounted() {
this.date = this.dateFormat(new Date())
console.log(this.date);
this.changeMonth(['', '', 31])
},
methods: {
// 日期改变
changeDay(date) {
console.log(date)
},
// 月改变
async changeMonth(data) {
console.log(data)
if (!this.price.type) return false
uni.showLoading({
title: '加载中',
mask: true
})
let params = {date:data.join('-')};
let orderResp = await Api.apiAdminCall('get', Api.admin.orderDayStatic, params,true);
console.log(orderResp)
let price = []
price.push(orderResp.a1);
price.push(orderResp.a2);
price.push(orderResp.a3);
price.push(orderResp.a4);
price.push(orderResp.a5);
price.push(orderResp.a6);
price.push(orderResp.a7);
price.push(orderResp.a8);
price.push(orderResp.a9);
price.push(orderResp.a10);
price.push(orderResp.a11);
price.push(orderResp.a12);
price.push(orderResp.a13);
price.push(orderResp.a14);
price.push(orderResp.a15);
price.push(orderResp.a16);
price.push(orderResp.a17);
price.push(orderResp.a18);
price.push(orderResp.a19);
price.push(orderResp.a20);
price.push(orderResp.a21);
price.push(orderResp.a22);
price.push(orderResp.a23);
price.push(orderResp.a24);
price.push(orderResp.a25);
price.push(orderResp.a26);
price.push(orderResp.a27);
price.push(orderResp.a28);
price.push(orderResp.a29);
price.push(orderResp.a30);
price.push(orderResp.a31);
this.price.data = price
},
dateFormat(time) {
console.log(time);
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd');
}
},
components: {
reserveDate
}
}
</script>

View File

@@ -0,0 +1,180 @@
<template>
<view class="content">
<view class="scroll-top" >
<time-filter @chooseTime='chooseTime' :type="type"></time-filter>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">订单数量</view>
<view class="right">{{homedata.orderCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="当日订单" :titleTwo="homedata.nowOrderCount" bg="#fbad4c" :percent="(homedata.nowOrderCount*100/homedata.orderCount) | numFilter"></circle-percent>
<circle-percent titleOne="当日总额" :titleTwo="homedata.nowOrderPay" bg="#87d7a5" :percent="(homedata.nowOrderCount*100/homedata.orderCount) | numFilter"></circle-percent>
</view>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">会员统计</view>
<view class="right">{{homedata.memberCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="当日新增会员" :titleTwo="homedata.mallCount+homedata.femallount" bg="#87d7a5" :percent="((homedata.mallCount+homedata.femallount)/homedata.memberCount)| numFilter"></circle-percent>
<circle-percent titleOne="男会员" :titleTwo="homedata.mallCount" bg="#00adc7" :percent="(homedata.mallCount/homedata.memberCount)| numFilter"></circle-percent>
<circle-percent titleOne="女会员" :titleTwo="homedata.femallount" bg="#FF6A6A" :percent="(homedata.femallount/homedata.memberCount)| numFilter"></circle-percent>
</view>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">商品统计</view>
<view class="right">{{homedata.goodsCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="新增商品" :titleTwo="homedata.onCount+homedata.offCount" bg="#87d7a5" :percent="((homedata.onCount+homedata.offCount)/homedata.goodsCount)| numFilter"></circle-percent>
<circle-percent titleOne="下架商品" :titleTwo="homedata.offCount" bg="#00adc7" :percent="(homedata.offCount/homedata.goodsCount)| numFilter"></circle-percent>
<circle-percent titleOne="缺库存商品" :titleTwo="homedata.noStock" bg="#FF6A6A" :percent="(homedata.noStock/homedata.goodsCount)| numFilter"></circle-percent>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import timeFilter from '@/components/time-filter/time-filter'
import circlePercent from '@/components/circle-percent/circle-percent'
import { formatDate } from '@/common/date';
export default {
data() {
return {
date: '2019-08-07',
homedata:null,
singleElection: false,
type: 'day'
}
},
components: {
timeFilter,
circlePercent
},
onLoad() {
},
async onShow() {
this.date = this.dateFormat(new Date());
let params = {date:this.date,type:1};
let resp = await Api.apiAdminCall('get', Api.admin.dayStatic, params,true);
console.log(resp)
this.homedata = resp;
},
computed: {
},
methods: {
async chooseTime(item, index) {
//console.log(this.addDate(item.value))
let params = {date:this.addDate(item.value),type:1};
let resp = await Api.apiAdminCall('get', Api.admin.dayStatic, params,true);
console.log(resp)
this.homedata = resp;
},
addDate(days) {
var d = new Date();
d.setDate(d.getDate() + days);
var m = d.getMonth() + 1;
if(m < 10){
m='0'+m
}
var day = d.getDate()
if(day < 10){
day='0'+day
}
return d.getFullYear() + '-' + m + '-' + day;
},
getMonth(month) {
var time = new Date();
time.setMonth(time.getMonth() + month);//设置month月后的时间
var y = time.getFullYear();
var m = time.getMonth() + 1;//获取当前月份
var d = time.getDate();
if(m<10){
m = "0"+m
}
return y + "-" + m ;
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd');
}
}
,filters: {
numFilter (value) {
let realVal = ''
if (value) {
// 截取当前数据到小数点后两位
realVal = parseFloat(value).toFixed(2)
} else {
realVal = '0'
}
return realVal
}
}
}
</script>
<style lang="scss">
.content{
background-color: $uni-bg-color;
}
.part{
background: $uni-bg-color;
font-size: $uni-font-size-lg;
color: $uni-text-color;
margin-bottom: 20upx;
}
.padding {
padding: 30upx 40upx;
}
.flexRow{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
}
.tj{
margin-bottom: 0;
padding-bottom: 0;
.tjTitle{
display: flex;
flex-direction: row;
border-bottom: 1upx solid #ebedf0;
padding: 40upx 0;
.left{
flex: 1;
text-align: left;
font-size: $uni-font-size-base;
font-weight: bold;
}
.right{
flex: 1;
text-align: right;
color: $uni-text-color-grey;
}
}
.tjBody{
justify-content: flex-start;
border-bottom: 1upx solid #f5f5f5;
}
}
</style>

View File

@@ -0,0 +1,302 @@
<template>
<view class="content">
<view class="content-top">
<view class='img-list'>
<view class='img-list-item'
v-for="item in info.orderItemList"
:key="item.id"
>
<view class="img-list-item-gray">
<image class='img-list-item-l small-img' :src='item.productPic' mode='aspectFill'></image>
<view class='img-list-item-r small-right'
@click="goodsDetail(item.productId)"
>
<view class='little-right-t'>
<view class='goods-name list-goods-name'>{{ item.productName }}</view>
</view>
</view>
</view>
<view class="evaluate-num">
<view class="evaluate-num-t">商品评分</view>
<view class="evaluate-num-b">
<uni-rate
size="18"
:id="item.id"
:value="score[item.id]"
@change="changeScore"
></uni-rate>
</view>
</view>
<view class="evaluate-content">
<view class="evaluate-c-t">
<textarea v-model="textarea[item.id]" placeholder="宝贝满足你的期待吗? 说说你的使用心得" />
</view>
<view class="evaluate-c-b">
<view class="goods-img-item"
v-if="images[item.id].length"
v-for="(img, key) in images[item.id]"
:key="key"
>
<image class="del" src="../../static/image/del.png" mode="" @click="removeImg(item.id, key)"></image>
<image class="" :src="img.url" mode="" @click="clickImg(img.url)"></image>
</view>
<view class="upload-img" v-show="isupload[item.id]">
<image class="icon" src="../../static/image/camera.png" mode="" @click="uploadImg(item.id)"></image>
<view class="">上传照片</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="button-bottom">
<button class="btn btn-square btn-b" hover-class="btn-hover" @click="toEvaluate" :disabled='submitStatus' :loading='submitStatus'>提交评论</button>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniRate from "@/components/uni-rate/uni-rate.vue"
import { goods } from '@/config/mixins.js'
export default {
mixins: [goods],
components: {uniRate},
data () {
return {
orderId: 0,
info: {}, // 订单详情
images: [],
score: [], // 商品评价
textarea: [], // 商品评价信息
isupload: [], // 启/禁用 图片上传按钮
rate: 5,
submitStatus: false
}
},
onLoad (options) {
this.orderId = options.order_id
this.orderId
? this.orderInfo()
: this.$common.errorToShow('获取失败', () => {
uni.navigateBack({
delta: 1
})
})
},
computed: {
// 获取vuex中状态
maxUploadImg () {
return 1
}
},
methods: {
// 获取订单详情
async orderInfo () {
let params = { id: this.orderId };
this.orderInfo = await Api.apiAdminCall('get', Api.admin.orderDetail, params);
let images = []
let textarea = []
let upload = []
let score = []
this.orderInfo.orderItemList.forEach (item => {
if (item.type==1){
images[item.id] = []
textarea[item.id] = ''
upload[item.id] = true
score[item.id] = 5
}
})
this.info = this.orderInfo
this.images = images
this.textarea = textarea
this.score = score
this.isupload = upload
},
// 上传图片
uploadImg (key) {
this.$otherApi.uploadFiles(res => {
if (res.code == 200) {
let img = {
url: res.data,
id: res.data
}
this.images[key].push(img)
this.$common.successToShow(res.msg)
} else {
this.$common.errorToShow(res.msg)
}
})
},
// 删除图片
removeImg (id, key) {
this.images[id].splice(key, 1)
},
// 图片点击放大
clickImg (img) {
// 预览图片
uni.previewImage({
urls: img.split()
});
},
// 改变评分
changeScore (e) {
this.score[e.id] = e.value
},
// 提交评价
async toEvaluate () {
this.submitStatus = true;
let items = {}
var myArray=new Array()
this.images.forEach((item, key) => {
let itemmm = {
goodsId:key,
images: item.url,
score: this.score[key],
textarea: this.textarea[key]
}
myArray.push(itemmm);
})
let params = {
orderId: this.orderId,
items: JSON.stringify(myArray)
}
uni.showLoading({
title: '请稍后'
});
let data = await Api.apiAdminCall('post', Api.admin.orderevaluate, params);
console.log(data);
if (data) {
// 更改订单列表页的订单状态
let pages = getCurrentPages(); // 当前页
let beforePage = pages[pages.length - 2]; // 上个页面
if (beforePage !== undefined && beforePage.route === 'pages/order/order') {
// #ifdef MP-WEIXIN
beforePage.$vm.isReload = true
// #endif
// #ifdef H5
beforePage.isReload = true
// #endif
// #ifdef MP-ALIPAY
beforePage.rootVM.isReload = true
// #endif
}
this.submitStatus = false;
uni.navigateBack({
delta: 1
})
}
uni.hideLoading();
}
},
watch: {
images: {
handler () {
this.images.forEach((item, key) => {
this.isupload[key] = item.length > this.maxUploadImg ? false : true
})
},
deep: true
}
}
}
</script>
<style>
.img-list-item{
padding: 30upx 20upx;
}
.img-list-item-gray{
background-color: #F7F7F7;
overflow: hidden;
padding: 18upx 20upx;
}
.small-right{
width: 520upx;
}
.evaluate-content{
background-color: #fff;
padding: 20upx 0upx;
}
.evaluate-c-t{
width: 100%;
height: 240upx;
}
.evaluate-c-t textarea{
width: 100%;
height: 100%;
font-size: 26upx;
padding: 10upx;
}
.evaluate-c-b{
overflow: hidden;
}
.upload-img{
width: 146upx;
height: 146upx;
margin: 14upx;
text-align: center;
color: #999999;
font-size: 22upx;
border: 2upx solid #E1E1E1;
/* #ifdef MP-ALIPAY */
border-top: 8upx solid #E1E1E1;
/* #endif */
border-radius: 4upx;
display: inline-block;
float: left;
padding: 24upx 0;
}
.goods-img-item{
width: 174upx;
height: 174upx;
padding: 14upx;
float: left;
position: relative;
}
.goods-img-item:nth-child(4n){
margin-right: 0;
}
.goods-img-item image{
width: 100%;
height: 100%;
}
.del{
width: 30upx !important;
height: 30upx !important;
position: absolute;
right: 0;
top: 0;
z-index: 999;
}
.evaluate-num{
padding: 20upx 26upx;
background-color: #fff;
margin-top: 20upx;
}
.evaluate-num-t{
color: #333;
font-size: 28upx;
margin-bottom: 20upx;
}
.button-bottom .btn{
width: 100%;
}
</style>

View File

@@ -0,0 +1,649 @@
<template>
<view class="content">
<view class="navbar">
<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
</view>
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData" >
<!-- 空白页 -->
<empty v-if="tabItem.loaded === true"></empty>
<!-- 订单列表 -->
<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item" >
<view class="i-top b-b">
<text class="time" @click="navToDetailPage(item)">{{ item.createTime }}</text>
<text class="state" :style="{ color: item.stateTipColor }" @click="navToDetailPage(item)">{{ item.id }}</text>
<text v-if="status == 3" class="del-btn yticon icon-iconfontshanchu1" @click="cancelOrder(index)">删除</text>
</view>
<view class="goods-box-single" >
<img class="goods-img" :src="item.pic" mode="aspectFill"></img>
<view class="right" @click="navToDetailPage(item)">
<text class="title clamp">{{ item.name }}</text>
<text class="attr-box"> </text>
<text class="price">{{ item.price }}</text>
</view>
</view>
<view class="action-box b-t">
<button v-if="item.isFenxiao == 1" class="action-btn" @click="updateFenxiaoStatus(item)">解除分销</button>
<button v-if="item.isFenxiao == 0" class="action-btn recom" @click="updateFenxiaoStatus(item)">设为分销</button>
<button v-if="item.isVip == 1" class="action-btn" @click="updateVipStatus(item)">解除会员商品</button>
<button v-if="item.isVip == 0" class="action-btn recom" @click="updateVipStatus(item)">设为会员商品</button>
<button v-if="item.recommandStatus == 1" class="action-btn" @click="updateReComStatus(item)">不推荐</button>
<button v-if="item.recommandStatus == 0" class="action-btn recom" @click="updateReComStatus(item)">设为推荐</button>
<button v-if="item.publishStatus == 1" class="action-btn" @click="updatePublishStatus(item)">下架</button>
<button v-if="item.publishStatus == 0" class="action-btn recom" @click="updatePublishStatus(item)">上架</button>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import { mapState } from 'vuex';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
import { formatDate } from '@/common/date';
export default {
components: {
uniLoadMore,
empty
},
data() {
return {
tabCurrentIndex: 0,
pageNum: 1,
orderList:[],
status:0,
headerPosition: 'fixed',
headerTop: '0px',
loadingType: 'more', //加载更多状态
navList: [
{
status: 0,
text: '全部',
loadingType: 'more',
orderList: []
},
{
status: 1,
text: '出售中',
loadingType: 'more',
orderList: []
},
{
status: 2,
text: '已售完',
loadingType: 'more',
orderList: []
},
{
status: 3,
text: '仓库中',
loadingType: 'more',
orderList: []
},
{
status: 4,
text: '已删除',
loadingType: 'more',
orderList: []
}
]
};
},
onLoad(options) {
/**
* 修复app端点击除全部订单外的按钮进入时不加载数据的问题
* 替换onLoad下代码即可
*/
this.tabCurrentIndex = +options.status;
this.pageNum=1;
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = 1;
console.log('1='+this.pageNum)
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = 1;
console.log('2='+this.pageNum)
this.loadData();
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/product?id=${id}`
});
},
//获取订单列表
async loadData(type = 'add', loading) {
//这里是将订单挂载到tab列表下
let index = this.tabCurrentIndex;
let navItem = this.navList[index];
let status = navItem.status;
this.status=status;
if (!this.hasLogin) {
url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
let params = { pageNum: this.pageNum, status: status };
let data = await Api.apiAdminCall('get', Api.admin.goodsList, params);
let orderList1 = data.records;
let orderList = orderList1.filter(item => {
//添加不同状态下订单的表现形式
item = Object.assign(item, this.orderStateExp(status));
item.createTime = this.dateFormat(item.createTime);
//演示数据所以自己进行状态筛选
if (status === 0) {
//0为全部订单
return item;
}
return item;
});
if (type === 'refresh') {
this.orderList = [];
}
this.orderList = this.orderList.concat(orderList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.orderList.length > data.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
this.pageNum = this.pageNum + 1;
orderList.forEach(item => {
navItem.orderList.push(item);
});
}
},
//swiper 切换
changeTab(e) {
console.log(e.target.current)
this.tabCurrentIndex = e.target.current;
this.loadData('refresh');
},
//顶部tab点击
tabClick(index) {
console.log(index)
this.tabCurrentIndex = index;
},
// 推荐
async updateReComStatus(item) {
let publishStatus =0;
if (item.recommandStatus==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus,type:1 };
let data = await Api.apiAdminCall('post', Api.admin.updateReComStatus, params);
if (data) {
this.$api.msg('设置成功');
}
},
// 推荐
async updateReComStatus(item) {
let publishStatus =0;
if (item.recommandStatus==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus,type:1 };
let data = await Api.apiAdminCall('post', Api.admin.updateReComStatus, params);
if (data) {
this.$api.msg('设置成功');
}
},
// 推荐
async updateFenxiaoStatus(item) {
let publishStatus =0;
if (item.isFenxiao==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus,type:5 };
let data = await Api.apiAdminCall('post', Api.admin.updateReComStatus, params);
if (data) {
this.$api.msg('设置成功');
}
},
// 推荐
async updateVipStatus(item) {
let publishStatus =0;
if (item.isVip==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus,type:6 };
let data = await Api.apiAdminCall('post', Api.admin.updateReComStatus, params);
if (data) {
this.$api.msg('设置成功');
}
},
// 上下架
async updatePublishStatus(item) {
let publishStatus =0;
if (item.publishStatus==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus ,type:1};
let data = await Api.apiAdminCall('post', Api.admin.updateReComStatus, params);
if (data) {
this.$api.msg(data);
this.pageNum=1;
if (item.publishStatus==1){
this.tabCurrentIndex = 3;
}else {
this.tabCurrentIndex = 1;
}
}
},
//订单状态文字和颜色
orderStateExp(value) {
let stateTip = '',
stateTipColor = '#fa436a';
if (value === 1) {
stateTipColor = '#909399';
stateTip = '出售中';
}if (value === 2) {
stateTip = '已下架';
} else if (value === 3) {
stateTip = '已售尽';
}
return { stateTip, stateTipColor };
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.swiper-box {
height: calc(100% - 40px);
}
.list-scroll-content {
height: 100%;
}
.navbar {
display: flex;
height: 40px;
padding: 0 5px;
background: #fff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
position: relative;
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 15px;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 44px;
height: 0;
border-bottom: 2px solid $base-color;
}
}
}
}
.uni-swiper-item {
height: auto;
}
.order-item {
display: flex;
flex-direction: column;
padding-left: 30upx;
background: #fff;
margin-top: 16upx;
.i-top {
display: flex;
align-items: center;
height: 80upx;
padding-right: 30upx;
font-size: $font-base;
color: $font-color-dark;
position: relative;
.time {
flex: 1;
}
.state {
color: $base-color;
}
.del-btn {
padding: 10upx 0 10upx 36upx;
font-size: $font-lg;
color: $font-color-light;
position: relative;
&:after {
content: '';
width: 0;
height: 30upx;
border-left: 1px solid $border-color-dark;
position: absolute;
left: 20upx;
top: 50%;
transform: translateY(-50%);
}
}
}
/* 多条商品 */
.goods-box {
height: 160upx;
padding: 20upx 0;
white-space: nowrap;
.goods-item {
width: 120upx;
height: 120upx;
display: inline-block;
margin-right: 24upx;
}
.goods-img {
display: block;
width: 100%;
height: 100%;
}
}
/* 单条商品 */
.goods-box-single {
display: flex;
padding: 20upx 0;
.goods-img {
display: block;
width: 120upx;
height: 120upx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
padding: 0 30upx 0 24upx;
overflow: hidden;
.title {
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1;
}
.attr-box {
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.num {
margin: 0 8upx;
color: $font-color-dark;
}
.price {
font-size: $font-lg;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
.action-box {
display: flex;
justify-content: flex-end;
align-items: center;
height: 100upx;
position: relative;
padding-right: 30upx;
}
.action-btn {
width: 160upx;
height: 60upx;
margin: 0;
margin-left: 24upx;
padding: 0;
text-align: center;
line-height: 60upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
background: #fff;
border-radius: 100px;
&:after {
border-radius: 100px;
}
&.recom {
background: #fff9f9;
color: $base-color;
&:after {
border-color: #f7bcc8;
}
}
}
}
/* load-more */
.uni-load-more {
display: flex;
flex-direction: row;
height: 80upx;
align-items: center;
justify-content: center;
}
.uni-load-more__text {
font-size: 28upx;
color: #999;
}
.uni-load-more__img {
height: 24px;
width: 24px;
margin-right: 10px;
}
.uni-load-more__img > view {
position: absolute;
}
.uni-load-more__img > view view {
width: 6px;
height: 2px;
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
background: #999;
position: absolute;
opacity: 0.2;
transform-origin: 50%;
animation: load 1.56s ease infinite;
}
.uni-load-more__img > view view:nth-child(1) {
transform: rotate(90deg);
top: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(2) {
transform: rotate(180deg);
top: 11px;
right: 0;
}
.uni-load-more__img > view view:nth-child(3) {
transform: rotate(270deg);
bottom: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(4) {
top: 11px;
left: 0;
}
.load1,
.load2,
.load3 {
height: 24px;
width: 24px;
}
.load2 {
transform: rotate(30deg);
}
.load3 {
transform: rotate(60deg);
}
.load1 view:nth-child(1) {
animation-delay: 0s;
}
.load2 view:nth-child(1) {
animation-delay: 0.13s;
}
.load3 view:nth-child(1) {
animation-delay: 0.26s;
}
.load1 view:nth-child(2) {
animation-delay: 0.39s;
}
.load2 view:nth-child(2) {
animation-delay: 0.52s;
}
.load3 view:nth-child(2) {
animation-delay: 0.65s;
}
.load1 view:nth-child(3) {
animation-delay: 0.78s;
}
.load2 view:nth-child(3) {
animation-delay: 0.91s;
}
.load3 view:nth-child(3) {
animation-delay: 1.04s;
}
.load1 view:nth-child(4) {
animation-delay: 1.17s;
}
.load2 view:nth-child(4) {
animation-delay: 1.3s;
}
.load3 view:nth-child(4) {
animation-delay: 1.43s;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
</style>

View File

@@ -0,0 +1,947 @@
<template>
<view class="container">
<!-- 小程序头部兼容 -->
<!-- #ifdef MP -->
<view class="mp-search-box" @click="search()"><input class="ser-input" type="text" value="输入关键字搜索" /></view>
<!-- #endif -->
<!-- 头部轮播 -->
<view class="carousel-section">
<!-- 标题栏和状态栏占位符 -->
<view class="titleNview-placing"></view>
<!-- 背景色区域 -->
<view class="titleNview-background" :style="{ backgroundColor: titleNViewBackground }"></view>
<swiper class="carousel" circular @change="swiperChange">
<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
@click="navToDetailPageL(item.url)">
<image :src="item.pic" />
</swiper-item>
</swiper>
<!-- 自定义swiper指示器 -->
<view class="swiper-dots">
<text class="num">{{ swiperCurrent + 1 }}</text>
<text class="sign">/</text>
<text class="num">{{ swiperLength }}</text>
</view>
</view>
<!-- 分类 -->
<view class="cate-section">
<view class="cate-item" @click="navToTabPage('../../pagesC/seller/store')">
<image src="/static/temp/c3.png"></image>
<text>店铺</text>
</view>
<view class="cate-item" @click="navToTabPage('../../pagesC/seller/goods?status=0')">
<image src="/static/temp/c5.png"></image>
<text>商品</text>
</view>
<view class="cate-item" @click="navToTabPage('../../pagesC/seller/order?status=0')">
<image src="/static/temp/c6.png"></image>
<text>订单</text>
</view>
<view class="cate-item" @click="navToTabPage('../../pagesC/seller/member')">
<image src="/static/temp/c7.png"></image>
<text>会员</text>
</view>
<view class="cate-item" @click="navToTabPage('../../pagesC/seller/monthStatisc')">
<image src="/static/temp/c8.png"></image>
<text>营销</text>
</view>
</view>
<view>
<uni-grid :column="4" :hor="35" :ver="-45">
<uni-grid-item marker="badge" :text="orderData.nowOrderCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/stack')">今日订单</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderData.nowOrderCount+''" type="primary">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=0')">今日总额</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderData.yesOrderCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=0')">昨日订单</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderData.yesOrderPay+''" type="primary">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=0')">昨日总额</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderStatusCount.status0+''" type="error">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=12')">待付款</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderStatusCount.status1+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=2')">待发货</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderStatusCount.status5+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=13')">申请退款</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="orderStatusCount.status14+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/order?status=15')">已关闭</text>
</uni-grid-item>
</uni-grid>
</view>
<view class="ad-1">
<image src="/static/temp/ad1.jpg" @click="navToDetailPageL('https://s.click.taobao.com/0T59c1w')"
mode="scaleToFill"></image>
</view>
<view>
<uni-grid :column="3" :hor="35" :ver="-45">
<uni-grid-item marker="badge" :text="userData.nowCount+''" type="primary">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">今日新增会员</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="userData.yesUserCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">昨日新增会员</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="userData.qiUserCount+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">当月新增会员</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="userData.mallCount+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">男会员</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="userData.femallount+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">女会员</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="userData.allCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">所有会员</text>
</uni-grid-item>
</uni-grid>
</view>
<view class="ad-1">
<image src="/static/temp/ad1.jpg" @click="navToDetailPageL('https://s.click.taobao.com/0T59c1w')"
mode="scaleToFill"></image>
</view>
<view>
<uni-grid :column="3" :hor="35" :ver="-45">
<uni-grid-item marker="badge" :text="goodsData.onCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/goods?status=1')">在售商品</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="goodsData.offCount+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/goods?status=3')">仓库中</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="goodsData.noStock+''" type="warning">
<text class="text" @click="navToTabPage('../../pagesC/seller/goods?status=2')">已售馨</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="goodsData.nowCount+''" type="primary">
<text class="text" @click="navToTabPage('../../pagesC/seller/dayStatisc')">今日新增商品</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="goodsData.yesCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/goods?status=0')">昨日新增商品</text>
</uni-grid-item>
<uni-grid-item marker="badge" :text="goodsData.allCount+''" type="success">
<text class="text" @click="navToTabPage('../../pagesC/seller/goods?status=0')">所有商品</text>
</uni-grid-item>
</uni-grid>
</view>
<!-- <mallplusCopyright></mallplusCopyright> -->
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import coupon from '@/components/coolc-coupon/coolc-coupon';
import {
formatDate
} from '@/common/date';
import uniGrid from "@/components/uni-grid/uni-grid.vue"
import uniGridItem from "@/components/uni-grid-item/uni-grid-item.vue"
export default {
components: {
mallplusCopyright,
coupon,
uniGrid,
uniGridItem
},
data() {
return {
keyword: '',
titleNViewBackground: '',
swiperCurrent: 0,
swiperLength: 0,
carouselList: [],
orderData: '',
goodsData: '',
userData: '',
orderStatusCount: ''
};
},
onShow: function() {
this.loadData();
},
onLoad(ops) {
this.loadData();
},
methods: {
/**
* 请求静态数据只是为了代码不那么乱
* 分次请求未作整合
*/
async loadData() {
let adminToken = uni.getStorageSync('adminToken') || '';
console.log('adminToken:' + adminToken)
if (!adminToken) {
uni.navigateTo({
url: '../../pagesC/seller/login'
});
return
}
let params = {};
let orderResp = await Api.apiAdminCall('get', Api.admin.orderStatic, params, true);
this.orderData = orderResp;
this.orderStatusCount = orderResp.orderStatusCount
let goodsResp = await Api.apiAdminCall('get', Api.admin.goodsStatic, params);
this.goodsData = goodsResp;
let userResp = await Api.apiAdminCall('get', Api.admin.userStatic, params);
this.userData = userResp;
let data = await Api.apiAdminCall('get', Api.admin.bannerList, params);
this.carouselList = data.records || [];
this.swiperLength = this.carouselList.length;
this.titleNViewBackground = 'rgb(203, 87, 60)';
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
},
//轮播图切换修改背景色
swiperChange(e) {
const index = e.detail.current;
this.swiperCurrent = index;
this.titleNViewBackground = this.carouselList[index].background;
},
navToTabPage(url) {
uni.navigateTo({
url: url
});
},
//详情页
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/product?id=${id}`
});
},
//详情页
navToDetailPageL(url) {
window.location.href = url;
},
//详情页
navToCouponDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/product?id=${id}`
});
},
async acceptCoupon(item) {
uni.showLoading({
title: '请稍后'
});
let params = {
couponId: item.id
};
let data = await Api.apiAdminCall('post', Api.admin.acceptCoupon, params);
console.log(data);
if (data) {
this.$api.msg(data);
}
uni.hideLoading();
},
navToSkillDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/secskillDetail?id=${id}`
});
},
navToGroupDetailPage(item) {
//测试数据没有写id用title代替
let id = item.goodsId;
let groupId = item.groupId;
uni.navigateTo({
url: `/pages/product/groupProduct?id=${id}&&groupId=&{groupId}`
});
},
navToList() {
uni.navigateTo({
url: `/pages/product/list`
});
}
},
search() {
uni.navigateTo({
url: '/pages/search/search'
});
},
// 标题栏input搜索框点击
onNavigationBarSearchInputClicked: async function(e) {
uni.navigateTo({
url: '/pages/search/search'
});
},
//点击导航栏 buttons 时触发
onNavigationBarButtonTap(e) {
const index = e.index;
if (index === 0) {
this.$api.msg('点击了扫描');
} else if (index === 1) {
// #ifdef APP-PLUS
const pages = getCurrentPages();
const page = pages[pages.length - 1];
const currentWebview = page.$getAppWebview();
currentWebview.hideTitleNViewButtonRedDot({
index
});
// #endif
uni.navigateTo({
url: '../../pagesU/notice/notice'
});
}
}
};
</script>
<style lang="scss">
.mp-search-box {
position: absolute;
left: 0;
top: 30upx;
z-index: 9999;
width: 100%;
padding: 0 80upx;
.ser-input {
flex: 1;
height: 56upx;
line-height: 56upx;
text-align: center;
font-size: 28upx;
color: $font-color-base;
border-radius: 20px;
background: rgba(255, 255, 255, 0.6);
}
}
page {
.cate-section {
position: relative;
z-index: 5;
border-radius: 16upx 16upx 0 0;
margin-top: -20upx;
}
.carousel-section {
padding: 0;
.titleNview-placing {
padding-top: 0;
height: 0;
}
.carousel {
.carousel-item {
padding: 0;
}
}
.swiper-dots {
left: 45upx;
bottom: 40upx;
}
}
}
page {
background: #f5f5f5;
}
.m-t {
margin-top: 16upx;
}
/* 头部 轮播图 */
.carousel-section {
position: relative;
padding-top: 10px;
.titleNview-placing {
height: var(--status-bar-height);
padding-top: 44px;
box-sizing: content-box;
}
.titleNview-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 426upx;
transition: 0.4s;
}
}
.carousel {
width: 100%;
height: 350upx;
.carousel-item {
width: 100%;
height: 100%;
padding: 0 28upx;
overflow: hidden;
}
image {
width: 100%;
height: 100%;
border-radius: 10upx;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 60upx;
bottom: 15upx;
width: 72upx;
height: 36upx;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAYAAADDhn8LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTk4MzlBNjE0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTk4MzlBNjA0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6Q0E3RUNERkE0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6Q0E3RUNERkI0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4Gh5BPAAACTUlEQVR42uzcQW7jQAwFUdN306l1uWwNww5kqdsmm6/2MwtVCp8CosQtP9vg/2+/gY+DRAMBgqnjIp2PaCxCLLldpPARRIiFj1yBbMV+cHZh9PURRLQNhY8kgWyL/WDtwujjI8hoE8rKLqb5CDJaRMJHokC6yKgSCR9JAukmokIknCQJpLOIrJFwMsBJELFcKHwM9BFkLBMKFxNcBCHlQ+FhoocgpVwwnv0Xn30QBJGMC0QcaBVJiAMiec/dcwKuL4j1QMsVCXFAJE4s4NQA3K/8Y6DzO4g40P7UcmIBJxbEesCKWBDg8wWxHrAiFgT4fEGsB/CwIhYE+AeBAAdPLOcV8HRmWRDAiQVcO7GcV8CLM8uCAE4sQCDAlHcQ7x+ABQEEAggEEAggEEAggEAAgQACASAQQCCAQACBAAIBBAIIBBAIIBBAIABe4e9iAe/xd7EAJxYgEGDeO4j3EODp/cOCAE4sYMyJ5cwCHs4rCwI4sYBxJ5YzC84rCwKcXxArAuthQYDzC2JF0H49LAhwYUGsCFqvx5EF2T07dMaJBetx4cRyaqFtHJ8EIhK0i8OJBQxcECuCVutxJhCRoE0cZwMRyRcFefa/ffZBVPogePihhyCnbBhcfMFFEFM+DD4m+ghSlgmDkwlOgpAl4+BkkJMgZdk4+EgaSCcpVX7bmY9kgXQQU+1TgE0c+QJZUUz1b2T4SBbIKmJW+3iMj2SBVBWz+leVfCQLpIqYbp8b85EskIxyfIOfK5Sf+wiCRJEsllQ+oqEkQfBxmD8BBgA5hVjXyrBNUQAAAABJRU5ErkJggg==);
background-size: 100% 100%;
.num {
width: 36upx;
height: 36upx;
border-radius: 50px;
font-size: 24upx;
color: #fff;
text-align: center;
line-height: 36upx;
}
.sign {
position: absolute;
top: 0;
left: 50%;
line-height: 36upx;
font-size: 12upx;
color: #fff;
transform: translateX(-50%);
}
}
/* 分类 */
.cate-section {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
padding: 30upx 22upx;
background: #fff;
.cate-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: $font-sm + 2upx;
color: $font-color-dark;
}
/* 原图标颜色太深,不想改图了,所以加了透明度 */
image {
width: 88upx;
height: 88upx;
margin-bottom: 14upx;
border-radius: 50%;
opacity: 0.7;
box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
}
}
.ad-1 {
width: 100%;
height: 210upx;
padding: 10upx 0;
background: #fff;
image {
width: 100%;
height: 100%;
}
}
/* 秒杀专区 */
.seckill-section {
padding: 4upx 30upx 24upx;
background: #fff;
.s-header {
display: flex;
align-items: center;
height: 92upx;
line-height: 1;
.s-img {
width: 140upx;
height: 30upx;
}
.tip {
font-size: $font-base;
color: $font-color-light;
margin: 0 20upx 0 40upx;
}
.timer {
display: inline-block;
width: 40upx;
height: 36upx;
text-align: center;
line-height: 36upx;
margin-right: 14upx;
font-size: $font-sm + 2upx;
color: #fff;
border-radius: 2px;
background: rgba(0, 0, 0, 0.8);
}
.icon-you {
font-size: $font-lg;
color: $font-color-light;
flex: 1;
text-align: right;
}
}
.floor-list {
white-space: nowrap;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 150upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 150upx;
height: 150upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
}
.f-header {
display: flex;
align-items: center;
height: 140upx;
padding: 6upx 30upx 8upx;
background: #fff;
image {
flex-shrink: 0;
width: 80upx;
height: 80upx;
margin-right: 20upx;
}
.tit-box {
flex: 1;
display: flex;
flex-direction: column;
}
.tit {
font-size: $font-lg + 2upx;
color: #font-color-dark;
line-height: 1.3;
}
.tit2 {
font-size: $font-sm;
color: $font-color-light;
}
.icon-you {
font-size: $font-lg + 2upx;
color: $font-color-light;
}
}
/* 团购楼层 */
.group-section {
background: #fff;
.g-swiper {
height: 650upx;
padding-bottom: 30upx;
}
.g-swiper-item {
width: 100%;
padding: 0 30upx;
display: flex;
}
image {
width: 100%;
height: 460upx;
border-radius: 4px;
}
.g-item {
display: flex;
flex-direction: column;
overflow: hidden;
}
.left {
flex: 1.2;
margin-right: 24upx;
.t-box {
padding-top: 20upx;
}
}
.right {
flex: 0.8;
flex-direction: column-reverse;
.t-box {
padding-bottom: 20upx;
}
}
.t-box {
height: 160upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1.6;
}
.price {
color: $uni-color-primary;
}
.m-price {
font-size: $font-sm + 2upx;
text-decoration: line-through;
color: $font-color-light;
margin-left: 8upx;
}
.pro-box {
display: flex;
align-items: center;
margin-top: 10upx;
font-size: $font-sm;
color: $font-base;
padding-right: 10upx;
}
.progress-box {
flex: 1;
border-radius: 10px;
overflow: hidden;
margin-right: 8upx;
}
}
/* 分类推荐楼层 */
.hot-floor {
width: 100%;
overflow: hidden;
margin-bottom: 20upx;
.floor-img-box {
width: 100%;
height: 320upx;
position: relative;
&:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(rgba(255, 255, 255, 0.06) 30%, #f8f8f8);
}
}
.floor-img {
width: 100%;
height: 100%;
}
.floor-list {
white-space: nowrap;
padding: 20upx;
padding-right: 50upx;
border-radius: 6upx;
margin-top: -140upx;
margin-left: 30upx;
background: #fff;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
position: relative;
z-index: 1;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 180upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 180upx;
height: 180upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
.more {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
flex-shrink: 0;
width: 180upx;
height: 180upx;
border-radius: 6upx;
background: #f3f3f3;
font-size: $font-base;
color: $font-color-light;
text:first-child {
margin-bottom: 4upx;
}
}
}
/* 单条商品 */
.goods-box-single {
display: flex;
padding: 20upx 0;
.goods-img {
display: block;
width: 120upx;
height: 120upx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
padding: 0 30upx 0 24upx;
overflow: hidden;
.title {
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1;
}
.attr-box {
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.num {
margin: 0 8upx;
color: $font-color-dark;
}
.price {
font-size: $font-lg;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
.action-box {
display: flex;
justify-content: flex-end;
align-items: center;
height: 100upx;
position: relative;
padding-right: 30upx;
}
.action-btn {
width: 160upx;
height: 60upx;
margin: 0;
margin-left: 24upx;
padding: 0;
text-align: center;
line-height: 60upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
background: #fff;
border-radius: 100px;
&:after {
border-radius: 100px;
}
&.recom {
background: #fff9f9;
color: $base-color;
&:after {
border-color: #f7bcc8;
}
}
}
/* 猜你喜欢 */
.guess-section {
display: flex;
flex-wrap: wrap;
padding: 0 30upx;
background: #fff;
.guess-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
}
.coupon_box {
width: 100%;
height: auto;
display: table;
padding: 6upx 26upx 26upx 26upx;
}
.other_type {
width: 100%;
height: 90upx;
padding-top: 50upx;
.text {
width: 100%;
border-top: 1px solid #eeeeee;
display: block;
text-align: center;
position: relative;
}
.text span {
width: 180upx;
height: 40upx;
line-height: 40upx;
color: #999999;
display: block;
background: #ffffff;
position: absolute;
left: 50%;
top: 50%;
margin-left: -90upx;
margin-top: -20upx;
font-size: $font-base;
}
}
}
</style>

View File

@@ -0,0 +1,239 @@
<template>
<view class="container">
<view class="left-bottom-sign"></view>
<view class="right-top-sign"></view>
<!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
<view class="wrapper">
<view class="left-top-sign">LOGIN</view>
<view class="welcome">欢迎回来</view>
<view class="input-content">
<view class="input-item">
<text class="tit">手机号码</text>
<input type="text" v-model="username" placeholder="请输入手机号码" />
</view>
<view class="input-item">
<text class="tit">密码</text>
<input type="password" placeholder="请输入密码" v-model="password" @confirm="toLogin" />
</view>
</view>
<button class="confirm-btn" @click="toLogin" :disabled="logining">登录</button>
<view class="forget-section">忘记密码?</view>
</view>
<view class="register-section">
还没有账号?
<text @click="toRegist">马上注册</text>
</view>
<!-- <mallplusCopyright></mallplusCopyright> -->
</view>
</template>
<script>
import { mapMutations, mapState } from 'vuex';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import store from '@/store/index';
export default {
components: {
mallplusCopyright
},
data() {
return {
username: 'admin',
password: '123456',
logining: false
};
},
onLoad() {},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
...mapMutations(['login']),
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.switchTab({
url: '/pages/index/user'
});
},
toRegist() {
uni.navigateTo({
url: '/pages/public/reg'
});
},
async toLogin() {
try {
if (this.username == '') {
throw '请填写手机号';
}
if (this.password == '') {
throw '请填写密码';
}
} catch (err) {
this.$api.msg(err);
return;
}
this.logining = true;
let params = { username: this.username, password: this.password };
let data = await Api.apiAdminCall('post', Api.admin.login, params);
this.logining = false;
if (data) {
console.log(data);
this.$db.set('adminToken', data.tokenHead+data.token);
uni.navigateTo({
url: '../../pagesC/seller/index'
});
}
},
}
};
</script>
<style lang="scss">
page {
background: #fff;
}
.container {
padding-top: 115px;
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;
background: #fff;
}
.wrapper {
position: relative;
z-index: 90;
background: #fff;
padding-bottom: 40upx;
}
.back-btn {
position: absolute;
left: 40upx;
z-index: 9999;
padding-top: var(--status-bar-height);
top: 40upx;
font-size: 40upx;
color: $font-color-dark;
}
.left-top-sign {
font-size: 120upx;
color: $page-color-base;
position: relative;
left: -16upx;
}
.right-top-sign {
position: absolute;
top: 80upx;
right: -30upx;
z-index: 95;
&:before,
&:after {
display: block;
content: '';
width: 400upx;
height: 80upx;
background: #b4f3e2;
}
&:before {
transform: rotate(50deg);
border-radius: 0 50px 0 0;
}
&:after {
position: absolute;
right: -198upx;
top: 0;
transform: rotate(-50deg);
border-radius: 50px 0 0 0;
/* background: pink; */
}
}
.left-bottom-sign {
position: absolute;
left: -270upx;
bottom: -320upx;
border: 100upx solid #d0d1fd;
border-radius: 50%;
padding: 180upx;
}
.welcome {
position: relative;
left: 50upx;
top: -90upx;
font-size: 46upx;
color: #555;
text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
}
.input-content {
padding: 0 60upx;
}
.input-item {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
padding: 0 30upx;
background: $page-color-light;
height: 120upx;
border-radius: 4px;
margin-bottom: 50upx;
&:last-child {
margin-bottom: 0;
}
.tit {
height: 50upx;
line-height: 56upx;
font-size: $font-sm + 2upx;
color: $font-color-base;
}
input {
height: 60upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
width: 100%;
}
}
.confirm-btn {
width: 630upx;
height: 76upx;
line-height: 76upx;
border-radius: 50px;
margin-top: 70upx;
background: $uni-color-primary;
color: #fff;
font-size: $font-lg;
&:after {
border-radius: 100px;
}
}
.forget-section {
font-size: $font-sm + 2upx;
color: $font-color-spec;
text-align: center;
margin-top: 40upx;
}
.register-section {
position: absolute;
left: 0;
bottom: 50upx;
width: 100%;
font-size: $font-sm + 2upx;
color: $font-color-base;
text-align: center;
text {
color: $font-color-spec;
margin-left: 10upx;
}
}
</style>

View File

@@ -0,0 +1,567 @@
<template>
<view class="content">
<!-- 空白页 -->
<!-- 订单列表 -->
<view v-for="(item, index) in orderList" :key="index" class="order-item" >
<view class="i-top b-b">
<text class="time" @click="navToDetailPage(item)">{{ item.createTime }}</text>
<text class="state" :style="{ color: item.stateTipColor }" @click="navToDetailPage(item)">{{ item.id }}--</text>
<text class="state" :style="{ color: item.stateTipColor }" @click="navToDetailPage(item)">{{ item.username }}</text>
</view>
<view class="goods-box-single" >
<img class="goods-img" :src="item.icon" mode="aspectFill"></img>
<view class="right" @click="navToDetailPage(item)">
<text class="title clamp">余额{{ item.blance }}</text>
<text class="attr-box"> 积分{{ item.integration }}</text>
</view>
</view>
<view class="action-box b-t">
<button v-if="status == 1" class="action-btn" @click="updatePublishStatus(item)">下架</button>
<button v-if="status == 2" class="action-btn recom" @click="updatePublishStatus(item)">上架</button>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</view>
</template>
<script>
import { mapState } from 'vuex';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
import { formatDate } from '@/common/date';
export default {
components: {
uniLoadMore,
empty
},
data() {
return {
tabCurrentIndex: 0,
pageNum: 1,
orderList:[],
status:0,
headerPosition: 'fixed',
headerTop: '0px',
loadingType: 'more', //加载更多状态
};
},
onLoad(options) {
/**
* 修复app端点击除全部订单外的按钮进入时不加载数据的问题
* 替换onLoad下代码即可
*/
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = 1;
console.log('1='+this.pageNum)
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = 1;
console.log('2='+this.pageNum)
this.loadData();
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/product?id=${id}`
});
},
//获取订单列表
async loadData(type = 'add', loading) {
//这里是将订单挂载到tab列表下
let index = this.tabCurrentIndex;
if (!this.hasLogin) {
url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
let params = { pageNum: this.pageNum };
let data = await Api.apiAdminCall('get', Api.admin.memberList, params);
let orderList1 = data.records;
let orderList = orderList1.filter(item => {
//添加不同状态下订单的表现形式
item.createTime = this.dateFormat(item.createTime);
return item;
});
if (type === 'refresh') {
this.orderList = [];
}
this.orderList = this.orderList.concat(orderList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.orderList.length > data.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
}
},
//swiper 切换
changeTab(e) {
this.tabCurrentIndex = e.target.current;
this.loadData('refresh');
},
//顶部tab点击
tabClick(index) {
this.tabCurrentIndex = index;
},
// 上下架
async updatePublishStatus(item) {
let publishStatus =0;
if (item.publishStatus==1){
publishStatus=0;
}else {
publishStatus=1;
}
let params = { id: item.id,status:publishStatus };
let data = await Api.apiAdminCall('post', Api.admin.updatePublishStatus, params);
if (data) {
this.$api.msg(data);
if (item.publishStatus==1){
this.tabCurrentIndex = 2;
}else {
this.tabCurrentIndex = 1;
}
}
},
//取消订单
async cancelOrder(item) {
let params = { orderId: item.id };
let data = await Api.apiAdminCall('post', Api.admin.closeOrder, params);
if (data) {
this.$api.msg(data);
this.tabCurrentIndex = 4;
}
},
//订单确认收货
async confimDelivery(item) {
let params = { id: item.id };
let data = await Api.apiAdminCall('post', Api.admin.confimDelivery, params);
console.log(data);
if (data) {
this.$api.msg(data);
this.tabCurrentIndex = 4;
}
},
//订单申请退款
async applyRefund(item) {
let params = { id: item.id };
let data = await Api.apiAdminCall('post', Api.admin.applyRefund, params);
if (data) {
console.log(data);
this.$api.msg(data);
}
this.tabCurrentIndex = 5;
},
// 去评价
toEvaluate(orderId) {
this.$common.navigateTo(
'/pages/order/evaluate?order_id=' + orderId
)
},
//订单状态文字和颜色
orderStateExp(value) {
let stateTip = '',
stateTipColor = '#fa436a';
if (value === 1) {
stateTipColor = '#909399';
stateTip = '出售中';
}if (value === 2) {
stateTip = '已下架';
} else if (value === 3) {
stateTip = '已售尽';
}
return { stateTip, stateTipColor };
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.swiper-box {
height: calc(100% - 40px);
}
.list-scroll-content {
height: 100%;
}
.navbar {
display: flex;
height: 40px;
padding: 0 5px;
background: #fff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
position: relative;
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 15px;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 44px;
height: 0;
border-bottom: 2px solid $base-color;
}
}
}
}
.uni-swiper-item {
height: auto;
}
.order-item {
display: flex;
flex-direction: column;
padding-left: 30upx;
background: #fff;
margin-top: 16upx;
.i-top {
display: flex;
align-items: center;
height: 80upx;
padding-right: 30upx;
font-size: $font-base;
color: $font-color-dark;
position: relative;
.time {
flex: 1;
}
.state {
color: $base-color;
}
.del-btn {
padding: 10upx 0 10upx 36upx;
font-size: $font-lg;
color: $font-color-light;
position: relative;
&:after {
content: '';
width: 0;
height: 30upx;
border-left: 1px solid $border-color-dark;
position: absolute;
left: 20upx;
top: 50%;
transform: translateY(-50%);
}
}
}
/* 多条商品 */
.goods-box {
height: 160upx;
padding: 20upx 0;
white-space: nowrap;
.goods-item {
width: 120upx;
height: 120upx;
display: inline-block;
margin-right: 24upx;
}
.goods-img {
display: block;
width: 100%;
height: 100%;
}
}
/* 单条商品 */
.goods-box-single {
display: flex;
padding: 20upx 0;
.goods-img {
display: block;
width: 120upx;
height: 120upx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
padding: 0 30upx 0 24upx;
overflow: hidden;
.title {
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1;
}
.attr-box {
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.num {
margin: 0 8upx;
color: $font-color-dark;
}
.price {
font-size: $font-lg;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
.action-box {
display: flex;
justify-content: flex-end;
align-items: center;
height: 100upx;
position: relative;
padding-right: 30upx;
}
.action-btn {
width: 160upx;
height: 60upx;
margin: 0;
margin-left: 24upx;
padding: 0;
text-align: center;
line-height: 60upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
background: #fff;
border-radius: 100px;
&:after {
border-radius: 100px;
}
&.recom {
background: #fff9f9;
color: $base-color;
&:after {
border-color: #f7bcc8;
}
}
}
}
/* load-more */
.uni-load-more {
display: flex;
flex-direction: row;
height: 80upx;
align-items: center;
justify-content: center;
}
.uni-load-more__text {
font-size: 28upx;
color: #999;
}
.uni-load-more__img {
height: 24px;
width: 24px;
margin-right: 10px;
}
.uni-load-more__img > view {
position: absolute;
}
.uni-load-more__img > view view {
width: 6px;
height: 2px;
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
background: #999;
position: absolute;
opacity: 0.2;
transform-origin: 50%;
animation: load 1.56s ease infinite;
}
.uni-load-more__img > view view:nth-child(1) {
transform: rotate(90deg);
top: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(2) {
transform: rotate(180deg);
top: 11px;
right: 0;
}
.uni-load-more__img > view view:nth-child(3) {
transform: rotate(270deg);
bottom: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(4) {
top: 11px;
left: 0;
}
.load1,
.load2,
.load3 {
height: 24px;
width: 24px;
}
.load2 {
transform: rotate(30deg);
}
.load3 {
transform: rotate(60deg);
}
.load1 view:nth-child(1) {
animation-delay: 0s;
}
.load2 view:nth-child(1) {
animation-delay: 0.13s;
}
.load3 view:nth-child(1) {
animation-delay: 0.26s;
}
.load1 view:nth-child(2) {
animation-delay: 0.39s;
}
.load2 view:nth-child(2) {
animation-delay: 0.52s;
}
.load3 view:nth-child(2) {
animation-delay: 0.65s;
}
.load1 view:nth-child(3) {
animation-delay: 0.78s;
}
.load2 view:nth-child(3) {
animation-delay: 0.91s;
}
.load3 view:nth-child(3) {
animation-delay: 1.04s;
}
.load1 view:nth-child(4) {
animation-delay: 1.17s;
}
.load2 view:nth-child(4) {
animation-delay: 1.3s;
}
.load3 view:nth-child(4) {
animation-delay: 1.43s;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
</style>

View File

@@ -0,0 +1,178 @@
<template>
<view class="content">
<view class="scroll-top" >
<time-filter @chooseTime='chooseTime' :type="type"></time-filter>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">订单数量</view>
<view class="right">{{homedata.orderCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="当月订单" :titleTwo="homedata.nowOrderCount" bg="#fbad4c" :percent="(homedata.nowOrderCount*100/homedata.orderCount) | numFilter"></circle-percent>
<circle-percent titleOne="当月总额" :titleTwo="homedata.nowOrderPay" bg="#87d7a5" :percent="(homedata.nowOrderCount*100/homedata.orderCount) | numFilter"></circle-percent>
</view>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">会员统计</view>
<view class="right">{{homedata.memberCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="当月新增会员" :titleTwo="homedata.mallCount+homedata.femallount" bg="#87d7a5" :percent="((homedata.mallCount+homedata.femallount)/homedata.memberCount)| numFilter"></circle-percent>
<circle-percent titleOne="男会员" :titleTwo="homedata.mallCount" bg="#00adc7" :percent="(homedata.mallCount/homedata.memberCount)| numFilter"></circle-percent>
<circle-percent titleOne="女会员" :titleTwo="homedata.femallount" bg="#FF6A6A" :percent="(homedata.femallount/homedata.memberCount)| numFilter"></circle-percent>
</view>
</view>
<view class="part tj padding">
<view class="tjTitle">
<view class="left">商品统计</view>
<view class="right">{{homedata.goodsCount}}</view>
</view>
<view class="tjBody flexRow">
<circle-percent titleOne="新增商品" :titleTwo="homedata.onCount+homedata.offCount" bg="#87d7a5" :percent="((homedata.onCount+homedata.offCount)/homedata.goodsCount)| numFilter"></circle-percent>
<circle-percent titleOne="下架商品" :titleTwo="homedata.offCount" bg="#00adc7" :percent="(homedata.offCount/homedata.goodsCount)| numFilter"></circle-percent>
<circle-percent titleOne="缺库存商品" :titleTwo="homedata.noStock" bg="#FF6A6A" :percent="(homedata.noStock/homedata.goodsCount)| numFilter"></circle-percent>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import timeFilter from '@/components/time-filter/time-filter'
import circlePercent from '@/components/circle-percent/circle-percent'
import { formatDate } from '@/common/date';
export default {
data() {
return {
date: '2019-11-01',
homedata:null,
singleElection: false,
type: 'month'
}
},
components: {
timeFilter,
circlePercent
},
onLoad() {
},
async onShow() {
this.date = this.dateFormat(new Date());
let params = {date:this.date,type:2};
let resp = await Api.apiAdminCall('get', Api.admin.dayStatic, params,true);
console.log(resp)
this.homedata = resp;
},
computed: {
},
methods: {
async chooseTime(item, index) {
let params = {date:this.getMonth(item.value),type:2};
let resp = await Api.apiAdminCall('get', Api.admin.dayStatic, params,true);
console.log(resp)
this.homedata = resp;
},
addDate(days) {
var d = new Date();
d.setDate(d.getDate() + days);
var m = d.getMonth() + 1;
if(m < 10){
m='0'+m
}
var day = d.getDate()
if(day < 10){
day='0'+day
}
return d.getFullYear() + '-' + m + '-' + day;
},
getMonth(month) {
var time = new Date();
time.setMonth(time.getMonth() + month);//设置month月后的时间
var y = time.getFullYear();
var m = time.getMonth() + 1;//获取当前月份
var d = time.getDate();
if(m<10){
m = "0"+m
}
return y + "-" + m + '-' + d;
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd');
}
}
,filters: {
numFilter (value) {
let realVal = ''
if (value) {
// 截取当前数据到小数点后两位
realVal = parseFloat(value).toFixed(2)
} else {
realVal = '0'
}
return realVal
}
}
}
</script>
<style lang="scss">
.content{
background-color: $uni-bg-color;
}
.part{
background: $uni-bg-color;
font-size: $uni-font-size-lg;
color: $uni-text-color;
margin-bottom: 20upx;
}
.padding {
padding: 30upx 40upx;
}
.flexRow{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
}
.tj{
margin-bottom: 0;
padding-bottom: 0;
.tjTitle{
display: flex;
flex-direction: row;
border-bottom: 1upx solid #ebedf0;
padding: 40upx 0;
.left{
flex: 1;
text-align: left;
font-size: $uni-font-size-base;
font-weight: bold;
}
.right{
flex: 1;
text-align: right;
color: $uni-text-color-grey;
}
}
.tjBody{
justify-content: flex-start;
border-bottom: 1upx solid #f5f5f5;
}
}
</style>

View File

@@ -0,0 +1,648 @@
<template>
<view class="content">
<view class="navbar">
<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
</view>
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData" >
<!-- 空白页 -->
<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
<!-- 订单列表 -->
<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item" >
<view class="i-top b-b">
<text class="time" @click="navToDetailPage(item)">{{ item.createTime }}</text>
<text class="state" :style="{ color: item.stateTipColor }" @click="navToDetailPage(item)">{{ item.id }}--</text>
<text class="state" :style="{ color: item.stateTipColor }" @click="navToDetailPage(item)">{{ item.stateTip }}</text>
<text v-if="item.status === 12" class="del-btn yticon icon-iconfontshanchu1" @click="cancelOrder(index)"></text>
</view>
<scroll-view v-if="item.orderItemList.length > 1" class="goods-box" scroll-x>
<view v-for="(goodsItem, goodsIndex) in item.orderItemList" :key="goodsIndex" class="goods-item">
<img class="goods-img" :src="goodsItem.productPic" @click="navToDetailPage(item)" mode="aspectFill"></img>
</view>
</scroll-view>
<view v-if="item.orderItemList.length === 1" class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.orderItemList" :key="goodsIndex">
<img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img>
<view class="right" @click="navToDetailPage(item)">
<text class="title clamp">{{ goodsItem.productName }}</text>
<text class="attr-box">{{ goodsItem.productAttr }} x {{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }}</text>
</view>
</view>
<view class="price-box">
<text class="num">{{ item.orderItemList.length }}</text>
件商品 实付款
<text class="price">{{ item.payAmount }}</text>
</view>
<view class="action-box b-t">
<text class="state" :style="{ color: item.stateTipColor }" v-if="item.orderType== 6">秒杀订单</text>
<text class="state" :style="{ color: item.stateTipColor }" v-else-if="item.orderType== 2">拼团订单</text>
<text class="state" :style="{ color: item.stateTipColor }" v-else-if="item.orderType== 3">团购订单</text>
<text class="state" :style="{ color: item.stateTipColor }" v-else-if="item.orderType== 4">砍价订单</text>
<text class="state" :style="{ color: item.stateTipColor }" v-else-if="item.orderType== 5">积分订单</text>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import { mapState } from 'vuex';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
import { formatDate } from '@/common/date';
export default {
components: {
uniLoadMore,
empty
},
data() {
return {
tabCurrentIndex: 0,
pageNum: 1,
orderList:[],
headerPosition: 'fixed',
headerTop: '0px',
loadingType: 'more', //加载更多状态
navList: [
{
status: 0,
text: '全部',
loadingType: 'more',
orderList: []
},
{
status: 12,
text: '待付款',
loadingType: 'more',
orderList: []
},
{
status: 2,
text: '待发货',
loadingType: 'more',
orderList: []
},
{
status: 3,
text: '已发货',
loadingType: 'more',
orderList: []
},
{
status: 5,
text: '已完成',
loadingType: 'more',
orderList: []
},
{
status: 13,
text: '申请退款',
loadingType: 'more',
orderList: []
}
]
};
},
onLoad(options) {
/**
* 修复app端点击除全部订单外的按钮进入时不加载数据的问题
* 替换onLoad下代码即可
*/
this.tabCurrentIndex = +options.status;
this.pageNum = 1;
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = 1;
console.log('1='+this.pageNum)
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = 1;
console.log('2='+this.pageNum)
this.loadData();
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/index/orderDetail?id=${id}`
});
},
//获取订单列表
async loadData(type = 'add', loading) {
//这里是将订单挂载到tab列表下
let index = this.tabCurrentIndex;
let navItem = this.navList[index];
let status = navItem.status;
if (!this.hasLogin) {
url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
let params = { pageNum: this.pageNum, status: status };
let data = await Api.apiAdminCall('get', Api.admin.orderList, params);
let goodsList = data.records;
let orderList = goodsList.filter(item => {
//添加不同状态下订单的表现形式
item = Object.assign(item, this.orderStateExp(item.status));
item.createTime = this.dateFormat(item.createTime);
//演示数据所以自己进行状态筛选
if (status === 0) {
//0为全部订单
return item;
}
return item.status === status;
});
if (type === 'refresh') {
this.orderList = [];
}
this.orderList = this.orderList.concat(orderList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.orderList.length >= data.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
this.pageNum = this.pageNum + 1;
orderList.forEach(item => {
navItem.orderList.push(item);
});
}
},
//swiper 切换
changeTab(e) {
this.pageNum = 1;
this.tabCurrentIndex = e.target.current;
this.loadData('refresh');
},
//顶部tab点击
tabClick(index) {
this.pageNum = 1;
this.tabCurrentIndex = index;
},
//删除订单
async deleteOrder(index) {
uni.showLoading({
title: '请稍后'
});
setTimeout(() => {
this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
uni.hideLoading();
}, 600);
},
async payOrder(item) {
this.$common.navigateTo(
'/pages/money/pay?id=' + item.id
)
},
//取消订单
async cancelOrder(item) {
let params = { orderId: item.id };
let data = await Api.apiAdminCall('post', Api.admin.closeOrder, params);
if (data) {
this.$api.msg(data);
this.tabCurrentIndex = 4;
}
},
//订单申请退款
async applyRefund(item) {
let params = { id: item.id };
let data = await Api.apiAdminCall('post', Api.admin.applyRefund, params);
if (data) {
console.log(data);
this.$api.msg(data);
}
this.tabCurrentIndex = 5;
},
// 去评价
toEvaluate(orderId) {
this.$common.navigateTo(
'/pages/order/evaluate?order_id=' + orderId
)
},
//订单状态文字和颜色
orderStateExp(value) {
let stateTip = '',
stateTipColor = '#fa436a';
if (value === 12) {
stateTipColor = '#909399';
stateTip = '待付款';
}if (value === 1) {
stateTipColor = '#909399';
stateTip = '支付成功,没有回掉';
}if (value === 2) {
stateTip = '待发货';
} else if (value === 3) {
stateTip = '待收货';
} else if (value === 4) {
stateTip = '待评价';
} else if (value === 5) {
stateTip = '已完成';
} else if (value === 6) {
stateTipColor = '#909399';
stateTip = '维权中';
} else if (value === 7) {
stateTip = ' 维权已完成';
} else if (value === 8) {
stateTip = '待分享';
} else if (value === 13) {
stateTip = '申请退款';
} else if (value === 14) {
stateTip = '已退款';
} else if (value === 15) {
stateTip = '已关闭';
} else if (value === 16) {
stateTip = '无效订单';
} else {
stateTip = '待付款';
}
return { stateTip, stateTipColor };
},
dateFormat(time) {
console.log(time)
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.swiper-box {
height: calc(100% - 40px);
}
.list-scroll-content {
height: 100%;
}
.navbar {
display: flex;
height: 40px;
padding: 0 5px;
background: #fff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
position: relative;
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 15px;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 44px;
height: 0;
border-bottom: 2px solid $base-color;
}
}
}
}
.uni-swiper-item {
height: auto;
}
.order-item {
display: flex;
flex-direction: column;
padding-left: 30upx;
background: #fff;
margin-top: 16upx;
.i-top {
display: flex;
align-items: center;
height: 80upx;
padding-right: 30upx;
font-size: $font-base;
color: $font-color-dark;
position: relative;
.time {
flex: 1;
}
.state {
color: $base-color;
}
.del-btn {
padding: 10upx 0 10upx 36upx;
font-size: $font-lg;
color: $font-color-light;
position: relative;
&:after {
content: '';
width: 0;
height: 30upx;
border-left: 1px solid $border-color-dark;
position: absolute;
left: 20upx;
top: 50%;
transform: translateY(-50%);
}
}
}
/* 多条商品 */
.goods-box {
height: 160upx;
padding: 20upx 0;
white-space: nowrap;
.goods-item {
width: 120upx;
height: 120upx;
display: inline-block;
margin-right: 24upx;
}
.goods-img {
display: block;
width: 100%;
height: 100%;
}
}
/* 单条商品 */
.goods-box-single {
display: flex;
padding: 20upx 0;
.goods-img {
display: block;
width: 120upx;
height: 120upx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
padding: 0 30upx 0 24upx;
overflow: hidden;
.title {
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1;
}
.attr-box {
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.num {
margin: 0 8upx;
color: $font-color-dark;
}
.price {
font-size: $font-lg;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
.action-box {
display: flex;
justify-content: flex-end;
align-items: center;
height: 100upx;
position: relative;
padding-right: 30upx;
}
.action-btn {
width: 160upx;
height: 60upx;
margin: 0;
margin-left: 24upx;
padding: 0;
text-align: center;
line-height: 60upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
background: #fff;
border-radius: 100px;
&:after {
border-radius: 100px;
}
&.recom {
background: #fff9f9;
color: $base-color;
&:after {
border-color: #f7bcc8;
}
}
}
}
/* load-more */
.uni-load-more {
display: flex;
flex-direction: row;
height: 80upx;
align-items: center;
justify-content: center;
}
.uni-load-more__text {
font-size: 28upx;
color: #999;
}
.uni-load-more__img {
height: 24px;
width: 24px;
margin-right: 10px;
}
.uni-load-more__img > view {
position: absolute;
}
.uni-load-more__img > view view {
width: 6px;
height: 2px;
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
background: #999;
position: absolute;
opacity: 0.2;
transform-origin: 50%;
animation: load 1.56s ease infinite;
}
.uni-load-more__img > view view:nth-child(1) {
transform: rotate(90deg);
top: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(2) {
transform: rotate(180deg);
top: 11px;
right: 0;
}
.uni-load-more__img > view view:nth-child(3) {
transform: rotate(270deg);
bottom: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(4) {
top: 11px;
left: 0;
}
.load1,
.load2,
.load3 {
height: 24px;
width: 24px;
}
.load2 {
transform: rotate(30deg);
}
.load3 {
transform: rotate(60deg);
}
.load1 view:nth-child(1) {
animation-delay: 0s;
}
.load2 view:nth-child(1) {
animation-delay: 0.13s;
}
.load3 view:nth-child(1) {
animation-delay: 0.26s;
}
.load1 view:nth-child(2) {
animation-delay: 0.39s;
}
.load2 view:nth-child(2) {
animation-delay: 0.52s;
}
.load3 view:nth-child(2) {
animation-delay: 0.65s;
}
.load1 view:nth-child(3) {
animation-delay: 0.78s;
}
.load2 view:nth-child(3) {
animation-delay: 0.91s;
}
.load3 view:nth-child(3) {
animation-delay: 1.04s;
}
.load1 view:nth-child(4) {
animation-delay: 1.17s;
}
.load2 view:nth-child(4) {
animation-delay: 1.3s;
}
.load3 view:nth-child(4) {
animation-delay: 1.43s;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
</style>

View File

@@ -0,0 +1,582 @@
<template>
<view class="content">
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
<swiper-item class="tab-content">
<scroll-view class="list-scroll-content" scroll-y>
<!-- 订单列表 -->
<view class="order-item">
<view class="i-top b-b">
<text class="time">{{ orderInfo.createTime }}</text>
<text class="state" :style="{ color: orderInfo.stateTipColor }" @click="navToDetailPage(item)">{{ orderInfo.id }}--</text>
<text class="state" :style="{ color: orderInfo.stateTipColor }">{{ orderInfo.stateTip }}</text>
<text v-if="orderInfo.status === 9" class="del-btn yticon icon-iconfontshanchu1" @click="deleteOrder(index)"></text>
</view>
<view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">订单商品</text>
</view>
<view v-if="goodsItem.type === 1" class="goods-box-single" v-for="(goodsItem, goodsIndex) in orderInfo.orderItemList" :key="goodsIndex">
<img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img>
<view class="right">
<text class="title clamp">{{ goodsItem.productName }}</text>
<text class="attr-box">{{ goodsItem.productAttr }} x {{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }}</text>
</view>
</view>
<view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">订单赠品</text>
</view>
<view v-if="goodsItem.type === 2" class="goods-box-single" v-for="(goodsItem, goodsIndex) in orderInfo.orderItemList" :key="goodsIndex">
<img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img>
<view class="right">
<text class="title clamp">{{ goodsItem.productName }}</text>
<text class="attr-box">{{ goodsItem.productAttr }} x {{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }}</text>
</view>
</view>
<view class="price-box">
<text class="num">{{ orderInfo.orderItemList.length }}</text>
件商品, 优惠金额
<text class="price">{{ orderInfo.promotionAmount }}</text>
,运费
<text class="price">{{ orderInfo.freightAmount }}</text>
<view class="yt-list-cell b-b" v-if="groupActivity">
<text class="cell-tit clamp">活动金额</text>
<text class="cell-tip">{{ groupActivity.price }}</text>
</view>
,实付款
<text class="price">{{ orderInfo.payAmount }}</text>
</view>
<view class="action-box b-t">
<button v-if="orderInfo.status == 12" class="action-btn" @click="cancelOrder(orderInfo)">取消订单</button>
<button v-if="orderInfo.status == 12" class="action-btn recom" @click="payOrder(orderInfo)">立即支付</button>
<button v-if="orderInfo.status <7" class="action-btn recom" @click="applyRefund(item)">申请退款</button>
<button v-if="orderInfo.status == 3" class="action-btn recom" @click="confimDelivery(orderInfo)">确认收货</button>
<button class='action-btn recom'
hover-class="btn-hover"
v-if="orderInfo.status === 4"
@click="toEvaluate(orderInfo.id)"
>立即评价</button>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import { mapState } from 'vuex';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
import Json from '@/Json';
import { formatDate } from '@/common/date';
export default {
components: {
uniLoadMore,
empty
},
data() {
return {
tabCurrentIndex: 0,
orderInfo: [],
navList: [
{
status: 0,
text: '全部',
loadingType: 'more',
orderList: []
},
{
status: 12,
text: '待付款',
loadingType: 'more',
orderList: []
},
{
status: 2,
text: '待发货',
loadingType: 'more',
orderList: []
},
{
status: 3,
text: '已发货',
loadingType: 'more',
orderList: []
},
{
status: 4,
text: '已完成',
loadingType: 'more',
orderList: []
}
]
};
},
async onLoad(options) {
let params = { id: options.id };
this.orderInfo = await Api.apiAdminCall('get', Api.admin.orderDetail, params);
this.orderInfo = Object.assign(this.orderInfo, this.orderStateExp(this.orderInfo.status));
this.orderInfo.createTime = this.dateFormat(this.orderInfo.createTime);
},
methods: {
//swiper 切换
changeTab(e) {
this.tabCurrentIndex = e.target.current;
this.loadData('tabChange');
},
//顶部tab点击
tabClick(index) {
this.tabCurrentIndex = index;
},
//删除订单
async deleteOrder(index) {
uni.showLoading({
title: '请稍后'
});
setTimeout(() => {
this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
uni.hideLoading();
}, 600);
},
async payOrder(item) {
uni.showLoading({
title: '请稍后'
});
let params = { orderId: item.id };
let data = await Api.apiAdminCall('post', Api.admin.weixinAppletPay, params);
if (data) {
this.$api.msg(data);
}
uni.hideLoading();
},
//取消订单
async cancelOrder(item) {
uni.showLoading({
title: '请稍后'
});
let params = { orderId: item.id };
let data = await Api.apiAdminCall('post', Api.admin.closeOrder, params);
if (data) {
this.$api.msg(data.data);
}
uni.hideLoading();
},
//订单确认收货
async confimDelivery(item) {
uni.showLoading({
title: '请稍后'
});
let params = { id: item.id };
let data = await Api.apiAdminCall('post', Api.admin.confimDelivery, params);
if (data) {
this.$api.msg(data);
}
uni.hideLoading();
},
//订单申请退款
async applyRefund(item) {
uni.showLoading({
title: '请稍后'
});
let params = { id: item.id };
let data = await Api.apiAdminCall('post', Api.admin.applyRefund, params);
console.log(data);
if (data) {
this.$api.msg(data.data);
}
uni.hideLoading();
},
// 去评价
toEvaluate(orderId) {
this.$common.navigateTo(
'/pages/order/evaluate?order_id=' + orderId
)
},
//订单状态文字和颜色
orderStateExp(value) {
let stateTip = '',
stateTipColor = '#fa436a';
if (value === 12) {
stateTipColor = '#909399';
return '待付款';
}if (value === 1) {
stateTipColor = '#909399';
return '支付成功,没有回掉';
}if (value === 2) {
stateTip = '待发货';
} else if (value === 3) {
stateTip = '待收货';
} else if (value === 4) {
stateTip = '待评价';
} else if (value === 5) {
stateTip = '已完成';
} else if (value === 6) {
stateTipColor = '#909399';
stateTip = '维权中';
} else if (value === 7) {
stateTip = ' 维权已完成';
} else if (value === 8) {
stateTip = '待分享';
} else if (value === 13) {
stateTip = '申请退款';
} else if (value === 14) {
stateTip = '已退款';
} else if (value === 15) {
stateTip = '已关闭';
} else if (value === 16) {
stateTip = '无效订单';
} else {
stateTip = '待付款';
}
return { stateTip, stateTipColor };
},
dateFormat(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.swiper-box {
height: calc(100% - 40px);
}
.list-scroll-content {
height: 100%;
}
.navbar {
display: flex;
height: 40px;
padding: 0 5px;
background: #fff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
position: relative;
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 15px;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 44px;
height: 0;
border-bottom: 2px solid $base-color;
}
}
}
}
.uni-swiper-item {
height: auto;
}
.order-item {
display: flex;
flex-direction: column;
padding-left: 30upx;
background: #fff;
margin-top: 16upx;
.i-top {
display: flex;
align-items: center;
height: 80upx;
padding-right: 30upx;
font-size: $font-base;
color: $font-color-dark;
position: relative;
.time {
flex: 1;
}
.state {
color: $base-color;
}
.del-btn {
padding: 10upx 0 10upx 36upx;
font-size: $font-lg;
color: $font-color-light;
position: relative;
&:after {
content: '';
width: 0;
height: 30upx;
border-left: 1px solid $border-color-dark;
position: absolute;
left: 20upx;
top: 50%;
transform: translateY(-50%);
}
}
}
/* 多条商品 */
.goods-box {
height: 160upx;
padding: 20upx 0;
white-space: nowrap;
.goods-item {
width: 120upx;
height: 120upx;
display: inline-block;
margin-right: 24upx;
}
.goods-img {
display: block;
width: 100%;
height: 100%;
}
}
/* 单条商品 */
.goods-box-single {
display: flex;
padding: 20upx 0;
.goods-img {
display: block;
width: 120upx;
height: 120upx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
padding: 0 30upx 0 24upx;
overflow: hidden;
.title {
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1;
}
.attr-box {
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.num {
margin: 0 8upx;
color: $font-color-dark;
}
.price {
font-size: $font-lg;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
}
.action-box {
display: flex;
justify-content: flex-end;
align-items: center;
height: 100upx;
position: relative;
padding-right: 30upx;
}
.action-btn {
width: 160upx;
height: 60upx;
margin: 0;
margin-left: 24upx;
padding: 0;
text-align: center;
line-height: 60upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
background: #fff;
border-radius: 100px;
&:after {
border-radius: 100px;
}
&.recom {
background: #fff9f9;
color: $base-color;
&:after {
border-color: #f7bcc8;
}
}
}
}
/* load-more */
.uni-load-more {
display: flex;
flex-direction: row;
height: 80upx;
align-items: center;
justify-content: center;
}
.uni-load-more__text {
font-size: 28upx;
color: #999;
}
.uni-load-more__img {
height: 24px;
width: 24px;
margin-right: 10px;
}
.uni-load-more__img > view {
position: absolute;
}
.uni-load-more__img > view view {
width: 6px;
height: 2px;
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
background: #999;
position: absolute;
opacity: 0.2;
transform-origin: 50%;
animation: load 1.56s ease infinite;
}
.uni-load-more__img > view view:nth-child(1) {
transform: rotate(90deg);
top: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(2) {
transform: rotate(180deg);
top: 11px;
right: 0;
}
.uni-load-more__img > view view:nth-child(3) {
transform: rotate(270deg);
bottom: 2px;
left: 9px;
}
.uni-load-more__img > view view:nth-child(4) {
top: 11px;
left: 0;
}
.load1,
.load2,
.load3 {
height: 24px;
width: 24px;
}
.load2 {
transform: rotate(30deg);
}
.load3 {
transform: rotate(60deg);
}
.load1 view:nth-child(1) {
animation-delay: 0s;
}
.load2 view:nth-child(1) {
animation-delay: 0.13s;
}
.load3 view:nth-child(1) {
animation-delay: 0.26s;
}
.load1 view:nth-child(2) {
animation-delay: 0.39s;
}
.load2 view:nth-child(2) {
animation-delay: 0.52s;
}
.load3 view:nth-child(2) {
animation-delay: 0.65s;
}
.load1 view:nth-child(3) {
animation-delay: 0.78s;
}
.load2 view:nth-child(3) {
animation-delay: 0.91s;
}
.load3 view:nth-child(3) {
animation-delay: 1.04s;
}
.load1 view:nth-child(4) {
animation-delay: 1.17s;
}
.load2 view:nth-child(4) {
animation-delay: 1.3s;
}
.load3 view:nth-child(4) {
animation-delay: 1.43s;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
</style>

View File

@@ -0,0 +1,577 @@
<template>
<view class="container">
<!-- 小程序头部兼容 -->
<!-- #ifdef MP -->
<view class="mp-search-box" @click="search()"><input class="ser-input" type="text" value="输入关键字搜索" /></view>
<!-- #endif -->
<!-- 头部轮播 -->
<view class="carousel-section">
<!-- 标题栏和状态栏占位符 -->
<view class="titleNview-placing"></view>
<!-- 背景色区域 -->
<view class="titleNview-background" :style="{ backgroundColor: titleNViewBackground }"></view>
<swiper class="carousel" circular @change="swiperChange">
<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item" @click="navToDetailPage({ title: '轮播广告' })">
<image :src="item.pic" />
</swiper-item>
</swiper>
<!-- 自定义swiper指示器 -->
<view class="swiper-dots">
<text class="num">{{ swiperCurrent + 1 }}</text>
<text class="sign">/</text>
<text class="num">{{ swiperLength }}</text>
</view>
</view>
<view class="ad-1"><image src="/static/temp/ad1.jpg" mode="scaleToFill"></image></view>
<!-- 秒杀楼层 -->
<view class="seckill-section m-t" v-if="item1.flashSessionInfoList.length > 0" v-for="(item1, index1) in groupHotGoodsList" :key="index1">
<view class="s-header" >
<image class="s-img" src="/static/temp/secskill-img.jpg" mode="widthFix"></image>
<text class="tip">{{ item1.flashName }}</text>
</view>
<view v-if="item2.productList.length > 0" v-for="(item2, index2) in item1.flashSessionInfoList" :key="index1">
<view class="s-header" >
<text class="tip">{{ item2.startTime }}</text>
<text class="tip"></text>
<text class="tip">{{ item2.endTime }}</text>
</view>
<scroll-view class="floor-list" scroll-x>
<view class="scoll-wrapper">
<view v-for="(item, index) in item2.productList" :key="index" class="floor-item" @click="navToDetailPage(item)">
<image :src="item.productImg" mode="aspectFill"></image>
<text class="title clamp">{{ item.productName }}</text>
<text class="price clamp">秒杀价 {{ item.flashPromotionPrice }}</text>
<text class="price clamp">原价 {{ item.productPrice }}</text>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
export default {
data() {
return {
keyword: '',
titleNViewBackground: '',
swiperCurrent: 0,
swiperLength: 0,
carouselList: [],
hotProductList: [],
brandList: [], // 推荐品牌
homeFlashPromotion: [], // 当前秒杀场次
subjectList: [], //推荐专题
cat_list: [],
homeFlashPromotion: [],
groupHotGoodsList: [],
newProductList: []
};
},
onLoad() {
this.loadData();
},
methods: {
/**
* 请求静态数据只是为了代码不那么乱
* 分次请求未作整合
*/
async loadData() {
this.logining = true;
let params = {};
let groupHotGoodsList = await Api.apiAdminCall('get', Api.admin.homeFlashPromotionList, params);
this.groupHotGoodsList = groupHotGoodsList;
let advertiseList = await Api.apiAdminCall('get', Api.admin.bannerList, params);
console.log(advertiseList);
this.carouselList = advertiseList || [];
this.swiperLength = this.carouselList.length;
this.logining = false;
},
//轮播图切换修改背景色
swiperChange(e) {
const index = e.detail.current;
this.swiperCurrent = index;
this.titleNViewBackground = this.carouselList[index].background;
},
navToTabPage(url) {
uni.navigateTo({
url: url
});
},
//详情页
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/secskillDetail?id=${id}`
});
},
navToList() {
uni.navigateTo({
url: `/pages/product/list`
});
}
},
search() {
uni.navigateTo({
url: '/pages/search/search'
});
},
// 标题栏input搜索框点击
onNavigationBarSearchInputClicked: async function(e) {
uni.navigateTo({
url: '/pages/search/search'
});
},
//点击导航栏 buttons 时触发
onNavigationBarButtonTap(e) {
const index = e.index;
if (index === 0) {
this.$api.msg('点击了扫描');
} else if (index === 1) {
// #ifdef APP-PLUS
const pages = getCurrentPages();
const page = pages[pages.length - 1];
const currentWebview = page.$getAppWebview();
currentWebview.hideTitleNViewButtonRedDot({
index
});
// #endif
uni.navigateTo({
url: '../../pagesU/notice/notice'
});
}
}
};
</script>
<style lang="scss">
.mp-search-box {
position: absolute;
left: 0;
top: 30upx;
z-index: 9999;
width: 100%;
padding: 0 80upx;
.ser-input {
flex: 1;
height: 56upx;
line-height: 56upx;
text-align: center;
font-size: 28upx;
color: $font-color-base;
border-radius: 20px;
background: rgba(255, 255, 255, 0.6);
}
}
page {
.cate-section {
position: relative;
z-index: 5;
border-radius: 16upx 16upx 0 0;
margin-top: -20upx;
}
.carousel-section {
padding: 0;
.titleNview-placing {
padding-top: 0;
height: 0;
}
.carousel {
.carousel-item {
padding: 0;
}
}
.swiper-dots {
left: 45upx;
bottom: 40upx;
}
}
}
page {
background: #f5f5f5;
}
.m-t {
margin-top: 16upx;
}
/* 头部 轮播图 */
.carousel-section {
position: relative;
padding-top: 10px;
.titleNview-placing {
height: var(--status-bar-height);
padding-top: 44px;
box-sizing: content-box;
}
.titleNview-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 426upx;
transition: 0.4s;
}
}
.carousel {
width: 100%;
height: 350upx;
.carousel-item {
width: 100%;
height: 100%;
padding: 0 28upx;
overflow: hidden;
}
image {
width: 100%;
height: 100%;
border-radius: 10upx;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 60upx;
bottom: 15upx;
width: 72upx;
height: 36upx;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAYAAADDhn8LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTk4MzlBNjE0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTk4MzlBNjA0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6Q0E3RUNERkE0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6Q0E3RUNERkI0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4Gh5BPAAACTUlEQVR42uzcQW7jQAwFUdN306l1uWwNww5kqdsmm6/2MwtVCp8CosQtP9vg/2+/gY+DRAMBgqnjIp2PaCxCLLldpPARRIiFj1yBbMV+cHZh9PURRLQNhY8kgWyL/WDtwujjI8hoE8rKLqb5CDJaRMJHokC6yKgSCR9JAukmokIknCQJpLOIrJFwMsBJELFcKHwM9BFkLBMKFxNcBCHlQ+FhoocgpVwwnv0Xn30QBJGMC0QcaBVJiAMiec/dcwKuL4j1QMsVCXFAJE4s4NQA3K/8Y6DzO4g40P7UcmIBJxbEesCKWBDg8wWxHrAiFgT4fEGsB/CwIhYE+AeBAAdPLOcV8HRmWRDAiQVcO7GcV8CLM8uCAE4sQCDAlHcQ7x+ABQEEAggEEAggEEAggEAAgQACASAQQCCAQACBAAIBBAIIBBAIIBBAIABe4e9iAe/xd7EAJxYgEGDeO4j3EODp/cOCAE4sYMyJ5cwCHs4rCwI4sYBxJ5YzC84rCwKcXxArAuthQYDzC2JF0H49LAhwYUGsCFqvx5EF2T07dMaJBetx4cRyaqFtHJ8EIhK0i8OJBQxcECuCVutxJhCRoE0cZwMRyRcFefa/ffZBVPogePihhyCnbBhcfMFFEFM+DD4m+ghSlgmDkwlOgpAl4+BkkJMgZdk4+EgaSCcpVX7bmY9kgXQQU+1TgE0c+QJZUUz1b2T4SBbIKmJW+3iMj2SBVBWz+leVfCQLpIqYbp8b85EskIxyfIOfK5Sf+wiCRJEsllQ+oqEkQfBxmD8BBgA5hVjXyrBNUQAAAABJRU5ErkJggg==);
background-size: 100% 100%;
.num {
width: 36upx;
height: 36upx;
border-radius: 50px;
font-size: 24upx;
color: #fff;
text-align: center;
line-height: 36upx;
}
.sign {
position: absolute;
top: 0;
left: 50%;
line-height: 36upx;
font-size: 12upx;
color: #fff;
transform: translateX(-50%);
}
}
/* 分类 */
.cate-section {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
padding: 30upx 22upx;
background: #fff;
.cate-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: $font-sm + 2upx;
color: $font-color-dark;
}
/* 原图标颜色太深,不想改图了,所以加了透明度 */
image {
width: 88upx;
height: 88upx;
margin-bottom: 14upx;
border-radius: 50%;
opacity: 0.7;
box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
}
}
.ad-1 {
width: 100%;
height: 210upx;
padding: 10upx 0;
background: #fff;
image {
width: 100%;
height: 100%;
}
}
/* 秒杀专区 */
.seckill-section {
padding: 4upx 30upx 24upx;
background: #fff;
.s-header {
display: flex;
align-items: center;
height: 92upx;
line-height: 1;
.s-img {
width: 140upx;
height: 30upx;
}
.tip {
font-size: $font-base;
color: $font-color-light;
margin: 0 20upx 0 40upx;
}
.timer {
display: inline-block;
width: 40upx;
height: 36upx;
text-align: center;
line-height: 36upx;
margin-right: 14upx;
font-size: $font-sm + 2upx;
color: #fff;
border-radius: 2px;
background: rgba(0, 0, 0, 0.8);
}
.icon-you {
font-size: $font-lg;
color: $font-color-light;
flex: 1;
text-align: right;
}
}
.floor-list {
white-space: nowrap;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 250upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 250upx;
height: 250upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
}
.f-header {
display: flex;
align-items: center;
height: 140upx;
padding: 6upx 30upx 8upx;
background: #fff;
image {
flex-shrink: 0;
width: 80upx;
height: 80upx;
margin-right: 20upx;
}
.tit-box {
flex: 1;
display: flex;
flex-direction: column;
}
.tit {
font-size: $font-lg + 2upx;
color: #font-color-dark;
line-height: 1.3;
}
.tit2 {
font-size: $font-sm;
color: $font-color-light;
}
.icon-you {
font-size: $font-lg + 2upx;
color: $font-color-light;
}
}
/* 团购楼层 */
.group-section {
background: #fff;
.g-swiper {
height: 650upx;
padding-bottom: 30upx;
}
.g-swiper-item {
width: 100%;
padding: 0 30upx;
display: flex;
}
image {
width: 100%;
height: 460upx;
border-radius: 4px;
}
.g-item {
display: flex;
flex-direction: column;
overflow: hidden;
}
.left {
flex: 1.2;
margin-right: 24upx;
.t-box {
padding-top: 20upx;
}
}
.right {
flex: 0.8;
flex-direction: column-reverse;
.t-box {
padding-bottom: 20upx;
}
}
.t-box {
height: 160upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
line-height: 1.6;
}
.price {
color: $uni-color-primary;
}
.m-price {
font-size: $font-sm + 2upx;
text-decoration: line-through;
color: $font-color-light;
margin-left: 8upx;
}
.pro-box {
display: flex;
align-items: center;
margin-top: 10upx;
font-size: $font-sm;
color: $font-base;
padding-right: 10upx;
}
.progress-box {
flex: 1;
border-radius: 10px;
overflow: hidden;
margin-right: 8upx;
}
}
/* 分类推荐楼层 */
.hot-floor {
width: 100%;
overflow: hidden;
margin-bottom: 20upx;
.floor-img-box {
width: 100%;
height: 320upx;
position: relative;
&:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(rgba(255, 255, 255, 0.06) 30%, #f8f8f8);
}
}
.floor-img {
width: 100%;
height: 100%;
}
.floor-list {
white-space: nowrap;
padding: 20upx;
padding-right: 50upx;
border-radius: 6upx;
margin-top: -140upx;
margin-left: 30upx;
background: #fff;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
position: relative;
z-index: 1;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 180upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 180upx;
height: 180upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
.more {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
flex-shrink: 0;
width: 180upx;
height: 180upx;
border-radius: 6upx;
background: #f3f3f3;
font-size: $font-base;
color: $font-color-light;
text:first-child {
margin-bottom: 4upx;
}
}
}
/* 猜你喜欢 */
.guess-section {
display: flex;
flex-wrap: wrap;
padding: 0 30upx;
background: #fff;
.guess-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
}
}
</style>

View File

@@ -0,0 +1,161 @@
<template>
<view class="qiun-columns">
<!--#ifdef H5 -->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt" >
<view class="qiun-title-dot-light">页面地址</view>
</view>
<view class="qiun-bg-white qiun-padding">
<text>pages/basic/column/stack</text>
</view>
<!--#endif-->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt" >
<view class="qiun-title-dot-light">堆叠柱状图</view>
</view>
<view class="qiun-charts" >
<!--#ifdef MP-ALIPAY -->
<canvas canvas-id="canvasColumnStack" id="canvasColumnStack" class="charts" :width="cWidth*pixelRatio" :height="cHeight*pixelRatio" :style="{'width':cWidth+'px','height':cHeight+'px'}" @touchstart="touchColumn"></canvas>
<!--#endif-->
<!--#ifndef MP-ALIPAY -->
<canvas canvas-id="canvasColumnStack" id="canvasColumnStack" class="charts" @touchstart="touchColumn"></canvas>
<!--#endif-->
</view>
<!--#ifdef H5 -->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt" >
<view class="qiun-title-dot-light">标准数据格式</view>
</view>
<view class="qiun-bg-white qiun-padding">
<textarea class="qiun-textarea" auto-height="true" maxlength="-1" v-model="textarea"/>
</view>
<view class="qiun-text-tips">Tips修改后点击更新图表</view>
<button class="qiun-button" @tap="changeData()">更新图表</button>
<!--#endif-->
</view>
</template>
<script>
import uCharts from '@/components/u-charts/u-charts.js';
import { isJSON } from '@/common/checker.js';
var _self;
var canvaColumn=null;
export default {
data() {
return {
cWidth:'',
cHeight:'',
pixelRatio:1,
textarea:''
}
},
onLoad() {
_self = this;
//#ifdef MP-ALIPAY
uni.getSystemInfo({
success: function (res) {
if(res.pixelRatio>1){
//正常这里给2就行如果pixelRatio=3性能会降低一点
//_self.pixelRatio =res.pixelRatio;
_self.pixelRatio =2;
}
}
});
//#endif
this.cWidth=uni.upx2px(750);
this.cHeight=uni.upx2px(500);
this.getServerData();
},
methods: {
getServerData(){
uni.request({
url: 'http://www.yjlive.cn:8085/common/data.json',
data:{
},
success: function(res) {
console.log(res.data.data)
let ColumnStack={categories:[],series:[]};
//这里我后台返回的是数组所以用等于如果您后台返回的是单条数据需要push进去
ColumnStack.categories=res.data.data.ColumnStack.categories;
ColumnStack.series=res.data.data.ColumnStack.series;
_self.textarea = JSON.stringify(res.data.data.ColumnStack);
_self.showColumnStack("canvasColumnStack",ColumnStack);
},
fail: () => {
_self.tips="网络错误,小程序端请检查合法域名";
},
});
},
showColumnStack(canvasId,chartData){
canvaColumn=new uCharts({
$this:_self,
canvasId: canvasId,
type: 'column',
padding:[15,15,0,15],
legend:{
show:true,
padding:5,
lineHeight:11,
margin:0,
},
fontSize:11,
background:'#FFFFFF',
pixelRatio:_self.pixelRatio,
animation: true,
categories: chartData.categories,
series: chartData.series,
xAxis: {
disableGrid:true,
},
yAxis: {
//disabled:true
},
dataLabel: true,
width: _self.cWidth*_self.pixelRatio,
height: _self.cHeight*_self.pixelRatio,
extra: {
column: {
type:'stack',
width: _self.cWidth*_self.pixelRatio*0.5/chartData.categories.length
}
}
});
},
touchColumn(e){
canvaColumn.touchLegend(e);
canvaColumn.showToolTip(e, {
format: function (item, category) {
return category + ' ' + item.name + ':' + item.data
}
});
},
changeData(){
if(isJSON(_self.textarea)){
let newdata=JSON.parse(_self.textarea);
canvaColumn.updateData({
series: newdata.series,
categories: newdata.categories
});
}else{
uni.showToast({
title:'数据格式错误',
image:'../../../static/images/alert-warning.png'
})
}
}
}
}
</script>
<style>
/*样式的width和height一定要与定义的cWidth和cHeight相对应*/
.qiun-charts {
width: 750upx;
height: 500upx;
background-color: #FFFFFF;
}
.charts {
width: 750upx;
height: 500upx;
background-color: #FFFFFF;
}
</style>

View File

@@ -0,0 +1,722 @@
<template>
<view class="container">
<view class="carousel">
<view class="image-wrapper"><image :src="detailData.logo" class="loaded" mode="aspectFill"></image></view>
</view>
<view class="introduce-section">
<text class="title">{{ detailData.name }}</text>
<view class="bot-row">
<text>浏览量: {{ detailData.hit }}</text>
<text>收藏量: {{ detailData.collect }}</text>
<text>商品量: {{ detailData.goodsCount }}</text>
</view>
</view>
<!-- 分享 -->
<view class="share-section" @click="share">
<view class="share-icon">
<text class="yticon icon-xingxing"></text>
</view>
<text class="tit">该商品分享可领49减10红包</text>
<text class="yticon icon-bangzhu1"></text>
<view class="share-btn">
立即分享
<text class="yticon icon-you"></text>
</view>
</view>
<view class="c-list">
<view class="c-row b-b">
<text class="tit">服务</text>
<view class="bz-list con">
<text>7天无理由退换货 ·</text>
<text>假一赔十 ·</text>
</view>
</view>
</view>
<view class="c-list">
<view class="c-row b-b">
<text class="tit">地址</text>
<view class="bz-list con">
<text>{{detailData.addressProvince}} ·</text>
<text>{{detailData.addressCity}} ·</text>
<text>{{detailData.addressArea}} ·</text>
<text>{{detailData.addressDetail}} ·</text>
</view>
</view>
</view>
<view class="">
<view class="hot-floor" v-if="item1.goodsList.length > 0" v-for="(item1, index1) in cat_list" :key="index1">
<view class="floor-img-box"><image class="floor-img" :src="item1.pic" mode="scaleToFill"></image></view>
<scroll-view class="floor-list" scroll-x>
<view class="scoll-wrapper">
<view v-for="(item, index) in item1.goodsList" :key="index" class="floor-item" @click="navToDetailPage(item)">
<image :src="item.pic" mode="aspectFill"></image>
<text class="title clamp">{{ item.name }}</text>
<text class="price">{{ item.price }}</text>
</view>
<view class="more" @click="navToTabPage('/pages/product/list')">
<text>查看全部</text>
<text>More+</text>
</view>
</view>
</scroll-view>
</view>
</view>
<!-- 底部操作菜单 -->
<view class="page-bottom">
<navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
<text class="yticon icon-xiatubiao--copy"></text>
<text>首页</text>
</navigator>
</view>
<!-- 分享 -->
<share ref="share" :contentHeight="580" :shareList="shareList"></share>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import share from '@/components/share';
import { mapState } from 'vuex';
export default {
components: {
share
},
data() {
return {
specClass: 'none',
specSelected: [],
small: null,
sku: [],
detailData: [],
favorite: true,
shareList: [],
cat_list: [],
desc: `
<div style="width:100%">
<img style="width:100%;display:block;" src="https://gd3.alicdn.com/imgextra/i4/479184430/O1CN01nCpuLc1iaz4bcSN17_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd2.alicdn.com/imgextra/i2/479184430/O1CN01gwbN931iaz4TzqzmG_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd3.alicdn.com/imgextra/i3/479184430/O1CN018wVjQh1iaz4aupv1A_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd4.alicdn.com/imgextra/i4/479184430/O1CN01tWg4Us1iaz4auqelt_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd1.alicdn.com/imgextra/i1/479184430/O1CN01Tnm1rU1iaz4aVKcwP_!!479184430.jpg_400x400.jpg" />
</div>
`,
skuList: []
};
},
async onLoad(ops) {
let params = {};
let data = await Api.apiAdminCall('get', Api.admin.storeDetail, params,true);
if (data) {
console.log(data)
let detailData = data.store;
this.detailData = detailData;
this.cat_list = data.store.list;
uni.setNavigationBarTitle({
title: detailData.name
});
}
this.shareList = await this.$api.json('shareList');
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//详情页
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `/pages/product/product?id=${id}`
});
},
//分享
share() {
this.$refs.share.toggleMask();
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page {
background: $page-color-base;
padding-bottom: 160upx;
}
.icon-you {
font-size: $font-base + 2upx;
color: #888;
}
.carousel {
height: 722upx;
position: relative;
swiper {
height: 100%;
}
.image-wrapper {
width: 100%;
height: 100%;
}
.swiper-item {
display: flex;
justify-content: center;
align-content: center;
height: 750upx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
}
/* 分类推荐楼层 */
.hot-floor {
width: 100%;
overflow: hidden;
margin-bottom: 20upx;
.floor-img-box {
width: 100%;
height: 320upx;
position: relative;
&:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(rgba(255, 255, 255, 0.06) 30%, #f8f8f8);
}
}
.floor-img {
width: 100%;
height: 100%;
}
.floor-list {
white-space: nowrap;
padding: 20upx;
padding-right: 50upx;
border-radius: 6upx;
margin-top: -140upx;
margin-left: 30upx;
background: #fff;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
position: relative;
z-index: 1;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 180upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 180upx;
height: 180upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
.more {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
flex-shrink: 0;
width: 180upx;
height: 180upx;
border-radius: 6upx;
background: #f3f3f3;
font-size: $font-base;
color: $font-color-light;
text:first-child {
margin-bottom: 4upx;
}
}
}
/* 标题简介 */
.introduce-section {
background: #fff;
padding: 20upx 30upx;
.title {
font-size: 32upx;
color: $font-color-dark;
height: 50upx;
line-height: 50upx;
}
.price-box {
display: flex;
align-items: baseline;
height: 64upx;
padding: 10upx 0;
font-size: 26upx;
color: $uni-color-primary;
}
.price {
font-size: $font-lg + 2upx;
}
.m-price {
margin: 0 12upx;
color: $font-color-light;
text-decoration: line-through;
}
.coupon-tip {
align-items: center;
padding: 4upx 10upx;
background: $uni-color-primary;
font-size: $font-sm;
color: #fff;
border-radius: 6upx;
line-height: 1;
transform: translateY(-4upx);
}
.bot-row {
display: flex;
align-items: center;
height: 50upx;
font-size: $font-sm;
color: $font-color-light;
text {
flex: 1;
}
}
}
/* 分享 */
.share-section {
display: flex;
align-items: center;
color: $font-color-base;
background: linear-gradient(left, #fdf5f6, #fbebf6);
padding: 12upx 30upx;
.share-icon {
display: flex;
align-items: center;
width: 70upx;
height: 30upx;
line-height: 1;
border: 1px solid $uni-color-primary;
border-radius: 4upx;
position: relative;
overflow: hidden;
font-size: 22upx;
color: $uni-color-primary;
&:after {
content: '';
width: 50upx;
height: 50upx;
border-radius: 50%;
left: -20upx;
top: -12upx;
position: absolute;
background: $uni-color-primary;
}
}
.icon-xingxing {
position: relative;
z-index: 1;
font-size: 24upx;
margin-left: 2upx;
margin-right: 10upx;
color: #fff;
line-height: 1;
}
.tit {
font-size: $font-base;
margin-left: 10upx;
}
.icon-bangzhu1 {
padding: 10upx;
font-size: 30upx;
line-height: 1;
}
.share-btn {
flex: 1;
text-align: right;
font-size: $font-sm;
color: $uni-color-primary;
}
.icon-you {
font-size: $font-sm;
margin-left: 4upx;
color: $uni-color-primary;
}
}
.c-list {
font-size: $font-sm + 2upx;
color: $font-color-base;
background: #fff;
.c-row {
display: flex;
align-items: center;
padding: 20upx 30upx;
position: relative;
}
.tit {
width: 140upx;
}
.con {
flex: 1;
color: $font-color-dark;
.selected-text {
margin-right: 10upx;
}
}
.bz-list {
height: 40upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
text {
display: inline-block;
margin-right: 30upx;
}
}
.con-list {
flex: 1;
display: flex;
flex-direction: column;
color: $font-color-dark;
line-height: 40upx;
}
.red {
color: $uni-color-primary;
}
}
/* 评价 */
.eva-section {
display: flex;
flex-direction: column;
padding: 20upx 30upx;
background: #fff;
margin-top: 16upx;
.e-header {
display: flex;
align-items: center;
height: 70upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.tit {
font-size: $font-base + 2upx;
color: $font-color-dark;
margin-right: 4upx;
}
.tip {
flex: 1;
text-align: right;
}
.icon-you {
margin-left: 10upx;
}
}
}
.eva-box {
display: flex;
padding: 20upx 0;
.portrait {
flex-shrink: 0;
width: 80upx;
height: 80upx;
border-radius: 100px;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
font-size: $font-base;
color: $font-color-base;
padding-left: 26upx;
.con {
font-size: $font-base;
color: $font-color-dark;
padding: 20upx 0;
}
.bot {
display: flex;
justify-content: space-between;
font-size: $font-sm;
color: $font-color-light;
}
}
}
/* 详情 */
.detail-desc {
background: #fff;
margin-top: 16upx;
.d-header {
display: flex;
justify-content: center;
align-items: center;
height: 80upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
position: relative;
text {
padding: 0 20upx;
background: #fff;
position: relative;
z-index: 1;
}
&:after {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%);
width: 300upx;
height: 0;
content: '';
border-bottom: 1px solid #ccc;
}
}
}
/* 规格选择弹窗 */
.attr-content {
padding: 10upx 30upx;
.a-t {
display: flex;
image {
width: 170upx;
height: 170upx;
flex-shrink: 0;
margin-top: -40upx;
border-radius: 8upx;
}
.right {
display: flex;
flex-direction: column;
padding-left: 24upx;
font-size: $font-sm + 2upx;
color: $font-color-base;
line-height: 42upx;
.price {
font-size: $font-lg;
color: $uni-color-primary;
margin-bottom: 10upx;
}
.selected-text {
margin-right: 10upx;
}
}
}
.attr-list {
display: flex;
flex-direction: column;
font-size: $font-base + 2upx;
color: $font-color-base;
padding-top: 30upx;
padding-left: 10upx;
}
.item-list {
padding: 20upx 0 0;
display: flex;
flex-wrap: wrap;
text {
display: flex;
align-items: center;
justify-content: center;
background: #eee;
margin-right: 20upx;
margin-bottom: 20upx;
border-radius: 100upx;
min-width: 60upx;
height: 60upx;
padding: 0 20upx;
font-size: $font-base;
color: $font-color-dark;
}
.selected {
background: #fbebee;
color: $uni-color-primary;
}
}
}
/* 弹出层 */
.popup {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 99;
&.show {
display: block;
.mask {
animation: showPopup 0.2s linear both;
}
.layer {
animation: showLayer 0.2s linear both;
}
}
&.hide {
.mask {
animation: hidePopup 0.2s linear both;
}
.layer {
animation: hideLayer 0.2s linear both;
}
}
&.none {
display: none;
}
.mask {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: rgba(0, 0, 0, 0.4);
}
.layer {
position: fixed;
z-index: 99;
bottom: 0;
width: 100%;
min-height: 40vh;
border-radius: 10upx 10upx 0 0;
background-color: #fff;
.btn {
height: 66upx;
line-height: 66upx;
border-radius: 100upx;
background: $uni-color-primary;
font-size: $font-base + 2upx;
color: #fff;
margin: 30upx auto 20upx;
}
}
@keyframes showPopup {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes hidePopup {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes showLayer {
0% {
transform: translateY(120%);
}
100% {
transform: translateY(0%);
}
}
@keyframes hideLayer {
0% {
transform: translateY(0);
}
100% {
transform: translateY(120%);
}
}
}
/* 底部操作菜单 */
.page-bottom {
position: fixed;
left: 30upx;
bottom: 30upx;
z-index: 95;
display: flex;
justify-content: center;
align-items: center;
width: 690upx;
height: 100upx;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
border-radius: 16upx;
.p-b-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: $font-sm;
color: $font-color-base;
width: 96upx;
height: 80upx;
.yticon {
font-size: 40upx;
line-height: 48upx;
color: $font-color-light;
}
&.active,
&.active .yticon {
color: $uni-color-primary;
}
.icon-fenxiang2 {
font-size: 42upx;
transform: translateY(-2upx);
}
.icon-shoucang {
font-size: 46upx;
}
}
.action-btn-group {
display: flex;
height: 76upx;
border-radius: 100px;
overflow: hidden;
box-shadow: 0 20upx 40upx -16upx #fa436a;
box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
background: linear-gradient(to right, #ffac30, #fa436a, #f56c6c);
margin-left: 20upx;
position: relative;
&:after {
content: '';
position: absolute;
top: 50%;
right: 50%;
transform: translateY(-50%);
height: 28upx;
width: 0;
border-right: 1px solid rgba(255, 255, 255, 0.5);
}
.action-btn {
display: flex;
align-items: center;
justify-content: center;
width: 180upx;
height: 100%;
font-size: $font-base;
padding: 0;
border-radius: 0;
background: transparent;
}
}
}
</style>

View File

@@ -0,0 +1,333 @@
<template>
<view class="content">
<view class="list-wraper logo-wraper" @click="uplodingImg(1)">
<view class="tit">
<text>点击上传商家logo</text>
</view>
<view class="input-logo" >
<image v-if="!logImg" src="http://mp.emshop.eonfox.com/zrhzstatic/muying/shop.png" mode=""></image>
<image v-else :src="logImg" mode=""></image>
</view>
</view>
<view class="list-wraper">
<view class="tit">
<text>商家名称</text>
</view>
<view class="input-all">
<input class="inpt" type="text" value="" v-model="infor.name" placeholder="请输入商家名称" />
</view>
</view>
<view class="list-wraper">
<view class="tit">
<text>商家QQ</text>
</view>
<view class="input-all">
<input class="inpt" type="text" value="" v-model="infor.contactQq" placeholder="请输入商家QQ" />
</view>
</view>
<view class="list-wraper">
<view class="tit">
<text>商家手机号</text>
</view>
<view class="input-all">
<input class="inpt" type="number" maxlength="11" v-model="infor.supportPhone" value="" placeholder="请输入手机号" />
</view>
</view>
<view class="list-wraper">
<view class="tit">
<text>商家类别</text>
</view>
<view class="input-all">
<radio-group>
<label class="radio" v-for="(item,index) in shopsType" :key='index'><radio value="r1" class="radio" @click="gain(item.type_id)"/>{{item.name}}</label>
</radio-group>
</view>
</view>
<view class="tips" @click="goPage">
<view class="tips_left">
<text>{{addressName}}</text>
</view>
<view class="tips_right">
<image src="../../static/right-arrow.png" ></image>
</view>
</view>
<view class="h-20upx"></view>
<view class="list-wraper ind-wraper">
<view class="tit">
<text>商家介绍</text>
</view>
<view class="input-lg">
<textarea class="lg-text" value="" v-model="infor.description" placeholder="请输入..." />
</view>
</view>
<view class="list-wraper logo-wraper" @click="uplodingImg(2)">
<view class="tit">
<text>点击上传营业执照</text>
</view>
<view class="input-Image">
<image v-if="!BusinessImg" src="http://mp.emshop.eonfox.com/zrhzstatic/muying/yingyezhizhao.png" mode=""></image>
<image v-else :src="BusinessImg" mode=""></image>
</view>
</view>
<view class="btn-box">
<button class="btn" @click="commit()">提交申请</button>
</view>
</view>
</template>
<script>
import lotusAddress from "@/components/Winglau14-lotusAddress/Winglau14-lotusAddress.vue"
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
// #ifdef H5
let jweixin = require('jweixin-module');
// #endif
export default {
components: {
mallplusCopyright
},
data() {
return {
cityPickerValueDefault: [0, 0, 1],
themeColor: '#007AFF',
pickerText: '选择省/市/区',
addressName:'请选择商家地址',
logImg:'',
infor:{},
BusinessImg:'' ,// 营业执照
BusinessImgId:'',
logImgID:'',
shopsType:[
{
id: 1,
name: "服装",
},
{
id: 2,
name: "化妆品",
},
{
id: 3,
name: "家装",
},
{
id: 4,
name: "水果",
},
]
}
},
components: {
},
onLoad(){
},
methods: {
goPage(){
var _this = this
uni.chooseLocation({
success: function (res) {
console.log('res',res)
console.log('位置名称:' + res.name);
_this.addressName=res.address +res.name
_this.infor.addressDetail = res.address +res.name
_this.infor.addressLat=res.latitude
_this.infor.addressLng=res.longitude
console.log('经度:' + res.longitude);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
}
});
},
gain(id){
this.infor.type_id=id
console.log('类别id',this.infor.type_id)
},
// 上传图片
uplodingImg (name) {
this.$otherApi.uploadFiles(res => {
if (res.code == 200) {
console.log(res.data)
if(name==1){
this.logImg = res.data
this.infor.logo=res.data
}else{
this.BusinessImg = res.data
this.infor.supportName=res.data
}
} else {
this.$common.errorToShow(res.msg)
}
})
},
async commit(){
var _this=this
let form = Object.assign({},_this.infor)
let data = await Api.apiCall('post', Api.member.applyStore, form);
console.log(data)
if (data) {
this.$api.msg(`商户入驻成功`);
setTimeout(() => {
let url = '../../pagesC/store/storeResult?id='+data.id;
uni.navigateTo({
url
});
}, 800);
} else {
this.$api.msg(`商户入驻失败`);
}
},
openLocation(){
// #ifdef H5
jweixin.getLocation({
type: 'wgs84',
success: res => {
const latitude = res.latitude;
const longitude = res.longitude;
jweixin.openLocation({
latitude: latitude, // 纬度浮点数范围为90 ~ -90
longitude: longitude, // 经度浮点数范围为180 ~ -180。
name: '位置名', // 位置名
scale: 16, // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl:"http://www.baidu.com"
})
},
fail: () => {},
complete: () => {}
});
// #endif
}
}
}
</script>
<style>
page{
background: #F5F5F5;
width: 100%;
height: 100%;
}
.h-20upx{
height: 20upx;
display: flex;
}
.tips{
display: flex;
/* width: calc(100% - 60upx); */
padding: 20upx;
background-color: #FFFFFF;
}
.tips_left{
width: 94%;
font-size: 28upx;
color: #de7d67;
}
.tips_right{
width: 5%;
}
.tips_right image{
width:40upx;
height: 40upx;
}
.btn{
background-color: rgba( 242 155 135);
color: #FFFFFF;
}
.input-logo{
width: 120upx;
height: 120upx;
line-height: 120upx;
text-align: center;
font-size: 27upx;
color: #444444;
}
.input-logo image{
width: 120upx;
height: 120upx;
}
.input-Image{
width: 420upx;
height: 320upx;
line-height: 320upx;
text-align: center;
font-size: 27upx;
border: 1upx #CCCCCC solid;
color: #444444;
}
.input-Image image{
width: 420upx;
height: 320upx;
}
.radio{
font-size: 28upx;
transform:scale(0.7)
}
</style>
<style scoped lang="stylus" ref="stylesheet/stylus">
.content
width 100%
display flex
flex-direction column
color #333333
.list-wraper
position relative
display flex
align-items center
// width calc(100% - 60upx)
padding 20upx
background #FFFFFF
.tit
flex 1.5
text
font-size 28upx
.input-all
flex 4
.inpt
// background red
padding-top 6upx
font-size 28upx
.logo-wraper
.input-all
text-align right
image
width 100upx
height 100upx
.list-wraper::after
position absolute
content ""
width calc(100% - 60upx)
height 2upx
left 30upx
bottom 0
background #CCCCCC
.ind-wraper
flex-direction column
justify-content left
.tit
width 100%
.input-lg
width 100%
padding 20upx 10upx
// background red
.lg-text
font-size 24upx
color #777777
.btn-box
width 690upx;
padding 40upx 30upx
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,365 @@
<template>
<view class="content" style="padding-top: 0upx;">
<!-- #ifdef MP-WEIXIN -->
<view class="subscription-notice" v-if="suTip">
<view>
<image class="icon" src="/static/image/subscription-tip.png" mode=""></image>
<text>订阅消息及时获取订单最新动态</text>
</view>
<view>
<text class="subscription-notice-btn red-price" @click="toSubscription()">消息订阅</text>
<text class="subscription-notice-btn-close" @click="toClose()">×</text>
</view>
</view>
<!-- #endif -->
<jshop :jdata="pageData"></jshop>
<!-- #ifdef H5 || APP-PLUS-NVUE || APP-PLUS -->
<view class="service" @click="showChat()"><image class="icon" src="/static/image/seller-content.png" mode=""></image></view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<button class="service" hover-class="none" open-type="contact" bindcontact="showChat" :session-from="kefupara">
<image class="icon" src="/static/image/seller-content.png" mode=""></image>
</button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<contact-button class="service icon" icon="/static/image/seller-content.png" size="80rpx*80rpx" tnt-inst-id="WKPKUZXG" scene="SCE00040186" hover-class="none" />
<!-- #endif -->
<!-- #ifdef MP-TOUTIAO -->
<!-- 头条客服 -->
<!-- #endif -->
<red-bag v-if="redBagShow" @click="handleGet"></red-bag>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import jshop from '@/components/jshop/jshop.vue';
import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
import redBag from '@/components/red-bag/index';
import { goods } from '@/config/mixins.js';
import { goBack } from '@/config/mixins.js';
export default {
mixins: [goods],
components: {
mallplusCopyright,
jshop,
uniCountdown,
redBag
},
data() {
return {
topmenu:{},
imageUrl: '/static/image/share_image.png', //店铺分享图片
pageData: [],
pageTitle: [],
pageCode: 'mobile_home', //页面布局编码
pintuan: [], //拼团列表,
redBagShow: false, //红包
config: '', //配置信息
userInfo: {}, // 用户信息
kefupara: '', //客服传递资料
id:0,
copy: false,
suTipStatus: false,
shareUrl: '/pages/share/jump'
};
},
updated() {
this.copy = true;
},
computed: {
appTitle() {
return this.pageTitle.pageName;
},
// 获取店铺联系人手机号
shopMobile() {
return this.$store.state.config.shop_mobile || 0;
},
suTip() {
return this.suTipStatus;
}
},
onLoad(e) {
this.id=e.id;
this.initData();
if (this.pageTitle.pageName) {
uni.setNavigationBarTitle({
title: this.pageTitle.pageName
});
}
},
onShow() {
// #ifdef MP-WEIXIN
this.userIsSubscription();
// #endif
},
methods: {
//领取红包
handleGet() {},
destroyed() {
window.removeEventListener('scroll', this.handleScroll);
},
goSearch() {
uni.navigateTo({
url: './search'
});
},
// 首页初始化获取数据
async initData() {
let params={type:2,storeId:this.id};
let res = await Api.apiCall('get',Api.index.diyDetail,params);
console.log(res)
let items = JSON.parse(res.datas)
console.log(items.currentTemplate)
items.currentTemplate.forEach((item)=> {
if (item.id == 'topmenu') {
this.topmenu = item;
if (item.data[0] == undefined) {
var linkurl = '';
} else {
var linkurl = item.data[0].linkurl;
core.get('diypage/getInfo', {
dataurl: linkurl
}, function(ret) {
//console.log(ret);
item.data[0].data = ret.goods.list;
});
}
}
if (item.id == 'seckillgroup') {
var data = {};
data.status = item.data.status;
data.endtime = item.data.endtime;
data.starttime = item.data.starttime;
$this.initSeckill(data);
}
});
this.pageData = items.currentTemplate;
this.pageTitle =items.basicOption;
setTimeout(() => {
this.showLoad = false;
}, 600);
//获取首页配置
var _this = this;
if (this.$db.get('userToken')) {
this.$api.userInfo({}, res => {
if (res.status) {
_this.userInfo = res.data;
// #ifdef MP-WEIXIN
//微信小程序打开客服时,传递用户信息
var kefupara = {};
kefupara.nickName = res.data.nickname;
kefupara.tel = res.data.mobile;
_this.kefupara = JSON.stringify(kefupara);
// #endif
}
});
}
// #ifdef MP-WEIXIN
this.userIsSubscription();
// #endif
// this.getShareUrl();
},
//在线客服,只有手机号的,请自己替换为手机号
showChat() {
// #ifdef H5
let _this = this;
window._AIHECONG('ini', {
entId: this.config.ent_id,
button: false,
appearance: {
panelMobile: {
tone: '#FF7159',
sideMargin: 30,
ratio: 'part',
headHeight: 50
}
}
});
//传递客户信息
window._AIHECONG('customer', {
head: _this.userInfo.avatar,
名称: _this.userInfo.nickname,
手机: _this.userInfo.mobile
});
window._AIHECONG('showChat');
// #endif
// 客服页面
// #ifdef APP-PLUS || APP-PLUS-NVUE
this.$common.navigateTo('../customer_service/index');
// #endif
// 头条系客服
// #ifdef MP-TOUTIAO
if (this.shopMobile != 0) {
let _this = this;
tt.makePhoneCall({
phoneNumber: this.shopMobile.toString(),
success(res) {},
fail(res) {}
});
} else {
_this.$common.errorToShow('暂无设置客服电话');
}
// #endif
},
//前往订阅
toSubscription() {
this.$common.navigateTo('/pages/member/setting/subscription/index');
},
//查询用户订阅
userIsSubscription() {
let userToken = this.$db.get('userToken');
if (userToken && userToken != '') {
this.$api.subscriptionIsTip(res => {
if (res.status) {
if (res.data) {
this.suTipStatus = true;
} else {
this.suTipStatus = false;
}
} else {
this.suTipStatus = true;
}
});
} else {
this.suTipStatus = true;
}
},
//关闭订阅
toClose() {
let userToken = this.$db.get('userToken');
if (userToken && userToken != '') {
this.$api.subscriptionCloseTip(res => {
this.suTipStatus = false;
});
} else {
this.suTipStatus = false;
}
},
//获取分享URL
getShareUrl() {
let data = {
client: 2,
url: "/pages/share/jump",
type: 1,
page: 1,
};
let userToken = this.$db.get('userToken');
if (userToken && userToken != '') {
data['token'] = userToken;
}
this.$api.share(data, res => {
this.shareUrl = res.data
});
}
},
onPullDownRefresh() {
this.initData();
uni.stopPullDownRefresh();
},
//分享
onShareAppMessage() {
return {
title: this.$store.state.config.share_title,
// #ifdef MP-ALIPAY
desc: this.$store.state.config.share_desc,
// #endif
imageUrl: this.$store.state.config.share_image,
path: this.shareUrl
};
},
// #ifdef MP-WEIXIN || APP-PLUS || APP-PLUS-NVUE
onPageScroll() {
var _this = this;
const query = uni.createSelectorQuery();
query
.select('.content >>> .search')
.boundingClientRect(function(res) {
if (res) {
if (res.top < 0) {
_this.$store.commit('searchFixed', true);
} else {
_this.$store.commit('searchFixed', false);
}
}
})
.exec();
}
//#endif
};
</script>
<style>
.cell-item {
border: none;
}
.cell-ft-text {
font-size: 22upx;
color: #999;
}
.service {
width: 80rpx;
height: 80rpx;
background-color: #fff;
border-radius: 50%;
position: fixed;
right: 30rpx;
bottom: 120rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 10rpx #ccc;
padding: 0;
z-index: 996;
}
.service .icon {
width: 60rpx;
height: 60rpx;
}
.subscription-notice {
background-color: #ffffff;
box-shadow: 0 2rpx 18rpx #eeeeee;
position: relative;
z-index: 99;
height: 66rpx;
line-height: 66rpx;
padding: 0 20rpx;
font-size: 28rpx;
color: #333333;
display: flex;
justify-content: space-between;
align-items: center;
}
.subscription-notice > view {
display: flex;
align-items: center;
}
.subscription-notice .icon {
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
.subscription-notice-btn {
color: #4285f4;
}
.subscription-notice-btn-close {
color: #888888;
padding-left: 10px;
font-size: 30rpx;
}
</style>

View File

@@ -0,0 +1,279 @@
<template>
<view class="content">
<view class="goods-list">
<view v-for="(item, index) in storeList" :key="index" class="goods-item" @click="navToDetailPage(item)">
<view class="image-wrapper"><image :src="item.logo" mode="aspectFill"></image></view>
<text class="title clamp">{{ item.name }}</text>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components: {
mallplusCopyright,
uniLoadMore
},
data() {
return {
cateMaskState: 0, //分类面板展开状态
headerPosition: 'fixed',
headerTop: '0px',
keyword: '',
loadingType: 'more', //加载更多状态
filterIndex: 0,
cateId: 0, //已选三级分类id
pageNum: 1,
cid: null,
priceOrder: 0, //1 价格从低到高 2价格从高到低
cateList: [],
storeList: []
};
},
async onLoad(options) {
// #ifdef H5
this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
// #endif
let params = {};
let list = await Api.apiCall('get', Api.member.storeList, params);
console.log(list);
this.storeList = list;
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
methods: {
//显示分类面板
toggleCateMask(type) {
let timer = type === 'show' ? 10 : 300;
let state = type === 'show' ? 1 : 0;
this.cateMaskState = 2;
setTimeout(() => {
this.cateMaskState = state;
}, timer);
},
//分类点击
changeCate(item) {
this.pageNum = 1;
this.cateId = item.id;
this.toggleCateMask();
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `../../pagesC/store/store?id=${id}`
});
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
}
.content {
padding-top: 96upx;
}
.navbar {
position: fixed;
left: 0;
top: var(--window-top);
display: flex;
width: 100%;
height: 80upx;
background: #fff;
box-shadow: 0 2upx 10upx rgba(0, 0, 0, 0.06);
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30upx;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 120upx;
height: 0;
border-bottom: 4upx solid $base-color;
}
}
}
.p-box {
display: flex;
flex-direction: column;
.yticon {
display: flex;
align-items: center;
justify-content: center;
width: 30upx;
height: 14upx;
line-height: 1;
margin-left: 4upx;
font-size: 26upx;
color: #888;
&.active {
color: $base-color;
}
}
.xia {
transform: scaleY(-1);
}
}
.cate-item {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 80upx;
position: relative;
font-size: 44upx;
&:after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
border-left: 1px solid #ddd;
width: 0;
height: 36upx;
}
}
}
/* 分类 */
.cate-mask {
position: fixed;
left: 0;
top: var(--window-top);
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0);
z-index: 95;
transition: 0.3s;
.cate-content {
width: 630upx;
height: 100%;
background: #fff;
float: right;
transform: translateX(100%);
transition: 0.3s;
}
&.none {
display: none;
}
&.show {
background: rgba(0, 0, 0, 0.4);
.cate-content {
transform: translateX(0);
}
}
}
.cate-list {
display: flex;
flex-direction: column;
height: 100%;
.cate-item {
display: flex;
align-items: center;
height: 90upx;
padding-left: 30upx;
font-size: 28upx;
color: #555;
position: relative;
}
.two {
height: 64upx;
color: #303133;
font-size: 30upx;
background: #f8f8f8;
}
.active {
color: $base-color;
}
}
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
padding: 0 30upx;
background: #fff;
.goods-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price-box {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10upx;
font-size: 24upx;
color: $font-color-light;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
&:before {
content: '¥';
font-size: 26upx;
}
}
}
</style>

View File

@@ -0,0 +1,742 @@
<template>
<view class="container">
<view class="carousel">
<view class="image-wrapper"><image :src="detailData.pic" class="loaded" mode="aspectFill"></image></view>
</view>
<view class="introduce-section">
<text class="title">{{ detailData.name }}</text>
<view class="bot-row">
<text>销量: 6</text>
<text>库存: {{ detailData.stock }}</text>
<text>浏览量: {{ detailData.hit }}</text>
</view>
</view>
<!-- 分享 -->
<view class="share-section" @click="share">
<view class="share-icon">
<text class="yticon icon-xingxing"></text>
</view>
<text class="tit">该商品分享可领49减10红包</text>
<text class="yticon icon-bangzhu1"></text>
<view class="share-btn">
立即分享
<text class="yticon icon-you"></text>
</view>
</view>
<view class="c-list">
<view class="c-row b-b">
<text class="tit">服务</text>
<view class="bz-list con">
<text>7天无理由退换货 ·</text>
<text>假一赔十 ·</text>
</view>
</view>
</view>
<view class="">
<view class="hot-floor" v-if="goodsList.length > 0">
<view v-for="(item, index) in goodsList" :key="index" class="floor-item" @click="navToDetailPage(item)">
<image :src="item.pic" mode="aspectFill"></image>
<text class="title clamp">{{ item.name }}</text>
<text class="price">{{ item.price }}</text>
</view>
</view>
</view>
<!-- 底部操作菜单 -->
<view class="page-bottom">
<navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
<text class="yticon icon-xiatubiao--copy"></text>
<text>首页</text>
</navigator>
<view class="p-b-btn" :class="{ active: favorite }" @click="toFavorite(detailData)">
<text class="yticon icon-shoucang"></text>
<text>收藏</text>
</view>
</view>
<!-- 分享 -->
<share ref="share" :contentHeight="580" :shareList="shareList"></share>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import share from '@/components/share';
import { mapState } from 'vuex';
export default {
components: {
share
},
data() {
return {
specClass: 'none',
specSelected: [],
small: null,
sku: [],
detailData: [],
favorite: true,
shareList: [],
cat_list: [],
desc: `
<div style="width:100%">
<img style="width:100%;display:block;" src="https://gd3.alicdn.com/imgextra/i4/479184430/O1CN01nCpuLc1iaz4bcSN17_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd2.alicdn.com/imgextra/i2/479184430/O1CN01gwbN931iaz4TzqzmG_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd3.alicdn.com/imgextra/i3/479184430/O1CN018wVjQh1iaz4aupv1A_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd4.alicdn.com/imgextra/i4/479184430/O1CN01tWg4Us1iaz4auqelt_!!479184430.jpg_400x400.jpg" />
<img style="width:100%;display:block;" src="https://gd1.alicdn.com/imgextra/i1/479184430/O1CN01Tnm1rU1iaz4aVKcwP_!!479184430.jpg_400x400.jpg" />
</div>
`,
goodsList: []
};
},
async onLoad(ops) {
//接收传值,id里面放的是标题因为测试数据并没写id
let id = ops.id;
if (id) {
this.logining = true;
let params = { id: ops.id };
let data = await Api.apiCall('get', Api.member.schoolDetail, params);
this.logining = false;
if (data) {
let detailData = data;
this.detailData = detailData;
this.goodsList = data.goodsList;
this.loaded = true;
uni.setNavigationBarTitle({
title: detailData.name
});
}
}
this.shareList = await this.$api.json('shareList');
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//分享
share() {
this.$refs.share.toggleMask();
},
//收藏
toFavorite(item) {
if (!this.hasLogin) {
let url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
this.favorite = !this.favorite;
let params = { objId: item.id, type: 6, name: item.name, meno1: item.pic, meno2: item.price, meno3: item.sale };
Api.apiCall('post', Api.goods.favoriteSave, params);
}
},
//详情页
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `../../pagesA/product/product?id=${id}`
});
},
async jifenPay(item) {
if (!this.hasLogin) {
let url = '/pages/public/login';
uni.navigateTo({
url
});
return false;
}
let id = item.id;
let data;
let params = { goodsId: id };
data = await Api.apiCall('post', Api.order.jifenPay, params);
if (data) {
this.$api.msg(data);
}
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page {
background: $page-color-base;
padding-bottom: 160upx;
}
.icon-you {
font-size: $font-base + 2upx;
color: #888;
}
.carousel {
height: 722upx;
position: relative;
swiper {
height: 100%;
}
.image-wrapper {
width: 100%;
height: 100%;
}
.swiper-item {
display: flex;
justify-content: center;
align-content: center;
height: 750upx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
}
/* 分类推荐楼层 */
.hot-floor {
width: 100%;
overflow: hidden;
margin-bottom: 20upx;
.floor-img-box {
width: 100%;
height: 320upx;
position: relative;
&:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(rgba(255, 255, 255, 0.06) 30%, #f8f8f8);
}
}
.floor-img {
width: 100%;
height: 100%;
}
.floor-list {
white-space: nowrap;
padding: 20upx;
padding-right: 50upx;
border-radius: 6upx;
margin-top: -140upx;
margin-left: 30upx;
background: #fff;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
position: relative;
z-index: 1;
}
.scoll-wrapper {
display: flex;
align-items: flex-start;
}
.floor-item {
width: 180upx;
margin-right: 20upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
line-height: 1.8;
image {
width: 180upx;
height: 180upx;
border-radius: 6upx;
}
.price {
color: $uni-color-primary;
}
}
.more {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
flex-shrink: 0;
width: 180upx;
height: 180upx;
border-radius: 6upx;
background: #f3f3f3;
font-size: $font-base;
color: $font-color-light;
text:first-child {
margin-bottom: 4upx;
}
}
}
/* 标题简介 */
.introduce-section {
background: #fff;
padding: 20upx 30upx;
.title {
font-size: 32upx;
color: $font-color-dark;
height: 50upx;
line-height: 50upx;
}
.price-box {
display: flex;
align-items: baseline;
height: 64upx;
padding: 10upx 0;
font-size: 26upx;
color: $uni-color-primary;
}
.price {
font-size: $font-lg + 2upx;
}
.m-price {
margin: 0 12upx;
color: $font-color-light;
text-decoration: line-through;
}
.coupon-tip {
align-items: center;
padding: 4upx 10upx;
background: $uni-color-primary;
font-size: $font-sm;
color: #fff;
border-radius: 6upx;
line-height: 1;
transform: translateY(-4upx);
}
.bot-row {
display: flex;
align-items: center;
height: 50upx;
font-size: $font-sm;
color: $font-color-light;
text {
flex: 1;
}
}
}
/* 分享 */
.share-section {
display: flex;
align-items: center;
color: $font-color-base;
background: linear-gradient(left, #fdf5f6, #fbebf6);
padding: 12upx 30upx;
.share-icon {
display: flex;
align-items: center;
width: 70upx;
height: 30upx;
line-height: 1;
border: 1px solid $uni-color-primary;
border-radius: 4upx;
position: relative;
overflow: hidden;
font-size: 22upx;
color: $uni-color-primary;
&:after {
content: '';
width: 50upx;
height: 50upx;
border-radius: 50%;
left: -20upx;
top: -12upx;
position: absolute;
background: $uni-color-primary;
}
}
.icon-xingxing {
position: relative;
z-index: 1;
font-size: 24upx;
margin-left: 2upx;
margin-right: 10upx;
color: #fff;
line-height: 1;
}
.tit {
font-size: $font-base;
margin-left: 10upx;
}
.icon-bangzhu1 {
padding: 10upx;
font-size: 30upx;
line-height: 1;
}
.share-btn {
flex: 1;
text-align: right;
font-size: $font-sm;
color: $uni-color-primary;
}
.icon-you {
font-size: $font-sm;
margin-left: 4upx;
color: $uni-color-primary;
}
}
.c-list {
font-size: $font-sm + 2upx;
color: $font-color-base;
background: #fff;
.c-row {
display: flex;
align-items: center;
padding: 20upx 30upx;
position: relative;
}
.tit {
width: 140upx;
}
.con {
flex: 1;
color: $font-color-dark;
.selected-text {
margin-right: 10upx;
}
}
.bz-list {
height: 40upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
text {
display: inline-block;
margin-right: 30upx;
}
}
.con-list {
flex: 1;
display: flex;
flex-direction: column;
color: $font-color-dark;
line-height: 40upx;
}
.red {
color: $uni-color-primary;
}
}
/* 评价 */
.eva-section {
display: flex;
flex-direction: column;
padding: 20upx 30upx;
background: #fff;
margin-top: 16upx;
.e-header {
display: flex;
align-items: center;
height: 70upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.tit {
font-size: $font-base + 2upx;
color: $font-color-dark;
margin-right: 4upx;
}
.tip {
flex: 1;
text-align: right;
}
.icon-you {
margin-left: 10upx;
}
}
}
.eva-box {
display: flex;
padding: 20upx 0;
.portrait {
flex-shrink: 0;
width: 80upx;
height: 80upx;
border-radius: 100px;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
font-size: $font-base;
color: $font-color-base;
padding-left: 26upx;
.con {
font-size: $font-base;
color: $font-color-dark;
padding: 20upx 0;
}
.bot {
display: flex;
justify-content: space-between;
font-size: $font-sm;
color: $font-color-light;
}
}
}
/* 详情 */
.detail-desc {
background: #fff;
margin-top: 16upx;
.d-header {
display: flex;
justify-content: center;
align-items: center;
height: 80upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
position: relative;
text {
padding: 0 20upx;
background: #fff;
position: relative;
z-index: 1;
}
&:after {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%);
width: 300upx;
height: 0;
content: '';
border-bottom: 1px solid #ccc;
}
}
}
/* 规格选择弹窗 */
.attr-content {
padding: 10upx 30upx;
.a-t {
display: flex;
image {
width: 170upx;
height: 170upx;
flex-shrink: 0;
margin-top: -40upx;
border-radius: 8upx;
}
.right {
display: flex;
flex-direction: column;
padding-left: 24upx;
font-size: $font-sm + 2upx;
color: $font-color-base;
line-height: 42upx;
.price {
font-size: $font-lg;
color: $uni-color-primary;
margin-bottom: 10upx;
}
.selected-text {
margin-right: 10upx;
}
}
}
.attr-list {
display: flex;
flex-direction: column;
font-size: $font-base + 2upx;
color: $font-color-base;
padding-top: 30upx;
padding-left: 10upx;
}
.item-list {
padding: 20upx 0 0;
display: flex;
flex-wrap: wrap;
text {
display: flex;
align-items: center;
justify-content: center;
background: #eee;
margin-right: 20upx;
margin-bottom: 20upx;
border-radius: 100upx;
min-width: 60upx;
height: 60upx;
padding: 0 20upx;
font-size: $font-base;
color: $font-color-dark;
}
.selected {
background: #fbebee;
color: $uni-color-primary;
}
}
}
/* 弹出层 */
.popup {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 99;
&.show {
display: block;
.mask {
animation: showPopup 0.2s linear both;
}
.layer {
animation: showLayer 0.2s linear both;
}
}
&.hide {
.mask {
animation: hidePopup 0.2s linear both;
}
.layer {
animation: hideLayer 0.2s linear both;
}
}
&.none {
display: none;
}
.mask {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: rgba(0, 0, 0, 0.4);
}
.layer {
position: fixed;
z-index: 99;
bottom: 0;
width: 100%;
min-height: 40vh;
border-radius: 10upx 10upx 0 0;
background-color: #fff;
.btn {
height: 66upx;
line-height: 66upx;
border-radius: 100upx;
background: $uni-color-primary;
font-size: $font-base + 2upx;
color: #fff;
margin: 30upx auto 20upx;
}
}
@keyframes showPopup {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes hidePopup {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes showLayer {
0% {
transform: translateY(120%);
}
100% {
transform: translateY(0%);
}
}
@keyframes hideLayer {
0% {
transform: translateY(0);
}
100% {
transform: translateY(120%);
}
}
}
/* 底部操作菜单 */
.page-bottom {
position: fixed;
left: 30upx;
bottom: 30upx;
z-index: 95;
display: flex;
justify-content: center;
align-items: center;
width: 690upx;
height: 100upx;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
border-radius: 16upx;
.p-b-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: $font-sm;
color: $font-color-base;
width: 96upx;
height: 80upx;
.yticon {
font-size: 40upx;
line-height: 48upx;
color: $font-color-light;
}
&.active,
&.active .yticon {
color: $uni-color-primary;
}
.icon-fenxiang2 {
font-size: 42upx;
transform: translateY(-2upx);
}
.icon-shoucang {
font-size: 46upx;
}
}
.action-btn-group {
display: flex;
height: 76upx;
border-radius: 100px;
overflow: hidden;
box-shadow: 0 20upx 40upx -16upx #fa436a;
box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
background: linear-gradient(to right, #ffac30, #fa436a, #f56c6c);
margin-left: 20upx;
position: relative;
&:after {
content: '';
position: absolute;
top: 50%;
right: 50%;
transform: translateY(-50%);
height: 28upx;
width: 0;
border-right: 1px solid rgba(255, 255, 255, 0.5);
}
.action-btn {
display: flex;
align-items: center;
justify-content: center;
width: 180upx;
height: 100%;
font-size: $font-base;
padding: 0;
border-radius: 0;
background: transparent;
}
}
}
</style>

View File

@@ -0,0 +1,386 @@
<template>
<view class="content">
<view class="navbar" :style="{ position: headerPosition, top: headerTop }">
<view class="nav-item" :class="{ current: filterIndex === 0 }" @click="tabClick(0)">综合排序</view>
<view class="nav-item" :class="{ current: filterIndex === 2 }" @click="tabClick(2)">
<text>热度</text>
<view class="p-box">
<text :class="{ active: priceOrder === 1 && filterIndex === 2 }" class="yticon icon-shang"></text>
<text :class="{ active: priceOrder === 2 && filterIndex === 2 }" class="yticon icon-shang xia"></text>
</view>
</view>
</view>
<view class="goods-list">
<view v-for="(item, index) in goodsList" :key="index" class="goods-item" @click="navToDetailPage(item)">
<view class="image-wrapper"><image :src="item.pic" mode="aspectFill"></image></view>
<text class="title clamp">{{ item.name }}</text>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components: {
uniLoadMore
},
data() {
return {
cateMaskState: 0, //分类面板展开状态
headerPosition: 'fixed',
headerTop: '0px',
keyword: '',
loadingType: 'more', //加载更多状态
filterIndex: 0,
cateId: 0, //已选三级分类id
pageNum: 1,
cid: null,
priceOrder: 0, //1 价格从低到高 2价格从高到低
cateList: [],
goodsList: []
};
},
onLoad(options) {
// #ifdef H5
this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
// #endif
this.keyword = options.keyword;
this.cateId = options.sid;
this.loadCateList(options.fid, options.sid);
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = this.pageNum + 1;
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = this.pageNum + 1;
this.loadData();
},
methods: {
//加载分类
async loadCateList(fid, sid) {
let params = {};
let list = await Api.apiCall('get', Api.goods.typeGiftList, params);
//let list = await this.$api.json('cateList');
let cateList = list.filter(item => item.pid == null);
cateList.forEach(item => {
let tempList = list.filter(val => val.pid == item.id);
item.child = tempList;
});
this.cateList = cateList;
},
//加载商品 ,带下拉刷新和上滑加载
async loadData(type = 'add', loading) {
//没有更多直接返回
if (type === 'add') {
if (this.loadingType === 'nomore') {
return;
}
this.loadingType = 'loading';
} else {
this.loadingType = 'more';
}
let params;
if (this.cateId) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId };
if (this.keyword) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId, keyword: this.keyword };
}
}
if (this.keyword) {
params = { pageNum: this.pageNum, keyword: this.keyword };
} else {
params = { pageNum: this.pageNum };
}
let list = await Api.apiCall('get', Api.member.schoolList, params);
let goodsList = list.records;
// let goodsList = await this.$api.json('goodsList');
if (type === 'refresh') {
this.goodsList = [];
}
//筛选,测试数据直接前端筛选了
if (this.filterIndex === 1) {
goodsList.sort((a, b) => b.is985 - a.is985);
}
if (this.filterIndex === 2) {
goodsList.sort((a, b) => {
if (this.priceOrder == 1) {
return a.hot - b.hot;
}
return b.price - a.price;
});
}
this.goodsList = this.goodsList.concat(goodsList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.goodsList.length > list.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
},
//筛选点击
tabClick(index) {
this.pageNum = 1;
if (this.filterIndex === index && index !== 2) {
return;
}
this.filterIndex = index;
if (index === 2) {
this.priceOrder = this.priceOrder === 1 ? 2 : 1;
} else {
this.priceOrder = 0;
}
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//显示分类面板
toggleCateMask(type) {
let timer = type === 'show' ? 10 : 300;
let state = type === 'show' ? 1 : 0;
this.cateMaskState = 2;
setTimeout(() => {
this.cateMaskState = state;
}, timer);
},
//分类点击
changeCate(item) {
console.log(item.id);
this.pageNum = 1;
this.cateId = item.id;
this.toggleCateMask();
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `../../pagesC/store/school?id=${id}`
});
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
}
.content {
padding-top: 96upx;
}
.navbar {
position: fixed;
left: 0;
top: var(--window-top);
display: flex;
width: 100%;
height: 80upx;
background: #fff;
box-shadow: 0 2upx 10upx rgba(0, 0, 0, 0.06);
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30upx;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 120upx;
height: 0;
border-bottom: 4upx solid $base-color;
}
}
}
.p-box {
display: flex;
flex-direction: column;
.yticon {
display: flex;
align-items: center;
justify-content: center;
width: 30upx;
height: 14upx;
line-height: 1;
margin-left: 4upx;
font-size: 26upx;
color: #888;
&.active {
color: $base-color;
}
}
.xia {
transform: scaleY(-1);
}
}
.cate-item {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 80upx;
position: relative;
font-size: 44upx;
&:after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
border-left: 1px solid #ddd;
width: 0;
height: 36upx;
}
}
}
/* 分类 */
.cate-mask {
position: fixed;
left: 0;
top: var(--window-top);
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0);
z-index: 95;
transition: 0.3s;
.cate-content {
width: 630upx;
height: 100%;
background: #fff;
float: right;
transform: translateX(100%);
transition: 0.3s;
}
&.none {
display: none;
}
&.show {
background: rgba(0, 0, 0, 0.4);
.cate-content {
transform: translateX(0);
}
}
}
.cate-list {
display: flex;
flex-direction: column;
height: 100%;
.cate-item {
display: flex;
align-items: center;
height: 90upx;
padding-left: 30upx;
font-size: 28upx;
color: #555;
position: relative;
}
.two {
height: 64upx;
color: #303133;
font-size: 30upx;
background: #f8f8f8;
}
.active {
color: $base-color;
}
}
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
padding: 0 30upx;
background: #fff;
.goods-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price-box {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10upx;
font-size: 24upx;
color: $font-color-light;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
&:before {
content: '¥';
font-size: 26upx;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,382 @@
<template>
<view class="content">
<view class="navbar" :style="{ position: headerPosition, top: headerTop }">
<view class="nav-item" :class="{ current: filterIndex === 0 }" @click="tabClick(0)">综合排序</view>
<view class="nav-item" :class="{ current: filterIndex === 2 }" @click="tabClick(2)">
<text>价格</text>
<view class="p-box">
<text :class="{ active: priceOrder === 1 && filterIndex === 2 }" class="yticon icon-shang"></text>
<text :class="{ active: priceOrder === 2 && filterIndex === 2 }" class="yticon icon-shang xia"></text>
</view>
</view>
<text class="cate-item yticon icon-fenlei1" @click="toggleCateMask('show')"></text>
</view>
<view class="goods-list">
<view v-for="(item, index) in goodsList" :key="index" class="goods-item" @click="navToDetailPage(item)">
<view class="image-wrapper"><image :src="item.logo" mode="aspectFill"></image></view>
<text class="title clamp">{{ item.name }}</text>
<view class="price-box">
<text >浏览{{ item.hit }}</text>
<text>收藏 {{item.collect}}</text>
</view>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components: {
mallplusCopyright,
uniLoadMore
},
data() {
return {
cateMaskState: 0, //分类面板展开状态
headerPosition: 'fixed',
headerTop: '0px',
keyword: '',
loadingType: 'more', //加载更多状态
filterIndex: 0,
cateId: 0, //已选三级分类id
pageNum: 1,
cid: null,
priceOrder: 0, //1 价格从低到高 2价格从高到低
cateList: [],
goodsList: []
};
},
onLoad(options) {
// #ifdef H5
this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
// #endif
this.keyword = options.keyword;
this.cateId = options.sid;
//this.loadCateList(options.fid, options.sid);
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = this.pageNum + 1;
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = this.pageNum + 1;
this.loadData();
},
methods: {
//加载商品 ,带下拉刷新和上滑加载
async loadData(type = 'add', loading) {
//没有更多直接返回
if (type === 'add') {
if (this.loadingType === 'nomore') {
return;
}
this.loadingType = 'loading';
} else {
this.loadingType = 'more';
}
let params;
if (this.cateId) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId };
if (this.keyword) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId, keyword: this.keyword };
}
}
if (this.keyword) {
params = { pageNum: this.pageNum, keyword: this.keyword };
} else {
params = { pageNum: this.pageNum };
}
let list = await Api.apiCall('get', Api.member.storeList, params);
let goodsList = list.records;
// let goodsList = await this.$api.json('goodsList');
if (type === 'refresh') {
this.goodsList = [];
}
//筛选,测试数据直接前端筛选了
if (this.filterIndex === 1) {
goodsList.sort((a, b) => b.sales - a.sales);
}
if (this.filterIndex === 2) {
goodsList.sort((a, b) => {
if (this.priceOrder == 1) {
return a.price - b.price;
}
return b.price - a.price;
});
}
this.goodsList = this.goodsList.concat(goodsList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.goodsList.length > list.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
},
//筛选点击
tabClick(index) {
this.pageNum = 1;
if (this.filterIndex === index && index !== 2) {
return;
}
this.filterIndex = index;
if (index === 2) {
this.priceOrder = this.priceOrder === 1 ? 2 : 1;
} else {
this.priceOrder = 0;
}
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//显示分类面板
toggleCateMask(type) {
let timer = type === 'show' ? 10 : 300;
let state = type === 'show' ? 1 : 0;
this.cateMaskState = 2;
setTimeout(() => {
this.cateMaskState = state;
}, timer);
},
//分类点击
changeCate(item) {
console.log(item.id);
this.pageNum = 1;
this.cateId = item.id;
this.toggleCateMask();
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `../../pagesC/store/store?id=${id}`
});
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
}
.content {
padding-top: 96upx;
}
.navbar {
position: fixed;
left: 0;
top: var(--window-top);
display: flex;
width: 100%;
height: 80upx;
background: #fff;
box-shadow: 0 2upx 10upx rgba(0, 0, 0, 0.06);
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30upx;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 120upx;
height: 0;
border-bottom: 4upx solid $base-color;
}
}
}
.p-box {
display: flex;
flex-direction: column;
.yticon {
display: flex;
align-items: center;
justify-content: center;
width: 30upx;
height: 14upx;
line-height: 1;
margin-left: 4upx;
font-size: 26upx;
color: #888;
&.active {
color: $base-color;
}
}
.xia {
transform: scaleY(-1);
}
}
.cate-item {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 80upx;
position: relative;
font-size: 44upx;
&:after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
border-left: 1px solid #ddd;
width: 0;
height: 36upx;
}
}
}
/* 分类 */
.cate-mask {
position: fixed;
left: 0;
top: var(--window-top);
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0);
z-index: 95;
transition: 0.3s;
.cate-content {
width: 630upx;
height: 100%;
background: #fff;
float: right;
transform: translateX(100%);
transition: 0.3s;
}
&.none {
display: none;
}
&.show {
background: rgba(0, 0, 0, 0.4);
.cate-content {
transform: translateX(0);
}
}
}
.cate-list {
display: flex;
flex-direction: column;
height: 100%;
.cate-item {
display: flex;
align-items: center;
height: 90upx;
padding-left: 30upx;
font-size: 28upx;
color: #555;
position: relative;
}
.two {
height: 64upx;
color: #303133;
font-size: 30upx;
background: #f8f8f8;
}
.active {
color: $base-color;
}
}
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
padding: 20upx 20upx 0 20upx;
background: #fff;
.goods-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price-box {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10upx;
font-size: 24upx;
color: $font-color-light;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
&:before {
content: '¥';
font-size: 26upx;
}
}
}
</style>

View File

@@ -0,0 +1,95 @@
<template>
<view class="content">
<text class="success-icon yticon icon-xuanzhong2"></text>
<text class="tit">{{orderInfo.name}}</text>
<view class="result-mid red-price" v-if="orderInfo.status==1">
申请中----
</view>
<view class="result-mid red-price" v-if="orderInfo.status==2">
申请拒绝----
</view>
<view class="btn-group">
<navigator url="/pages/order/order?status=0" open-type="redirect" class="mix-btn">用户中心</navigator>
<navigator url="/pages/index/user" open-type="switchTab" class="mix-btn hollow">返回首页</navigator>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
export default {
components: {
mallplusCopyright
},
data() {
return {
paymentId: 0,
orderInfo: {}, // 支付单详情
orderId: 0,
status: false
}
},
async onLoad(options) {
console.log(options)
let params = { };
let data = await Api.apiCall('get', Api.member.storeDetail1, params);
console.log(data)
this.orderInfo = data.store;
if (data.member){
uni.setStorageSync('userInfo', data.member);
}
} ,
methods: {
status(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
}}
};
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.success-icon {
font-size: 160upx;
color: #fa436a;
margin-top: 100upx;
}
.tit {
font-size: 38upx;
color: #303133;
}
.btn-group {
padding-top: 100upx;
}
.mix-btn {
margin-top: 30upx;
display: flex;
align-items: center;
justify-content: center;
width: 600upx;
height: 80upx;
font-size: $font-lg;
color: #fff;
background-color: $base-color;
border-radius: 10upx;
&.hollow {
background: #fff;
color: #303133;
border: 1px solid #ccc;
}
}
</style>