|
|
@ -6,11 +6,13 @@ |
|
|
size="26"></uni-icons></view> |
|
|
size="26"></uni-icons></view> |
|
|
<view class="title" |
|
|
<view class="title" |
|
|
:style="{'top': titleTop + 'px','height': capsuleHeight + 'px','line-height': capsuleHeight + 'px'}"> |
|
|
:style="{'top': titleTop + 'px','height': capsuleHeight + 'px','line-height': capsuleHeight + 'px'}"> |
|
|
中转配送</view> |
|
|
{{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"> |
|
|
@ -20,6 +22,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> |
|
|
@ -40,13 +49,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)"> |
|
|
@ -61,12 +77,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"> |
|
|
@ -107,8 +129,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: { |
|
|
@ -117,6 +144,9 @@ |
|
|
deliveryType: 1, |
|
|
deliveryType: 1, |
|
|
transferDelivery: 1, |
|
|
transferDelivery: 1, |
|
|
transferArriveEmpty: true, |
|
|
transferArriveEmpty: true, |
|
|
|
|
|
transferWorkerView: false, |
|
|
|
|
|
transferWorkerAccepted: false, |
|
|
|
|
|
transferWorkerId: '', |
|
|
shopId: '', |
|
|
shopId: '', |
|
|
regionId: '' |
|
|
regionId: '' |
|
|
}, |
|
|
}, |
|
|
@ -127,6 +157,9 @@ |
|
|
listTop: 210 |
|
|
listTop: 210 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
onLoad(options) { |
|
|
|
|
|
this.isWorkerMode = !!(options && options.role === 'worker') |
|
|
|
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
this.initNavMetrics() |
|
|
this.initNavMetrics() |
|
|
this.resetList() |
|
|
this.resetList() |
|
|
@ -165,18 +198,32 @@ |
|
|
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).regionId : '' |
|
|
this.searchForm.regionId = area ? JSON.parse(area).regionId : '' |
|
|
|
|
|
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.NB.sendRequest("/mall/delivery/pageTransferDelivery", this.searchForm, false, 'post', |
|
|
this.NB.sendRequest("/mall/delivery/pageTransferDelivery", this.searchForm, false, 'post', |
|
|
'application/json').then((res) => { |
|
|
'application/json').then((res) => { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
@ -184,12 +231,39 @@ |
|
|
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 { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: res.message, |
|
|
title: res.message, |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
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.NB.sendRequest("/mall/delivery/pageTransferDelivery", params, false, 'post', |
|
|
|
|
|
'application/json').then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
this.transferTodoCount = Number((res.result || {}).total) || 0 |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
chooseImage(index) { |
|
|
chooseImage(index) { |
|
|
@ -237,6 +311,55 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
transferAccept(index, item) { |
|
|
|
|
|
if (this.acceptingTransferId) return |
|
|
|
|
|
const worker = this.currentWorker && this.currentWorker.workerId ? this.currentWorker : (uni.getStorageSync('worker') || {}) |
|
|
|
|
|
if (!worker.workerId) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '您还没有注册兼职', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.acceptingTransferId = item.id |
|
|
|
|
|
this.$set(this.list[index], 'transferAccepting', true) |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '接单中...', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
this.NB.sendRequest("/mall/delivery/transferAccept", { |
|
|
|
|
|
deliveryId: item.id, |
|
|
|
|
|
workerId: worker.workerId, |
|
|
|
|
|
workerName: worker.workerName || '', |
|
|
|
|
|
workerMobile: worker.mobile || '' |
|
|
|
|
|
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
this.list.splice(index, 1) |
|
|
|
|
|
this.transferTodoCount += 1 |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '接单成功', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.message, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
this.resetList() |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '接单失败,请重试', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
}).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 |
|
|
@ -472,6 +595,10 @@ |
|
|
color: #00231c; |
|
|
color: #00231c; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.main-btn-disabled { |
|
|
|
|
|
opacity: .58; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.empty { |
|
|
.empty { |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
color: #8a9692; |
|
|
color: #8a9692; |
|
|
|