Commit 02d72d13 authored by 黄奎's avatar 黄奎

微信支付

parent ce04d204
...@@ -52,14 +52,14 @@ ...@@ -52,14 +52,14 @@
<!-- 内容 --> <!-- 内容 -->
</view> </view>
<!-- 新增分类科目结束 --> <!-- 新增分类科目结束 -->
<view class="catstyle4" style="height: 100%;"> <view class="catstyle4" style="height: 100%;margin-bottom: 20rpx;">
<!-- <div class="left-slider"> <!-- <div class="left-slider">
<sidebar :active="tid" name="Name" :active-color="mainColor" :border="false" :list="d" <sidebar :active="tid" name="Name" :active-color="mainColor" :border="false" :list="d"
@change="changeHandler" @change2="changeHandler2"></sidebar> @change="changeHandler" @change2="changeHandler2"></sidebar>
</div> --> </div> -->
<div class="right-slider"> <div class="right-slider">
<scroll-view :scroll-y="true" @scrolltolower="lower" :enable-back-to-top="true" :enable-flex="true" <scroll-view :scroll-y="true" @scrolltolower="lower" :enable-back-to-top="true" :enable-flex="true"
:style="{ height: '100%' }"> style="height:calc(100vh - 35rpx);">
<div class="adbox" v-if="d[tid].advert_pic" @click="clickHandler(d[tid].advert_url)"> <div class="adbox" v-if="d[tid].advert_pic" @click="clickHandler(d[tid].advert_url)">
<image mode="aspectFit" :src="d[tid].advert_url" style="width: 100%; height: 100%;" /> <image mode="aspectFit" :src="d[tid].advert_url" style="width: 100%; height: 100%;" />
</div> </div>
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
</view> </view>
</template> </template>
</div> </div>
<u-divider class="The-tail" v-if="isover" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider> <u-divider class="The-tail" v-if="isover" :margin-top="20" :margin-bottom="20" bg-color="transparent" >没有更多商品了</u-divider>
</scroll-view> </scroll-view>
</div> </div>
<template v-if="u&&u.TenantId==27"> <template v-if="u&&u.TenantId==27">
...@@ -531,6 +531,7 @@ ...@@ -531,6 +531,7 @@
); );
}, },
lower(e) { lower(e) {
// console.log('4444')
if (this.msg.pageIndex < this.page_count) { if (this.msg.pageIndex < this.page_count) {
if (!this.loading) { if (!this.loading) {
this.msg.pageIndex++; this.msg.pageIndex++;
...@@ -552,9 +553,9 @@ ...@@ -552,9 +553,9 @@
</script> </script>
<style > <style >
.The-tail .u-divider{ /* .The-tail >>> .u-divider{
background-color: transparent !important; background-color: transparent !important;
} } */
.The-title{ .The-title{
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
......
...@@ -32,8 +32,6 @@ export default { ...@@ -32,8 +32,6 @@ export default {
return { return {
show: true, show: true,
orderInfo: {}, orderInfo: {},
}; };
}, },
created() { created() {
......
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
}; };
}, },
created() { created() {
console.log(wx) // console.log(wx)
this.getDataInfo();
this.u = uni.getStorageSync('mall_UserInfo') this.u = uni.getStorageSync('mall_UserInfo')
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.TimingState(); this.TimingState();
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
this.TimingState(); this.TimingState();
}, 30000); }, 30000);
}, },
onShow (){ onShow() {
this.TimingState(); this.TimingState();
this.times = setInterval(() => { this.times = setInterval(() => {
this.TimingState(); this.TimingState();
...@@ -139,7 +140,7 @@ ...@@ -139,7 +140,7 @@
methods: { methods: {
// 定时查询状态 // 定时查询状态
TimingState() { TimingState() {
let that =this let that = this
this.request2({ this.request2({
url: '/api/AppletOrder/GetAppletMyOrderInfo', url: '/api/AppletOrder/GetAppletMyOrderInfo',
data: { data: {
...@@ -148,7 +149,7 @@ ...@@ -148,7 +149,7 @@
} }
}, },
(res) => { (res) => {
if(res.data.OrderStatus==5){ if (res.data.OrderStatus == 5) {
clearInterval(this.times); clearInterval(this.times);
uni.navigateTo({ uni.navigateTo({
url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}` url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}`
...@@ -159,7 +160,29 @@ ...@@ -159,7 +160,29 @@
// console.log('状态',res.data.OrderStatus) // console.log('状态',res.data.OrderStatus)
} }
); );
},
// 微信支付一开始的请求
getDataInfo() {
let that=this;
// console.log("要发送的参数",that.payInfo)
let msg = {
OpenId: that.payInfo.OpenId,
OrderId: that.payInfo.OrderId,
OrderPayType:that.payInfo.OrderPayType,
GoodsName: that.payInfo.GoodsName
};
this.request2(
{
url: '/api/WeChatPay/GetPayInfo',
data: msg
},
res => {
if (res.resultCode == 1) {
this.orderInfo = JSON.parse(res.data);
}
uni.hideNavigationBarLoading();
}
);
}, },
radioChange(e) { radioChange(e) {
if (e == 0) { if (e == 0) {
...@@ -174,7 +197,6 @@ ...@@ -174,7 +197,6 @@
}, },
// 支付宝发送发送 // 支付宝发送发送
send() { send() {
}, },
copy() { copy() {
uniCopy({ uniCopy({
...@@ -198,8 +220,11 @@ ...@@ -198,8 +220,11 @@
closePay() { closePay() {
this.$emit('closePay'); this.$emit('closePay');
}, },
// 支付宝支付
Pay() { Pay() {
// if (this.payment == 0) { if(this.payType == 'wx_lite') {
this.wxPay()
} else {
let msg = { let msg = {
'pay_channel': this 'pay_channel': this
.payType, //网页打开支付宝支付:alipay_wap 支付宝正扫:alipay_qr 支付宝app:alipay 微信小程序:wx_lite 微信公众号:wx_pub .payType, //网页打开支付宝支付:alipay_wap 支付宝正扫:alipay_qr 支付宝app:alipay 微信小程序:wx_lite 微信公众号:wx_pub
...@@ -232,14 +257,9 @@ ...@@ -232,14 +257,9 @@
icon: 'error' icon: 'error'
}) })
} }
// uni.hideNavigationBarLoading();
} }
); );
// } }
// else {
// this.AlipayMask = true
// this.pay = false
// }
}, },
// 支付宝支付 // 支付宝支付
...@@ -251,21 +271,22 @@ ...@@ -251,21 +271,22 @@
// 微信支付 // 微信支付
wxPay(payData) { wxPay(payData) {
let that = this let that = this
let orderInfo = this.orderInfo;
uni.showLoading({ uni.showLoading({
title: '支付中...' title: '支付中...'
}) })
wx.requestPayment({ uni.requestPayment({
"timeStamp": payData.timeStamp, //时间戳,自1970年以来的秒数 provider: 'wxpay',
"nonceStr": payData.nonceStr, //随机串 timeStamp: that.orderInfo.timeStamp,
"package": payData.package, nonceStr: that.orderInfo.nonceStr,
"signType": payData.signType, //微信签名方式: package: that.orderInfo.package,
"paySign": payData.paySign, //微信签名 signType: that.orderInfo.signType,
'success': function(res) { paySign: that.orderInfo.sign,
success: function(res) {
uni.hideLoading() uni.hideLoading()
if (that.u && that.u.TenantId == 27) { if (that.u && that.u.TenantId == 27) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}` url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}`
// url: '/pages/order-submit/pay-success2?payInfo='+JSON.stringify(that.payInfo)
}); });
that.pay = false that.pay = false
} else { } else {
...@@ -275,22 +296,15 @@ ...@@ -275,22 +296,15 @@
}); });
that.pay = false that.pay = false
} }
// uni.showToast({
// title:'支付成功'
// })
}, },
'fail': function(res) { fail: function(res) {
uni.hideLoading() uni.hideLoading()
uni.navigateTo({ uni.navigateTo({
// url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}`
url: '/pages/order/index/index?status=1' url: '/pages/order/index/index?status=1'
}); });
that.pay = false that.pay = false
}, },
'complete': function(res) { complete: function(res) {
// uni.showToast({
// title:res.errMsg
// })
} }
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment