添加储值卡消费
This commit is contained in:
@ -138,19 +138,32 @@
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
<view :class="payType == 'balance' ? 'item active' : 'item'" @tap="payTypeFunc('balance')">
|
||||
<view :class="payType == 'balance' ? 'item active' : 'item'" @tap="payTypeFunc('balance')" style="padding-bottom: 10rpx;">
|
||||
<view class="d-s-c">
|
||||
<view class="icon-box d-c-c mr10"><span class="icon iconfont icon-yue"></span></view>
|
||||
<text class="key">平台余额</text>
|
||||
</view>
|
||||
<view class="d-f a-i-c">
|
||||
<view class="mr10 dis" v-if="userAccount > 0">
|
||||
<!-- <text class="key">余额支付:(剩余:{{balance}})</text> -->
|
||||
{{ cardType() }}
|
||||
<view class="mr10 dis" v-if="payType == 'balance' && userAccount > 0">
|
||||
{{ cardType() }}
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view :class="payType == 'storedCard' ? 'item active' : 'item'" @tap="payTypeFunc('storedCard')">
|
||||
<view class="d-s-c">
|
||||
<view class="icon-box d-c-c mr10">
|
||||
<image src="https://xh.stnav.com/uploads/sport/chuzhika.png" mode="heightFix" style="width: 50rpx; height: 50rpx;"></image>
|
||||
</view>
|
||||
<text class="key">储值卡支付</text>
|
||||
</view>
|
||||
<view class="d-f a-i-c">
|
||||
<view class="mr10 dis" v-if="payType == 'storedCard' && userAccount > 0">
|
||||
{{ storedCardName() }}
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="pay-light-btn" @click="getSelectedContent">确定并支付</view>
|
||||
@ -200,12 +213,12 @@
|
||||
<text class="cg-copy" @click="copy(detail.order_sn)">复制</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cg-order-info d-b-c mt14" v-if="detail.pay_way > 0">
|
||||
<view class="">交易方式:</view>
|
||||
<view class="">
|
||||
<text v-if="detail.pay_way == 1">余额支付-{{ cardType(detail.pay_way) }}</text>
|
||||
<text v-if="detail.pay_way == 1">余额支付-{{ cardType(detail.pay_type) }}</text>
|
||||
<text v-if="detail.pay_way == 2">微信支付</text>
|
||||
<text v-if="detail.pay_way == 3">储值卡支付-{{ storedCardType(detail.pay_xntype) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -396,6 +409,30 @@
|
||||
</view>
|
||||
</view>
|
||||
</Popup>
|
||||
|
||||
<!-- 储值卡选择弹窗 -->
|
||||
<Popup :show="storedCardPopup" :width='750' :padding="0" type="bottom" backgroundColor="#fff" radius="32rpx 32rpx 0 0">
|
||||
<view class="ww100 box-s-b pop-improt typeof pr">
|
||||
<image style="width: 64rpx;height: 64rpx;position: absolute; top: 26rpx;right: 30rpx;" src="@/static/icon/close2.png" mode="" @click="closeStoredCardPopup"></image>
|
||||
|
||||
<view class="d-c-c pt44">
|
||||
<text class="f34 fb">储值卡选择</text>
|
||||
</view>
|
||||
|
||||
<view class="bg-white card">
|
||||
<view class="card-item" v-for="item in storedCardList" :key="item.id" :class="currentStoredCardId == item.id ? 'active' : ''" @click="currentStoredCardId = item.id">
|
||||
<view class="d-f a-i-c">
|
||||
<view class="card-title">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="d-f a-i-c">
|
||||
<view class="card-balance">¥{{ formatMoney(item.balance) }}</view>
|
||||
<view class="icon-box d-c-c card-checkout"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-btn" @click="confirmStoredCard">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</Popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -448,6 +485,10 @@
|
||||
currentType: '', // 选择的会员卡类型
|
||||
userAccount: 0,
|
||||
userDiscount: 0,
|
||||
storedCardPopup: false,
|
||||
storedCardList: [],
|
||||
currentStoredCardId: '',
|
||||
storedValueCard: [],
|
||||
lightDateTime: '',
|
||||
lightPrice: 0,
|
||||
};
|
||||
@ -670,19 +711,31 @@
|
||||
|
||||
// 会员卡类型
|
||||
cardType(type) {
|
||||
if (type == 1) {
|
||||
const t = type || this.currentType;
|
||||
if (t == 1) {
|
||||
return '白银会员卡'
|
||||
} else if (type == 2) {
|
||||
} else if (t == 2) {
|
||||
return '黄金会员卡'
|
||||
} else if (type == 3) {
|
||||
} else if (t == 3) {
|
||||
return '铂金会员卡'
|
||||
} else if (type == 4) {
|
||||
} else if (t == 4) {
|
||||
return '钻石会员卡'
|
||||
} else if (type == 5) {
|
||||
} else if (t == 5) {
|
||||
return '至尊会员卡'
|
||||
}
|
||||
},
|
||||
|
||||
// 储值卡类型
|
||||
storedCardType(type) {
|
||||
if (type == 1) {
|
||||
return '储值卡一'
|
||||
} else if (type == 2) {
|
||||
return '储值卡二'
|
||||
} else if (type == 3) {
|
||||
return '储值卡三'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 购买灯光前置条件
|
||||
*/
|
||||
@ -708,13 +761,25 @@
|
||||
payTypeFunc(n) {
|
||||
this.payType = n;
|
||||
if (n == 'balance') {
|
||||
this.userAccount = 0;
|
||||
this.userDiscount = 0;
|
||||
this.currentStoredCardId = '';
|
||||
this.balancePopup = true;
|
||||
this.storedCardPopup = false;
|
||||
} else if (n == 'storedCard') {
|
||||
this.userAccount = 0;
|
||||
this.userDiscount = 0;
|
||||
this.currentType = '';
|
||||
this.balancePopup = false;
|
||||
this.storedCardPopup = true;
|
||||
} else {
|
||||
// 切换到微信支付时还原价格
|
||||
this.userAccount = 0;
|
||||
this.userDiscount = 0;
|
||||
this.currentType = '';
|
||||
this.currentStoredCardId = '';
|
||||
this.balancePopup = false;
|
||||
this.storedCardPopup = false;
|
||||
}
|
||||
},
|
||||
|
||||
@ -724,6 +789,49 @@
|
||||
this.balancePopup = false;
|
||||
},
|
||||
|
||||
closeStoredCardPopup() {
|
||||
this.payType = 'wxpay';
|
||||
this.storedCardPopup = false;
|
||||
},
|
||||
|
||||
formatMoney(value) {
|
||||
const amount = Number(value) || 0;
|
||||
return amount.toFixed(2);
|
||||
},
|
||||
|
||||
getStoredCardInfo() {
|
||||
return this.storedCardList.find(item => item.id === this.currentStoredCardId);
|
||||
},
|
||||
|
||||
storedCardName() {
|
||||
const currentCard = this.getStoredCardInfo();
|
||||
return currentCard ? currentCard.name : '';
|
||||
},
|
||||
|
||||
confirmStoredCard() {
|
||||
if (this.currentStoredCardId === '') {
|
||||
uni.showToast({
|
||||
title: '请选择储值卡',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const currentCard = this.getStoredCardInfo();
|
||||
if (!currentCard) {
|
||||
uni.showToast({
|
||||
title: '储值卡不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.userAccount = Number(currentCard.balance);
|
||||
this.userDiscount = 0;
|
||||
|
||||
this.storedCardPopup = false;
|
||||
},
|
||||
|
||||
getRecharge() {
|
||||
let self = this;
|
||||
uni.showLoading({
|
||||
@ -737,6 +845,7 @@
|
||||
},
|
||||
function(res) {
|
||||
self.balance = res.data.lists.balance;
|
||||
self.storedValueCard = res.data.lists.storedValueCard;
|
||||
}
|
||||
)
|
||||
|
||||
@ -746,6 +855,13 @@
|
||||
}, function(res) {
|
||||
console.log("🚀 ~ res:", res)
|
||||
self.userBalance = res.data.userInfo;
|
||||
|
||||
self.storedCardList = [
|
||||
{ id: 1, payType: 1, name: '储值卡一', discount: self.storedValueCard.discount1, balance: self.userBalance.card_balance1 },
|
||||
{ id: 2, payType: 2, name: '储值卡二', discount: self.storedValueCard.discount2, balance: self.userBalance.card_balance2 },
|
||||
{ id: 3, payType: 3, name: '储值卡三', discount: self.storedValueCard.discount3, balance: self.userBalance.card_balance3 },
|
||||
];
|
||||
|
||||
self.loadding = false;
|
||||
uni.hideLoading();
|
||||
});
|
||||
@ -771,27 +887,13 @@
|
||||
|
||||
|
||||
this.userAccount = this.userBalance['balance' + this.currentType];
|
||||
this.userDiscount = this.balance['discount' + this.currentType];
|
||||
this.userDiscount = 0;
|
||||
|
||||
// this.payType = this.currentType;
|
||||
// this.countPrice();
|
||||
this.balancePopup = false;
|
||||
},
|
||||
|
||||
cardType() {
|
||||
if (this.currentType == 1) {
|
||||
return '白银会员卡'
|
||||
} else if (this.currentType == 2) {
|
||||
return '黄金会员卡'
|
||||
} else if (this.currentType == 3) {
|
||||
return '铂金会员卡'
|
||||
} else if (this.currentType == 4) {
|
||||
return '钻石会员卡'
|
||||
} else if (this.currentType == 5) {
|
||||
return '至尊会员卡'
|
||||
}
|
||||
},
|
||||
|
||||
isSelected(groupIdx, idx) {
|
||||
return this.selectedTimes.some(sel => sel.group === groupIdx && sel.idx === idx);
|
||||
},
|
||||
@ -932,9 +1034,18 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.payType == 'storedCard' && self.currentStoredCardId === '') {
|
||||
uni.showToast({
|
||||
title: '请选择储值卡',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '正在处理'
|
||||
});
|
||||
});
|
||||
console.log('self.payType=', self.payType)
|
||||
console.log(123123)
|
||||
self._post(
|
||||
'order.GroundOrder/addLightStoreOrder', {
|
||||
@ -1034,6 +1145,54 @@
|
||||
self.getRecharge();
|
||||
}, 1500);
|
||||
|
||||
} else {
|
||||
self.openLightPopup = false;
|
||||
|
||||
console.log("🚀 ~ pay error res:", res)
|
||||
self.result = 'fail'
|
||||
uni.hideLoading();
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}, 200);
|
||||
|
||||
setTimeout(() => {
|
||||
self.getData();
|
||||
self.getRecharge();
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
)
|
||||
} else if (self.payType == 'storedCard') {
|
||||
const currentCard = self.getStoredCardInfo();
|
||||
console.log("🚀 ~ getStoredCardInfo:", 12312312321)
|
||||
self._post(
|
||||
'ground.ground/yuexnLightPay', {
|
||||
order_id: payId,
|
||||
pay_type: currentCard.payType
|
||||
},
|
||||
function(pay) {
|
||||
if (pay.code == 1) {
|
||||
self.openLightPopup = false;
|
||||
self.selectedTimes = []
|
||||
self.content = []
|
||||
|
||||
self.result = 'success'
|
||||
uni.hideLoading();
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}, 200);
|
||||
|
||||
setTimeout(() => {
|
||||
self.getData();
|
||||
self.getRecharge();
|
||||
}, 1500);
|
||||
|
||||
} else {
|
||||
self.openLightPopup = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user