From 6325ddbbfc70848a200f02eac4a1d5e773871451 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Mon, 17 Jun 2024 18:21:01 +0800 Subject: [PATCH] add tid 1523 refund logic --- src/store/index.js | 3 +- src/subpackage/order/js/api.js | 1 + .../order/pages/retail/detail/detail.vue | 397 +++++++++++---------- .../order/pages/ym_card/detail/detail.vue | 87 ++++- 4 files changed, 300 insertions(+), 188 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 36a4a95..38ef2f5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -44,7 +44,8 @@ export default new Vuex.Store({ '1014': '储值卡管理', '1015': '进场人数异常', '1016': '系统工具', - '1017': '钱包提现' + '1017': '钱包提现', + '1018': '退款权限' }, // 场地占用提交页面信息 occupyInfo: { diff --git a/src/subpackage/order/js/api.js b/src/subpackage/order/js/api.js index fc16176..40d6591 100644 --- a/src/subpackage/order/js/api.js +++ b/src/subpackage/order/js/api.js @@ -41,6 +41,7 @@ export const ORDER_API = { timeOrderDetail:`${ORIGIN}/admin/assistant/timeOrder/detail`, //k-订单管理-计时订单详情 timeOrderComplete:`${ORIGIN}/admin/assistant/timeOrder/complete`, //【20220208】k-订单管理-计时订单完结 orderRefund:`${ORIGIN}/admin/stadium/order/refund`, // A订单管理-场馆预订订单-订单退款 + userMonthlyCardRefundFixed:`${ORIGIN}/admin/userMonthlyCard/refundFixed`, // 年月卡订单-订单退款 } export default ORDER_API; \ No newline at end of file diff --git a/src/subpackage/order/pages/retail/detail/detail.vue b/src/subpackage/order/pages/retail/detail/detail.vue index 7860259..f853c78 100644 --- a/src/subpackage/order/pages/retail/detail/detail.vue +++ b/src/subpackage/order/pages/retail/detail/detail.vue @@ -2,36 +2,36 @@ - - {{ orderInfo.stadium_name || '-' }} - - - - - - 微信昵称: - {{ orderInfo.nickname || '-' }} - - {{ getStatus(orderInfo.pay_status) }} - - - - 手机号码: - {{ orderInfo.mobile || '-' }} - - - - - - 下单途径: - {{ orderInfo.retail_source || '-' }} - - + + {{ orderInfo.stadium_name || '-' }} + + + + + + 微信昵称: + {{ orderInfo.nickname || '-' }} + + {{ getStatus(orderInfo.pay_status) }} + + + + 手机号码: + {{ orderInfo.mobile || '-' }} + + + + + + 下单途径: + {{ orderInfo.retail_source || '-' }} + + @@ -39,37 +39,37 @@ - {{ e.erp_retail_goods ? (e.erp_retail_goods.goods_name || '-') : (e.name || '-') }} - ¥{{ e.price || 0 }} - - sku:{{ e.erp_retail_goods ? (e.erp_retail_goods.erp_goods ? e.erp_retail_goods.erp_goods.erp_goods_sku : '-') : '-' }} - - 型号:{{ e.erp_retail_goods ? (e.erp_retail_goods.erp_goods ? e.erp_retail_goods.erp_goods.erp_goods_type : '-') : '-' }}        规格:{{ e.spec || '-' }} - x{{ e.nums || 0 }} - - + {{ e.erp_retail_goods ? (e.erp_retail_goods.goods_name || '-') : (e.name || '-') }} + ¥{{ e.price || 0 }} + + sku:{{ e.erp_retail_goods ? (e.erp_retail_goods.erp_goods ? e.erp_retail_goods.erp_goods.erp_goods_sku : '-') : '-' }} + + 型号:{{ e.erp_retail_goods ? (e.erp_retail_goods.erp_goods ? e.erp_retail_goods.erp_goods.erp_goods_type : '-') : '-' }}        规格:{{ e.spec || '-' }} + x{{ e.nums || 0 }} + + - - - 金额小计 - ¥{{ orderInfo.amount || 0 }} - - - 积分抵扣 - ¥{{ orderInfo.deduction_amount || 0 }} - - - 折扣金额 - -¥{{ orderInfo.discount_amount || 0 }} - - - 优惠券优惠 - -¥{{ orderInfo.coupons_amount || 0 }} - - 合计支付:¥{{ orderInfo.pay_amount || 0 }} + + + 金额小计 + ¥{{ orderInfo.amount || 0 }} + + + 积分抵扣 + ¥{{ orderInfo.deduction_amount || 0 }} + + + 折扣金额 + -¥{{ orderInfo.discount_amount || 0 }} + + 优惠券优惠 + -¥{{ orderInfo.coupons_amount || 0 }} + + 合计支付:¥{{ orderInfo.pay_amount || 0 }} + 支付详情 @@ -78,33 +78,44 @@ - - - - - 退款信息{{ index + 1 }} - - - - - - + + + + + 退款信息{{ index + 1 }} + + + + + + + + + + @@ -114,16 +125,20 @@ import server from '../../../js/server'; import util from '../../../../../utils/util'; import s_line from '../../../components/s_line/s_line.vue'; import p_line from '../../../components/p_line/p_line.vue'; +import orderRefundFixed from '@/components/order_refund/fixed.vue' +import orderRefundModal from '@/components/order_refund/modal.vue'; import { mapState } from 'vuex'; export default { components: { 's-line': s_line, 'p-line': p_line, + 'order-refund-fixed': orderRefundFixed, + 'order-refund-modal': orderRefundModal, }, data(){ return { orderInfo: {}, - refundList: [] + refundList: [] } }, computed:{ @@ -133,17 +148,35 @@ export default { this.getOrderInfo(options.order_no); }, methods: { + refunndBtn(){ + let { orderInfo, refundList } = this; + this.$refs.orderRefundModal.show({ + stadium_name: orderInfo?.refundList ?? '', + order_no: orderInfo?.order_no ?? '', + mobile: orderInfo?.refundList ?? '', + refundable_amount: orderInfo?.extension?.refundable_amount ?? 0, + refundable_integral: orderInfo?.extension?.refundable_integral ?? 0, + refund_times: refundList?.length || 0, + confirm: e => { + // this.venueCourseOrderRefund({ + // order_no: orderInfo?.order_no ?? '', + // amount: e.refund_amount || 0, + // integral: e.refund_integral || 0 + // }) + } + }); + }, // payTypeTxt: util.order_pay_type_txt, - payTypeTxt(payType, cardNo) { - let _obj = { - 0: '微信支付', - 1: '支付宝支付', - 2: `储值卡支付 ${cardNo ? '(' + cardNo + ')' : ''}`, - 3: '现金支付', - 4: '其他' - }; - return _obj[payType] || '-' - }, + payTypeTxt(payType, cardNo) { + let _obj = { + 0: '微信支付', + 1: '支付宝支付', + 2: `储值卡支付 ${cardNo ? '(' + cardNo + ')' : ''}`, + 3: '现金支付', + 4: '其他' + }; + return _obj[payType] || '-' + }, getStatus(status){ let _obj = { 1: '交易成功', @@ -160,19 +193,19 @@ export default { }) .then(res=>{ this.orderInfo = res || {}; - // this.orderInfo.refunds = [ - // { refund_amount: this.orderInfo.refund_amount, refund_no: this.orderInfo.refund_no, refund_time: this.orderInfo.refund_time, refund_reason: this.orderInfo.refund_reason }, - // { refund_amount: this.orderInfo.refund_amount, refund_no: this.orderInfo.refund_no, refund_time: this.orderInfo.refund_time, refund_reason: this.orderInfo.refund_reason } - // ]; - server.get({ - url: ORDER_API.retailOrderInfoRefundList, - data: { order_no, brand_id: this.brandInfo.brand.id }, - failMsg: '加载失败!' - }) - .then(res=>{ - util.hideLoad(); - this.refundList = res.list; - }); + // this.orderInfo.refunds = [ + // { refund_amount: this.orderInfo.refund_amount, refund_no: this.orderInfo.refund_no, refund_time: this.orderInfo.refund_time, refund_reason: this.orderInfo.refund_reason }, + // { refund_amount: this.orderInfo.refund_amount, refund_no: this.orderInfo.refund_no, refund_time: this.orderInfo.refund_time, refund_reason: this.orderInfo.refund_reason } + // ]; + server.get({ + url: ORDER_API.retailOrderInfoRefundList, + data: { order_no, brand_id: this.brandInfo.brand.id }, + failMsg: '加载失败!' + }) + .then(res=>{ + util.hideLoad(); + this.refundList = res?.list || []; + }); }); }, @@ -189,57 +222,57 @@ export default { margin-bottom: 26upx; padding: 0 24upx; background-color: #fff; - .ra-header { - position: relative; - padding: 30upx 0; - @include centerFlex(flex-start); - >image { - width: 32upx; - height: 30upx; - margin-right: 14upx; - } - >text { - font-size: 28upx; - font-weight: 500; - color: #1A1A1A; + .ra-header { + position: relative; + padding: 30upx 0; + @include centerFlex(flex-start); + >image { + width: 32upx; + height: 30upx; + margin-right: 14upx; + } + >text { + font-size: 28upx; + font-weight: 500; + color: #1A1A1A; + } + >view { + position: absolute; + bottom: 0%; + width: 100%; + height: 2upx; + background-color: #D8D8D8; + } + } + .rh-name{ + padding: 18upx 0; + .rh-name-line { + @include centerFlex(space-between); + font-size: 28upx; + font-weight: 400; + margin-bottom: 10upx; + + >view { + &:first-child { + color: #9C9C9F; + @include centerFlex(flex-start); + flex-grow: 1; + + >view { + width: 152upx; + flex-shrink: 0; + } + >text { + color: #1A1A1A; + @include textHide(1); + } } - >view { - position: absolute; - bottom: 0%; - width: 100%; - height: 2upx; - background-color: #D8D8D8; + + &:nth-child(2) { + flex-shrink: 0; } } - .rh-name{ - padding: 18upx 0; - .rh-name-line { - @include centerFlex(space-between); - font-size: 28upx; - font-weight: 400; - margin-bottom: 10upx; - - >view { - &:first-child { - color: #9C9C9F; - @include centerFlex(flex-start); - flex-grow: 1; - - >view { - width: 152upx; - flex-shrink: 0; - } - >text { - color: #1A1A1A; - @include textHide(1); - } - } - - &:nth-child(2) { - flex-shrink: 0; - } - } - } + } } } .rc-goods-info{ @@ -256,32 +289,32 @@ export default { .rgl-item{ padding-top: 30upx; // border-bottom: 2upx solid #D8D8D8; - color: #9C9C9F; - font-size: 28upx; - - .rgl-item-desc { - display: flex; - justify-content: space-between; - margin-bottom: 20upx; - color: #1A1A1A; - } - .rgl-item-sku { - margin-bottom: 10upx; - } - .rgl-item-type-spec { - display: flex; - justify-content: space-between; - align-items: flex-end; - >text { - color: #1A1A1A; - } - } - .rgl-item-bottom-line { - width: 100%; - height: 2upx; - background-color: #D8D8D8; - margin-top: 18upx; - } + color: #9C9C9F; + font-size: 28upx; + + .rgl-item-desc { + display: flex; + justify-content: space-between; + margin-bottom: 20upx; + color: #1A1A1A; + } + .rgl-item-sku { + margin-bottom: 10upx; + } + .rgl-item-type-spec { + display: flex; + justify-content: space-between; + align-items: flex-end; + >text { + color: #1A1A1A; + } + } + .rgl-item-bottom-line { + width: 100%; + height: 2upx; + background-color: #D8D8D8; + margin-top: 18upx; + } } } } diff --git a/src/subpackage/order/pages/ym_card/detail/detail.vue b/src/subpackage/order/pages/ym_card/detail/detail.vue index 13ffcbe..edbb76e 100644 --- a/src/subpackage/order/pages/ym_card/detail/detail.vue +++ b/src/subpackage/order/pages/ym_card/detail/detail.vue @@ -54,6 +54,17 @@ + + + + @@ -67,6 +78,8 @@ import a_line from '../../../../../components/order_list/a_line/a_line.vue'; import s_line from '../../../components/s_line/s_line.vue'; import p_line from '../../../components/p_line/p_line.vue'; +import orderRefundFixed from '@/components/order_refund/fixed.vue' +import orderRefundModal from '@/components/order_refund/modal.vue'; import util from '../../../../../utils/util'; import { ORDER_API } from '../../../js/api'; import server from '../../../js/server'; @@ -75,7 +88,13 @@ export default { 'a-line': a_line, 's-line': s_line, 'p-line': p_line, - + 'order-refund-fixed': orderRefundFixed, + 'order-refund-modal': orderRefundModal, + }, + computed: { + _extension(){ + return this.orderInfo?.extension || {} + } }, data(){ return { @@ -84,16 +103,70 @@ export default { extension: {} }, optionsQuery: {}, + refundInfo: {} } }, onLoad(options){ this.getCardInfo({ id: options.id, card_no: options.card_no - }); - this.optionsQuery = options || {}; + }) + .then(res=>{ + if(res.order_no)this.getRefundInfo(res.order_no || ''); + }) + }, methods: { + refunndBtn(){ + let { orderInfo, _extension } = this; + this.$refs.orderRefundModal.show({ + stadium_name: _extension?.name ?? '', + order_no: orderInfo?.order_no ?? '', + mobile: orderInfo?.mobile ?? '', + refundable_amount: +_extension?.pay_amount || 0, + refundable_integral: 0, + refund_times: 0, + confirm: e => { + this.userMonthlyCardRefundFixed({ + order_no: orderInfo?.order_no || '', + amount: e.refund_amount || 0, + integral: e.refund_integral || 0 + }); + } + }); + }, + async getRefundInfo(order_no){ + try{ + let _refundRes = await this.$store.dispatch('getOrderRefundList', order_no); + + console.log('refundRes', _refundRes); + }catch(err){ + console.warn('getRefundTimes err', err); + } + }, + // 年月卡订单-订单退款 + userMonthlyCardRefundFixed({ order_no = '', amount = 0, integral = 0 }){ + util.showLoad(); + server.get({ + url: ORDER_API.userMonthlyCardRefundFixed, + data: { order_no, amount, integral }, + isDefaultGet: false + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showNone(res.data.message || '操作成功!'); + }else{ + util.showNone(res.data.message || '操作失败!'); + } + }) + .catch(util.hideLoad) + .finally(_=>setTimeout(_=>this.getCardInfo({ + id: this.optionsQuery?.id, + card_no: this.optionsQuery?.card_no + + }), 1200)); + }, previewImg(url){ if(!url)return uni.previewImage({ urls: [ url ] }); @@ -166,14 +239,18 @@ export default { }, getCardInfo({id, card_no}){ util.showLoad(); - server.get({ + return server.get({ url: ORDER_API.userMonthlyCardInfo, data: { id, card_no }, failMsg: '加载失败!' }) .then(res=>{ util.hideLoad(); - this.orderInfo = res || {}; + return this.orderInfo = res || {}; + }) + .catch(err=>{ + util.hideLoad(); + console.warn('getCardInfo err', err); }) }, toRecord(){