This commit is contained in:
邱贞招 2024-10-02 18:33:10 +08:00
parent 2c9695f6c5
commit 188836b06a
5 changed files with 86 additions and 25 deletions

View File

@ -86,36 +86,36 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商户号" prop="merchantId"> <el-form-item label="商户号" prop="merchantId">
<el-input style="width: 100%" v-model="form.merchantId" placeholder="请输入商户号" /> <el-input style="width: 100%" v-model="form.merchantId" placeholder="请输入商户号" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="apiV3密钥" prop="apiV3Key"> <el-form-item label="apiV3密钥" prop="apiV3Key">
<el-input v-model="form.apiV3Key" placeholder="请输入apiV3密钥" /> <el-input v-model="form.apiV3Key" placeholder="请输入apiV3密钥" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="通知回调地址" label-width="100" prop="notifyUrl"> <el-form-item label="通知回调地址" label-width="100" prop="notifyUrl">
<el-input style="width: 66%" v-model="form.notifyUrl" placeholder="请输入通知回调地址" /> <el-input style="width: 66%" v-model="form.notifyUrl" placeholder="请输入通知回调地址" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="密钥所在位置" label-width="100" prop="privateKeyPath"> <el-form-item label="密钥所在位置" label-width="100" prop="privateKeyPath">
<el-input style="width: 70%" v-model="form.privateKeyPath" placeholder="请输入密钥所在位置" /> <el-input style="width: 70%" v-model="form.privateKeyPath" placeholder="请输入密钥所在位置" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="证书序列号" label-width="90" prop="merchantSerialNumber"> <el-form-item label="证书序列号" label-width="90" prop="merchantSerialNumber">
<el-input style="width: 70%" v-model="form.merchantSerialNumber" placeholder="请输入证书序列号" /> <el-input style="width: 70%" v-model="form.merchantSerialNumber" placeholder="请输入证书序列号" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="退款回调地址" label-width="100" prop="refundNotifyUrl"> <el-form-item label="退款回调地址" label-width="100" prop="refundNotifyUrl">
<el-input style="width: 70%" v-model="form.refundNotifyUrl" placeholder="请输入退款回调地址" /> <el-input style="width: 70%" v-model="form.refundNotifyUrl" placeholder="请输入退款回调地址" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -6,16 +6,14 @@
size="small" size="small"
:inline="true" :inline="true"
v-show="showSearch" v-show="showSearch"
label-width="68px" label-width="68px">
>
<el-form-item label="代理商" prop="deptId" v-if="userName == 'admin'"> <el-form-item label="代理商" prop="deptId" v-if="userName == 'admin'">
<el-select <el-select
v-model="queryParams.deptId" v-model="queryParams.deptId"
filterable filterable
placeholder="选择代理商" placeholder="选择代理商"
style="width: 120px" style="width: 120px"
clearable clearable>
>
<el-option <el-option
v-for="item in deptOptions" v-for="item in deptOptions"
:key="item.deptId" :key="item.deptId"
@ -615,6 +613,7 @@
<el-select <el-select
v-model="form.deptId" v-model="form.deptId"
clearable clearable
filterable
placeholder="请选择代理商" placeholder="请选择代理商"
> >
<el-option <el-option

View File

@ -94,7 +94,7 @@
<el-row> <el-row>
<el-col :span="12" v-if="userName == 'admin'"> <el-col :span="12" v-if="userName == 'admin'">
<el-form-item label="代理商" prop="deptId" > <el-form-item label="代理商" prop="deptId" >
<el-select v-model="form.deptId" placeholder="请选择运营区"> <el-select v-model="form.deptId" filterable placeholder="请选择代理商">
<el-option <el-option
v-for="item in deptOptions" v-for="item in deptOptions"
:key="item.deptId" :key="item.deptId"

View File

