Commit b00b233a authored by 郭志伟's avatar 郭志伟

Merge branch 'pay' into feat/vipLife

# Conflicts:
#	src/views/vipLife/index.vue
parents 134644ca ad359b42
...@@ -77,12 +77,12 @@ function payByWeixinH5(info) { ...@@ -77,12 +77,12 @@ function payByWeixinH5(info) {
* @return: * @return:
*/ */
function payByALIH5(info) { function payByALIH5(info) {
if (!info.order_string) return; if (!info.url) return;
console.log('ali:', info.order_string); console.log('ali:', info.url);
const aliWrap = document.createElement('div'); const aliWrap = document.createElement('div');
aliWrap.id = 'ALIWEB_WRAP'; aliWrap.id = 'ALIWEB_WRAP';
aliWrap.setAttribute('id', 'ALIWEB_WRAP'); aliWrap.setAttribute('id', 'ALIWEB_WRAP');
aliWrap.innerHTML = info.order_string; aliWrap.innerHTML = info.url;
document.body.appendChild(aliWrap); document.body.appendChild(aliWrap);
document.forms[0].submit(); document.forms[0].submit();
......
...@@ -418,7 +418,6 @@ export const APP_DOWN_URL = 'https://misc.lkbang.net/download/yxm.html'; ...@@ -418,7 +418,6 @@ export const APP_DOWN_URL = 'https://misc.lkbang.net/download/yxm.html';
export function throttle(fn, wait) { export function throttle(fn, wait) {
let flag = true; let flag = true;
console.log(fn);
return function() { return function() {
if (flag) { if (flag) {
fn.apply(this, arguments); fn.apply(this, arguments);
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
class="center-phone-field" class="center-phone-field"
placeholder="请输入手机号码" placeholder="请输入手机号码"
@input="changeTelFormat" @input="changeTelFormat"
@blur="searchPhoneNoHome" @blur="searchPhoneNo(rechargeTel)"
@focus="inputBlur = true"
/> />
<div class="center-phone__list" :class="{ show: inputBlur }"> <div class="center-phone__list" :class="{ show: inputBlur }">
<div <div
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
class="center-phone__list-item" class="center-phone__list-item"
@click="searchPhoneNoHome(item)" @click="selectPhone(item)"
> >
<span class="phone">{{ phoneFormat(item.phone) }}</span> <span class="phone">{{ phoneFormat(item) }}</span>
<span class="phone-home">{{ item.home }}</span>
<span v-if="index === 0" class="current">上次充值</span> <span v-if="index === 0" class="current">上次充值</span>
</div> </div>
</div> </div>
...@@ -65,18 +65,29 @@ export default { ...@@ -65,18 +65,29 @@ export default {
this.queryhome(); this.queryhome();
} }
}, },
async searchPhoneNoHome() { async searchPhoneNo() {
if (!this.phoneNo) return; if (!this.phoneNo) return;
if (!checkPhoneFormat(this.phoneNo)) { if (!checkPhoneFormat(this.phoneNo)) {
this.$toast.fail('请您输入正确的手机号'); this.$toast.fail('请您输入正确的手机号');
this.$emit('input', { phoneNo: '', phoneNoHome: this.phoneNoHome }); this.input();
return; return;
} }
this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome }); !this.phoneHome && this.queryhome();
this.input();
},
selectPhone(phone) {
this.inputBlur = false;
if (phone) {
this.rechargeTel = phoneFormat(phone);
}
this.searchPhoneNo();
}, },
async queryhome() { async queryhome() {
const [data] = await getPhoneHome(this.phoneNo); const [data] = await getPhoneHome(this.phoneNo);
this.phoneNoHome = data?.phoneHome; this.phoneNoHome = data?.phoneHome;
this.input();
},
input() {
this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome }); this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome });
} }
} }
...@@ -87,6 +98,9 @@ export default { ...@@ -87,6 +98,9 @@ export default {
position: relative; position: relative;
&-phone { &-phone {
border-bottom: @border-width-base solid @gray-2; border-bottom: @border-width-base solid @gray-2;
.cr-field:not(:last-child)::after {
display: none;
}
.cr-cell__title { .cr-cell__title {
display: none; display: none;
} }
...@@ -103,9 +117,11 @@ export default { ...@@ -103,9 +117,11 @@ export default {
text-indent: -2px; text-indent: -2px;
} }
&__list { &__list {
// display: none; display: none;
position: absolute; position: absolute;
top: 50px; top: 100px;
width: 100%;
margin: auto;
left: -@padding-lg; left: -@padding-lg;
right: -@padding-lg; right: -@padding-lg;
z-index: 3; z-index: 3;
......
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
methods: { methods: {
async changeRechargeType(name) { async changeRechargeType(name) {
const [data] = await getSkuList( const [data] = await getSkuList(
this.phoneRecharge[`${name}SpuNo`], this.phoneRecharge[`${name}SpuNos`],
this.phoneRecharge[`${name}Type`] this.phoneRecharge[`${name}Type`]
); );
this.$emit('changeRechargetype', name); this.$emit('changeRechargetype', name);
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
phoneRecharge: {}, phoneRecharge: {},
userPhoneInfo: {}, userPhoneInfo: {},
rechargeType: 'recharge', rechargeType: 'recharge',
historyRecordList: [{}, {}], historyRecordList: ['17611682272', '222222222'],
rechargePhoneInfo: {}, rechargePhoneInfo: {},
selectedRechargeInfo: {} selectedRechargeInfo: {}
}; };
...@@ -67,10 +67,10 @@ export default { ...@@ -67,10 +67,10 @@ export default {
const [data] = await getSpuList(); const [data] = await getSpuList();
if (data) { if (data) {
this.vipLife = data.vipLife || []; this.vipLife = data.vipLife || [];
this.phoneRecharge = data.phoneRecharge || {}; this.phoneRecharge = data?.phoneRecharge || {};
this.userPhoneInfo = data.userPhoneInfo || {}; this.userPhoneInfo = data?.userPhoneInfo || {};
this.rechargePhoneInfo = data.userPhoneInfo || {}; this.rechargePhoneInfo = data?.userPhoneInfo || {};
localStorage.set('phoneNo', data.userPhoneInfo.phoneNo); localStorage.set('phoneNo', data?.userPhoneInfo?.phoneNo);
} }
}, },
methods: { methods: {
...@@ -80,7 +80,7 @@ export default { ...@@ -80,7 +80,7 @@ export default {
}, },
async goOrderApi() { async goOrderApi() {
/* 需要加防抖 */ /* 需要加防抖 */
const { skuNo, salePrice } = this.selectedRechargeInfo; const { skuNos, salePrice } = this.selectedRechargeInfo;
const token = localStorage.get('vccToken'); const token = localStorage.get('vccToken');
if (!token) { if (!token) {
await getTokenFromNative(); await getTokenFromNative();
...@@ -88,12 +88,12 @@ export default { ...@@ -88,12 +88,12 @@ export default {
const [res] = await orderApi.orderCreate({ const [res] = await orderApi.orderCreate({
totalFee: salePrice, totalFee: salePrice,
terminal: 'H5', terminal: 'H5',
account: this.rechargePhoneInfo.phoneNo, account: this.rechargePhoneInfo?.phoneNo,
registrationLocation: this.rechargePhoneInfo.phoneNoHome, registrationLocation: this.rechargePhoneInfo?.phoneNoHome,
virtualRechargeType: this.phoneRecharge[`${this.rechargeType}Type`], virtualRechargeType: this.phoneRecharge[`${this.rechargeType}Type`],
skuList: [ skuList: [
{ {
skuNo, skuNo: skuNos,
count: 1 count: 1
} }
] ]
......
...@@ -188,7 +188,8 @@ export default { ...@@ -188,7 +188,8 @@ export default {
this.showCancelPopup = true; this.showCancelPopup = true;
}, },
toPay() { toPay() {
this.$router.push({ path: '/pay', query: { orderNo: this.currentOrder.orderNo } }); console.log(this.currentOrder.orderNo);
this.$router.push({ path: '/pay', query: { orderNo: this.orderNo } });
}, },
toGoods() { toGoods() {
this.$router.push({ this.$router.push({
......
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
<p class="content-info-tit">{{ value.name }}</p> <p class="content-info-tit">{{ value.name }}</p>
<p v-if="value.tagName" class="content-info-tit_tag">{{ value.tagName }}</p> <p v-if="value.tagName" class="content-info-tit_tag">{{ value.tagName }}</p>
</div> </div>
<p v-if="isGroupPay && value.mergePayPretreatmentInfo" class="content-info-amount"> <p v-if="isGroupPay && value.payAmt" class="content-info-amount">
{{ {{ value.payAmt }}
value.mergePayPretreatmentInfo && value.mergePayPretreatmentInfo.creditPayAmt
}}.00
</p> </p>
</div> </div>
<p>{{ value.accountStatusDesc }}</p> <p>{{ value.accountStatusDesc }}</p>
...@@ -65,12 +63,12 @@ export default { ...@@ -65,12 +63,12 @@ export default {
couponDisabled: Boolean couponDisabled: Boolean
}, },
methods: { methods: {
changePayType({ payType }) { changePayType({ payType, mergePayPretreatmentInfo }) {
if (this.disabled || this.value.disabled) { if (this.disabled || this.value.disabled) {
return; return;
} }
this.$emit('click'); this.$emit('click');
this.pay.changePayType(payType); this.pay.changePayType(payType, mergePayPretreatmentInfo);
}, },
openCouponModal() { openCouponModal() {
if (this.couponDisabled) return; if (this.couponDisabled) return;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
@click.native="changePayType(thirdPayInfo)" @click.native="changePayType(thirdPayInfo)"
/> />
</div> </div>
<!-- <PayCardItem :is-group-pay="true" :value="thirdPayInfo" /> -->
<div class="groupCard"> <div class="groupCard">
<PayCardItem :is-group-pay="true" :value="thirdPayInfo" /> <PayCardItem :is-group-pay="true" :value="thirdPayInfo" />
</div> </div>
...@@ -69,7 +68,13 @@ export default { ...@@ -69,7 +68,13 @@ export default {
let temp = {}; let temp = {};
for (const key in this.value) { for (const key in this.value) {
if (this.value[key].isRecommend || this.value[key].isCheck) { if (this.value[key].isRecommend || this.value[key].isCheck) {
temp = { ...this.value[key] }; const mergePayPretreatmentInfo = this.value[key]?.mergePayPretreatmentInfo || {};
temp = {
...this.value[key],
payAmt: mergePayPretreatmentInfo?.otherPayAmt
};
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.creditPayInfo.payAmt = mergePayPretreatmentInfo.creditPayAmt;
} }
} }
return temp; return temp;
...@@ -84,6 +89,7 @@ export default { ...@@ -84,6 +89,7 @@ export default {
}, },
methods: { methods: {
changePayType({ payType, mergePayPretreatmentInfo }) { changePayType({ payType, mergePayPretreatmentInfo }) {
console.log(mergePayPretreatmentInfo, 'mergePayPretreatmentInfo');
if (this.disabled || this.creditPayInfo.disabled) { if (this.disabled || this.creditPayInfo.disabled) {
return; return;
} }
......
...@@ -106,7 +106,6 @@ import { ...@@ -106,7 +106,6 @@ import {
payTypeE, payTypeE,
CREDIT_PAY, CREDIT_PAY,
WECHAT_PAY, WECHAT_PAY,
ALIPAY_PAY,
PAY_SUCCESS, PAY_SUCCESS,
creditStatus, creditStatus,
IS_THIRD_PAY, IS_THIRD_PAY,
...@@ -227,6 +226,7 @@ export default { ...@@ -227,6 +226,7 @@ export default {
} }
if (displayInfo.payCouponInfo && displayInfo.payCouponInfo.optimalPayCoupon) { if (displayInfo.payCouponInfo && displayInfo.payCouponInfo.optimalPayCoupon) {
this.selectedCoupon = displayInfo.payCouponInfo.optimalPayCoupon; this.selectedCoupon = displayInfo.payCouponInfo.optimalPayCoupon;
this.selectedCoupon.id = this.selectedCoupon.pickupId;
this.showCoupon = displayInfo.payCouponInfo.optimalType === 3; this.showCoupon = displayInfo.payCouponInfo.optimalType === 3;
} }
this.payContractInfo = displayInfo.payContractInfo || {}; this.payContractInfo = displayInfo.payContractInfo || {};
...@@ -259,6 +259,9 @@ export default { ...@@ -259,6 +259,9 @@ export default {
displayInfo[key].disabled = true; displayInfo[key].disabled = true;
} }
this.creditPayList.isGroupPay = IS_GROUP_PAY(p.method); this.creditPayList.isGroupPay = IS_GROUP_PAY(p.method);
if (p.isDefault) {
this.mergePayPretreatmentInfo = p.mergePayPretreatmentInfo;
}
this.$set(this.creditPayList.payList, key, { this.$set(this.creditPayList.payList, key, {
...displayInfo[key], ...displayInfo[key],
...p, ...p,
...@@ -267,10 +270,18 @@ export default { ...@@ -267,10 +270,18 @@ export default {
isCheck: p.isDefault || false, isCheck: p.isDefault || false,
isGroupPay: IS_GROUP_PAY(p.method) isGroupPay: IS_GROUP_PAY(p.method)
}); });
if (!('creditPayInfo' in this.creditPayList.payList)) {
this.$set(this.creditPayList.payList, 'creditPayInfo', {
...displayInfo['creditPayInfo'],
show: true,
isCheck: false
});
}
break; break;
} }
} }
} }
if (this.payType === CREDIT_PAY && displayInfo.creditPayInfo.disabled) { if (this.payType === CREDIT_PAY && displayInfo.creditPayInfo.disabled) {
this.payType = null; this.payType = null;
} }
...@@ -350,13 +361,16 @@ export default { ...@@ -350,13 +361,16 @@ export default {
/* 获取优惠券信息 */ /* 获取优惠券信息 */
async getCouponList(orderNo) { async getCouponList(orderNo) {
const [data] = await getCoupon({ orderNo: orderNo }); const [data] = await getCoupon({ orderNo: orderNo });
this.payCouponList = [];
if (data && data.coupons) { if (data && data.coupons) {
this.payCouponList = data.coupons.filter(item => { data.coupons.forEach(item => {
if (item.couponCategory === 21) { if (item.couponCategory === 21) {
return { this.payCouponList.push({
...item, ...item,
id: item.pickupId id: item.pickupId,
}; pickupAble: 1, // 需要判断是否可用
limitAmount: item.limitDesc
});
} }
}); });
} }
...@@ -376,10 +390,10 @@ export default { ...@@ -376,10 +390,10 @@ export default {
this.isDetention = false; this.isDetention = false;
/* 设置密码 */ /* 设置密码 */
if (this.payType === CREDIT_PAY && !this.creditPayInfo.hasPwd) { if (this.payType === CREDIT_PAY && !this.creditPayInfo.hasPwd) {
const url = `${this.creditPayInfo.pwdSetJumpUrl}&vccChannel=${VCC_CHANNEL}`; this.retrieveLink();
this.goH5(url);
return; return;
} }
localStorage.set('orderNo', { orderNo: this.orderNo });
const paramsData = { const paramsData = {
...params, ...params,
quitUrl: `${window.location.origin}/payWaiting`, quitUrl: `${window.location.origin}/payWaiting`,
...@@ -396,45 +410,38 @@ export default { ...@@ -396,45 +410,38 @@ export default {
/* 支付失败 */ /* 支付失败 */
if (error) { if (error) {
if (codeArr.indexOf(error.response.businessCode) < 0) { if (codeArr.indexOf(error.response.businessCode) < 0) {
this.payResult('Fail', error.msg); this.payResult('Fail', error.message);
return; return;
} }
this.error = error.msg; this.error = error.message;
return; return;
} }
const { creditPayInfo = {}, wxPayInfo, flowOrderNo, aliPayInfo } = data; const { creditPayInfo = {}, wxPayInfo = {}, flowOrderNo, aliPayInfo = {} } = data;
const creditPayStatus = creditPayInfo.creditPayStatus; const creditPayStatus = creditPayInfo.creditPayStatus;
this.flowOrderNo = flowOrderNo; this.flowOrderNo = flowOrderNo;
if (wxPayInfo.mwebUrl) {
if (!params && this.payType === WECHAT_PAY) {
/* 微信支付 */ /* 微信支付 */
payByWay(this.tradeType, { ...wxPayInfo, url: wxPayInfo.mwebUrl }); payByWay(this.tradeType, { ...wxPayInfo, url: wxPayInfo.mwebUrl });
return; return;
} } else if (aliPayInfo.order_string) {
if (!params && this.payType === ALIPAY_PAY) {
/* 支付宝支付 */ /* 支付宝支付 */
payByWay('ALIWEB', aliPayInfo); payByWay('ALIWEB', { ...aliPayInfo, url: aliPayInfo.order_string });
return; return;
} } else if (creditPayStatus === PAY_SUCCESS) {
if (creditPayStatus === PAY_SUCCESS) { /* 信用支付成功 */
if (IS_GROUP_PAY(this.payType)) {
//组合支付成功后跳转支付中
this.payResult('Waiting');
return;
}
/* 支付成功 */
this.close(); this.close();
this.payResult('Success'); this.payResult('Success');
return; return;
} } else if (
if (creditPayStatus === PAYMENT_CODE_PAY || creditPayStatus === SMS_VERIFICATION_CODE_PAY) { creditPayStatus === PAYMENT_CODE_PAY ||
creditPayStatus === SMS_VERIFICATION_CODE_PAY
) {
/* 密码或者短信鉴权 */ /* 密码或者短信鉴权 */
this.close(); this.close();
this[`${creditPayStatusType[creditPayStatus]}Modal`] = true; this[`${creditPayStatusType[creditPayStatus]}Modal`] = true;
return; return;
} } else if (creditPayStatus === FACE_VERIFICATION_CODE_PAY) {
/* 人脸鉴权 */ /* 人脸鉴权 */
if (creditPayStatus === FACE_VERIFICATION_CODE_PAY) {
this.goOcr(); this.goOcr();
} }
}, },
...@@ -473,7 +480,6 @@ export default { ...@@ -473,7 +480,6 @@ export default {
console.log(id, selectedCoupon); console.log(id, selectedCoupon);
registeredEvents('PD_YXMMACP_UserClickCouponPopupWindowComfirmBtn'); registeredEvents('PD_YXMMACP_UserClickCouponPopupWindowComfirmBtn');
this.selectedCoupon = selectedCoupon || {}; this.selectedCoupon = selectedCoupon || {};
console.log(this.selectedCoupon);
const status = this.checkStatus(this.creditPayInfo, this.displayInfo); const status = this.checkStatus(this.creditPayInfo, this.displayInfo);
if (status) { if (status) {
this.displayInfo.creditPayInfo.disabled = true; this.displayInfo.creditPayInfo.disabled = true;
......
...@@ -53,12 +53,12 @@ export default { ...@@ -53,12 +53,12 @@ export default {
return { return {
money: '00.00', money: '00.00',
orderNo: null, orderNo: null,
isSuccess: null, isSuccess: false,
freeAmount: null freeAmount: 0
}; };
}, },
created() { created() {
const { amount, orderNo, freeAmount, reason } = this.$route.query; const { amount = null, orderNo, freeAmount = null, reason } = this.$route.query;
const { success } = this.$route.meta; const { success } = this.$route.meta;
this.money = amount; this.money = amount;
this.orderNo = orderNo; this.orderNo = orderNo;
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
</div> </div>
</template> </template>
<script> <script>
import { registeredEvents } from '@/service/sa.service';
import { queryPayStatus } from '@/api/pay.api'; import { queryPayStatus } from '@/api/pay.api';
import localStorage from '@/service/localStorage.service';
export default { export default {
components: {}, components: {},
data() { data() {
...@@ -35,19 +35,14 @@ export default { ...@@ -35,19 +35,14 @@ export default {
}; };
}, },
created() { created() {
const { orderNo } = this.$route.query; this.orderNo = this.$route.query.orderNo || localStorage.get('orderNo')?.orderNo;
this.orderNo = orderNo;
}, },
mounted() { mounted() {
// eslint-disable-next-line space-before-function-paren // eslint-disable-next-line space-before-function-paren
this.timer = setInterval(async () => { this.timer = setInterval(async () => {
this.time -= 1; this.time -= 1;
if (this.time % 2 === 0) { if (this.time % 2 === 0) {
const [data] = await queryPayStatus({ orderNo: this.orderNo }); this.query();
if (data.payStatus === 3) {
this.goPay();
}
// 结果处理,如果未支付弹窗提示是否支付成功,跳转支付中页面
} }
if (this.time < 1) { if (this.time < 1) {
clearInterval(this.timer); clearInterval(this.timer);
...@@ -59,18 +54,42 @@ export default { ...@@ -59,18 +54,42 @@ export default {
}, },
methods: { methods: {
goHome() { goHome() {
// 去页面 // 去首页
this.$router.replace({ name: 'home' }); this.$router.replace({ name: 'home' });
}, },
goSuccess() {
// 支付成功
this.$router.replace({ name: 'paySuccess' });
},
goOrderDetail() { goOrderDetail() {
this.$router.replace({ name: 'orderDetail', query: { order: this.orderNo } }); this.$router.replace({ name: 'orderDetail', query: { orderNo: this.orderNo } });
// 去订单详情页面 // 去订单详情页面
}, },
goPay() { async query() {
registeredEvents('PD_YXMMAEC_UserClickCashierPaymentAgainBtn', { const [data, error] = await queryPayStatus({ orderNo: this.orderNo });
order_id: this.orderNo console.log(this.orderNo);
}); if (error) {
this.$router.replace({ name: 'pay', query: { order: this.orderNo } }); this.$router.replace({
name: 'payFail',
query: { reason: error.message, orderNo: this.orderNo }
});
return;
}
if (+data?.payStatus === 3) {
this.goSuccess();
}
// else if (+data?.payStatus === 1) {
// this.$dialog({
// message: '是否支付成功?',
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// confirmButtonColor: '#EC1500',
// onCancel: () => {},
// onConfirm: () => {
// this.query();
// }
// });
// }
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment