From aa9f54f4c4036d7edb49e024f31a851f805476f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Mon, 7 Oct 2024 16:06:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=95=86=E6=B8=A0=E9=81=93?= =?UTF-8?q?=E6=88=90=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/recharge.js | 9 ++++ src/utils/constants.js | 13 +++++ src/views/system/dept/index.vue | 14 ++++-- src/views/system/recharge/detail.vue | 29 ++++++++++-- src/views/system/recharge/index.vue | 71 ++++++++++++++++------------ 5 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/api/system/recharge.js b/src/api/system/recharge.js index e9509f6..cec19e9 100644 --- a/src/api/system/recharge.js +++ b/src/api/system/recharge.js @@ -79,3 +79,12 @@ 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 775744b..c47c598 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -154,3 +154,16 @@ export const BonusArrivalType = { return [this.COMPANY, this.PLATFORM] } } + +// 充值订单状态 +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/dept/index.vue b/src/views/system/dept/index.vue index 8ddf9c9..67617f8 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -60,6 +60,9 @@ + + + @@ -116,14 +119,15 @@ + + + % - - - - - + + % + diff --git a/src/views/system/recharge/detail.vue b/src/views/system/recharge/detail.vue index 46b7cc1..2acb6e5 100644 --- a/src/views/system/recharge/detail.vue +++ b/src/views/system/recharge/detail.vue @@ -3,15 +3,30 @@ - + {{detail.billNo | defaultValue}} - {{detail.money | money | defaultValue}} 元 - - + + {{detail.money | money | defaultValue}} 元 + + + {{detail.deptChannelCost | money | defaultValue}} 元 + + + + {{detail.channelCost | money | defaultValue}} 元 + + + + + + + + + @@ -40,6 +55,7 @@ + {{detail.suitName | defaultValue}} @@ -102,19 +118,21 @@ import Refund from '@/views/ss/refund/index.vue' import { findLabel } from '@/utils' import DeviceLink from '@/components/Business/Device/DeviceLink.vue' import UserLink from '@/components/Business/SmUser/UserLink.vue' -import { BonusArrivalType, FieldName, SuitFeeType, views } from '@/utils/constants' +import { BonusArrivalType, FieldName, ROOT_DEPT, SuitFeeType, views } from '@/utils/constants' import PayBill from '@/views/ss/payBill/index.vue' import StoreLink from '@/components/Business/Store/StoreLink.vue' import Bonus from '@/views/ss/bonus/index.vue' import { checkPermi } from '@/utils/permission' import { listBonusByBill } from '@/api/ss/bonus' import LineField from '@/components/LineField/index.vue' +import { mapGetters } from 'vuex' export default { name: 'RechargeDetail', components: { LineField, Bonus, StoreLink, PayBill, UserLink, DeviceLink, Refund }, dicts: ['channel_type','sm_transaction_bill_status', 'sm_transaction_bill_device_recharge_status', 'time_unit', 'suit_fee_mode', 'suit_fee_type', 'bonus_status', 'bonus_arrival_type'], computed: { + ...mapGetters(['deptId']), BonusArrivalType() { return BonusArrivalType }, @@ -136,6 +154,7 @@ export default { }, data() { return { + ROOT_DEPT, loading: false, detail: {}, bonusList: [], // 分成列表 diff --git a/src/views/system/recharge/index.vue b/src/views/system/recharge/index.vue index f1fba6a..25746c6 100644 --- a/src/views/system/recharge/index.vue +++ b/src/views/system/recharge/index.vue @@ -106,39 +106,19 @@ - - - - - - - - - - + + + - - - - - - - - - - - - - - - @@ -230,12 +218,12 @@ 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 { FieldName, ROOT_DEPT, SuitFeeType } from '@/utils/constants' +import { FieldName, RechargeStatus, ROOT_DEPT, SuitFeeType } from '@/utils/constants' import { $view } from '@/utils/mixins' import StoreLink from '@/components/Business/Store/StoreLink.vue' import { mapGetters } from 'vuex' @@ -316,9 +304,15 @@ export default { }, canRefund() { return (row) => { - return row.status === '2'; + return row.status === '2' && row.isFinished; } - } + }, + canClose() { + return (row) => { + // (支付成功或者押金支付成功) 且 订单未完成 + return [RechargeStatus.PAY_SUCCESS, RechargeStatus.DEPOSIT_SUCCESS].includes(row.status) && !row.isFinished; + } + }, }, created() { this.queryParams = { @@ -350,6 +344,21 @@ export default { } this.showRefund = true; }, + // 结束订单 + 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(); + } + }) + }) + }, rechargeDevice(id) { rechargeDevice(id).then(res => { if (res.code === 200) {