修复无法支付的问题

This commit is contained in:
gyq
2026-01-29 18:19:26 +08:00
parent 696a39da99
commit 3e64567d52
4 changed files with 30 additions and 23 deletions

View File

@@ -15,7 +15,8 @@ import {
} from '@/commons/utils/encryptUtil.js' } from '@/commons/utils/encryptUtil.js'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
// let baseUrl = '' // let baseUrl = ''
let baseUrl = 'https://cashier.sxczgkj.com' // let baseUrl = 'https://cashier.sxczgkj.com'
let baseUrl = 'https://frp.sxczgkj.com'
// let baseUrl = '/api' // let baseUrl = '/api'
// 多少 ms 以内, 不提示loading // 多少 ms 以内, 不提示loading
const loadingShowTime = 200 const loadingShowTime = 200
@@ -23,11 +24,11 @@ const loadingShowTime = 200
function getHeader(){ function getHeader(){
const headerObject={} const headerObject={}
headerObject["Authorization"] = storageManage.token() // headerObject["Authorization"] = storageManage.token()
headerObject["Content-Type"] = 'application/json' headerObject["Content-Type"] = 'application/json'
headerObject["loginname"] = 'admin' // headerObject["loginname"] = 'admin'
headerObject["token"] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ' // headerObject["token"] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ'
headerObject["userId"] = '244' // headerObject["userId"] = '244'
return headerObject return headerObject
} }

View File

@@ -23,6 +23,7 @@ export function getOpenId(params) {
return request({ return request({
url: `/account/user/openId`, url: `/account/user/openId`,
method: 'get', method: 'get',
headers: {},
params params
}) })
} }

View File

@@ -1,7 +1,7 @@
import App from './App' import App from './App'
import vConsloe from 'vconsole' // import vConsloe from 'vconsole'
new vConsloe() // new vConsloe()
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'

View File

@@ -22,7 +22,6 @@ export default {
return { return {
payAmount: '', payAmount: '',
openId: null, openId: null,
// openId: '2088112837517234',
shopImage: null, shopImage: null,
shopName: null, shopName: null,
shopId: null, shopId: null,
@@ -113,7 +112,6 @@ export default {
this.getOpenId(_code, '2021004174605036'); //微信 WECHAT 支付宝 ALIPAY this.getOpenId(_code, '2021004174605036'); //微信 WECHAT 支付宝 ALIPAY
} }
} }
// this.getOpenId('1321312123123', '2021004174605036');
}, },
/** /**
@@ -130,7 +128,8 @@ export default {
shopId: this.getUrlParam('shopId') //微信 WECHAT 支付宝 ALIPAY shopId: this.getUrlParam('shopId') //微信 WECHAT 支付宝 ALIPAY
}; };
getOpenId(params).then((res) => { getOpenId(params).then((res) => {
if (res.code == 0) { console.log('获取微信/支付宝openid', res);
if (res.code == 200) {
this.openId = res.data.openId; this.openId = res.data.openId;
this.shopImage = res.data.shopImage; this.shopImage = res.data.shopImage;
this.shopName = res.data.shopName; this.shopName = res.data.shopName;
@@ -214,15 +213,21 @@ export default {
// } // }
// }; // };
console.log('createOrder.params', params); console.log('createOrder.params', params);
if (this.orderId) { // if (this.orderId) {
params.orderId = this.orderId; // params.orderId = this.orderId;
} // }
// if (this.isWechat()) {
// this.wxH5Pay(params);
// }
// if (this.isAlipay()) {
// this.alipay(params);
// }
createOrder(params) createOrder(params)
.then((res) => { .then((res) => {
console.log('createOrder.res', res); console.log('createOrder.res', res);
// alert("创建订单=="+JSON.stringify(res)) // alert("创建订单=="+JSON.stringify(res))
if (res.code == '100015') { if (res.code == 200) {
this.orderId = res.data.orderInfo.id; // this.orderId = res.data.orderInfo.id;
if (this.isWechat()) { if (this.isWechat()) {
this.wxH5Pay(res); this.wxH5Pay(res);
} }
@@ -250,12 +255,12 @@ export default {
'getBrandWCPayRequest', 'getBrandWCPayRequest',
{ {
debug: true, debug: true,
appId: res.data.payInfo.appId, appId: res.data.appId,
timeStamp: res.data.payInfo.timeStamp, timeStamp: res.data.timeStamp,
nonceStr: res.data.payInfo.nonceStr, nonceStr: res.data.nonceStr,
package: res.data.payInfo.package, package: res.data.package,
paySign: res.data.payInfo.paySign, paySign: res.data.paySign,
signType: res.data.payInfo.signType signType: res.data.signType
}, },
function (res) { function (res) {
console.log(res); console.log(res);
@@ -297,7 +302,7 @@ export default {
AlipayJSBridge.call( AlipayJSBridge.call(
'tradePay', 'tradePay',
{ {
tradeNO: res.data.payInfo.tradeNo tradeNO: res.data.tradeNo
}, },
function (result) { function (result) {
if (result.resultCode === '9000') { if (result.resultCode === '9000') {
@@ -310,7 +315,7 @@ export default {
window.AlipayJSBridge.call('closeWebview'); window.AlipayJSBridge.call('closeWebview');
}, 500); }, 500);
} else { } else {
cancelOrderPay({ orderId: this.orderId }); // cancelOrderPay({ orderId: this.orderId });
// 支付失败 // 支付失败
uni.showToast({ uni.showToast({
title: '支付失败', title: '支付失败',