From 4d0a9085ac8e5883c5c2dd72a26112109871c425 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com>
Date: Fri, 6 Sep 2024 16:16:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=94=B5=E9=87=8F=E5=BD=92?=
=?UTF-8?q?=E9=9B=B6=E3=80=81=E7=BB=93=E6=9D=9F=E8=AE=A2=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/recharge.js | 10 ++
src/utils/constants.js | 13 ++
src/views/system/recharge/index.vue | 189 ++++++++++++++++++----------
3 files changed, 147 insertions(+), 65 deletions(-)
diff --git a/src/api/system/recharge.js b/src/api/system/recharge.js
index e9509f6..9da4992 100644
--- a/src/api/system/recharge.js
+++ b/src/api/system/recharge.js
@@ -79,3 +79,13 @@ export function refundBill(billId, refundAmount) {
}
})
}
+
+
+// 关闭订单
+export function closeBill(data) {
+ return request({
+ url: `/system/bill/close`,
+ method: 'put',
+ data
+ })
+}
diff --git a/src/utils/constants.js b/src/utils/constants.js
index bb60b8b..b703d33 100644
--- a/src/utils/constants.js
+++ b/src/utils/constants.js
@@ -110,3 +110,16 @@ export const PayBillStatus = {
REFUNDING: "5", // 退款中
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", // 押金已支付
+}
diff --git a/src/views/system/recharge/index.vue b/src/views/system/recharge/index.vue
index 7b869a8..4a8026b 100644
--- a/src/views/system/recharge/index.vue
+++ b/src/views/system/recharge/index.vue
@@ -88,70 +88,60 @@
v-hasPermi="['system:bill:export']"
>导出
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{d.row.money | money}} 元
-
-
-
-
- {{d.row.arrivalAmount | money}} 元
-
-
-
-
- {{d.row.serviceCharge | money | defaultValue}} 元
-
-
-
-
- {{d.row.channelCost | money}} 元
-
-
-
-
- {{d.row.serviceCharge - d.row.channelCost | money}} 元
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{d.row.isUsing ? '是' : '否'}}
-
-
+
+
+
+
+ {{d.row[column.key]}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{d.row.isUsing ? '是' : '否'}}
+
+
+ {{d.row.money | money | defaultValue}} 元
+
+
+ {{d.row[column.key] | defaultValue}}
+
+
+
+
手动设备充值
订单退款
+ 结束订单
@@ -231,19 +229,47 @@ import {
updateBill,
refreshPayResult,
rechargeDevice,
- refundBill
+ refundBill, closeBill
} from '@/api/system/recharge'
import UserLink from '@/components/Business/SmUser/UserLink.vue'
import DeviceLink from '@/components/Business/Device/DeviceLink.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 {
name: "Bill",
+ mixins: [$showColumns],
components: { RechargeLink, DeviceLink, UserLink },
dicts: ['channel_type','sm_transaction_bill_status', 'sm_transaction_bill_device_recharge_status', 'suit_fee_mode', 'suit_fee_type'],
data() {
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,
// 选中数组
@@ -266,6 +292,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
+ orderByColumn: defaultSort.prop,
+ isAsc: defaultSort.order,
userName: null,
deviceName: null,
landlordName: null,
@@ -301,12 +329,43 @@ export default {
return (row) => {
return row.status === '2';
}
+ },
+ canClose() {
+ return (row) => {
+ return [RechargeStatus.PAY_SUCCESS, RechargeStatus.DEPOSIT_SUCCESS].includes(row.status) && !row.isFinished;
+ }
}
},
created() {
this.getList();
},
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() {
this.refundLoading = true;
refundBill(this.refundForm.billId, this.refundForm.refundAmount).then(res => {