Browse Source

支付结果页面

master
jiazhipeng 11 months ago
parent
commit
da8b998c18
  1. 12
      pages/order/pay/index.js
  2. 15
      pages/user/cartlist/list.js
  3. 11
      project.private.config.json

12
pages/order/pay/index.js

@ -47,6 +47,9 @@ Page({
codeId:null, codeId:null,
inputAreaHeight: 0, inputAreaHeight: 0,
heightTimer: null, heightTimer: null,
isPaying: false,
}, },
/** /**
@ -103,6 +106,9 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
// 正在支付中不处理
if (this.data.isPaying) return
commonApi.user_post("subwallet.ermb/wallet",{}).then(res=>{ commonApi.user_post("subwallet.ermb/wallet",{}).then(res=>{
// 给建设银行子钱包做标识 // 给建设银行子钱包做标识
let resData = res.data || [] let resData = res.data || []
@ -248,6 +254,7 @@ Page({
}).then(res=>{ }).then(res=>{
res.data = JSON.parse(res.data) res.data = JSON.parse(res.data)
console.log(res.data) console.log(res.data)
_this.data.isPaying = true
wx.requestPayment({ wx.requestPayment({
nonceStr: res.data.nonceStr || res.data.noncestr, nonceStr: res.data.nonceStr || res.data.noncestr,
package: res.data.package, package: res.data.package,
@ -260,12 +267,15 @@ Page({
icon:'success' icon:'success'
}) })
setTimeout(()=>{ setTimeout(()=>{
// 支付成功不还原isPaying redirectTo 会删掉当前页面触发unload
// _this.data.isPaying = false
wx.redirectTo({ wx.redirectTo({
url: '../payresult/index?tid='+_this.data.id+'&ids='+_this.data.ids.join(',') url: '../payresult/index?tid='+_this.data.id+'&ids='+_this.data.ids.join(',')
}) })
},1000) },1000)
}, },
fail:function(err){ fail:function(err){
_this.data.isPaying = false
console.log(err) console.log(err)
} }
}) })
@ -557,7 +567,7 @@ Page({
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
if (!this.data.status) { if (!this.data.status && !this.data.isPaying) {
wx.reLaunch({ wx.reLaunch({
url: '/pages/user/order/list', url: '/pages/user/order/list',
}) })

15
pages/user/cartlist/list.js

@ -54,10 +54,25 @@ Page({
getList: function () { getList: function () {
commonApi.user_post("cart/get_list", { commonApi.user_post("cart/get_list", {
// type: '1' // type: '1'
offset:0,
limit:10,
}).then(res => { }).then(res => {
this.setData({ this.setData({
list: res.data list: res.data
}) })
commonApi.user_post("cart/get_list", {
// type: '1'
offset:10,
limit:999,
}).then(res => {
let resData = this.data.list.concat((res.data || []))
this.setData({
list: resData
})
})
}) })
}, },
minus: function (e) { minus: function (e) {

11
project.private.config.json

@ -6,10 +6,17 @@
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
{
"name": "pages/order/pay/index",
"pathName": "pages/order/pay/index",
"query": "id=28182505151348102853",
"launchMode": "default",
"scene": null
},
{ {
"name": "pages/user/order/movieOrderInfo/index", "name": "pages/user/order/movieOrderInfo/index",
"pathName": "pages/user/order/movieOrderInfo/index", "pathName": "pages/order/payresult/index",
"query": "id=46022504271632102675", "query": "id=28182505151342456109",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },

Loading…
Cancel
Save