tianyi 22 hours ago
parent
commit
9513d4a37f
  1. 213
      components/tab-bar/myCenter.vue

213
components/tab-bar/myCenter.vue

@ -6,10 +6,12 @@
<view style="margin-top: 80px;" v-if="worker" @click="navigatorTo('jianzhizhuye')">兼职主页-{{workerCounts}}</view> <view style="margin-top: 80px;" v-if="worker" @click="navigatorTo('jianzhizhuye')">兼职主页-{{workerCounts}}</view>
<view style="margin-top: 80px;" @click="navigatorTo('qianbao')">钱包余额 {{balance}}</view> <view style="margin-top: 80px;" @click="navigatorTo('qianbao')">钱包余额 {{balance}}</view>
<view style="margin-top: 80px;" @click="navigatorTo('dingdan')">我的订单</view> <view style="margin-top: 80px;" @click="navigatorTo('dingdan')">我的订单</view>
<view style="margin-top: 80px;" @click="navigatorTo('qiehuan')">切换校区放到设置中</view>
<!-- 未注册兼职弹窗 --> <!-- 未注册兼职弹窗 -->
<uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px"> <uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
<view class="jianzhi-content" @tap="navigatorTo('partTimeReg')"> <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%;"> <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()"> <view style="position: absolute;bottom: -50px;left: 130px;" @tap.stop="$refs.jianzhiPopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons> <uni-icons type="close" size="40" color="#fff"></uni-icons>
</view> </view>
@ -26,6 +28,17 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 弹出区域选择 -->
<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> </view>
</template> </template>
@ -33,46 +46,49 @@
export default { export default {
data() { data() {
return { return {
schoolShop:[], areaList:[],
workerCounts:0, schoolShop: [],
shopCounts:0, workerCounts: 0,
balance:0, shopCounts: 0,
worker:uni.getStorageSync('worker') balance: 0,
worker: uni.getStorageSync('worker')
} }
}, },
props:{ props: {
}, },
watch: { watch: {
}, },
methods: { methods: {
init(){ init() {
this.schoolShop = uni.getStorageSync('schoolShop') this.schoolShop = uni.getStorageSync('schoolShop')
this.worker = uni.getStorageSync('worker') this.worker = uni.getStorageSync('worker')
let shopId = uni.getStorageSync('shopId') let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
this.workerCounts = 0 this.workerCounts = 0
this.shopCounts = 0 this.shopCounts = 0
if(worker){ if (worker) {
this.workerCounts = uni.getStorageSync('workerCounts') this.workerCounts = uni.getStorageSync('workerCounts')
} }
if(shopId){ if (shopId) {
this.shopCounts = uni.getStorageSync('shopCounts') this.shopCounts = uni.getStorageSync('shopCounts')
} }
this.balance = 0 this.balance = 0
this.tui.request("/worker/getAllDepo/", "GET", {userId:uni.getStorageSync('id')}, false, true).then((res) => { this.tui.request("/worker/getAllDepo/", "GET", {
userId: uni.getStorageSync('id')
}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if(res.result.user){ if (res.result.user) {
this.balance += Number(res.result.user.depoBal) this.balance += Number(res.result.user.depoBal)
} }
if(res.result.worker){ if (res.result.worker) {
this.balance += Number(res.result.worker.depoBal) this.balance += Number(res.result.worker.depoBal)
this.balance += Number(res.result.worker.depoBalRel) this.balance += Number(res.result.worker.depoBalRel)
} }
if(res.result.shop){ if (res.result.shop) {
for(let i = 0; i < res.result.shop.length;i++){ for (let i = 0; i < res.result.shop.length; i++) {
this.balance += Number(res.result.shop[i].balance) this.balance += Number(res.result.shop[i].balance)
} }
} }
@ -84,42 +100,59 @@
uni.hideLoading() uni.hideLoading()
}).catch((res) => {}) }).catch((res) => {})
}, },
clickShop(item){ clickShop(item) {
uni.setStorageSync('shopId',item.id) uni.setStorageSync('shopId', item.id)
uni.setStorageSync('shopName',item.shopName) uni.setStorageSync('shopName', item.shopName)
uni.setStorageSync('shopIcon',item.shopIcon) uni.setStorageSync('shopIcon', item.shopIcon)
uni.setStorageSync('shopScore',item.shopScore) uni.setStorageSync('shopScore', item.shopScore)
uni.setStorageSync('shopTakeaway',item.shopTakeaway) uni.setStorageSync('shopTakeaway', item.shopTakeaway)
uni.setStorageSync('attrId',item.attrId)
uni.setStorageSync('attrId', item.attrId)
this.$refs.shopPopup.close()
uni.navigateTo({ uni.navigateTo({
url: '/package2/shop/merchantCenter' url: '/package2/shop/merchantCenter'
}) })
}, },
navigatorTo(e,index){ 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 = "" let url = ""
if(e=='addgoods'){ if (e == 'addgoods') {
url = '/package2/myCenter/addGoods' url = '/package2/myCenter/addGoods'
}else if(e=='merchantCenter'){ } else if (e == 'merchantCenter') {
if(this.schoolShop){ if (this.schoolShop) {
if(this.schoolShop.length>1){ if (this.schoolShop.length > 1) {
this.$refs.shopPopup.open() this.$refs.shopPopup.open()
return return
}else if(this.schoolShop != ''){ } else if (this.schoolShop != '') {
uni.setStorageSync('shopId',this.schoolShop[0].id) uni.setStorageSync('shopId', this.schoolShop[0].id)
uni.setStorageSync('attrId',this.schoolShop[0].attrId) uni.setStorageSync('attrId', this.schoolShop[0].attrId)
uni.setStorageSync('shopName',this.schoolShop[0].shopName) uni.setStorageSync('shopName', this.schoolShop[0].shopName)
uni.setStorageSync('shopIcon',this.schoolShop[0].shopIcon) uni.setStorageSync('shopIcon', this.schoolShop[0].shopIcon)
uni.setStorageSync('shopScore',this.schoolShop[0].shopScore) uni.setStorageSync('shopScore', this.schoolShop[0].shopScore)
uni.setStorageSync('shopTakeaway',this.schoolShop[0].shopTakeaway) uni.setStorageSync('shopTakeaway', this.schoolShop[0].shopTakeaway)
url = '/package2/shop/merchantCenter' url = '/package2/shop/merchantCenter'
} }
}else{ } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '您还没有注册成为商家,要去注册吗?', content: '您还没有注册成为商家,要去注册吗?',
cancelText:'暂时不了', cancelText: '暂时不了',
confirmText:'去注册', confirmText: '去注册',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
url = '/package2/shop/merchantRegister' url = '/package2/shop/merchantRegister'
uni.navigateTo({ uni.navigateTo({
@ -128,34 +161,41 @@
} }
} }
}); });
} }
}else if(e=='dingdan'){ } else if (e == 'dingdan') {
url = '/package1/order/orderList' url = '/package1/order/orderList'
}else if(e=='addType'){ } else if (e == 'addType') {
url = '/package2/myCenter/addType' url = '/package2/myCenter/addType'
}else if(e=='qianbao'){ } else if (e == 'qianbao') {
url = '/package2/myCenter/wallet' url = '/package2/myCenter/wallet'
}else if(e=='goodsList'){ } else if (e == 'goodsList') {
url = '/package2/myCenter/goodsList' url = '/package2/myCenter/goodsList'
}else if(e=='merchant'){ } else if (e == 'merchant') {
url = '/package2/shop/merchantRegister' url = '/package2/shop/merchantRegister'
}else if(e=='jianzhichaping'){ } else if (e == 'qiehuan') {
this.checkArea()
} else if (e == 'jianzhichaping') {
let item = { let item = {
shopScore:uni.getStorageSync('worker').score, shopScore: uni.getStorageSync('worker').score,
id:uni.getStorageSync('worker').workerId id: uni.getStorageSync('worker').workerId
} }
url = '/package2/group/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=2&isCha=' + (index =='cha'?1:0) url = '/package2/group/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=2&isCha=' + (index ==
}else if(e == 'partTimeReg'){ 'cha' ? 1 : 0)
} else if (e == 'partTimeReg') {
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
let that = this let that = this
// //
if(worker == undefined || worker == '' || worker == null){ 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) => { 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.code == 200) {
if(res.result != null){ if (res.result != null) {
uni.setStorageSync('worker',res.result) uni.setStorageSync('worker', res.result)
} }
url = '/package2/myCenter/partTimeJobRegister' url = '/package2/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close() this.$refs.jianzhiPopup.close()
@ -168,18 +208,18 @@
} }
uni.hideLoading() uni.hideLoading()
}).catch((res) => {}) }).catch((res) => {})
}else{ } else {
url = '/package2/myCenter/partTimeJobRegister' url = '/package2/myCenter/partTimeJobRegister'
this.$refs.jianzhiPopup.close() this.$refs.jianzhiPopup.close()
} }
}else if(e=='jianzhizhuce'){ } else if (e == 'jianzhizhuce') {
if(uni.getStorageSync('worker')){ if (uni.getStorageSync('worker')) {
url = '/package2/myCenter/partTimeJobRegister' url = '/package2/myCenter/partTimeJobRegister'
}else{ } else {
this.$refs.jianzhiPopup.open() this.$refs.jianzhiPopup.open()
return return
} }
}else if(e=='jianzhizhuye'){ } else if (e == 'jianzhizhuye') {
url = '/package2/partTimeJob/partTimeJobCenter' url = '/package2/partTimeJob/partTimeJobCenter'
} }
uni.navigateTo({ uni.navigateTo({
@ -191,22 +231,25 @@
</script> </script>
<style> <style>
page{ page {
width: 100%; width: 100%;
height: 100%; height: 100%;
font-size: 28rpx; font-size: 28rpx;
} }
.page1 { .page1 {
width: 100%; width: 100%;
height: 100%; height: 100%;
font-size: 28rpx; font-size: 28rpx;
} }
.jianzhi-content{
.jianzhi-content {
width: 300px; width: 300px;
height: 350px; height: 350px;
position: relative; position: relative;
} }
.shop-content{
.shop-content {
width: 300px; width: 300px;
height: auto; height: auto;
position: relative; position: relative;
@ -214,16 +257,18 @@
border-radius: 10px; border-radius: 10px;
padding: 10px; padding: 10px;
} }
.popup-pay-title { .popup-pay-title {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
position: relative; position: relative;
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
margin-bottom: 10px; margin-bottom: 10px;
} }
.popup-list{
.popup-list {
height: 30px; height: 30px;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
@ -231,4 +276,32 @@
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
line-height: 30px; line-height: 30px;
} }
.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> </style>
Loading…
Cancel
Save