|
@@ -1,36 +1,29 @@
|
|
|
<template>
|
|
|
<view :style="colorStyle">
|
|
|
<view class="flex-col flex-center py-78">
|
|
|
- <baseMoney :money="payPriceShow" symbolSize="48" integerSize="64" decimalSize="48" color="#333" weight></baseMoney>
|
|
|
+ <baseMoney :money="payPriceShow" symbolSize="48" integerSize="64" decimalSize="48" color="#333" weight>
|
|
|
+ </baseMoney>
|
|
|
<view class="flex-y-center mt-20">
|
|
|
<text class="fs-24 text--w111-333 lh-36rpx pr-10">支付剩余时间</text>
|
|
|
- <countDown
|
|
|
- :is-day="false"
|
|
|
- tip-text=" "
|
|
|
- day-text=" "
|
|
|
- hour-text=":"
|
|
|
- minute-text=":"
|
|
|
- second-text=" "
|
|
|
- bgColor="#FFFFFF"
|
|
|
- dotColor="var(--view-theme)"
|
|
|
- :datatime="invalidTime"></countDown>
|
|
|
+ <countDown :is-day="false" tip-text=" " day-text=" " hour-text=":" minute-text=":" second-text=" "
|
|
|
+ bgColor="#FFFFFF" dotColor="var(--view-theme)" :datatime="invalidTime"></countDown>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="px-20">
|
|
|
<view class="bg--w111-fff rd-24rpx pay_card">
|
|
|
- <view class="flex-between-center pay_item"
|
|
|
- v-for="(item, index) in payTypeList" :key="index"
|
|
|
- @tap="payType(item.value, index)">
|
|
|
+ <view class="flex-between-center pay_item" v-for="(item, index) in payTypeList" :key="index"
|
|
|
+ @tap="payType(item.value, index)">
|
|
|
<view class="flex-y-center">
|
|
|
<image class="w-52 h-52" :src="item.icon"></image>
|
|
|
<view class="pl-20">
|
|
|
<view class="text--w111-333 fs-28 lh-38rpx">{{item.name}}</view>
|
|
|
- <view class="fs-22 text--w111-999 lh-30rpx mt-8"
|
|
|
- v-if="item.value == 'yue'">可用余额¥{{now_money}}</view>
|
|
|
+ <view class="fs-22 text--w111-999 lh-30rpx mt-8" v-if="item.value == 'yue'">
|
|
|
+ 可用余额¥{{now_money}}</view>
|
|
|
<view class="fs-22 text--w111-999 lh-30rpx mt-8" v-else>{{item.title}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <text class="iconfont fs-40 text--w111-999" :class="active==index ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"></text>
|
|
|
+ <text class="iconfont fs-40 text--w111-999"
|
|
|
+ :class="active==index ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'"></text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -44,20 +37,28 @@
|
|
|
<script>
|
|
|
import countDown from '@/components/countDown';
|
|
|
import colors from "@/mixins/color";
|
|
|
- import { getCashierOrder, orderPay } from "@/api/order";
|
|
|
- import { rechargePayAPi, memberCardPayApi } from "@/api/user.js"
|
|
|
- import { HTTP_REQUEST_URL } from '@/config/app';
|
|
|
+ import {
|
|
|
+ getCashierOrder,
|
|
|
+ orderPay
|
|
|
+ } from "@/api/order";
|
|
|
+ import {
|
|
|
+ rechargePayAPi,
|
|
|
+ memberCardPayApi
|
|
|
+ } from "@/api/user.js"
|
|
|
+ import {
|
|
|
+ HTTP_REQUEST_URL
|
|
|
+ } from '@/config/app';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
invalidTime: 0,
|
|
|
- checked:false,
|
|
|
+ checked: false,
|
|
|
orderId: 0,
|
|
|
fromType: '',
|
|
|
active: -1,
|
|
|
payPrice: 0,
|
|
|
payPriceShow: 0,
|
|
|
- now_money:'',
|
|
|
+ now_money: '',
|
|
|
payPostage: 0,
|
|
|
offlinePostage: false,
|
|
|
invalidTime: 0,
|
|
@@ -67,8 +68,7 @@
|
|
|
msg: ''
|
|
|
},
|
|
|
formContent: '',
|
|
|
- cartArr: [
|
|
|
- {
|
|
|
+ cartArr: [{
|
|
|
"name": "微信支付",
|
|
|
"icon": HTTP_REQUEST_URL + "/statics/images/order/wx_pay.png",
|
|
|
value: 'weixin',
|
|
@@ -95,20 +95,33 @@
|
|
|
value: 'offline',
|
|
|
title: '选择线下付款方式',
|
|
|
payStatus: 2,
|
|
|
- }
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // "name": "lakala",
|
|
|
+ // "icon": HTTP_REQUEST_URL + "/statics/images/order/xianxia_pay.png",
|
|
|
+ // value: 'lakala',
|
|
|
+ // title: '选择线lakala支付',
|
|
|
+ // payStatus: 1,
|
|
|
+ // }
|
|
|
],
|
|
|
- paytype:''
|
|
|
+ paytype: '',
|
|
|
+ // #ifdef APP
|
|
|
+ showApp: false
|
|
|
+ // #endif
|
|
|
+ // #ifndef APP
|
|
|
+ showApp: true
|
|
|
+ // #endif
|
|
|
}
|
|
|
},
|
|
|
mixins: [colors],
|
|
|
components: {
|
|
|
countDown,
|
|
|
},
|
|
|
- computed:{
|
|
|
- payTypeList(){
|
|
|
+ computed: {
|
|
|
+ payTypeList() {
|
|
|
let list = [];
|
|
|
- this.cartArr.forEach(item=>{
|
|
|
- if(item.payStatus == 1){
|
|
|
+ this.cartArr.forEach(item => {
|
|
|
+ if (item.payStatus == 1) {
|
|
|
list.push(item);
|
|
|
}
|
|
|
})
|
|
@@ -117,6 +130,9 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
+ // #ifdef APP
|
|
|
+ this.showApp = uni.getStorageSync("showAppHistary") || false
|
|
|
+ // #endif
|
|
|
if (options.order_id) this.orderId = options.order_id;
|
|
|
if (options.from_type) this.fromType = options.from_type;
|
|
|
this.getCashierOrder();
|
|
@@ -136,7 +152,11 @@
|
|
|
getCashierOrder() {
|
|
|
getCashierOrder(this.orderId, this.fromType).then(res => {
|
|
|
//微信支付是否开启
|
|
|
- this.cartArr[0].payStatus = res.data.pay_weixin_open || 0
|
|
|
+ if (this.showApp) {
|
|
|
+ this.cartArr[0].payStatus = res.data.pay_weixin_open || 0
|
|
|
+ } else {
|
|
|
+ this.cartArr[0].payStatus = 0
|
|
|
+ }
|
|
|
//支付宝是否开启
|
|
|
// #ifdef MP-WEIXIN
|
|
|
/*微信小程序环境中不允许支付宝支付*/
|
|
@@ -172,11 +192,11 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- getShowPay(){
|
|
|
+ getShowPay() {
|
|
|
//付费会员购买和余额充值不允许使用线下支付和余额支付,未开启线上支付支付的话给出提示并且返回上一页
|
|
|
//检查支付类型列表数组的payStatus是不是都是0或者2
|
|
|
const isAllPayStatusZero = this.cartArr.every(item => item.payStatus == 0 || item.payStatus == 2);
|
|
|
- if(isAllPayStatusZero && ['vip','recharge'].includes(this.fromType)){
|
|
|
+ if (isAllPayStatusZero && ['vip', 'recharge'].includes(this.fromType)) {
|
|
|
return this.$util.Tips({
|
|
|
title: '未开启线上支付,请联系管理员'
|
|
|
}, {
|
|
@@ -184,24 +204,25 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- goPay(){
|
|
|
+ goPay() {
|
|
|
let that = this;
|
|
|
- if(that.active == -1) return that.$util.Tips({
|
|
|
+ if (that.active == -1) return that.$util.Tips({
|
|
|
title: '请选择付款方式'
|
|
|
});
|
|
|
if (!that.orderId) return that.$util.Tips({
|
|
|
title: '请选择要支付的订单'
|
|
|
});
|
|
|
- if (that.paytype == 'yue' && parseFloat(this.now_money) < parseFloat(that.payPriceShow)) return that.$util.Tips({
|
|
|
- title: '余额不足'
|
|
|
- });
|
|
|
+ if (that.paytype == 'yue' && parseFloat(this.now_money) < parseFloat(that.payPriceShow)) return that.$util
|
|
|
+ .Tips({
|
|
|
+ title: '余额不足'
|
|
|
+ });
|
|
|
|
|
|
uni.showLoading({
|
|
|
title: '支付中'
|
|
|
});
|
|
|
|
|
|
let funApi = '';
|
|
|
- if(this.fromType == 'order'){
|
|
|
+ if (this.fromType == 'order') {
|
|
|
funApi = orderPay({
|
|
|
uni: that.orderId,
|
|
|
paytype: that.paytype,
|
|
@@ -212,13 +233,16 @@
|
|
|
'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
- quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location.port + '/pages/goods/order_pay_status/index?order_id=' + this.orderId : location.protocol + '//' + location.hostname +'/pages/goods/order_pay_status/index?order_id=' + this.orderId
|
|
|
+ quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location
|
|
|
+ .port + '/pages/goods/order_pay_status/index?order_id=' + this.orderId : location
|
|
|
+ .protocol + '//' + location.hostname +
|
|
|
+ '/pages/goods/order_pay_status/index?order_id=' + this.orderId
|
|
|
// #endif
|
|
|
// #ifdef APP-PLUS
|
|
|
quitUrl: '/pages/goods/order_pay_status/index?order_id=' + this.orderId
|
|
|
// #endif
|
|
|
})
|
|
|
- }else if(this.fromType == 'recharge'){
|
|
|
+ } else if (this.fromType == 'recharge') {
|
|
|
funApi = rechargePayAPi({
|
|
|
uni: this.orderId,
|
|
|
paytype: that.paytype,
|
|
@@ -229,13 +253,15 @@
|
|
|
'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
- quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location.port + '/pages/users/user_payment/index' : location.protocol + '//' + location.hostname +'/pages/users/user_payment/index'
|
|
|
+ quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location
|
|
|
+ .port + '/pages/users/user_payment/index' : location.protocol + '//' + location
|
|
|
+ .hostname + '/pages/users/user_payment/index'
|
|
|
// #endif
|
|
|
// #ifdef APP-PLUS
|
|
|
quitUrl: '/pages/users/user_payment/index'
|
|
|
// #endif
|
|
|
})
|
|
|
- }else if(this.fromType == 'vip'){
|
|
|
+ } else if (this.fromType == 'vip') {
|
|
|
funApi = memberCardPayApi({
|
|
|
uni: this.orderId,
|
|
|
paytype: this.paytype,
|
|
@@ -252,76 +278,90 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- funApi.then(res=>{
|
|
|
+ // if(data.pay_type == 'lakala'){
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: goPages + '&status=1'
|
|
|
+ // })
|
|
|
+ // // #ifdef H5
|
|
|
+ // window.open(res.data.result.counter_url);
|
|
|
+ // // #endif
|
|
|
+ // // #ifdef APP-PLUS
|
|
|
+ // plus.runtime.openURL(res.data.result.counter_url);
|
|
|
+ // // #endif
|
|
|
+ // }
|
|
|
+
|
|
|
+ funApi.then(res => {
|
|
|
+ console.log(res,"res")
|
|
|
let status = res.data.status,
|
|
|
- orderId = res.data.result.order_id || '',
|
|
|
- jsConfig = res.data.result.jsConfig;
|
|
|
+ orderId = res.data.result.order_id || '',
|
|
|
+ jsConfig = res.data.result.jsConfig;
|
|
|
//页面回调地址
|
|
|
let PageObj = {
|
|
|
- 'order': '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=' +res.msg +'&type=3' + '&totalPrice=' + this.payPriceShow,
|
|
|
+ 'order': '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=' + res
|
|
|
+ .msg + '&type=3' + '&totalPrice=' + this.payPriceShow,
|
|
|
'recharge': '/pages/users/user_payment/index',
|
|
|
'vip': '/pages/annex/vip_paid/index',
|
|
|
};
|
|
|
let backUrl = PageObj[this.fromType];
|
|
|
- switch (status) {
|
|
|
- case 'ORDER_EXIST':
|
|
|
- case 'EXTEND_ORDER':
|
|
|
- case 'PAY_ERROR':
|
|
|
- this.pageReject(res.msg,backUrl);
|
|
|
- break;
|
|
|
- case 'SUCCESS':
|
|
|
- this.pageReject(res.msg,backUrl);
|
|
|
- break;
|
|
|
- case 'WECHAT_PAY':
|
|
|
- this.wechatPayFun(jsConfig,backUrl);
|
|
|
- break;
|
|
|
- case 'PAY_DEFICIENCY':
|
|
|
- uni.hideLoading();
|
|
|
- this.pageReject(res.msg,backUrl);
|
|
|
- break;
|
|
|
- case "WECHAT_H5_PAY":
|
|
|
- uni.hideLoading();
|
|
|
- // that.$util.Tips({
|
|
|
- // title: '订单创建成功!'
|
|
|
- // });
|
|
|
- setTimeout(() => {
|
|
|
- location.href = res.data.result.jsConfig.mweb_url;
|
|
|
- }, 500);
|
|
|
- break;
|
|
|
+ switch (status) {
|
|
|
+ case 'ORDER_EXIST':
|
|
|
+ case 'EXTEND_ORDER':
|
|
|
+ case 'PAY_ERROR':
|
|
|
+ this.pageReject(res.msg, backUrl);
|
|
|
+ break;
|
|
|
+ case 'SUCCESS':
|
|
|
+ this.pageReject(res.msg, backUrl);
|
|
|
+ break;
|
|
|
+ case 'WECHAT_PAY':
|
|
|
+ this.wechatPayFun(jsConfig, backUrl);
|
|
|
+ break;
|
|
|
+ case 'PAY_DEFICIENCY':
|
|
|
+ uni.hideLoading();
|
|
|
+ this.pageReject(res.msg, backUrl);
|
|
|
+ break;
|
|
|
+ case "WECHAT_H5_PAY":
|
|
|
+ uni.hideLoading();
|
|
|
+ // that.$util.Tips({
|
|
|
+ // title: '订单创建成功!'
|
|
|
+ // });
|
|
|
+ setTimeout(() => {
|
|
|
+ location.href = res.data.result.jsConfig.mweb_url;
|
|
|
+ }, 500);
|
|
|
+ break;
|
|
|
|
|
|
- case 'ALIPAY_PAY':
|
|
|
- //#ifdef H5
|
|
|
- uni.hideLoading();
|
|
|
- that.formContent = res.data.result.jsConfig;
|
|
|
- that.$nextTick(() => {
|
|
|
- document.getElementById('alipaysubmit').submit();
|
|
|
- })
|
|
|
- //#endif
|
|
|
- // #ifdef APP-PLUS
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'alipay',
|
|
|
- orderInfo: jsConfig,
|
|
|
- success: (e) => {
|
|
|
- that.pageReject('支付成功',backUrl);
|
|
|
- },
|
|
|
- fail: (e) => {
|
|
|
- that.pageReject('支付失败',backUrl);
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- uni.hideLoading();
|
|
|
- },
|
|
|
- });
|
|
|
- // #endif
|
|
|
- break;
|
|
|
+ case 'ALIPAY_PAY':
|
|
|
+ //#ifdef H5
|
|
|
+ uni.hideLoading();
|
|
|
+ that.formContent = res.data.result.jsConfig;
|
|
|
+ that.$nextTick(() => {
|
|
|
+ document.getElementById('alipaysubmit').submit();
|
|
|
+ })
|
|
|
+ //#endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'alipay',
|
|
|
+ orderInfo: jsConfig,
|
|
|
+ success: (e) => {
|
|
|
+ that.pageReject('支付成功', backUrl);
|
|
|
+ },
|
|
|
+ fail: (e) => {
|
|
|
+ that.pageReject('支付失败', backUrl);
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ uni.hideLoading();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ break;
|
|
|
}
|
|
|
- }).catch(err=>{
|
|
|
+ }).catch(err => {
|
|
|
uni.hideLoading();
|
|
|
return that.$util.Tips({
|
|
|
title: err
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
- wechatPayFun(jsConfig, backUrl){
|
|
|
+ wechatPayFun(jsConfig, backUrl) {
|
|
|
let that = this;
|
|
|
// #ifdef MP
|
|
|
uni.requestPayment({
|
|
@@ -332,23 +372,23 @@
|
|
|
paySign: jsConfig.paySign,
|
|
|
success: function(res) {
|
|
|
console.log("success");
|
|
|
- that.pageReject('支付成功',backUrl);
|
|
|
+ that.pageReject('支付成功', backUrl);
|
|
|
},
|
|
|
fail: function(e) {
|
|
|
console.log("fail");
|
|
|
- that.pageReject('支付失败',backUrl);
|
|
|
+ that.pageReject('支付失败', backUrl);
|
|
|
},
|
|
|
})
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
this.$wechat.pay(jsConfig).then(res => {
|
|
|
- this.pageReject('支付成功',backUrl);
|
|
|
+ this.pageReject('支付成功', backUrl);
|
|
|
}).catch(res => {
|
|
|
if (!this.$wechat.isWeixin()) {
|
|
|
- this.pageReject('支付失败',backUrl);
|
|
|
+ this.pageReject('支付失败', backUrl);
|
|
|
}
|
|
|
if (res.errMsg == 'chooseWXPay:cancel') {
|
|
|
- this.pageReject('取消支付',backUrl);
|
|
|
+ this.pageReject('取消支付', backUrl);
|
|
|
}
|
|
|
})
|
|
|
// #endif
|
|
@@ -357,15 +397,15 @@
|
|
|
provider: 'wxpay',
|
|
|
orderInfo: jsConfig,
|
|
|
success: (e) => {
|
|
|
- that.pageReject('支付成功',backUrl);
|
|
|
+ that.pageReject('支付成功', backUrl);
|
|
|
},
|
|
|
fail: (e) => {
|
|
|
- that.pageReject('支付失败',backUrl);
|
|
|
+ that.pageReject('支付失败', backUrl);
|
|
|
},
|
|
|
});
|
|
|
// #endif
|
|
|
},
|
|
|
- pageReject(msg,backUrl){
|
|
|
+ pageReject(msg, backUrl) {
|
|
|
uni.hideLoading();
|
|
|
return this.$util.Tips({
|
|
|
title: msg
|
|
@@ -379,21 +419,25 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-/deep/ .styleAll{
|
|
|
- padding: 0 6rpx;
|
|
|
- border: 1rpx solid #DDDDDD;
|
|
|
- border-radius: 8rpx;
|
|
|
-}
|
|
|
-.pay_card{
|
|
|
- padding: 40rpx 32rpx;
|
|
|
-}
|
|
|
-.pay_item ~ .pay_item{
|
|
|
- margin-top: 56rpx;
|
|
|
-}
|
|
|
-.icon-ic_unselect{
|
|
|
- color: #ccc;
|
|
|
-}
|
|
|
-.icon-a-ic_CompleteSelect{
|
|
|
- color: var(--view-theme)
|
|
|
-}
|
|
|
-</style>
|
|
|
+ /deep/ .styleAll {
|
|
|
+ padding: 0 6rpx;
|
|
|
+ border: 1rpx solid #DDDDDD;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pay_card {
|
|
|
+ padding: 40rpx 32rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pay_item~.pay_item {
|
|
|
+ margin-top: 56rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon-ic_unselect {
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon-a-ic_CompleteSelect {
|
|
|
+ color: var(--view-theme)
|
|
|
+ }
|
|
|
+</style>
|