This commit is contained in:
磷叶 2025-05-16 17:33:55 +08:00
parent 468516f68e
commit e91ff5ce97
4 changed files with 80 additions and 22 deletions

16
src/api/app/order.js Normal file
View File

@ -0,0 +1,16 @@
import request from '@/utils/request'
/**
* 计算订单费用
* @param {Object} data - 请求参数
* @param {number} data.lon - 经度
* @param {number} data.lat - 纬度
* @returns {Promise} 返回订单费用信息
*/
export function appCalcOrderFee(data) {
return request({
url: '/app/order/calcFee',
method: 'post',
data: data
})
}

View File

@ -44,12 +44,13 @@ export function delOrder(id) {
}
// 删除订单
export function endOrder(orderId) {
export function endOrder(orderId, needDispatchFee = false) {
return request({
url: '/bst/order/end',
method: 'put',
data: {
orderId
orderId,
needDispatchFee
}
})
}

View File

@ -289,6 +289,7 @@
</template>
<script>
import { appCalcOrderFee } from "@/api/app/order";
import { endOrder, listOrder } from "@/api/bst/order";
import AreaLink from '@/components/Business/Area/AreaLink.vue';
import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
@ -402,16 +403,37 @@ export default {
handleView(row) {
this.$router.push(`/view/order/${row.id}`)
},
handleEnd(row) {
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
endOrder(row.id).then(response => {
this.$message.success("结束成功");
this.getList();
async handleEnd(row) {
const calcRes = await appCalcOrderFee({orderId: row.id, checkLocation: false})
let fee = {}
if (calcRes.code === 200 && calcRes.data) {
fee = calcRes.data
}
if (fee.manageFee || fee.dispatchFee) {
this.$confirm(`订单${row.no}存在${fee.dispatchFee ? '调度费' + fee.dispatchFee + '元' : ''}${fee.manageFee ? '管理费' + fee.manageFee + '元' : ''},是否收取?`, '提示', {
confirmButtonText: '收取',
cancelButtonText: '不收取',
type: 'warning'
}).then(() => {
this.doEndOrder(row.id, true);
}).catch(() => {
this.doEndOrder(row.id, false);
});
} else {
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.doEndOrder(row.id, false);
});
}
},
doEndOrder(id, needDispatchFee) {
endOrder(id, needDispatchFee).then(res => {
this.$message.success("结束成功");
this.getList();
});
},
handleRefund(row) {

View File

@ -256,6 +256,7 @@
</template>
<script>
import { appCalcOrderFee } from '@/api/app/order'
import { endOrder, getOrder } from '@/api/bst/order'
import AreaLink from '@/components/Business/Area/AreaLink.vue'
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
@ -340,19 +341,37 @@ export default {
handleVerify(row) {
this.showVerifyDialog = true;
},
handleEnd(row) {
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.loading = true;
endOrder(row.id).then(response => {
this.$message.success("结束成功");
this.getDetail();
async handleEnd(row) {
const calcRes = await appCalcOrderFee({orderId: row.id, checkLocation: false})
let fee = {}
if (calcRes.code === 200 && calcRes.data) {
fee = calcRes.data
}
if (fee.manageFee || fee.dispatchFee) {
this.$confirm(`订单${row.no}存在${fee.dispatchFee ? '调度费' + fee.dispatchFee + '元' : ''}${fee.manageFee ? '管理费' + fee.manageFee + '元' : ''},是否收取?`, '提示', {
confirmButtonText: '收取',
cancelButtonText: '不收取',
type: 'warning'
}).then(() => {
this.doEndOrder(row.id, true);
}).catch(() => {
this.loading = false;
this.doEndOrder(row.id, false);
});
} else {
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.doEndOrder(row.id, false);
});
}
},
doEndOrder(id, needDispatchFee) {
endOrder(id, needDispatchFee).then(res => {
this.$message.success("结束成功");
this.getList();
});
},
unitLabel(value) {