@ -1,6 +1,21 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="代理商" prop="deptId" v-if="userName == 'admin'">
<el-select
v-model="queryParams.deptId"
filterable
placeholder="选择代理商"
style="width: 120px"
clearable>
<el-option
v-for="item in deptOptions"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="运营区" prop="areaId" v-if="userName == 'admin'"> <el-form-item label="运营区" prop="areaId" v-if="userName == 'admin'">
<el-select v-model="queryParams.areaId" filterable placeholder="请选择运营区" clearable> <el-select v-model="queryParams.areaId" filterable placeholder="请选择运营区" clearable>
<el-option <el-option
@ -194,8 +209,12 @@
<!-- <el-table-column label="金额(元)" align="center" prop="totalFee" width="70"/>--> <!-- <el-table-column label="金额(元)" align="center" prop="totalFee" width="70"/>-->
<el-table-column label="费用详情" header-align="center" align="left" width="200"> <el-table-column label="费用详情" header-align="center" align="left" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <!-- {{scope.row.status}}-->
<template > <!-- <div v-if="scope.row.status == '2'"> &lt;!&ndash; 如果状态是骑行中 &ndash;&gt;-->
<!-- <span>预估金额{{ calculateEstimateFee(scope.row) }}</span><br />-->
<!-- </div>-->
<div> <!-- 其他状态下显示费用详情 -->
<template>
<span>结算金额{{ formatFee(calculateSettlementAmount(scope.row)) }}</span><br /> <span>结算金额{{ formatFee(calculateSettlementAmount(scope.row)) }}</span><br />
</template> </template>
<template v-if="scope.row.appointmentFee > 0"> <template v-if="scope.row.appointmentFee > 0">
@ -210,13 +229,13 @@
<template v-if="scope.row.manageFee > 0"> <template v-if="scope.row.manageFee > 0">
<span>停车点外调度费{{ formatFee(scope.row.manageFee) }}</span><br /> <span>停车点外调度费{{ formatFee(scope.row.manageFee) }}</span><br />
</template> </template>
<template v-if="scope.row.manageFee > 0"> <template v-if="scope.row.payFee > 0">
<span >订单金额{{ formatFee(scope.row.payFee) }}</span><br /> <span>订单金额{{ formatFee(scope.row.payFee) }}</span><br />
</template> </template>
<template v-if="scope.row.totalRefundFee > 0"> <template v-if="scope.row.totalRefundFee > 0">
<span>退款金额 <span>退款金额
<span style="font-weight: bold;color: red">{{ formatFee(scope.row.totalRefundFee) }}</span> <span style="font-weight: bold;color: red">{{ formatFee(scope.row.totalRefundFee) }}</span>
</span><br /> </span><br />
</template> </template>
</div> </div>
</template> </template>
@ -225,7 +244,7 @@
<el-table-column label="备注" align="center" prop="mark" width="140"/> <el-table-column label="备注" align="center" prop="mark" width="140"/>
<!-- <el-table-column label="交易金额" align="center" prop="amount" :formatter="formatAmount"/>--> <!-- <el-table-column label="交易金额" align="center" prop="amount" :formatter="formatAmount"/>-->
<el-table-column label="手续费" align="center" prop="handlingCharge" :formatter="formatAmount"/> <el-table-column label="手续费" align="center" prop="handlingCharge" :formatter="formatAmount"/>
<el-table-column label="成本" align="center" prop="handlingCharge" :formatter="formatAmount"/> <el-table-column label="成本" align="center" prop="cost" :formatter="formatAmount"/>
<el-table-column label="服务费" align="center" prop="platformServiceFee" :formatter="formatAmount"/> <el-table-column label="服务费" align="center" prop="platformServiceFee" :formatter="formatAmount"/>
<!-- <el-table-column label="到账金额" align="center" prop="platformServiceFee" :formatter="formatAmount"/>--> <!-- <el-table-column label="到账金额" align="center" prop="platformServiceFee" :formatter="formatAmount"/>-->
<!-- <el-table-column label="订单时长" align="center" prop="duration" :formatter="formatDuration"/>--> <!-- <el-table-column label="订单时长" align="center" prop="duration" :formatter="formatDuration"/>-->
@ -535,6 +554,8 @@
} from '@/api/system/order' } from '@/api/system/order'
import TrajectoryMap from '@/components/Map/TrajectoryMap' import TrajectoryMap from '@/components/Map/TrajectoryMap'
import { getArea, optionselect as getAreaOptionselect } from '@/api/system/area' import { getArea, optionselect as getAreaOptionselect } from '@/api/system/area'
import { getFee } from '@/api/system/fee'
import { listDept2 } from '@/api/system/dept'
export default { export default {
name: "Order", name: "Order",
@ -556,6 +577,7 @@ export default {
// keyarea-map // keyarea-map
key: 0, key: 0,
areaOptions: [], areaOptions: [],
deptOptions: [],
// //
total: 0, total: 0,
view: false, view: false,
@ -656,6 +678,7 @@ export default {
this.reset2(); this.reset2();
this.getList(); this.getList();
this.getAreaList(); this.getAreaList();
this.getDeptList();
}, },
watch: { watch: {
open(val) { open(val) {
@ -669,6 +692,11 @@ export default {
} }
}, },
methods: { methods: {
getDeptList() {
listDept2({ status: "0", pageNum: 1, pageSize: 999 }).then((response) => {
this.deptOptions = response.rows;
});
},
formatAmount(row, column) { formatAmount(row, column) {
const key = column.property; const key = column.property;
return parseFloat(row[key] || 0).toFixed(2); return parseFloat(row[key] || 0).toFixed(2);
@ -846,6 +874,7 @@ export default {
}, },
//null0.00 //null0.00
formatFee(fee){ formatFee(fee){
console.log("formatFee:"+fee)
if (!fee) return '0.00元'; if (!fee) return '0.00元';
const feeStr = fee.toString(); const feeStr = fee.toString();
const twoDecimalPattern = /^\d+(\.\d{2})?$/; const twoDecimalPattern = /^\d+(\.\d{2})?$/;
@ -855,6 +884,42 @@ export default {
const formattedFee = parseFloat(fee).toFixed(2); const formattedFee = parseFloat(fee).toFixed(2);
return `${formattedFee}`; return `${formattedFee}`;
}, },
calculateEstimateFee(row) {
const ridingRule = JSON.parse( row.ridingRuleJson);
console.log("ridingRule",ridingRule)
const startingPrice = parseFloat(ridingRule.startingPrice);
const startingTime = parseInt(ridingRule.startingTime);
const timeoutPrice = parseFloat(ridingRule.timeoutPrice);
const timeoutTime = parseInt(ridingRule.timeoutTime);
console.log("ridingRule:" + JSON.stringify(ridingRule));
const createTime = new Date(row.createTime);
const currentTime = new Date();
const durationMinutes = Math.floor((currentTime - createTime) / (1000 * 60)); //
//
let estimatedFee = startingPrice;
if (durationMinutes > startingTime) {
const extraTime = durationMinutes - startingTime;
const extraCharges = Math.ceil(extraTime / timeoutTime) * timeoutPrice;
estimatedFee += extraCharges;
}
console.log("durationMinutes:" + durationMinutes);
console.log("estimatedFee:" + estimatedFee);
//
if (!estimatedFee) return '0.00元';
const feeStr = estimatedFee.toString();
const twoDecimalPattern = /^\d+(\.\d{2})?$/;
console.log("feeStr:" + feeStr)
if (twoDecimalPattern.test(feeStr)) {
return `${feeStr}`;
}
const formattedFee = parseFloat(estimatedFee).toFixed(2);
console.log("formattedFee:" + formattedFee)
return `${formattedFee}`;
},
calculateSettlementAmount(row) { calculateSettlementAmount(row) {
// = - 退 // = - 退
const payFee = row.payFee || 0; const payFee = row.payFee || 0;
@ -901,10 +966,7 @@ export default {
}, },
formatDuration(row) { formatDuration(row) {
const createTime = new Date(row.createTime); const createTime = new Date(row.createTime);
const endTime = new Date(row.returnTime); const endTime = row.returnTime ? new Date(row.returnTime) : new Date(); // 使
if (!row.returnTime) {
return "未结束";
}
const durationMilliseconds = endTime - createTime; const durationMilliseconds = endTime - createTime;
// //
const hours = Math.floor(durationMilliseconds / (1000 * 60 * 60)); const hours = Math.floor(durationMilliseconds / (1000 * 60 * 60));

View File

@ -136,7 +136,7 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="代理商" prop="operator" v-if="userName == 'admin'"> <el-form-item label="代理商" prop="operator" v-if="userName == 'admin'">
<el-select v-model="form.deptId" clearable placeholder="请选择代理商"> <el-select v-model="form.deptId" clearable filterable placeholder="请选择代理商">
<el-option <el-option
v-for="item in deptOptions" v-for="item in deptOptions"
:key="item.deptId" :key="item.deptId"