|
@ -11,7 +11,7 @@ |
|
|
<view class="cc-btns"> |
|
|
<view class="cc-btns"> |
|
|
<view class="cb-item" @click="toRecords">消费记录</view> |
|
|
<view class="cb-item" @click="toRecords">消费记录</view> |
|
|
<view class="cb-item red" @click="deductionBtn">扣费</view> |
|
|
<view class="cb-item red" @click="deductionBtn">扣费</view> |
|
|
<view class="cb-item orange">充值</view> |
|
|
|
|
|
|
|
|
<view class="cb-item orange" @click="rechargeBtn">充值</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cd-box cd-record"> |
|
|
<view class="cd-box cd-record"> |
|
@ -26,7 +26,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<recharge-popup v-if="false"></recharge-popup> |
|
|
|
|
|
|
|
|
<recharge-popup ref="rechangePopup"></recharge-popup> |
|
|
<deduction-popup ref="deductionPopup"></deduction-popup> |
|
|
<deduction-popup ref="deductionPopup"></deduction-popup> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
@ -38,7 +38,7 @@ import deductionPopup from "../../components/popup/deduction.vue"; |
|
|
|
|
|
|
|
|
import { SHOWER_API } from "../../js/api"; |
|
|
import { SHOWER_API } from "../../js/api"; |
|
|
import server from "../../js/server"; |
|
|
import server from "../../js/server"; |
|
|
import { routeTo, showLoad, hideLoad, showNone, formatDate } from "@/utils/util"; |
|
|
|
|
|
|
|
|
import { routeTo, showLoad, hideLoad, showNone, formatDate, jsonStr, showModal } from "@/utils/util"; |
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
|
'kv-line': kv_line, |
|
|
'kv-line': kv_line, |
|
@ -63,11 +63,96 @@ export default { |
|
|
onLoad(options){ |
|
|
onLoad(options){ |
|
|
let { id, brand_id } = options; |
|
|
let { id, brand_id } = options; |
|
|
this.getCardInfo({ id, brand_id }); |
|
|
this.getCardInfo({ id, brand_id }); |
|
|
setTimeout(_=>{ |
|
|
|
|
|
this.deductionBtn(); |
|
|
|
|
|
}, 1200) |
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
rechargeBtn(){ |
|
|
|
|
|
let { water_card } = this; |
|
|
|
|
|
this.$refs.rechangePopup.init({ |
|
|
|
|
|
water_card_no: water_card?.water_card_no || '', |
|
|
|
|
|
mobile: water_card?.mobile || '', |
|
|
|
|
|
valid_duration_text: water_card?.valid_duration_text || '', |
|
|
|
|
|
success: rData => { |
|
|
|
|
|
let _query = { |
|
|
|
|
|
type: 5, |
|
|
|
|
|
brand_id: water_card?.brand_id || '', |
|
|
|
|
|
amount: rData?.pay_amount || 0, |
|
|
|
|
|
stadiumInfo: { |
|
|
|
|
|
id: water_card?.stadium_id || '', |
|
|
|
|
|
name: water_card?.stadium_name || '', |
|
|
|
|
|
logo: water_card?.stadium_logo || '', |
|
|
|
|
|
}, |
|
|
|
|
|
}; |
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: `/subpackage/common/pages/pay_type_select?query=${jsonStr(_query)}`, |
|
|
|
|
|
events: { payConfirm: pData => this.rechargePayConfirm({ rData, pData }) }, |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
async rechargePayConfirm({ rData, pData }){ |
|
|
|
|
|
let { water_card } = this; |
|
|
|
|
|
let _reqData = { |
|
|
|
|
|
brand_id: water_card?.brand_id || '', |
|
|
|
|
|
water_card_no: water_card?.water_card_no || '', |
|
|
|
|
|
duration: rData?.duration || 0, |
|
|
|
|
|
mobile: water_card?.mobile || '', |
|
|
|
|
|
pay_type: this.getTextForType(pData?.payTypeName || ''), |
|
|
|
|
|
pay_amount: pData?.amount || 0, |
|
|
|
|
|
order_no: pData?.selectedCardNo || '' |
|
|
|
|
|
} |
|
|
|
|
|
let _rechargeRes = await this.rechargePayReq(_reqData); |
|
|
|
|
|
if(_rechargeRes === 'SUCCESS'){ |
|
|
|
|
|
setTimeout(_=>{ |
|
|
|
|
|
this.getCardInfo({ id: water_card?.id, brand_id: water_card?.brand_id }); |
|
|
|
|
|
}, 1200) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
rechargePayReq(data){ |
|
|
|
|
|
showLoad(); |
|
|
|
|
|
return server.post({ |
|
|
|
|
|
url: SHOWER_API.CardRecharge, |
|
|
|
|
|
data, |
|
|
|
|
|
isDefaultGet: false, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res => { |
|
|
|
|
|
hideLoad(); |
|
|
|
|
|
let _data = res?.data || {}; |
|
|
|
|
|
if(_data.code === 0){ |
|
|
|
|
|
showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: _data.message || '操作成功!' |
|
|
|
|
|
}) |
|
|
|
|
|
return "SUCCESS"; |
|
|
|
|
|
// this.initData?.success?.('SUCCESS'); |
|
|
|
|
|
}else{ |
|
|
|
|
|
return Promise.reject(_data); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
hideLoad(); |
|
|
|
|
|
showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: err.message || '操作失败!' |
|
|
|
|
|
}) |
|
|
|
|
|
console.warn('deduction deductionReq err --->', err); |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// // 0: 微信支付 1: 支付宝支付 2: 储值卡支付 3:商家主动 4:押金抵扣 5:任务奖品 6:抖音团购兑换 7:付款码支付 |
|
|
|
|
|
getTextForType(payTxt){ |
|
|
|
|
|
switch(payTxt){ |
|
|
|
|
|
case '微信支付': return 0; |
|
|
|
|
|
case '支付宝支付': return 1; |
|
|
|
|
|
case '储值卡支付': return 2; |
|
|
|
|
|
case '商家主动': return 3; |
|
|
|
|
|
case '押金抵扣': return 4; |
|
|
|
|
|
case '任务奖品': return 5; |
|
|
|
|
|
case '抖音团购兑换': return 6; |
|
|
|
|
|
case '付款码支付': return 7; |
|
|
|
|
|
default: return 8; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
deductionBtn(){ |
|
|
deductionBtn(){ |
|
|
let { water_card } = this; |
|
|
let { water_card } = this; |
|
|
this.$refs.deductionPopup.init({ |
|
|
this.$refs.deductionPopup.init({ |
|
@ -75,6 +160,10 @@ export default { |
|
|
mobile: water_card?.mobile || '', |
|
|
mobile: water_card?.mobile || '', |
|
|
valid_duration_text: water_card?.valid_duration_text || '', |
|
|
valid_duration_text: water_card?.valid_duration_text || '', |
|
|
valid_duration: water_card?.valid_duration || '', |
|
|
valid_duration: water_card?.valid_duration || '', |
|
|
|
|
|
// 扣减提交参数 |
|
|
|
|
|
brand_id: water_card?.brand_id || '', |
|
|
|
|
|
stadium_id: water_card?.stadium_id || '', |
|
|
|
|
|
|
|
|
success: () => { |
|
|
success: () => { |
|
|
this.getCardInfo({ id: water_card?.id, brand_id: water_card?.brand_id }); |
|
|
this.getCardInfo({ id: water_card?.id, brand_id: water_card?.brand_id }); |
|
|
} |
|
|
} |
|
@ -82,7 +171,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
toRecords(){ |
|
|
toRecords(){ |
|
|
let { water_card } = this; |
|
|
let { water_card } = this; |
|
|
let _qryStr = `brand_id=${water_card?.brand_id || ''}&id=${water_card?.id || ''}`; |
|
|
|
|
|
|
|
|
let _qryStr = `brand_id=${water_card?.brand_id || ''}&water_card_no=${water_card?.water_card_no || ''}`; |
|
|
routeTo(`/subpackage/shower/pages/card/use_record?${_qryStr}`, 'nT'); |
|
|
routeTo(`/subpackage/shower/pages/card/use_record?${_qryStr}`, 'nT'); |
|
|
}, |
|
|
}, |
|
|
getCardInfo({ |
|
|
getCardInfo({ |
|
|