Commit 50ac1855fcdd343f843c6eb317a1ebf17e39faad

Authored by yvan.ni
1 parent adfa094a

1. 积分购,预存的赠送修复提交

packageA/pages/chongzhi/chongzhi.wxml
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
1 <view class="container"> 2 <view class="container">
2 <!-- 封面 --> 3 <!-- 封面 -->
3 <view class="banner-container"><image class="img-block" src="{{url + imgAd}}"></image></view> 4 <view class="banner-container"><image class="img-block" src="{{url + imgAd}}"></image></view>
@@ -28,7 +29,7 @@ @@ -28,7 +29,7 @@
28 </view> 29 </view>
29 </view> 30 </view>
30 <!-- 下 --> 31 <!-- 下 -->
31 - <view class="bottom" wx:if="{{currentIndex == 0}}" > 32 + <view class="bottom" wx:if="{{currentIndex == 0 && g_filter.is_acting(item.EndDate) }}" >
32 <text catchtap="viewDetails" data-index="{{index}}" class="btn" >立即使用</text> 33 <text catchtap="viewDetails" data-index="{{index}}" class="btn" >立即使用</text>
33 </view> 34 </view>
34 </view> 35 </view>
packageA/pages/chongzhi/g_filter.wxs 0 → 100644
  1 +var is_acting = function(endtime){
  2 + //判断结束时间减去当前时间 ,如果当前时间大于0则为True
  3 + endtime = endtime.substring(0, 19);
  4 + var reg = getRegExp("-", "g");
  5 + endtime = endtime.replace(reg, '/');
  6 + var bijiao = getDate(endtime) - getDate();
  7 + return bijiao > 0 ? true : false;
  8 +}
  9 +module.exports = {
  10 + is_acting:is_acting
  11 +}
