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({ return request({
url: '/bst/order/end', url: '/bst/order/end',
method: 'put', method: 'put',
data: { data: {
orderId orderId,
needDispatchFee
} }
}) })
} }

View File

@ -289,6 +289,7 @@
</template> </template>
<script> <script>
import { appCalcOrderFee } from "@/api/app/order";
import { endOrder, listOrder } from "@/api/bst/order"; import { endOrder, listOrder } from "@/api/bst/order";
import AreaLink from '@/components/Business/Area/AreaLink.vue'; import AreaLink from '@/components/Business/Area/AreaLink.vue';
import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue'; import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
@ -402,17 +403,38 @@ export default {
handleView(row) { handleView(row) {
this.$router.push(`/view/order/${row.id}`) this.$router.push(`/view/order/${row.id}`)
}, },
handleEnd(row) { 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}吗?`, '提示', { this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
endOrder(row.id).then(response => { this.doEndOrder(row.id, false);
});
}
},
doEndOrder(id, needDispatchFee) {
endOrder(id, needDispatchFee).then(res => {
this.$message.success("结束成功"); this.$message.success("结束成功");
this.getList(); this.getList();
}); });
});
}, },
handleRefund(row) { handleRefund(row) {
this.row = row; this.row = row;

View File

@ -256,6 +256,7 @@
</template> </template>
<script> <script>
import { appCalcOrderFee } from '@/api/app/order'
import { endOrder, getOrder } from '@/api/bst/order' import { endOrder, getOrder } from '@/api/bst/order'
import AreaLink from '@/components/Business/Area/AreaLink.vue' import AreaLink from '@/components/Business/Area/AreaLink.vue'
import DeviceLink from '@/components/Business/Device/DeviceLink.vue' import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
@ -340,19 +341,37 @@ export default {
handleVerify(row) { handleVerify(row) {
this.showVerifyDialog = true; this.showVerifyDialog = true;
}, },
handleEnd(row) { 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}吗?`, '提示', { this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.loading = true; this.doEndOrder(row.id, false);
endOrder(row.id).then(response => {
this.$message.success("结束成功");
this.getDetail();
}).catch(() => {
this.loading = false;
}); });
}
},
doEndOrder(id, needDispatchFee) {
endOrder(id, needDispatchFee).then(res => {
this.$message.success("结束成功");
this.getList();
}); });
}, },
unitLabel(value) { unitLabel(value) {