tianyi 4 days ago
parent
commit
5fe70cb84b
  1. 6
      components/tab-bar/myCenter.vue
  2. 34
      components/worker/delivery.vue
  3. 220
      components/worker/tab-bar.vue

6
components/tab-bar/myCenter.vue

@ -138,11 +138,7 @@
},
navigatorTo(e){
let url = ""
if(e=='addgoods'){
url = '/package1/myCenter/addGoods'
}else if(e=='merchant'){
url = '/package1/myCenter/myMerchant'
}else if(e == 'xiugaixinxi'){
if(e == 'xiugaixinxi'){
url = '/pages/myCenter/shopDetail'
}else if(e == 'yingyexinxi'){
url = '/pages/myCenter/businessInfo'

34
components/worker/delivery.vue

@ -12,7 +12,7 @@
<text>待取货</text>
<text class="tab-count" v-if="deliveryStatusCounts.daiqu > 0">{{deliveryStatusCounts.daiqu}}</text>
</view>
<img v-if="tab1Checked == 'daiqu'"
<image v-if="tab1Checked == 'daiqu'"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png"
alt=""
style="width: 120rpx;height: 12rpx;position: absolute;bottom: 4rpx;left: 30rpx;" />
@ -23,7 +23,7 @@
<text>待送达</text>
<text class="tab-count" v-if="deliveryStatusCounts.daisong > 0">{{deliveryStatusCounts.daisong}}</text>
</view>
<img v-if="tab1Checked == 'daisong'"
<image v-if="tab1Checked == 'daisong'"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png"
alt=""
style="width: 80rpx;height: 14rpx;position: absolute;bottom: 4rpx;left: 32rpx;" />
@ -99,6 +99,7 @@
<view class="delivery-empty-desc">设置接单路线用户下单时即可直接指派给你</view>
<view class="delivery-empty-btn" @tap="goRuleSetting">去设置接单范围</view>
</view>
<view class="box1" v-for="(item,index) in pageData" :key="index">
<view class="maotou" v-if="item.deliveryType == 1">
<text>{{item.numberCode.length>14 ?'多订单':item.numberCode | delPlus}}</text>
@ -161,7 +162,7 @@
<view style="display: flex;border-radius: 20rpx;margin-top: 32rpx;border: 1px solid rgba(166, 255, 234, 0.78);padding: 10px;">
<view class="goods-content" @tap="productDetail(item)">
<view class="goods-name" style="font-size: 24rpx;line-height: 50rpx;display: flex;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png"
<image src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png"
alt="" style="width: 50rpx;height: 50rpx;" />
<view style="flex: 1;">
<view class="">
@ -174,7 +175,7 @@
</view>
</view>
<view class="right">
<img @tap.stop="makeCall(item.shopPhone)"
<image @tap.stop="makeCall(item.shopPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
alt="" style="width: 60rpx;height: 60rpx;" />
</view>
@ -186,7 +187,7 @@
</view>
<view class="goods-name"
style="font-size: 24rpx;line-height: 50rpx;display: flex;margin-top: 14rpx;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png"
<image src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png"
alt="" style="width: 50rpx;height: 50rpx;" />
<view style="flex: 1;">
<view class="">
@ -197,7 +198,7 @@
</view>
</view>
<view class="right">
<img @tap.stop="makeCall(item.receiverPhone)"
<image @tap.stop="makeCall(item.receiverPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
alt="" style="width: 60rpx;height: 60rpx;" />
</view>
@ -410,7 +411,7 @@
<view class="product-popup-list" v-if="productData != null && productData.length > 0">
<view class="product-popup-card" v-for="(item1,index1) in productData" :key="index1">
<view class="product-popup-img">
<img :src="item1.productPicture" alt="">
<image :src="item1.productPicture" alt="">
</view>
<view class="product-popup-info">
<view class="product-popup-name">
@ -435,7 +436,7 @@
<!-- 未注册兼职弹窗 -->
<uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
<view class="jianzhi-content" @tap="createPartTimeWorker">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/faf25c687bc1417282ebac719fd1bfba.png" alt=""
<image src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/faf25c687bc1417282ebac719fd1bfba.png" alt=""
style="width: 100%;height: 100%;">
<view class="jianzhi-close" @tap.stop="$refs.jianzhiPopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons>
@ -697,7 +698,7 @@
const redirectKey = 'login_redirect_' + Date.now()
uni.setStorageSync(redirectKey, target)
uni.navigateTo({
url: '/package2/login/login?redirect=' + redirectKey,
url: '/pages/login/login?redirect=' + redirectKey,
complete: () => {
setTimeout(() => {
this.loginRedirecting = false
@ -708,7 +709,6 @@
},
init() {
if (!this.ensureLogin()) return
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) {
uni.showToast({
@ -738,13 +738,13 @@
},
goDeliveryRanking() {
uni.navigateTo({
url: '/package2/shop/ranking'
url: '/pages/worker/ranking'
})
},
goPartTimeRegister() {
if (uni.getStorageSync('worker')) {
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
url: '/pages/worker/partTimeJobRegister'
})
return
}
@ -756,7 +756,7 @@
if (worker) {
this.$refs.jianzhiPopup.close()
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
url: '/pages/worker/partTimeJobRegister'
})
return
}
@ -772,7 +772,7 @@
}
this.$refs.jianzhiPopup.close()
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
url: '/pages/worker/partTimeJobRegister'
})
} else {
uni.showToast({
@ -903,7 +903,7 @@
if (!this.ensureLogin()) return
let that = this
that.isLoadingPage = true;
this.NB.sendRequest("/mall/delivery/pagebyworker", this.searchForm, false, 'POST', 'application/x-www-form-urlencoded').then((res) => {
this.NB.sendRequest("/mall/delivery/pagebyworker", this.searchForm, false, 'POST', 'application/json').then((res) => {
that.isLoadingPage = false;
that.loadStatus = 'nomore';
if (res.code == 200) {
@ -1695,7 +1695,7 @@
}
.box1 {
width: 100%;
width: 95%;
margin: 20rpx auto 20rpx;
background: #fff;
border-radius: 20rpx;
@ -2361,7 +2361,7 @@
border-radius: 22rpx;
background: #f0f5f3;
img {
image {
width: 100%;
height: 100%;
background-size: 100%;

220
components/worker/tab-bar.vue

@ -1,6 +1,15 @@
<template>
<view class="tabbar-box">
<view class="bar-box" @click="clickBar(index)" v-for="(item,index) in tabList" :key="index">
<view class="red-dot" v-if="index == 0 && indexZhipaiCount > 0">
{{formatBadgeCount(indexZhipaiCount)}}
</view>
<view class="red-dot" v-if="index == 1 && indexWorkerCount > 0">
{{formatBadgeCount(indexWorkerCount)}}
</view>
<view class="red-dot" v-if="index == 2 && indexMyCount > 0">
{{formatBadgeCount(indexMyCount)}}
</view>
<view class="img-box">
<image :src="item.isCheck?item.tabIconSelect:item.tabIcon" alt="" />
</view>
@ -30,7 +39,11 @@
tabIcon: '/static/image/staff.png',
tabIconSelect: '/static/image/staff-sel.png',
isCheck: false
}]
}],
indexZhipaiCount:0,
indexWorkerCount:0,
indexMyCount:0,
countRefreshId:0
}
},
props: {
@ -57,18 +70,185 @@
}
}
},
mounted() {
uni.$on('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
this.setDeliveryStatusCounts(uni.getStorageSync('deliveryStatusCounts') || {})
},
beforeDestroy() {
uni.$off('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
},
methods: {
hasLogin() {
const token = uni.getStorageSync('hiver_token')
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
},
goLogin(index) {
const redirectKey = 'login_redirect_' + Date.now()
uni.setStorageSync(redirectKey, '/pages/index/index?tabIndex=' + index)
uni.navigateTo({
url: '/package2/login/login?redirect=' + redirectKey
})
},
formatBadgeCount(count) {
const value = Number(count) || 0
return value > 99 ? '99+' : value
},
setDeliveryStatusCounts(counts) {
this.indexWorkerCount = (Number(counts.daiqu) || 0) + (Number(counts.daisong) || 0)
this.$forceUpdate()
},
//tab
clickBar(index) {
if (index !== 0 && !this.hasLogin()) {
this.goLogin(index)
return
}
for (let i = 0; i < this.tabList.length; i++) {
if (index == i) {
this.$emit('tab-index', i);
this.getWorkerCounts()
this.tabList[i].isCheck = true
if (this.tabList[i].shaking) return
this.tabList[i].shaking = true
setTimeout(() => {
this.tabList[i].shaking = false
}, 500)
} else {
this.tabList[i].isCheck = false
this.$forceUpdate()
}
}
},
getWorkerCounts(){
const refreshId = ++this.countRefreshId
this.indexZhipaiCount = 0
this.indexWorkerCount = 0
this.indexMyCount = 0
if (!this.hasLogin()) {
return Promise.resolve()
}
let deliveryStatusCounts = {
daiqu: 0,
daisong: 0
}
let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker')
let workerResult = {
zhipaiCount: 0,
workerTabCount: 0,
myCount: 0,
workerCounts: 0,
deliveryStatusCounts
}
let shopCounts = 0
let tasks = []
if(worker){
const area = uni.getStorageSync('area') ? JSON.parse(uni.getStorageSync('area')) : {}
tasks.push(this.NB.sendRequest("/mall/delivery/countOrderByStatus", {
workerId:worker.workerId,
regionId:area.id,
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
let result = {
zhipaiCount: 0,
workerTabCount: 0,
myCount: 0,
workerCounts: 0,
deliveryStatusCounts: {
daiqu: 0,
daisong: 0
}
}
if(res.result != null){
for(let i = 0;i<res.result.length;i++){
const orderCount = Number(res.result[i].orderCount) || 0
if(res.result[i].status == 0){
result.zhipaiCount = orderCount
}else if(res.result[i].status == 1 || res.result[i].status == 2){
if (res.result[i].status == 1) {
result.deliveryStatusCounts.daiqu = orderCount
} else if (res.result[i].status == 2) {
result.deliveryStatusCounts.daisong = orderCount
}
result.workerTabCount += orderCount
}else{
result.myCount += orderCount
}
if(res.result[i].status == 3){
result.workerCounts = orderCount
}
}
}
workerResult = result
} else {
this.tui.toast(res.message);
}
uni.hideLoading();
}));
}else{
uni.setStorageSync('workerCounts', 0)
uni.setStorageSync('deliveryStatusCounts', deliveryStatusCounts)
uni.$emit('deliveryStatusCountsChange', deliveryStatusCounts)
}
if(shopId){
tasks.push(this.NB.sendRequest("/mall/order/countByShop/"+shopId, {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shopData = res.result
let total = 0
const orderStatusCount = this.shopData.orderStatusCount || []
for(let i=0;i<orderStatusCount.length;i++){
if(orderStatusCount[i].counttype){
const count = Number(orderStatusCount[i].count) || 0
if(orderStatusCount[i].counttype == 'daipeisongjiedan'){
total += count
}else if(orderStatusCount[i].counttype == 'daisong'){
total += count
}else if(orderStatusCount[i].counttype == 'daiqu'){
total += count
}else if(orderStatusCount[i].counttype == 'daixiaofei'){
total += count
}else if(orderStatusCount[i].counttype == 'daichucan'){
total += count
}
}
}
const pendingBadReviewCount = Number(this.shopData.pendingBadReviewCount) || 0
const refundCount = Number(this.shopData.refundCount) || 0
const shopDeliveryPendingCount = Number(this.shopData.shopDeliveryPendingCount) || 0
const transferDeliveryPendingCount = Number(this.shopData.transferDeliveryPendingCount) || 0
total += pendingBadReviewCount
total += refundCount
total += shopDeliveryPendingCount
total += transferDeliveryPendingCount
shopCounts = total
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}))
}else{
uni.setStorageSync('shopCounts', 0)
}
return Promise.all(tasks).then(() => {
if (refreshId != this.countRefreshId) return
this.indexZhipaiCount = workerResult.zhipaiCount
this.indexWorkerCount = workerResult.workerTabCount
this.indexMyCount = workerResult.myCount + shopCounts
uni.setStorageSync('workerCounts', workerResult.workerCounts)
uni.setStorageSync('shopCounts', shopCounts)
uni.setStorageSync('deliveryStatusCounts', workerResult.deliveryStatusCounts)
uni.$emit('deliveryStatusCountsChange', workerResult.deliveryStatusCounts)
uni.$emit('myCenterCountsChange', {
workerCounts: workerResult.workerCounts,
shopCounts: shopCounts
})
this.$forceUpdate()
})
}
}
}
@ -83,7 +263,7 @@
background: rgba(255, 255, 255, 1);
margin: 0 auto;
display: flex;
z-index: 999;
z-index: 998;
border-top: 1px solid #eee;
border-top-left-radius: 60rpx;
border-top-right-radius: 60rpx;
@ -92,6 +272,10 @@
.bar-box {
height: 100%;
flex: 1;
position: relative;
background: transparent;
outline: none;
-webkit-tap-highlight-color: transparent;
}
.img-box {
@ -103,20 +287,48 @@
transition: all 0.3s;
transform-origin: center center;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.red-dot {
position: absolute;
top: 10rpx;
right: 60rpx;
z-index: 2;
min-width: 34rpx;
height: 34rpx;
padding: 0 10rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 999rpx;
box-sizing: border-box;
text-align: center;
color: #ffffff;
background: linear-gradient(135deg, #ff8a1f 0%, #ff3f5f 100%);
border: 4rpx solid rgba(255, 255, 255, 0.96);
box-shadow: 0 8rpx 18rpx rgba(255, 63, 95, 0.34);
font-size: 20rpx;
font-weight: 900;
font-family: Arial, 'PingFang SC', sans-serif;
}
.img-box image{
width: 50rpx;
height: 50rpx;
background-size: 100%;
display: block;
pointer-events: none;
-webkit-tap-highlight-color: transparent;
}
.big-img-box image{
width: 80%;
height: 90%;
background-size: 100%;
margin: -20rpx 0 0 10%;
display: block;
pointer-events: none;
-webkit-tap-highlight-color: transparent;
}
.text-box {
text-align: center;
font-size: 20rpx;

Loading…
Cancel
Save