wangfukang 1 month ago
parent
commit
b3a1cb7392
  1. 39
      package3/shop/selfDeliveryOrderList.vue

39
package3/shop/selfDeliveryOrderList.vue

@ -8,6 +8,7 @@
<view class="nav-title">自配送订单</view> <view class="nav-title">自配送订单</view>
</view> </view>
<view class="tabs"> <view class="tabs">
<view class="tab" :class="{active: tab === 'pickup'}" @tap="switchTab('pickup')">待取货</view>
<view class="tab" :class="{active: tab === 'wait'}" @tap="switchTab('wait')">待送达</view> <view class="tab" :class="{active: tab === 'wait'}" @tap="switchTab('wait')">待送达</view>
<view class="tab" :class="{active: tab === 'done'}" @tap="switchTab('done')">已送达</view> <view class="tab" :class="{active: tab === 'done'}" @tap="switchTab('done')">已送达</view>
</view> </view>
@ -49,7 +50,7 @@
</view> </view>
<view class="remark" v-if="item.remark">备注{{item.remark}}</view> <view class="remark" v-if="item.remark">备注{{item.remark}}</view>
<view class="fee">配送费 {{item.deliveryFee || 0}}</view> <view class="fee">配送费 {{item.deliveryFee || 0}}</view>
<view class="btn" v-if="tab === 'wait'" @tap.stop="handleOrder(index,item)"> <view class="btn" v-if="tab !== 'done'" @tap.stop="handleOrder(index,item)">
{{buttonText(item)}} {{buttonText(item)}}
</view> </view>
</view> </view>
@ -89,14 +90,14 @@
export default { export default {
data() { data() {
return { return {
tab: 'wait', tab: 'pickup',
list: [], list: [],
loadStatus: 'more', loadStatus: 'more',
totalPages: 1, totalPages: 1,
searchForm: { searchForm: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
status: 2, status: 1,
deliveryType: 1, deliveryType: 1,
shopDelivery: 1, shopDelivery: 1,
shopId: '', shopId: '',
@ -107,7 +108,12 @@
navHeight: 120, navHeight: 120,
backTop: 88, backTop: 88,
listTop: 150, listTop: 150,
productData: [] productData: [],
worker: {
workerId: '',
workerName: '',
workerPhone: ''
}
} }
}, },
filters: { filters: {
@ -164,7 +170,12 @@
this.searchForm.pageNum = 1; this.searchForm.pageNum = 1;
this.totalPages = 1; this.totalPages = 1;
this.loadStatus = 'more'; this.loadStatus = 'more';
this.searchForm.status = this.tab === 'wait' ? 2 : 3; const statusMap = {
pickup: 1,
wait: 2,
done: 3
};
this.searchForm.status = statusMap[this.tab];
this.getList(); this.getList();
}, },
loadMore() { loadMore() {
@ -190,10 +201,18 @@
}); });
}, },
handleOrder(index, item) { handleOrder(index, item) {
if (this.tab !== 'wait') return; if (this.tab === 'pickup') {
this.changeStatus(index, item, 3); this.changeStatus(index, item, item.arriveTime == null ? 1 : 2);
return;
}
if (this.tab === 'wait') {
this.changeStatus(index, item, 3);
}
}, },
buttonText(item) { buttonText(item) {
if (this.tab === 'pickup') {
return item.arriveTime == null ? '已到店' : '已取货';
}
return '确认送达'; return '确认送达';
}, },
changeStatus(index, item, status) { changeStatus(index, item, status) {
@ -204,12 +223,8 @@
workerId: this.worker.workerId workerId: this.worker.workerId
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (status === 1) {
this.$set(this.list[index], 'arriveTime', new Date());
} else {
this.list.splice(index, 1);
}
this.tui.toast(res.message || '操作成功'); this.tui.toast(res.message || '操作成功');
this.resetList();
} else { } else {
this.tui.toast(res.message); this.tui.toast(res.message);
} }

Loading…
Cancel
Save