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

37
package3/shop/selfDeliveryOrderList.vue

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

Loading…
Cancel
Save