feat(M08-A): 接入顾客端订单开门
This commit is contained in:
@@ -66,6 +66,19 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
async openDoor() {
|
||||
if (!this.data.orderId) return
|
||||
await this.withOrderRequest(async () => {
|
||||
const response = await request(`/orders/${encodeURIComponent(this.data.orderId)}/open-door`, {
|
||||
method: 'POST',
|
||||
data: { delayTime: 4 },
|
||||
})
|
||||
this.setData({
|
||||
successMessage: `开门指令已发送:${response.data.status || 'PUBLISHED'}`,
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async withOrderRequest(work) {
|
||||
this.setData({ loading: true, errorMessage: '', successMessage: '' })
|
||||
try {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<view class="action-grid">
|
||||
<button loading="{{loading}}" bindtap="loadOrder">刷新</button>
|
||||
<button loading="{{loading}}" bindtap="openDoor">开门</button>
|
||||
<button loading="{{loading}}" bindtap="loadCancellationQuote">取消测算</button>
|
||||
<button loading="{{loading}}" bindtap="cancelOrder">取消订单</button>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user