Commit ad359b42 authored by FE-安焕焕's avatar FE-安焕焕 👣

组合支付

parent eec7da5a
......@@ -418,7 +418,6 @@ export const APP_DOWN_URL = 'https://misc.lkbang.net/download/yxm.html';
export function throttle(fn, wait) {
let flag = true;
console.log(fn);
return function() {
if (flag) {
fn.apply(this, arguments);
......
......@@ -67,10 +67,10 @@ export default {
const [data] = await getSpuList();
if (data) {
this.vipLife = data.vipLife || [];
this.phoneRecharge = data.phoneRecharge || {};
this.userPhoneInfo = data.userPhoneInfo || {};
this.rechargePhoneInfo = data.userPhoneInfo || {};
localStorage.set('phoneNo', data.userPhoneInfo.phoneNo);
this.phoneRecharge = data?.phoneRecharge || {};
this.userPhoneInfo = data?.userPhoneInfo || {};
this.rechargePhoneInfo = data?.userPhoneInfo || {};
localStorage.set('phoneNo', data?.userPhoneInfo?.phoneNo);
}
},
methods: {
......@@ -88,8 +88,8 @@ export default {
const [res] = await orderApi.orderCreate({
totalFee: salePrice,
terminal: 'H5',
account: this.rechargePhoneInfo.phoneNo,
registrationLocation: this.rechargePhoneInfo.phoneNoHome,
account: this.rechargePhoneInfo?.phoneNo,
registrationLocation: this.rechargePhoneInfo?.phoneNoHome,
virtualRechargeType: this.phoneRecharge[`${this.rechargeType}Type`],
skuList: [
{
......
......@@ -10,10 +10,8 @@
<p class="content-info-tit">{{ value.name }}</p>
<p v-if="value.tagName" class="content-info-tit_tag">{{ value.tagName }}</p>
</div>
<p v-if="isGroupPay && value.mergePayPretreatmentInfo" class="content-info-amount">
{{
value.mergePayPretreatmentInfo && value.mergePayPretreatmentInfo.creditPayAmt
}}.00
<p v-if="isGroupPay && value.payAmt" class="content-info-amount">
{{ value.payAmt }}
</p>
</div>
<p>{{ value.accountStatusDesc }}</p>
......@@ -65,12 +63,12 @@ export default {
couponDisabled: Boolean
},
methods: {
changePayType({ payType }) {
changePayType({ payType, mergePayPretreatmentInfo }) {
if (this.disabled || this.value.disabled) {
return;
}
this.$emit('click');
this.pay.changePayType(payType);
this.pay.changePayType(payType, mergePayPretreatmentInfo);
},
openCouponModal() {
if (this.couponDisabled) return;
......
......@@ -20,7 +20,6 @@
@click.native="changePayType(thirdPayInfo)"
/>
</div>
<!-- <PayCardItem :is-group-pay="true" :value="thirdPayInfo" /> -->
<div class="groupCard">
<PayCardItem :is-group-pay="true" :value="thirdPayInfo" />
</div>
......@@ -69,7 +68,13 @@ export default {
let temp = {};
for (const key in this.value) {
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;
......@@ -84,6 +89,7 @@ export default {
},
methods: {
changePayType({ payType, mergePayPretreatmentInfo }) {
console.log(mergePayPretreatmentInfo, 'mergePayPretreatmentInfo');
if (this.disabled || this.creditPayInfo.disabled) {
return;
}
......
......@@ -106,7 +106,6 @@ import {
payTypeE,
CREDIT_PAY,
WECHAT_PAY,
ALIPAY_PAY,
PAY_SUCCESS,
creditStatus,
IS_THIRD_PAY,
......@@ -118,8 +117,6 @@ import {
ACCOUNT_APPLY_FAIL,
creditPayStatusType,
ACCOUNT_APPLY_SUCCESS,
CREDIT_AND_WECHAT_PAY,
CREDIT_AND_ALIPAY_PAY,
ACCOUNT_APPLY_AUDIT_FAIL,
SMS_VERIFICATION_CODE_PAY, //短信验证码
FACE_VERIFICATION_CODE_PAY
......@@ -229,6 +226,7 @@ export default {
}
if (displayInfo.payCouponInfo && displayInfo.payCouponInfo.optimalPayCoupon) {
this.selectedCoupon = displayInfo.payCouponInfo.optimalPayCoupon;
this.selectedCoupon.id = this.selectedCoupon.pickupId;
this.showCoupon = displayInfo.payCouponInfo.optimalType === 3;
}
this.payContractInfo = displayInfo.payContractInfo || {};
......@@ -261,6 +259,9 @@ export default {
displayInfo[key].disabled = true;
}
this.creditPayList.isGroupPay = IS_GROUP_PAY(p.method);
if (p.isDefault) {
this.mergePayPretreatmentInfo = p.mergePayPretreatmentInfo;
}
this.$set(this.creditPayList.payList, key, {
...displayInfo[key],
...p,
......@@ -269,10 +270,18 @@ export default {
isCheck: p.isDefault || false,
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;
}
}
}
if (this.payType === CREDIT_PAY && displayInfo.creditPayInfo.disabled) {
this.payType = null;
}
......@@ -352,13 +361,16 @@ export default {
/* 获取优惠券信息 */
async getCouponList(orderNo) {
const [data] = await getCoupon({ orderNo: orderNo });
this.payCouponList = [];
if (data && data.coupons) {
this.payCouponList = data.coupons.filter(item => {
data.coupons.forEach(item => {
if (item.couponCategory === 21) {
return {
this.payCouponList.push({
...item,
id: item.pickupId
};
id: item.pickupId,
pickupAble: 1, // 需要判断是否可用
limitAmount: item.limitDesc
});
}
});
}
......@@ -378,11 +390,10 @@ export default {
this.isDetention = false;
/* 设置密码 */
if (this.payType === CREDIT_PAY && !this.creditPayInfo.hasPwd) {
const url = `${this.creditPayInfo.pwdSetJumpUrl}&vccChannel=${VCC_CHANNEL}`;
this.goH5(url);
this.retrieveLink();
return;
}
localStorage.set('orderNo', this.orderNo);
localStorage.set('orderNo', { orderNo: this.orderNo });
const paramsData = {
...params,
quitUrl: `${window.location.origin}/payWaiting`,
......@@ -399,24 +410,20 @@ export default {
/* 支付失败 */
if (error) {
if (codeArr.indexOf(error.response.businessCode) < 0) {
this.payResult('Fail', error.msg);
this.payResult('Fail', error.message);
return;
}
this.error = error.msg;
this.error = error.message;
return;
}
const { creditPayInfo = {}, wxPayInfo, flowOrderNo, aliPayInfo } = data;
const { creditPayInfo = {}, wxPayInfo = {}, flowOrderNo, aliPayInfo = {} } = data;
const creditPayStatus = creditPayInfo.creditPayStatus;
this.flowOrderNo = flowOrderNo;
if (!params && (this.payType === WECHAT_PAY || this.payType === CREDIT_AND_WECHAT_PAY)) {
if (wxPayInfo.mwebUrl) {
/* 微信支付 */
payByWay(this.tradeType, { ...wxPayInfo, url: wxPayInfo.mwebUrl });
return;
} else if (
!params &&
(this.payType === ALIPAY_PAY || this.payType === CREDIT_AND_ALIPAY_PAY)
) {
} else if (aliPayInfo.order_string) {
/* 支付宝支付 */
payByWay('ALIWEB', { ...aliPayInfo, url: aliPayInfo.order_string });
return;
......@@ -473,7 +480,6 @@ export default {
console.log(id, selectedCoupon);
registeredEvents('PD_YXMMACP_UserClickCouponPopupWindowComfirmBtn');
this.selectedCoupon = selectedCoupon || {};
console.log(this.selectedCoupon);
const status = this.checkStatus(this.creditPayInfo, this.displayInfo);
if (status) {
this.displayInfo.creditPayInfo.disabled = true;
......
......@@ -53,12 +53,12 @@ export default {
return {
money: '00.00',
orderNo: null,
isSuccess: null,
freeAmount: null
isSuccess: false,
freeAmount: 0
};
},
created() {
const { amount, orderNo, freeAmount, reason } = this.$route.query;
const { amount = null, orderNo, freeAmount = null, reason } = this.$route.query;
const { success } = this.$route.meta;
this.money = amount;
this.orderNo = orderNo;
......
......@@ -23,7 +23,6 @@
</div>
</template>
<script>
import { registeredEvents } from '@/service/sa.service';
import { queryPayStatus } from '@/api/pay.api';
import localStorage from '@/service/localStorage.service';
export default {
......@@ -36,7 +35,7 @@ export default {
};
},
created() {
this.orderNo = this.$route.query.orderNo || localStorage.get('orderNo');
this.orderNo = this.$route.query.orderNo || localStorage.get('orderNo')?.orderNo;
},
mounted() {
// eslint-disable-next-line space-before-function-paren
......@@ -67,21 +66,30 @@ export default {
// 去订单详情页面
},
async query() {
const [data] = await queryPayStatus({ orderNo: this.orderNo });
const [data, error] = await queryPayStatus({ orderNo: this.orderNo });
console.log(this.orderNo);
if (error) {
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();
}
});
}
// 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