0 \ No newline at end of file 12 \ No newline at end of file
packageA/pages/chongzhiDetails/chongzhiDetails.js
@@ -66,11 +66,32 @@ Page({ @@ -66,11 +66,32 @@ Page({
66 data: { 66 data: {
67 Id:options.id, 67 Id:options.id,
68 store_id:os.stoid, 68 store_id:os.stoid,
69 - user_id: UserInfo.user_id , 69 + user_id: UserInfo.user_id,
70 }, 70 },
71 - success: function (res) { 71 + success: function (res) {
  72 + var result=res.data.data;
  73 +
  74 + var now=new Date();
  75 + var reg = RegExp("-", "g");
  76 + var endtime = result.EndDate.replace(reg, '/');
  77 + var end=new Date(endtime);
  78 + result.is_acting=1;
  79 + if(end<now) result.is_acting=0;
  80 +
  81 +
  82 + var givelist=result.givelist;
  83 + if(!givelist) givelist=new Array();
  84 + if(result.Integral){
  85 + var ob={Integral:result.Integral};
  86 + givelist.push(ob);
  87 + }
  88 + if(result.GradeSum){
  89 + var ob={GradeSum:result.GradeSum};
  90 + givelist.push(ob);
  91 + }
  92 +
72 self.setData({ 93 self.setData({
73 - result: res.data.data 94 + result: result,
74 }); 95 });
75 96
76 }, 97 },
packageA/pages/chongzhiDetails/chongzhiDetails.wxml
1 <!--packageA//pages/chongzhiDetails/chongzhiDetails.wxml--> 1 <!--packageA//pages/chongzhiDetails/chongzhiDetails.wxml-->
  2 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
2 <view class="container"> 3 <view class="container">
3 <view> 4 <view>
4 <view class="banner-container"> 5 <view class="banner-container">
5 - <image class="img-block" src="{{url+show_img}}" 6 + <image class="img-block" src="{{url+show_img}}" mode="widthFix"
6 lazy-load="true" binderror="bind_err" data-errorimg="show_img" ></image></view> 7 lazy-load="true" binderror="bind_err" data-errorimg="show_img" ></image></view>
7 8
8 <view class="list"> 9 <view class="list">
@@ -13,7 +14,7 @@ @@ -13,7 +14,7 @@
13 </view> 14 </view>
14 </view> 15 </view>
15 16
16 - <view class="list-item flex" wx:for="{{result.givelist}}"> 17 + <view class="list-item flex" wx:for="{{result.givelist}}">
17 <!-- 左图片 --> 18 <!-- 左图片 -->
18 <view class="avatar"> 19 <view class="avatar">
19 <image wx:if="{{item.GiveType=='0'}}" src="{{url}}/miniapp/images/giftbag/gift05.png"></image><!-- 代金券 --> 20 <image wx:if="{{item.GiveType=='0'}}" src="{{url}}/miniapp/images/giftbag/gift05.png"></image><!-- 代金券 -->
@@ -25,21 +26,22 @@ @@ -25,21 +26,22 @@
25 </view> 26 </view>
26 <!-- 右 --> 27 <!-- 右 -->
27 <view class="info"> 28 <view class="info">
28 - <view class="">{{item.GiveName}}</view> 29 + <view wx:if="{{item.GiveType=='0'}}">{{item.CouponSum}}元优惠券</view>
  30 + <view wx:elif="{{item.Integral>0}}">{{item.Integral}}积分</view>
  31 + <view wx:elif="{{item.GradeSum>0}}">{{item.GradeSum}}成长值</view>
  32 + <view wx:else>{{item.GiveName}}</view>
29 <!-- <view class="fs28 pdv10 txt-justify">节日可免费享受专业美甲,可以享受1次。</view> --> 33 <!-- <view class="fs28 pdv10 txt-justify">节日可免费享受专业美甲,可以享受1次。</view> -->
30 - <view class="t-r fs24 c-y">数量:{{item.Qty}}</view> 34 + <view wx:if="{{item.Qty>0}}" class="t-r fs24 c-y">数量:{{item.Qty}}</view>
31 </view> 35 </view>
32 - </view>  
33 -  
34 - </view>  
35 - 36 + </view>
  37 + </view>
36 </view> 38 </view>
37 39
38 - <view class="btn-container"> 40 + <view class="btn-container" >
39 <text wx:if="{{type==0}}" data-advance="{{result.Id}}" data-money="{{result.BeginSum}}" 41 <text wx:if="{{type==0}}" data-advance="{{result.Id}}" data-money="{{result.BeginSum}}"
40 class="btn" bindtap="go_buy">立即充值</text> 42 class="btn" bindtap="go_buy">立即充值</text>
41 <block wx:else> 43 <block wx:else>
42 - <text wx:if="{{result.AddType==0}}" class="btn" bindtap="onUse">立即使用</text> 44 + <text wx:if="{{result.AddType==0 && result.is_acting}}" class="btn" bindtap="onUse">立即使用</text>
43 <text wx:if="{{result.AddType==1}}" class="btn" >已核销</text> 45 <text wx:if="{{result.AddType==1}}" class="btn" >已核销</text>
44 </block> 46 </block>
45 </view> 47 </view>
packageA/pages/chongzhiDetails/chongzhiDetails.wxss
@@ -18,10 +18,7 @@ @@ -18,10 +18,7 @@
18 padding-bottom: 120rpx; 18 padding-bottom: 120rpx;
19 } 19 }
20 20
21 -.banner-container {  
22 - height: 600rpx;  
23 -  
24 -} 21 +.banner-container {}
25 22
26 .list { 23 .list {
27 /* padding: 0 20rpx; 24 /* padding: 0 20rpx;
packageA/pages/chongzhiDetails/g_filter.wxs 0 → 100644
  1 +var is_acting = function(endtime){
  2 + //判断结束时间减去当前时间 ,如果当前时间大于0则为True
  3 + endtime = endtime.substring(0, 19);
  4 + var reg = getRegExp("-", "g");
  5 + endtime = endtime.replace(reg, '/');
  6 + var bijiao = getDate(endtime) - getDate();
  7 + return bijiao > 0 ? true : false;
  8 +}
  9 +module.exports = {
  10 + is_acting:is_acting
  11 +}
0 \ No newline at end of file 12 \ No newline at end of file
packageA/pages/jfbuy/jfbuy.js
@@ -18,7 +18,8 @@ Page({ @@ -18,7 +18,8 @@ Page({
18 active1: false, 18 active1: false,
19 // 控制佣金 19 // 控制佣金
20 active2: false, 20 active2: false,
21 - url: oo.imghost, 21 + url: oo.imghost,
  22 + h5_url:oo.h5_url,
22 //popup 23 //popup
23 hiddenPopup: true, 24 hiddenPopup: true,
24 // 排序 25 // 排序
packageA/pages/jfbuy/jfbuy.wxml
@@ -7,11 +7,10 @@ @@ -7,11 +7,10 @@
7 </view> --> 7 </view> -->
8 8
9 <view class="banner-container"> 9 <view class="banner-container">
10 - <image src="../../images/jfbuy.jpg" class="banner"></image> 10 + <image src="{{h5_url}}/template/mobile/new/static/images/integral/liwu.png" class="banner"></image>
11 </view> 11 </view>
12 12
13 13
14 -  
15 <!-- 列表 --> 14 <!-- 列表 -->
16 <view class="list-container"> 15 <view class="list-container">
17 <!-- 标题 --> 16 <!-- 标题 -->
pages/cart/cart/cart.js
@@ -27,8 +27,8 @@ Page({ @@ -27,8 +27,8 @@ Page({
27 isadd: 0, //是否可以加商品数量 27 isadd: 0, //是否可以加商品数量
28 28
29 card_field:"", 29 card_field:"",
30 - bconf:null,  
31 - 30 + bconf:null,
  31 + btn_click:1,
32 }, 32 },
33 33
34 onLoad: function() { 34 onLoad: function() {
@@ -65,6 +65,7 @@ Page({ @@ -65,6 +65,7 @@ Page({
65 } 65 }
66 66
67 var th = this; 67 var th = this;
  68 + this.setData({requestData:null,is_load:0});
68 //调用底部导航 69 //调用底部导航
69 //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); 70 //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
70 this.getCardList(); 71 this.getCardList();
@@ -170,7 +171,7 @@ Page({ @@ -170,7 +171,7 @@ Page({
170 171
171 var tt = ut.gettimestamp(); 172 var tt = ut.gettimestamp();
172 //如果商品下架了,或者商品是赠品,一开始都要清除 173 //如果商品下架了,或者商品是赠品,一开始都要清除
173 - if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0 || item.is_gift) { 174 + if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) {
174 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 175 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
175 getApp().request.delete(url, { 176 getApp().request.delete(url, {
176 success: function (t) { 177 success: function (t) {
@@ -204,13 +205,13 @@ Page({ @@ -204,13 +205,13 @@ Page({
204 var r_data = res.data.data; 205 var r_data = res.data.data;
205 if (!r_data.promGoodsLists) { 206 if (!r_data.promGoodsLists) {
206 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 207 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
207 - a.delete(url, {}); 208 + getApp().request.delete(url, {});
208 //商品已经下架 209 //商品已经下架
209 isok = 0; 210 isok = 0;
210 } 211 }
211 } else { 212 } else {
212 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 213 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
213 - a.delete(url, {}); 214 + getApp().request.delete(url, {});
214 //商品已经下架 215 //商品已经下架
215 isok = 0; 216 isok = 0;
216 } 217 }
@@ -275,6 +276,7 @@ Page({ @@ -275,6 +276,7 @@ Page({
275 is_edit: 0 276 is_edit: 0
276 }), 277 }),
277 th.doCheckAll(), wx.stopPullDownRefresh(); 278 th.doCheckAll(), wx.stopPullDownRefresh();
  279 +
278 } 280 }
279 }); 281 });
280 }, 282 },
@@ -300,27 +302,42 @@ Page({ @@ -300,27 +302,42 @@ Page({
300 }, 302 },
301 303
302 //-----------------点击输入修改商品数量--------------- 304 //-----------------点击输入修改商品数量---------------
303 - valueToNum: function(t) {  
304 - var a = t.currentTarget.dataset.item;  
305 - var b = t.currentTarget.dataset.pitems;  
306 - a = this.data.requestData[b].goods[a];  
307 - var e = a;  
308 - if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {  
309 - var s = {  
310 - goods_num: a,  
311 - goods_id: e.goods_id,  
312 - id: e.id,  
313 - store_id: oo.stoid  
314 - };  
315 - this.postCardList(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);  
316 - } 305 + valueToNum: function(t) {
  306 + if(!this.data.is_load) return false;
  307 + //控制住,避免事件响应冲突,只有input有输入的时候,才刷新
  308 + if(this.data.btn_click){
  309 + return false;
  310 + }
  311 + this.data.btn_click=1;
  312 +
  313 + var a = t.currentTarget.dataset.item;
  314 + var b = t.currentTarget.dataset.pitems;
  315 + a = this.data.requestData[b].goods[a];
  316 + var e = a;
  317 + var th=this;
  318 +
  319 +
  320 +
  321 + if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
  322 + var s = {
  323 + goods_num: a,
  324 + goods_id: e.goods_id,
  325 + id: e.id,
  326 + store_id: oo.stoid
  327 + };
  328 + th.postCardList(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  329 + }
  330 +
  331 +
  332 +
317 }, 333 },
318 334
319 //-------------加数量--------------------- 335 //-------------加数量---------------------
320 addNum: function(t) { 336 addNum: function(t) {
  337 + if(!this.data.is_load) return false;
321 if (this.data.up_dating == 1) return false; 338 if (this.data.up_dating == 1) return false;
322 this.data.up_dating = 1; 339 this.data.up_dating = 1;
323 - 340 +
324 var a = t.currentTarget.dataset.item; 341 var a = t.currentTarget.dataset.item;
325 var b = t.currentTarget.dataset.pitems; 342 var b = t.currentTarget.dataset.pitems;
326 a = this.data.requestData[b].goods[a]; 343 a = this.data.requestData[b].goods[a];
@@ -344,9 +361,14 @@ Page({ @@ -344,9 +361,14 @@ Page({
344 }, 361 },
345 //-------------减数量--------------------- 362 //-------------减数量---------------------
346 subNum: function(t) { 363 subNum: function(t) {
  364 + if(!this.data.is_load) return false;
  365 + if (this.data.up_dating == 1) return false;
  366 + this.data.up_dating = 1;
  367 +
347 var a = t.currentTarget.dataset.item; 368 var a = t.currentTarget.dataset.item;
348 var b = t.currentTarget.dataset.pitems; 369 var b = t.currentTarget.dataset.pitems;
349 a = this.data.requestData[b].goods[a]; 370 a = this.data.requestData[b].goods[a];
  371 + this.data.btn_click=1;
350 372
351 if (a.goods_num - 1 < 0) return false; 373 if (a.goods_num - 1 < 0) return false;
352 374
@@ -367,6 +389,8 @@ Page({ @@ -367,6 +389,8 @@ Page({
367 tfeel = 0, 389 tfeel = 0,
368 t_num = 0, 390 t_num = 0,
369 text_arr = ""; 391 text_arr = "";
  392 + this.data.btn_click=1;
  393 +
370 for (var i = 0; i < dda.length; i++) { 394 for (var i = 0; i < dda.length; i++) {
371 var item = dda[i].goods; 395 var item = dda[i].goods;
372 if (!e.data.checkAllToggle) { 396 if (!e.data.checkAllToggle) {
@@ -419,11 +443,12 @@ Page({ @@ -419,11 +443,12 @@ Page({
419 }, 443 },
420 444
421 //------门店全选按钮,要判断是否门店的匹配方式一致--------- 445 //------门店全选按钮,要判断是否门店的匹配方式一致---------
422 - check_th_all_item: function(ele) { 446 + check_th_all_item:async function(ele) {
423 var e = this, 447 var e = this,
424 pitems = ele.currentTarget.dataset.pitems, 448 pitems = ele.currentTarget.dataset.pitems,
425 item = this.data.requestData[pitems].goods, 449 item = this.data.requestData[pitems].goods,
426 sele = this.data.requestData[pitems].selected; 450 sele = this.data.requestData[pitems].selected;
  451 + this.data.btn_click=1;
427 452
428 var isok = 1, 453 var isok = 1,
429 fir = 0, 454 fir = 0,
@@ -462,18 +487,19 @@ Page({ @@ -462,18 +487,19 @@ Page({
462 e.setData({ 487 e.setData({
463 [txt]: Number(!sele), 488 [txt]: Number(!sele),
464 }); 489 });
465 - e.check_prom_activity(pitems); 490 + await e.check_prom_activity(pitems);
466 this.doCheckAll(); 491 this.doCheckAll();
467 }, 492 },
468 493
469 //---------------单选,也要判断门店的配送方式是否一致-------------- 494 //---------------单选,也要判断门店的配送方式是否一致--------------
470 - check_th_item: function(t) { 495 + check_th_item: async function(t) {
471 var e = this, 496 var e = this,
472 item = t.currentTarget.dataset.item, 497 item = t.currentTarget.dataset.item,
473 pitems = t.currentTarget.dataset.pitems; 498 pitems = t.currentTarget.dataset.pitems;
474 a = this.data.requestData[pitems].goods[item]; 499 a = this.data.requestData[pitems].goods[item];
475 var isok = 1,fir = 0; 500 var isok = 1,fir = 0;
476 var iarr = e.data.requestData[pitems].goods; 501 var iarr = e.data.requestData[pitems].goods;
  502 + this.data.btn_click=1;
477 503
478 504
479 //当数量大于1,且是选择的时候 505 //当数量大于1,且是选择的时候
@@ -508,7 +534,7 @@ Page({ @@ -508,7 +534,7 @@ Page({
508 534
509 if(a.prom_type==3){ 535 if(a.prom_type==3){
510 //判断商品是不是优惠活动 536 //判断商品是不是优惠活动
511 - e.check_prom_activity(pitems); 537 + await e.check_prom_activity(pitems);
512 } 538 }
513 539
514 this.doCheckAll(); 540 this.doCheckAll();
@@ -554,6 +580,7 @@ Page({ @@ -554,6 +580,7 @@ Page({
554 580
555 //----------------------更新购物数量,加减,调用接口--------------------- 581 //----------------------更新购物数量,加减,调用接口---------------------
556 postCardList: function(t, item, pitem) { 582 postCardList: function(t, item, pitem) {
  583 +
557 var e = this,th=e; 584 var e = this,th=e;
558 var user_id = getApp().globalData.user_id; 585 var user_id = getApp().globalData.user_id;
559 console.log('update'); 586 console.log('update');
@@ -800,17 +827,18 @@ Page({ @@ -800,17 +827,18 @@ Page({
800 //--更新购物车--- 827 //--更新购物车---
801 update_cart: function(t, pitem, item) { 828 update_cart: function(t, pitem, item) {
802 var e = this; 829 var e = this;
  830 +
803 getApp().request.put("/api/weshop/cart/update", { 831 getApp().request.put("/api/weshop/cart/update", {
804 data: t, 832 data: t,
805 - success: function(ee) { 833 + success:async function(ee) {
806 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; 834 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
807 - e.data.up_dating = 0 835 +
808 e.setData({ 836 e.setData({
809 [txt]: t.goods_num, 837 [txt]: t.goods_num,
810 }); 838 });
811 - for(var i in e.data.requestData){  
812 - e.check_prom_activity(i)  
813 - } 839 + //for(var i in e.data.requestData){
  840 + await e.check_prom_activity(pitem)
  841 + //}
814 e.doCheckAll(); 842 e.doCheckAll();
815 getApp().requestCardNum(e); 843 getApp().requestCardNum(e);
816 } 844 }
@@ -824,6 +852,14 @@ Page({ @@ -824,6 +852,14 @@ Page({
824 852
825 //--------------去结算------------ 853 //--------------去结算------------
826 async checkout() { 854 async checkout() {
  855 +
  856 + if(!this.data.is_load) return false;
  857 + if(this.data.up_dating) {
  858 + wx.showLoading({
  859 + title:"计算中"
  860 + })
  861 + }
  862 +
827 var glist = ""; //用逗号隔开的 863 var glist = ""; //用逗号隔开的
828 var map = new Map(); //使用map值键进行运算 864 var map = new Map(); //使用map值键进行运算
829 var map_limit = new Map(); //使用map值键进行存储限购 865 var map_limit = new Map(); //使用map值键进行存储限购
@@ -1156,15 +1192,17 @@ Page({ @@ -1156,15 +1192,17 @@ Page({
1156 var make_up_arr=new Array(); 1192 var make_up_arr=new Array();
1157 var th=this; 1193 var th=this;
1158 var map=new Map(); 1194 var map=new Map();
1159 - var list=this.data.requestData[cindex]; 1195 + var list= JSON.parse(JSON.stringify(this.data.requestData[cindex]));
1160 //循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量 1196 //循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量
1161 - for(var i in list.goods){ 1197 +
  1198 + for(var i=0;i<list.goods.length;i++){
1162 var item=list.goods[i]; 1199 var item=list.goods[i];
1163 if(item.prom_type==3 && item.selected && !item.is_gift){ 1200 if(item.prom_type==3 && item.selected && !item.is_gift){
1164 if(map.has(item.prom_id+"")){ 1201 if(map.has(item.prom_id+"")){
1165 var ob=map.get(item.prom_id+""); 1202 var ob=map.get(item.prom_id+"");
1166 ob.num+=item.goods_num; 1203 ob.num+=item.goods_num;
1167 ob.price+=item.goods_num*item.goods_price; 1204 ob.price+=item.goods_num*item.goods_price;
  1205 + delete map[item.prom_id+""];
1168 map.set(item.prom_id+"",ob); 1206 map.set(item.prom_id+"",ob);
1169 }else{ 1207 }else{
1170 var ob={}; 1208 var ob={};
@@ -1174,13 +1212,14 @@ Page({ @@ -1174,13 +1212,14 @@ Page({
1174 } 1212 }
1175 } 1213 }
1176 if(item.is_gift==1){ 1214 if(item.is_gift==1){
1177 - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 1215 + //var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
1178 //getApp().request.delete(url, {}); 1216 //getApp().request.delete(url, {});
1179 - await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除  
1180 - list.goods.splice(i,1); 1217 + //await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除
  1218 + list.goods.splice(i--,1);
1181 } 1219 }
1182 } 1220 }
1183 1221
  1222 + /*--
1184 var map2=new Map(); 1223 var map2=new Map();
1185 //请那些是赠品,但是优惠活动并没有被选中的商品要删除,同时满足条件的要放到map2, 1224 //请那些是赠品,但是优惠活动并没有被选中的商品要删除,同时满足条件的要放到map2,
1186 for(var i in list.goods){ 1225 for(var i in list.goods){
@@ -1196,7 +1235,10 @@ Page({ @@ -1196,7 +1235,10 @@ Page({
1196 getApp().request.delete(url, {}); 1235 getApp().request.delete(url, {});
1197 } 1236 }
1198 } 1237 }
1199 - } 1238 + }--*/
  1239 +
  1240 + var t_prom_list=new Array();
  1241 +
1200 for(let p_item of map.entries()){ 1242 for(let p_item of map.entries()){
1201 var prom=null; 1243 var prom=null;
1202 await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+p_item[0],{}).then(res=> { 1244 await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+p_item[0],{}).then(res=> {
@@ -1216,6 +1258,9 @@ Page({ @@ -1216,6 +1258,9 @@ Page({
1216 } 1258 }
1217 continue; 1259 continue;
1218 } 1260 }
  1261 +
  1262 + t_prom_list.push(prom);
  1263 +
1219 //---读取打折的详情--- 1264 //---读取打折的详情---
1220 var ob=p_item[1];var discount=null; 1265 var ob=p_item[1];var discount=null;
1221 await getApp().request.promiseGet("/api/weshop/goods/getDiscount",{ 1266 await getApp().request.promiseGet("/api/weshop/goods/getDiscount",{
@@ -1251,6 +1296,8 @@ Page({ @@ -1251,6 +1296,8 @@ Page({
1251 gift_id:discount.gift_id 1296 gift_id:discount.gift_id
1252 }; 1297 };
1253 1298
  1299 +
  1300 + /*---
1254 if(map2.has(p_item[0]+"")){ 1301 if(map2.has(p_item[0]+"")){
1255 var index=map2.get(p_item[0]+""); 1302 var index=map2.get(p_item[0]+"");
1256 if( list.goods[index].goods_num!=discount.bs){ 1303 if( list.goods[index].goods_num!=discount.bs){
@@ -1268,7 +1315,11 @@ Page({ @@ -1268,7 +1315,11 @@ Page({
1268 }); 1315 });
1269 } 1316 }
1270 1317
1271 - }else{ 1318 + }else{---*/
  1319 + var url="/api/weshop/cart/delGift?store_id="+newd.store_id+"&user_id="
  1320 + +newd.user_id+"&goods_id="+newd.goods_id+"&is_gift=1&pick_id="+newd.pick_id;
  1321 + await getApp().request.promiseDelete(url, {})
  1322 +
1272 var add_data=null; 1323 var add_data=null;
1273 await getApp().request.promisePost("/api/weshop/cart/save", { data: newd }).then(res=>{ 1324 await getApp().request.promisePost("/api/weshop/cart/save", { data: newd }).then(res=>{
1274 if(res.data.code==0){ 1325 if(res.data.code==0){
@@ -1279,37 +1330,44 @@ Page({ @@ -1279,37 +1330,44 @@ Page({
1279 newd.id=add_data.id; 1330 newd.id=add_data.id;
1280 list.goods.push(newd); 1331 list.goods.push(newd);
1281 } 1332 }
1282 - } 1333 + //}
1283 } 1334 }
1284 -  
1285 -  
1286 -  
1287 - //-- 获取 --  
1288 - await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{  
1289 - data:{prom_id:prom.id}  
1290 - }).then(res=>{  
1291 - if(res.data.code==0){  
1292 - var list=res.data.data;  
1293 - for(var i in list){  
1294 - var item=list[i];  
1295 - if(item.prom_type==0){  
1296 - if(ob.price<item.condition){  
1297 - var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)}  
1298 - make_up_arr.push(elem); break;  
1299 - }  
1300 - }else{  
1301 - if(ob.num<item.condition){  
1302 - var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.num).toFixed(2), content:JSON.parse(item.preferential_type)}  
1303 - make_up_arr.push(elem);break;  
1304 - }  
1305 - }  
1306 - }  
1307 - }  
1308 - }) 1335 +
1309 } 1336 }
1310 //--更新购物车的前台渲染-- 1337 //--更新购物车的前台渲染--
1311 var rq_text="requestData["+cindex+"]"; 1338 var rq_text="requestData["+cindex+"]";
1312 this.setData({[rq_text]:list}); 1339 this.setData({[rq_text]:list});
  1340 +
  1341 + if(!t_prom_list || t_prom_list.length==0 ) return false;
  1342 +
  1343 + //-- 提示凑单的,放在最后显示 --
  1344 + for(let prid in t_prom_list){
  1345 + var prom=t_prom_list[prid];
  1346 + //-- 获取凑单提示 --
  1347 + await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
  1348 + data:{prom_id:prom.id}
  1349 + }).then(res=>{
  1350 + if(res.data.code==0){
  1351 + var list=res.data.data;
  1352 + for(var i in list){
  1353 + var item=list[i];
  1354 + if(item.prom_type==0){
  1355 + if(ob.price<item.condition){
  1356 + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)}
  1357 + make_up_arr.push(elem); break;
  1358 + }
  1359 + }else{
  1360 + if(ob.num<item.condition){
  1361 + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.num).toFixed(2), content:JSON.parse(item.preferential_type)}
  1362 + make_up_arr.push(elem);break;
  1363 + }
  1364 + }
  1365 + }
  1366 + }
  1367 + })
  1368 + }
  1369 +
  1370 +
1313 var diff_text="requestData["+cindex+"].make_up_arr"; 1371 var diff_text="requestData["+cindex+"].make_up_arr";
1314 //-- 如果有凑单的话 -- 1372 //-- 如果有凑单的话 --
1315 if(make_up_arr.length>0){ 1373 if(make_up_arr.length>0){
@@ -1332,5 +1390,9 @@ Page({ @@ -1332,5 +1390,9 @@ Page({
1332 if(!url || url=='') return; 1390 if(!url || url=='') return;
1333 if(url[0]!='/') url='/'+url; 1391 if(url[0]!='/') url='/'+url;
1334 getApp().goto(url); 1392 getApp().goto(url);
1335 - } 1393 + },
  1394 +
  1395 + refresh_input:function(){
  1396 + this.data.btn_click=0;
  1397 + }
1336 }); 1398 });
1337 \ No newline at end of file 1399 \ No newline at end of file
pages/cart/cart/cart.wxml
@@ -79,7 +79,9 @@ @@ -79,7 +79,9 @@
79 </view> 79 </view>
80 <view class="count"> 80 <view class="count">
81 <view bindtap="subNum" class="sub fs28" data-pitems="{{pidx}}" data-item="{{idx}}">一</view> 81 <view bindtap="subNum" class="sub fs28" data-pitems="{{pidx}}" data-item="{{idx}}">一</view>
82 - <input class="goodadd" bindblur="valueToNum" data-pitems="{{pidx}}" data-item="{{idx}}" type="number" value="{{items.goods_num}}"></input> 82 + <input class="goodadd" bindblur="valueToNum" data-pitems="{{pidx}}" data-item="{{idx}}"
  83 + bindinput="refresh_input"
  84 + type="number" value="{{items.goods_num}}"></input>
83 <view class="add" bindtap="addNum" data-pitems="{{pidx}}" data-item="{{idx}}">+</view> 85 <view class="add" bindtap="addNum" data-pitems="{{pidx}}" data-item="{{idx}}">+</view>
84 </view> 86 </view>
85 </view> 87 </view>
pages/cart/cart2/cart2.js
@@ -317,41 +317,54 @@ Page({ @@ -317,41 +317,54 @@ Page({
317 //----------------展示页面,是再获取用户信息之后-------------- 317 //----------------展示页面,是再获取用户信息之后--------------
318 show_page:function(){ 318 show_page:function(){
319 var th=this,ta = this.data.param; 319 var th=this,ta = this.data.param;
320 - th.setData({  
321 - userinfo: getApp().globalData.userInfo,});  
322 -  
323 - //选获取地址  
324 - th.getuser_addr(function(addr){  
325 - th.setData({user_addr: addr});  
326 - //--------------------------立即购买------------------  
327 - if(ta.is_bnow== 1){  
328 - //读取门店  
329 - to.get_allsto(function (e) {  
330 - th.setData({ allsto: e });  
331 - //获取立即购买的商品信息  
332 - th.get_buy_goods(ta.goods_id);  
333 - });  
334 - }else {  
335 - //------------------------购物车结算----------------------  
336 - //读取门店  
337 - to.get_allsto(function (e) {  
338 - th.setData({ allsto: e });  
339 - //-------获取购物车已经选择的商品--------  
340 - th.get_cart();  
341 - })  
342 - }  
343 - });  
344 - //获取提现金额  
345 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
346 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
347 - success: function (su) {  
348 - if (su.data.code == 0) {  
349 - var yuer = parseFloat(th.data.userinfo.user_money -  
350 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
351 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
352 - }  
353 - }  
354 - }); 320 + //th.setData({ userinfo: getApp().globalData.userInfo,}); //这个余额被缓存了
  321 +
  322 + //会员的信息,要获取最新
  323 + var user=getApp().globalData.userInfo;
  324 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  325 + data:{r:Math.random()},
  326 + success: function (e) {
  327 + getApp().globalData.userInfo = e.data.data;
  328 + th.setData({userinfo:e.data.data});
  329 +
  330 + //选获取地址
  331 + th.getuser_addr(function(addr){
  332 + th.setData({user_addr: addr});
  333 + //--------------------------立即购买------------------
  334 + if(ta.is_bnow== 1){
  335 + //读取门店
  336 + to.get_allsto(function (e) {
  337 + th.setData({ allsto: e });
  338 + //获取立即购买的商品信息
  339 + th.get_buy_goods(ta.goods_id);
  340 + });
  341 + }else {
  342 + //------------------------购物车结算----------------------
  343 + //读取门店
  344 + to.get_allsto(function (e) {
  345 + th.setData({ allsto: e });
  346 + //-------获取购物车已经选择的商品--------
  347 + th.get_cart();
  348 + })
  349 + }
  350 + });
  351 +
  352 + //获取提现金额
  353 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  354 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  355 + success: function (su) {
  356 + if (su.data.code == 0) {
  357 + var yuer = parseFloat(th.data.userinfo.user_money -
  358 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  359 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  360 + }
  361 + }
  362 + });
  363 +
  364 +
  365 + },
  366 + });
  367 +
355 }, 368 },
356 369
357 370
pages/cart/cart2_inte/cart2_inte.js
@@ -88,6 +88,54 @@ Page({ @@ -88,6 +88,54 @@ Page({
88 success: function (s) { 88 success: function (s) {
89 } 89 }
90 }); 90 });
  91 +
  92 + //先获取是否有关闭使用优惠券
  93 + getApp().getConfig2(function (ee) {
  94 + var json_d = JSON.parse(ee.switch_list);
  95 + th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  96 + th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch});
  97 +
  98 + var rank_switch=json_d.rank_switch;
  99 + var max_price=-1;
  100 + var show_card=null;
  101 + var name="";
  102 + //如果有开等级卡的时候,
  103 + //因为都是调接口,要返回在计算
  104 + if(rank_switch==2){
  105 + //-- 获取所有的等级卡, --
  106 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  107 + {}).then(res => {
  108 + if(res.data.code==0){
  109 + var plusCard = res.data.data;
  110 + //-- 循环判断,拿到最贵的那张卡 --
  111 + for(var ih in plusCard){
  112 + if(plusCard[ih].IsStopBuy == true){ continue; }
  113 + if(max_price<0){
  114 + max_price=plusCard[ih].CardFee;
  115 + name='card'+plusCard[ih]['CorrPrice'];
  116 + show_card=plusCard[ih];
  117 + }else{
  118 + if(max_price<plusCard[ih].CardFee){
  119 + max_price=plusCard[ih].CardFee;
  120 + name='card'+plusCard[ih]['CorrPrice'];
  121 + show_card=plusCard[ih];
  122 + }
  123 + }
  124 + }
  125 +
  126 + if(show_card){
  127 + name=name.toLowerCase();
  128 + th.setData({card_name:name,show_card:show_card})
  129 + }
  130 + }
  131 + //-----先获取物流,再获取用户信息,再展示页面-----
  132 + th.get_wuliu(th.get_info(th.show_page));
  133 + })
  134 + }else{
  135 + //-----先获取物流,再获取用户信息,再展示页面-----
  136 + th.get_wuliu(th.get_info(th.show_page));
  137 + }
  138 + })
91 139
92 140
93 }, 141 },
@@ -102,7 +150,6 @@ Page({ @@ -102,7 +150,6 @@ Page({
102 //----------子页返回父页触发---------- 150 //----------子页返回父页触发----------
103 onShow: function() { 151 onShow: function() {
104 var th=this; 152 var th=this;
105 - th.setData({show_submit:0}); //让提交先掩藏  
106 th.data.g_cart_q_time=null; 153 th.data.g_cart_q_time=null;
107 154
108 if (th.data.isclose==0){ 155 if (th.data.isclose==0){
@@ -111,7 +158,8 @@ Page({ @@ -111,7 +158,8 @@ Page({
111 }) 158 })
112 159
113 }else{ 160 }else{
114 - this.getuser_addr(function(ie){ 161 + this.getuser_addr(function(ie){
  162 + /*--
115 //地址切换要把包邮券清空 163 //地址切换要把包邮券清空
116 if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){ 164 if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){
117 var using_quan=th.data.using_quan; 165 var using_quan=th.data.using_quan;
@@ -123,18 +171,16 @@ Page({ @@ -123,18 +171,16 @@ Page({
123 } 171 }
124 } 172 }
125 173
126 - }  
127 -  
128 -  
129 - th.data.prom_goods_map={};  
130 - th.data.is_summit_ing=0; 174 + }--*/
  175 +
  176 + //th.data.prom_goods_map={};
131 //更换地址回来要重新调用计算价钱的接口 177 //更换地址回来要重新调用计算价钱的接口
132 if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ 178 if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
133 - th.setData({user_addr: ie }); 179 + th.setData({user_addr: ie,show_submit:0 });
134 if (th.data.is_b_now == 1) { 180 if (th.data.is_b_now == 1) {
135 if(th.data.bn_goods) { 181 if(th.data.bn_goods) {
136 th.setData({add_back:1}); 182 th.setData({add_back:1});
137 - 183 + th.calculatePrice2();
138 } 184 }
139 } 185 }
140 }else{ 186 }else{
@@ -150,55 +196,7 @@ Page({ @@ -150,55 +196,7 @@ Page({
150 getApp().globalData.is_cart_old=0; 196 getApp().globalData.is_cart_old=0;
151 } 197 }
152 } 198 }
153 -  
154 - //先获取是否有关闭使用优惠券  
155 - getApp().getConfig2(function (ee) {  
156 - var json_d = JSON.parse(ee.switch_list);  
157 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
158 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch});  
159 -  
160 - var rank_switch=json_d.rank_switch;  
161 - var max_price=-1;  
162 - var show_card=null;  
163 - var name="";  
164 - //如果有开等级卡的时候,  
165 - //因为都是调接口,要返回在计算  
166 - if(rank_switch==2){  
167 - //-- 获取所有的等级卡, --  
168 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
169 - {}).then(res => {  
170 - if(res.data.code==0){  
171 - var plusCard = res.data.data;  
172 - //-- 循环判断,拿到最贵的那张卡 --  
173 - for(var ih in plusCard){  
174 - if(plusCard[ih].IsStopBuy == true){ continue; }  
175 - if(max_price<0){  
176 - max_price=plusCard[ih].CardFee;  
177 - name='card'+plusCard[ih]['CorrPrice'];  
178 - show_card=plusCard[ih];  
179 - }else{  
180 - if(max_price<plusCard[ih].CardFee){  
181 - max_price=plusCard[ih].CardFee;  
182 - name='card'+plusCard[ih]['CorrPrice'];  
183 - show_card=plusCard[ih];  
184 - }  
185 - }  
186 - }  
187 -  
188 - if(show_card){  
189 - name=name.toLowerCase();  
190 - th.setData({card_name:name,show_card:show_card})  
191 - }  
192 - }  
193 - //-----先获取物流,再获取用户信息,再展示页面-----  
194 - th.get_wuliu(th.get_info(th.show_page));  
195 - })  
196 - }else{  
197 - //-----先获取物流,再获取用户信息,再展示页面-----  
198 - th.get_wuliu(th.get_info(th.show_page));  
199 - }  
200 - })  
201 - 199 +
202 }, 200 },
203 201
204 //-------------------获取物流--------------- 202 //-------------------获取物流---------------
@@ -245,33 +243,45 @@ Page({ @@ -245,33 +243,45 @@ Page({
245 //----------------展示页面,是再获取用户信息之后-------------- 243 //----------------展示页面,是再获取用户信息之后--------------
246 show_page:function(){ 244 show_page:function(){
247 var th=this,ta = this.data.param; 245 var th=this,ta = this.data.param;
248 - th.setData({  
249 - userinfo: getApp().globalData.userInfo,}); 246 + //th.setData({ userinfo: getApp().globalData.userInfo,});
  247 +
  248 + var user=getApp().globalData.userInfo;
  249 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  250 + data:{r:Math.random()},
  251 + success: function (e) {
  252 +
  253 + getApp().globalData.userInfo = e.data.data;
  254 + th.setData({userinfo:e.data.data});
250 255
251 - //选获取地址  
252 - th.getuser_addr(function(addr){  
253 - th.setData({user_addr: addr});  
254 - //--------------------------立即购买------------------  
255 - if(ta.is_bnow== 1){  
256 - //读取门店  
257 - to.get_allsto(function (e) {  
258 - th.setData({ allsto: e });  
259 - //获取立即购买的商品信息  
260 - th.get_buy_goods(ta.goods_id);  
261 - });  
262 - }  
263 - });  
264 - //获取提现金额  
265 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
266 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
267 - success: function (su) {  
268 - if (su.data.code == 0) {  
269 - var yuer = parseFloat(th.data.userinfo.user_money -  
270 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
271 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
272 - }  
273 - }  
274 - }); 256 + //选获取地址
  257 + th.getuser_addr(function(addr){
  258 + th.setData({user_addr: addr});
  259 + //--------------------------立即购买------------------
  260 + if(ta.is_bnow== 1){
  261 + //读取门店
  262 + to.get_allsto(function (e) {
  263 + th.setData({ allsto: e });
  264 + //获取立即购买的商品信息
  265 + th.get_buy_goods(ta.goods_id);
  266 + });
  267 + }
  268 + });
  269 + //获取提现金额
  270 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  271 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  272 + success: function (su) {
  273 + if (su.data.code == 0) {
  274 + var yuer = parseFloat(th.data.userinfo.user_money -
  275 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  276 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  277 + }
  278 + }
  279 + });
  280 +
  281 + },
  282 + })
  283 +
  284 +
275 }, 285 },
276 286
277 //-----获取立即购买的商品信息,入口---- 287 //-----获取立即购买的商品信息,入口----
@@ -401,6 +411,8 @@ Page({ @@ -401,6 +411,8 @@ Page({
401 wx.showLoading({ title:"处理中.",}) 411 wx.showLoading({ title:"处理中.",})
402 //-----------计算商品总价-------------- 412 //-----------计算商品总价--------------
403 var allpice = good.shop_price * good.buynum; 413 var allpice = good.shop_price * good.buynum;
  414 + var all_integral=good.integral * good.buynum;
  415 +
404 var cut_price=0; 416 var cut_price=0;
405 if(good.prom_type==3 && good.prom_price!==null){ 417 if(good.prom_type==3 && good.prom_price!==null){
406 cut_price=allpice-good.prom_price; 418 cut_price=allpice-good.prom_price;
@@ -510,14 +522,14 @@ Page({ @@ -510,14 +522,14 @@ Page({
510 if (th.data.bn_use_money == 1) { 522 if (th.data.bn_use_money == 1) {
511 if (amoney> order_m) { 523 if (amoney> order_m) {
512 order_m = order_m.toFixed(2); 524 order_m = order_m.toFixed(2);
513 - th.setData({ [txt]: order_m, [txt2]:0,[txt4]:good.integral,show_submit:1 }) 525 + th.setData({ [txt]: order_m, [txt2]:0,[txt4]:all_integral,show_submit:1 })
514 }else{ 526 }else{
515 order_m =parseFloat(order_m - amoney); 527 order_m =parseFloat(order_m - amoney);
516 order_m = order_m.toFixed(2); 528 order_m = order_m.toFixed(2);
517 - th.setData({ [txt]: amoney, [txt2]: order_m,[txt4]:good.integral,show_submit:1 }) 529 + th.setData({ [txt]: amoney, [txt2]: order_m,[txt4]:all_integral,show_submit:1 })
518 } 530 }
519 }else{ 531 }else{
520 - th.setData({ [txt]: 0, [txt2]: order_m,[txt4]:good.integral, show_submit:1 }) 532 + th.setData({ [txt]: 0, [txt2]: order_m,[txt4]:all_integral, show_submit:1 })
521 } 533 }
522 534
523 wx.hideLoading(); 535 wx.hideLoading();
@@ -551,6 +563,27 @@ Page({ @@ -551,6 +563,27 @@ Page({
551 th.data.is_summit_ing = 0; 563 th.data.is_summit_ing = 0;
552 return false; 564 return false;
553 } 565 }
  566 +
  567 +
  568 + var integrals=0;
  569 + var get_datas= {
  570 + user_id:getApp().globalData.user_id, store_id:o.stoid,
  571 + };
  572 + await getApp().request.promiseGet("/api/weshop/users/getAllPoints", {
  573 + data: get_datas
  574 + }).then(res => {
  575 + if(res.data.code==0){
  576 + integrals=res.data.data.Integral;
  577 + }
  578 + })
  579 +
  580 + //判断积分的情况
  581 + if(th.data.formData.integral && parseFloat(th.data.formData.integral)< parseFloat(integrals) ){
  582 + getApp().my_warnning("积分不足",0,th);
  583 + th.data.is_summit_ing = 0;
  584 + return false;
  585 + }
  586 +
554 587
555 var item={ 588 var item={
556 'user_id': to.globalData.user_id, 589 'user_id': to.globalData.user_id,
@@ -826,7 +859,7 @@ Page({ @@ -826,7 +859,7 @@ Page({
826 //--自提就要把包邮券清理掉-- 859 //--自提就要把包邮券清理掉--
827 if(ty==1){ 860 if(ty==1){
828 th.data.isget_by_quan={}; 861 th.data.isget_by_quan={};
829 - if(th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){ 862 + if(th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){
830 th.setData({using_quan:{}}); 863 th.setData({using_quan:{}});
831 } 864 }
832 } 865 }
pages/cart/cart2_pt/cart2_pt.js
@@ -131,21 +131,30 @@ Page({ @@ -131,21 +131,30 @@ Page({
131 //----------------展示页面,是再获取用户信息之后-------------- 131 //----------------展示页面,是再获取用户信息之后--------------
132 show_page:function(){ 132 show_page:function(){
133 var th=this; 133 var th=this;
134 - th.setData({ userinfo: to.globalData.userInfo});  
135 - //获取立即购买的商品信息  
136 - th.get_buy_goods();  
137 -  
138 - //获取提现金额  
139 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
140 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
141 - success: function (su) {  
142 - if (su.data.code == 0) {  
143 - var yuer = parseFloat(th.data.userinfo.user_money -  
144 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
145 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
146 - }  
147 - }  
148 - }); 134 + //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取
  135 + var user=getApp().globalData.userInfo;
  136 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  137 + data:{r:Math.random()},
  138 + success: function (e) {
  139 +
  140 + getApp().globalData.userInfo = e.data.data;
  141 + th.setData({userinfo:e.data.data});
  142 + //获取立即购买的商品信息
  143 + th.get_buy_goods();
  144 +
  145 + //获取提现金额
  146 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  147 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  148 + success: function (su) {
  149 + if (su.data.code == 0) {
  150 + var yuer = parseFloat(th.data.userinfo.user_money -
  151 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  152 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  153 + }
  154 + }
  155 + });
  156 + }
  157 + });
149 }, 158 },
150 159
151 //-----获取立即购买的商品信息---- 160 //-----获取立即购买的商品信息----
pages/goods/goodsInfo/goodsInfo.js
@@ -28,7 +28,7 @@ Page({ @@ -28,7 +28,7 @@ Page({
28 gid: "", 28 gid: "",
29 stoid: o.stoid, 29 stoid: o.stoid,
30 url: o.url, 30 url: o.url,
31 - resourceUrl: 'https://mshop-lib.yolipai.net/', //公众号那边的图片文件域名 31 + resourceUrl: o.h5_url, //公众号那边的图片文件域名
32 iurl: o.imghost, 32 iurl: o.imghost,
33 defaultAvatar: o.resourceUrl + "/static/images/user68.jpg", 33 defaultAvatar: o.resourceUrl + "/static/images/user68.jpg",
34 34
@@ -1421,7 +1421,7 @@ Page({ @@ -1421,7 +1421,7 @@ Page({
1421 } 1421 }
1422 1422
1423 //--判断商品是否超出活动限购-- 1423 //--判断商品是否超出活动限购--
1424 - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) { 1424 + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
1425 if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { 1425 if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
1426 wx.showModal({ 1426 wx.showModal({
1427 title: '超出商品活动限购', 1427 title: '超出商品活动限购',
@@ -2606,6 +2606,7 @@ Page({ @@ -2606,6 +2606,7 @@ Page({
2606 prom_act: inte_data, 2606 prom_act: inte_data,
2607 isshow: 1, 2607 isshow: 1,
2608 can_integral:can_integral, 2608 can_integral:can_integral,
  2609 + is_shopbuy: parseInt(inte_data.is_shopbuy?inte_data.is_shopbuy:0)
2609 }); 2610 });
2610 ee.get_sto(); 2611 ee.get_sto();
2611 2612
@@ -4560,6 +4561,7 @@ Page({ @@ -4560,6 +4561,7 @@ Page({
4560 var storid = os.stoid; 4561 var storid = os.stoid;
4561 var th = this; 4562 var th = this;
4562 var user=getApp().globalData.userInfo; 4563 var user=getApp().globalData.userInfo;
  4564 + if(!user) return false;
4563 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { 4565 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
4564 var plusCard = res.data.data; 4566 var plusCard = res.data.data;
4565 var arr = [1219, 2089, 3031]; 4567 var arr = [1219, 2089, 3031];
pages/goods/goodsInfo/goodsInfo.wxml
@@ -953,20 +953,28 @@ @@ -953,20 +953,28 @@
953 953
954 <!-------积分购--------> 954 <!-------积分购-------->
955 <block wx:if="{{prom_type==4}}"> 955 <block wx:if="{{prom_type==4}}">
956 -  
957 - <view bindtap="go_pay_integral_normal" class="join-btn cart-btn line-h">  
958 - <view class="fir-v">  
959 - <block wx:if="{{card_field && sele_g[card_field]>0}}">  
960 - {{filters.toFix(sele_g[card_field],2)}}  
961 - </block>  
962 - <block wx:else>  
963 - {{filters.toFix(sele_g.shop_price,2)}}  
964 - </block>  
965 - </view>  
966 - <view>单独购买</view>  
967 - </view>  
968 - <view bindtap="go_pay_integral" class="buy-btn cart-btn" wx:if="{{can_integral}}" >立即兑换</view>  
969 - <view class="buy-btn cart-btn" style="background-color: #aaa;" wx:else >立即兑换</view> 956 +
  957 + <block wx:if="{{is_shopbuy}}">
  958 + <view bindtap="go_pay_integral_normal" class="join-btn cart-btn line-h">
  959 + <view class="fir-v">
  960 + <block wx:if="{{card_field && sele_g[card_field]>0}}">
  961 + {{filters.toFix(sele_g[card_field],2)}}
  962 + </block>
  963 + <block wx:else>
  964 + {{filters.toFix(sele_g.shop_price,2)}}
  965 + </block>
  966 + </view>
  967 + <view>单独购买</view>
  968 + </view>
  969 + <view bindtap="go_pay_integral" class="buy-btn cart-btn" wx:if="{{can_integral}}" >立即兑换</view>
  970 + <view class="buy-btn cart-btn" style="background-color: #aaa;" wx:else >立即兑换</view>
  971 + </block>
  972 +
  973 + <block wx:else>
  974 + <view bindtap="go_pay_integral" class="buy-btn-all cart-btn" style="width: 58%; margin-left:1%;" wx:if="{{can_integral}}" >立即兑换</view>
  975 + <view class="buy-btn-all cart-btn" style="background-color: #aaa; width: 58%;margin-left:1%" wx:else >立即兑换</view>
  976 + </block>
  977 +
970 </block> 978 </block>
971 979
972 <!---<view bindtap="openSpecModel" class="buy-btn cart-btn cart-btn-lg" wx:else>立即兑换</view>--> 980 <!---<view bindtap="openSpecModel" class="buy-btn cart-btn cart-btn-lg" wx:else>立即兑换</view>-->
pages/goods/goodsInfo/goodsInfo.wxss
@@ -422,6 +422,13 @@ border-radius: 0 56rpx 55rpx 0; @@ -422,6 +422,13 @@ border-radius: 0 56rpx 55rpx 0;
422 422
423 } 423 }
424 424
  425 +.buy-btn-all{
  426 + background-color: #f23030;
  427 + height: 70rpx;
  428 + border-radius: 56rpx;
  429 +}
  430 +
  431 +
425 .toTop { 432 .toTop {
426 position: fixed; 433 position: fixed;
427 z-index: 3; 434 z-index: 3;
pages/user/order_detail/order_detail.wxml
@@ -106,9 +106,9 @@ @@ -106,9 +106,9 @@
106 <view> ¥ {{order.coupon_price}}元</view> 106 <view> ¥ {{order.coupon_price}}元</view>
107 </view> 107 </view>
108 108
109 - <view class="item pnew" wx:if="{{order.integral_money>0}}"> 109 + <view class="item pnew" wx:if="{{order.integral>0}}">
110 <view>积分</view> 110 <view>积分</view>
111 - <view> ¥ {{order.integral_money}}元</view> 111 + <view>{{order.integral}}积分</view>
112 </view> 112 </view>
113 113
114 <view class="item pnew" wx:if="{{order.discount_amount>0}}"> 114 <view class="item pnew" wx:if="{{order.discount_amount>0}}">
pages/user/order_list/order_list.js
@@ -674,6 +674,9 @@ Page({ @@ -674,6 +674,9 @@ Page({
674 674
675 pay_next(e){ 675 pay_next(e){
676 var th=this; 676 var th=this;
  677 +
  678 +
  679 +
677 if (e.order_amount == 0) { 680 if (e.order_amount == 0) {
678 var dd = { 681 var dd = {
679 parent_sn: e.order_sn, 682 parent_sn: e.order_sn,