|
|
@@ -7,7 +7,7 @@
|
|
|
</view>
|
|
|
</u-navbar> -->
|
|
|
|
|
|
- <view class="contentBox" >
|
|
|
+ <view class="contentBox">
|
|
|
<view class="remainingTime">
|
|
|
{{ orderStatus }}
|
|
|
<text v-if="orderInfo.orderStatus == 0 && countdownText != '00:00'">{{ countdownText }}</text>
|
|
|
@@ -61,7 +61,7 @@
|
|
|
<text class="text">合计:</text>
|
|
|
<text class="price">¥ {{
|
|
|
(orderInfo.payAmount + (orderInfo.freightAmount > 0 ? orderInfo.freightAmount : 0))
|
|
|
- }}</text>
|
|
|
+ }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="weiChect">
|
|
|
@@ -108,23 +108,23 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="buttonClass">
|
|
|
-
|
|
|
- <u-button v-if="orderInfo.orderStatus==0" :customStyle="{
|
|
|
+
|
|
|
+ <u-button v-if="orderInfo.orderStatus == 0" :customStyle="{
|
|
|
color: '#999',
|
|
|
background: '',
|
|
|
border: '2rpx solid rgba(153, 153, 153, 1)'
|
|
|
}" @click="cancelOrderFun">取消支付</u-button>
|
|
|
|
|
|
- <u-button v-if="orderInfo.orderStatus==0" :customStyle="{
|
|
|
+ <u-button v-if="orderInfo.orderStatus == 0" :customStyle="{
|
|
|
color: '#fff ',
|
|
|
background: '#03C1B8'
|
|
|
}" @click="goPay">去付款</u-button>
|
|
|
- <u-button v-if="orderInfo.orderStatus==11" :customStyle="{
|
|
|
+ <u-button v-if="orderInfo.orderStatus == 11" :customStyle="{
|
|
|
color: '#fff ',
|
|
|
background: '#03C1B8'
|
|
|
- }" @click="buyAgain">再次购买</u-button>
|
|
|
+ }" @click="buyAgain">再次购买</u-button>
|
|
|
+
|
|
|
|
|
|
-
|
|
|
</view>
|
|
|
|
|
|
</scroll-view>
|
|
|
@@ -169,9 +169,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
+import wx from 'weixin-js-sdk';
|
|
|
import { getPointOrderInfo, productOrderCancel, productOrderPay } from '@/api/pointOrder'
|
|
|
-import { getInfo, } from '@/api/index.js';
|
|
|
+import { getInfo, getSignature } from '@/api/index.js';
|
|
|
|
|
|
//paymentType 商品的付款类型 付款类型(1:积分 2:金额 3:积分+金额)
|
|
|
|
|
|
@@ -200,6 +200,7 @@ export default {
|
|
|
orderNo: '',
|
|
|
orderInfo: null,
|
|
|
productInfo: null,
|
|
|
+ wxconfig: {},
|
|
|
}
|
|
|
},
|
|
|
onLoad(data) {
|
|
|
@@ -285,58 +286,57 @@ export default {
|
|
|
},
|
|
|
//微信支付
|
|
|
weixinPay() {
|
|
|
+ let url = 'https://city.baoxianzhanggui.com/fragrance/'
|
|
|
productOrderPay({
|
|
|
orderNo: this.orderInfo.orderNo, //订单编号
|
|
|
payType: this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
|
|
|
totalPrice: this.orderInfo.totalAmount //订单总金额,单位:元
|
|
|
}).then(res => {
|
|
|
- console.log(res, '8888888')
|
|
|
- return
|
|
|
- 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,但并不保证它绝对可靠。
|
|
|
-
|
|
|
- // JSON.stringify(res);
|
|
|
- if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/points/productDetails/paymentSuccessful'
|
|
|
- });
|
|
|
- } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
- uni.showToast({
|
|
|
- title: '已取消支付',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- uni.navigateTo({
|
|
|
- url: '/points/productDetails/pendingPayment'
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- } else {
|
|
|
- alert('付款失败');
|
|
|
+ let payConfig = JSON.parse(res.data.data)
|
|
|
+ getSignature(url).then(res => {
|
|
|
+ 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,但并不保证它绝对可靠。
|
|
|
+
|
|
|
+ // 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'
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ alert('付款失败');
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- )
|
|
|
+ )
|
|
|
+
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
//账号余额支付
|