diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index ed1aa98..dd2f08c 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -47,7 +47,6 @@ Page({ var my_confirm = th.selectComponent("#my_confirm"); //组件的id var order_sn = e.currentTarget.dataset.order_sn; //订单号 var money = e.currentTarget.dataset.money; //支付金额 - my_confirm.open( "是否确定购买该礼包", "取消", @@ -57,9 +56,6 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -99,37 +95,7 @@ Page({ } ) - 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 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); - } - } - }) + } @@ -151,9 +117,6 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -191,8 +154,7 @@ Page({ page: th.data.pages, pageSize: th.data.pageSize }, - success: function success(res) { - wx.hideLoading(); + success: function(res) { if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -236,9 +198,7 @@ Page({ var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; - wx.showLoading({ - title: '加载中...', - }) + th.getList(); }, //图片失败,默认图片 diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 050415b..ec28d16 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -61,7 +61,7 @@ Page({ }, function() { my_confirm.open_cancel(0); - + var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -74,36 +74,36 @@ 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 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) { + } - }, - function(res){ - } + ) - ) - } @@ -136,18 +136,18 @@ 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) { - getApp().my_warnning("兑换成功!", 1, th); - } else { - getApp().my_warnning(res.data.msg, 0, th); - } + function(res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } }, - function (res) { + function(res) { } - ) + ) }) @@ -156,13 +156,13 @@ Page({ var _this = this; var th = this; getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { + isShowLoading: true, data: { "storeId": a.stoid, //商家ID "userId": d.user_id, //用户ID "orderSn": th.data.orderSn }, - success: function success(res) { - wx.hideLoading(); + success: function(res) { if (res.data.code == 0) { th.setData({ giftImage: th.data.iurl + res.data.data.lbUrl, @@ -224,6 +224,7 @@ Page({ var _this2 = this; var th = this.data; getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { + isShowLoading: true, data: { "storeId": a.stoid, //商家ID "userId": d.user_id, //用户ID @@ -278,9 +279,6 @@ Page({ //获取核销码 getcode: function() { var th = this; - wx.showLoading({ - title: '加载中', - }) var orderSn = th.data.orderSn; //订单号 var json = { "storeId": a.stoid, @@ -288,15 +286,8 @@ Page({ }; var data = JSON.stringify(json); var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 - wx.request({ - url: url, - data: data, - method: 'put', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); + getApp().request.json_post(url, json, + function(res) { if (res.data.code == 0) { th.setData({ code: res.data.data @@ -305,8 +296,14 @@ Page({ } else { getApp().my_warnning(res.data.msg, 0, th); } - } - }) + }, + function(res) { + + }, + "put" + + ) + }, //界面跳转 goto: function(e) { diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index a19778b..d72bc94 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -37,7 +37,7 @@ 礼包内容 - + diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 5108445..6708adf 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -52,7 +52,6 @@ Page({ pageSize: th.data.pageSize }, success: function success(res) { - wx.hideLoading(); if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -97,9 +96,6 @@ Page({ var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; - wx.showLoading({ - title: '加载中...', - }) th.getList(); }, //图片失败,默认图片 diff --git a/pages/giftpack/newvipgift/newvipgift.js b/pages/giftpack/newvipgift/newvipgift.js index d19ccc0..601e05c 100644 --- a/pages/giftpack/newvipgift/newvipgift.js +++ b/pages/giftpack/newvipgift/newvipgift.js @@ -33,10 +33,8 @@ Page({ GetList: function() { var th = this; var url = "/api/weshop/marketing/giftbag/bound/get"; - wx.showLoading({ - title: '加载中', - }) getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动id "actType": 1, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 @@ -45,7 +43,6 @@ Page({ "userId": d.user_id //用户ID } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons != null && res.data.data.lbCoupons.length > 0) { //礼包内容--礼券 @@ -137,9 +134,6 @@ Page({ th.setData({ is_sub: 1 }) - wx.showLoading({ - title: '加载中', - }) var json = { "actId": th.data.getActId, //活动Id "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -149,15 +143,8 @@ Page({ }; var data = JSON.stringify(json); var url = th.data.url + "/api/weshop/marketing/free/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) { th.setData({ is_sub: 0 }) @@ -169,8 +156,13 @@ Page({ } else { getApp().my_warnning(res.data.msg, 0, th); } - } - }) + }, + function(res) { + + }, "post" + + ) + } }, //界面跳转