diff --git a/api/http.js b/api/http.js index ea36803..401c7c8 100644 --- a/api/http.js +++ b/api/http.js @@ -15,7 +15,8 @@ import { } from '@/commons/utils/encryptUtil.js' import infoBox from "@/commons/utils/infoBox.js" // let baseUrl = '' -let baseUrl = 'https://cashier.sxczgkj.com' +// let baseUrl = 'https://cashier.sxczgkj.com' +let baseUrl = 'https://frp.sxczgkj.com' // let baseUrl = '/api' // 多少 ms 以内, 不提示loading const loadingShowTime = 200 @@ -23,11 +24,11 @@ const loadingShowTime = 200 function getHeader(){ const headerObject={} - headerObject["Authorization"] = storageManage.token() + // headerObject["Authorization"] = storageManage.token() headerObject["Content-Type"] = 'application/json' - headerObject["loginname"] = 'admin' - headerObject["token"] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ' - headerObject["userId"] = '244' + // headerObject["loginname"] = 'admin' + // headerObject["token"] = 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyVHlwZSI6Ik1HIiwiZXhwIjoxNjkwMTgwNzE2LCJ1c2VySWQiOiIyNDQiLCJpYXQiOjE2ODg3MDk0ODcsImxvZ2luTmFtZSI6ImFkbWluIn0.lqxxvv2-FcecQngMBorz4MpkB3mIJQDG-IUULQyV-KQ' + // headerObject["userId"] = '244' return headerObject } diff --git a/api/index.js b/api/index.js index 9a8a566..3ab7147 100644 --- a/api/index.js +++ b/api/index.js @@ -23,6 +23,7 @@ export function getOpenId(params) { return request({ url: `/account/user/openId`, method: 'get', + headers: {}, params }) } diff --git a/main.js b/main.js index e04836d..0d506c6 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ import App from './App' -import vConsloe from 'vconsole' +// import vConsloe from 'vconsole' -new vConsloe() +// new vConsloe() // #ifndef VUE3 import Vue from 'vue' diff --git a/pages/index/index.vue b/pages/index/index.vue index 17fe1c0..1028798 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -22,7 +22,6 @@ export default { return { payAmount: '', openId: null, - // openId: '2088112837517234', shopImage: null, shopName: null, shopId: null, @@ -113,7 +112,6 @@ export default { this.getOpenId(_code, '2021004174605036'); //微信 WECHAT; 支付宝 ALIPAY; } } - // this.getOpenId('1321312123123', '2021004174605036'); }, /** @@ -130,7 +128,8 @@ export default { shopId: this.getUrlParam('shopId') //微信 WECHAT; 支付宝 ALIPAY; }; getOpenId(params).then((res) => { - if (res.code == 0) { + console.log('获取微信/支付宝openid', res); + if (res.code == 200) { this.openId = res.data.openId; this.shopImage = res.data.shopImage; this.shopName = res.data.shopName; @@ -214,15 +213,21 @@ export default { // } // }; console.log('createOrder.params', params); - if (this.orderId) { - params.orderId = this.orderId; - } + // if (this.orderId) { + // params.orderId = this.orderId; + // } + // if (this.isWechat()) { + // this.wxH5Pay(params); + // } + // if (this.isAlipay()) { + // this.alipay(params); + // } createOrder(params) .then((res) => { console.log('createOrder.res', res); // alert("创建订单=="+JSON.stringify(res)) - if (res.code == '100015') { - this.orderId = res.data.orderInfo.id; + if (res.code == 200) { + // this.orderId = res.data.orderInfo.id; if (this.isWechat()) { this.wxH5Pay(res); } @@ -250,12 +255,12 @@ export default { 'getBrandWCPayRequest', { debug: true, - appId: res.data.payInfo.appId, - timeStamp: res.data.payInfo.timeStamp, - nonceStr: res.data.payInfo.nonceStr, - package: res.data.payInfo.package, - paySign: res.data.payInfo.paySign, - signType: res.data.payInfo.signType + appId: res.data.appId, + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + paySign: res.data.paySign, + signType: res.data.signType }, function (res) { console.log(res); @@ -297,7 +302,7 @@ export default { AlipayJSBridge.call( 'tradePay', { - tradeNO: res.data.payInfo.tradeNo + tradeNO: res.data.tradeNo }, function (result) { if (result.resultCode === '9000') { @@ -310,7 +315,7 @@ export default { window.AlipayJSBridge.call('closeWebview'); }, 500); } else { - cancelOrderPay({ orderId: this.orderId }); + // cancelOrderPay({ orderId: this.orderId }); // 支付失败 uni.showToast({ title: '支付失败',