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.

591 lines
14 KiB

<template>
<view class="page">
<view class="swiper-container">
2 months ago
<view class="swiper-page" v-show="currentIndex == 0">
1 week ago
<view class="title">
<view class="title-sreach">
<view class="title-name">
商家中心
</view>
</view>
</view>
<view class="shop-title">
<view class="title1">
<img :src="shop.shopIcon" alt="" />
</view>
<view class="title2">
4 days ago
<view class="title22" @tap="checkArea">
1 week ago
{{shop.shopName}}
4 days ago
<uni-icons type="right"></uni-icons>
1 week ago
</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">
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待接单
</view>
</view>
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待取货
</view>
</view>
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待送达
</view>
</view>
</view>
<view class="order22">
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待消费
</view>
</view>
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待退款
</view>
</view>
4 days ago
<view class="order33" @tap="changeIndex(1)">
1 week ago
<view class="order44">
0
</view>
<view class="order55">
待售后
</view>
</view>
<view class="order33" @tap="goDetail('pj')">
<view class="order44">
0
</view>
<view class="order55">
待回复差评
</view>
</view>
</view>
</view>
</view>
<view class="shop-order">
<view class="order1" style="display: flex;">
<view style="flex: 1;">
今日实时数据
</view>
<view @tap="goDetail('tj')">
更多
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="data2">
<view class="data22">
<view class="data222">
0
</view>
<view class="data333">
今日订单
</view>
</view>
<view class="data22">
<view class="data222">
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>
4 days ago
<view class="menu22" @tap="changeIndex(1)">
1 week ago
<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('hx')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<uni-icons type="scan" size="25"></uni-icons>
</view>
<view class="menu44">
扫码核销
</view>
</view>
4 days ago
<view class="menu22" @tap="goDetail('dy')">
<view class="menu33" style="width: 100%;height: 56rpx;">
<image src="../../static/image/dingdan/dd1.png" alt="" />
</view>
<view class="menu44">
打印设置
</view>
</view>
1 week ago
</view>
2 months ago
</view>
</view>
2 months ago
<view class="swiper-page" v-show="currentIndex == 1">
<de-livery ref="deLivery"></de-livery>
</view>
2 months ago
<view class="swiper-page" v-show="currentIndex == 2">
<my-center ref="myCenter"></my-center>
</view>
</view>
4 days ago
<!-- 弹出区域选择 -->
<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,
currentIndex: 0,
2 months ago
businessStatus:1,
4 days ago
shop:{},
areaList:[],
shopList: [],
}
},
components: {
tabBar,
deLivery,
myCenter
},
onShow() {
4 days ago
this.indexInit()
},
onLoad() {
1 week ago
},
methods: {
4 days ago
indexInit(){
let that = this
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
}
});
this.getBusinessStatus()
if(!uni.getStorageSync('area')){
this.checkArea()
}
},
//切换店铺
onActionItemClick(item) {
if(this.type == 'wuliu'){
this.current = item.id
this.name = item.companyName
}else{
this.current = item.shop.id
this.name = item.shopName
this.shopOwnerPhone = item.shopOwnerPhone
}
if (!this.shopName) return this.tui.toast('请输入新店铺名称', 2000)
this.tui.request("/app/shop/modifyShopNameById", "put", {
id: this.shopId,
shopName: this.shopName
}, false, true).then((res) => {
if (res.code === 200) {
this.getList()
this.onPopupClose()
} else {
this.tui.toast(res.message)
}
})
},
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 {
this.tui.toast(res.message)
}
})
},
2 months ago
//获取营业状态
getBusinessStatus(){
1 week ago
this.NB.sendRequest("/app/shoptakeaway/getByShopId", {
2 months ago
shopId: uni.getStorageSync('shopId')
1 week ago
}, true, 'GET', 'application/x-www-form-urlencoded').then((res) => {
2 months ago
if (res.code == 200) {
1 week ago
this.shop = res.result
this.shop.shopIcon = uni.getStorageSync('shopIcon')
2 months ago
this.businessStatus = res.result.status
} else {
1 week ago
this.tui.toast(res.message)
2 months ago
}
1 week ago
uni.hideLoading()
}).catch((res) => {})
2 months ago
},
4 days ago
onClickArea(item){
uni.setStorageSync('area',JSON.stringify(item))
// this.searchForm.regionId = item.id
// this.getDelivery();
// this.getShopArea();
// let that = this
// that.tui.request("/worker/admin/add", "POST", {userId:uni.getStorageSync('id'),isChangeArea:0,region:item.id}, false, true).then((res) => {
// if (res.code == 200) {
// if(res.result != null){
// uni.setStorageSync('worker',res.result)
// }
// } else {
// that.tui.toast(res.message)
// return
// }
// uni.hideLoading()
// }).catch((res) => {})
this.$refs.areaPopup.close()
},
2 months ago
//更改营业状态
updateStatus(){
let that = this;
uni.showModal({
title: '提示',
content: '要更改营业状态吗?',
success: function (res1) {
if (res1.confirm) {
1 week ago
that.NB.sendRequest("/app/shoptakeaway/update", {
shopId: uni.getStorageSync('shopId'),
2 months ago
status:that.businessStatus == "1"?'0':that.businessStatus == "0"?'1':'2'
1 week ago
}, true, 'post', 'application/x-www-form-urlencoded').then((res) => {
2 months ago
if (res.code == 200) {
uni.showToast("更改成功")
that.businessStatus = that.businessStatus == "1"?'0':that.businessStatus == "0"?'1':'2'
} else {
1 week ago
that.tui.toast(res.message)
2 months ago
}
1 week ago
uni.hideLoading()
}).catch((res) => {})
2 months ago
}
}
});
},
1 week ago
goDetail(type,index) {
let url = ''
switch (type) {
case 'tj':
4 days ago
url = '/pages/shop/dataStatistics'
1 week ago
break;
case 'db':
4 days ago
url = '/pages/shop/shopOrderList?index=' + index
1 week ago
break;
case 'sp':
4 days ago
url = '/pages/shop/goodsList'
1 week ago
break;
case 'dp':
url = ''
break;
case 'dd':
4 days ago
url = '/pages/shop/shopOrderList'
1 week ago
break;
case 'zd':
4 days ago
url = '/pages/shop/shopBill'
1 week ago
break;
case 'pj':
let item = {
shopScore:uni.getStorageSync('shopScore'),
id:uni.getStorageSync('id')
}
4 days ago
url = '/pages/shop/shopEvaluate'
1 week ago
break;
case 'hx':
this.scanCodeAdd()
break;
4 days ago
case 'dy':
url = '/pages/myCenter/setPrint'
break;
1 week ago
default:
}
uni.navigateTo({
url: url
})
},
//扫一扫功能
scanCodeAdd() {
let that = this;
uni.scanCode({
success: (res) => {
if (res.scanType == "QR_CODE") { //二维码
console.log('二维码',res)
// let shopId = base.decode(res.result.split(',')[1])
// if (shopId == uni.getStorageSync('shopId').substring('10', '12')) {
// that.productId = base.decode(res.result.split(',')[0])
// that.toggle('bottom', base.decode(res.result.split(',')[0]));
// } else {
// that.tui.toast('您的店铺中暂无该商品!')
// }
} else {
console.log('条形码',res)
// that.NB.sendRequest("/app/product/getByBarcode", "POST", {
// barcode: res.result
// }, false, true).then((res1) => {
// if (res1.code == 200) {
// that.productId = res1.result[0].id
// if (res1.result == '') {
// that.tui.toast('您的店铺中暂无该商品!')
// } else {
// that.toggle('bottom', res1.result[0].id);
// }
// } else {
// that.tui.toast(res.message)
// }
// }).catch((res) => {
// that.tui.toast(res)
// })
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
//底部tab切换组件状态改变
changeIndex(index) {
2 months ago
let that = this;
this.lastIndex = this.currentIndex
this.currentIndex = index
2 months ago
switch (index) {
4 days ago
case 0:
this.indexInit()
break;
2 months ago
case 1:
that.$refs.deLivery.init()
break;
case 2:
that.$refs.myCenter.init()
break;
}
}
}
}
</script>
1 week ago
<style lang="scss">
@import url("./index.css");
1 week ago
.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;
img {
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{
flex: 1;
}
.data222{
font-size: 36rpx;
font-weight: 700;
padding-bottom: 20rpx;
}
.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;
}
4 days ago
.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>