|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-03-20 14:14:53
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-06-29 17:23:04
|
|
|
|
|
* @LastEditTime: 2022-07-13 18:18:18
|
|
|
|
|
* @Description: file content
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
@ -34,22 +34,6 @@
|
|
|
|
|
maxlength="50" placeholder="填写您想要备注的信息,50字以内" />
|
|
|
|
|
</UiCell>
|
|
|
|
|
</UiWhiteBox>
|
|
|
|
|
<UiWhiteBox>
|
|
|
|
|
<text class="play--title">支付方式</text>
|
|
|
|
|
<radio-group>
|
|
|
|
|
<u-cell v-for="item in payData" :title="item.label" :key="item.val"
|
|
|
|
|
:border="false" @click="payType = item.val">
|
|
|
|
|
<image class="play--icon" slot="icon" :src="item.icon"/>
|
|
|
|
|
<radio class="play--radio" slot="right-icon" color="#FF875B"
|
|
|
|
|
:checked="payType == item.val" ></radio>
|
|
|
|
|
</u-cell>
|
|
|
|
|
<!-- <u-cell title="支付宝支付" :border="false" @click="payType = 'alipay'">
|
|
|
|
|
<image class="play--icon" slot="icon" src="@/static/order/zfb.png"/>
|
|
|
|
|
<radio class="play--radio" slot="right-icon" color="#FF875B"
|
|
|
|
|
:checked="payType == 'alipay'"></radio>
|
|
|
|
|
</u-cell> -->
|
|
|
|
|
</radio-group>
|
|
|
|
|
</UiWhiteBox>
|
|
|
|
|
|
|
|
|
|
<UiWhiteBox class="amount">
|
|
|
|
|
<u-cell title="商品总额" :value="`¥${orderInfo.productAmount}`" :border="false"></u-cell>
|
|
|
|
@ -72,11 +56,13 @@
|
|
|
|
|
import {GOODS_TYPE} from '@/common/dicts/goods';
|
|
|
|
|
import UiCell from '@/components/UiCell';
|
|
|
|
|
import {ApiPostSubmitOrder, ApiGetBeforeOrder, ApiGetBeforeCartOrder} from '@/common/api/order';
|
|
|
|
|
import {ApiPostCashierPrepay} from '@/common/api/pay';
|
|
|
|
|
import {ApiGetAddress } from '@/common/api/base';
|
|
|
|
|
import {Wxpay, Alipay} from '@/common/utils';
|
|
|
|
|
import UiButton from '@/components/UiButton.vue';
|
|
|
|
|
import UiWhiteBox from '../../components/UiWhiteBox.vue';
|
|
|
|
|
import UiGoodsInfo from '../../components/UiGoodsInfo.vue';
|
|
|
|
|
const ENV = process.env;
|
|
|
|
|
export default {
|
|
|
|
|
components : {UiCell, UiButton, UiWhiteBox, UiGoodsInfo },
|
|
|
|
|
data(){
|
|
|
|
@ -85,15 +71,6 @@ export default {
|
|
|
|
|
address : {},
|
|
|
|
|
userMessage : '',
|
|
|
|
|
orderInfo : {},
|
|
|
|
|
payType : 'wxpay',
|
|
|
|
|
payData : [
|
|
|
|
|
{
|
|
|
|
|
label : '微信支付',
|
|
|
|
|
icon : require('@/static/order/wx.png'),
|
|
|
|
|
val : 'wxpay'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
productType : this.$Route.query.productType,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -102,14 +79,6 @@ export default {
|
|
|
|
|
uni.$on('changeAddress',(item)=>{
|
|
|
|
|
this.address = item;
|
|
|
|
|
});
|
|
|
|
|
// 非微信APP则添加支付宝支付
|
|
|
|
|
if(!this.$store.state.openId){
|
|
|
|
|
this.payData.push({
|
|
|
|
|
label : '支付宝支付',
|
|
|
|
|
icon : require('@/static/order/zfb.png'),
|
|
|
|
|
val : 'alipay'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onShow(){
|
|
|
|
|
// 默认选择设为默认的地址
|
|
|
|
@ -206,11 +175,28 @@ export default {
|
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(this.payType === 'wxpay'){
|
|
|
|
|
Wxpay({orderId : result.orderId, openId : this.$store.state.openId});
|
|
|
|
|
}else{
|
|
|
|
|
Alipay({orderId : result.orderId});
|
|
|
|
|
let payType = 'wxjsapi'
|
|
|
|
|
if(!this.$store.state.openId){
|
|
|
|
|
payType = 'h5'
|
|
|
|
|
}
|
|
|
|
|
const {error:er, result:res} = await ApiPostCashierPrepay({
|
|
|
|
|
orderId:result.orderId,
|
|
|
|
|
returnUrl : `${ENV.VUE_APP_STATIC_URL}/payResult?orderId=${result.orderId}&payType=${payType}`
|
|
|
|
|
});
|
|
|
|
|
if(er){
|
|
|
|
|
uni.$u.toast(er.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
window.location.replace(res.wapCashierUrl)
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
// #ifndef H5
|
|
|
|
|
this.$Router.push(`/webView?url=${encodeURIComponent(res.wapCashierUrl)}`);
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|