feat: 积分商城-供应商-对账-发票
This commit is contained in:
@@ -15,6 +15,15 @@
|
||||
</van-tabs>
|
||||
|
||||
<van-pull-refresh v-model="refreshing" class="order-list" @refresh="onRefresh">
|
||||
<van-button
|
||||
v-if="receivableOrders.length"
|
||||
block
|
||||
round
|
||||
class="batch-receive-button"
|
||||
@click="confirmReceiveAll"
|
||||
>
|
||||
一键收货({{ receivableOrders.length }})
|
||||
</van-button>
|
||||
<van-empty v-if="visibleOrders.length === 0" description="暂无订单" />
|
||||
|
||||
<template v-else>
|
||||
@@ -164,6 +173,11 @@ export default {
|
||||
activeTab() {
|
||||
return this.tabs[this.active] || this.tabs[0]
|
||||
},
|
||||
receivableOrders() {
|
||||
return this.visibleOrders.filter(order => {
|
||||
return order.displayType === 'sub' && Number(order.orderState) === ORDER_STATE.IN_PROGRESS
|
||||
})
|
||||
},
|
||||
visibleOrders() {
|
||||
const tab = this.activeTab
|
||||
|
||||
@@ -321,6 +335,44 @@ export default {
|
||||
this.refreshing = false
|
||||
}
|
||||
},
|
||||
async confirmReceiveAll() {
|
||||
try {
|
||||
await Dialog.confirm({
|
||||
title: '一键收货',
|
||||
message: `确定将当前 ${this.receivableOrders.length} 个订单全部确认收货吗?`
|
||||
})
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
this.operationKey = 'batch-confirm-receive'
|
||||
try {
|
||||
await this.fetchBridgeToken()
|
||||
if (!this.supplierId || !this.userId) {
|
||||
Toast('用户信息不完整,请重新进入商城')
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.all(this.receivableOrders.map(order => postFunction('order-push-event', {
|
||||
supplierId: this.supplierId,
|
||||
userId: this.userId,
|
||||
orderType: ORDER_EVENT_TYPE.CONFIRM_RECEIVE,
|
||||
orderId: order.orderId,
|
||||
mainOrderId: order.mainOrderId,
|
||||
subOrderId: order.orderId,
|
||||
amount: Number(order.amount || 0),
|
||||
reason: '确认收货',
|
||||
time: Date.now()
|
||||
})))
|
||||
|
||||
Toast('批量收货成功')
|
||||
await this.loadOrders()
|
||||
} catch (error) {
|
||||
Toast(error.message || '批量收货失败,请稍后再试')
|
||||
} finally {
|
||||
this.operationKey = ''
|
||||
}
|
||||
},
|
||||
orderActions(order) {
|
||||
if (order.displayType === 'main') {
|
||||
return Number(order.orderState) === ORDER_STATE.PENDING_PAY
|
||||
@@ -583,6 +635,12 @@ export default {
|
||||
padding: 12px 10px 18px;
|
||||
}
|
||||
|
||||
.batch-receive-button {
|
||||
margin-bottom: 12px;
|
||||
color: #ff5b20;
|
||||
background: #fff1e8;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
overflow: hidden;
|
||||
margin-bottom: 14px;
|
||||
|
||||
Reference in New Issue
Block a user