Commit 8503ca2a8ba4cc937719f1bdeaedef3da3bf4656
Merge branch 'dev' into 'test'
Dev See merge request !244
Showing
4 changed files
with
84 additions
and
72 deletions
pages/giftpack/buygiftpack/giftpackbuy.js
| @@ -71,6 +71,34 @@ Page({ | @@ -71,6 +71,34 @@ Page({ | ||
| 71 | }; | 71 | }; | 
| 72 | var data = JSON.stringify(json); | 72 | var data = JSON.stringify(json); | 
| 73 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 73 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 
| 74 | + getApp().request.json_post(url, json, | ||
| 75 | + function(res) { | ||
| 76 | + if (res.data.code == 0) { | ||
| 77 | + var order_sn = res.data.data.orderSn; | ||
| 78 | + res = res.data.data.result; | ||
| 79 | + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | ||
| 80 | + wx.requestPayment({ | ||
| 81 | + timeStamp: String(res.timeStamp), | ||
| 82 | + nonceStr: res.nonceStr, | ||
| 83 | + package: res.packageValue, | ||
| 84 | + signType: res.signType, | ||
| 85 | + paySign: res.paySign, | ||
| 86 | + success: function(res) { | ||
| 87 | + getApp().goto(url); | ||
| 88 | + }, | ||
| 89 | + fail: function(res) { | ||
| 90 | + getApp().my_confirm("取消支付", 0, th); | ||
| 91 | + } | ||
| 92 | + }); | ||
| 93 | + } else { | ||
| 94 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 95 | + } | ||
| 96 | + }, | ||
| 97 | + function(res) { | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + ) | ||
| 74 | wx.request({ | 102 | wx.request({ | 
| 75 | url: url, | 103 | url: url, | 
| 76 | data: data, | 104 | data: data, | 
| @@ -136,32 +164,27 @@ Page({ | @@ -136,32 +164,27 @@ Page({ | ||
| 136 | }; | 164 | }; | 
| 137 | var data = JSON.stringify(json); | 165 | var data = JSON.stringify(json); | 
| 138 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 166 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 
| 139 | - wx.request({ | ||
| 140 | - url: url, | ||
| 141 | - data: data, | ||
| 142 | - method: 'post', | ||
| 143 | - header: { | ||
| 144 | - 'content-type': 'application/json' | ||
| 145 | - }, // 设置请求的 header | ||
| 146 | - success: function(res) { | ||
| 147 | - wx.hideLoading(); | 167 | + getApp().request.json_post(url, json, | 
| 168 | + function(res) { | ||
| 148 | if (res.data.code == 0) { | 169 | if (res.data.code == 0) { | 
| 149 | getApp().my_warnning("兑换成功!", 1, th); | 170 | getApp().my_warnning("兑换成功!", 1, th); | 
| 150 | } else { | 171 | } else { | 
| 151 | getApp().my_warnning(res.data.msg, 0, th); | 172 | getApp().my_warnning(res.data.msg, 0, th); | 
| 152 | } | 173 | } | 
| 174 | + }, | ||
| 175 | + function(res) { | ||
| 176 | + | ||
| 153 | } | 177 | } | 
| 154 | - }) | 178 | + | 
| 179 | + ) | ||
| 155 | 180 | ||
| 156 | }) | 181 | }) | 
| 157 | 182 | ||
| 158 | }, | 183 | }, | 
| 159 | getList: function(e) { | 184 | getList: function(e) { | 
| 160 | var th = this; | 185 | var th = this; | 
| 161 | - wx.showLoading({ | ||
| 162 | - title: '加载中', | ||
| 163 | - }); | ||
| 164 | getApp().request.get('/api/weshop/marketing/giftbag/page', { | 186 | getApp().request.get('/api/weshop/marketing/giftbag/page', { | 
| 187 | + isShowLoading: true, | ||
| 165 | data: { | 188 | data: { | 
| 166 | storeId: th.data.getStorageID, //商家ID | 189 | storeId: th.data.getStorageID, //商家ID | 
| 167 | userId: th.data.getUserID, //用户ID | 190 | userId: th.data.getUserID, //用户ID | 
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -61,9 +61,7 @@ Page({ | @@ -61,9 +61,7 @@ Page({ | ||
| 61 | }, | 61 | }, | 
| 62 | function() { | 62 | function() { | 
| 63 | my_confirm.open_cancel(0); | 63 | my_confirm.open_cancel(0); | 
| 64 | - wx.showLoading({ | ||
| 65 | - title: '加载中', | ||
| 66 | - }) | 64 | + | 
| 67 | var json = { | 65 | var json = { | 
| 68 | "actId": '', //活动Id | 66 | "actId": '', //活动Id | 
| 69 | "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | 67 | "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | 
| @@ -75,38 +73,37 @@ Page({ | @@ -75,38 +73,37 @@ Page({ | ||
| 75 | }; | 73 | }; | 
| 76 | var data = JSON.stringify(json); | 74 | var data = JSON.stringify(json); | 
| 77 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 75 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 
| 78 | - wx.request({ | ||
| 79 | - url: url, | ||
| 80 | - data: data, | ||
| 81 | - method: 'post', | ||
| 82 | - header: { | ||
| 83 | - 'content-type': 'application/json' | ||
| 84 | - }, // 设置请求的 header | ||
| 85 | - success: function(res) { | ||
| 86 | - wx.hideLoading(); | ||
| 87 | - if (res.data.code == 0) { | ||
| 88 | - var res = res.data.data; | ||
| 89 | - var order_sn = res.orderSn; | ||
| 90 | - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | ||
| 91 | - wx.requestPayment({ | ||
| 92 | - timeStamp: String(res.result.timeStamp), | ||
| 93 | - nonceStr: res.result.nonceStr, | ||
| 94 | - package: res.result.packageValue, | ||
| 95 | - signType: res.result.signType, | ||
| 96 | - paySign: res.result.paySign, | ||
| 97 | - success: function(n) { | ||
| 98 | - getApp().goto(url); | ||
| 99 | - }, | ||
| 100 | - fail: function(n) { | ||
| 101 | - getApp().my_confirm("取消支付", 0, th); | ||
| 102 | - } | ||
| 103 | - }); | ||
| 104 | - } else { | ||
| 105 | - getApp().my_warnning(res.data.msg, 0, th); | ||
| 106 | - } | 76 | + | 
| 77 | + getApp().request.json_post(url,json, | ||
| 78 | + function(res){ | ||
| 79 | + if (res.data.code == 0) { | ||
| 80 | + var res = res.data.data; | ||
| 81 | + var order_sn = res.orderSn; | ||
| 82 | + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | ||
| 83 | + wx.requestPayment({ | ||
| 84 | + timeStamp: String(res.result.timeStamp), | ||
| 85 | + nonceStr: res.result.nonceStr, | ||
| 86 | + package: res.result.packageValue, | ||
| 87 | + signType: res.result.signType, | ||
| 88 | + paySign: res.result.paySign, | ||
| 89 | + success: function (n) { | ||
| 90 | + getApp().goto(url); | ||
| 91 | + }, | ||
| 92 | + fail: function (n) { | ||
| 93 | + getApp().my_confirm("取消支付", 0, th); | ||
| 94 | + } | ||
| 95 | + }); | ||
| 96 | + } else { | ||
| 97 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 107 | } | 98 | } | 
| 108 | - }) | 99 | + }, | 
| 100 | + function(res){ | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + ) | ||
| 109 | 105 | ||
| 106 | + | ||
| 110 | } | 107 | } | 
| 111 | 108 | ||
| 112 | 109 | ||
| @@ -128,9 +125,6 @@ Page({ | @@ -128,9 +125,6 @@ Page({ | ||
| 128 | }, | 125 | }, | 
| 129 | function() { | 126 | function() { | 
| 130 | my_confirm.open_cancel(0); | 127 | my_confirm.open_cancel(0); | 
| 131 | - wx.showLoading({ | ||
| 132 | - title: '加载中', | ||
| 133 | - }) | ||
| 134 | var json = { | 128 | var json = { | 
| 135 | "actId": '', //活动Id | 129 | "actId": '', //活动Id | 
| 136 | "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | 130 | "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | 
| @@ -141,23 +135,19 @@ Page({ | @@ -141,23 +135,19 @@ Page({ | ||
| 141 | }; | 135 | }; | 
| 142 | var data = JSON.stringify(json); | 136 | var data = JSON.stringify(json); | 
| 143 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 137 | var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | 
| 144 | - wx.request({ | ||
| 145 | - url: url, | ||
| 146 | - data: data, | ||
| 147 | - method: 'post', | ||
| 148 | - header: { | ||
| 149 | - 'content-type': 'application/json' | ||
| 150 | - }, // 设置请求的 header | ||
| 151 | - success: function(res) { | ||
| 152 | - wx.hideLoading(); | ||
| 153 | - if (res.data.code == 0) { | ||
| 154 | - getApp().my_warnning("兑换成功!", 1, th); | ||
| 155 | - } else { | ||
| 156 | - getApp().my_warnning(res.data.msg, 0, th); | ||
| 157 | - } | 138 | + getApp().request.json_post(url, json, | 
| 139 | + function (res) { | ||
| 140 | + if (res.data.code == 0) { | ||
| 141 | + getApp().my_warnning("兑换成功!", 1, th); | ||
| 142 | + } else { | ||
| 143 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 144 | + } | ||
| 145 | + }, | ||
| 146 | + function (res) { | ||
| 147 | + | ||
| 158 | } | 148 | } | 
| 159 | - }) | ||
| 160 | 149 | ||
| 150 | + ) | ||
| 161 | }) | 151 | }) | 
| 162 | 152 | ||
| 163 | 153 | ||
| @@ -165,9 +155,6 @@ Page({ | @@ -165,9 +155,6 @@ Page({ | ||
| 165 | GetMyGiftList: function() { | 155 | GetMyGiftList: function() { | 
| 166 | var _this = this; | 156 | var _this = this; | 
| 167 | var th = this; | 157 | var th = this; | 
| 168 | - wx.showLoading({ | ||
| 169 | - title: '加载中', | ||
| 170 | - }) | ||
| 171 | getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { | 158 | getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { | 
| 172 | data: { | 159 | data: { | 
| 173 | "storeId": a.stoid, //商家ID | 160 | "storeId": a.stoid, //商家ID | 
pages/giftpack/mygiftpack/mygiftpack.js
| @@ -42,10 +42,9 @@ Page({ | @@ -42,10 +42,9 @@ Page({ | ||
| 42 | }, | 42 | }, | 
| 43 | getList: function() { | 43 | getList: function() { | 
| 44 | var th = this; | 44 | var th = this; | 
| 45 | - wx.showLoading({ | ||
| 46 | - title: '加载中', | ||
| 47 | - }) | 45 | + | 
| 48 | getApp().request.get('/api/weshop/marketing/my/giftbag/page', { | 46 | getApp().request.get('/api/weshop/marketing/my/giftbag/page', { | 
| 47 | + isShowLoading:true, | ||
| 49 | data: { | 48 | data: { | 
| 50 | storeId: th.data.getStorageID, //商家ID | 49 | storeId: th.data.getStorageID, //商家ID | 
| 51 | userId: th.data.getUserID, //用户ID | 50 | userId: th.data.getUserID, //用户ID | 
utils/request.js
| @@ -116,7 +116,8 @@ module.exports = { | @@ -116,7 +116,8 @@ module.exports = { | ||
| 116 | }, | 116 | }, | 
| 117 | showLoading: function() { | 117 | showLoading: function() { | 
| 118 | wx.showLoading({ | 118 | wx.showLoading({ | 
| 119 | - title: "加载中" | 119 | + title: "加载中", | 
| 120 | + mask:true, | ||
| 120 | }); | 121 | }); | 
| 121 | }, | 122 | }, | 
| 122 | hideLoading: function() { | 123 | hideLoading: function() { | 
| @@ -220,6 +221,8 @@ module.exports = { | @@ -220,6 +221,8 @@ module.exports = { | ||
| 220 | * @param {Object} fail //失败的回调 | 221 | * @param {Object} fail //失败的回调 | 
| 221 | */ | 222 | */ | 
| 222 | json_post:function(url,data,succ,fail){ | 223 | json_post:function(url,data,succ,fail){ | 
| 224 | + var th=this; | ||
| 225 | + this.showLoading(); | ||
| 223 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; | 226 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; | 
| 224 | var str = JSON.stringify(data); | 227 | var str = JSON.stringify(data); | 
| 225 | wx.request({ | 228 | wx.request({ | 
| @@ -229,7 +232,7 @@ module.exports = { | @@ -229,7 +232,7 @@ module.exports = { | ||
| 229 | header: { | 232 | header: { | 
| 230 | 'content-type': 'application/json' | 233 | 'content-type': 'application/json' | 
| 231 | },// 设置请求的 header | 234 | },// 设置请求的 header | 
| 232 | - success: function (res) { succ(res); }, | 235 | + success: function (res) { succ(res);th.hideLoading(); }, | 
| 233 | fail:function(res){fail(res);} | 236 | fail:function(res){fail(res);} | 
| 234 | }) | 237 | }) | 
| 235 | } | 238 | } | 
