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.

307 lines
8.6 KiB

<template>
<view class="page1">
1 month ago
<view style="margin-top: 80px;" @click="navigatorTo('merchant')">商家入驻</view>
<view style="margin-top: 80px;" @click="navigatorTo('merchantCenter')">商家中心-{{shopCounts}}</view>
<view style="margin-top: 80px;" @click="navigatorTo('jianzhizhuce')">兼职注册</view>
1 month ago
<view style="margin-top: 80px;" v-if="worker" @click="navigatorTo('jianzhizhuye')">兼职主页-{{workerCounts}}</view>
3 weeks ago
<view style="margin-top: 80px;" @click="navigatorTo('qianbao')">钱包余额 {{balance}}</view>
3 weeks ago
<view style="margin-top: 80px;" @click="navigatorTo('dingdan')">我的订单</view>
1 day ago
<view style="margin-top: 80px;" @click="navigatorTo('qiehuan')">切换校区放到设置中</view>
3 months ago
<!-- 未注册兼职弹窗 -->
3 months ago
<uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
<view class="jianzhi-content" @tap="navigatorTo('partTimeReg')">
1 day ago
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/faf25c687bc1417282ebac719fd1bfba.png" alt=""
style="width: 100%;height: 100%;">
3 months ago
<view style="position: absolute;bottom: -50px;left: 130px;" @tap.stop="$refs.jianzhiPopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons>
</view>
</view>
</uni-popup>
2 months ago
<!-- 多个商家选择弹窗 -->
<uni-popup ref="shopPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
<view class="shop-content">
<view class="popup-pay-title">
<text>您有多个店铺</text>
</view>
<view class="popup-list" @tap="clickShop(item)" v-for="(item,index) in schoolShop" :key="index">
{{item.shopName}}
</view>
</view>
</uni-popup>
1 day 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" @tap="onClickArea(item)">
<text style="display: inline-block">{{item.title}}</text>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
1 day ago
areaList:[],
schoolShop: [],
workerCounts: 0,
shopCounts: 0,
balance: 0,
worker: uni.getStorageSync('worker')
}
},
1 day ago
props: {
},
watch: {
1 day ago
},
methods: {
1 day ago
init() {
2 months ago
this.schoolShop = uni.getStorageSync('schoolShop')
1 month ago
this.worker = uni.getStorageSync('worker')
let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker')
this.workerCounts = 0
this.shopCounts = 0
1 day ago
if (worker) {
1 month ago
this.workerCounts = uni.getStorageSync('workerCounts')
1 month ago
}
1 day ago
if (shopId) {
1 month ago
this.shopCounts = uni.getStorageSync('shopCounts')
1 month ago
}
1 month ago
this.balance = 0
1 day ago
this.tui.request("/worker/getAllDepo/", "GET", {
userId: uni.getStorageSync('id')
}, false, true).then((res) => {
1 month ago
if (res.code == 200) {
1 day ago
if (res.result.user) {
1 month ago
this.balance += Number(res.result.user.depoBal)
}
1 day ago
if (res.result.worker) {
1 month ago
this.balance += Number(res.result.worker.depoBal)
this.balance += Number(res.result.worker.depoBalRel)
}
1 day ago
if (res.result.shop) {
for (let i = 0; i < res.result.shop.length; i++) {
1 month ago
this.balance += Number(res.result.shop[i].balance)
}
}
1 month ago
this.balance = this.balance.toFixed(2);
1 month ago
that.$forceUpdate();
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {})
2 months ago
},
1 day ago
clickShop(item) {
uni.setStorageSync('shopId', item.id)
uni.setStorageSync('shopName', item.shopName)
uni.setStorageSync('shopIcon', item.shopIcon)
uni.setStorageSync('shopScore', item.shopScore)
uni.setStorageSync('shopTakeaway', item.shopTakeaway)
uni.setStorageSync('attrId', item.attrId)
this.$refs.shopPopup.close()
2 months ago
uni.navigateTo({
2 months ago
url: '/package2/shop/merchantCenter'
2 months ago
})
3 months ago
},
1 day ago
checkArea() {
this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => {
if (res.code == 200) {
this.areaList = res.result
this.$refs.areaPopup.open()
} else {
this.tui.toast(res.message)
}
})
},
onClickArea(item) {
uni.setStorageSync('area', JSON.stringify(item))
this.tui.toast('切换成功')
this.$refs.areaPopup.close()
},
navigatorTo(e, index) {
let url = ""
1 day ago
if (e == 'addgoods') {
4 weeks ago
url = '/package2/myCenter/addGoods'
1 day ago
} else if (e == 'merchantCenter') {
if (this.schoolShop) {
if (this.schoolShop.length > 1) {
1 month ago
this.$refs.shopPopup.open()
return
1 day ago
} else if (this.schoolShop != '') {
uni.setStorageSync('shopId', this.schoolShop[0].id)
uni.setStorageSync('attrId', this.schoolShop[0].attrId)
uni.setStorageSync('shopName', this.schoolShop[0].shopName)
uni.setStorageSync('shopIcon', this.schoolShop[0].shopIcon)
uni.setStorageSync('shopScore', this.schoolShop[0].shopScore)
uni.setStorageSync('shopTakeaway', this.schoolShop[0].shopTakeaway)
1 month ago
url = '/package2/shop/merchantCenter'
}
1 day ago
} else {
1 month ago
uni.showModal({
title: '提示',
content: '您还没有注册成为商家,要去注册吗?',
1 day ago
cancelText: '暂时不了',
confirmText: '去注册',
success: function(res) {
1 month ago
if (res.confirm) {
url = '/package2/shop/merchantRegister'
uni.navigateTo({
url: url
})
}
}
});
1 day ago
2 months ago
}
1 day ago
} else if (e == 'dingdan') {
3 weeks ago
url = '/package1/order/orderList'
1 day ago
} else if (e == 'addType') {
4 weeks ago
url = '/package2/myCenter/addType'
1 day ago
} else if (e == 'qianbao') {
4 weeks ago
url = '/package2/myCenter/wallet'
1 day ago
} else if (e == 'goodsList') {
url = '/package2/myCenter/goodsList'
} else if (e == 'merchant') {
2 months ago
url = '/package2/shop/merchantRegister'
1 day ago
} else if (e == 'qiehuan') {
this.checkArea()
} else if (e == 'jianzhichaping') {
1 month ago
let item = {
1 day ago
shopScore: uni.getStorageSync('worker').score,
id: uni.getStorageSync('worker').workerId
1 month ago
}
1 day ago
url = '/package2/group/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=2&isCha=' + (index ==
'cha' ? 1 : 0)
} else if (e == 'partTimeReg') {
let worker = uni.getStorageSync('worker')
let that = this
//当前人不是配送员身份
1 day ago
if (worker == undefined || worker == '' || worker == null) {
that.tui.request("/worker/admin/add", "POST", {
userId: uni.getStorageSync('id'),
isChangeArea: 1,
region: JSON.parse(uni.getStorageSync('area')).id
}, false, true).then((res) => {
if (res.code == 200) {
1 day ago
if (res.result != null) {
uni.setStorageSync('worker', res.result)
}
4 weeks ago
url = '/package2/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close()
2 months ago
uni.navigateTo({
url: url
})
} else {
4 weeks ago
that.tui.toast(res.message)
return
}
uni.hideLoading()
}).catch((res) => {})
1 day ago
} else {
4 weeks ago
url = '/package2/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close()
}
1 day ago
} else if (e == 'jianzhizhuce') {
if (uni.getStorageSync('worker')) {
4 weeks ago
url = '/package2/myCenter/partTimeJobRegister'
1 day ago
} else {
3 months ago
this.$refs.jianzhiPopup.open()
return
}
1 day ago
} else if (e == 'jianzhizhuye') {
1 month ago
url = '/package2/partTimeJob/partTimeJobCenter'
}
uni.navigateTo({
url: url
})
}
}
}
</script>
<style>
1 day ago
page {
width: 100%;
height: 100%;
font-size: 28rpx;
}
1 day ago
.page1 {
width: 100%;
height: 100%;
font-size: 28rpx;
}
1 day ago
.jianzhi-content {
3 months ago
width: 300px;
height: 350px;
position: relative;
}
1 day ago
.shop-content {
2 months ago
width: 300px;
height: auto;
position: relative;
background: #fff;
border-radius: 10px;
padding: 10px;
}
1 day ago
2 months ago
.popup-pay-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
1 day ago
padding-bottom: 10px;
border-bottom: 1px solid #eee;
margin-bottom: 10px;
2 months ago
}
1 day ago
.popup-list {
2 months ago
height: 30px;
text-align: center;
font-size: 14px;
font-weight: 700;
border-bottom: 1px solid #eee;
line-height: 30px;
}
1 day ago
.popup-area-content {
align-items: center;
justify-content: center;
padding: 15px;
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: 10px;
background: #088FEB;
line-height: 100rpx;
text-align: center;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
color: #fff;
}
</style>