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

微信支付

parent ce04d204
......@@ -52,14 +52,14 @@
<!-- 内容 -->
</view>
<!-- 新增分类科目结束 -->
<view class="catstyle4" style="height: 100%;">
<view class="catstyle4" style="height: 100%;margin-bottom: 20rpx;">
<!-- <div class="left-slider">
<sidebar :active="tid" name="Name" :active-color="mainColor" :border="false" :list="d"
@change="changeHandler" @change2="changeHandler2"></sidebar>
</div> -->
<div class="right-slider">
<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)">
<image mode="aspectFit" :src="d[tid].advert_url" style="width: 100%; height: 100%;" />
</div>
......@@ -204,7 +204,7 @@
</view>
</template>
</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>
</div>
<template v-if="u&&u.TenantId==27">
......@@ -531,6 +531,7 @@
);
},
lower(e) {
// console.log('4444')
if (this.msg.pageIndex < this.page_count) {
if (!this.loading) {
this.msg.pageIndex++;
......@@ -552,9 +553,9 @@
</script>
<style >
.The-tail .u-divider{
/* .The-tail >>> .u-divider{
background-color: transparent !important;
}
} */
.The-title{
white-space: nowrap;
overflow: hidden;
......
......@@ -32,8 +32,6 @@ export default {
return {
show: true,
orderInfo: {},
};
},
created() {
......
......@@ -113,7 +113,8 @@
};
},
created() {
console.log(wx)
// console.log(wx)
this.getDataInfo();
this.u = uni.getStorageSync('mall_UserInfo')
this.mc = this.$uiConfig.mainColor;
this.TimingState();
......@@ -121,12 +122,12 @@
this.TimingState();
}, 30000);
},
onShow (){
onShow() {
this.TimingState();
this.times = setInterval(() => {
this.TimingState();
}, 30000);
},
wacth: {
payInfo: {
......@@ -139,7 +140,7 @@
methods: {
// 定时查询状态
TimingState() {
let that =this
let that = this
this.request2({
url: '/api/AppletOrder/GetAppletMyOrderInfo',
data: {
......@@ -148,153 +149,166 @@
}
},
(res) => {
if(res.data.OrderStatus==5){
clearInterval(this.times);
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)
});
if (res.data.OrderStatus == 5) {
clearInterval(this.times);
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)
});
that.pay = false
}
// console.log('状态',res.data.OrderStatus)
// console.log('状态',res.data.OrderStatus)
}
);
},
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({
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))
},
// 微信支付一开始的请求
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);
}
} 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({
title: "调起支付失败,请重试",
icon: 'error'
title: res,
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
// this.pay = false
// }
},
// 支付宝支付
aliPay(url) {
// window.location.href = url
this.url = `http://jj.kookaku.com/pages/pay/transition?aliuri=${encodeURIComponent(url)}`
},
// 支付宝支付
aliPay(url) {
// window.location.href = url
this.url = `http://jj.kookaku.com/pages/pay/transition?aliuri=${encodeURIComponent(url)}`
},
// 微信支付
wxPay(payData) {
let that = this
uni.showLoading({
title: '支付中...'
})
wx.requestPayment({
"timeStamp": payData.timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": payData.nonceStr, //随机串
"package": payData.package,
"signType": payData.signType, //微信签名方式:
"paySign": payData.paySign, //微信签名
'success': function(res) {
uni.hideLoading()
if (that.u && that.u.TenantId == 27) {
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)
});
that.pay = false
} else {
},
// 微信支付
wxPay(payData) {
let that = this
let orderInfo = this.orderInfo;
uni.showLoading({
title: '支付中...'
})
uni.requestPayment({
provider: 'wxpay',
timeStamp: that.orderInfo.timeStamp,
nonceStr: that.orderInfo.nonceStr,
package: that.orderInfo.package,
signType: that.orderInfo.signType,
paySign: that.orderInfo.sign,
success: function(res) {
uni.hideLoading()
if (that.u && that.u.TenantId == 27) {
uni.navigateTo({
url: `/pages/order-submit/pay-success2?payInfo=${JSON.stringify(that.payInfo)}&StuId=${that.StuId}&TeacherIds=${that.TeacherIds}`
});
that.pay = false
} else {
uni.navigateTo({
url: '/pages/order-submit/pay-success?payInfo=' + JSON.stringify(that
.payInfo)
});
that.pay = false
}
},
fail: function(res) {
uni.hideLoading()
uni.navigateTo({
url: '/pages/order-submit/pay-success?payInfo=' + JSON.stringify(that
.payInfo)
url: '/pages/order/index/index?status=1'
});
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>
......
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