feat: 接单/拒接

This commit is contained in:
gcd 2025-04-01 21:11:10 +08:00
parent 6e7d927c1e
commit b260c4ac3d
2 changed files with 40 additions and 2 deletions

View File

@ -37,6 +37,12 @@ class Api {
let url = `${config.host}/worker/order_dispatch/index`;
return fetch.request('GET', url, data, true)
}
// 接单/拒接
static orderConfirm(data) {
let url = `${config.host}/worker/order_dispatch/orderConfirm`;
return fetch.request('postFrom', url, data, true)
}
}
export default Api

View File

@ -36,8 +36,8 @@
</view>
<view class="discount flex-l" v-if="item.order_info.receive_type === 1">已支付订金{{item.order_info.online_amount}}元抵扣{{item.order_info.discount_amount}}</view>
<view class="btn-ctr flex-sb">
<me-button @click="" text="确认接单" width="460rpx" icon-type="icon-flashlight"></me-button>
<me-button @click="" active-color="var(--contentBgColor)" text="拒 " width="166rpx" text-color="var(--titleColor)"></me-button>
<me-button @click="acceptOrder(index, item.id)" text="确认接单" width="460rpx" icon-type="icon-flashlight"></me-button>
<me-button @click="rejectOrder(index, item.id)" active-color="var(--contentBgColor)" text="拒 " width="166rpx" text-color="var(--titleColor)"></me-button>
</view>
</view>
</view>
@ -61,6 +61,38 @@ import helpers from "../../utils/helpers";
import api from "../../api/api";
import IndexSkeleton from "./index-skeleton";
const acceptOrder = (index, id) => {
uni.showModal({
title: '接单提示',
confirmText: '确认',
content: '接单后请及时和客户联系,确认接单?',
success: function (res) {
if (res.confirm) {
api.orderConfirm({type: 'accept', order_dispatch_id: id}).then(res => {
helpers.showToast('已接单')
data.list.splice(index, 1)
}).catch(() => {})
}
}
});
}
const rejectOrder = (index, id) => {
uni.showModal({
title: '拒接提示',
confirmText: '确认',
content: '确认拒接该单?',
success: function (res) {
if (res.confirm) {
api.orderConfirm({type: 'reject', order_dispatch_id: id}).then(res => {
helpers.showToast('已拒接')
data.list.splice(index, 1)
}).catch(() => {})
}
}
});
}
const listMarginTop = computed(() => {
return (inject('globalData').statusBarH + (inject('globalData').customBarH - inject('globalData').statusBarH)) * 2
})