init
This commit is contained in:
379
pages_tool/pay/cashier.vue
Normal file
379
pages_tool/pay/cashier.vue
Normal file
@@ -0,0 +1,379 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view class="cashier">
|
||||
<block v-if="payInfo">
|
||||
<block v-if="payInfo.pay_status == 0">
|
||||
<text class="content">{{ payInfo.pay_body }}</text>
|
||||
<view class="money-wrap">
|
||||
<text class="unit price-font">¥</text>
|
||||
<text class="money price-font">{{ payInfo.pay_money | moneyFormat }}</text>
|
||||
</view>
|
||||
|
||||
<block v-if="payTypeList.length > 0">
|
||||
<view class="pay-type">
|
||||
<view class="payment-item" v-for="(item, index) in payTypeList" :key="index" @click="payIndex = index">
|
||||
<view>
|
||||
<text class="iconfont" :class="item.icon"></text>
|
||||
<text class="name">{{ item.name }}</text>
|
||||
</view>
|
||||
<text class="iconfont" :class="payIndex == index ? 'icon-yuan_checked color-base-text' : 'icon-checkboxblank'"></text>
|
||||
</view>
|
||||
</view>
|
||||
<button type="primary" @click="confirm">确认支付</button>
|
||||
</block>
|
||||
<view v-else class="empty">店铺尚未配置支付方式!</view>
|
||||
</block>
|
||||
<ns-empty text="该支付单据已支付" :is-index="true" v-else></ns-empty>
|
||||
</block>
|
||||
<ns-empty text="未获取到支付信息" :is-index="true" v-else></ns-empty>
|
||||
<ns-login ref="login"></ns-login>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Weixin } from 'common/js/wx-jssdk.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
payIndex: 0,
|
||||
// #ifdef H5
|
||||
payTypeList: [
|
||||
{
|
||||
name: '支付宝支付',
|
||||
icon: 'icon-zhifubaozhifu-',
|
||||
type: 'alipay'
|
||||
},
|
||||
{
|
||||
name: '微信支付',
|
||||
icon: 'icon-weixin1',
|
||||
type: 'wechatpay'
|
||||
}
|
||||
],
|
||||
timer: null,
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
payTypeList: [{
|
||||
name: '微信支付',
|
||||
provider: 'wxpay',
|
||||
icon: 'icon-weixin1',
|
||||
type: 'wechatpay'
|
||||
}],
|
||||
// #endif
|
||||
payInfo: null,
|
||||
outTradeNo: ''
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getPayType();
|
||||
this.outTradeNo = option.out_trade_no || '';
|
||||
this.getPayInfo();
|
||||
},
|
||||
methods: {
|
||||
getPayInfo() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/info',
|
||||
data: {
|
||||
out_trade_no: this.outTradeNo
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
this.payInfo = res.data;
|
||||
if (this.payInfo.pay_status == 0) {
|
||||
setTimeout(() => {
|
||||
this.autoPay();
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getPayType() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/type',
|
||||
success: res => {
|
||||
if (res.data.pay_type == '') {
|
||||
this.payTypeList = [];
|
||||
} else {
|
||||
this.payTypeList.forEach((val, key) => {
|
||||
if (res.data.pay_type.indexOf(val.type) == -1) {
|
||||
this.payTypeList.splice(key, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
autoPay(){
|
||||
if (!this.payTypeList.length) return;
|
||||
if (this.$util.isWeiXin()) {
|
||||
this.payTypeList.forEach((item, index) => {
|
||||
if (item.type == 'wechatpay') {
|
||||
this.payIndex = index;
|
||||
this.confirm();
|
||||
}
|
||||
})
|
||||
} else if (/AlipayClient/.test(window.navigator.userAgent)) {
|
||||
this.payTypeList.forEach((item, index) => {
|
||||
if (item.type == 'alipay') {
|
||||
this.payIndex = index;
|
||||
this.confirm();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/pay/cashier?out_trade_no=' + this.outTradeNo);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.payTypeList.length == 0 && this.payInfo.pay_money > 0) {
|
||||
this.$util.showToast({
|
||||
title: '请选择支付方式!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '支付中...',
|
||||
mask: true
|
||||
});
|
||||
this.pay();
|
||||
},
|
||||
// #ifdef H5
|
||||
pay() {
|
||||
var payType = this.payTypeList[this.payIndex];
|
||||
if (!payType) return;
|
||||
|
||||
let returnUrl = encodeURIComponent(this.$config.h5Domain + '/pages_tool/pay/result?code=' + this.payInfo.out_trade_no);
|
||||
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/pay',
|
||||
data: {
|
||||
out_trade_no: this.payInfo.out_trade_no,
|
||||
pay_type: payType.type,
|
||||
return_url: returnUrl
|
||||
},
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.code >= 0) {
|
||||
switch (payType.type) {
|
||||
case 'alipay':
|
||||
if (this.$util.isWeiXin()) {
|
||||
var wx_alipay = encodeURIComponent(res.data.data);
|
||||
this.$util.redirectTo('/pages/pay/wx_pay/wx_pay', { wx_alipay: wx_alipay, out_trade_no: this.payInfo.out_trade_no }, 'redirectTo');
|
||||
} else {
|
||||
location.href = res.data.data;
|
||||
this.checkPayStatus();
|
||||
}
|
||||
break;
|
||||
case 'wechatpay':
|
||||
if (this.$util.isWeiXin()) {
|
||||
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||
var url = uni.getStorageSync('initUrl');
|
||||
} else {
|
||||
var url = location.href;
|
||||
}
|
||||
// 获取jssdk配置
|
||||
this.$api.sendRequest({
|
||||
url: '/wechat/api/wechat/jssdkconfig',
|
||||
data: { url: url },
|
||||
success: jssdkRes => {
|
||||
var wxJS = new Weixin(),
|
||||
payData = res.data.data;
|
||||
wxJS.init(jssdkRes.data);
|
||||
wxJS.pay(
|
||||
{
|
||||
timestamp: payData.timestamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign
|
||||
},
|
||||
res => {
|
||||
if (res.errMsg == 'chooseWXPay:ok') {
|
||||
if (!this.back) this.$util.redirectTo('/pages_tool/pay/result', { code: this.payInfo.out_trade_no }, 'redirectTo');
|
||||
else location.replace(this.back + '/pages_tool/pay/result?code=' + this.payInfo.out_trade_no);
|
||||
} else {
|
||||
this.$util.showToast({ title: res.errMsg });
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
location.href = res.data.url;
|
||||
this.checkPayStatus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.$util.showToast({ title: res.message });
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
uni.hideLoading();
|
||||
this.$util.showToast({ title: 'request:fail' });
|
||||
}
|
||||
});
|
||||
},
|
||||
checkPayStatus() {
|
||||
this.timer = setInterval(() => {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/status',
|
||||
data: { out_trade_no: this.payInfo.out_trade_no },
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.pay_status == 2) {
|
||||
clearInterval(this.timer);
|
||||
this.$util.redirectTo('/pages_tool/pay/result', { code: this.payInfo.out_trade_no }, 'redirectTo');
|
||||
}
|
||||
} else {
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
pay() {
|
||||
var payType = this.payTypeList[this.payIndex];
|
||||
if (!payType) return;
|
||||
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/pay',
|
||||
data: {
|
||||
out_trade_no: this.payInfo.out_trade_no,
|
||||
pay_type: payType.type
|
||||
},
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.code >= 0) {
|
||||
var payData = res.data.data;
|
||||
uni.requestPayment({
|
||||
provider: payType.provider,
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
success: res => {
|
||||
this.$util.redirectTo('/pages_tool/pay/result', { code: this.payInfo.out_trade_no }, 'redirectTo');
|
||||
},
|
||||
fail: res => {
|
||||
this.flag = false;
|
||||
if (res.errMsg == 'requestPayment:fail cancel') {
|
||||
this.$util.showToast({ title: '您已取消支付' });
|
||||
} else {
|
||||
uni.showModal({ content: '支付失败,失败原因: ' + res.errMsg, showCancel: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$util.showToast({ title: res.message });
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
uni.hideLoading();
|
||||
this.$util.showToast({ title: 'request:fail' });
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
watch: {
|
||||
storeToken: function(nVal, oVal) {
|
||||
if (nVal) {
|
||||
this.getPayInfo();
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
/**
|
||||
* 金额格式化输出
|
||||
* @param {Object} money
|
||||
*/
|
||||
moneyFormat(money) {
|
||||
return parseFloat(money).toFixed(2);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.cashier {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 80rpx 26rpx;
|
||||
.content {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
padding: 0 60rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.money-wrap {
|
||||
font-weight: bold;
|
||||
margin: 40rpx 0;
|
||||
.unit {
|
||||
font-size: 40rpx;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
.money {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.pay-type {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
.payment-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 90rpx;
|
||||
border-bottom: 2rpx solid $color-line;
|
||||
padding: 20rpx 30rpx;
|
||||
&:last-of-type {
|
||||
border-bottom: none;
|
||||
}
|
||||
> view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.name {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 64rpx;
|
||||
}
|
||||
.icon-weixin1 {
|
||||
color: #24af41;
|
||||
}
|
||||
.icon-zhifubaozhifu- {
|
||||
color: #00a0e9;
|
||||
}
|
||||
.icon-yuan_checked {
|
||||
font-size: 40rpx;
|
||||
color: $base-color;
|
||||
}
|
||||
.icon-checkboxblank {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
margin-top: 80rpx !important;
|
||||
background: $base-color;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 90rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
133
pages_tool/pay/index.vue
Normal file
133
pages_tool/pay/index.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<scroll-view scroll-y="true" class="pay-container">
|
||||
<view class="payment-amount">
|
||||
<text class="amount-tit">{{ $lang('paymentAmount') }}</text>
|
||||
<view class="amount-num">
|
||||
{{ $lang('common.currencySymbol') }}
|
||||
<text>{{ payInfo.pay_money }}</text>
|
||||
</view>
|
||||
<view class="payment-name">{{ payInfo.pay_body }}</view>
|
||||
</view>
|
||||
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isIphoneX: false,
|
||||
payInfo: {},
|
||||
outTradeNo: '',
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
if (option.code) this.outTradeNo = option.code;
|
||||
this.isIphoneX = this.$util.uniappIsIPhoneX();
|
||||
},
|
||||
onShow() {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
} else {
|
||||
this.getPayInfo();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPayInfo() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/info',
|
||||
data: {
|
||||
out_trade_no: this.outTradeNo
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
this.payInfo = res.data;
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: '未获取到支付信息!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.pay-container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
@mixin flex-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
@mixin flex-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.payment-amount {
|
||||
@include flex-column;
|
||||
margin: $margin-updown $margin-both;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx 0 58rpx 0;
|
||||
background-color: #fff;
|
||||
.amount-tit {
|
||||
font-size: $font-size-base;
|
||||
color: #838383;
|
||||
line-height: 1;
|
||||
margin-top: 44rpx;
|
||||
}
|
||||
.amount-num {
|
||||
color: #000;
|
||||
margin-top: 36rpx;
|
||||
line-height: 1;
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
.amount-desc {
|
||||
font-size: $font-size-tag;
|
||||
color: #838383;
|
||||
padding: 0 40rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.payment-name {
|
||||
width: 90%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: #838383;
|
||||
margin-top: 30rpx;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
344
pages_tool/pay/result.vue
Normal file
344
pages_tool/pay/result.vue
Normal file
@@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view class="container">
|
||||
<template v-if="payInfo.pay_status != undefined">
|
||||
<view class="result-box">
|
||||
<template v-if="payInfo.pay_status">
|
||||
<image :src="$util.img('public/uniapp/pay/pay_success.png')" mode="widthFix" lazy-load="true" class="result-image"/>
|
||||
<view class="msg success">{{ $lang('paymentSuccess') }}</view>
|
||||
<view class="pay-amount">
|
||||
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
|
||||
<text class="price-style large">{{ parseFloat(payInfo.pay_money).toFixed(2).split(".")[0] }}</text>
|
||||
<text class="price-style small">.{{ parseFloat(payInfo.pay_money).toFixed(2).split(".")[1] }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image :src="$util.img('public/uniapp/pay/pay_fail.png')" mode="widthFix" class="result-image"/>
|
||||
<view class="msg fail">{{ $lang('paymentFail') }}</view>
|
||||
</template>
|
||||
|
||||
<view class="consume-box" v-if="addonIsExist.memberconsume && consumeStatus == 1 && payInfo.pay_status">
|
||||
<view class="consume-head">
|
||||
<view class="consume-head-text">恭喜您获得</view>
|
||||
</view>
|
||||
<view class="consume-list">
|
||||
<view class="consume-item" v-if="consumeInfo.point_num > 0">
|
||||
<image :src="$util.img('public/uniapp/pay/point.png')" mode="widthFix"></image>
|
||||
<view class="consume-value color-base-text">{{ consumeInfo.point_num }}</view>
|
||||
<view class="consume-type">积分</view>
|
||||
</view>
|
||||
<view class="consume-item" v-if="consumeInfo.growth_num > 0">
|
||||
<image :src="$util.img('public/uniapp/pay/growth.png')" mode="widthFix"></image>
|
||||
<view class="consume-value color-base-text">{{ consumeInfo.growth_num }}</view>
|
||||
<view class="consume-type">成长值</view>
|
||||
</view>
|
||||
<view class="consume-item" v-if="consumeInfo.coupon_list.length > 0">
|
||||
<image :src="$util.img('public/uniapp/pay/coupon.png')" mode="widthFix"></image>
|
||||
<view class="consume-value color-base-text">{{ consumeInfo.coupon_list.length }}</view>
|
||||
<view class="consume-type">张优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="action">
|
||||
<template v-if="storeToken">
|
||||
<view v-if="paySource == 'recharge'" class="btn" @click="toRecharge()">充值记录</view>
|
||||
<view v-else-if="paySource == 'membercard'" class="btn" @click="toCard()">会员卡</view>
|
||||
<view v-else-if="paySource == 'presale'" class="btn" @click="toPresaleOrder()">查看订单</view>
|
||||
<view v-else-if="paySource == 'giftcard'" class="btn" @click="toOrder()">查看订单</view>
|
||||
<view v-else-if="paySource == 'pointexchange'" class="btn" @click="toExchangeOrder()">查看订单
|
||||
</view>
|
||||
<view v-else class="btn" @click="toOrderDetail(payInfo.order_id)">查看订单</view>
|
||||
</template>
|
||||
<view class="btn go-home" @click="goHome()">{{ $lang('goHome') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<ns-goods-recommend route="pay"></ns-goods-recommend>
|
||||
</template>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
payInfo: {},
|
||||
outTradeNo: '',
|
||||
paySource: '',
|
||||
consumeInfo: {},
|
||||
consumeStatus: 0,
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
if (option.code) this.outTradeNo = option.code;
|
||||
this.paySource = uni.getStorageSync('paySource');
|
||||
},
|
||||
onShow() {
|
||||
this.getPayInfo();
|
||||
this.getConsume();
|
||||
},
|
||||
methods: {
|
||||
consume(type) {
|
||||
switch (type) {
|
||||
case 'point':
|
||||
this.$util.redirectTo('/pages_tool/member/point_detail', {});
|
||||
break;
|
||||
case 'growth':
|
||||
this.$util.redirectTo('/pages_tool/member/level', {});
|
||||
break;
|
||||
case 'coupon':
|
||||
this.$util.redirectTo('/pages_tool/member/coupon', {});
|
||||
break;
|
||||
default:
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
break;
|
||||
}
|
||||
},
|
||||
getConsume() {
|
||||
this.$api.sendRequest({
|
||||
url: '/memberconsume/api/config/info',
|
||||
data: {
|
||||
out_trade_no: this.outTradeNo
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
let reward = res.data.value;
|
||||
if (res.data.is_use && (reward.point_num > 0 || reward.growth_num > 0 || reward.coupon_list.length)) {
|
||||
this.consumeStatus = res.data.is_use;
|
||||
this.consumeInfo = res.data.value;
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
getPayInfo() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/info',
|
||||
data: {
|
||||
out_trade_no: this.outTradeNo
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
this.payInfo = res.data;
|
||||
this.payInfo.pay_money = parseFloat(res.data.pay_money);
|
||||
this.payInfo.pay_money += parseFloat(res.data.balance);
|
||||
this.payInfo.pay_money += parseFloat(res.data.balance_money);
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: '未获取到支付信息!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch');
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
goHome() {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch');
|
||||
},
|
||||
toOrderDetail(id) {
|
||||
if (this.payInfo.order_type == 2) {
|
||||
this.$util.redirectTo('/pages/order/detail_pickup', {
|
||||
order_id: id
|
||||
}, 'redirectTo');
|
||||
} else if (this.payInfo.order_type == 3) {
|
||||
this.$util.redirectTo('/pages/order/detail_local_delivery', {
|
||||
order_id: id
|
||||
}, 'redirectTo');
|
||||
} else if (this.payInfo.order_type == 4) {
|
||||
this.$util.redirectTo('/pages_tool/order/detail_virtual', {
|
||||
order_id: id
|
||||
}, 'redirectTo');
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/order/detail', {
|
||||
order_id: id
|
||||
}, 'redirectTo');
|
||||
}
|
||||
},
|
||||
toOrder(id) {
|
||||
this.$util.redirectTo('/pages_promotion/giftcard/order_list', {}, 'redirectTo');
|
||||
uni.setStorageSync('paySource', '');
|
||||
},
|
||||
toRecharge() {
|
||||
this.$util.redirectTo('/pages_tool/recharge/order_list', {}, 'redirectTo');
|
||||
uni.setStorageSync('paySource', '');
|
||||
},
|
||||
toCard() {
|
||||
this.$util.redirectTo('/pages_tool/member/card', {}, 'redirectTo');
|
||||
uni.setStorageSync('paySource', '');
|
||||
},
|
||||
toPresaleOrder() {
|
||||
this.$util.redirectTo('/pages_promotion/presale/order_list', {}, 'redirectTo');
|
||||
uni.setStorageSync('paySource', '');
|
||||
},
|
||||
toExchangeOrder() {
|
||||
this.$util.redirectTo('/pages_promotion/point/order_list', {}, 'redirectTo');
|
||||
uni.setStorageSync('paySource', '');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.consume-box {
|
||||
padding: $padding;
|
||||
background: #F8F8F8;
|
||||
width: calc(100% - 48rpx);
|
||||
margin: 0 24rpx 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx;
|
||||
|
||||
.consume-head {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
|
||||
.consume-head-text {
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.consume-list {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.consume-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: $color-title;
|
||||
font-size: $font-size-base;
|
||||
margin-top: 10rpx;
|
||||
|
||||
image {
|
||||
width: 24rpx;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.consume-value {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.consume-remark {
|
||||
color: $color-tip;
|
||||
font-size: $font-size-tag;
|
||||
padding: 10rpx 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.result-box {
|
||||
padding-top: 94rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #FFFFFF;
|
||||
width: 100%;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.result-image {
|
||||
width: 80rpx;
|
||||
height: auto;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.msg {
|
||||
font-size: 32rpx;
|
||||
margin-top: 25rpx;
|
||||
|
||||
&.success {
|
||||
color: #09BB07;
|
||||
}
|
||||
|
||||
&.fail {
|
||||
color: #FF4646;
|
||||
}
|
||||
}
|
||||
|
||||
.pay-amount {
|
||||
font-size: 30rpx;
|
||||
margin: 40rpx 0 24rpx 0;
|
||||
font-weight: 600;
|
||||
line-height: 50rpx;
|
||||
|
||||
text {
|
||||
color: #333333 !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.unit {
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.large {
|
||||
font-size: 60rpx !important;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
.action {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.btn {
|
||||
font-size: 30rpx;
|
||||
width: 200rpx;
|
||||
height: 66rpx;
|
||||
line-height: 66rpx;
|
||||
text-align: center;
|
||||
border-radius: 66rpx;
|
||||
border: 1px solid $color-tip;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:last-child {
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.go-home {
|
||||
background-color: $base-color;
|
||||
color: #fff;
|
||||
border-color: $base-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .goods-recommend {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
</style>
|
||||
94
pages_tool/pay/wx_pay.vue
Normal file
94
pages_tool/pay/wx_pay.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view class="launch-mask" v-if="show == true">
|
||||
<view class="mask-img">
|
||||
<image :src="$util.img('public/uniapp/pay/invite_friends_share.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="mask-word">点击右上角跳转到浏览器打开</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'wx_pay',
|
||||
data() {
|
||||
return {
|
||||
show : true,
|
||||
wx_alipay : "",
|
||||
out_trade_no : ""
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.wx_alipay = options.wx_alipay || '';
|
||||
this.out_trade_no = options.out_trade_no || '';
|
||||
if(!this.$util.isWeiXin() && this.wx_alipay){
|
||||
this.show = false;
|
||||
location.href = this.wx_alipay;
|
||||
}
|
||||
this.checkPayStatus();
|
||||
},
|
||||
methods: {
|
||||
getPayInfo(out_trade_no) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/pay/info',
|
||||
data: {
|
||||
out_trade_no
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
this.checkPayStatus();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
checkPayStatus() {
|
||||
var that = this;
|
||||
var timer = setInterval(() => {
|
||||
that.$api.sendRequest({
|
||||
url: '/api/pay/status',
|
||||
data: { out_trade_no: that.out_trade_no },
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.pay_status == 2) {
|
||||
clearInterval(timer);
|
||||
that.$util.redirectTo('/pages_tool/pay/result', { code: that.out_trade_no }, '', 'redirectTo');
|
||||
}
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.launch-mask{
|
||||
position:fixed;
|
||||
top:0px;
|
||||
left: 0px;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
background:rgba(0,0,0,0.8);
|
||||
.mask-img{
|
||||
text-align: right;
|
||||
margin:10% 10px 10px 30px;
|
||||
image{
|
||||
width: 50px;
|
||||
height:117px;
|
||||
margin-right:9%
|
||||
}
|
||||
}
|
||||
.mask-word{
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
text{
|
||||
color:#FF0036 !important
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user