Browse Source

add tid1523 refund permission condition

tid1731
刘嘉炜 11 months ago
parent
commit
d176480e40
  1. 11
      src/components/order_refund/fixed.vue
  2. 13
      src/components/order_refund/modal.vue
  3. 215
      src/components/order_refund_modal/index.vue
  4. 1
      src/subpackage/device/components/order/reservation_site_detail/reservation_site_detail.vue
  5. 125
      src/subpackage/device/pages/order_details/order_details.vue
  6. 2
      src/subpackage/order/js/api.js
  7. 50
      src/subpackage/order/pages/retail/detail/detail.vue

11
src/components/order_refund/fixed.vue

@ -9,6 +9,7 @@
<script> <script>
import fixedBar from "../fixed_bar/fixed_bar.vue"; import fixedBar from "../fixed_bar/fixed_bar.vue";
import orButton from "./button.vue"; import orButton from "./button.vue";
import { mapState } from 'vuex';
/** /**
* 全部订单都能退两次, 所有订单最多只能退2次款 * 全部订单都能退两次, 所有订单最多只能退2次款
* 只要订单金额是未全退的都能退 * 只要订单金额是未全退的都能退
@ -22,6 +23,7 @@ export default {
}, },
props: [ 'pay_amount', 'refund_amount', 'refund_times' ], props: [ 'pay_amount', 'refund_amount', 'refund_times' ],
computed: { computed: {
...mapState([ 'brandInfo' ]),
payAmount(){ payAmount(){
let { pay_amount } = this; let { pay_amount } = this;
return +pay_amount || 0 return +pay_amount || 0
@ -31,8 +33,13 @@ export default {
return +refund_amount || 0 return +refund_amount || 0
}, },
isShow(){ isShow(){
let { payAmount, refundAmount, refund_times } = this;
if(payAmount - refundAmount > 0 && [0, 1].includes(refund_times)){
console.log('brandInfo', this.brandInfo)
let { payAmount, refundAmount, refund_times, brandInfo } = this;
if(
payAmount - refundAmount > 0
&&[0, 1].includes(refund_times)
&&brandInfo?.permission?.['1018'] // 退
){
return true return true
} }
return false return false

13
src/components/order_refund/modal.vue

@ -64,7 +64,12 @@
* 0元订单不能退 * 0元订单不能退
* *
*/ */
import { mapState } from 'vuex';
import { showModal } from '@/utils/util';
export default { export default {
computed: {
...mapState([ 'brandInfo' ])
},
data() { data() {
return { return {
isShow: false, isShow: false,
@ -88,8 +93,16 @@ export default {
}, },
methods: { methods: {
show(initData){ show(initData){
let { brandInfo } = this;
if(brandInfo?.permission?.['1018']){
this.isShow = true; this.isShow = true;
this.init(initData); this.init(initData);
}else{
showModal({
content: '您没有退款权限',
})
}
}, },
init(data){ init(data){
this.iptInfo.refund_amount = data?.refundable_amount || '0'; this.iptInfo.refund_amount = data?.refundable_amount || '0';

215
src/components/order_refund_modal/index.vue

@ -1,215 +0,0 @@
<template>
<view class="order-refund-modal">
<view class="orm-mask" v-show="isShow">
<view class="om-content">
<image class="oc-close" mode="aspectFit" src="../../static/images/icon/x_close.png" @click="hide"></image>
<view class="oc-title">退款</view>
<view class="oc-section">
<view class="os-info">
<view class="oi-name">{{ refundInfo.stadium_name || '' }}</view>
<view class="oi-line">订单编号{{ refundInfo.order_no || '' }}</view>
<view class="oi-line">手机号码{{ refundInfo.mobile || '' }}</view>
<view class="os-ipts">
<view class="oi-item">
<view class="oi-name">
<text class="on-txt">*</text>
退款金额
</view>
<view class="oi-right">
<input
class="or-ipt"
type="number"
v-model="iptInfo.refund_amount"
:disabled="refundInfo.refund_times > 0"
:class="{ 'or-disabled': refundInfo.refund_times > 0 }"
/>
<view class="or-tip">可退{{ refundInfo.refundable_amount || 0 }}</view>
</view>
</view>
<view class="oi-item">
<view class="oi-name">
<text class="on-txt">*</text>
退款积分
</view>
<view class="oi-right">
<input
class="or-ipt" type="number"
v-model="iptInfo.refund_integral"
:disabled="refundInfo.refund_times > 0"
:class="{ 'or-disabled': refundInfo.refund_times > 0 }"
/>
<view class="or-tip">可退{{ refundInfo.refundable_integral || 0 }}积分</view>
</view>
</view>
</view>
</view>
</view>
<view class="oc-btns">
<view class="ob-item" @click="cancelBtn">取消</view>
<view class="ob-item" @click="confirmBtn">确认</view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* 全部订单都能退两次, 所有订单最多只能退2次款
* 只要订单金额是未全退的都能退
* 0元订单不能退
*
*/
export default {
data() {
return {
isShow: false,
refundInfo: {
/**
* @param {String} stadium_name 店铺名称
* @param {String} order_no 订单编号
* @param {String} mobile 手机号码
* @param {String} refundable_amount 退款金额
* @param {String} refundable_integral 退款积分
* @param {Number} refund_times 退款次数
* @param {Function} cancel 取消回调
* @param {Function} confirm 确认回调
*/
},
iptInfo: {
refund_amount: '',
refund_integral: ''
}
}
},
methods: {
show(initData){
this.isShow = true;
this.init(initData);
},
init(data){
this.iptInfo.refund_amount = data?.refundable_amount || '0';
this.iptInfo.refund_integral = data?.refundable_integral || '0';
this.refundInfo = data;
},
hide(){
this.isShow = false;
},
cancelBtn() {
this.hide();
this.$emit('click:cancel');
this.refundInfo?.cancel?.(0);
},
confirmBtn() {
let { iptInfo, refundInfo } = this;
this.$emit('click:confirm');
this.refundInfo?.confirm?.(iptInfo);
}
}
}
</script>
<style lang="scss">
.order-refund-modal{}
.orm-mask{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,.5);
z-index: 10;
}
.om-content{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding-bottom: 80upx;
width: 620upx;
border-radius: 10px;
background: #fff;
.oc-close{
position: absolute;
top: 30upx;
right: 30upx;
width: 34upx;
height: 34upx;
}
.oc-title{
padding-top: 78upx;
text-align: center;
@include flcw(32upx, 44upx, #333, 500);
}
.oc-section{
padding: 30upx 30upx 0;
@include ctf(center);
.os-info{
.oi-name{
@include flcw(28upx, 48upx, #333);
}
.oi-line{
@include flcw(28upx, 48upx, #9C9C9F);
}
.os-ipts{
padding-top: 34upx;
.oi-item{
display: flex;
align-items: flex-start;
.oi-name{
@include flcw(28upx, 56upx, #333333);
.on-txt{
color: #EA5061;
}
}
.oi-right{
margin-left: 16upx;
flex-shrink: 0;
width: 312upx;
.or-ipt{
display: block;
box-sizing: border-box;
padding: 0 20upx;
width: 100%;
height: 56upx;
border-radius: 10upx;
border: 2upx solid #D8D8D8;
@include flcw(28upx, 48upx, #9C9C9F);
&.or-disabled{
background: #cecece;
color: #9C9C9F;
}
}
.or-tip{
padding-left: 8upx;
@include flcw(24upx, 48upx, #EA5061);
@include tHide;
}
}
}
}
}
}
.oc-btns{
margin-top: 32upx;
padding: 0 54upx;
@include ctf(space-between);
.ob-item{
width: 240upx;
height: 88upx;
text-align: center;
border: 2upx solid $mColor;
border-radius: 10upx;
@include flcw(32upx, 84upx, $mColor, 500);
&+.ob-item{
background: $mColor;
color: #fff;
}
}
}
}
</style>

1
src/subpackage/device/components/order/reservation_site_detail/reservation_site_detail.vue

@ -198,7 +198,6 @@ export default {
return _obj[`${_status}`] || '-' return _obj[`${_status}`] || '-'
}, },
refunndBtn(){ refunndBtn(){
// this.$emit('refundbtn');
this.$emit('click:refund'); this.$emit('click:refund');
} }
} }

125
src/subpackage/device/pages/order_details/order_details.vue

@ -5,7 +5,6 @@
<reservation-site-detail <reservation-site-detail
v-if="pageInfo.order_type == 0" v-if="pageInfo.order_type == 0"
:orderInfo="pageInfo" :orderInfo="pageInfo"
@refundbtn='refundBtn'
@click:refund="siteAndPeopleDetailRefund" @click:refund="siteAndPeopleDetailRefund"
></reservation-site-detail> ></reservation-site-detail>
<reservation-people-detail <reservation-people-detail
@ -19,25 +18,7 @@
</block> </block>
<organize-detail :orderInfo="pageInfo" v-if="optionsQuery.order_type==10"></organize-detail> <organize-detail :orderInfo="pageInfo" v-if="optionsQuery.order_type==10"></organize-detail>
<!-- 次卡订场退款弹窗 -->
<view class="refund-mask" v-if="isOrderRefund" @click="isOrderRefund = false">
<view class="rm-content" @click.stop="_=>false">
<view class="rc-tit">退款</view>
<view class="rc-info">
<view class="ri-view">{{ pageInfo.stadium_name || '-' }}</view>
<view class="ri-view">订单编号{{ pageInfo.order_no || '-' }}</view>
<view class="ri-view">手机号码{{ pageInfo.mobile || '-' }}</view>
</view>
<view class="rc-price">
<view class="rp-name"><text class="rn-txt">*</text>退款金额</view>
<view class="rp-frame">
<input class="rf-ipt" v-model="refundPrice" type="digit" placeholder="请输入金额" />
</view>
<view class="rp-tip">最多可退{{ (pageInfo.extension&&pageInfo.extension.refundable_amount) || 0 }}</view>
</view>
<view class="ri-btn" @click="confirmRefund">确认退款</view>
</view>
</view>
<!-- 次票核销弹窗 --> <!-- 次票核销弹窗 -->
<ticket-check <ticket-check
ref="ticketCheckModal" ref="ticketCheckModal"
@ -86,11 +67,6 @@
order_type: -1, order_type: -1,
}, },
pageInfo: {}, pageInfo: {},
// /退 ---
isOrderRefund: false,
refundPrice: '',
// /退 ---
} }
}, },
onLoad(options) { onLoad(options) {
@ -162,34 +138,12 @@
}, },
refreshPage(){ refreshPage(){
let { optionsQuery } = this; let { optionsQuery } = this;
this.isOrderRefund = false;
this.refundPrice = '';
this.getPageInfo({ this.getPageInfo({
orderType: optionsQuery.order_type, orderType: optionsQuery.order_type,
stadium_id: optionsQuery.stadium_id, stadium_id: optionsQuery.stadium_id,
order_no: optionsQuery.order_no, order_no: optionsQuery.order_no,
}) })
}, },
refundBtn(){
this.isOrderRefund = true;
},
confirmRefund: util.debounce(function(){
let { pageInfo, refundPrice } = this;
deviceServer.get({
url: deviceApi.orderRefund,
data: { order_no: pageInfo.order_no || '', amount: refundPrice || 0, integral: 0 }, // integral 0
isDefaultGet: false
})
.then(res=>{
if(res.data.code == 0){
util.showNone(res.data.message || '操作成功!');
setTimeout(this.refreshPage, 1200);
}else{
util.showNone(res.data.message || '操作失败!');
}
})
.catch(util.hideLoad)
}, 300, true),
// //
peopleRecoverBtn(){ peopleRecoverBtn(){
this.okChange(); // this.okChange(); //
@ -238,82 +192,5 @@
} }
.refund-mask{
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background-color: rgba($color: #000, $alpha: .5);
.rm-content{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
padding: 80upx;
background-color: #fff;
width: 620upx;
border-radius: 10upx;
.rc-tit{
margin-bottom: 30upx;
text-align: center;
font-size: 32upx;
font-weight: 500;
color: #1A1A1A;
}
.rc-info{
margin-bottom: 34upx;
.ri-view{
line-height: 40upx;
font-size: 28upx;
color: #9C9C9F;
@include textHide(1);
&:first-child{
font-weight: 500;
color: #1A1A1A;
}
}
}
.rc-price{
margin-bottom: 32upx;
.rp-name{
margin-bottom: 8upx;
font-size: 28upx;
line-height: 48upx;
color: #1A1A1A;
.rn-txt{
color: #EA5061;
}
}
.rp-frame{
padding: 0 20upx;
height: 88upx;
border-radius: 10upx;
border: 2upx solid #D8D8D8;
.rf-ipt{
width: 100%;
height: 100%;
font-size: 28upx;
color: #1A1A1A;
}
}
.rp-tip{
font-size: 24upx;
color: #EA5061;
}
}
.ri-btn{
margin: 0 auto;
width: 240upx;
line-height: 88upx;
text-align: center;
border-radius: 10upx;
font-size: 32upx;
font-weight: 500;
color: #fff;
background-color: $themeColor;
}
}
}
</style> </style>

2
src/subpackage/order/js/api.js

@ -40,7 +40,7 @@ export const ORDER_API = {
userValueCardRefundFixed:`${ORIGIN}/admin/userValueCard/refundFixed`, // 储值卡订单-退款 userValueCardRefundFixed:`${ORIGIN}/admin/userValueCard/refundFixed`, // 储值卡订单-退款
timeOrderDetail:`${ORIGIN}/admin/assistant/timeOrder/detail`, //k-订单管理-计时订单详情 timeOrderDetail:`${ORIGIN}/admin/assistant/timeOrder/detail`, //k-订单管理-计时订单详情
timeOrderComplete:`${ORIGIN}/admin/assistant/timeOrder/complete`, //【20220208】k-订单管理-计时订单完结 timeOrderComplete:`${ORIGIN}/admin/assistant/timeOrder/complete`, //【20220208】k-订单管理-计时订单完结
orderRefund:`${ORIGIN}/admin/stadium/order/refund`, // A订单管理-场馆预订订单-订单退款
orderRefund:`${ORIGIN}/admin/stadium/order/refund`, // A订单管理-场馆预订订单-订单退款 (零售订单、场地、次卡)
userMonthlyCardRefundFixed:`${ORIGIN}/admin/userMonthlyCard/refundFixed`, // 年月卡订单-订单退款 userMonthlyCardRefundFixed:`${ORIGIN}/admin/userMonthlyCard/refundFixed`, // 年月卡订单-订单退款
} }

50
src/subpackage/order/pages/retail/detail/detail.vue

@ -146,26 +146,63 @@ export default {
}, },
onLoad(options){ onLoad(options){
this.getOrderInfo(options.order_no); this.getOrderInfo(options.order_no);
this.retailOrderInfoRefundList({
order_no: options.order_no,
brand_id: this.brandInfo.brand.id
})
}, },
methods: { methods: {
refunndBtn(){ refunndBtn(){
let { orderInfo, refundList } = this; let { orderInfo, refundList } = this;
this.$refs.orderRefundModal.show({ this.$refs.orderRefundModal.show({
stadium_name: orderInfo?.refundList ?? '',
stadium_name: orderInfo?.stadium_name ?? '',
order_no: orderInfo?.order_no ?? '', order_no: orderInfo?.order_no ?? '',
mobile: orderInfo?.refundList ?? '',
mobile: orderInfo?.mobile ?? '',
refundable_amount: orderInfo?.extension?.refundable_amount ?? 0, refundable_amount: orderInfo?.extension?.refundable_amount ?? 0,
refundable_integral: orderInfo?.extension?.refundable_integral ?? 0, refundable_integral: orderInfo?.extension?.refundable_integral ?? 0,
refund_times: refundList?.length || 0, refund_times: refundList?.length || 0,
confirm: e => { confirm: e => {
console.log('refund' , e)
// this.venueCourseOrderRefund({ // this.venueCourseOrderRefund({
// order_no: orderInfo?.order_no ?? '', // order_no: orderInfo?.order_no ?? '',
// amount: e.refund_amount || 0, // amount: e.refund_amount || 0,
// integral: e.refund_integral || 0 // integral: e.refund_integral || 0
// }) // })
this.confirmRefundReq({
order_no: orderInfo?.order_no || '',
amount: e.refund_amount || 0,
integral: e.refund_integral || 0
})
} }
}); });
}, },
confirmRefundReq({ order_no = '', amount = 0, integral = 0}){
util.showLoad();
server.get({
url: ORDER_API.orderRefund,
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 || '操作失败!');
}
})
.then(_=>{
setTimeout(_=>{
let { orderInfo } = this;
this.getOrderInfo(orderInfo?.order_no || '');
this.retailOrderInfoRefundList({
order_no: orderInfo?.order_no || '',
brand_id: orderInfo?.brand_id || ''
})
}, 1200);
})
.catch(util.hideLoad)
},
// payTypeTxt: util.order_pay_type_txt, // payTypeTxt: util.order_pay_type_txt,
payTypeTxt(payType, cardNo) { payTypeTxt(payType, cardNo) {
let _obj = { let _obj = {
@ -197,17 +234,20 @@ export default {
// { 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 },
// { 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 }
// ]; // ];
});
},
retailOrderInfoRefundList({ order_no, brand_id }){
server.get({ server.get({
url: ORDER_API.retailOrderInfoRefundList, url: ORDER_API.retailOrderInfoRefundList,
data: { order_no, brand_id: this.brandInfo.brand.id },
data: { order_no, brand_id },
failMsg: '加载失败!' failMsg: '加载失败!'
}) })
.then(res=>{ .then(res=>{
util.hideLoad(); util.hideLoad();
this.refundList = res?.list || []; this.refundList = res?.list || [];
}); });
});
},
}
} }
} }

Loading…
Cancel
Save