You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

764 lines
19 KiB

<template>
<view class="page">
<view class="swiper-container">
<view class="swiper-page" v-show="currentIndex == 0">
<view class="title">
<view class="title-sreach">
<view class="title-name">
商家中心
</view>
</view>
</view>
<view class="shop-title">
<view class="title1">
<image :src="shop.shopIcon" alt="" />
</view>
<view class="title2">
<view class="title22" @tap="checkArea">
{{shop.shopName}}
<uni-icons type="right"></uni-icons>
</view>
<view class="title33" @tap="updateStatus">
{{businessStatus == '1'?'暂停营业':'正常营业'}}
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
</view>
<view class="shop-order">
<view class="order1">
待办事项
</view>
<view class="order2">
<view class="order22">
<view class="order33" @tap="changeIndex(1,3)">
<view class="order44" style="color: red;">
{{daipeisongjiedan}}
</view>
<view class="order55">
待配送接单
</view>
</view>
<view class="order33" @tap="changeIndex(1,13)">
<view class="order44" style="color: red;">
{{daichucan}}
</view>
<view class="order55">
待出餐
</view>
</view>
<view class="order33" @tap="changeIndex(1,4)">
<view class="order44">
{{daiquhuo}}
</view>
<view class="order55">
待取货
</view>
</view>
<view class="order33" @tap="changeIndex(1,5)">
<view class="order44">
{{daisongda}}
</view>
<view class="order55">
待送达
</view>
</view>
</view>
<view class="order22">
<view class="order33" @tap="changeIndex(1,2)">
<view class="order44">
{{daixiaofei}}
</view>
<view class="order55">
待消费
</view>
</view>
<view class="order33" @tap="goDetail('tui',11)">
<view class="order44" style="color: red;">
{{shopData.refundCount == undefined?0:shopData.refundCount}}
</view>
<view class="order55">
待退款/售后
</view>
</view>
<view class="order33" @tap="goDetail('pj','cha')">
<view class="order44">
{{shopData.pendingBadReviewCount == undefined?0:shopData.pendingBadReviewCount}}
</view>
<view class="order55">
待回复差评
</view>
</view>
<view class="order33" v-if="shopConfig.supportShopDelivery == 1"
@tap="goDetail('selfDelivery')">
<view class="order44" style="color: red;">
{{shopData.shopDeliveryPendingCount == undefined?0:shopData.shopDeliveryPendingCount}}
</view>
<view class="order55">
自配送订单
</view>
</view>
<view class="order33" v-if="shopConfig.supportTransferDelivery == 1"
@tap="goDetail('transferDelivery')">
<view class="order44" style="color: red;">
{{shopData.transferDeliveryPendingCount == undefined?0:shopData.transferDeliveryPendingCount}}
</view>
<view class="order55">
中转配送
</view>
</view>
</view>
<!-- <view class="order22">
</view> -->
</view>
</view>
<view class="shop-order">
<view class="order1" style="display: flex;">
<view style="flex: 1;">
今日实时数据
</view>
</view>
<view class="data2">
<view class="data22">
<view class="data222">
{{shopData.orderRevenueAndCount ?shopData.orderRevenueAndCount.count:0}}
</view>
<view class="data333">
今日订单
</view>
</view>
<view class="data22">
<view class="data222">
{{shopData.orderRevenueAndCount?shopData.orderRevenueAndCount.amount:0}}
</view>
<view class="data333">
营业额
</view>
</view>
<view class="data22">
<view class="data222">
{{shopData.orderRevenueAndCount?shopData.orderRevenueAndCount.afterSaleCount:0}}
</view>
<view class="data333">
退/售后笔数
</view>
</view>
<view class="data22">
<view class="data222">
{{shopData.orderRevenueAndCount?shopData.orderRevenueAndCount.afterSaleAmount:0}}
</view>
<view class="data333">
退/售后金额
</view>
</view>
</view>
</view>
<view class="shop-order">
<view class="order1">
必备工具
</view>
<view class="menu2">
<view class="menu22" @tap="goDetail('sp')">
<view class="menu33">
<image src="../../static/image/dingdan/dd0.png" alt="" />
</view>
<view class="menu44">
商品管理
</view>
</view>
<!-- <view class="menu22" @tap="goDetail('dp')">
<view class="menu33">
<image src="../../static/image/dingdan/dd1.png" alt="" />
</view>
<view class="menu44">
店铺管理
</view>
</view> -->
<view class="menu22" @tap="changeIndex(1)">
<view class="menu33">
<image src="../../static/image/dingdan/dd2.png" alt="" />
</view>
<view class="menu44">
订单管理
</view>
</view>
<view class="menu22" @tap="goDetail('zd')">
<view class="menu33">
<image src="../../static/image/dingdan/dd3.png" alt="" />
</view>
<view class="menu44">
账单结算
</view>
</view>
<view class="menu22" @tap="goDetail('pj')">
<view class="menu33">
<image src="../../static/image/dingdan/dd4.png" alt="" />
</view>
<view class="menu44">
顾客评价
</view>
</view>
<view class="menu22" @tap="goDetail('dy')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<image src="../../static/image/dingdan/dd4.png" alt="" />
</view>
<view class="menu44">
打印设置
</view>
</view>
<view class="menu22" @tap="goDetail('shjl')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<image src="../../static/image/dingdan/dd0.png" alt="" />
</view>
<view class="menu44">
退款售后记录
</view>
</view>
<view class="menu22" @tap="goDetail('yyxx')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<image src="../../static/image/dingdan/dd0.png" alt="" />
</view>
<view class="menu44">
营业信息
</view>
</view>
<view class="menu22" @tap="goDetail('sjxx')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<image src="../../static/image/dingdan/dd1.png" alt="" />
</view>
<view class="menu44">
商家信息
</view>
</view>
<view class="menu22" @tap="goDetail('hx')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<uni-icons type="scan" size="25"></uni-icons>
</view>
<view class="menu44">
扫码核销
</view>
</view>
</view>
<view style="width: 100%;height: 20rpx;"></view>
</view>
</view>
<view class="swiper-page" v-show="currentIndex == 1">
<de-livery ref="deLivery"></de-livery>
</view>
<view class="swiper-page" v-show="currentIndex == 2">
<my-center ref="myCenter"></my-center>
</view>
</view>
<!-- 弹出区域选择 -->
<uni-popup ref="areaPopup" background-color="#fff">
<view class="popup-area-content">
<view class="popup-area-title">
<text>请选择店铺</text>
</view>
<view class="popup-area-container" v-for="(item,index) in areaList" :key="index"
@tap="onClickArea(item)">
<text style="display: inline-block">{{item.shop.shopName}}</text>
</view>
</view>
</uni-popup>
<tab-bar :width="width" @tab-index="changeIndex" :currentIndex="currentIndex"></tab-bar>
</view>
</template>
<script>
import tabBar from "@/components/tab-bar/tab-bar.vue";
import deLivery from "@/components/tab-bar/delivery.vue";
import myCenter from "@/components/tab-bar/myCenter.vue";
export default {
data() {
return {
width: 0,
daipeisongjiedan:0,
currentIndex: 0,
businessStatus: 1,
shop: {},
shopConfig: {},
areaList: [],
shopList: [],
shopData: {},
daixiaofei: 0,
daichucan: 0,
daiquhuo: 0,
daisongda: 0
}
},
components: {
tabBar,
deLivery,
myCenter
},
onShow() {
if(!uni.getStorageSync('peisongyuan')){
this.indexInit()
}
},
onLoad() {
console.log('hahaha',uni.getStorageSync('shopId'))
if(!uni.getStorageSync('area') || !uni.getStorageSync('shopId')){
uni.reLaunch({
url: '../login/login'
})
}
if(uni.getStorageSync('peisongyuan')){
uni.reLaunch({
url: '../worker/index'
})
return
}
},
methods: {
indexInit() {
let that = this
this.shopConfig = JSON.parse(uni.getStorageSync('area')) || {}
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
}
});
this.getData()
this.getBusinessStatus()
this.getShopTakeaway()
if (!uni.getStorageSync('area')) {
this.checkArea()
}
},
getShopTakeaway(){
this.NB.sendRequest("/app/shoptakeaway/getByShopId", {
shopId: uni.getStorageSync('shopId')
}, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
uni.setStorageSync('shopTakeaway',res.result)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
checkArea() {
this.NB.sendRequest("/auth/getShopByUser", {}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.areaList = res.result
this.$refs.areaPopup.open()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//获取营业状态
getBusinessStatus() {
this.NB.sendRequest("/app/shoptakeaway/getByShopId", {
shopId: uni.getStorageSync('shopId')
}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shop = res.result
this.shop.shopIcon = JSON.parse(uni.getStorageSync('area')).shopIcon
this.shop.shopName = JSON.parse(uni.getStorageSync('area')).shopName
this.businessStatus = res.result.status
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
onClickArea(item) {
uni.setStorageSync('shopId', item.shop.id)
uni.setStorageSync('shopMerchantType', item.shop.merchantType)
uni.setStorageSync('area', JSON.stringify(item.shop))
this.getBusinessStatus()
this.getData()
this.$refs.areaPopup.close()
},
//更改营业状态
updateStatus() {
let that = this;
uni.showModal({
title: '提示',
content: '要更改营业状态吗?',
cancelText:'确定',
confirmText:'取消',
success: function(res1) {
if (res1.cancel) {
that.NB.sendRequest("/app/shoptakeaway/update", {
shopId: uni.getStorageSync('shopId'),
status: that.businessStatus == "1" ? '0' : that.businessStatus == "0" ?
'1' : '2'
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
uni.showToast({
title: '更改成功',
icon: 'none'
});
that.businessStatus = that.businessStatus == "1" ? '0' : that
.businessStatus == "0" ? '1' : '2'
} else {
uni.showToast({
title: res.message,
icon: 'none'
});
}
uni.hideLoading()
}).catch((res) => {})
}
}
});
},
goDetail(type, index) {
let url = ''
switch (type) {
case 'tj':
url = '/pages/shop/dataStatistics'
break;
case 'dy':
url = '/pages/myCenter/setPrint'
break;
case 'sp':
url = '/pages/shop/goodsList'
break;
case 'yy':
url = '/pages/myCenter/businessInfo'
break;
case 'sjxx':
url = '/pages/myCenter/shopDetail'
break;
case 'selfDelivery':
url = '/pages/shop/selfDeliveryOrderList'
break;
case 'transferDelivery':
url = '/pages/shop/transferDeliveryOrderList'
break;
case 'tui':
url = '/pages/shop/afterService?type=shop'
break;
case 'zd':
url = '/pages/shop/shopBill'
break;
case 'shjl':
url = '/pages/shop/afterService?type=shop&mode=record'
break;
case 'sjxx':
url = '/pages/myCenter/shopDetail'
break;
case 'yyxx':
url = '/pages/myCenter/businessInfo'
break;
case 'pj':
let item = {
shopScore: uni.getStorageSync('shopScore'),
id: uni.getStorageSync('shopId')
}
url = '/pages/shop/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=1&isCha=' + (index ==
'cha' ? 1 : 0)
break;
case 'hx':
this.scanCodeAdd()
break;
default:
}
uni.navigateTo({
url: url
})
},
clearData(){
this.daisongda = 0
this.daiquhuo = 0
this.daixiaofei = 0
this.daipeisongjiedan = 0
this.daichucan = 0
},
getData() {
let that = this;
this.daixiaofei = 0
this.daipeisongjiedan = 0
this.daichucan = 0
this.daiquhuo = 0
this.daisongda = 0
that.NB.sendRequest("/mall/order/countByShop/" + uni.getStorageSync('shopId'), {}, false, 'GET',
'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shopData = res.result || {}
this.shopData.orderStatusCount = this.shopData.orderStatusCount || []
this.shopData.orderRevenueAndCount = this.shopData.orderRevenueAndCount || {}
for(let i=0;i<this.shopData.orderStatusCount.length;i++){
if(this.shopData.orderStatusCount[i].counttype){
if(this.shopData.orderStatusCount[i].counttype == 'daipeisongjiedan'){
this.daipeisongjiedan = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daisong'){
this.daisongda = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){
this.daiquhuo = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){
this.daixiaofei = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){
this.daichucan = this.shopData.orderStatusCount[i].count
}
}
}
this.$forceUpdate()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
//扫一扫功能
scanCodeAdd() {
let that = this;
uni.scanCode({
success: (res) => {
if (res.scanType == "QR_CODE") { //二维码
let shopId = res.result.split('@@')[1]
if (shopId == uni.getStorageSync('shopId')) {
let productId = res.result.split('@@')[0]
uni.showModal({
title: '提示',
content: '确定要核销该订单吗?',
confirmText: '取消',
cancelText: '确认',
success: function(res1) {
if (res1.cancel) {
that.NB.sendRequest("/mall/order/complete", {
orderId: productId
}, false, 'post',
'application/x-www-form-urlencoded').then((
res) => {
if (res.code == 200) {
uni.showToast({
title: '核销成功',
icon: 'none'
})
} else {
uni.showModal({
title: '提示',
content: res.message,
showCancel:false
});
}
uni.hideLoading()
}).catch((res) => {})
}
}
});
} else {
uni.showToast({
title: '未查询到此订单信息,请核实!',
icon: 'none'
})
}
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
//底部tab切换组件状态改变
changeIndex(index, type) {
let that = this;
this.lastIndex = this.currentIndex
this.currentIndex = index
switch (index) {
case 0:
this.indexInit()
break;
case 1:
that.$refs.deLivery.init(type)
break;
case 2:
that.$refs.myCenter.init()
break;
}
}
}
}
</script>
<style lang="scss">
@import url("./index.css");
.title {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
width: 100%;
height: 20%;
}
.title-sreach {
width: 100%;
display: flex;
height: 200rpx;
position: relative;
}
.title-name {
padding-top: 110rpx;
font-size: 36rpx;
font-weight: 700;
flex: 1;
text-align: center;
}
.shop-title {
width: 95%;
margin: 0 auto;
padding: 20rpx;
background: #fff;
border-radius: 20rpx;
display: flex;
font-size: 28rpx;
font-weight: 700;
}
.title1 {
width: 70rpx;
height: 70rpx;
image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
.title2 {
flex: 1;
line-height: 70rpx;
display: flex;
}
.title22 {
flex: 1;
padding-left: 20rpx;
}
.shop-order {
width: 95%;
margin: 20rpx auto 0;
background: #fff;
border-radius: 20rpx;
padding: 0 20rpx 0;
}
.order1 {
height: 70rpx;
line-height: 70rpx;
font-size: 28rpx;
font-weight: 700;
border-bottom: 1px solid #eee;
}
.order22 {
display: flex;
height: 100rpx;
padding-top: 20rpx;
}
.order33 {
flex: 1;
text-align: center;
}
.order44 {
font-size: 28rpx;
font-weight: 700;
}
.data2 {
display: flex;
height: 140rpx;
text-align: center;
padding-top: 20rpx;
}
.data22 {
width:25%;
}
.data222 {
font-size: 36rpx;
font-weight: 700;
padding-bottom: 20rpx;
}
.data333 {
color: #415c56;
font-size: 28rpx;
}
.menu2 {
display: flex;
flex-wrap: wrap;
text-align: center;
padding-top: 20rpx;
}
.menu22 {
width: 25%;
height: 120rpx;
}
.menu33 {
image {
width: 50rpx;
height: 50rpx;
background-size: 100%;
}
}
.menu44 {
height: 40rpx;
line-height: 40rpx;
font-size:28rpx;
}
.popup-area-content {
align-items: center;
justify-content: center;
padding: 30rpx;
width: 500rpx;
height: auto;
background-color: #fff;
}
.popup-area-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-area-container {
margin-top: 20rpx;
height: 100rpx;
border-radius: 20rpx;
background: #088FEB;
line-height: 100rpx;
text-align: center;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
color: #fff;
}
</style>