设备电量归零、结束订单
This commit is contained in:
parent
991c3fa3fa
commit
4d0a9085ac
|
@ -79,3 +79,13 @@ export function refundBill(billId, refundAmount) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭订单
|
||||||
|
export function closeBill(data) {
|
||||||
|
return request({
|
||||||
|
url: `/system/bill/close`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -110,3 +110,16 @@ export const PayBillStatus = {
|
||||||
REFUNDING: "5", // 退款中
|
REFUNDING: "5", // 退款中
|
||||||
REFUNDED: "6", // 已退款
|
REFUNDED: "6", // 已退款
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 充值订单状态
|
||||||
|
export const RechargeStatus = {
|
||||||
|
WAIT_PAY: "1", // 未支付
|
||||||
|
PAY_SUCCESS: "2", // 支付成功
|
||||||
|
REFUNDED: "3", // 已退款
|
||||||
|
USER_CANCEL: "4", // 用户取消
|
||||||
|
SYS_CANCEL: "5", // 系统超时取消
|
||||||
|
PAYING: "6", // 支付中
|
||||||
|
REFUNDING: "7", // 退款中
|
||||||
|
DEPOSIT_WAIT_PAY: "8", // 押金待支付
|
||||||
|
DEPOSIT_SUCCESS: "9", // 押金已支付
|
||||||
|
}
|
||||||
|
|
|
@ -88,70 +88,60 @@
|
||||||
v-hasPermi="['system:bill:export']"
|
v-hasPermi="['system:bill:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="billList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="billList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="订单ID" align="center" prop="billId" width="80"/>
|
<template v-for="column of showColumns">
|
||||||
<el-table-column label="时间" align="center" prop="createTime" width="180"/>
|
<el-table-column
|
||||||
<el-table-column label="订单编号" align="center" prop="billNo" min-width="130">
|
:key="column.key"
|
||||||
<recharge-link slot-scope="d" :bill-id="d.row.billId" :text="d.row.billNo"/>
|
:label="column.label"
|
||||||
</el-table-column>
|
:prop="column.key"
|
||||||
<el-table-column label="充值用户" align="center" prop="userName" >
|
:align="column.align"
|
||||||
<user-link slot-scope="d" :id="d.row.userId" :name="d.row.userName"/>
|
:min-width="column.minWidth"
|
||||||
</el-table-column>
|
:sort-orders="orderSorts"
|
||||||
<el-table-column label="设备名称/SN" align="center" prop="deviceName" width="180">
|
:sortable="column.sortable"
|
||||||
<device-link slot-scope="d" :id="d.row.deviceId" :text="`${d.row.deviceName ? d.row.deviceName : '--'} (${d.row.deviceNo})`"/>
|
:show-overflow-tooltip="column.overflow"
|
||||||
</el-table-column>
|
:width="column.width"
|
||||||
<el-table-column label="收款用户" align="center" prop="mchName" >
|
>
|
||||||
<user-link slot-scope="d" :id="d.row.mchId" :name="d.row.mchName"/>
|
<template slot-scope="d">
|
||||||
</el-table-column>
|
<template v-if="column.key === 'billId'">
|
||||||
<el-table-column label="交易金额" align="center">
|
{{d.row[column.key]}}
|
||||||
<template slot-scope="d">
|
</template>
|
||||||
{{d.row.money | money}} 元
|
<template v-else-if="column.key === 'billNo'">
|
||||||
</template>
|
<recharge-link :bill-id="d.row.billId" :text="d.row.billNo"/>
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="到账金额" align="center">
|
<template v-else-if="column.key === 'userName'">
|
||||||
<template slot-scope="d">
|
<user-link :id="d.row.userId" :name="d.row.userName"/>
|
||||||
{{d.row.arrivalAmount | money}} 元
|
</template>
|
||||||
</template>
|
<template v-else-if="column.key === 'deviceName'">
|
||||||
</el-table-column>
|
<device-link :id="d.row.deviceId" :text="`${d.row.deviceName ? d.row.deviceName : '--'} (${d.row.deviceNo})`"/>
|
||||||
<el-table-column label="手续费" align="center">
|
</template>
|
||||||
<template slot-scope="d">
|
<template v-else-if="column.key === 'mchName'">
|
||||||
{{d.row.serviceCharge | money | defaultValue}} 元
|
<user-link :id="d.row.mchId" :name="d.row.mchName"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
<template v-else-if="column.key === 'suitFeeMode'">
|
||||||
<el-table-column label="成本" align="center">
|
<dict-tag :value="d.row.suitFeeMode" :options="dict.type.suit_fee_mode"/>
|
||||||
<template slot-scope="d">
|
</template>
|
||||||
{{d.row.channelCost | money}} 元
|
<template v-else-if="column.key === 'suitFeeType'">
|
||||||
</template>
|
<dict-tag :value="d.row.suitFeeType" :options="dict.type.suit_fee_type"/>
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="利润" align="center">
|
<template v-else-if="column.key === 'status'">
|
||||||
<template slot-scope="d">
|
<dict-tag :value="d.row.status" :options="dict.type.sm_transaction_bill_status"/>
|
||||||
{{d.row.serviceCharge - d.row.channelCost | money}} 元
|
</template>
|
||||||
</template>
|
<template v-else-if="column.key === 'isUsing'">
|
||||||
</el-table-column>
|
<el-tag :type="d.row.isUsing ? 'success' : 'danger'">{{d.row.isUsing ? '是' : '否'}}</el-tag>
|
||||||
<el-table-column label="收费模式" align="center">
|
</template>
|
||||||
<template slot-scope="d">
|
<template v-else-if="['money', 'serviceCharge', 'channelCost', 'arrivalAmount'].includes(column.key)">
|
||||||
<dict-tag :value="d.row.suitFeeMode" :options="dict.type.suit_fee_mode"/>
|
{{d.row.money | money | defaultValue}} 元
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
<template v-else>
|
||||||
<el-table-column label="收费方式" align="center">
|
{{d.row[column.key] | defaultValue}}
|
||||||
<template slot-scope="d">
|
</template>
|
||||||
<dict-tag :value="d.row.suitFeeType" :options="dict.type.suit_fee_type"/>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="交易状态" align="center">
|
|
||||||
<template slot-scope="d">
|
|
||||||
<dict-tag :value="d.row.status" :options="dict.type.sm_transaction_bill_status"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="使用中" align="center">
|
|
||||||
<template slot-scope="d">
|
|
||||||
<el-tag :type="d.row.isUsing ? 'success' : 'danger'">{{d.row.isUsing ? '是' : '否'}}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="200">
|
<el-table-column label="操作" align="center" fixed="right" width="200">
|
||||||
<template slot-scope="d">
|
<template slot-scope="d">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -171,18 +161,26 @@
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-s-promotion"
|
||||||
@click="rechargeDevice(d.row.billId)"
|
@click="rechargeDevice(d.row.billId)"
|
||||||
v-if="canRechargeDevice(d.row)"
|
v-if="canRechargeDevice(d.row)"
|
||||||
>手动设备充值</el-button>
|
>手动设备充值</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-bank-card"
|
||||||
@click="handleRefund(d.row)"
|
@click="handleRefund(d.row)"
|
||||||
v-has-permi="['system:bill:refund']"
|
v-has-permi="['system:bill:refund']"
|
||||||
v-show="canRefund(d.row)"
|
v-show="canRefund(d.row)"
|
||||||
>订单退款</el-button>
|
>订单退款</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-document-delete"
|
||||||
|
@click="handleClose(d.row)"
|
||||||
|
v-has-permi="['system:bill:close']"
|
||||||
|
v-show="canClose(d.row)"
|
||||||
|
>结束订单</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -231,19 +229,47 @@ import {
|
||||||
updateBill,
|
updateBill,
|
||||||
refreshPayResult,
|
refreshPayResult,
|
||||||
rechargeDevice,
|
rechargeDevice,
|
||||||
refundBill
|
refundBill, closeBill
|
||||||
} from '@/api/system/recharge'
|
} from '@/api/system/recharge'
|
||||||
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
||||||
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
|
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
|
||||||
import RechargeLink from '@/components/Business/Transaction/RechargeLink.vue'
|
import RechargeLink from '@/components/Business/Transaction/RechargeLink.vue'
|
||||||
import { SuitFeeType } from '@/utils/constants'
|
import { RechargeStatus, SuitFeeType } from '@/utils/constants'
|
||||||
|
import { $showColumns } from '@/utils/mixins'
|
||||||
|
|
||||||
|
// 默认排序字段
|
||||||
|
const defaultSort = {
|
||||||
|
prop: "createTime",
|
||||||
|
order: "descending"
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Bill",
|
name: "Bill",
|
||||||
|
mixins: [$showColumns],
|
||||||
components: { RechargeLink, DeviceLink, UserLink },
|
components: { RechargeLink, DeviceLink, UserLink },
|
||||||
dicts: ['channel_type','sm_transaction_bill_status', 'sm_transaction_bill_device_recharge_status', 'suit_fee_mode', 'suit_fee_type'],
|
dicts: ['channel_type','sm_transaction_bill_status', 'sm_transaction_bill_device_recharge_status', 'suit_fee_mode', 'suit_fee_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
defaultSort,
|
||||||
|
// 排序方式
|
||||||
|
orderSorts: ['ascending', 'descending', null],
|
||||||
|
// 字段列表
|
||||||
|
columns: [
|
||||||
|
{key: 'billId', visible: false, label: '订单ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||||
|
{key: 'createTime', visible: true, label: '时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||||
|
{key: 'billNo', visible: true, label: '订单编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||||
|
{key: 'userName', visible: true, label: '充值用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'deviceName', visible: true, label: '设备名称/SN', minWidth: null, sortable: true, overflow: false, align: 'center', width: "120"},
|
||||||
|
{key: 'mchName', visible: true, label: '商户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'money', visible: true, label: '交易金额', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'arrivalAmount', visible: true, label: '到账金额', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'serviceCharge', visible: true, label: '手续费', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'channelCost', visible: true, label: '成本', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'suitFeeMode', visible: true, label: '收费模式', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'suitFeeType', visible: true, label: '收费方式', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'status', visible: true, label: '交易状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
{key: 'isUsing', visible: true, label: '使用中', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||||
|
],
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
|
@ -266,6 +292,8 @@ export default {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
orderByColumn: defaultSort.prop,
|
||||||
|
isAsc: defaultSort.order,
|
||||||
userName: null,
|
userName: null,
|
||||||
deviceName: null,
|
deviceName: null,
|
||||||
landlordName: null,
|
landlordName: null,
|
||||||
|
@ -301,12 +329,43 @@ export default {
|
||||||
return (row) => {
|
return (row) => {
|
||||||
return row.status === '2';
|
return row.status === '2';
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
canClose() {
|
||||||
|
return (row) => {
|
||||||
|
return [RechargeStatus.PAY_SUCCESS, RechargeStatus.DEPOSIT_SUCCESS].includes(row.status) && !row.isFinished;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 结束订单
|
||||||
|
handleClose(row) {
|
||||||
|
this.$confirm(`确定结束订单【${row.billNo}】吗?`, {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
closeBill({billId: row.billId, totalEle: null}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message.success("操作成功");
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 当排序按钮被点击时触发 **/
|
||||||
|
onSortChange(column) {
|
||||||
|
if (column.order == null) {
|
||||||
|
this.queryParams.orderByColumn = defaultSort.prop;
|
||||||
|
this.queryParams.isAsc = defaultSort.order;
|
||||||
|
} else {
|
||||||
|
this.queryParams.orderByColumn = column.prop;
|
||||||
|
this.queryParams.isAsc = column.order;
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
submitRefund() {
|
submitRefund() {
|
||||||
this.refundLoading = true;
|
this.refundLoading = true;
|
||||||
refundBill(this.refundForm.billId, this.refundForm.refundAmount).then(res => {
|
refundBill(this.refundForm.billId, this.refundForm.refundAmount).then(res => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user