|
|
@ -3,11 +3,13 @@ |
|
|
<view class="fixed-head"> |
|
|
<view class="fixed-head"> |
|
|
<view class="nav" :style="{'height': navHeight + 'px'}"> |
|
|
<view class="nav" :style="{'height': navHeight + 'px'}"> |
|
|
<view class="back" :style="{'top': backTop + 'px'}" @tap="back"><uni-icons type="left" size="26"></uni-icons></view> |
|
|
<view class="back" :style="{'top': backTop + 'px'}" @tap="back"><uni-icons type="left" size="26"></uni-icons></view> |
|
|
<view class="title" :style="{'top': titleTop + 'px','height': capsuleHeight + 'px','line-height': capsuleHeight + 'px'}">中转配送</view> |
|
|
<view class="title" :style="{'top': titleTop + 'px','height': capsuleHeight + 'px','line-height': capsuleHeight + 'px'}">{{isWorkerMode ? '中转单' : '中转配送'}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="tabs"> |
|
|
<view class="tabs"> |
|
|
<view class="tab" :class="{active: tab === 'wait'}" @tap="switchTab('wait')">待送达</view> |
|
|
<view class="tab" v-if="isWorkerMode" :class="{active: tab === 'wait'}" @tap="switchTab('wait')">待接单</view> |
|
|
<view class="tab" :class="{active: tab === 'done'}" @tap="switchTab('done')">已送达</view> |
|
|
<view class="tab" v-if="isWorkerMode" :class="{active: tab === 'accepted'}" @tap="switchTab('accepted')">待送达中转点({{transferTodoCount}})</view> |
|
|
|
|
|
<view class="tab" v-if="!isWorkerMode" :class="{active: tab === 'wait'}" @tap="switchTab('wait')">待送达</view> |
|
|
|
|
|
<view class="tab" v-if="!isWorkerMode" :class="{active: tab === 'done'}" @tap="switchTab('done')">已送达</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<scroll-view class="list" :style="{'top': listTop + 'px'}" scroll-y @scrolltolower="loadMore"> |
|
|
<scroll-view class="list" :style="{'top': listTop + 'px'}" scroll-y @scrolltolower="loadMore"> |
|
|
@ -17,6 +19,13 @@ |
|
|
<view class="appointment-delivery-tag" v-if="item.appointmentDelivery == 1">预约配送</view> |
|
|
<view class="appointment-delivery-tag" v-if="item.appointmentDelivery == 1">预约配送</view> |
|
|
<view class="code" v-if="item.numberCode">#{{item.numberCode}}</view> |
|
|
<view class="code" v-if="item.numberCode">#{{item.numberCode}}</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<view class="row"> |
|
|
|
|
|
<view class="label">商家</view> |
|
|
|
|
|
<view class="value phone-value" @tap.stop="makeCall(item.shopPhone)"> |
|
|
|
|
|
<text>{{item.shopName || '-'}}</text> |
|
|
|
|
|
<text v-if="item.shopPhone" class="phone">{{item.shopPhone}}</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
<view class="row"> |
|
|
<view class="row"> |
|
|
<view class="label">中转点</view> |
|
|
<view class="label">中转点</view> |
|
|
<view class="value">{{item.transferAddressName || item.shopName}}</view> |
|
|
<view class="value">{{item.transferAddressName || item.shopName}}</view> |
|
|
@ -37,13 +46,20 @@ |
|
|
<view class="label">取餐码</view> |
|
|
<view class="label">取餐码</view> |
|
|
<view class="value pickup-code">{{item.transferPickupCode || '配送员接单后生成'}}</view> |
|
|
<view class="value pickup-code">{{item.transferPickupCode || '配送员接单后生成'}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="row"> |
|
|
<view class="row" v-if="!isWorkerMode"> |
|
|
<view class="label">配送员</view> |
|
|
<view class="label">配送员</view> |
|
|
<view class="value phone-value" @tap.stop="makeCall(item.workerPhone)"> |
|
|
<view class="value phone-value" @tap.stop="makeCall(item.workerPhone)"> |
|
|
<text>{{item.workerName || '未分配'}}</text> |
|
|
<text>{{item.workerName || '未分配'}}</text> |
|
|
<text v-if="item.workerPhone" class="phone">{{item.workerPhone}}</text> |
|
|
<text v-if="item.workerPhone" class="phone">{{item.workerPhone}}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<view class="row" v-if="item.transferWorkerId"> |
|
|
|
|
|
<view class="label">中转员</view> |
|
|
|
|
|
<view class="value phone-value" @tap.stop="makeCall(item.transferWorkerMobile)"> |
|
|
|
|
|
<text>{{item.transferWorkerName || '未分配'}}</text> |
|
|
|
|
|
<text v-if="item.transferWorkerMobile" class="phone">{{item.transferWorkerMobile}}</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
<view class="row"> |
|
|
<view class="row"> |
|
|
<view class="label">用户</view> |
|
|
<view class="label">用户</view> |
|
|
<view class="value phone-value" @tap.stop="makeCall(item.receiverPhone)"> |
|
|
<view class="value phone-value" @tap.stop="makeCall(item.receiverPhone)"> |
|
|
@ -58,12 +74,18 @@ |
|
|
<view class="arrive-info" v-if="item.transferArriveTime"> |
|
|
<view class="arrive-info" v-if="item.transferArriveTime"> |
|
|
已送达中转点:{{formatTime(item.transferArriveTime)}} |
|
|
已送达中转点:{{formatTime(item.transferArriveTime)}} |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<view class="actions" v-else-if="isWorkerMode && tab === 'wait'"> |
|
|
|
|
|
<view class="main-btn" :class="{'main-btn-disabled': item.transferAccepting}" @tap.stop="transferAccept(index,item)"> |
|
|
|
|
|
{{item.transferAccepting ? '接单中...' : '接单'}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
<view class="actions" v-else> |
|
|
<view class="actions" v-else> |
|
|
<view class="photo-btn" @tap.stop="chooseImage(index)">拍照</view> |
|
|
<view class="photo-btn" @tap.stop="chooseImage(index)">拍照</view> |
|
|
<view class="main-btn" @tap.stop="transferArrive(index,item)">送达中转点</view> |
|
|
<view class="main-btn" @tap.stop="transferArrive(index,item)">送达中转点</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="empty" v-if="list.length === 0 && loadStatus === 'nomore'">暂无中转配送单</view> |
|
|
<uni-load-more :status="loadStatus" /> |
|
|
|
|
|
<view class="empty" v-if="list.length === 0 && loadStatus === 'nomore'">{{isWorkerMode ? (tab === 'accepted' ? '暂无待送达中转点订单' : '暂无待接中转单') : '暂无中转配送单'}}</view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
<uni-popup ref="productPopup" background-color="transparent"> |
|
|
<uni-popup ref="productPopup" background-color="transparent"> |
|
|
<view class="product-popup-content"> |
|
|
<view class="product-popup-content"> |
|
|
@ -104,8 +126,13 @@ |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
tab: 'wait', |
|
|
tab: 'wait', |
|
|
|
|
|
isWorkerMode: false, |
|
|
|
|
|
currentWorker: {}, |
|
|
|
|
|
transferTodoCount: 0, |
|
|
|
|
|
acceptingTransferId: '', |
|
|
list: [], |
|
|
list: [], |
|
|
productData: [], |
|
|
productData: [], |
|
|
|
|
|
isLoadingPage: false, |
|
|
loadStatus: 'more', |
|
|
loadStatus: 'more', |
|
|
totalPages: 1, |
|
|
totalPages: 1, |
|
|
searchForm: { |
|
|
searchForm: { |
|
|
@ -114,6 +141,9 @@ |
|
|
deliveryType: 1, |
|
|
deliveryType: 1, |
|
|
transferDelivery: 1, |
|
|
transferDelivery: 1, |
|
|
transferArriveEmpty: true, |
|
|
transferArriveEmpty: true, |
|
|
|
|
|
transferWorkerView: false, |
|
|
|
|
|
transferWorkerAccepted: false, |
|
|
|
|
|
transferWorkerId: '', |
|
|
shopId: '', |
|
|
shopId: '', |
|
|
regionId: '' |
|
|
regionId: '' |
|
|
}, |
|
|
}, |
|
|
@ -124,6 +154,9 @@ |
|
|
listTop: 210 |
|
|
listTop: 210 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
onLoad(options) { |
|
|
|
|
|
this.isWorkerMode = !!(options && options.role === 'worker') |
|
|
|
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
this.initNavMetrics() |
|
|
this.initNavMetrics() |
|
|
this.resetList() |
|
|
this.resetList() |
|
|
@ -165,27 +198,67 @@ |
|
|
this.totalPages = 1 |
|
|
this.totalPages = 1 |
|
|
this.list = [] |
|
|
this.list = [] |
|
|
this.loadStatus = 'more' |
|
|
this.loadStatus = 'more' |
|
|
this.searchForm.transferArriveEmpty = this.tab === 'wait' |
|
|
this.isLoadingPage = false |
|
|
this.searchForm.shopId = uni.getStorageSync('shopId') |
|
|
|
|
|
const area = uni.getStorageSync('area') |
|
|
const area = uni.getStorageSync('area') |
|
|
this.searchForm.regionId = area ? JSON.parse(area).id : '' |
|
|
this.searchForm.regionId = area ? JSON.parse(area).id : '' |
|
|
|
|
|
this.searchForm.transferWorkerView = this.isWorkerMode |
|
|
|
|
|
if (this.isWorkerMode) { |
|
|
|
|
|
this.currentWorker = uni.getStorageSync('worker') || {} |
|
|
|
|
|
this.searchForm.shopId = '' |
|
|
|
|
|
this.searchForm.transferWorkerId = this.currentWorker.workerId || '' |
|
|
|
|
|
this.searchForm.transferArriveEmpty = true |
|
|
|
|
|
this.searchForm.transferWorkerAccepted = this.tab === 'accepted' |
|
|
|
|
|
} else { |
|
|
|
|
|
this.searchForm.shopId = uni.getStorageSync('shopId') |
|
|
|
|
|
this.searchForm.transferWorkerId = '' |
|
|
|
|
|
this.searchForm.transferArriveEmpty = this.tab === 'wait' |
|
|
|
|
|
this.searchForm.transferWorkerAccepted = false |
|
|
|
|
|
} |
|
|
this.getList() |
|
|
this.getList() |
|
|
}, |
|
|
}, |
|
|
loadMore() { |
|
|
loadMore() { |
|
|
if (this.searchForm.pageNum >= this.totalPages) return |
|
|
if (this.isLoadingPage || this.searchForm.pageNum >= this.totalPages) return |
|
|
this.searchForm.pageNum++ |
|
|
this.searchForm.pageNum++ |
|
|
this.getList() |
|
|
this.getList() |
|
|
}, |
|
|
}, |
|
|
getList() { |
|
|
getList() { |
|
|
|
|
|
if (this.isLoadingPage) return |
|
|
|
|
|
this.isLoadingPage = true |
|
|
this.tui.request('/mall/delivery/pageTransferDelivery', 'POST', this.searchForm, false, false).then((res) => { |
|
|
this.tui.request('/mall/delivery/pageTransferDelivery', 'POST', this.searchForm, false, false).then((res) => { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
const records = res.result.records || [] |
|
|
const records = res.result.records || [] |
|
|
this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records) |
|
|
this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records) |
|
|
this.totalPages = res.result.pages || 1 |
|
|
this.totalPages = res.result.pages || 1 |
|
|
this.loadStatus = this.searchForm.pageNum >= this.totalPages ? 'nomore' : 'more' |
|
|
this.loadStatus = this.searchForm.pageNum >= this.totalPages ? 'nomore' : 'more' |
|
|
|
|
|
if (this.isWorkerMode) { |
|
|
|
|
|
if (this.tab === 'accepted') { |
|
|
|
|
|
this.transferTodoCount = Number(res.result.total) || 0 |
|
|
|
|
|
} else { |
|
|
|
|
|
this.getTransferTodoCount() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.tui.toast(res.message) |
|
|
this.tui.toast(res.message) |
|
|
} |
|
|
} |
|
|
|
|
|
this.isLoadingPage = false |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
this.isLoadingPage = false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getTransferTodoCount() { |
|
|
|
|
|
if (!this.isWorkerMode || !this.searchForm.transferWorkerId) { |
|
|
|
|
|
this.transferTodoCount = 0 |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const params = Object.assign({}, this.searchForm, { |
|
|
|
|
|
pageNum: 1, |
|
|
|
|
|
pageSize: 1, |
|
|
|
|
|
transferWorkerAccepted: true |
|
|
|
|
|
}) |
|
|
|
|
|
this.tui.request('/mall/delivery/pageTransferDelivery', 'POST', params, false, false).then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
this.transferTodoCount = Number((res.result || {}).total) || 0 |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
chooseImage(index) { |
|
|
chooseImage(index) { |
|
|
@ -227,6 +300,43 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
transferAccept(index, item) { |
|
|
|
|
|
if (this.acceptingTransferId) return |
|
|
|
|
|
const worker = this.currentWorker && this.currentWorker.workerId ? this.currentWorker : (uni.getStorageSync('worker') || {}) |
|
|
|
|
|
if (!worker.workerId) { |
|
|
|
|
|
this.tui.toast('您还没有注册兼职') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.acceptingTransferId = item.id |
|
|
|
|
|
this.$set(this.list[index], 'transferAccepting', true) |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '接单中...', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
this.tui.request('/mall/delivery/transferAccept', 'POST', { |
|
|
|
|
|
deliveryId: item.id, |
|
|
|
|
|
workerId: worker.workerId, |
|
|
|
|
|
workerName: worker.workerName || '', |
|
|
|
|
|
workerMobile: worker.mobile || '' |
|
|
|
|
|
}, false, true).then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
this.list.splice(index, 1) |
|
|
|
|
|
this.transferTodoCount += 1 |
|
|
|
|
|
this.tui.toast('接单成功') |
|
|
|
|
|
} else { |
|
|
|
|
|
this.tui.toast(res.message) |
|
|
|
|
|
this.resetList() |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
this.tui.toast('接单失败,请重试') |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
this.acceptingTransferId = '' |
|
|
|
|
|
if (this.list[index] && this.list[index].id === item.id) { |
|
|
|
|
|
this.$set(this.list[index], 'transferAccepting', false) |
|
|
|
|
|
} |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
productDetail(item) { |
|
|
productDetail(item) { |
|
|
const goodsList = item.goodsList || item.mallOrderGoodsList || item.orderGoodsList || [] |
|
|
const goodsList = item.goodsList || item.mallOrderGoodsList || item.orderGoodsList || [] |
|
|
this.productData = goodsList |
|
|
this.productData = goodsList |
|
|
@ -290,6 +400,7 @@ |
|
|
.photo-btn,.main-btn{flex:1;height:76rpx;line-height:76rpx;text-align:center;border-radius:38rpx;font-weight:700;} |
|
|
.photo-btn,.main-btn{flex:1;height:76rpx;line-height:76rpx;text-align:center;border-radius:38rpx;font-weight:700;} |
|
|
.photo-btn{background:#f2f6f4;color:#0b9b73;} |
|
|
.photo-btn{background:#f2f6f4;color:#0b9b73;} |
|
|
.main-btn{background:linear-gradient(90deg,#e3ff96,#a6ffea);color:#00231c;} |
|
|
.main-btn{background:linear-gradient(90deg,#e3ff96,#a6ffea);color:#00231c;} |
|
|
|
|
|
.main-btn-disabled{opacity:.58;} |
|
|
.empty{text-align:center;color:#8a9692;padding:80rpx 0;} |
|
|
.empty{text-align:center;color:#8a9692;padding:80rpx 0;} |
|
|
.product-popup-content { |
|
|
.product-popup-content { |
|
|
width: 680rpx; |
|
|
width: 680rpx; |
|
|
|