优化
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({
|
return request({
|
||||||
url: '/bst/order/end',
|
url: '/bst/order/end',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: {
|
data: {
|
||||||
orderId
|
orderId,
|
||||||
|
needDispatchFee
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,16 +403,37 @@ 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) {
|
||||||
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
|
const calcRes = await appCalcOrderFee({orderId: row.id, checkLocation: false})
|
||||||
confirmButtonText: '确定',
|
let fee = {}
|
||||||
cancelButtonText: '取消',
|
if (calcRes.code === 200 && calcRes.data) {
|
||||||
type: 'warning'
|
fee = calcRes.data
|
||||||
}).then(() => {
|
}
|
||||||
endOrder(row.id).then(response => {
|
|
||||||
this.$message.success("结束成功");
|
if (fee.manageFee || fee.dispatchFee) {
|
||||||
this.getList();
|
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) {
|
handleRefund(row) {
|
||||||
|
|
|
@ -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) {
|
||||||
this.$confirm(`确定结束订单${row.no}吗?`, '提示', {
|
const calcRes = await appCalcOrderFee({orderId: row.id, checkLocation: false})
|
||||||
confirmButtonText: '确定',
|
let fee = {}
|
||||||
cancelButtonText: '取消',
|
if (calcRes.code === 200 && calcRes.data) {
|
||||||
type: 'warning'
|
fee = calcRes.data
|
||||||
}).then(() => {
|
}
|
||||||
this.loading = true;
|
|
||||||
endOrder(row.id).then(response => {
|
if (fee.manageFee || fee.dispatchFee) {
|
||||||
this.$message.success("结束成功");
|
this.$confirm(`订单${row.no}存在${fee.dispatchFee ? '调度费' + fee.dispatchFee + '元' : ''}${fee.manageFee ? '管理费' + fee.manageFee + '元' : ''},是否收取?`, '提示', {
|
||||||
this.getDetail();
|
confirmButtonText: '收取',
|
||||||
|
cancelButtonText: '不收取',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.doEndOrder(row.id, true);
|
||||||
}).catch(() => {
|
}).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) {
|
unitLabel(value) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user