Commit 747c28a4 authored by 郭志伟's avatar 郭志伟

Merge branch 'pay' into feat/vipLife

parents c3630af1 ebe2eb93
...@@ -3973,9 +3973,9 @@ ...@@ -3973,9 +3973,9 @@
} }
}, },
"crypto-js": { "crypto-js": {
"version": "3.1.9-1", "version": "3.3.0",
"resolved": "http://npmprivate.quantgroups.com/crypto-js/-/crypto-js-3.1.9-1.tgz", "resolved": "http://npmprivate.quantgroups.com/crypto-js/-/crypto-js-3.3.0.tgz",
"integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q=="
}, },
"css": { "css": {
"version": "2.2.4", "version": "2.2.4",
......
...@@ -19,10 +19,11 @@ export default { ...@@ -19,10 +19,11 @@ export default {
}, },
// 订单详情查询接口 // 订单详情查询接口
orderDetail(data) { orderDetail(data) {
return http.get(`${talosHost}/api/kdsp/order-info/virtual-recharge/detail`, data); return http.get(`${talosHost}/api/kdsp/order-info/virtual-recharge/detail`, { params: data });
}, },
// 订单创建 // 订单创建
orderCreate(data) { orderCreate(data) {
return http.post(`${talosHost}/api/kdsp/order-info/e/vmSubmit`, { data: encryption(data) }); console.log(data);
return http.post(`${talosHost}/api/kdsp/order-info/e/vmSubmit`, encryption(data));
} }
}; };
import request from '@/service/httpDecorator'; import request from '@/service/httpDecorator';
import config from '@/config'; import config from '@/config';
import { encryption } from '@/service/encrypt'; import { saDeviceId } from '@/service/sa.service';
const { talosHost } = config; const { talosHost } = config;
const queryPayInfo = function(data) { const queryPayInfo = function(data) {
return request.post(`${talosHost}/open/checkout`, data); return request.post(`${talosHost}/open/checkout`, data);
}; };
const prepay = function(data) { const prepay = async function(data) {
console.log('prepay-param', data); const scDeviceId = await saDeviceId();
return request.post(`${talosHost}/open/checkout/prepay`, data); return request.post(`${talosHost}/open/checkout/prepay`, data, {
customHeader: {
scDeviceId
}
});
}; };
const pay = function(data) { const pay = async function(data) {
return request.post( const scDeviceId = await saDeviceId();
`${talosHost}/open/checkout/pay`, return request.post(`${talosHost}/open/checkout/pay`, data, {
{ data: encryption(data) }, customHeader: {
{ scDeviceId
needScDeviceId: true
} }
); });
}; };
const queryPayStatus = function(data) { const queryPayStatus = function(data) {
......
...@@ -48,6 +48,9 @@ export default { ...@@ -48,6 +48,9 @@ export default {
return this.list.filter((item, index) => index % 2); return this.list.filter((item, index) => index % 2);
} }
}, },
mounted() {
this.onLoad();
},
methods: { methods: {
async onLoad() { async onLoad() {
this.loading = true; this.loading = true;
......
...@@ -20,6 +20,7 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') ...@@ -20,6 +20,7 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
.install(); .install();
} }
Vue.prototype.util = new Bridge(); Vue.prototype.util = new Bridge();
window.Bridge = Bridge;
saService.init(router); saService.init(router);
......
...@@ -39,6 +39,7 @@ export function encryption(data = '') { ...@@ -39,6 +39,7 @@ export function encryption(data = '') {
* @return {String} 加密后的数据16进制 * @return {String} 加密后的数据16进制
*/ */
export async function encryptByDESModeEBC(message) { export async function encryptByDESModeEBC(message) {
console.log(message);
const [{ payPwdSalt }] = await desSalt(); const [{ payPwdSalt }] = await desSalt();
var keyHex = CryptoJS.enc.Utf8.parse(payPwdSalt); var keyHex = CryptoJS.enc.Utf8.parse(payPwdSalt);
var encrypted = CryptoJS.DES.encrypt(message, keyHex, { var encrypted = CryptoJS.DES.encrypt(message, keyHex, {
......
import HttpRequest from '@qg/ui-request'; import HttpRequest from '@qg/ui-request';
import { Toast } from '@qg/cherry-ui'; import { Toast } from '@qg/cherry-ui';
import store from '@/store'; import store from '@/store';
import { appVersion } from '@/service/validation.service';
const http = new HttpRequest( const http = new HttpRequest(
{}, {},
{}, {
headers: {
'x-user-terminal': 'H5',
version: appVersion || '7.9.0'
}
},
function(msg) { function(msg) {
Toast(msg); Toast(msg);
}, },
......
import { isAndroid, isIOS } from './validation.service'; import { isAndroid, isIOS, isApp } from './validation.service';
import Clipboard from 'clipboard'; import Clipboard from 'clipboard';
/** /**
...@@ -378,3 +378,54 @@ export function setClipboardData( ...@@ -378,3 +378,54 @@ export function setClipboardData(
fakeEl.click(); fakeEl.click();
document.body.removeChild(fakeEl); document.body.removeChild(fakeEl);
} }
export function getTokenFromNative() {
return new Promise((resolve, reject) => {
if (!isApp) {
reject();
console.log('not app or wxmp');
navToDlApp();
return;
}
const nativeBridge = new window.Bridge();
window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res;
if (json.event === 'getTokenSuccess') {
const appData = json.data || {};
if (appData && appData.token) {
localStorage.set('vccToken', appData.token);
resolve(true);
} else {
reject();
}
} else {
reject();
}
};
nativeBridge.getToken();
});
}
export function navToDlApp() {
window.location.href = 'xyqb://openApp';
setTimeout(() => {
window.location.href = APP_DOWN_URL;
const nextPage = document.createElement('a');
nextPage.setAttribute('href', APP_DOWN_URL);
nextPage.click();
}, 2000);
}
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);
flag = false;
setTimeout(() => {
flag = true;
}, wait);
}
};
}
<template> <template>
<p class="center-phone"> <div class="center-phone">
<span v-if="rechargeTel" class="center-phone-location" <span v-if="rechargeTel" class="center-phone-location"
>{{ isDefaultphone ? '默认号码' : '未知号码' >{{ isDefaultphone ? '默认号码' : '未知号码'
}}{{ phoneNoHome ? `(${phoneNoHome})` : '' }}</span }}{{ phoneNoHome ? `(${phoneNoHome})` : '' }}</span
...@@ -12,7 +12,19 @@ ...@@ -12,7 +12,19 @@
@input="changeTelFormat" @input="changeTelFormat"
@blur="searchPhoneNoHome" @blur="searchPhoneNoHome"
/> />
</p> <div class="center-phone__list" :class="{ show: inputBlur }">
<div
v-for="(item, index) in list"
:key="index"
class="center-phone__list-item"
@click="searchPhoneNoHome(item)"
>
<span class="phone">{{ phoneFormat(item.phone) }}</span>
<span class="phone-home">{{ item.home }}</span>
<span v-if="index === 0" class="current">上次充值</span>
</div>
</div>
</div>
</template> </template>
<script> <script>
import api from '@/api/recharge.api'; import api from '@/api/recharge.api';
...@@ -20,12 +32,14 @@ import { phoneFormat, phoneTrim, checkPhoneFormat } from '@/service/utils.servic ...@@ -20,12 +32,14 @@ import { phoneFormat, phoneTrim, checkPhoneFormat } from '@/service/utils.servic
const { getPhoneHome } = api; const { getPhoneHome } = api;
export default { export default {
props: { props: {
userPhoneInfo: Object userPhoneInfo: Object,
list: Array
}, },
data() { data() {
return { return {
phoneNoHome: null, phoneNoHome: null,
rechargeTel: null rechargeTel: null,
inputBlur: false
}; };
}, },
computed: { computed: {
...@@ -43,9 +57,13 @@ export default { ...@@ -43,9 +57,13 @@ export default {
} }
}, },
methods: { methods: {
phoneFormat,
changeTelFormat(phone) { changeTelFormat(phone) {
this.phoneNoHome = ''; this.phoneNoHome = '';
this.rechargeTel = phoneFormat(phone); this.rechargeTel = phoneFormat(phone);
if (this.rechargeTel.length > 12) {
this.queryhome();
}
}, },
async searchPhoneNoHome() { async searchPhoneNoHome() {
if (!this.phoneNo) return; if (!this.phoneNo) return;
...@@ -54,6 +72,9 @@ export default { ...@@ -54,6 +72,9 @@ export default {
this.$emit('input', { phoneNo: '', phoneNoHome: this.phoneNoHome }); this.$emit('input', { phoneNo: '', phoneNoHome: this.phoneNoHome });
return; return;
} }
this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome });
},
async queryhome() {
const [data] = await getPhoneHome(this.phoneNo); const [data] = await getPhoneHome(this.phoneNo);
this.phoneNoHome = data?.phoneHome; this.phoneNoHome = data?.phoneHome;
this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome }); this.$emit('input', { phoneNo: this.phoneNo, phoneNoHome: this.phoneNoHome });
...@@ -63,6 +84,7 @@ export default { ...@@ -63,6 +84,7 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.center { .center {
position: relative;
&-phone { &-phone {
border-bottom: @border-width-base solid @gray-2; border-bottom: @border-width-base solid @gray-2;
.cr-cell__title { .cr-cell__title {
...@@ -80,6 +102,44 @@ export default { ...@@ -80,6 +102,44 @@ export default {
&-field { &-field {
text-indent: -2px; text-indent: -2px;
} }
&__list {
// display: none;
position: absolute;
top: 50px;
left: -@padding-lg;
right: -@padding-lg;
z-index: 3;
background-color: @white;
box-shadow: 0px 7px 12px 0px rgba(0, 0, 0, 0.1);
&.show {
display: block;
}
&-item {
display: flex;
align-items: center;
padding: @padding-lg / 2 @padding-lg;
.phone {
color: @text-color;
.text-14();
margin-right: @padding-xs;
}
.phone-home {
color: @text-color;
.text-12();
max-width: 180px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
flex-shrink: 0;
overflow: hidden;
}
.current {
color: @text-grey;
.text-10();
margin-left: auto;
}
}
}
} }
} }
</style> </style>
...@@ -54,11 +54,12 @@ export default { ...@@ -54,11 +54,12 @@ export default {
this.phoneRecharge[`${name}SpuNo`], this.phoneRecharge[`${name}SpuNo`],
this.phoneRecharge[`${name}Type`] this.phoneRecharge[`${name}Type`]
); );
this.$emit('changeRechargetype', name);
this.rechargeList[name] = data?.rechargeList || []; this.rechargeList[name] = data?.rechargeList || [];
}, },
handleSkuSelected(item) { handleSkuSelected(item) {
this.selectedRechargeInfo = item; this.selectedRechargeInfo = item;
this.$emit('selectedRecharge', item); this.$emit('selectedRecharge', { rechargeInfo: item });
} }
} }
}; };
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
</div> </div>
</template> </template>
<script> <script>
import { getTokenFromNative } from '@/service/utils.service';
import localStorage from '@/service/localStorage.service';
export default { export default {
props: { props: {
value: Array value: Array
...@@ -43,7 +45,11 @@ export default { ...@@ -43,7 +45,11 @@ export default {
} }
}); });
}, },
goOrderList() { async goOrderList() {
const token = localStorage.get('vccToken');
if (!token) {
await getTokenFromNative();
}
this.$router.push({ name: 'orderList' }); this.$router.push({ name: 'orderList' });
} }
} }
......
...@@ -13,4 +13,10 @@ ...@@ -13,4 +13,10 @@
.text-18(); .text-18();
} }
} }
.slowRechargeTip{
.text-12();
color: @gray-4;
text-align: center;
margin-bottom: @padding-sm;
}
} }
\ No newline at end of file
...@@ -2,8 +2,19 @@ ...@@ -2,8 +2,19 @@
<div class="home"> <div class="home">
<RechargeTop v-model="vipLife" /> <RechargeTop v-model="vipLife" />
<div class="center"> <div class="center">
<RechargeInput v-model="rechargePhoneInfo" :user-phone-info="userPhoneInfo" /> <RechargeInput
<RechargeList :phone-recharge="phoneRecharge" @selectedRecharge="selectedRecharge" /> v-model="rechargePhoneInfo"
:user-phone-info="userPhoneInfo"
:list="historyRecordList"
/>
<RechargeList
:phone-recharge="phoneRecharge"
@selectedRecharge="selectedRecharge"
@changeRechargetype="rechargeType = $event"
/>
<p v-if="rechargeType === 'slowRecharge'" class="slowRechargeTip">
充值后预计最迟48小时内到账,请耐心等待
</p>
<cr-button <cr-button
block block
type="primary" type="primary"
...@@ -24,6 +35,7 @@ import RechargeTop from './components/RechargeTop.vue'; ...@@ -24,6 +35,7 @@ import RechargeTop from './components/RechargeTop.vue';
import RechargeList from './components/RechargeList.vue'; import RechargeList from './components/RechargeList.vue';
import RechargeInput from './components/RechargeInput.vue'; import RechargeInput from './components/RechargeInput.vue';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import { getTokenFromNative, throttle } from '@/service/utils.service';
const { getSpuList } = api; const { getSpuList } = api;
export default { export default {
components: { components: {
...@@ -37,7 +49,8 @@ export default { ...@@ -37,7 +49,8 @@ export default {
rechargeAmount: 0, rechargeAmount: 0,
phoneRecharge: {}, phoneRecharge: {},
userPhoneInfo: {}, userPhoneInfo: {},
rechargeType: null, rechargeType: 'recharge',
historyRecordList: [{}, {}],
rechargePhoneInfo: {}, rechargePhoneInfo: {},
selectedRechargeInfo: {} selectedRechargeInfo: {}
}; };
...@@ -47,7 +60,9 @@ export default { ...@@ -47,7 +60,9 @@ export default {
return this.rechargePhoneInfo.phoneNo && this.selectedRechargeInfo.salePrice; return this.rechargePhoneInfo.phoneNo && this.selectedRechargeInfo.salePrice;
} }
}, },
created() {}, created() {
this.goOrder = throttle.call(this, this.goOrderApi, 1000);
},
async mounted() { async mounted() {
const [data] = await getSpuList(); const [data] = await getSpuList();
if (data) { if (data) {
...@@ -59,13 +74,21 @@ export default { ...@@ -59,13 +74,21 @@ export default {
} }
}, },
methods: { methods: {
selectedRecharge(item) { throttle,
this.selectedRechargeInfo = item; selectedRecharge({ rechargeInfo }) {
this.selectedRechargeInfo = rechargeInfo;
}, },
async goOrder() { async goOrderApi() {
/* 需要加防抖 */
const { skuNo, salePrice } = this.selectedRechargeInfo; const { skuNo, salePrice } = this.selectedRechargeInfo;
const token = localStorage.get('vccToken');
if (!token) {
await getTokenFromNative();
}
const [res] = await orderApi.orderCreate({ const [res] = await orderApi.orderCreate({
totalFee: salePrice, totalFee: salePrice,
terminal: 'H5',
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: [
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div v-if="it.count" class="Ol__body-row"> <div v-if="it.count" class="Ol__body-row">
<span class="Ol__body-count">{{ it.count }}</span> <span class="Ol__body-count">{{ it.count }}</span>
</div> </div>
<div class="Ol__body-skus"> <div v-if="it.virtualChargeAttrs" class="Ol__body-skus">
<div v-if="it.virtualChargeAttrs.account" class="Ol__body-sku"> <div v-if="it.virtualChargeAttrs.account" class="Ol__body-sku">
<span>充值帐户:</span> <span>充值帐户:</span>
<span class="Ol__body-val">{{ it.virtualChargeAttrs.account }}</span> <span class="Ol__body-val">{{ it.virtualChargeAttrs.account }}</span>
......
...@@ -44,22 +44,22 @@ export default { ...@@ -44,22 +44,22 @@ export default {
...JSON.parse(JSON.stringify(commonParams)) ...JSON.parse(JSON.stringify(commonParams))
}, },
{ {
state: 1, state: 11,
title: '待付款', title: '待付款',
...JSON.parse(JSON.stringify(commonParams)) ...JSON.parse(JSON.stringify(commonParams))
}, },
{ {
state: 2, state: 21,
title: '待发货', title: '待发货',
...JSON.parse(JSON.stringify(commonParams)) ...JSON.parse(JSON.stringify(commonParams))
}, },
{ {
state: 3, state: 31,
title: '待收货', title: '待收货',
...JSON.parse(JSON.stringify(commonParams)) ...JSON.parse(JSON.stringify(commonParams))
}, },
{ {
state: 4, state: 41,
title: '已完成', title: '已完成',
...JSON.parse(JSON.stringify(commonParams)) ...JSON.parse(JSON.stringify(commonParams))
} }
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
if (finished) return; if (finished) return;
this.setNavListData('loading', true); this.setNavListData('loading', true);
const [res] = await orderApi.orderList({ const [res] = await orderApi.orderList({
page, pageNo: page,
pageSize, pageSize,
orderStatus orderStatus
}); });
......
...@@ -71,7 +71,7 @@ function isDetentionFn() { ...@@ -71,7 +71,7 @@ function isDetentionFn() {
this.creditPayList.isGroupPay this.creditPayList.isGroupPay
) { ) {
this.$dialog({ this.$dialog({
message: '使用组合支付部分金额可免使用40天哦!', message: '使用组合支付部分金额可免使用40天哦!',
confirmButtonText: '组合支付', confirmButtonText: '组合支付',
cancelButtonText: '继续支付', cancelButtonText: '继续支付',
confirmButtonColor: '#EC1500', confirmButtonColor: '#EC1500',
...@@ -96,7 +96,7 @@ function isDetentionFn() { ...@@ -96,7 +96,7 @@ function isDetentionFn() {
!this.creditPayList.isGroupPay !this.creditPayList.isGroupPay
) { ) {
this.$dialog({ this.$dialog({
message: '使用享花卡支付可免使用40天哦', message: '使用享花卡支付可免使用40天哦',
confirmButtonText: '享花卡支付', confirmButtonText: '享花卡支付',
cancelButtonText: '继续支付', cancelButtonText: '继续支付',
confirmButtonColor: '#EC1500', confirmButtonColor: '#EC1500',
......
...@@ -49,14 +49,7 @@ export default { ...@@ -49,14 +49,7 @@ export default {
align-items: flex-start; align-items: flex-start;
color: @gray-5; color: @gray-5;
.text-10; .text-10;
&-checkbox {
// margin-right: 2px;
// height: 14px;
}
&-list { &-list {
display: inline-flex;
justify-content: flex-start;
flex-wrap: wrap;
color: @gray-5; color: @gray-5;
span { span {
color: @red; color: @red;
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
</div> </div>
<p>{{ value.accountStatusDesc }}</p> <p>{{ value.accountStatusDesc }}</p>
</div> </div>
<!-- <p v-if="isGroupPay && value.mergePayPretreatmentInfo" class="content-info-amount">
{{ value.mergePayPretreatmentInfo && value.mergePayPretreatmentInfo.creditPayAmt }}.00
</p> -->
</div> </div>
<div <div
v-if="showCoupon && value.payType === 1" v-if="showCoupon && value.payType === 1"
......
<template> <template>
<div class="pay"> <div class="pay">
<!-- 支付倒计时 --> <!-- 支付倒计时 -->
<div class="price-box"> <div v-if="success" class="price-box">
<p class="price">{{ displayInfo.orderAmt }}100</p> <p class="price">{{ displayInfo.orderAmt }}</p>
<p v-if="!overtime" class="time"> <p v-if="!overtime" class="time">
支付剩余时间: 支付剩余时间:
<cr-count-down :time="displayInfo.periodSeconds" @finish="timeup" /> <cr-count-down :time="displayInfo.periodSeconds" @finish="timeup" />
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<!-- 推荐信用支付 --> <!-- 推荐信用支付 -->
<cr-pay-card <cr-pay-card
v-if="getObjectKey(creditPayList.payList).length"
v-model="creditPayList" v-model="creditPayList"
:pay-type="payType" :pay-type="payType"
:disabled="overtime" :disabled="overtime"
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
<!-- 其他支付方式 --> <!-- 其他支付方式 -->
<cr-pay-card <cr-pay-card
v-if="getObjectKey(thirdPayList.payList).length"
v-model="thirdPayList" v-model="thirdPayList"
:pay-type="payType" :pay-type="payType"
:disabled="overtime" :disabled="overtime"
...@@ -54,7 +56,7 @@ ...@@ -54,7 +56,7 @@
</cr-button> </cr-button>
</p> </p>
<p v-if="overtime" class="btn"> <p v-if="overtime" class="btn">
<cr-button type="default" class="btn-default" @click="goOrderDetail">查看订单</cr-button> <cr-button type="default" class="btn-default" @click="goOrderDetail">我的订单</cr-button>
<cr-button type="primary" class="btn-primary" @click="goHome">返回商城</cr-button> <cr-button type="primary" class="btn-primary" @click="goHome">返回商城</cr-button>
</p> </p>
<p class="placeholder" /> <p class="placeholder" />
...@@ -98,16 +100,14 @@ import { isWechat } from '@/service/validation.service'; ...@@ -98,16 +100,14 @@ import { isWechat } from '@/service/validation.service';
import { encryptByDESModeEBC } from '@/service/encrypt'; import { encryptByDESModeEBC } from '@/service/encrypt';
import { registeredEvents } from '@/service/sa.service'; import { registeredEvents } from '@/service/sa.service';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import { throttle } from '@/service/utils.service';
import { import {
status,
codeArr, codeArr,
payTypeE, payTypeE,
PAY_PAYING,
CREDIT_PAY, CREDIT_PAY,
WECHAT_PAY, WECHAT_PAY,
ALIPAY_PAY, ALIPAY_PAY,
PAY_SUCCESS, PAY_SUCCESS,
payTypeText,
creditStatus, creditStatus,
IS_THIRD_PAY, IS_THIRD_PAY,
IS_GROUP_PAY, IS_GROUP_PAY,
...@@ -148,12 +148,13 @@ export default { ...@@ -148,12 +148,13 @@ export default {
error: '', error: '',
random: '', random: '',
orderNo: '', orderNo: '',
success: false,
payType: null, payType: null,
isReady: false, isReady: false,
overtime: false, overtime: false,
pwdModal: false, pwdModal: false,
smsModal: false, smsModal: false,
showCoupon: true, showCoupon: false,
flowOrderNo: null, flowOrderNo: null,
couponPopup: false, couponPopup: false,
showGoFaceTip: false, // h5支付活体提示怎么处理 showGoFaceTip: false, // h5支付活体提示怎么处理
...@@ -218,6 +219,12 @@ export default { ...@@ -218,6 +219,12 @@ export default {
if (error) return; if (error) return;
this.isReady = true; this.isReady = true;
const { displayInfo = {}, payMethods } = data || {}; const { displayInfo = {}, payMethods } = data || {};
this.overtime = displayInfo.periodSeconds <= 0;
this.success = true;
if (this.overtime) {
this.displayInfo.orderAmt = displayInfo.orderAmt;
return;
}
if (displayInfo.payCouponInfo && displayInfo.payCouponInfo.optimalPayCoupon) { if (displayInfo.payCouponInfo && displayInfo.payCouponInfo.optimalPayCoupon) {
this.selectedCoupon = displayInfo.payCouponInfo.optimalPayCoupon; this.selectedCoupon = displayInfo.payCouponInfo.optimalPayCoupon;
this.showCoupon = displayInfo.payCouponInfo.optimalType === 3; this.showCoupon = displayInfo.payCouponInfo.optimalType === 3;
...@@ -274,7 +281,7 @@ export default { ...@@ -274,7 +281,7 @@ export default {
this.displayInfo = displayInfo || {}; this.displayInfo = displayInfo || {};
this.creditPayInfo = displayInfo.creditPayInfo || {}; this.creditPayInfo = displayInfo.creditPayInfo || {};
this.overtime = displayInfo.periodSeconds <= 0; displayInfo.periodSeconds = displayInfo.periodSeconds * 1000;
this.getBtnStatus(this.isRiskLimit()); this.getBtnStatus(this.isRiskLimit());
}, },
checkStatus({ accountStatus, canAmt }, { orderAmt }) { checkStatus({ accountStatus, canAmt }, { orderAmt }) {
...@@ -333,7 +340,7 @@ export default { ...@@ -333,7 +340,7 @@ export default {
}; };
} }
} else { } else {
const txt = `确认付款`; const txt = `确认支付`;
this.accountS = { this.accountS = {
text: txt, text: txt,
fn: this.pay fn: this.pay
...@@ -353,40 +360,10 @@ export default { ...@@ -353,40 +360,10 @@ export default {
} }
}); });
} }
this.payCouponList = [
{
id: 33,
name: '仅新用户购买自营商品',
startDate: '2020.8.6',
endDate: '2021.8.16',
faceValue: 200,
limitAmount: '满99元可用',
couponCategory: 1,
iconUrl: 'http://talos-image-fe.liangkebang.net/pcm/1599553158123.png',
pickupAble: 1
},
{
id: 44,
name: '仅新用户购买自营商品',
startDate: '2020.8.6',
endDate: '2021.8.16',
faceValue: 200,
limitAmount: '满99元可用',
couponCategory: 1,
iconUrl: 'http://talos-image-fe.liangkebang.net/pcm/1599553158123.png',
pickupAble: 1
}
];
}, },
nextAction() { nextAction: throttle(function() {
registeredEvents('PD_YXMMACP_UserClickCashierConfirmPaymentBtn', {
order_id: this.orderNo,
pay_method: payTypeText[this.payType - 1],
vcc_state: status[this.creditPayInfo.accountStatus - 1],
buttons_name: this.accountS.text
});
this.accountS.fn(); this.accountS.fn();
}, }, 1000),
/* 预支付 */ /* 预支付 */
async pay(params) { async pay(params) {
// 组合支付的提示和享花卡支付逻辑 // 组合支付的提示和享花卡支付逻辑
...@@ -405,6 +382,8 @@ export default { ...@@ -405,6 +382,8 @@ export default {
} }
const paramsData = { const paramsData = {
...params, ...params,
quitUrl: `${window.location.origin}/payWaiting`,
returnUrl: `${window.location.origin}/payWaiting`,
ocrAuth: { ocrAuth: {
isH5: true isH5: true
}, },
...@@ -437,14 +416,14 @@ export default { ...@@ -437,14 +416,14 @@ export default {
payByWay('ALIWEB', aliPayInfo); payByWay('ALIWEB', aliPayInfo);
return; return;
} }
// if (creditPayStatus === PAY_PAYING) {
// /* 支付中? */
// this.payResult('Waiting');
// return;
// }
console.log(creditPayStatus);
if (creditPayStatus === PAY_SUCCESS) { if (creditPayStatus === PAY_SUCCESS) {
if (IS_GROUP_PAY(this.payType)) {
//组合支付成功后跳转支付中
this.payResult('Waiting');
return;
}
/* 支付成功 */ /* 支付成功 */
this.close();
this.payResult('Success'); this.payResult('Success');
return; return;
} }
...@@ -461,12 +440,12 @@ export default { ...@@ -461,12 +440,12 @@ export default {
}, },
payResult(type, error) { payResult(type, error) {
const finalAmt = const finalAmt =
this.payType === WECHAT_PAY || !this.showCoupon IS_THIRD_PAY(this.payType) || !this.showCoupon
? this.displayInfo.orderAmt || '0.00' ? this.displayInfo.orderAmt || '0.00'
: (this.displayInfo.orderAmt - this.selectedCoupon.faceValue || 0).toFixed(2); : (this.displayInfo.orderAmt - this.selectedCoupon.faceValue || 0).toFixed(2);
const freeAmount = this.showCoupon ? this.selectedCoupon.faceValue || '0.00' : '0.00'; const freeAmount = this.showCoupon ? this.selectedCoupon.faceValue || '0.00' : '0.00';
/* 跳转支付结果页面 */ /* 跳转支付结果页面 */
this.$router.push({ this.$router.replace({
name: `pay${type}`, name: `pay${type}`,
query: { query: {
freeAmount, freeAmount,
...@@ -531,7 +510,7 @@ export default { ...@@ -531,7 +510,7 @@ export default {
return; return;
} }
const [{ url }] = await h5AppyUrl(); const [{ url }] = await h5AppyUrl();
if (url) return; if (!url) return;
window.location.href = url; window.location.href = url;
}, },
async getKaGetNextUrl() { async getKaGetNextUrl() {
...@@ -563,16 +542,20 @@ export default { ...@@ -563,16 +542,20 @@ export default {
}, },
/* 忘记密码 */ /* 忘记密码 */
retrieveLink() { retrieveLink() {
const url = `${this.creditPayInfo.forgetPwdJumpUrl}&vccChannel=${VCC_CHANNEL}`; let url = `${this.creditPayInfo.forgetPwdJumpUrl}&vccChannel=${VCC_CHANNEL}&redirectUrl=${window.location.href}`;
url = url.replace('{token}', localStorage.get('vccToken'));
window.location.href = url; window.location.href = url;
}, },
goHome() { goHome() {
// 商城地址 // 商城地址
this.$router.push({ name: 'home' }); this.$router.replace({ name: 'home' });
}, },
goOrderDetail() { goOrderDetail() {
this.$router.push({ name: 'orderList' }); this.$router.replace({ name: 'orderList' });
// 订单详情地址 // 订单详情地址
},
getObjectKey(obj) {
return Object.keys(obj);
} }
} }
}; };
......
...@@ -60,7 +60,6 @@ export default { ...@@ -60,7 +60,6 @@ export default {
created() { created() {
const { amount, orderNo, freeAmount, reason } = this.$route.query; const { amount, orderNo, freeAmount, reason } = this.$route.query;
const { success } = this.$route.meta; const { success } = this.$route.meta;
console.log(this.$route.meta);
this.money = amount; this.money = amount;
this.orderNo = orderNo; this.orderNo = orderNo;
this.reason = reason || ''; this.reason = reason || '';
...@@ -77,13 +76,13 @@ export default { ...@@ -77,13 +76,13 @@ export default {
order_id: this.orderNo order_id: this.orderNo
}); });
// 去订单详情页面 // 去订单详情页面
this.$router.push({ name: 'orderList' }); this.$router.replace({ name: 'orderList' });
}, },
goPay() { goPay() {
registeredEvents('PD_YXMMAEC_UserClickCashierPaymentAgainBtn', { registeredEvents('PD_YXMMAEC_UserClickCashierPaymentAgainBtn', {
order_id: this.orderNo order_id: this.orderNo
}); });
this.$router.push({ name: 'pay', query: { order: this.orderNo } }); this.$router.replace({ name: 'pay', query: { orderNo: this.orderNo } });
} }
} }
}; };
......
...@@ -39,31 +39,38 @@ export default { ...@@ -39,31 +39,38 @@ export default {
this.orderNo = orderNo; this.orderNo = orderNo;
}, },
mounted() { mounted() {
this.timer = setInterval(() => { // eslint-disable-next-line space-before-function-paren
this.timer = setInterval(async () => {
this.time -= 1; this.time -= 1;
if (this.time % 2 === 0) { if (this.time % 2 === 0) {
queryPayStatus({ orderNo: this.orderNo }); const [data] = await queryPayStatus({ orderNo: this.orderNo });
if (data.payStatus === 3) {
this.goPay();
}
// 结果处理,如果未支付弹窗提示是否支付成功,跳转支付中页面
} }
if (this.time < 1) { if (this.time < 1) {
clearInterval(this.timer); clearInterval(this.timer);
} }
}, 2000); }, 2000);
}, },
beforeDestroy() {
clearInterval(this.timer);
},
methods: { methods: {
goHome() { goHome() {
// 去页面 // 去页面
this.$router.replace({ name: 'home' });
}, },
goOrderDetail() { goOrderDetail() {
registeredEvents('PD_YXMMAEC_UserClickCashierCheckOrderBtn', { this.$router.replace({ name: 'orderDetail', query: { order: this.orderNo } });
order_id: this.orderNo
});
// 去订单详情页面 // 去订单详情页面
}, },
goPay() { goPay() {
registeredEvents('PD_YXMMAEC_UserClickCashierPaymentAgainBtn', { registeredEvents('PD_YXMMAEC_UserClickCashierPaymentAgainBtn', {
order_id: this.orderNo order_id: this.orderNo
}); });
this.$router.push({ name: 'pay', query: { order: this.orderNo } }); this.$router.replace({ name: 'pay', query: { order: this.orderNo } });
} }
} }
}; };
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
type: Array, type: Array,
default: () => [ default: () => [
{ {
spuNo: '', spuNos: '',
icon: '', icon: '',
name: '' name: ''
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 2; z-index: 9;
right: 0; right: 0;
width: calc(100% - @padding-sm * 2); width: calc(100% - @padding-sm * 2);
background-color: @white; background-color: @white;
......
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
<div class="Vl__panel-tips" v-html="tips" /> <div class="Vl__panel-tips" v-html="tips" />
</template> </template>
</div> </div>
<div v-if="!hideFixedBottom" class="Vl__bottom"> <div class="Vl__bottom">
<cr-button type="primary" block shape="circle" :disabled="disabled" @click="goOrder"> <cr-button type="primary" block shape="circle" :disabled="disabled" @click="goOrder">
立即充值 立即充值
</cr-button> </cr-button>
</div> </div>
<!-- v-show="!hideFixedBottom" -->
</div> </div>
</template> </template>
<script> <script>
...@@ -34,6 +35,7 @@ import tipsData from '@/api/tips'; ...@@ -34,6 +35,7 @@ import tipsData from '@/api/tips';
import SpuList from './components/SpuList.vue'; import SpuList from './components/SpuList.vue';
import SkuList from './components/SkuList.vue'; import SkuList from './components/SkuList.vue';
import AccountInput from './components/AccountInput.vue'; import AccountInput from './components/AccountInput.vue';
import { throttle } from '@/service/utils.service';
export default { export default {
name: 'VipLife', name: 'VipLife',
components: { components: {
...@@ -56,7 +58,7 @@ export default { ...@@ -56,7 +58,7 @@ export default {
}, },
computed: { computed: {
disabled() { disabled() {
return this.spuInfo.rechargeAccountType !== 2 && !this.account; return (this.spuInfo.rechargeAccountType !== 2 && !this.account) || !this.skuList.length;
}, },
spuList() { spuList() {
return this.spuData[this.currentTab - 1] ? this.spuData[this.currentTab - 1].itemList : []; return this.spuData[this.currentTab - 1] ? this.spuData[this.currentTab - 1].itemList : [];
...@@ -82,6 +84,7 @@ export default { ...@@ -82,6 +84,7 @@ export default {
methods: { methods: {
handleTabChange(name) { handleTabChange(name) {
this.currentTab = name; this.currentTab = name;
this.skuInfo = {};
this.updateSpuInfo(this.spuData[this.currentTab - 1].itemList[0]); this.updateSpuInfo(this.spuData[this.currentTab - 1].itemList[0]);
this.getSkuListDebounce(); this.getSkuListDebounce();
}, },
...@@ -122,16 +125,15 @@ export default { ...@@ -122,16 +125,15 @@ export default {
} }
this.showLoading = false; this.showLoading = false;
}, },
async goOrder() { goOrder: throttle(async function() {
if (!this.account && this.spuInfo.rechargeAccountType !== 2) if (!this.account && this.spuInfo.rechargeAccountType !== 2)
return this.$toast.fail('请填写账号!'); return this.$toast.fail('请填写账号!');
if (!this.skuInfo.skuNo) return this.$toast.fail('请选择类型!'); if (!this.skuInfo.skuNo) return this.$toast.fail('请选择类型!');
const { skuNo, salePrice } = this.skuInfo; const { skuNo, salePrice } = this.skuInfo;
const [res] = await orderApi.orderCreate({ const [res] = await orderApi.orderCreate({
account: this.account,
totalFee: salePrice, totalFee: salePrice,
orderCouponIds: '', virtualRechargeType: this.spuInfo.type,
freightCouponIds: '',
virtualRechargeType: this.spuInfo.rechargeAccountType,
skuList: [ skuList: [
{ {
skuNo, skuNo,
...@@ -140,7 +142,7 @@ export default { ...@@ -140,7 +142,7 @@ export default {
] ]
}); });
res && this.$router.push({ path: '/pay', query: { orderNo: res.orderNo } }); res && this.$router.push({ path: '/pay', query: { orderNo: res.orderNo } });
} }, 1000)
} }
}; };
</script> </script>
......
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