|
|
@@ -150,6 +150,7 @@
|
|
|
|
|
|
<script>
|
|
|
import wx from 'weixin-js-sdk';
|
|
|
+import { h5Url } from '@/common/config.js';
|
|
|
import ImageItem from "@/components/swiper/components/image.vue";
|
|
|
import RedemptionRules from "./components/redemptionRules.vue";
|
|
|
import SelectProduct from "./components/selectProduct.vue";
|
|
|
@@ -334,10 +335,8 @@ export default {
|
|
|
},
|
|
|
//微信支付
|
|
|
weixinPay(params) {
|
|
|
- let url = 'https://city.baoxianzhanggui.com/fragrance/'
|
|
|
productOrderCreate(params).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
-
|
|
|
productOrderPay({
|
|
|
orderNo: res.data.data, //订单编号
|
|
|
payType: params.payType, //支付方式:1微信支付 2:余额支付
|
|
|
@@ -345,55 +344,56 @@ export default {
|
|
|
}).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
let payConfig = JSON.parse(res.data.data)
|
|
|
- getSignature(url).then(res => {
|
|
|
- if (res.data.code == 200) {
|
|
|
- this.wxconfig = res.data
|
|
|
- wx.config({
|
|
|
- beta: true,
|
|
|
- debug: false,
|
|
|
- appId: this.wxconfig.appId, // 公众号ID
|
|
|
- // appId: uni.getAppBaseInfo().host.appId, // 公众号ID
|
|
|
- timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
|
|
|
- nonceStr: this.wxconfig.nonceStr, // 随机串
|
|
|
- signature: this.wxconfig.sign, // 微信签名方式
|
|
|
- jsApiList: ['getBrandWCPayRequest']
|
|
|
- });
|
|
|
- var vm = this
|
|
|
- wx.invoke('getBrandWCPayRequest',
|
|
|
- // 下面参数内容都是后台返回的
|
|
|
- {
|
|
|
- 'appId': payConfig.appid, // 公众号名称,由商户传入
|
|
|
- 'timeStamp': payConfig.timeStamp, // 时间戳
|
|
|
- 'nonceStr': payConfig.nonceStr, // 随机串
|
|
|
- 'package': payConfig.package, // 预支付id
|
|
|
- 'signType': payConfig.signType, // 微信签名方式
|
|
|
- 'paySign': payConfig.paySign, // 微信签名
|
|
|
- },
|
|
|
- function (res) {
|
|
|
- // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
- this.redeemNowBtnDisable = false
|
|
|
- // JSON.stringify(res);
|
|
|
- if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
-
|
|
|
- uni.navigateTo({
|
|
|
- url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
|
|
|
- });
|
|
|
- } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
- uni.showToast({
|
|
|
- title: '已取消支付',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- uni.navigateTo({
|
|
|
- url: '/points/productDetails/pendingPayment?orderNo=' + this.orderNo
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- } else {
|
|
|
- alert('付款失败');
|
|
|
- }
|
|
|
+ console.log(payConfig,'this.payConfig9999999')
|
|
|
+ getSignature(h5Url).then(res => {
|
|
|
+ this.wxconfig = res.data
|
|
|
+ console.log(this.wxconfig,'this.wxconfig66666')
|
|
|
+ wx.config({
|
|
|
+ beta: true,
|
|
|
+ debug: false,
|
|
|
+ appId: this.wxconfig.appId, // 公众号ID
|
|
|
+ // appId: uni.getAppBaseInfo().host.appId, // 公众号ID
|
|
|
+ timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
|
|
|
+ nonceStr: this.wxconfig.nonceStr, // 随机串
|
|
|
+ signature: this.wxconfig.signature, // 微信签名方式
|
|
|
+ jsApiList: ['getBrandWCPayRequest']
|
|
|
+ });
|
|
|
+ var vm = this
|
|
|
+ wx.invoke('getBrandWCPayRequest',
|
|
|
+ // 下面参数内容都是后台返回的
|
|
|
+ {
|
|
|
+ 'appId': payConfig.appId, // 公众号名称,由商户传入
|
|
|
+ 'timeStamp': payConfig.timeStamp, // 时间戳
|
|
|
+ 'nonceStr': payConfig.nonceStr, // 随机串
|
|
|
+ 'package': payConfig.package, // 预支付id
|
|
|
+ 'signType': payConfig.signType, // 微信签名方式
|
|
|
+ 'paySign': payConfig.paySign, // 微信签名
|
|
|
+ },
|
|
|
+ function (res) {
|
|
|
+ console.log(res,'---------------付款')
|
|
|
+ // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
+ // JSON.stringify(res);
|
|
|
+ if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
|
|
|
+ });
|
|
|
+ } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
+ uni.showToast({
|
|
|
+ title: '已取消支付',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/points/productDetails/pendingPayment?orderNo=' + this.orderNo
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ alert('付款失败');
|
|
|
}
|
|
|
- )
|
|
|
- }
|
|
|
+ }
|
|
|
+ )
|
|
|
|
|
|
})
|
|
|
}
|