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.
 
 
 
 
 

231 lines
6.8 KiB

<template>
<view class="page1">
<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>
<view style="margin-top: 80px;" v-if="worker" @click="navigatorTo('jianzhizhuye')">兼职主页-{{workerCounts}}</view>
<view style="margin-top: 80px;" @click="navigatorTo('qianbao')">钱包余额-{{balance}}</view>
<!-- 未注册兼职弹窗 -->
<uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
<view class="jianzhi-content" @tap="navigatorTo('partTimeReg')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/faf25c687bc1417282ebac719fd1bfba.png" alt="" style="width: 100%;height: 100%;">
<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>
<!-- 多个商家选择弹窗 -->
<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>
</view>
</template>
<script>
export default {
data() {
return {
schoolShop:[],
workerCounts:0,
shopCounts:0,
balance:0,
worker:uni.getStorageSync('worker')
}
},
props:{
},
watch: {
},
methods: {
init(){
this.schoolShop = uni.getStorageSync('schoolShop')
console.log("我的初始化",this.schoolShop)
this.worker = uni.getStorageSync('worker')
let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker')
this.workerCounts = 0
this.shopCounts = 0
if(worker){
this.workerCounts = uni.getStorageSync('workerCounts')
}
if(shopId){
this.shopCounts = uni.getStorageSync('shopCounts')
}
this.balance = 0
this.tui.request("/worker/getAllDepo/", "GET", {userId:uni.getStorageSync('id')}, false, true).then((res) => {
if (res.code == 200) {
if(res.result.user){
this.balance += Number(res.result.user.depoBal)
}
if(res.result.worker){
this.balance += Number(res.result.worker.depoBal)
this.balance += Number(res.result.worker.depoBalRel)
}
if(res.result.shop){
for(let i = 0; i < res.result.shop.length;i++){
this.balance += Number(res.result.shop[i].balance)
}
}
this.balance = this.balance.toFixed(2);
that.$forceUpdate();
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {})
},
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)
uni.navigateTo({
url: '/package2/shop/merchantCenter'
})
},
navigatorTo(e,index){
let url = ""
if(e=='addgoods'){
url = '/package1/myCenter/addGoods'
}else if(e=='merchantCenter'){
if(this.schoolShop){
if(this.schoolShop.length>1){
this.$refs.shopPopup.open()
return
}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)
url = '/package2/shop/merchantCenter'
}
}else{
uni.showModal({
title: '提示',
content: '您还没有注册成为商家,要去注册吗?',
cancelText:'暂时不了',
confirmText:'去注册',
success: function (res) {
if (res.confirm) {
url = '/package2/shop/merchantRegister'
uni.navigateTo({
url: url
})
}
}
});
}
}else if(e=='addType'){
url = '/package1/myCenter/addType'
}else if(e=='goodsList'){
url = '/package1/myCenter/goodsList'
}else if(e=='merchant'){
url = '/package2/shop/merchantRegister'
}else if(e=='jianzhichaping'){
let item = {
shopScore:uni.getStorageSync('worker').score,
id:uni.getStorageSync('worker').workerId
}
url = '/package1/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
console.log("111",worker)
//当前人不是配送员身份
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) {
if(res.result != null){
uni.setStorageSync('worker',res.result)
}
url = '/package1/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close()
uni.navigateTo({
url: url
})
} else {
that.tui.toast(res.message,1000)
return
}
uni.hideLoading()
}).catch((res) => {})
}else{
url = '/package1/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close()
}
}else if(e=='jianzhizhuce'){
if(uni.getStorageSync('worker')){
url = '/package1/myCenter/partTimeJobRegister'
}else{
this.$refs.jianzhiPopup.open()
return
}
}else if(e=='jianzhizhuye'){
url = '/package2/partTimeJob/partTimeJobCenter'
}
uni.navigateTo({
url: url
})
}
}
}
</script>
<style>
page{
width: 100%;
height: 100%;
font-size: 28rpx;
}
.page1 {
width: 100%;
height: 100%;
font-size: 28rpx;
}
.jianzhi-content{
width: 300px;
height: 350px;
position: relative;
}
.shop-content{
width: 300px;
height: auto;
position: relative;
background: #fff;
border-radius: 10px;
padding: 10px;
}
.popup-pay-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
margin-bottom: 10px;
}
.popup-list{
height: 30px;
text-align: center;
font-size: 14px;
font-weight: 700;
border-bottom: 1px solid #eee;
line-height: 30px;
}
</style>