wangfukang 1 month ago
parent
commit
fe18ba4a27
  1. 220
      components/tab-bar/delivery.vue

220
components/tab-bar/delivery.vue

@ -245,11 +245,12 @@
</view> </view>
<view v-if="item.status == 2 && item.arriveTime != null" <view v-if="item.status == 2 && item.arriveTime != null"
class="order-action-btn order-action-btn--complete" class="order-action-btn order-action-btn--complete"
:class="{'order-action-btn--disabled': completingDeliveryIds[item.id]}"
@tap="changeStatus(index,item,3)"> @tap="changeStatus(index,item,3)">
<view class="order-action-icon"> <view class="order-action-icon">
<uni-icons type="hand-up-filled" size="24" color="#fff"></uni-icons> <uni-icons type="hand-up-filled" size="24" color="#fff"></uni-icons>
</view> </view>
<text>已送达</text> <text>{{completingDeliveryIds[item.id] ? '提交中...' : '已送达'}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -258,7 +259,7 @@
</scroll-view> </scroll-view>
<!-- 设置指派单规则弹窗 --> <!-- 设置指派单规则弹窗 -->
<uni-popup ref="carPopup" type="bottom" background-color="transparent"> <uni-popup ref="carPopup" class="dispatch-popup" type="bottom" background-color="transparent" @change="handleDispatchPopupChange">
<view class="guize-list"> <view class="guize-list">
<view class="dispatch-popup-title"> <view class="dispatch-popup-title">
选择参与自动派单的接单范围 选择参与自动派单的接单范围
@ -380,6 +381,23 @@
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="pickupCodePopup" background-color="transparent">
<view class="pickup-code-popup">
<view class="pickup-code-title">输入取餐码</view>
<view class="pickup-code-desc">请输入4位取餐码</view>
<input class="pickup-code-input" v-model="pickupCode" type="number" maxlength="4"
:focus="pickupCodeInputFocus"
placeholder="请输入4位取餐码" confirm-type="done" @input="handlePickupCodeInput"
@confirm="submitPickupCode" />
<view class="pickup-code-actions">
<view class="pickup-code-action pickup-code-action--cancel" @tap="closePickupCodePopup">取消</view>
<view class="pickup-code-action pickup-code-action--confirm" @tap="submitPickupCode">
{{pickupCodeSubmitting ? '提交中...' : '确认'}}
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="productPopup" background-color="transparent"> <uni-popup ref="productPopup" background-color="transparent">
<view class="product-popup-content"> <view class="product-popup-content">
<view class="product-popup-header"> <view class="product-popup-header">
@ -469,6 +487,11 @@
refreshLoading: false, refreshLoading: false,
refreshLoadingStartTime: 0, refreshLoadingStartTime: 0,
refreshLoadingTimer: null, refreshLoadingTimer: null,
pickupCode: '',
pickupCodeContext: null,
pickupCodeSubmitting: false,
pickupCodeInputFocus: false,
completingDeliveryIds: {},
lineStatus: [{ lineStatus: [{
title: '上线', title: '上线',
value: 0 value: 0
@ -732,6 +755,7 @@
that.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false that.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
that.$forceUpdate() that.$forceUpdate()
if (openAfterLoad) { if (openAfterLoad) {
that.setHomeTabBarVisible(false)
that.$refs.carPopup.open() that.$refs.carPopup.open()
} }
} else { } else {
@ -890,6 +914,12 @@
this.goPartTimeRegister() this.goPartTimeRegister()
}, },
handleDispatchPopupChange(e) {
this.setHomeTabBarVisible(!(e && e.show))
},
setHomeTabBarVisible(visible) {
this.$emit('tabbar-visible-change', visible)
},
selectRule(item) { selectRule(item) {
//TODO //TODO
// let rule = { // let rule = {
@ -980,39 +1010,86 @@
checkArea() { checkArea() {
this.isArea = !this.isArea this.isArea = !this.isArea
}, },
openPickupCodePopup(index, item, regionId) {
this.pickupCode = ''
this.pickupCodeInputFocus = false
this.pickupCodeContext = {
index,
item,
regionId
}
this.$refs.pickupCodePopup.open()
this.$nextTick(() => {
setTimeout(() => {
this.pickupCodeInputFocus = true
}, 300)
})
},
closePickupCodePopup() {
if (this.pickupCodeSubmitting) return
this.$refs.pickupCodePopup.close()
this.pickupCode = ''
this.pickupCodeContext = null
this.pickupCodeInputFocus = false
},
handlePickupCodeInput(e) {
const value = String(e.detail.value || '').replace(/\D/g, '').slice(0, 4)
this.pickupCode = value
return value
},
submitPickupCode() {
if (this.pickupCodeSubmitting) return
const context = this.pickupCodeContext
if (!context) return
if (!this.pickupCode) {
uni.showToast({
title: '请输入取餐码',
icon: 'none'
})
return
}
this.pickupCodeSubmitting = true
this.tui.request('/mall/delivery/transferPickup', 'POST', {
regionId: context.regionId,
deliveryId: context.item.id,
workerId: context.item.workerId,
pickupCode: this.pickupCode
}, false, true).then((res) => {
if (res.code == 200) {
this.pageData.splice(context.index, 1)
this.decreaseDeliveryStatusCount(2)
this.tui.toast(res.message, 200)
this.$refs.pickupCodePopup.close()
this.pickupCode = ''
this.pickupCodeContext = null
this.pickupCodeInputFocus = false
this.$forceUpdate()
} else {
uni.showToast({
title: res.message || '取餐码错误',
icon: 'none',
duration: 2500
})
}
this.pickupCodeSubmitting = false
}).catch(() => {
this.pickupCodeSubmitting = false
})
},
changeStatus(index, item, status) { changeStatus(index, item, status) {
if (!this.ensureLogin()) return if (!this.ensureLogin()) return
if (status == 3) {
if (this.completingDeliveryIds[item.id]) {
this.tui.toast('送达处理中,请勿重复提交')
return
}
this.$set(this.completingDeliveryIds, item.id, true)
}
let regionId = JSON.parse(uni.getStorageSync('area')).id let regionId = JSON.parse(uni.getStorageSync('area')).id
let url = '' let url = ''
if (status == 2) { if (status == 2) {
if (item.transferDelivery == 1) { if (item.transferDelivery == 1) {
uni.showModal({ this.openPickupCodePopup(index, item, regionId)
title: '输入取餐码',
editable: true,
placeholderText: '请输入4位取餐码',
success: (modalRes) => {
if (!modalRes.confirm) return
this.tui.request('/mall/delivery/transferPickup', 'POST', {
regionId: regionId,
deliveryId: item.id,
workerId: item.workerId,
pickupCode: modalRes.content
}, false, true).then((res) => {
if (res.code == 200) {
this.pageData.splice(index, 1)
this.decreaseDeliveryStatusCount(2)
this.tui.toast(res.message, 200)
this.$forceUpdate()
} else {
uni.showToast({
title: res.message || '取餐码错误',
icon: 'none',
duration: 2500
})
}
})
}
})
return return
} }
url = "/mall/delivery/pickup" url = "/mall/delivery/pickup"
@ -1029,6 +1106,9 @@
deliveryId: item.id, deliveryId: item.id,
workerId: item.workerId workerId: item.workerId
}, false, true).then((res) => { }, false, true).then((res) => {
if (status == 3) {
that.$delete(that.completingDeliveryIds, item.id)
}
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)
@ -1045,7 +1125,11 @@
return; return;
} }
uni.hideLoading(); uni.hideLoading();
}).catch((res) => {}); }).catch((res) => {
if (status == 3) {
that.$delete(that.completingDeliveryIds, item.id)
}
});
}, },
checkTab1(type) { checkTab1(type) {
if (!this.ensureWorkerRegistered()) return if (!this.ensureWorkerRegistered()) return
@ -1637,6 +1721,11 @@
box-sizing: border-box; box-sizing: border-box;
} }
.dispatch-popup {
position: relative;
z-index: 1001;
}
.dispatch-popup-title { .dispatch-popup-title {
line-height: 48rpx; line-height: 48rpx;
font-size: 34rpx; font-size: 34rpx;
@ -1717,8 +1806,9 @@
.dispatch-actions { .dispatch-actions {
display: flex; display: flex;
gap: 18rpx; gap: 18rpx;
padding: 18rpx 0 calc(132rpx + constant(safe-area-inset-bottom)); padding: 18rpx 0 24rpx;
padding: 18rpx 0 calc(132rpx + env(safe-area-inset-bottom)); padding: 18rpx 0 calc(24rpx + constant(safe-area-inset-bottom));
padding: 18rpx 0 calc(24rpx + env(safe-area-inset-bottom));
background: #fff; background: #fff;
flex-shrink: 0; flex-shrink: 0;
z-index: 2; z-index: 2;
@ -1852,6 +1942,72 @@
height: 500rpx; height: 500rpx;
} }
.pickup-code-popup {
width: 640rpx;
padding: 42rpx 34rpx 30rpx;
box-sizing: border-box;
border-radius: 32rpx;
background: #fff;
box-shadow: 0 24rpx 56rpx rgba(0, 35, 28, 0.18);
}
.pickup-code-title {
color: #00231C;
font-size: 34rpx;
font-weight: 900;
line-height: 46rpx;
text-align: center;
}
.pickup-code-desc {
margin-top: 10rpx;
color: #7b8a85;
font-size: 24rpx;
line-height: 34rpx;
text-align: center;
}
.pickup-code-input {
width: 100%;
height: 92rpx;
margin-top: 34rpx;
padding: 0 26rpx;
box-sizing: border-box;
border: 2rpx solid rgba(166, 255, 234, 0.88);
border-radius: 22rpx;
background: rgba(247, 255, 251, 0.96);
color: #00231C;
font-size: 34rpx;
font-weight: 800;
text-align: center;
}
.pickup-code-actions {
display: flex;
gap: 18rpx;
margin-top: 34rpx;
}
.pickup-code-action {
flex: 1;
height: 78rpx;
line-height: 78rpx;
border-radius: 78rpx;
text-align: center;
font-size: 28rpx;
font-weight: 900;
}
.pickup-code-action--cancel {
background: rgba(247, 248, 248, 0.96);
color: #526964;
}
.pickup-code-action--confirm {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
color: #00231C;
}
.chaoda { .chaoda {
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;

Loading…
Cancel
Save