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,12 +122,12 @@ ...@@ -121,12 +122,12 @@
this.TimingState(); this.TimingState();
}, 30000); }, 30000);
}, },
onShow (){ onShow() {
this.TimingState(); this.TimingState();
this.times = setInterval(() => { this.times = setInterval(() => {
this.TimingState(); this.TimingState();
}, 30000); }, 30000);
}, },
wacth: { wacth: {
payInfo: { payInfo: {
...@@ -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,153 +149,166 @@ ...@@ -148,153 +149,166 @@
} }
}, },
(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}`
// url: '/pages/order-submit/pay-success2?payInfo='+JSON.stringify(that.payInfo) // url: '/pages/order-submit/pay-success2?payInfo='+JSON.stringify(that.payInfo)
}); });
that.pay = false that.pay = false
} }
// console.log('状态',res.data.OrderStatus) // console.log('状态',res.data.OrderStatus)
} }
); );
},
}, // 微信支付一开始的请求
radioChange(e) { getDataInfo() {
if (e == 0) { let that=this;
this.payType = 'wx_lite' // console.log("要发送的参数",that.payInfo)
} else { let msg = {
this.payType = 'alipay_qr' OpenId: that.payInfo.OpenId,
} OrderId: that.payInfo.OrderId,
}, OrderPayType:that.payInfo.OrderPayType,
cloGood() { GoodsName: that.payInfo.GoodsName
this.AlipayMask = false };
this.pay = true this.request2(
}, {
// 支付宝发送发送 url: '/api/WeChatPay/GetPayInfo',
send() { data: msg
},
}, res => {
copy() { if (res.resultCode == 1) {
uniCopy({ this.orderInfo = JSON.parse(res.data);
content: this.url,
success: (res) => {
uni.showToast({
title: res,
icon: 'none'
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 3000,
})
}
})
},
closePay() {
this.$emit('closePay');
},
Pay() {
// if (this.payment == 0) {
let msg = {
'pay_channel': this
.payType, //网页打开支付宝支付:alipay_wap 支付宝正扫:alipay_qr 支付宝app:alipay 微信小程序:wx_lite 微信公众号:wx_pub
'open_id': this.payType == 'wx_lite' ? this.payInfo.OpenId : '',
'hb_fq_num': '',
'orderId': this.payInfo.OrderId,
};
this.loading = true
uni.showLoading({
title: '正在调起支付'
})
this.request2({
url: '/api/Adapay/GetAdapayInfo',
data: msg
},
res => {
this.loading = false
uni.hideLoading()
if (res.data != '') {
if (this.payType != 'wx_lite') {
this.aliPay(res.data)
this.AlipayMask = true
this.pay = false
} else {
this.wxPay(JSON.parse(res.data))
} }
} else { uni.hideNavigationBarLoading();
}
);
},
radioChange(e) {
if (e == 0) {
this.payType = 'wx_lite'
} else {
this.payType = 'alipay_qr'
}
},
cloGood() {
this.AlipayMask = false
this.pay = true
},
// 支付宝发送发送
send() {
},
copy() {
uniCopy({
content: this.url,
success: (res) => {
uni.showToast({ uni.showToast({
title: "调起支付失败,请重试", title: res,
icon: 'error' icon: 'none'
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 3000,
}) })
} }
// uni.hideNavigationBarLoading(); })
},
closePay() {
this.$emit('closePay');
},
// 支付宝支付
Pay() {
if(this.payType == 'wx_lite') {
this.wxPay()
} else {
let msg = {
'pay_channel': this
.payType, //网页打开支付宝支付:alipay_wap 支付宝正扫:alipay_qr 支付宝app:alipay 微信小程序:wx_lite 微信公众号:wx_pub
'open_id': this.payType == 'wx_lite' ? this.payInfo.OpenId : '',
'hb_fq_num': '',
'orderId': this.payInfo.OrderId,
};
this.loading = true
uni.showLoading({
title: '正在调起支付'
})
this.request2({
url: '/api/Adapay/GetAdapayInfo',
data: msg
},
res => {
this.loading = false
uni.hideLoading()
if (res.data != '') {
if (this.payType != 'wx_lite') {
this.aliPay(res.data)
this.AlipayMask = true
this.pay = false
} else {
this.wxPay(JSON.parse(res.data))
}
} else {
uni.showToast({
title: "调起支付失败,请重试",
icon: 'error'
})
}
}
);
} }
);
// } },
// else { // 支付宝支付
// this.AlipayMask = true aliPay(url) {
// this.pay = false // window.location.href = url
// } this.url = `http://jj.kookaku.com/pages/pay/transition?aliuri=${encodeURIComponent(url)}`
}, },
// 支付宝支付 // 微信支付
aliPay(url) { wxPay(payData) {
// window.location.href = url let that = this
this.url = `http://jj.kookaku.com/pages/pay/transition?aliuri=${encodeURIComponent(url)}` let orderInfo = this.orderInfo;
uni.showLoading({
}, title: '支付中...'
// 微信支付 })
wxPay(payData) { uni.requestPayment({
let that = this provider: 'wxpay',
uni.showLoading({ timeStamp: that.orderInfo.timeStamp,
title: '支付中...' nonceStr: that.orderInfo.nonceStr,
}) package: that.orderInfo.package,
wx.requestPayment({ signType: that.orderInfo.signType,
"timeStamp": payData.timeStamp, //时间戳,自1970年以来的秒数 paySign: that.orderInfo.sign,
"nonceStr": payData.nonceStr, //随机串 success: function(res) {
"package": payData.package, uni.hideLoading()
"signType": payData.signType, //微信签名方式: if (that.u && that.u.TenantId == 27) {
"paySign": payData.paySign, //微信签名 uni.navigateTo({
'success': function(res) { url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}`
uni.hideLoading() });
if (that.u && that.u.TenantId == 27) { that.pay = false
uni.navigateTo({ } else {
url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}` uni.navigateTo({
// url: '/pages/order-submit/pay-success2?payInfo='+JSON.stringify(that.payInfo) url: '/pages/order-submit/pay-success?payInfo=' + JSON.stringify(that
}); .payInfo)
that.pay = false });
} else { that.pay = false
}
},
fail: function(res) {
uni.hideLoading()
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/pay-success?payInfo=' + JSON.stringify(that url: '/pages/order/index/index?status=1'
.payInfo)
}); });
that.pay = false that.pay = false
},
complete: function(res) {
} }
// uni.showToast({ })
// title:'支付成功' },
// }) }
},
'fail': function(res) {
uni.hideLoading()
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'
});
that.pay = false
},
'complete': function(res) {
// uni.showToast({
// title:res.errMsg
// })
}
})
},
}
}; };
</script> </script>
......
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