|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-03-20 14:14:53
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-04-28 17:15:11
|
|
|
|
|
* @LastEditTime: 2022-04-28 18:18:30
|
|
|
|
|
* @Description: file content
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
@ -81,7 +81,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import UiCell from '@/components/UiCell';
|
|
|
|
|
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 UiWhiteBox from '../../components/UiWhiteBox.vue';
|
|
|
|
|
export default {
|
|
|
|
@ -181,14 +181,24 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async wxpay(orderId){
|
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
|
|
|
|
|
|
|
|
if(ua.includes('micromessenger')) {
|
|
|
|
|
const openId = this.$store.state.openId;
|
|
|
|
|
if(openId) {
|
|
|
|
|
// 微信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{
|
|
|
|
|
// h5支付
|
|
|
|
|
const {error, result} = await ApiPostWxPay({orderId});
|
|
|
|
|
const {error, result} = await ApiPostWxH5Pay({orderId});
|
|
|
|
|
if(error){
|
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
|
return false;
|
|
|
|
|