|
|
@ -2,7 +2,7 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-03-20 14:14:53
|
|
|
|
* @Date: 2022-03-20 14:14:53
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-04-28 17:15:11
|
|
|
|
* @LastEditTime: 2022-04-28 18:18:30
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -81,7 +81,7 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import UiCell from '@/components/UiCell';
|
|
|
|
import UiCell from '@/components/UiCell';
|
|
|
|
import {ApiPostSubmitOrder, ApiGetBeforeOrder, ApiGetBeforeCartOrder} from '@/common/api/order';
|
|
|
|
import {ApiPostSubmitOrder, ApiGetBeforeOrder, ApiGetBeforeCartOrder} from '@/common/api/order';
|
|
|
|
import { ApiPostWxPay } from '@/common/api/wx';
|
|
|
|
import { ApiPostWxH5Pay, ApiPostWxJsApiPay } from '@/common/api/wx';
|
|
|
|
import UiButton from '@/components/UiButton.vue';
|
|
|
|
import UiButton from '@/components/UiButton.vue';
|
|
|
|
import UiWhiteBox from '../../components/UiWhiteBox.vue';
|
|
|
|
import UiWhiteBox from '../../components/UiWhiteBox.vue';
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -181,14 +181,24 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async wxpay(orderId){
|
|
|
|
async wxpay(orderId){
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
|
|
const openId = this.$store.state.openId;
|
|
|
|
|
|
|
|
if(openId) {
|
|
|
|
if(ua.includes('micromessenger')) {
|
|
|
|
|
|
|
|
// 微信JSAPI
|
|
|
|
// 微信JSAPI
|
|
|
|
|
|
|
|
const {error, result} = await ApiPostWxJsApiPay({orderId,openId});
|
|
|
|
|
|
|
|
if(error){
|
|
|
|
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
WeixinJSBridge.invoke('getBrandWCPayRequest', result.dataInfo, res => {
|
|
|
|
|
|
|
|
if(res.err_msg === 'get_brand_wcpay_request:cancel'){
|
|
|
|
|
|
|
|
this.$$Router.replace(`/payResult?orderId=${orderId}`);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.$$Router.replace(`/orderDetail?id=${orderId}`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
// h5支付
|
|
|
|
// h5支付
|
|
|
|
const {error, result} = await ApiPostWxPay({orderId});
|
|
|
|
const {error, result} = await ApiPostWxH5Pay({orderId});
|
|
|
|
if(error){
|
|
|
|
if(error){
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|