diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index d4f2510..ed1aa98 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -71,6 +71,34 @@ Page({ }; var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + getApp().request.json_post(url, json, + function(res) { + if (res.data.code == 0) { + var order_sn = res.data.data.orderSn; + res = res.data.data.result; + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; + wx.requestPayment({ + timeStamp: String(res.timeStamp), + nonceStr: res.nonceStr, + package: res.packageValue, + signType: res.signType, + paySign: res.paySign, + success: function(res) { + getApp().goto(url); + }, + fail: function(res) { + getApp().my_confirm("取消支付", 0, th); + } + }); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function(res) { + + } + + ) wx.request({ url: url, data: data, @@ -136,32 +164,27 @@ Page({ }; var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; - wx.request({ - url: url, - data: data, - method: 'post', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); + getApp().request.json_post(url, json, + function(res) { if (res.data.code == 0) { getApp().my_warnning("兑换成功!", 1, th); } else { getApp().my_warnning(res.data.msg, 0, th); } + }, + function(res) { + } - }) + + ) }) }, getList: function(e) { var th = this; - wx.showLoading({ - title: '加载中', - }); getApp().request.get('/api/weshop/marketing/giftbag/page', { + isShowLoading: true, data: { storeId: th.data.getStorageID, //商家ID userId: th.data.getUserID, //用户ID diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index a7e6a29..050415b 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -61,9 +61,7 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) + var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -75,38 +73,37 @@ Page({ }; var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; - wx.request({ - url: url, - data: data, - method: 'post', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); - if (res.data.code == 0) { - var res = res.data.data; - var order_sn = res.orderSn; - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; - wx.requestPayment({ - timeStamp: String(res.result.timeStamp), - nonceStr: res.result.nonceStr, - package: res.result.packageValue, - signType: res.result.signType, - paySign: res.result.paySign, - success: function(n) { - getApp().goto(url); - }, - fail: function(n) { - getApp().my_confirm("取消支付", 0, th); - } - }); - } else { - getApp().my_warnning(res.data.msg, 0, th); - } + + getApp().request.json_post(url,json, + function(res){ + if (res.data.code == 0) { + var res = res.data.data; + var order_sn = res.orderSn; + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; + wx.requestPayment({ + timeStamp: String(res.result.timeStamp), + nonceStr: res.result.nonceStr, + package: res.result.packageValue, + signType: res.result.signType, + paySign: res.result.paySign, + success: function (n) { + getApp().goto(url); + }, + fail: function (n) { + getApp().my_confirm("取消支付", 0, th); + } + }); + } else { + getApp().my_warnning(res.data.msg, 0, th); } - }) + }, + function(res){ + + } + + ) + } @@ -128,9 +125,6 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -141,23 +135,19 @@ Page({ }; var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; - wx.request({ - url: url, - data: data, - method: 'post', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); - if (res.data.code == 0) { - getApp().my_warnning("兑换成功!", 1, th); - } else { - getApp().my_warnning(res.data.msg, 0, th); - } + getApp().request.json_post(url, json, + function (res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function (res) { + } - }) + ) }) @@ -165,9 +155,6 @@ Page({ GetMyGiftList: function() { var _this = this; var th = this; - wx.showLoading({ - title: '加载中', - }) getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { data: { "storeId": a.stoid, //商家ID diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 6dd2691..5108445 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -42,10 +42,9 @@ Page({ }, getList: function() { var th = this; - wx.showLoading({ - title: '加载中', - }) + getApp().request.get('/api/weshop/marketing/my/giftbag/page', { + isShowLoading:true, data: { storeId: th.data.getStorageID, //商家ID userId: th.data.getUserID, //用户ID