Commit a6a9ca33f9520398108efce7355d76b4b5c48e2d

Authored by yvan.ni
1 parent 19d480b4

多活动优化

packageA/pages/distribution/goods/goods.js
@@ -99,7 +99,7 @@ Page({ @@ -99,7 +99,7 @@ Page({
99 onShow: function () { 99 onShow: function () {
100 100
101 getApp().check_can_share(); 101 getApp().check_can_share();
102 - let url = '/api/weshop/goods/page'; 102 + let url = '/api/weshop/goods/page?isnewwhere=1';
103 let currentQuery = this.data.currentQuery; 103 let currentQuery = this.data.currentQuery;
104 if(app.globalData.userInfo) { 104 if(app.globalData.userInfo) {
105 if(!this.data.isLogin) { 105 if(!this.data.isLogin) {
@@ -115,12 +115,10 @@ Page({ @@ -115,12 +115,10 @@ Page({
115 currentQuery.is_mainshow = 1; 115 currentQuery.is_mainshow = 1;
116 currentQuery.isonsale = 1; 116 currentQuery.isonsale = 1;
117 currentQuery.searchtype = 2; 117 currentQuery.searchtype = 2;
118 - // url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1';  
119 - // this.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', this.data.currentQuery); 118 +
120 } else {//下架商品 119 } else {//下架商品
121 currentQuery.searchtype = 1; 120 currentQuery.searchtype = 1;
122 - // url = '/api/weshop/goods/page?dis_type=1';  
123 - // this.getData(true, '/api/weshop/goods/page?dis_type=1', this.data.currentQuery); 121 +
124 }; 122 };
125 currentQuery.orderType = 'desc'; 123 currentQuery.orderType = 'desc';
126 currentQuery.dis_type = 1; 124 currentQuery.dis_type = 1;
@@ -235,9 +233,9 @@ Page({ @@ -235,9 +233,9 @@ Page({
235 let url = ''; 233 let url = '';
236 234
237 if(options.index == 0) { 235 if(options.index == 0) {
238 - url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; 236 + url = '/api/weshop/goods/page?isnewwhere=1&is_mainshow=1&isonsale=1&dis_type=1';
239 } else { 237 } else {
240 - url = '/api/weshop/goods/page'; 238 + url = '/api/weshop/goods/page?isnewwhere=1';
241 }; 239 };
242 240
243 241
@@ -367,10 +365,10 @@ Page({ @@ -367,10 +365,10 @@ Page({
367 365
368 366
369 if(this.data.options.index == 0) {//上架商品 367 if(this.data.options.index == 0) {//上架商品
370 - url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; 368 + url = '/api/weshop/goods/page?isnewwhere=1&is_mainshow=1&isonsale=1&dis_type=1';
371 } else {//下架商品 369 } else {//下架商品
372 data.dis_type = 1; 370 data.dis_type = 1;
373 - url = '/api/weshop/goods/page?searchtype=1'; 371 + url = '/api/weshop/goods/page?isnewwhere=1&searchtype=1';
374 }; 372 };
375 this.getData(true, url, data) 373 this.getData(true, url, data)
376 .then(function(callback) { 374 .then(function(callback) {
@@ -494,9 +492,9 @@ Page({ @@ -494,9 +492,9 @@ Page({
494 }; 492 };
495 493
496 if(options.index == 0) { 494 if(options.index == 0) {
497 - url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; 495 + url = '/api/weshop/goods/page?isnewwhere=1&is_mainshow=1&isonsale=1&dis_type=1';
498 } else { 496 } else {
499 - url = '/api/weshop/goods/page'; 497 + url = '/api/weshop/goods/page?isnewwhere=1';
500 }; 498 };
501 this.getData(true, url, data); 499 this.getData(true, url, data);
502 }, 500 },
@@ -697,7 +695,7 @@ Page({ @@ -697,7 +695,7 @@ Page({
697 duration: 1000, 695 duration: 1000,
698 }); 696 });
699 697
700 - self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false); 698 + self.getData(true, '/api/weshop/goods/page?isnewwhere=1&is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false);
701 } else { 699 } else {
702 wx.showToast({ 700 wx.showToast({
703 title: '上架失败', 701 title: '上架失败',
@@ -753,7 +751,7 @@ Page({ @@ -753,7 +751,7 @@ Page({
753 icon: 'success', 751 icon: 'success',
754 duration: 1000, 752 duration: 1000,
755 }); 753 });
756 - self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery, false); 754 + self.getData(true, '/api/weshop/goods/page?isnewwhere=1&dis_type=1&searchtype=1', self.data.currentQuery, false);
757 } else { 755 } else {
758 wx.showToast({ 756 wx.showToast({
759 title: '下架失败', 757 title: '下架失败',
@@ -850,7 +848,7 @@ Page({ @@ -850,7 +848,7 @@ Page({
850 currentTabIndex: 0, 848 currentTabIndex: 0,
851 }); 849 });
852 if(data.orderField) delete data.orderField; 850 if(data.orderField) delete data.orderField;
853 - this.getData(true, '/api/weshop/goods/page', data); 851 + this.getData(true, '/api/weshop/goods/page?isnewwhere=1', data);
854 return; 852 return;
855 }; 853 };
856 854
packageA/pages/serviceCard_pd/cart/cart.js
@@ -90,48 +90,6 @@ Page({ @@ -90,48 +90,6 @@ Page({
90 to.auth.get_u(func); 90 to.auth.get_u(func);
91 }, 91 },
92 92
93 - //-------------------获取物流---------------  
94 - get_wuliu(func) {  
95 - var th = this;  
96 - console.log("getwuliu4545");  
97 - to.getwuliu(function (e) {  
98 - if (th.data.is_default_logistics) {  
99 - //如果第一个不是开启默认,说明要让用户自己选  
100 - if (!e[0].is_default) {  
101 - th.setData({ is_default_logistics: 0 });  
102 - }  
103 - }  
104 - th.setData({ wu_arr: e })  
105 - typeof func == "function" && func();  
106 - })  
107 - },  
108 -  
109 - //------获取会员收货地址-----  
110 - getuser_addr: function (func) {  
111 - if (to.globalData.baddr != null) {  
112 - var user_addr = to.globalData.baddr;  
113 - to.globalData.baddr = null;  
114 - func(user_addr);  
115 - } else {  
116 - a.get("/api/weshop/useraddress/page", {  
117 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 },  
118 - success: function (su) {  
119 -  
120 - var user_addr = su.data.data.pageData;  
121 - var item = null;  
122 - var def_item = null;  
123 - for (var i = 0; i < user_addr.length; i++) {  
124 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
125 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
126 - }  
127 - if (item == null) item = def_item;  
128 - if (item == null) item = user_addr[0];  
129 - if (item == undefined) item = null;  
130 - func(item);  
131 - }  
132 - });  
133 - }  
134 - },  
135 //----------------展示页面,是再获取用户信息之后-------------- 93 //----------------展示页面,是再获取用户信息之后--------------
136 show_page: function () { 94 show_page: function () {
137 var th = this; 95 var th = this;
@@ -141,23 +99,10 @@ Page({ @@ -141,23 +99,10 @@ Page({
141 data: { r: Math.random() }, 99 data: { r: Math.random() },
142 success: function (e) { 100 success: function (e) {
143 101
144 - getApp().globalData.userInfo = e.data.data;  
145 - th.setData({ userinfo: e.data.data });  
146 - //获取立即购买的商品信息  
147 - th.get_buy_goods();  
148 -  
149 - //获取提现金额  
150 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
151 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
152 - success: function (su) {  
153 - if (su.data.code == 0) {  
154 - var yuer = parseFloat(th.data.userinfo.user_money -  
155 - (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);  
156 - if (yuer < 0) yuer = 0;  
157 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
158 - }  
159 - }  
160 - }); 102 + getApp().globalData.userInfo = e.data.data;
  103 + th.setData({ userinfo: e.data.data });
  104 + //获取立即购买的商品信息
  105 + th.get_buy_goods();
161 } 106 }
162 }); 107 });
163 }, 108 },
@@ -166,13 +111,14 @@ Page({ @@ -166,13 +111,14 @@ Page({
166 get_buy_goods: function () { 111 get_buy_goods: function () {
167 var th = this, a = getApp().request; 112 var th = this, a = getApp().request;
168 var gg = th.data.postdata; 113 var gg = th.data.postdata;
  114 + var url = "/api/weshop/serviceCard/get/" + oo.stoid + "/" + gg.id
169 //调用商品 115 //调用商品
170 - a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, { 116 + a.get(url, {
171 success: function (t) { 117 success: function (t) {
172 var gd = t.data.data; 118 var gd = t.data.data;
173 if (!gd) return false; 119 if (!gd) return false;
174 120
175 - t.data.data.original_img = oo.imghost + t.data.data.original_img; 121 + t.data.data.original_img = oo.imghost + t.data.data.imgUrl;
176 t.data.data['buynum'] = gg.goods_num; 122 t.data.data['buynum'] = gg.goods_num;
177 console.log(t.data.data); 123 console.log(t.data.data);
178 var distr_t = 0, et = 0 124 var distr_t = 0, et = 0
@@ -204,39 +150,21 @@ Page({ @@ -204,39 +150,21 @@ Page({
204 150
205 var gd = t.data.data; 151 var gd = t.data.data;
206 //-- 用商品的手店价来显示 -- 152 //-- 用商品的手店价来显示 --
207 - gg.goods_price = gd.shop_price;  
208 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
209 - var is_card_back = getApp().globalData.is_card_back;  
210 - if (is_card_back) {  
211 - gg.goods_price = gd[th.data.card_name];  
212 - t.data.data.shop_price = gg.goods_price;  
213 - getApp().globalData.is_card_back = 0;  
214 - th.setData({ card_cut_price: 0 });  
215 - } else {  
216 - //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
217 - if (th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {  
218 - var cut_p = gg.goods_price - gd[th.data.card_name];  
219 - th.setData({ card_cut_price: cut_p });  
220 - }  
221 - } 153 + gg.goods_price = gd.money;
222 154
223 if (th.data.bn_goods) { 155 if (th.data.bn_goods) {
224 et = th.data.bn_exp_type; 156 et = th.data.bn_exp_type;
225 } 157 }
226 158
227 -  
228 th.setData({ 159 th.setData({
229 bn_goods: t.data.data, bn_pickname: gg.pick_name, 160 bn_goods: t.data.data, bn_pickname: gg.pick_name,
230 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal: 1, bn_exp_type: et 161 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal: 1, bn_exp_type: et
231 }); 162 });
232 -  
233 -  
234 -  
235 th.calculatePrice2(); 163 th.calculatePrice2();
236 } else { 164 } else {
237 165
238 //--阶梯团很特殊,不能用总表来拿价格-- 166 //--阶梯团很特殊,不能用总表来拿价格--
239 - getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, { 167 + getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gg.prom_id, {
240 success: function (tt) { 168 success: function (tt) {
241 169
242 if (tt.data.code == 0) { 170 if (tt.data.code == 0) {
@@ -264,16 +192,12 @@ Page({ @@ -264,16 +192,12 @@ Page({
264 t.data.data.is_normal = 1; 192 t.data.data.is_normal = 1;
265 } 193 }
266 194
267 - if (th.data.bn_goods) {  
268 - et = th.data.bn_exp_type;  
269 - } 195 + if (th.data.bn_goods) { et = th.data.bn_exp_type; }
270 196
271 th.setData({ 197 th.setData({
272 bn_goods: t.data.data, bn_pickname: gg.pick_name, 198 bn_goods: t.data.data, bn_pickname: gg.pick_name,
273 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et 199 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
274 }); 200 });
275 -  
276 -  
277 //计算价格 201 //计算价格
278 th.calculatePrice2(); 202 th.calculatePrice2();
279 } 203 }
@@ -290,89 +214,11 @@ Page({ @@ -290,89 +214,11 @@ Page({
290 wx.navigateTo({ 214 wx.navigateTo({
291 url: "/pages/index/index/index" 215 url: "/pages/index/index/index"
292 }) 216 })
293 - } else {  
294 - this.getuser_addr(function (ie) {  
295 - //更换地址回来要重新调用计算价钱的接口  
296 - th.setData({ user_addr: ie });  
297 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {  
298 - th.setData({ add_back: 1 });  
299 - if (th.data.bn_goods) th.calculatePrice2();  
300 - }  
301 - })  
302 - //--更新默认地址--,看一下是不是跳到地址页面  
303 - if (!getApp().globalData.is_cart_old) {  
304 - this.update_code();  
305 - } else {  
306 - getApp().globalData.is_cart_old = 0;  
307 - }  
308 } 217 }
309 -  
310 -  
311 - //先获取是否有关闭使用优惠券  
312 - getApp().getConfig2(function (ee) {  
313 - var json_d = JSON.parse(ee.switch_list);  
314 - th.data.json_d = json_d;  
315 - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
316 - var is_default_logistics = json_d.is_default_logistics;  
317 -  
318 - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });  
319 -  
320 - var rank_switch = json_d.rank_switch;  
321 - var max_price = -1;  
322 - var show_card = null;  
323 - var name = "";  
324 - //如果有开等级卡的时候,  
325 - //因为都是调接口,要返回在计算  
326 - if (rank_switch == 2) {  
327 - //-- 获取所有的等级卡, --  
328 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
329 - {}).then(res => {  
330 - if (res.data.code == 0) {  
331 - var plusCard = res.data.data;  
332 - //-- 循环判断,拿到最贵的那张卡 --  
333 - for (var ih in plusCard) {  
334 - if (plusCard[ih].IsStopBuy == true) { continue; }  
335 - if (max_price < 0) {  
336 - max_price = plusCard[ih].CardFee;  
337 - name = 'card' + plusCard[ih]['CorrPrice'];  
338 - show_card = plusCard[ih];  
339 - } else {  
340 - if (max_price < plusCard[ih].CardFee) {  
341 - max_price = plusCard[ih].CardFee;  
342 - name = 'card' + plusCard[ih]['CorrPrice'];  
343 - show_card = plusCard[ih];  
344 - }  
345 - }  
346 - }  
347 -  
348 - if (show_card) {  
349 - name = name.toLowerCase();  
350 - th.setData({ card_name: name, show_card: show_card })  
351 - }  
352 - }  
353 - //-----先获取物流,再获取用户信息,再展示页面-----  
354 - th.get_wuliu(th.get_info(th.show_page));  
355 - })  
356 - } else {  
357 - //-----先获取物流,再获取用户信息,再展示页面-----  
358 - th.get_wuliu(th.get_info(th.show_page));  
359 - }  
360 - }, 1)  
361 -  
362 - },  
363 - //---------------检查是否有收货地址-------------------  
364 - checkAddressList: function () {  
365 - var t = this;  
366 - return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({  
367 - title: "请先填写或选择收货地址~",  
368 - success: function (a) {  
369 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
370 - },  
371 - fail: function () {  
372 - wx.navigateBack();  
373 - }  
374 - }), !1); 218 + //-----先获取物流,再获取用户信息,再展示页面-----
  219 + th.get_info(th.show_page);
375 }, 220 },
  221 +
376 showInvoice: function () { 222 showInvoice: function () {
377 this.setData({ 223 this.setData({
378 invoiceToggle: !this.data.invoiceToggle 224 invoiceToggle: !this.data.invoiceToggle
@@ -393,129 +239,37 @@ Page({ @@ -393,129 +239,37 @@ Page({
393 maxWord: t.detail.value.length 239 maxWord: t.detail.value.length
394 }); 240 });
395 }, 241 },
396 - //---------计算立即购买----------  
397 - calculatePrice2: function () {  
398 - var th = this, good = this.data.bn_goods;  
399 - //-----------计算商品总价--------------  
400 - var allpice = good.shop_price * good.buynum;  
401 - allpice = parseFloat(allpice).toFixed(2);  
402 - var txt = "formData.all_price";  
403 - th.setData({ [txt]: allpice, });  
404 - console.log(th.data.formData);  
405 -  
406 - to.getConfig2(function (ee) {  
407 - to.getwuliuprice(async function (rs) {  
408 - console.log('calculatePrice2222');  
409 - console.log(rs);  
410 - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;  
411 - var out_of_weight = null; //超出多少重量  
412 - var freight_free = ee.freight_free; //全场满多少包邮  
413 - var weight_free = ee.weight_free; //多少kg内包邮  
414 - var no_ex_id = ee.no_ex_id;  
415 - var no_ex_good = null;  
416 - var by_qc = {};  
417 - if (no_ex_id && freight_free > 0) {  
418 - //-----------获取不包邮区域,不包邮商品-------  
419 - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {  
420 - data: { store_id: os.stoid, id: no_ex_id }  
421 - }).then(res => {  
422 - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {  
423 - by_qc = res.data.data[0];  
424 - }  
425 - })  
426 - };  
427 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
428 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {  
429 - switch (good['exp_sum_type']) {  
430 - case 1:  
431 - //统一运费  
432 - o_shipping_price += good['uniform_exp_sum']; break;  
433 - case 2:  
434 - if (goods_weight < 0) goods_weight = 0;  
435 - //累积商品重量 每种商品的重量 * 数量  
436 - goods_weight += good['weight'] * good['buynum'];  
437 - if (weight_free > 0) {  
438 - out_of_weight = (weight_free * 1000) - goods_weight;  
439 - }  
440 - break;  
441 - case 3:  
442 - if (goods_piece < 0) goods_piece = 0;  
443 - //累积商品数量  
444 - goods_piece += good['buynum']; break;  
445 - }  
446 -  
447 - console.log(th.data.wu_arr);  
448 - var code = th.data.wu_arr[th.data.index].code;  
449 - th.data.is_no_by[th.data.bn_pick] = 0;  
450 - var no_by_data = null;  
451 - //--全部金额--  
452 - //有不包邮区域,且不免运费  
453 - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) {  
454 - //-----------获取不包邮区域,不包邮商品-------  
455 - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {  
456 - data: { store_id: os.stoid, id: no_ex_id }  
457 - }).then(res => {  
458 - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {  
459 - no_by_data = res.data.data[0];  
460 - //如果有设置不包邮区域的时候  
461 - if (res.data.data[0].region_list) {  
462 - if (th.check_by_area(res.data.data[0].region_list)) {  
463 - freight_free = 0;  
464 - // out_of_weight = 0;  
465 - th.data.is_no_by[th.data.bn_pick] = 1;  
466 - }  
467 - }  
468 - //如果有设置不包邮商品  
469 - if (res.data.data[0].goods_list && freight_free) {  
470 - if (th.check_by_goods(res.data.data[0].goods_list)) {  
471 - freight_free = 0;  
472 - // out_of_weight = 0;  
473 - th.data.is_no_by[th.data.bn_pick] = 1;  
474 - }  
475 - }  
476 - }  
477 - })  
478 - }  
479 - var shipping_price =  
480 - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
481 - goods_piece, th.data.user_addr, freight_free, allpice, rs,th.data.bn_pick); 242 + //---------计算立即购买----------
  243 + calculatePrice2: function () {
  244 + var th = this, good = this.data.bn_goods;
  245 + //-----------计算商品总价--------------
  246 + var allpice = good.shop_price * good.buynum;
  247 + allpice = parseFloat(allpice).toFixed(2);
  248 + var txt = "formData.all_price";
  249 + th.setData({ [txt]: allpice, });
482 250
483 - shipping_price = parseFloat(shipping_price).toFixed(2);  
484 - var wl_txt = "formData.shipping_price";  
485 - th.setData({ [wl_txt]: shipping_price, })  
486 251
487 - } else {  
488 - var wl_txt = "formData.shipping_price";  
489 - th.setData({ [wl_txt]: 0, })  
490 - }  
491 //-----------------总价----------------- 252 //-----------------总价-----------------
492 - var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price); 253 + var total_m = parseFloat(allpice);
493 total_m = parseFloat(total_m).toFixed(2); 254 total_m = parseFloat(total_m).toFixed(2);
494 -  
495 var atxt = "formData.total_amount"; 255 var atxt = "formData.total_amount";
496 th.setData({ [atxt]: total_m, }) 256 th.setData({ [atxt]: total_m, })
497 var order_m = total_m; 257 var order_m = total_m;
498 -  
499 - var txt = "formData.user_money";  
500 var txt2 = "formData.order_amount"; 258 var txt2 = "formData.order_amount";
501 - //--------------如果使用余额---------------------  
502 - if (th.data.bn_use_money == 1 && th.data.yuer > 0) {  
503 - if (parseFloat(th.data.yuer) > total_m) {  
504 - th.setData({ [txt]: total_m, [txt2]: 0 })  
505 - } else {  
506 - order_m = parseFloat(order_m) - parseFloat(th.data.yuer);  
507 - order_m = order_m.toFixed(2);  
508 - th.setData({ [txt]: th.data.yuer, [txt2]: order_m })  
509 - }  
510 - } else {  
511 - th.setData({ [txt]: 0, [txt2]: order_m })  
512 - } 259 + th.setData({ [txt2]: order_m })
513 260
514 - });  
515 - });  
516 }, 261 },
  262 +
  263 +
  264 + //-- 要弹起来提示一下 --
  265 + submitForm: function() {
  266 + var th = this;
  267 + this.sendsm(function() {
  268 + th.submit_func();
  269 + })
  270 + },
517 //--------------------提交订单----------------------- 271 //--------------------提交订单-----------------------
518 - submitForm: async function (t) { 272 + submit_func: async function (t) {
519 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 273 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
520 this.data.is_summit_ing = 1; 274 this.data.is_summit_ing = 1;
521 275
@@ -523,114 +277,64 @@ Page({ @@ -523,114 +277,64 @@ Page({
523 var ff = true; 277 var ff = true;
524 //------------立即购买------------- 278 //------------立即购买-------------
525 console.log("buy_new"); 279 console.log("buy_new");
526 -  
527 - //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候  
528 - if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {  
529 - ff = false;  
530 - getApp().my_warnning("请选择收货地址", 0, this);  
531 - this.data.is_summit_ing = 0;  
532 - }  
533 - if (!ff) return false;  
534 - var addr = th.data.user_addr;  
535 - if (th.data.bn_exp_type == 1) addr = null;  
536 -  
537 - console.log(th.data.formData);  
538 - console.log(th.data.wu_arr);  
539 - console.log(th.data.bn_exp_type);  
540 -  
541 - if (th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {  
542 - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {  
543 - getApp().my_warnning("读取物流失败", 0, this);  
544 - this.data.is_summit_ing = 0;  
545 - return false;  
546 - }  
547 - }  
548 -  
549 - //阶梯团强制带1,自提~~~  
550 - if (th.data.kt_type == 3) {  
551 - th.data.bn_exp_type = 1;  
552 - } 280 + th.data.bn_exp_type =1;
553 281
554 var item = { 282 var item = {
555 - 'user_id': to.globalData.user_id,  
556 - 'consignee': addr == null ? "" : addr.consignee,  
557 - 'province': addr == null ? 0 : addr.province,  
558 - 'city': addr == null ? 0 : addr.city,  
559 - 'district': addr == null ? 0 : addr.district,  
560 - 'twon': addr == null ? 0 : addr.twon,  
561 - 'address': addr == null ? "" : addr.address,  
562 - 'more_address': addr == null ? "" : addr.more_address,  
563 - 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,  
564 - 'email': '',  
565 - 'invoice_title': '',  
566 - 'goods_price': th.data.formData.all_price, //商品总价  
567 - 'shipping_price': th.data.formData.shipping_price, //物流金额  
568 - 'user_money': th.data.formData.user_money, //使用余额  
569 - 'total_amount': th.data.formData.total_amount, //订单总价  
570 - 'order_amount': th.data.formData.order_amount, //应付  
571 - 'user_note': t.detail.value.user_note, //用户备注  
572 - 'store_id': oo.stoid, //商家  
573 - 'pickup_id': th.data.bn_pick, //门店  
574 - 'exp_type': th.data.bn_exp_type, //配送方式  
575 - 'is_normal': th.data.bn_goods.is_normal, //是否是普通购买  
576 - 'pt_prom_id': th.data.bn_goods.prom_id, //拼单ID  
577 - 'is_pt_tz': th.data.is_pt_tz, //开团类型  
578 - 'order_goods': new Array(), 283 + 'user_id': to.globalData.user_id,
  284 + 'account': th.data.formData.order_amount,
  285 + 'store_id': oo.stoid, //商家
  286 + 'list': new Array(),
579 }; 287 };
580 288
581 - //如果不是阶梯团,或者是普通购买,  
582 - if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {  
583 - item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;  
584 - item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;  
585 - }  
586 289
587 - if (!th.data.bn_goods.is_normal) {  
588 - item.is_zsorder = th.data.kt_type + 1; //开团类型  
589 - }  
590 - //老会员成为分销下线需要的参数  
591 - if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {  
592 - //判断一下分享人是不是分享商  
593 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {  
594 - if (res.data.code == 0) {  
595 - var user = res.data.data;  
596 - if (user.is_distribut == 1) {  
597 - item.first_leader = parseInt(getApp().globalData.first_leader);  
598 - }  
599 - }  
600 - })  
601 - } 290 + var gg = to.get_b_now();
  291 + if (!gg.pick_id) {
  292 + getApp().showWarning("未找到门店");
  293 + return false;
  294 + }
  295 + var goods = {
  296 + 'card_id': gg.id,
  297 + 'itemid': th.data.bn_goods.erpItemID,
  298 + 'qty': gg.goods_num,
  299 + 'price': th.data.formData.order_amount,
  300 + 'pickup_id': gg.pick_id,
  301 + 'pickup_keyid': gg.keyid,
  302 + 'prom_type': this.data.postdata.prom_type, //促销活动类型
  303 + 'prom_id': this.data.postdata.prom_id, //促销活动id
  304 + 'is_pd_normal': th.data.bn_goods.is_normal, //是否是普通购买
  305 + 'is_pt_tz': th.data.is_pt_tz, //开团类型
  306 + };
  307 +
  308 + if (!th.data.bn_goods.is_normal) {
  309 + goods.is_zsorder = th.data.kt_type + 1; //开团类型
  310 + }
602 311
603 - if (th.data.qh != '') {  
604 - item.team_qh = th.data.qh;  
605 - item.pt_listno = th.data.qh;  
606 - } 312 + if (th.data.qh != '') {
  313 + goods.team_qh = th.data.qh;
  314 + goods.pt_listno = th.data.qh;
  315 + }
607 316
608 - var gg = to.get_b_now();  
609 - var goods = {  
610 - 'goods_id': gg.goods_id,  
611 - 'goods_name': gg.goods_name,  
612 - 'goods_sn': gg.goods_sn,  
613 - 'goods_num': gg.goods_num,  
614 - 'market_price': th.data.bn_goods.market_price,  
615 - 'goods_price': th.data.bn_goods.shop_price,  
616 - 'member_goods_price': th.data.bn_goods.shop_price,  
617 - 'store_id': oo.stoid,  
618 - 'prom_type': th.data.bn_goods.prom_type, //促销活动类型  
619 - 'prom_id': th.data.bn_goods.prom_id, //促销活动id  
620 - }; 317 + if(this.data.postdata.prom_type == 1) {
  318 + goods.price = this.data.postdata.prom_price;
  319 + };
621 320
622 - //--导购分享过来的id--  
623 - if (gg.guide_id) {  
624 - goods.guide_id = gg.guide_id;  
625 - goods.guide_type = gg.guide_type;  
626 - //调用接口判断是不是会员  
627 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {  
628 - if (res.data.code == 0) {  
629 - goods.guide_name = res.data.data.salesman;  
630 - goods.guide_sn = res.data.data.salesman_no;  
631 - }  
632 - })  
633 - } 321 + if(getApp().globalData.skinface_id){
  322 + goods.skinface_id=getApp().globalData.skinface_id;
  323 + }
  324 +
  325 + //--导购分享过来的id--
  326 + if (gg.guide_id) {
  327 + goods.guide_id = gg.guide_id;
  328 + goods.guide_type = gg.guide_type;
  329 + //调用接口判断是不是会员
  330 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(
  331 + res => {
  332 + if (res.data.code == 0) {
  333 + goods.guide_name = res.data.data.salesman;
  334 + goods.guide_sn = res.data.data.salesman_no;
  335 + }
  336 + })
  337 + }
634 338
635 339
636 //--商品的房间号-- 340 //--商品的房间号--
@@ -638,308 +342,87 @@ Page({ @@ -638,308 +342,87 @@ Page({
638 item.room_ids = gg.room_id; 342 item.room_ids = gg.room_id;
639 goods.room_id = gg.room_id; 343 goods.room_id = gg.room_id;
640 } 344 }
641 -  
642 - if (th.data.bn_goods.is_normal) { goods.is_pd_normal = 1; }  
643 -  
644 - item.order_goods.push(goods);  
645 - pdata.push(item);  
646 -  
647 - if (pdata.length == 0) return; 345 + item.list.push(goods);
  346 + pdata=item;
  347 + if (pdata.length == 0) return false;
648 var str = JSON.stringify(pdata); 348 var str = JSON.stringify(pdata);
649 - console.log("支付数据");  
650 - console.log(str);  
651 - //return false;  
652 - wx.showLoading({ title: "加载中" });  
653 - wx.request({  
654 - url: oo.url + '/api/weshop/order/createWxdOrder',  
655 - data: str,  
656 - method: 'POST',  
657 - header: {  
658 - 'content-type': 'application/json'  
659 - },// 设置请求的 header  
660 - success: function (res) {  
661 -  
662 - wx.hideLoading();  
663 - if (res.statusCode == 200) {  
664 - var data = res.data;  
665 - if (data.code == 0) {  
666 - console.log(th.data.is_b_now);  
667 - //如果是购物车结算,还要删除购物车  
668 - if (th.data.is_b_now == 0) {  
669 - console.log(th.data.cartlist_y);  
670 - var list = th.data.cartlist_y;  
671 - for (var i = 0; i < list.length; i++) {  
672 - //删除购物车  
673 - getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});  
674 - }  
675 - }  
676 - var order_amount = 0;  
677 - pdata.forEach(function (em, ind) {  
678 - order_amount += em.order_amount;  
679 - })  
680 - //要进行判断,如果是用微信支付,就要跳转到支付界面  
681 - if (order_amount > 0) {  
682 - th.setData({ isclose: 0 });  
683 - //void e.jumpToCart4({  
684 - // order_sn: data.data,  
685 - // type:1,  
686 - // }, 1);  
687 - util_pay.pay(data.data, function () {  
688 - setTimeout(function () {  
689 - wx.reLaunch({  
690 - //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,  
691 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
692 - })  
693 - }, 1000)  
694 - }, function () {  
695 - //支付失败  
696 - setTimeout(function () {  
697 - //wx.navigateBack({ delta: 1 })  
698 - wx.reLaunch({  
699 - url: "/pages/user/order_list/order_list",  
700 - })  
701 - }, 1000)  
702 -  
703 - }, oo.stoid, 1);  
704 -  
705 - } else {  
706 - var dd = {  
707 - parent_sn: data.data,  
708 - store_id: oo.stoid,  
709 - type: 1,  
710 - };  
711 - //return false;  
712 - getApp().request.post("/api/weshop/order/pay/createOrder", {  
713 - data: dd,  
714 - success: function (t) {  
715 - console.log(t);  
716 - // app.my_warnning("支付成功", 1, th);  
717 - wx.showToast({  
718 - title: '支付成功',  
719 - icon: 'success',  
720 - duration: 2000  
721 - });  
722 - setTimeout(function () {  
723 - th.setData({ isclose: 0 });  
724 -  
725 - if (th.data.is_normal == 1) {  
726 - /*--  
727 - wx.navigateTo({  
728 - url: "/pages/user/order_list/order_list",  
729 - })--*/  
730 - var url = "/pages/payment/pay_success/pay_success?type=1&order_sn=" + data.data;  
731 - wx.reLaunch({  
732 - url: url  
733 - })  
734 -  
735 - } else {  
736 - wx.reLaunch({  
737 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
738 - })  
739 - }  
740 -  
741 -  
742 - }, 1000)  
743 - }  
744 - });  
745 - }  
746 - }  
747 - else {  
748 - th.data.is_summit_ing = 0; //是否提交中  
749 - getApp().confirmBox(data.msg);  
750 - }  
751 - } else {  
752 - th.data.is_summit_ing = 0; //是否提交中  
753 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);  
754 - }  
755 - },  
756 - fail: function () {  
757 - th.data.is_summit_ing = 0; //是否提交中  
758 - wx.hideLoading();  
759 - console.log("index.js wx.request CheckCallUser fail");  
760 - },  
761 - complete: function () { }  
762 - })  
763 - },  
764 - useCoupon: function () {  
765 - if (this.data.order.couponNum <= 0) {  
766 - //return t.showWarning("无可用优惠券");  
767 - getApp().my_warnning("无可用优惠券", 0, this);  
768 - return;  
769 - }  
770 - var a = {  
771 - lid: this.data.coupon ? this.data.coupon.id : "0"  
772 - };  
773 - wx.navigateTo({  
774 - url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)  
775 - });  
776 - },  
777 - //检查区域是不是包邮  
778 - check_area: function (arr) {  
779 - var user_addr = this.data.user_addr;  
780 - if (!user_addr) return 0;  
781 - for (var i in arr) {  
782 - var item = arr[i];  
783 - if (user_addr.twon == item || user_addr.district == item  
784 - || user_addr.city == item || user_addr.province == item) {  
785 - return 0;  
786 - }  
787 - }  
788 - return 1;  
789 - },  
790 -  
791 - //检查立即购买的商品是不是不包邮  
792 - check_good: function (arr, goods_id) {  
793 - if (!goods_id) goods_id = this.data.goods.goods_id;  
794 - for (var i in arr) {  
795 - var item = arr[i];  
796 - if (goods_id == item) return 0;  
797 - }  
798 - return 1;  
799 - },  
800 - check_by_area: function (region_list) {  
801 - var arr = region_list.split(",");  
802 - var check = this.check_area(arr);  
803 - return !check;  
804 - },  
805 - check_by_goods: function (goods_list, goods_id) {  
806 - var arr = goods_list.split(",");  
807 - var check = this.check_good(arr, goods_id);  
808 - return !check;  
809 - },  
810 - enterAddressPage: function () {  
811 - getApp().globalData.is_cart_old = 1;  
812 - this.data.enterAddressPage = !0, wx.navigateTo({  
813 - url: "/pages/user/address_list/address_list"  
814 - });  
815 - },  
816 -  
817 - //--------立即购买时,选择自提和物流-----------  
818 - setexptype_w: function (t) {  
819 - var th = this;  
820 - var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt;  
821 - th.setData({ [txt]: ty });  
822 - var iszt = 1;  
823 - if (ty == 0) {  
824 - th.setData({ is_all_zt: 0 });  
825 - } else {  
826 - for (var i = 0; i < th.data.cartlist.length; i++) {  
827 - var item = th.data.cartlist[i];  
828 - if (item.exp_type == 0) { iszt = 0; break; }  
829 - }  
830 - th.setData({ is_all_zt: iszt });  
831 - }  
832 - //----计算此时购物车的价格----  
833 - th.calculatePrice();  
834 - },  
835 -  
836 - //--------立即购买时,选择自提和物流----------  
837 - setexptype: function (t) {  
838 - var th = this;  
839 - var ty = t.currentTarget.dataset.t;  
840 - th.setData({ bn_exp_type: ty });  
841 - //当物流为空的时候。  
842 - if (ty == 0 && th.data.wu_arr == null) {  
843 - return th.get_wuliu(th.calculatePrice2());  
844 - }  
845 - th.calculatePrice2()  
846 - console.log('setexptype');  
847 - },  
848 -  
849 - //--------立即购买时,使用余额--------  
850 - set_bn_useyuer: function () {  
851 - var th = this;  
852 - th.setData({ bn_use_money: !th.data.bn_use_money });  
853 - th.calculatePrice2();  
854 - },  
855 - set_js_useyuer: function () {  
856 - var th = this;  
857 - th.setData({ js_use_money: !th.data.js_use_money });  
858 - th.calculatePrice();  
859 - }, 349 + console.log(str,"----");
860 350
861 - //-------------------计算物流---------------  
862 - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,  
863 - goods_piece, user_addr, freight_free, o_price, rs, pickid) {  
864 - var price = 0, th = this;  
865 - price += parseFloat(o_shipping_price);  
866 - //如果是包邮  
867 - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }  
868 - if (user_addr == null) { return 0; }  
869 - //计算物流的config item;  
870 - var item = null;  
871 - //先根据 镇 县 区找计算的config  
872 - item = th.get_wuliu_config(user_addr.district, code, rs);  
873 - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);  
874 - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);  
875 - if (item == null) item = th.get_wuliu_default(code, rs);  
876 - if (item == null) return o_shipping_price;  
877 - var fw_price = 0, fp_price = 0;  
878 - item = item.config;  
879 - if (item == null) return o_shipping_price;  
880 - //------按重量----------  
881 - if (goods_weight >= 0 && item['money']) {  
882 - fw_price = parseFloat(item['money']);  
883 - if (goods_weight > item['first_weight']) {  
884 - var fw = goods_weight - item['first_weight'];  
885 - var n = Math.ceil(fw / item['second_weight'])  
886 - fw_price = fw_price + n * parseFloat(item['add_money']);  
887 - }  
888 - }  
889 - //------超出重量----------  
890 - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {  
891 - fw_price = parseFloat(item['money']);  
892 - var out_of_weight = Math.abs(out_of_weight);  
893 - if (out_of_weight > item['first_weight']) {  
894 - var fw = out_of_weight - item['first_weight'];  
895 - var n = Math.ceil(fw / item['second_weight'])  
896 - fw_price = fw_price + n * parseFloat(item['add_money']);  
897 - }  
898 - }  
899 - //------按件数----------  
900 - if (goods_piece > 0) {  
901 - fp_price = parseFloat(item['piecemoney']);  
902 - if (goods_piece > item['first_piece']) {  
903 - var fp = goods_piece - item['first_piece'];  
904 - var m = Math.ceil(fp / item['second_piece'])  
905 - fp_price = fp_price + m * parseFloat(item['add_piecemoney']);  
906 - }  
907 - }  
908 - var rspice = parseFloat(price + fw_price + fp_price);  
909 - return rspice;  
910 - },  
911 -  
912 - //------------循环获取config-----------  
913 - get_wuliu_config: function (region_id, code, rs) {  
914 - var item = null, rslist = rs.pageData;  
915 - for (var i = 0; i < rslist.length; i++) {  
916 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }  
917 - }  
918 - return item;  
919 - },  
920 - //-------循环获取config,code default-------  
921 - get_wuliu_default: function (code, rs) {  
922 - var item = null, rslist = rs.pageData;  
923 - for (var i = 0; i < rslist.length; i++) {  
924 - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }  
925 - }  
926 - return item;  
927 - },  
928 -  
929 - //----------立即购买,选择物流-------------  
930 - bindPickerChange: function (e) {  
931 - var ind = e.detail.value  
932 - this.setData({ index: ind });  
933 - this.calculatePrice2();  
934 - }, 351 + wx.showLoading({
  352 + title: "加载中"
  353 + });
  354 + wx.request({
  355 + url: oo.url + '/api/weshop/recharge/saveRecharge',
  356 + data: str,
  357 + method: 'POST',
  358 + header: {
  359 + 'content-type': 'application/json'
  360 + }, // 设置请求的 header
  361 + success: function(res) {
  362 +
  363 + wx.hideLoading();
  364 + if (res.statusCode == 200) {
  365 + var data = res.data;
  366 + if (data.code == 0) {
  367 + th.data.order_id = data.data.order_id;
  368 + th.data.order_sn = data.data.order_sn;
  369 +
  370 + var order_amount = pdata.account;
  371 + //要进行判断,如果是用微信支付,就要跳转到支付界面
  372 + if (order_amount > 0) {
  373 + th.setData({ isclose: 0 });
  374 + getApp().request.post("/api/weshop/order/pay/createRechargeOrder", {
  375 + data: {
  376 + parentSn: data.data.order_sn,
  377 + store_id: oo.stoid
  378 + },
  379 + success: function(su) {
  380 +
  381 + var n = su.data.data;
  382 + let order_id = data.data.order_id;
  383 + th.weixinPay(n,
  384 + function() {
  385 + // getApp().showWarning("购买成功");
  386 + wx.showToast({
  387 + title: '购买成功',
  388 + icon: 'success',
  389 + duration: 2000
  390 + });
  391 + setTimeout(function() {
  392 + wx.redirectTo({
  393 + url: "/packageA/pages/serviceCard_pd/team_success/team_success?order_sn=" + data.data.order_sn
  394 + });
  395 + }, 1000)
  396 + },
  397 + function() {
  398 + getApp().showWarning("支付失败");
  399 + setTimeout(function() {
  400 + wx.reLaunch({
  401 + url: "/pages/user/order_list/order_list?index=2&tabindex=1",
  402 + })
  403 + }, 1000)
  404 + })
  405 + }
  406 + })
  407 + }
  408 + } else {
  409 + th.data.is_summit_ing = 0; //是否提交中
  410 + getApp().confirmBox(data.msg);
  411 + }
  412 + } else {
  413 + th.data.is_summit_ing = 0; //是否提交中
  414 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
  415 + }
  416 + },
  417 + fail: function() {
  418 + th.data.is_summit_ing = 0; //是否提交中
  419 + wx.hideLoading();
  420 + console.log("index.js wx.request CheckCallUser fail");
  421 + },
  422 + complete: function() {}
  423 + })
935 424
936 - //----------购物车结算,选择物流-------------  
937 - bindPickerChange_w: function (e) {  
938 - var ind = e.detail.value, txt = e.currentTarget.dataset.txt;  
939 - this.setData({ [txt]: ind });  
940 - this.calculatePrice();  
941 }, 425 },
942 -  
943 cart_set_err: function (e) { 426 cart_set_err: function (e) {
944 var txt = e.currentTarget.dataset.err; 427 var txt = e.currentTarget.dataset.err;
945 var ob = {}; 428 var ob = {};
@@ -947,70 +430,53 @@ Page({ @@ -947,70 +430,53 @@ Page({
947 this.setData(ob); 430 this.setData(ob);
948 }, 431 },
949 432
950 - //// 开启物流的弹窗  
951 - show_wu_arr: function (e) {  
952 - this.setData({ open_express: 1 });  
953 - },  
954 -  
955 - //更新下默认,在onshow里面  
956 - update_code() {  
957 - var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;  
958 -  
959 - var uii = setInterval(function () {  
960 - if (th.data.wu_arr) {  
961 - clearInterval(uii);  
962 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
963 - var item = th.data.wu_arr[k];  
964 - if (def_exp_code == item.code) {  
965 - m_wind = k;  
966 - }  
967 - }  
968 - //--如果是立即购买--  
969 - th.setData({ index: m_wind, is_express: m_wind });  
970 - }  
971 - }, 500)  
972 - }, 433 + //------调起支付框--------
  434 + weixinPay: function(n, success, fail) {
  435 + var th=this;
  436 + if (!n) return false;
  437 + wx.requestPayment({
  438 + timeStamp: String(n.timeStamp),
  439 + nonceStr: n.nonceStr,
  440 + package: n.packageValue,
  441 + signType: n.signType,
  442 + paySign: n.paySign,
  443 + success: function(n) {
  444 + // console.log(n), getApp().showSuccess("支付成功!");
  445 + wx.showToast({
  446 + title: '支付成功',
  447 + icon: 'success',
  448 + duration: 2000
  449 + });
  450 + "function" == typeof success && success();
  451 + },
  452 + fail: function(n) {
  453 + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") :
  454 + "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n
  455 + .errMsg.substr("requestPayment:fail ".length)),
  456 + "function" == typeof fail && fail();
  457 + }
  458 + });
  459 + },
973 460
974 - // 关闭物流的弹窗  
975 - close_express: function () {  
976 - this.setData({ open_express: 0 });  
977 - },  
978 - // 选择物流  
979 - click_express_name: function (e) {  
980 - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;  
981 - var index = e.currentTarget.dataset.idxe;  
982 - var ob = { is_express: index, is_shipping_code: shippingcode, index: index };  
983 - this.setData(ob);  
984 - }, 461 + //订阅消息提醒
  462 + sendsm: function(func) {
  463 + var template_id = this.data.template_id;
  464 + // //授权订阅
  465 + wx.requestSubscribeMessage({
  466 + tmplIds: [template_id],
  467 + success(res) {
  468 + func();
  469 + },
  470 + fail(res) {
  471 + func();
  472 + }
  473 + })
985 474
986 - //点击确定物流  
987 - determine_expres: function (e) {  
988 - this.setData({ open_express: 0 });  
989 - this.calculatePrice2();  
990 - },  
991 - //设置默认物流  
992 - select_default_logistics: function () {  
993 - var th = this;  
994 - var is_shipping_code = this.data.is_shipping_code  
995 - getApp().request.put("/api/weshop/users/update", {  
996 - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },  
997 - success: function (rse) {  
998 - if (rse.data.code == 0) {  
999 - getApp().globalData.userInfo.def_exp_code = is_shipping_code;  
1000 - th.setData({ open_express: 0 });  
1001 - //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----  
1002 - //if(th.data.is_b_now==1) th.calculatePrice2();  
1003 - //else th.calculatePrice();  
1004 - th.calculatePrice2();  
1005 - }  
1006 - }  
1007 - })  
1008 - }, 475 + },
1009 476
  477 + go_to:function (e) {
  478 + var url=e.currentTarget.dataset.url;
  479 + getApp().goto(url);
  480 + }
1010 481
1011 - //跳转到购买卡  
1012 - buycard: function () {  
1013 - getApp().goto("/pages/user/plus/plus");  
1014 - getApp().globalData.plus_buy_back = 1;  
1015 - }  
1016 }); 482 });
pages/goods/goodsList/goodsList.js
@@ -15,7 +15,7 @@ Page({ @@ -15,7 +15,7 @@ Page({
15 requestData: null, 15 requestData: null,
16 allData: null, 16 allData: null,
17 openFilterModal: !1, 17 openFilterModal: !1,
18 - baseUrl: "/api/weshop/goods/page?isnewwhere=1", 18 + baseUrl: "/api/weshop/goods/page?1=1&isnewwhere=1",
19 requestUrl: "", 19 requestUrl: "",
20 old_req_url:'', 20 old_req_url:'',
21 21