wangfukang 1 month ago
parent
commit
89a420209a
  1. 667
      components/tab-bar/delivery.vue
  2. 33
      components/tab-bar/myCenter.vue
  3. 136
      components/tab-bar/tab-bar.vue

667
components/tab-bar/delivery.vue

@ -3,12 +3,15 @@
<common-loading /> <common-loading />
<view class="title"> <view class="title">
<view class="title-sreach"> <view class="title-sreach">
<view style="position: absolute;display: flex;" :style="{'top': menuButtonInfo.top +'px'}"> <view style="position: absolute;display: flex;" :style="{'top': (menuButtonInfo.top || 44) +'px'}">
<view class="sort-member delivery-title-tabs"> <view class="sort-member delivery-title-tabs">
<view class="tab1"> <view class="tab1">
<view class="tabs1" @tap="checkTab1('daiqu')" <view class="tabs1" @tap="checkTab1('daiqu')"
:style="{'color':tab1Checked == 'daiqu'?'#000':'#777','font-size':tab1Checked== 'daiqu'?'36rpx':'30rpx'}"> :style="{'color':tab1Checked == 'daiqu'?'#000':'#777','font-size':tab1Checked== 'daiqu'?'36rpx':'30rpx'}">
待取货 <view class="tab-label">
<text>待取货</text>
<text class="tab-count" v-if="deliveryStatusCounts.daiqu > 0">{{deliveryStatusCounts.daiqu}}</text>
</view>
<img v-if="tab1Checked == 'daiqu'" <img v-if="tab1Checked == 'daiqu'"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png"
alt="" alt=""
@ -16,7 +19,10 @@
</view> </view>
<view class="tabs1" @tap="checkTab1('daisong')" <view class="tabs1" @tap="checkTab1('daisong')"
:style="{'color':tab1Checked == 'daisong'?'#000':'#777','font-size':tab1Checked== 'daisong'?'36rpx':'30rpx'}"> :style="{'color':tab1Checked == 'daisong'?'#000':'#777','font-size':tab1Checked== 'daisong'?'36rpx':'30rpx'}">
待送达 <view class="tab-label">
<text>待送达</text>
<text class="tab-count" v-if="deliveryStatusCounts.daisong > 0">{{deliveryStatusCounts.daisong}}</text>
</view>
<img v-if="tab1Checked == 'daisong'" <img v-if="tab1Checked == 'daisong'"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png"
alt="" alt=""
@ -39,7 +45,6 @@
</view> </view>
</view> </view>
<view class="delivery-filter-row"> <view class="delivery-filter-row">
<view class="guize-box1" <view class="guize-box1"
:style="{'background':tab1Checked1 == 'fantuan'?'rgba(130, 255, 130, 1)':'rgba(247, 248, 248, 0.6)'}" :style="{'background':tab1Checked1 == 'fantuan'?'rgba(130, 255, 130, 1)':'rgba(247, 248, 248, 0.6)'}"
@tap="chooseType('fantuan')"> @tap="chooseType('fantuan')">
@ -58,22 +63,39 @@
<uni-icons type="info" size="10"></uni-icons> <uni-icons type="info" size="10"></uni-icons>
跑腿 跑腿
</view> </view>
<view class="filter-divider">|</view> </view>
<view class="guize-box" @tap="openPopup()"> <view class="delivery-status-card">
<uni-icons type="info" size="10"></uni-icons> <view class="delivery-status-main">
接单规则 <view class="delivery-status-title-row">
<view class="delivery-status-title">今日接单状态</view>
<view class="delivery-status-pill" :class="{'delivery-status-pill--on': isOnLine == 1}">
{{isOnLine == 1 ? '已上线' : '已离线'}}
</view>
</view>
<view class="delivery-status-desc">{{deliveryStatusText}}</view>
<view class="delivery-status-meta">
<text :class="{'delivery-status-meta--warn': !zhipaiCheck}">{{zhipaiCheck ? '自动派单已开启' : '自动派单未开启'}}</text>
<text>覆盖 {{totalRuleCount}} 条路线</text>
<text v-if="minRuleFeeText">最低 {{minRuleFeeText}} </text>
</view>
</view> </view>
<view class=""> <view class="delivery-status-actions">
<view @tap="changeOnline(0)" class="shangxia-btn shangxian-btn" v-if="isOnLine==1"> <view class="delivery-status-action delivery-status-action--primary" @tap="openPopup">
<text>已上线</text> 我的接单范围
</view> </view>
<view @tap="changeOnline(1)" class="shangxia-btn lixian-btn" v-else> <view class="delivery-status-action" @tap="changeOnline(isOnLine == 1 ? 0 : 1)">
<text>已离线</text> {{isOnLine == 1 ? '下线休息' : '上线接单'}}
</view> </view>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<scroll-view id="orderScroll" class="order-scroll" @scrolltolower="onReachPage" @scroll="handleScroll" :scroll-top="scrollTop" lower-threshold="160" scroll-y> <scroll-view id="orderScroll" class="order-scroll" @scrolltolower="onReachPage" @scroll="handleScroll" :scroll-top="scrollTop" lower-threshold="160" scroll-y>
<view class="delivery-empty-guide" v-if="totalRuleCount == 0">
<view class="delivery-empty-illustration">赚钱地盘</view>
<view class="delivery-empty-title">还没划定赚钱地盘</view>
<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="box1" v-for="(item,index) in pageData" :key="index">
<view class="maotou" v-if="item.deliveryType == 1"> <view class="maotou" v-if="item.deliveryType == 1">
<text>{{item.numberCode.length>14 ?'多订单':item.numberCode | delPlus}}</text> <text>{{item.numberCode.length>14 ?'多订单':item.numberCode | delPlus}}</text>
@ -199,7 +221,8 @@
</view> </view>
<view v-if="item.isReturn != null && item.isReturn == 1" class="refund-status"> <view v-if="item.isReturn != null && item.isReturn == 1" class="refund-status">
<view class="refund-status-text"> <view class="refund-status-text">
用户申请退款中 <text class="refund-status-dot"></text>
<text>用户申请退款中</text>
</view> </view>
</view> </view>
<view v-else class="order-action"> <view v-else class="order-action">
@ -235,22 +258,31 @@
</scroll-view> </scroll-view>
<!-- 设置指派单规则弹窗 --> <!-- 设置指派单规则弹窗 -->
<uni-popup ref="carPopup" background-color="#fff" style="height: 1600rpx !important;"> <uni-popup ref="carPopup" type="bottom" background-color="transparent">
<view class="guize-list"> <view class="guize-list">
<view <view class="dispatch-popup-title">
style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;"> 选择参与自动派单的接单范围
设置指派单规则 </view>
<view class="dispatch-popup-desc">
开启后系统只会把符合你设置区域和最低佣金的订单派给你未勾选路线不会参与指派
</view> </view>
<view class="zhipai-box"> <view class="zhipai-box">
接受指派单 开启接受指派单
<view class="zhipai"> <view class="zhipai">
<switch :checked="zhipaiCheck" @change="zhipaiChange" <switch :checked="zhipaiCheck" @change="zhipaiChange"
style="transform: scale(0.7);text-align: right;" /> style="transform: scale(0.7);text-align: right;" />
</view> </view>
</view> </view>
<scroll-view scroll-y="true" style="height: 660rpx;overflow-y: scroll;"> <view class="dispatch-warning" v-if="isOnLine != 1">
当前离线保存后需要上线才会收到系统派单
</view>
<view class="dispatch-empty" v-if="totalRuleCount == 0">
<view class="dispatch-empty-title">你还没有接单范围</view>
<view class="dispatch-empty-desc">先去划定想送的楼栋和最低配送费设置后才能开启自动派单</view>
</view>
<scroll-view scroll-y="true" class="dispatch-rule-scroll">
<view style="height: 50rpx;line-height: 50rpx;font-weight: 700;display: flex;"> <view style="height: 50rpx;line-height: 50rpx;font-weight: 700;display: flex;">
外卖规则 外卖接单范围
<view @tap="allCheck('waimai')" v-if="zhipaiCheck" <view @tap="allCheck('waimai')" v-if="zhipaiCheck"
style="color: #1E90FF;flex:1;text-align: right;padding-right: 20rpx;"> style="color: #1E90FF;flex:1;text-align: right;padding-right: 20rpx;">
全选 全选
@ -279,6 +311,7 @@
{{item.putAreaName}} {{item.putAreaName}}
</view> </view>
</view> </view>
<view class="dispatch-rule-fee">最低{{item.orderBkge || 0}}</view>
<view class="radio-check" v-if="item.isChecked"> <view class="radio-check" v-if="item.isChecked">
<uni-icons type="checkmarkempty" size="12"></uni-icons> <uni-icons type="checkmarkempty" size="12"></uni-icons>
</view> </view>
@ -288,7 +321,7 @@
</view> </view>
</view> </view>
<view style="height: 50rpx;line-height: 50rpx;font-weight: 700;display: flex;"> <view style="height: 50rpx;line-height: 50rpx;font-weight: 700;display: flex;">
跑腿规则 快递接单范围
<view @tap="allCheck('paotui')" v-if="zhipaiCheck" <view @tap="allCheck('paotui')" v-if="zhipaiCheck"
style="color: #1E90FF;flex:1;text-align: right;padding-right: 20rpx;"> style="color: #1E90FF;flex:1;text-align: right;padding-right: 20rpx;">
全选 全选
@ -317,6 +350,7 @@
{{item.putAreaName}} {{item.putAreaName}}
</view> </view>
</view> </view>
<view class="dispatch-rule-fee">最低{{item.orderBkge || 0}}</view>
<view class="radio-check" v-if="item.isChecked"> <view class="radio-check" v-if="item.isChecked">
<uni-icons type="checkmarkempty" size="12"></uni-icons> <uni-icons type="checkmarkempty" size="12"></uni-icons>
</view> </view>
@ -325,16 +359,16 @@
style="margin-left:5px;"></uni-icons> --> style="margin-left:5px;"></uni-icons> -->
</view> </view>
</view> </view>
<view style="width: 100%;height: 140rpx;line-height: 140rpx;text-align: center;"> <view class="dispatch-scroll-bottom">
没有更多了 没有更多了
</view> </view>
</scroll-view> </scroll-view>
<view style="display: flex;position: absolute;bottom: 0;width: 93%;"> <view class="dispatch-actions">
<view class="btn" @tap="buchong"> <view class="dispatch-action-btn dispatch-action-btn--secondary" @tap="buchong">
补充规则 补充范围
</view> </view>
<view class="btn" @tap="selectRule"> <view class="dispatch-action-btn dispatch-action-btn--primary" @tap="selectRule">
确认规则 确认并保存
</view> </view>
</view> </view>
</view> </view>
@ -377,6 +411,16 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 未注册兼职弹窗 -->
<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=""
style="width: 100%;height: 100%;">
<view class="jianzhi-close" @tap.stop="$refs.jianzhiPopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons>
</view>
</view>
</uni-popup>
</view> </view>
</view> </view>
</template> </template>
@ -389,7 +433,9 @@
bigImg: '', bigImg: '',
zhipaiCheck: false, zhipaiCheck: false,
tab1Checked: 'daiqu', tab1Checked: 'daiqu',
menuButtonInfo: {}, menuButtonInfo: {
top: 44
},
scrollTop: 0, scrollTop: 0,
oldScrollTop: 0, oldScrollTop: 0,
isLoadingPage: false, isLoadingPage: false,
@ -409,6 +455,10 @@
}, },
waimaRuleList: [], waimaRuleList: [],
tab1Checked1: '', tab1Checked1: '',
deliveryStatusCounts: {
daiqu: 0,
daisong: 0
},
pageData: [], pageData: [],
deliveryItem: [], deliveryItem: [],
deliveryItem1: [], deliveryItem1: [],
@ -435,11 +485,16 @@
}, },
watch: { watch: {
},
mounted() {
this.loadDeliveryStatusCounts()
uni.$on('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
}, },
onReachBottom() { onReachBottom() {
this.onReachPage(); this.onReachPage();
}, },
beforeDestroy() { beforeDestroy() {
uni.$off('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
if (this.refreshLoadingTimer) { if (this.refreshLoadingTimer) {
clearTimeout(this.refreshLoadingTimer) clearTimeout(this.refreshLoadingTimer)
this.refreshLoadingTimer = null this.refreshLoadingTimer = null
@ -449,6 +504,37 @@
uni.hideLoading() uni.hideLoading()
} }
}, },
computed: {
totalRuleCount() {
return (this.waimaRuleList ? this.waimaRuleList.length : 0) + (this.paotuiRuleList ? this.paotuiRuleList.length : 0)
},
activeRuleCount() {
const list = (this.waimaRuleList || []).concat(this.paotuiRuleList || [])
return list.filter(item => item.getPushOrder == 1 || item.isChecked).length
},
minRuleFeeText() {
const fees = (this.waimaRuleList || []).concat(this.paotuiRuleList || [])
.map(item => parseFloat(item.orderBkge))
.filter(item => !isNaN(item) && item > 0)
if (fees.length == 0) return ''
return '¥' + Math.min.apply(null, fees).toFixed(2).replace(/\.?0+$/, '')
},
deliveryStatusText() {
if (this.totalRuleCount == 0) {
return '未设置区域,用户下单时将无法按范围指派你'
}
if (this.isOnLine != 1) {
return '已设置范围,但当前离线,系统不会派单'
}
if (!this.zhipaiCheck) {
return '已上线,未开启自动派单,系统不会派单'
}
if (this.activeRuleCount == 0) {
return '已上线,但还没有勾选参与派单的路线'
}
return '已准备好接收符合范围和佣金的订单'
}
},
filters: { filters: {
formatHourMinute(value) { formatHourMinute(value) {
if (!value) return ''; if (!value) return '';
@ -492,6 +578,26 @@
} }
}, },
methods: { methods: {
loadDeliveryStatusCounts() {
this.setDeliveryStatusCounts(uni.getStorageSync('deliveryStatusCounts') || {})
},
setDeliveryStatusCounts(counts) {
this.deliveryStatusCounts = {
daiqu: Number(counts.daiqu) || 0,
daisong: Number(counts.daisong) || 0
}
uni.setStorageSync('deliveryStatusCounts', this.deliveryStatusCounts)
},
decreaseDeliveryStatusCount(status) {
if (status == 2) {
this.deliveryStatusCounts.daiqu = Math.max(0, Number(this.deliveryStatusCounts.daiqu) - 1)
this.deliveryStatusCounts.daisong = Number(this.deliveryStatusCounts.daisong) + 1
} else if (status == 3) {
this.deliveryStatusCounts.daisong = Math.max(0, Number(this.deliveryStatusCounts.daisong) - 1)
}
uni.setStorageSync('deliveryStatusCounts', this.deliveryStatusCounts)
uni.$emit('deliveryStatusCountsChange', this.deliveryStatusCounts)
},
formatTimeText(value) { formatTimeText(value) {
if (!value) return ''; if (!value) return '';
const date = new Date(value); const date = new Date(value);
@ -539,13 +645,14 @@
}, },
init() { init() {
if (!this.ensureLogin()) return if (!this.ensureLogin()) return
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) { if (worker == '' || worker == undefined || worker == null) {
this.tui.toast('您还没有注册兼职') this.tui.toast('您还没有注册兼职')
return return
} }
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.isOnLine = uni.getStorageSync('worker').isOnLine this.isOnLine = uni.getStorageSync('worker').isOnLine
this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
if (uni.getStorageSync('area')) { if (uni.getStorageSync('area')) {
this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id; this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
} }
@ -553,12 +660,85 @@
this.searchForm.workerId = uni.getStorageSync('worker').workerId this.searchForm.workerId = uni.getStorageSync('worker').workerId
} }
this.$forceUpdate() this.$forceUpdate()
this.loadWorkerRules()
this.getDelivery() this.getDelivery()
this.$nextTick(() => { this.$nextTick(() => {
this.measureScrollView() this.measureScrollView()
}) })
}, },
goRuleSetting() {
this.goPartTimeRegister()
},
goPartTimeRegister() {
if (uni.getStorageSync('worker')) {
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
})
return
}
this.$refs.jianzhiPopup.open()
},
createPartTimeWorker() {
if (!this.ensureLogin()) return
let worker = uni.getStorageSync('worker')
if (worker) {
this.$refs.jianzhiPopup.close()
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
})
return
}
const area = uni.getStorageSync('area') ? JSON.parse(uni.getStorageSync('area')) : {}
this.tui.request("/worker/admin/add", "POST", {
userId: uni.getStorageSync('id'),
isChangeArea: 1,
region: area.id
}, false, true).then((res) => {
if (res.code == 200) {
if (res.result != null) {
uni.setStorageSync('worker', res.result)
}
this.$refs.jianzhiPopup.close()
uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister'
})
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {})
},
ensureWorkerRegistered() {
if (!this.ensureLogin()) return false
const worker = uni.getStorageSync('worker')
if (worker && worker.workerId) return true
this.$refs.jianzhiPopup.open()
return false
},
loadWorkerRules(openAfterLoad) {
const worker = uni.getStorageSync('worker')
if (!worker || !worker.workerId) return
let that = this
that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId,
"GET", {}, false, true).then((res) => {
if (res.code == 200) {
let list = res.result && res.result.workerRelaPriceList ? res.result.workerRelaPriceList : []
for (let i = 0; i < list.length; i++) {
list[i].isChecked = list[i].getPushOrder == 1
}
that.waimaRuleList = list.filter(item => item.orderType == 0)
that.paotuiRuleList = list.filter(item => item.orderType == 1)
that.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
that.$forceUpdate()
if (openAfterLoad) {
that.$refs.carPopup.open()
}
} else {
that.tui.toast(res.message)
}
}).catch((res) => {})
},
// //
getUserLocation(item) { getUserLocation(item) {
if (!this.ensureLogin()) return if (!this.ensureLogin()) return
@ -611,7 +791,7 @@
}) })
}, },
chooseType(type) { chooseType(type) {
if (!this.ensureLogin()) return if (!this.ensureWorkerRegistered()) return
if (this.tab1Checked1 == type) { if (this.tab1Checked1 == type) {
this.tab1Checked1 = '' this.tab1Checked1 = ''
this.searchForm.deliveryType = null this.searchForm.deliveryType = null
@ -707,9 +887,7 @@
}, },
buchong() { buchong() {
this.$refs.carPopup.close() this.$refs.carPopup.close()
uni.navigateTo({ this.goPartTimeRegister()
url: '/package2/myCenter/partTimeJobRegister'
})
}, },
selectRule(item) { selectRule(item) {
@ -794,72 +972,10 @@
if (!this.ensureLogin()) return if (!this.ensureLogin()) return
const worker = uni.getStorageSync('worker') const worker = uni.getStorageSync('worker')
if (!worker || !worker.workerId) { if (!worker || !worker.workerId) {
this.tui.toast('您还没有注册兼职') this.$refs.jianzhiPopup.open()
return return
} }
if (this.isOnLine != 1) { this.loadWorkerRules(true)
this.tui.toast('请先上线后配置');
return;
}
let that = this
that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId,
"GET", {}, false, true).then((res) => {
if (res.code == 200) {
if (res.result != null) {
let data = res.result;
let list = data.workerRelaPriceList || [];
for (let i = 0; i < list.length; i++) {
list[i].isChecked = false
}
let waimaList = list.filter(item => item.orderType == 0);
let paotuiList = list.filter(item => item.orderType == 1);
if (waimaList.length > 0) {
that.waimaRuleList = waimaList;
}
if (paotuiList.length > 0) {
that.paotuiRuleList = paotuiList;
}
that.$forceUpdate();
}
this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
/* if(uni.getStorageSync('waimaiData')){
let waimaiData = uni.getStorageSync('waimaiData')
for(let i=0;i<waimaiData.length;i++){
for(let m=0;m<that.waimaRuleList.length;m++){
if(waimaiData[i].id == that.waimaRuleList[m].id){
that.waimaRuleList[m].isChecked = true
}
}
}
} */
for (let m = 0; m < that.waimaRuleList.length; m++) {
if (that.waimaRuleList[m].getPushOrder == 1) {
that.waimaRuleList[m].isChecked = true
}
}
for (let m = 0; m < that.paotuiRuleList.length; m++) {
if (that.paotuiRuleList[m].getPushOrder == 1) {
that.paotuiRuleList[m].isChecked = true
}
}
/* if(uni.getStorageSync('kuaidiData')){
let kuaidiData = uni.getStorageSync('kuaidiData')
for(let i=0;i<kuaidiData.length;i++){
for(let m=0;m<that.paotuiRuleList.length;m++){
if(kuaidiData[i].id == that.paotuiRuleList[m].id){
that.paotuiRuleList[m].isChecked = true
}
}
}
} */
this.$refs.carPopup.open()
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
}, },
checkArea() { checkArea() {
this.isArea = !this.isArea this.isArea = !this.isArea
@ -884,6 +1000,7 @@
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.pageData.splice(index, 1) this.pageData.splice(index, 1)
this.decreaseDeliveryStatusCount(2)
this.tui.toast(res.message, 200) this.tui.toast(res.message, 200)
this.$forceUpdate() this.$forceUpdate()
} else { } else {
@ -915,6 +1032,7 @@
if (res.code == 200) { if (res.code == 200) {
if (status == 2 || status == 3) { if (status == 2 || status == 3) {
that.pageData.splice(index, 1) that.pageData.splice(index, 1)
that.decreaseDeliveryStatusCount(status)
} else { } else {
that.pageData[index].arriveTime = "qq" that.pageData[index].arriveTime = "qq"
} }
@ -930,7 +1048,7 @@
}).catch((res) => {}); }).catch((res) => {});
}, },
checkTab1(type) { checkTab1(type) {
if (!this.ensureLogin()) return if (!this.ensureWorkerRegistered()) return
this.tab1Checked = type this.tab1Checked = type
if (type == 'daiqu') { if (type == 'daiqu') {
this.searchForm.status = 1 this.searchForm.status = 1
@ -942,7 +1060,7 @@
this.getDelivery() this.getDelivery()
}, },
refreshCurrentTab() { refreshCurrentTab() {
if (!this.ensureLogin()) return if (!this.ensureWorkerRegistered()) return
if (this.refreshLoading) return if (this.refreshLoading) return
this.refreshLoading = true this.refreshLoading = true
this.refreshLoadingStartTime = Date.now() this.refreshLoadingStartTime = Date.now()
@ -1073,13 +1191,13 @@
} }
.delivery-title-tabs { .delivery-title-tabs {
width: 380rpx; width: 460rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.delivery-title-tabs .tab1 { .delivery-title-tabs .tab1 {
width: 260rpx; width: 340rpx;
flex-shrink: 0; flex-shrink: 0;
} }
@ -1127,6 +1245,35 @@
font-weight: 700; font-weight: 700;
color: #777; color: #777;
flex: 1; flex: 1;
min-width: 0;
display: flex;
justify-content: center;
align-items: center;
white-space: nowrap;
}
.tab-label {
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
.tab-count {
min-width: 32rpx;
height: 32rpx;
line-height: 32rpx;
margin-left: 8rpx;
padding: 0 8rpx;
display: inline-block;
border-radius: 999rpx;
background: linear-gradient(135deg, #ff8a1f 0%, #ff3f5f 100%);
color: #fff;
font-size: 20rpx;
font-weight: 900;
text-align: center;
vertical-align: middle;
box-sizing: border-box;
} }
.delivery-filter-row { .delivery-filter-row {
@ -1138,6 +1285,111 @@
line-height: 64rpx; line-height: 64rpx;
} }
.delivery-status-card {
width: 95%;
margin: 18rpx auto 0;
padding: 22rpx;
box-sizing: border-box;
display: flex;
align-items: center;
border-radius: 28rpx;
background:
radial-gradient(circle at 92% 20%, rgba(166, 255, 234, 0.58) 0, rgba(166, 255, 234, 0) 160rpx),
linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 255, 250, 0.92));
box-shadow: 0 16rpx 36rpx rgba(0, 35, 28, 0.1);
}
.delivery-status-main {
flex: 1;
min-width: 0;
}
.delivery-status-title-row {
display: flex;
align-items: center;
}
.delivery-status-title {
font-size: 30rpx;
font-weight: 900;
color: #00231C;
}
.delivery-status-pill {
margin-left: 14rpx;
height: 40rpx;
line-height: 40rpx;
padding: 0 16rpx;
border-radius: 40rpx;
background: rgba(255, 117, 88, 0.14);
color: #d34a32;
font-size: 22rpx;
font-weight: 800;
}
.delivery-status-pill--on {
background: rgba(166, 255, 234, 0.72);
color: #00624f;
}
.delivery-status-desc {
margin-top: 10rpx;
color: #4c625d;
font-size: 24rpx;
line-height: 34rpx;
}
.delivery-status-meta {
margin-top: 12rpx;
display: flex;
flex-wrap: wrap;
gap: 10rpx;
color: #0b6b5a;
font-size: 20rpx;
font-weight: 700;
}
.delivery-status-meta text {
padding: 4rpx 12rpx;
border-radius: 999rpx;
background: rgba(166, 255, 234, 0.36);
}
.delivery-status-meta .delivery-status-meta--warn {
background: rgba(255, 117, 88, 0.12);
color: #d96b5c;
}
.delivery-status-actions {
width: 180rpx;
margin-left: 18rpx;
flex-shrink: 0;
}
.delivery-status-action {
height: 62rpx;
line-height: 62rpx;
margin-top: 12rpx;
border-radius: 62rpx;
background: #fff;
color: #00231C;
font-size: 22rpx;
font-weight: 800;
text-align: center;
border: 2rpx solid rgba(0, 35, 28, 0.08);
box-shadow: 0 8rpx 18rpx rgba(0, 35, 28, 0.08);
}
.delivery-status-action:first-child {
margin-top: 0;
}
.delivery-status-action--primary {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
border-color: rgba(166, 255, 234, 0.8);
box-shadow: 0 10rpx 22rpx rgba(0, 112, 91, 0.14);
}
.filter-divider { .filter-divider {
flex-shrink: 0; flex-shrink: 0;
padding: 0 14rpx 0 2rpx; padding: 0 14rpx 0 2rpx;
@ -1168,6 +1420,52 @@
flex-shrink: 0; flex-shrink: 0;
} }
.delivery-empty-guide {
margin: 20rpx auto;
padding: 44rpx 30rpx;
border-radius: 30rpx;
background: #fff;
text-align: center;
box-shadow: 0 12rpx 30rpx rgba(0, 35, 28, 0.06);
}
.delivery-empty-illustration {
width: 180rpx;
height: 180rpx;
line-height: 180rpx;
margin: 0 auto 24rpx;
border-radius: 50%;
background: linear-gradient(135deg, #e3ff96, #a6ffea);
color: #07372f;
font-size: 28rpx;
font-weight: 900;
}
.delivery-empty-title {
font-size: 34rpx;
font-weight: 900;
color: #00231C;
}
.delivery-empty-desc {
margin-top: 14rpx;
color: #6d7b77;
font-size: 24rpx;
line-height: 38rpx;
}
.delivery-empty-btn {
width: 320rpx;
height: 78rpx;
line-height: 78rpx;
margin: 28rpx auto 0;
border-radius: 78rpx;
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
color: #00231C;
font-size: 28rpx;
font-weight: 900;
}
.box1 { .box1 {
width: 100%; width: 100%;
margin: 20rpx auto 20rpx; margin: 20rpx auto 20rpx;
@ -1240,21 +1538,33 @@
.refund-status { .refund-status {
width: 100%; width: 100%;
height: 100rpx; margin-top: 24rpx;
margin-top: 32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.refund-status-text { .refund-status-text {
height: 56rpx; width: 100%;
line-height: 56rpx; min-height: 72rpx;
padding: 0 24rpx; padding: 0 22rpx;
background: rgba(255, 117, 88, 0.12); display: flex;
color: #ff4d35; align-items: center;
border: 1px solid rgba(255, 117, 88, 0.35); background: rgba(255, 244, 236, 0.96);
border-radius: 16rpx; color: #c56a35;
font-weight: 700; border: 1px solid rgba(255, 181, 120, 0.52);
border-radius: 18rpx;
font-size: 26rpx;
font-weight: 800;
box-sizing: border-box;
}
.refund-status-dot {
width: 14rpx;
height: 14rpx;
margin-right: 12rpx;
border-radius: 50%;
background: #ff9a4a;
box-shadow: 0 0 0 8rpx rgba(255, 154, 74, 0.12);
} }
.order-action { .order-action {
@ -1316,12 +1626,125 @@
} }
.guize-list { .guize-list {
width: 600rpx; width: 100%;
padding: 20rpx 20rpx 0; padding: 30rpx 28rpx 0;
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 36rpx 36rpx 0 0;
height: 1000rpx; height: 76vh;
position: relative; position: relative;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.dispatch-popup-title {
line-height: 48rpx;
font-size: 34rpx;
font-weight: 900;
text-align: center;
color: #00231C;
}
.dispatch-popup-desc {
margin: 12rpx 0 8rpx;
padding: 18rpx 20rpx;
border-radius: 18rpx;
background: rgba(166, 255, 234, 0.22);
color: #526964;
font-size: 24rpx;
line-height: 36rpx;
}
.dispatch-warning {
margin: 12rpx 0;
padding: 14rpx 18rpx;
border-radius: 16rpx;
background: rgba(255, 233, 89, 0.24);
color: #926500;
font-size: 24rpx;
font-weight: 700;
}
.dispatch-empty {
margin: 20rpx 0;
padding: 34rpx 20rpx;
border-radius: 22rpx;
background: rgba(247, 248, 248, 0.9);
text-align: center;
}
.dispatch-empty-title {
font-size: 30rpx;
font-weight: 900;
color: #00231C;
}
.dispatch-empty-desc {
margin-top: 10rpx;
color: #7b8a85;
font-size: 24rpx;
line-height: 36rpx;
}
.dispatch-rule-fee {
height: 40rpx;
line-height: 40rpx;
margin: 20rpx 16rpx 0 0;
padding: 0 12rpx;
border-radius: 40rpx;
background: rgba(255, 233, 89, 0.32);
color: #8a5a00;
font-size: 20rpx;
font-weight: 800;
flex-shrink: 0;
}
.dispatch-rule-scroll {
flex: 1;
min-height: 0;
height: auto;
overflow-y: scroll;
}
.dispatch-scroll-bottom {
width: 100%;
height: 60rpx;
line-height: 60rpx;
color: #9ca6a2;
text-align: center;
}
.dispatch-actions {
display: flex;
gap: 18rpx;
padding: 18rpx 0 calc(132rpx + constant(safe-area-inset-bottom));
padding: 18rpx 0 calc(132rpx + env(safe-area-inset-bottom));
background: #fff;
flex-shrink: 0;
z-index: 2;
}
.dispatch-action-btn {
flex: 1;
height: 78rpx;
line-height: 78rpx;
border-radius: 78rpx;
text-align: center;
font-size: 28rpx;
font-weight: 900;
box-sizing: border-box;
}
.dispatch-action-btn--secondary {
background: rgba(166, 255, 234, 0.28);
color: #00624f;
border: 2rpx solid rgba(166, 255, 234, 0.88);
}
.dispatch-action-btn--primary {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
color: #00231C;
box-shadow: 0 10rpx 22rpx rgba(0, 112, 91, 0.14);
} }
.zhipai-box { .zhipai-box {
@ -1628,4 +2051,16 @@
font-weight: 700; font-weight: 700;
text-align: center; text-align: center;
} }
.jianzhi-content {
width: 300px;
height: 350px;
position: relative;
}
.jianzhi-close {
position: absolute;
bottom: -50px;
left: 130px;
}
</style> </style>

33
components/tab-bar/myCenter.vue

@ -52,7 +52,8 @@
workerCounts: 0, workerCounts: 0,
shopCounts: 0, shopCounts: 0,
balance: 0, balance: 0,
worker: uni.getStorageSync('worker') worker: uni.getStorageSync('worker'),
balanceRefreshId: 0
} }
}, },
props: { props: {
@ -60,8 +61,19 @@
}, },
watch: { watch: {
},
mounted() {
uni.$on('myCenterCountsChange', this.setPendingCounts)
},
beforeDestroy() {
uni.$off('myCenterCountsChange', this.setPendingCounts)
}, },
methods: { methods: {
setPendingCounts(counts) {
this.workerCounts = Number(counts.workerCounts) || 0
this.shopCounts = Number(counts.shopCounts) || 0
this.$forceUpdate()
},
init() { init() {
this.schoolShop = uni.getStorageSync('schoolShop') this.schoolShop = uni.getStorageSync('schoolShop')
@ -71,30 +83,33 @@
this.workerCounts = 0 this.workerCounts = 0
this.shopCounts = 0 this.shopCounts = 0
if (worker) { if (worker) {
this.workerCounts = uni.getStorageSync('workerCounts') this.workerCounts = Number(uni.getStorageSync('workerCounts')) || 0
} }
if (shopId) { if (shopId) {
this.shopCounts = uni.getStorageSync('shopCounts') this.shopCounts = Number(uni.getStorageSync('shopCounts')) || 0
} }
this.balance = 0 this.balance = 0
const refreshId = ++this.balanceRefreshId
this.tui.request("/worker/getAllDepo/", "GET", { this.tui.request("/worker/getAllDepo/", "GET", {
userId: uni.getStorageSync('id') userId: uni.getStorageSync('id')
}, false, true).then((res) => { }, false, true).then((res) => {
if (refreshId != this.balanceRefreshId) return
if (res.code == 200) { if (res.code == 200) {
let balance = 0
if (res.result.user) { if (res.result.user) {
this.balance += Number(res.result.user.depoBal) balance += Number(res.result.user.depoBal) || 0
} }
if (res.result.worker) { if (res.result.worker) {
this.balance += Number(res.result.worker.depoBal) balance += Number(res.result.worker.depoBal) || 0
this.balance += Number(res.result.worker.depoBalRel) balance += Number(res.result.worker.depoBalRel) || 0
} }
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) balance += Number(res.result.shop[i].balance) || 0
} }
} }
this.balance = this.balance.toFixed(2); this.balance = balance.toFixed(2);
that.$forceUpdate(); this.$forceUpdate();
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }

136
components/tab-bar/tab-bar.vue

@ -60,7 +60,8 @@
}], }],
indexZhipaiCount:0, indexZhipaiCount:0,
indexWorkerCount:0, indexWorkerCount:0,
indexMyCount:0 indexMyCount:0,
countRefreshId:0
} }
}, },
props: { props: {
@ -87,6 +88,13 @@
} }
} }
}, },
mounted() {
uni.$on('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
this.setDeliveryStatusCounts(uni.getStorageSync('deliveryStatusCounts') || {})
},
beforeDestroy() {
uni.$off('deliveryStatusCountsChange', this.setDeliveryStatusCounts)
},
methods: { methods: {
hasLogin() { hasLogin() {
const token = uni.getStorageSync('hiver_token') const token = uni.getStorageSync('hiver_token')
@ -103,6 +111,10 @@
const value = Number(count) || 0 const value = Number(count) || 0
return value > 99 ? '99+' : value return value > 99 ? '99+' : value
}, },
setDeliveryStatusCounts(counts) {
this.indexWorkerCount = (Number(counts.daiqu) || 0) + (Number(counts.daisong) || 0)
this.$forceUpdate()
},
//tab //tab
clickBar(index) { clickBar(index) {
if (index !== 0 && !this.hasLogin()) { if (index !== 0 && !this.hasLogin()) {
@ -132,76 +144,122 @@
} }
}, },
getWorkerCounts(){ getWorkerCounts(){
if(!uni.getStorageSync('worker')){ const refreshId = ++this.countRefreshId
return;
}
this.indexZhipaiCount = 0 this.indexZhipaiCount = 0
this.indexWorkerCount = 0 this.indexWorkerCount = 0
this.indexMyCount = 0 this.indexMyCount = 0
let that = this let deliveryStatusCounts = {
daiqu: 0,
daisong: 0
}
let shopId = uni.getStorageSync('shopId') let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
let workerResult = {
zhipaiCount: 0,
workerTabCount: 0,
myCount: 0,
workerCounts: 0,
deliveryStatusCounts
}
let shopCounts = 0
let tasks = []
if(worker){ if(worker){
this.tui.request("/mall/delivery/countOrderByStatus", "POST", {workerId:uni.getStorageSync('worker').workerId,regionId:JSON.parse(uni.getStorageSync('area')).id}, false, true).then((res) => { const area = uni.getStorageSync('area') ? JSON.parse(uni.getStorageSync('area')) : {}
tasks.push(this.tui.request("/mall/delivery/countOrderByStatus", "POST", {workerId:worker.workerId,regionId:area.id}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
let result = {
zhipaiCount: 0,
workerTabCount: 0,
myCount: 0,
workerCounts: 0,
deliveryStatusCounts: {
daiqu: 0,
daisong: 0
}
}
if(res.result != null){ if(res.result != null){
for(let i = 0;i<res.result.length;i++){ for(let i = 0;i<res.result.length;i++){
const orderCount = Number(res.result[i].orderCount) || 0
if(res.result[i].status == 0){ if(res.result[i].status == 0){
this.indexZhipaiCount = Number(res.result[i].orderCount) result.zhipaiCount = orderCount
}else if(res.result[i].status == 1 || res.result[i].status == 2){ }else if(res.result[i].status == 1 || res.result[i].status == 2){
this.indexWorkerCount += Number(res.result[i].orderCount) 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{ }else{
this.indexMyCount += Number(res.result[i].orderCount) result.myCount += orderCount
} }
if(res.result[i].status == 3){ if(res.result[i].status == 3){
let workerCounts = Number(res.result[i].orderCount) result.workerCounts = orderCount
uni.setStorageSync('workerCounts',workerCounts)
} }
} }
} }
that.$forceUpdate(); workerResult = result
} else { } else {
that.tui.toast(res.message); this.tui.toast(res.message);
return;
} }
uni.hideLoading(); uni.hideLoading();
}).catch((res) => {}); }).catch((res) => {}));
}else{
uni.setStorageSync('workerCounts', 0)
uni.setStorageSync('deliveryStatusCounts', deliveryStatusCounts)
uni.$emit('deliveryStatusCountsChange', deliveryStatusCounts)
} }
if(shopId){ if(shopId){
this.tui.request("/mall/order/countByShop/"+uni.getStorageSync('shopId'), "GET", {}, false, true).then((res) => { tasks.push(this.tui.request("/mall/order/countByShop/"+shopId, "GET", {}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.shopData = res.result this.shopData = res.result
let shopCounts = 0 let total = 0
for(let i=0;i<this.shopData.orderStatusCount.length;i++){ const orderStatusCount = this.shopData.orderStatusCount || []
if(this.shopData.orderStatusCount[i].counttype){ for(let i=0;i<orderStatusCount.length;i++){
if(this.shopData.orderStatusCount[i].counttype == 'daisong'){ if(orderStatusCount[i].counttype){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) const count = Number(orderStatusCount[i].count) || 0
shopCounts += Number(this.shopData.orderStatusCount[i].count) if(orderStatusCount[i].counttype == 'daisong'){
}else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){ total += count
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) }else if(orderStatusCount[i].counttype == 'daiqu'){
shopCounts += Number(this.shopData.orderStatusCount[i].count) total += count
}else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){ }else if(orderStatusCount[i].counttype == 'daixiaofei'){
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count) total += count
shopCounts += Number(this.shopData.orderStatusCount[i].count) }else if(orderStatusCount[i].counttype == 'daichucan'){
}else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){ total += count
this.indexMyCount += Number(this.shopData.orderStatusCount[i].count)
shopCounts += Number(this.shopData.orderStatusCount[i].count)
} }
} }
} }
this.indexMyCount += Number(this.shopData.pendingBadReviewCount) const pendingBadReviewCount = Number(this.shopData.pendingBadReviewCount) || 0
this.indexMyCount += Number(this.shopData.refundCount) const refundCount = Number(this.shopData.refundCount) || 0
const shopDeliveryPendingCount = Number(this.shopData.shopDeliveryPendingCount) || 0
shopCounts += Number(this.shopData.pendingBadReviewCount) const transferDeliveryPendingCount = Number(this.shopData.transferDeliveryPendingCount) || 0
shopCounts += Number(this.shopData.refundCount) total += pendingBadReviewCount
uni.setStorageSync('shopCounts',shopCounts) total += refundCount
that.$forceUpdate(); total += shopDeliveryPendingCount
total += transferDeliveryPendingCount
shopCounts = total
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
uni.hideLoading() uni.hideLoading()
}).catch((res) => {}) }).catch((res) => {}))
}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()
})
} }
} }
} }

Loading…
Cancel
Save