优化
This commit is contained in:
parent
468516f68e
commit
e91ff5ce97
16
src/api/app/order.js
Normal file
16
src/api/app/order.js
Normal 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
|
||||
})
|
||||
}
|
|
@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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,17 +403,38 @@ export default {
|
|||
handleView(row) {
|
||||
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}吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
endOrder(row.id).then(response => {
|
||||
this.doEndOrder(row.id, false);
|
||||
});
|
||||
}
|
||||
},
|
||||
doEndOrder(id, needDispatchFee) {
|
||||
endOrder(id, needDispatchFee).then(res => {
|
||||
this.$message.success("结束成功");
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
handleRefund(row) {
|
||||
this.row = row;
|
||||
|
|
|
@ -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) {
|
||||
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.loading = true;
|
||||
endOrder(row.id).then(response => {
|
||||
this.$message.success("结束成功");
|
||||
this.getDetail();
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.doEndOrder(row.id, false);
|
||||
});
|
||||
}
|
||||
},
|
||||
doEndOrder(id, needDispatchFee) {
|
||||
endOrder(id, needDispatchFee).then(res => {
|
||||
this.$message.success("结束成功");
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
unitLabel(value) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user