Commit e6412d6d5294cbc9d2fae3b50f4aad9d2f49ba28

Authored by abson
1 parent 8a1b1544

oa单处理

components/diy_goodsGroup/diy_goodsGroup.js
@@ -45,6 +45,7 @@ Component({ @@ -45,6 +45,7 @@ Component({
45 nav_list:null, 45 nav_list:null,
46 title_index:0, 46 title_index:0,
47 swiper_hei:0, 47 swiper_hei:0,
  48 + title_class:"",
48 }, 49 },
49 50
50 ready: function () {}, 51 ready: function () {},
@@ -96,7 +97,17 @@ Component({ @@ -96,7 +97,17 @@ Component({
96 if(this.data.object.goodsprice) hei+=80; 97 if(this.data.object.goodsprice) hei+=80;
97 if(this.data.object.goodsnum) hei+=80; 98 if(this.data.object.goodsnum) hei+=80;
98 99
99 - this.setData({swiper_hei:hei}); 100 + if(this.data.object.title_color){
  101 + this.data.title_class=`color:${this.data.object.title_color};`
  102 + }
  103 +
  104 + if(this.data.object.title_font_size){
  105 + this.data.title_class=this.data.title_class.concat(`font-size:${this.data.object.title_font_size}px;`)
  106 + }
  107 + this.setData({
  108 + swiper_hei:hei,
  109 + title_class:this.data.title_class,
  110 + });
100 111
101 if (nav_item && nav_item.goodsclass == 1) { 112 if (nav_item && nav_item.goodsclass == 1) {
102 this.data.is_recommend = 1 113 this.data.is_recommend = 1
components/diy_goodsGroup/diy_goodsGroup.wxml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <block wx:if="{{is_nav}}"> 6 <block wx:if="{{is_nav}}">
7 <view class="flex gr_title_list" style="overflow-x: auto;"> 7 <view class="flex gr_title_list" style="overflow-x: auto;">
8 <view class="gr_title_item" wx:for="{{nav_list}}" data-index="{{index}}" bindtap="gr_set_nav" data-idlist="{{item.idlist}}" data-wgroup="{{item.wgroup}}" data-classstyle="{{item.classstyle}}" > 8 <view class="gr_title_item" wx:for="{{nav_list}}" data-index="{{index}}" bindtap="gr_set_nav" data-idlist="{{item.idlist}}" data-wgroup="{{item.wgroup}}" data-classstyle="{{item.classstyle}}" >
9 - <text class="{{index==title_index?'t_red':''}}">{{item.title}}</text> 9 + <text class="{{index==title_index?'t_red':''}}" style="{{title_class}}">{{item.title}}</text>
10 </view> 10 </view>
11 </view> 11 </view>
12 </block> 12 </block>
packageA/pages/quan_pro/quan_pro.js
@@ -128,9 +128,16 @@ Page({ @@ -128,9 +128,16 @@ Page({
128 }, 128 },
129 129
130 go_quan:function(){ 130 go_quan:function(){
131 - //跳转到券列表 131 + //跳转到券列表
  132 + this.setData({
  133 + show_success:0
  134 + })
132 getApp().goto("/pages/user/coupons/coupons"); 135 getApp().goto("/pages/user/coupons/coupons");
133 - }  
134 - 136 + },
135 137
  138 + close_show(){
  139 + this.setData({
  140 + show_success:0
  141 + })
  142 + },
136 }); 143 });
packageA/pages/quan_pro/quan_pro.wxml
@@ -7,42 +7,39 @@ @@ -7,42 +7,39 @@
7 <view class="img_part"> 7 <view class="img_part">
8 <image style="width: 100%; height: 450rpx" src="{{iurl}}/miniapp/images/coupon_img/q_detail_bg.png"></image> 8 <image style="width: 100%; height: 450rpx" src="{{iurl}}/miniapp/images/coupon_img/q_detail_bg.png"></image>
9 <view class="q_content"> 9 <view class="q_content">
10 - <view class="upper flex jc_sb co-w">  
11 - <view class="left fs30" style="width: 460rpx;">  
12 - <view>  
13 - <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image>  
14 - <text wx:if="{{q_data}}">{{q_data.name}}</text>  
15 - <text wx:elif="{{is_get}}" class="fs28">不存在此微券或数量已领取完</text>  
16 - </view>  
17 -  
18 - <block wx:if="{{q_data}}">  
19 - <view class="flex ai-center" style="margin-top: 24rpx; margin-right: 20rpx; width: 440rpx">  
20 - <view class="t_circle"></view>  
21 - <view>  
22 - <text wx:if="{{q_data.useobjecttype==0}}">全场通用</text>  
23 - <text wx:else>仅限{{q_data.useobjectname}}使用</text>  
24 - </view>  
25 -  
26 - </view>  
27 - <view class="ellipsis-3" style="margin-top: 20rpx;">{{q_data.coupon_remark}}</view>  
28 - </block> 10 + <view class="upper quan_box jc_sb co-w" style="padding: 20rpx 20rpx 0;">
  11 + <view>
  12 + <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image>
  13 + <text wx:if="{{q_data}}">{{q_data.name}}</text>
  14 + <text wx:elif="{{is_get}}" class="fs28">不存在此微券或数量已领取完</text>
29 </view> 15 </view>
30 - <view wx:if="{{q_data}}" class="right" style="margin-right: 80rpx;">  
31 - <view class="f40 t-c" style="margin-top: 100rpx"><text class="fs26">¥</text>{{filters.toFix(q_data.money,2)}}</view>  
32 - <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view> 16 + <view class="fs30 flex" wx:if="{{q_data}}" style="height: 100rpx;justify-content: space-between;">
  17 + <view class="flex ai-center">
  18 + <view class="t_circle"></view>
  19 + <view>
  20 + <text wx:if="{{q_data.useobjecttype==0}}">全场通用</text>
  21 + <text wx:else>仅限{{q_data.useobjectname}}使用</text>
  22 + </view>
  23 + </view>
  24 + <view>
  25 + <view class="fs40 t-c"><text class="fs26">¥</text>{{filters.toFix(q_data.money,2)}}</view>
  26 + <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view>
  27 + </view>
33 </view> 28 </view>
  29 + <text class="ellipsis-3 fs30">{{q_data.coupon_remark}}</text>
34 </view> 30 </view>
35 31
36 - <block wx:if="{{ q_data}}"> 32 + <block wx:if="{{ q_data}}">
37 <view wx:if="{{ q_data.endtype==0}}" class="lower fs30">有效期 33 <view wx:if="{{ q_data.endtype==0}}" class="lower fs30">有效期
38 - <text wx:if="{{q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text> 34 + <text wx:if="{{q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text>
39 <text wx:if="{{q_data.use_start_time>0 && q_data.starttype==0}}"> {{filters.format_time(q_data.use_start_time)}}</text>至 35 <text wx:if="{{q_data.use_start_time>0 && q_data.starttype==0}}"> {{filters.format_time(q_data.use_start_time)}}</text>至
40 <text wx:if="{{q_data.use_end_time>0}}"> {{filters.format_time(q_data.use_end_time)}}</text><text wx:else>不限</text> 36 <text wx:if="{{q_data.use_end_time>0}}"> {{filters.format_time(q_data.use_end_time)}}</text><text wx:else>不限</text>
41 </view> 37 </view>
42 <view wx:else class="lower fs30">有效期 38 <view wx:else class="lower fs30">有效期
43 - <text wx:if="{{ q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text>  
44 - <text wx:else>{{filters.format_time(getcurday)}}</text>至  
45 - <text wx:if="{{q_data.days>0}}"> {{filters.format_time(getcurday+3600*24*q_data.days)}}</text><text wx:else>不限</text></view> 39 + <text wx:if="{{ q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text>
  40 + <text wx:else>{{filters.format_time(getcurday)}}</text>至
  41 + <text wx:if="{{q_data.days>0}}"> {{filters.format_time(getcurday+3600*24*q_data.days)}}</text><text wx:else>不限</text>
  42 + </view>
46 </block> 43 </block>
47 44
48 <view wx:elif="{{is_get}}" class="fs28" style="text-align: center;color: #999;position: absolute;bottom: 20rpx;"> 45 <view wx:elif="{{is_get}}" class="fs28" style="text-align: center;color: #999;position: absolute;bottom: 20rpx;">
@@ -58,7 +55,7 @@ @@ -58,7 +55,7 @@
58 </view> 55 </view>
59 56
60 <view class="flex jc-center fs36" style="margin-top: 40rpx"> 57 <view class="flex jc-center fs36" style="margin-top: 40rpx">
61 - <image style="margin-right: 20rpx" class="love" src="{{iurl}}/miniapp/images/coupon_img/love.png"></image>猜你喜欢 58 + <image style="margin-right: 20rpx" class="love" src="{{iurl}}/miniapp/images/coupon_img/love.png"></image>猜你喜欢
62 </view> 59 </view>
63 </view> 60 </view>
64 <!-- 下部分 --> 61 <!-- 下部分 -->
@@ -83,6 +80,4 @@ @@ -83,6 +80,4 @@
83 80
84 81
85 <warn id="warn"></warn> 82 <warn id="warn"></warn>
86 -<nav_box id="nav"></nav_box>  
87 -  
88 - 83 +<nav_box id="nav"></nav_box>
89 \ No newline at end of file 84 \ No newline at end of file
packageA/pages/quan_pro/quan_pro.wxss
@@ -7,10 +7,10 @@ page{background-color: #f8f8f8;} @@ -7,10 +7,10 @@ page{background-color: #f8f8f8;}
7 .img_part{ padding: 0 20rpx; position: relative} 7 .img_part{ padding: 0 20rpx; position: relative}
8 .btn{ width: 90%; height: 72rpx; border-radius: 10rpx; background-color: #ff6c6c; color: #fff;} 8 .btn{ width: 90%; height: 72rpx; border-radius: 10rpx; background-color: #ff6c6c; color: #fff;}
9 .love{ width: 60rpx; height: 50rpx} 9 .love{ width: 60rpx; height: 50rpx}
10 -.q_content{ position: absolute;top: 0; left: 0; width: 100%; height: 450rpx;padding: 0 20rpx; } 10 +.q_content{ position: absolute;top: 0; left: 0; width: calc(100% - 40rpx); height: 450rpx;padding: 0 20rpx; }
11 .upper{ height:330rpx;} 11 .upper{ height:330rpx;}
12 .lower{ height: 120rpx; line-height: 170rpx;color:#7a668f} 12 .lower{ height: 120rpx; line-height: 170rpx;color:#7a668f}
13 - 13 +.quan_box {display: flex;flex-direction: column;justify-content: flex-start; box-sizing: border-box;}
14 .upper .left{ margin-left:30rpx; margin-top: 30rpx } 14 .upper .left{ margin-left:30rpx; margin-top: 30rpx }
15 .t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx} 15 .t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx}
16 16
packageB/pages/zuhegou/index/index.js
@@ -10,8 +10,7 @@ let imgDraw = { @@ -10,8 +10,7 @@ let imgDraw = {
10 "width": "650px", 10 "width": "650px",
11 "height": "843px", 11 "height": "843px",
12 "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", 12 "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg",
13 - "views": [  
14 - { // 头像 13 + "views": [{ // 头像
15 "type": "image", 14 "type": "image",
16 "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", 15 "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
17 "css": { 16 "css": {
@@ -64,7 +63,7 @@ let imgDraw = { @@ -64,7 +63,7 @@ let imgDraw = {
64 "textAlign": "center" 63 "textAlign": "center"
65 } 64 }
66 }, 65 },
67 - { // 码 66 + { // 码
68 "type": "image", 67 "type": "image",
69 "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", 68 "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
70 "css": { 69 "css": {
@@ -102,64 +101,62 @@ Page({ @@ -102,64 +101,62 @@ Page({
102 showNum: false, 101 showNum: false,
103 haveAdded: false, 102 haveAdded: false,
104 //imgDraw: imgDraw, 分享内容 103 //imgDraw: imgDraw, 分享内容
105 - id: 0, //获得活动id  
106 - page: 1, //第一页  
107 - no_more: 0, //没有更多  
108 - loading: 0, //加载中  
109 - list:null, //商品列表的显示  
110 - act: null, //组合活动 104 + id: 0, //获得活动id
  105 + page: 1, //第一页
  106 + no_more: 0, //没有更多
  107 + loading: 0, //加载中
  108 + list: null, //商品列表的显示
  109 + act: null, //组合活动
111 all_price: 0, //合计价格 110 all_price: 0, //合计价格
112 - all_num: 0, //全部数量 111 + all_num: 0, //全部数量
113 sele_pick_id: 0, //默认选择门店,当用户什么商品都没有选,sele_pick_id=0 112 sele_pick_id: 0, //默认选择门店,当用户什么商品都没有选,sele_pick_id=0
114 - def_store: null, //用户默认的门店  
115 - sele_store: 0, //是不是选择了门店 113 + def_store: null, //用户默认的门店
  114 + sele_store: 0, //是不是选择了门店
116 more_store: 0, //选择门店 115 more_store: 0, //选择门店
117 sort_store: 0, //门店分类 116 sort_store: 0, //门店分类
118 choice_sort_store: 0, //选择分类门店 117 choice_sort_store: 0, //选择分类门店
119 - fir_pick_index: 0, //门店选择的下标  
120 - sec_pick_index: 0 //门店选择的下标,地区选择之后的内页 118 + fir_pick_index: 0, //门店选择的下标
  119 + sec_pick_index: 0 //门店选择的下标,地区选择之后的内页
121 }, 120 },
122 121
123 /** 122 /**
124 * 生命周期函数--监听页面加载 123 * 生命周期函数--监听页面加载
125 */ 124 */
126 onLoad: function (options) { 125 onLoad: function (options) {
127 -  
128 - console.log(options,111);  
129 - 126 + console.log(options, 111);
130 self = this; 127 self = this;
131 var the_id = options.id; 128 var the_id = options.id;
132 - if(options.title) {  
133 - wx.setNavigationBarTitle({  
134 - title: options.title,  
135 - });  
136 - };  
137 - var first_leader=options.first_leader; 129 + if (options.title) {
  130 + wx.setNavigationBarTitle({
  131 + title: options.title,
  132 + });
  133 + };
  134 + var first_leader = options.first_leader;
138 135
139 //--如果tg_id是空的话,分享回来-- 136 //--如果tg_id是空的话,分享回来--
140 if (the_id == undefined || the_id == null || the_id == "") { 137 if (the_id == undefined || the_id == null || the_id == "") {
141 - var gid_str = decodeURIComponent(options.scene);  
142 - gid_str=gid_str.split("_");  
143 - the_id=gid_str[0];  
144 - if(gid_str.length>1){  
145 - first_leader=gid_str[1]; 138 + var gid_str = decodeURIComponent(options.scene);
  139 + gid_str = gid_str.split("_");
  140 + the_id = gid_str[0];
  141 + if (gid_str.length > 1) {
  142 + first_leader = gid_str[1];
146 } 143 }
147 } 144 }
148 145
149 - this.data.id=the_id;  
150 - if(first_leader){  
151 - getApp().globalData.first_leader=first_leader; 146 + this.data.id = the_id;
  147 + if (first_leader) {
  148 + getApp().globalData.first_leader = first_leader;
152 //调用接口判断是不是会员 149 //调用接口判断是不是会员
153 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{  
154 - if(res.data.code==0){  
155 - getApp().globalData.guide_id=res.data.data.id; 150 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  151 + if (res.data.code == 0) {
  152 + getApp().globalData.guide_id = res.data.data.id;
156 } 153 }
157 }) 154 })
158 } 155 }
159 156
160 //如果有会员的时候 157 //如果有会员的时候
161 var userInfo = getApp().globalData.userInfo; 158 var userInfo = getApp().globalData.userInfo;
162 - if(!userInfo){ 159 + if (!userInfo) {
163 getApp().goto("/pages/togoin/togoin"); 160 getApp().goto("/pages/togoin/togoin");
164 return false; 161 return false;
165 } 162 }
@@ -169,40 +166,51 @@ Page({ @@ -169,40 +166,51 @@ Page({
169 * 生命周期函数--监听页面显示 166 * 生命周期函数--监听页面显示
170 */ 167 */
171 onShow: function () { 168 onShow: function () {
172 - var th = this, that = this, ee = this; 169 + var th = this,
  170 + that = this,
  171 + ee = this;
173 this.data.is_timer = 1; 172 this.data.is_timer = 1;
174 if (this.data.act) this.countDown(); 173 if (this.data.act) this.countDown();
175 //如果有会员的时候 174 //如果有会员的时候
176 var userInfo = getApp().globalData.userInfo; 175 var userInfo = getApp().globalData.userInfo;
177 if (userInfo) { 176 if (userInfo) {
178 - if(!th.data.is_get_act){ 177 + if (!th.data.is_get_act) {
179 //获取活动信息 178 //获取活动信息
180 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id+"/"+userInfo.user_id; 179 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id;
181 getApp().request.get(url, { 180 getApp().request.get(url, {
182 success: function (e) { 181 success: function (e) {
183 - th.data.is_get_act=1; 182 + th.data.is_get_act = 1;
184 if (e.data.code == 0 && e.data.data) { 183 if (e.data.code == 0 && e.data.data) {
185 - self.setData({act: e.data.data});  
186 - if(e.data.data.is_show!=1){  
187 - th.setData({error:'活动未开启'}); 184 + self.setData({
  185 + act: e.data.data
  186 + });
  187 + if (e.data.data.is_show != 1) {
  188 + th.setData({
  189 + error: '活动未开启'
  190 + });
188 return false; 191 return false;
189 } 192 }
190 - if(ut.gettimestamp()<e.data.data.start_time){  
191 - th.setData({error:'活动还未开始'}); 193 + if (ut.gettimestamp() < e.data.data.start_time) {
  194 + th.setData({
  195 + error: '活动还未开始'
  196 + });
192 return false; 197 return false;
193 } 198 }
194 - if (e.data.data.is_end == 0 && ut.gettimestamp()<e.data.data.end_time ) { 199 + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) {
195 //-- 获取商品列表 -- 200 //-- 获取商品列表 --
196 self.get_list(); 201 self.get_list();
197 self.countDown(); 202 self.countDown();
198 - }  
199 - else{  
200 - th.setData({error:'活动已经过期'}); 203 + } else {
  204 + th.setData({
  205 + error: '活动已经过期'
  206 + });
201 return false; 207 return false;
202 } 208 }
203 } else { 209 } else {
204 - th.data.is_get_act=0;  
205 - th.setData({error:e.data.msg}); 210 + th.data.is_get_act = 0;
  211 + th.setData({
  212 + error: e.data.msg
  213 + });
206 return false; 214 return false;
207 } 215 }
208 } 216 }
@@ -211,11 +219,11 @@ Page({ @@ -211,11 +219,11 @@ Page({
211 219
212 //等待活动值 220 //等待活动值
213 this.waitfor2(10, 'list', function () { 221 this.waitfor2(10, 'list', function () {
214 - if(!th.data.list) return false;  
215 - if(ut.gettimestamp()<th.data.act.start_time){ 222 + if (!th.data.list) return false;
  223 + if (ut.gettimestamp() < th.data.act.start_time) {
216 return false; 224 return false;
217 } 225 }
218 - if (th.data.act.is_end == 10 || ut.gettimestamp()>=th.data.act.end_time ) { 226 + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) {
219 return false; 227 return false;
220 } 228 }
221 //获取头像的分享 229 //获取头像的分享
@@ -241,7 +249,9 @@ Page({ @@ -241,7 +249,9 @@ Page({
241 success: function (res) { 249 success: function (res) {
242 var vpath = res.path; 250 var vpath = res.path;
243 imgDraw.views[4].url = vpath; 251 imgDraw.views[4].url = vpath;
244 - th.setData({imgDraw: imgDraw}) 252 + th.setData({
  253 + imgDraw: imgDraw
  254 + })
245 } 255 }
246 }) 256 })
247 }) 257 })
@@ -254,13 +264,13 @@ Page({ @@ -254,13 +264,13 @@ Page({
254 } 264 }
255 265
256 266
257 - 267 +
258 var ee = JSON.parse(JSON.stringify(e)); 268 var ee = JSON.parse(JSON.stringify(e));
259 var appd = getApp().globalData; 269 var appd = getApp().globalData;
260 //-- 等待定位系统的开启 -- 270 //-- 等待定位系统的开启 --
261 th.waitfor2(15, 'is_get_local_ok', function () { 271 th.waitfor2(15, 'is_get_local_ok', function () {
262 272
263 - if(!th.data.is_get_local_ok) return false; 273 + if (!th.data.is_get_local_ok) return false;
264 274
265 var e = JSON.parse(JSON.stringify(ee)); 275 var e = JSON.parse(JSON.stringify(ee));
266 //如果有开启近距离的话,同时距离优不一样了 276 //如果有开启近距离的话,同时距离优不一样了
@@ -325,10 +335,14 @@ Page({ @@ -325,10 +335,14 @@ Page({
325 var sw_arr = JSON.parse(swithc_list); 335 var sw_arr = JSON.parse(swithc_list);
326 //---如果后台又开等级卡的开关--- 336 //---如果后台又开等级卡的开关---
327 if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { 337 if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
328 - th.setData({rank_switch: true}); 338 + th.setData({
  339 + rank_switch: true
  340 + });
329 //---回调卡的列表--- 341 //---回调卡的列表---
330 th.getPlusCardType(function (ob) { 342 th.getPlusCardType(function (ob) {
331 - th.setData({card_list: ob.card_list}); 343 + th.setData({
  344 + card_list: ob.card_list
  345 + });
332 var user = getApp().globalData.userInfo; 346 var user = getApp().globalData.userInfo;
333 if (!user) return false; 347 if (!user) return false;
334 if (user.card_field && user['card_expiredate']) { 348 if (user.card_field && user['card_expiredate']) {
@@ -350,7 +364,7 @@ Page({ @@ -350,7 +364,7 @@ Page({
350 th.get_cart_val(e); 364 th.get_cart_val(e);
351 365
352 }) 366 })
353 - }else{ 367 + } else {
354 //获取购物车的内容 368 //获取购物车的内容
355 th.get_cart_val(e); 369 th.get_cart_val(e);
356 } 370 }
@@ -359,9 +373,6 @@ Page({ @@ -359,9 +373,6 @@ Page({
359 }) 373 })
360 374
361 } 375 }
362 -  
363 -  
364 -  
365 }, 376 },
366 377
367 onHide: function () { 378 onHide: function () {
@@ -386,33 +397,43 @@ Page({ @@ -386,33 +397,43 @@ Page({
386 data: req_data, 397 data: req_data,
387 success: function (res) { 398 success: function (res) {
388 th.data.loading = 0; 399 th.data.loading = 0;
389 - th.setData({is_get: 1}) 400 + th.setData({
  401 + is_get: 1
  402 + })
390 if (ut.ajax_ok(res)) { 403 if (ut.ajax_ok(res)) {
391 th.data.page++; 404 th.data.page++;
392 var list = th.data.list; 405 var list = th.data.list;
393 - if(!list) list=[]; 406 + if (!list) list = [];
394 407
395 //当是下拉刷新的时候 408 //当是下拉刷新的时候
396 - if(th.data.page>1 && th.data.cart_list){ 409 + if (th.data.page > 1 && th.data.cart_list) {
397 //下拉之后也要重新计算一下金额 410 //下拉之后也要重新计算一下金额
398 - th.calc_more(res.data.data.pageData,function (list1) { 411 + th.calc_more(res.data.data.pageData, function (list1) {
399 for (var i in list1) { 412 for (var i in list1) {
400 list.push(list1[i]); 413 list.push(list1[i]);
401 } 414 }
402 - th.setData({list: list}); 415 + th.setData({
  416 + list: list
  417 + });
403 th.re_sum_price(); 418 th.re_sum_price();
404 }) 419 })
405 - }else{ 420 + } else {
406 for (var i in res.data.data.pageData) { 421 for (var i in res.data.data.pageData) {
407 list.push(res.data.data.pageData[i]); 422 list.push(res.data.data.pageData[i]);
408 } 423 }
409 - th.setData({list: list}); 424 + th.setData({
  425 + list: list
  426 + });
410 if (res.data.data.total <= 10) { 427 if (res.data.data.total <= 10) {
411 - th.setData({no_more: 1}); 428 + th.setData({
  429 + no_more: 1
  430 + });
412 } 431 }
413 } 432 }
414 } else { 433 } else {
415 - th.setData({no_more: 1}); 434 + th.setData({
  435 + no_more: 1
  436 + });
416 } 437 }
417 } 438 }
418 }) 439 })
@@ -428,34 +449,34 @@ Page({ @@ -428,34 +449,34 @@ Page({
428 */ 449 */
429 onShareAppMessage: function () { 450 onShareAppMessage: function () {
430 var title = this.data.act.name; 451 var title = this.data.act.name;
431 - var url= "/packageB/pages/zuhegou/index/index?id="+this.data.act.id; 452 + var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
432 if (getApp().globalData.user_id) { 453 if (getApp().globalData.user_id) {
433 url += "&first_leader=" + getApp().globalData.user_id; 454 url += "&first_leader=" + getApp().globalData.user_id;
434 } 455 }
435 var ob = { 456 var ob = {
436 - title:title, 457 + title: title,
437 path: url, 458 path: url,
438 }; 459 };
439 - if(this.data.act.img_url)  
440 - ob.imageUrl=this.data.iurl+this.data.act.img_url; 460 + if (this.data.act.img_url)
  461 + ob.imageUrl = this.data.iurl + this.data.act.img_url;
441 return ob; 462 return ob;
442 }, 463 },
443 464
444 /** 465 /**
445 * 用户分享朋友圈 466 * 用户分享朋友圈
446 */ 467 */
447 - onShareTimeline(){ 468 + onShareTimeline() {
448 var title = this.data.act.name; 469 var title = this.data.act.name;
449 - var url= "/packageB/pages/zuhegou/index/index?id="+this.data.act.id; 470 + var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
450 if (getApp().globalData.user_id) { 471 if (getApp().globalData.user_id) {
451 url += "&first_leader=" + getApp().globalData.user_id; 472 url += "&first_leader=" + getApp().globalData.user_id;
452 } 473 }
453 var ob = { 474 var ob = {
454 - title:title, 475 + title: title,
455 path: url, 476 path: url,
456 }; 477 };
457 - if(this.data.act.img_url)  
458 - ob.imageUrl=this.data.iurl+this.data.act.img_url; 478 + if (this.data.act.img_url)
  479 + ob.imageUrl = this.data.iurl + this.data.act.img_url;
459 return ob; 480 return ob;
460 }, 481 },
461 /** 482 /**
@@ -505,7 +526,7 @@ Page({ @@ -505,7 +526,7 @@ Page({
505 this.data.sele_index = index; 526 this.data.sele_index = index;
506 let title = ''; 527 let title = '';
507 self = this; 528 self = this;
508 - th.data.s_cart_num=0; 529 + th.data.s_cart_num = 0;
509 530
510 //说明是加入购物车是时候 531 //说明是加入购物车是时候
511 this.data.is_zuhe_addcart = 1; 532 this.data.is_zuhe_addcart = 1;
@@ -527,7 +548,7 @@ Page({ @@ -527,7 +548,7 @@ Page({
527 wx.showModal({ 548 wx.showModal({
528 title: '温馨提示', 549 title: '温馨提示',
529 content: '该商品的物流配送方式和默认门店不匹配,是否要切换门店?', 550 content: '该商品的物流配送方式和默认门店不匹配,是否要切换门店?',
530 - success (res) { 551 + success(res) {
531 if (res.confirm) { 552 if (res.confirm) {
532 //物流的配送方式不一样 553 //物流的配送方式不一样
533 th.get_sto(); 554 th.get_sto();
@@ -544,7 +565,9 @@ Page({ @@ -544,7 +565,9 @@ Page({
544 } 565 }
545 return false; 566 return false;
546 } else { 567 } else {
547 - th.setData({is_no_pipei: 0}); 568 + th.setData({
  569 + is_no_pipei: 0
  570 + });
548 th.check_is_in_cart(function () { 571 th.check_is_in_cart(function () {
549 th.add_cart_func(); 572 th.add_cart_func();
550 }) 573 })
@@ -559,10 +582,10 @@ Page({ @@ -559,10 +582,10 @@ Page({
559 wx.showModal({ 582 wx.showModal({
560 title: '温馨提示', 583 title: '温馨提示',
561 content: "确定取消该商品参与活动?", 584 content: "确定取消该商品参与活动?",
562 - success (res) { 585 + success(res) {
563 if (res.confirm) { 586 if (res.confirm) {
564 console.log('用户点击确定'); 587 console.log('用户点击确定');
565 - if(th.data.sele_g.cart_num && th.data.sele_g.cart_num - th.data.sele_g.num>0){ 588 + if (th.data.sele_g.cart_num && th.data.sele_g.cart_num - th.data.sele_g.num > 0) {
566 589
567 var updata = { 590 var updata = {
568 id: th.data.sele_g.cart_id, 591 id: th.data.sele_g.cart_id,
@@ -571,8 +594,8 @@ Page({ @@ -571,8 +594,8 @@ Page({
571 } 594 }
572 getApp().request.put("/api/weshop/cart/update", { 595 getApp().request.put("/api/weshop/cart/update", {
573 data: updata, 596 data: updata,
574 - success:function (rs) {  
575 - if(rs.data.code==0) { 597 + success: function (rs) {
  598 + if (rs.data.code == 0) {
576 title = '取消成功'; 599 title = '取消成功';
577 th.setData({ 600 th.setData({
578 [txt1]: 0, 601 [txt1]: 0,
@@ -588,12 +611,12 @@ Page({ @@ -588,12 +611,12 @@ Page({
588 } 611 }
589 }) 612 })
590 613
591 - }else{  
592 - var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;  
593 - getApp().request.delete(url, {  
594 - success:function (res) { 614 + } else {
  615 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;
  616 + getApp().request.delete(url, {
  617 + success: function (res) {
595 618
596 - if(res.data.code==0) { 619 + if (res.data.code == 0) {
597 title = '取消成功'; 620 title = '取消成功';
598 th.setData({ 621 th.setData({
599 [txt1]: 0, 622 [txt1]: 0,
@@ -635,14 +658,14 @@ Page({ @@ -635,14 +658,14 @@ Page({
635 return false; 658 return false;
636 } 659 }
637 660
638 - if(this.data.changing) return false;  
639 - this.data.changing=1; 661 + if (this.data.changing) return false;
  662 + this.data.changing = 1;
640 663
641 var index = e.currentTarget.dataset.index; 664 var index = e.currentTarget.dataset.index;
642 this.data.sele_g = this.data.list[index]; 665 this.data.sele_g = this.data.list[index];
643 - this.data.sele_index=index; 666 + this.data.sele_index = index;
644 th.data.goodsInputNum = this.data.sele_g.num + 1; 667 th.data.goodsInputNum = this.data.sele_g.num + 1;
645 - if(this.data.sele_g.cart_num){ 668 + if (this.data.sele_g.cart_num) {
646 th.data.s_cart_num = this.data.sele_g.cart_num + 1; 669 th.data.s_cart_num = this.data.sele_g.cart_num + 1;
647 } 670 }
648 th.add_cart_func(); 671 th.add_cart_func();
@@ -661,7 +684,7 @@ Page({ @@ -661,7 +684,7 @@ Page({
661 var th = this; 684 var th = this;
662 var index = e.currentTarget.dataset.index; 685 var index = e.currentTarget.dataset.index;
663 var item = this.data.list[index]; 686 var item = this.data.list[index];
664 - this.data.sele_g=item; 687 + this.data.sele_g = item;
665 let num = item.num; 688 let num = item.num;
666 th.data.s_cart_num = item.cart_num - 1; 689 th.data.s_cart_num = item.cart_num - 1;
667 690
@@ -677,8 +700,8 @@ Page({ @@ -677,8 +700,8 @@ Page({
677 return false; 700 return false;
678 } 701 }
679 702
680 - if(th.data.changing) return false;  
681 - th.data.changing=1; 703 + if (th.data.changing) return false;
  704 + th.data.changing = 1;
682 th.data.sele_g = item; 705 th.data.sele_g = item;
683 th.data.sele_index = index; 706 th.data.sele_index = index;
684 th.data.goodsInputNum = check_num; 707 th.data.goodsInputNum = check_num;
@@ -694,19 +717,19 @@ Page({ @@ -694,19 +717,19 @@ Page({
694 wx.showModal({ 717 wx.showModal({
695 title: '温馨提示', 718 title: '温馨提示',
696 content: '确定取消该商品参与活动?', 719 content: '确定取消该商品参与活动?',
697 - success (res) { 720 + success(res) {
698 if (res.confirm) { 721 if (res.confirm) {
699 722
700 - if(th.data.s_cart_num){ 723 + if (th.data.s_cart_num) {
701 var updata = { 724 var updata = {
702 id: th.data.sele_g.cart_id, 725 id: th.data.sele_g.cart_id,
703 - goods_num:th.data.s_cart_num , 726 + goods_num: th.data.s_cart_num,
704 store_id: os.stoid 727 store_id: os.stoid
705 } 728 }
706 getApp().request.put("/api/weshop/cart/update", { 729 getApp().request.put("/api/weshop/cart/update", {
707 data: updata, 730 data: updata,
708 - success:function (rs) {  
709 - if(rs.data.code==0) { 731 + success: function (rs) {
  732 + if (rs.data.code == 0) {
710 var title = '取消成功'; 733 var title = '取消成功';
711 th.setData({ 734 th.setData({
712 [txt1]: 0, 735 [txt1]: 0,
@@ -721,7 +744,7 @@ Page({ @@ -721,7 +744,7 @@ Page({
721 } 744 }
722 } 745 }
723 }) 746 })
724 - }else { 747 + } else {
725 var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id; 748 var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id;
726 getApp().request.delete(url, { 749 getApp().request.delete(url, {
727 success: function (res) { 750 success: function (res) {
@@ -736,7 +759,7 @@ Page({ @@ -736,7 +759,7 @@ Page({
736 title: title, 759 title: title,
737 icon: 'success', 760 icon: 'success',
738 }); 761 });
739 - th.re_sum_price();//重新统计数量和总金额 762 + th.re_sum_price(); //重新统计数量和总金额
740 } 763 }
741 } 764 }
742 }); 765 });
@@ -911,11 +934,11 @@ Page({ @@ -911,11 +934,11 @@ Page({
911 //-- 加入购物的函数 -- 934 //-- 加入购物的函数 --
912 add_cart_func: function () { 935 add_cart_func: function () {
913 if (oo.user_id == null) { 936 if (oo.user_id == null) {
914 - this.data.changing=0; 937 + this.data.changing = 0;
915 return getApp().my_warnning("还未登录!", 0, this); 938 return getApp().my_warnning("还未登录!", 0, this);
916 } 939 }
917 if (!getApp().globalData.userInfo) { 940 if (!getApp().globalData.userInfo) {
918 - this.data.changing=0; 941 + this.data.changing = 0;
919 return getApp().my_warnning("还未登录!", 0, this); 942 return getApp().my_warnning("还未登录!", 0, this);
920 } 943 }
921 944
@@ -933,16 +956,16 @@ Page({ @@ -933,16 +956,16 @@ Page({
933 title: '提示', 956 title: '提示',
934 content: '超出商品限购' 957 content: '超出商品限购'
935 }); 958 });
936 - th.data.changing=0; 959 + th.data.changing = 0;
937 return false; 960 return false;
938 } 961 }
939 - if(th.data.s_cart_num){ 962 + if (th.data.s_cart_num) {
940 if (th.data.s_cart_num + th.data.g_buy_num.get(th.data.sele_g.goods_id).gd_buynum > th.data.sele_g.viplimited) { 963 if (th.data.s_cart_num + th.data.g_buy_num.get(th.data.sele_g.goods_id).gd_buynum > th.data.sele_g.viplimited) {
941 wx.showModal({ 964 wx.showModal({
942 title: '提示', 965 title: '提示',
943 content: '超出商品限购' 966 content: '超出商品限购'
944 }); 967 });
945 - th.data.changing=0; 968 + th.data.changing = 0;
946 return false; 969 return false;
947 } 970 }
948 } 971 }
@@ -950,25 +973,27 @@ Page({ @@ -950,25 +973,27 @@ Page({
950 } 973 }
951 //---判断商品是否超出活动限购--- 974 //---判断商品是否超出活动限购---
952 if (th.data.sele_g.buyqty > 0) { 975 if (th.data.sele_g.buyqty > 0) {
953 - if (th.data.goodsInputNum+ th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.buyqty) { 976 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.buyqty) {
954 wx.showModal({ 977 wx.showModal({
955 title: '提示', 978 title: '提示',
956 content: '超出商品活动限购' 979 content: '超出商品活动限购'
957 }); 980 });
958 - th.data.changing=0; 981 + th.data.changing = 0;
959 return false; 982 return false;
960 } 983 }
961 } 984 }
962 985
963 - if (th.data.goodsInputNum <= 0){  
964 - this.data.changing=0;return s.my_warnning("商品数量不能为0", 0, th); 986 + if (th.data.goodsInputNum <= 0) {
  987 + this.data.changing = 0;
  988 + return s.my_warnning("商品数量不能为0", 0, th);
965 } 989 }
966 if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) 990 if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
967 this.setData({ 991 this.setData({
968 sto_sele_name: "" 992 sto_sele_name: ""
969 }); 993 });
970 if (th.data.sto_sele_name == "") { 994 if (th.data.sto_sele_name == "") {
971 - th.data.changing=0;return s.my_warnning("请选择门店", 0, th); 995 + th.data.changing = 0;
  996 + return s.my_warnning("请选择门店", 0, th);
972 } 997 }
973 998
974 //--------------此时操作的数据------------ 999 //--------------此时操作的数据------------
@@ -984,8 +1009,8 @@ Page({ @@ -984,8 +1009,8 @@ Page({
984 goods_sn: o.goods_sn, 1009 goods_sn: o.goods_sn,
985 }; 1010 };
986 1011
987 - if(th.data.s_cart_num){  
988 - newd.goods_num=th.data.s_cart_num; 1012 + if (th.data.s_cart_num) {
  1013 + newd.goods_num = th.data.s_cart_num;
989 } 1014 }
990 1015
991 //---是不是从收藏夹出来的--- 1016 //---是不是从收藏夹出来的---
@@ -1010,19 +1035,21 @@ Page({ @@ -1010,19 +1035,21 @@ Page({
1010 if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id; 1035 if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
1011 } 1036 }
1012 1037
1013 - if (o.store_count <= 0){  
1014 - th.data.changing=0;return getApp().my_warnning("库存已为空!", 0, th); 1038 + if (o.store_count <= 0) {
  1039 + th.data.changing = 0;
  1040 + return getApp().my_warnning("库存已为空!", 0, th);
1015 } 1041 }
1016 - if (o.store_count < e.data.goodsInputNum){  
1017 - th.data.changing=0;return getApp().my_warnning("库存不足!", 0, th); 1042 + if (o.store_count < e.data.goodsInputNum) {
  1043 + th.data.changing = 0;
  1044 + return getApp().my_warnning("库存不足!", 0, th);
1018 } 1045 }
1019 - th.add_cart_next(o, newd); //加入购物车下一步 1046 + th.add_cart_next(o, newd); //加入购物车下一步
1020 1047
1021 }) 1048 })
1022 }, 1049 },
1023 1050
1024 //---加入购物车的最后一步--- 1051 //---加入购物车的最后一步---
1025 - add_cart_next(o, newd){ 1052 + add_cart_next(o, newd) {
1026 var th = this; 1053 var th = this;
1027 //如果会员有等级价 1054 //如果会员有等级价
1028 if (th.data.card_field) { 1055 if (th.data.card_field) {
@@ -1052,12 +1079,12 @@ Page({ @@ -1052,12 +1079,12 @@ Page({
1052 th.data.adding = 0; 1079 th.data.adding = 0;
1053 return getApp().my_warnning("库存不足!", 0, th); 1080 return getApp().my_warnning("库存不足!", 0, th);
1054 } 1081 }
1055 - if (th.data.goodsInputNum+ th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > o.buyqty && o.buyqty>0) { 1082 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > o.buyqty && o.buyqty > 0) {
1056 th.data.adding = 0; 1083 th.data.adding = 0;
1057 return getApp().my_warnning("超出商品活动限购!", 0, th); 1084 return getApp().my_warnning("超出商品活动限购!", 0, th);
1058 } 1085 }
1059 - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.viplimited  
1060 - && th.data.sele_g.viplimited > 0 1086 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.viplimited &&
  1087 + th.data.sele_g.viplimited > 0
1061 ) { 1088 ) {
1062 th.data.adding = 0; 1089 th.data.adding = 0;
1063 return getApp().my_warnning("超出商品限购!", 0, th); 1090 return getApp().my_warnning("超出商品限购!", 0, th);
@@ -1071,13 +1098,13 @@ Page({ @@ -1071,13 +1098,13 @@ Page({
1071 member_goods_price: newd.goods_price, 1098 member_goods_price: newd.goods_price,
1072 store_id: os.stoid, 1099 store_id: os.stoid,
1073 }; 1100 };
1074 - if(th.data.s_cart_num){  
1075 - updata.goods_num=th.data.s_cart_num; 1101 + if (th.data.s_cart_num) {
  1102 + updata.goods_num = th.data.s_cart_num;
1076 } 1103 }
1077 //---是不是从收藏夹出来的--- 1104 //---是不是从收藏夹出来的---
1078 if (th.data.c_guide_id) { 1105 if (th.data.c_guide_id) {
1079 updata['guide_id'] = th.data.c_guide_id; 1106 updata['guide_id'] = th.data.c_guide_id;
1080 - updata['guide_type'] = 3; //加入购物车之后就变成了3 1107 + updata['guide_type'] = 3; //加入购物车之后就变成了3
1081 } else { 1108 } else {
1082 if (getApp().globalData.guide_id) { 1109 if (getApp().globalData.guide_id) {
1083 updata['guide_id'] = getApp().globalData.guide_id; 1110 updata['guide_id'] = getApp().globalData.guide_id;
@@ -1096,12 +1123,14 @@ Page({ @@ -1096,12 +1123,14 @@ Page({
1096 th.data.adding = 0; 1123 th.data.adding = 0;
1097 th.data.sele_store = 1; 1124 th.data.sele_store = 1;
1098 1125
1099 - if(th.data.s_cart_num){ 1126 + if (th.data.s_cart_num) {
1100 var txt_temp = "list[" + index + "].cart_num"; 1127 var txt_temp = "list[" + index + "].cart_num";
1101 - th.setData({[txt_temp]:th.data.s_cart_num}) 1128 + th.setData({
  1129 + [txt_temp]: th.data.s_cart_num
  1130 + })
1102 } 1131 }
1103 1132
1104 - th.re_sum_price();//重新统计数量和总金额 1133 + th.re_sum_price(); //重新统计数量和总金额
1105 } 1134 }
1106 }); 1135 });
1107 } else { 1136 } else {
@@ -1121,7 +1150,7 @@ Page({ @@ -1121,7 +1150,7 @@ Page({
1121 1150
1122 th.data.adding = 0; 1151 th.data.adding = 0;
1123 th.data.sele_store = 1; 1152 th.data.sele_store = 1;
1124 - th.re_sum_price();//重新统计数量和总金额 1153 + th.re_sum_price(); //重新统计数量和总金额
1125 } 1154 }
1126 } 1155 }
1127 }); 1156 });
@@ -1182,14 +1211,17 @@ Page({ @@ -1182,14 +1211,17 @@ Page({
1182 list.push(plusCard[i]); 1211 list.push(plusCard[i]);
1183 } 1212 }
1184 1213
1185 - var ob = {"card_list": list, "name_map": card_name_map}; 1214 + var ob = {
  1215 + "card_list": list,
  1216 + "name_map": card_name_map
  1217 + };
1186 func(ob); 1218 func(ob);
1187 }) 1219 })
1188 }, 1220 },
1189 1221
1190 1222
1191 //--- 设置一下默认库存的数量 ---- 1223 //--- 设置一下默认库存的数量 ----
1192 - set_def_storage(ee){ 1224 + set_def_storage(ee) {
1193 var that = this; 1225 var that = this;
1194 that.data.fir_def_store = ee; 1226 that.data.fir_def_store = ee;
1195 that.setData({ 1227 that.setData({
@@ -1206,8 +1238,8 @@ Page({ @@ -1206,8 +1238,8 @@ Page({
1206 this.waitfor2(15, 'is_get_local_ok', function () { 1238 this.waitfor2(15, 'is_get_local_ok', function () {
1207 //if (!th.data.sele_g) return false; 1239 //if (!th.data.sele_g) return false;
1208 var dd = null; 1240 var dd = null;
1209 - var g_distr_type =0;  
1210 - if(th.data.sele_g) g_distr_type=th.data.sele_g.distr_type; 1241 + var g_distr_type = 0;
  1242 + if (th.data.sele_g) g_distr_type = th.data.sele_g.distr_type;
1211 if (g_distr_type != 0) { 1243 if (g_distr_type != 0) {
1212 dd = { 1244 dd = {
1213 store_id: os.stoid, 1245 store_id: os.stoid,
@@ -1233,7 +1265,9 @@ Page({ @@ -1233,7 +1265,9 @@ Page({
1233 1265
1234 //如果会员是有默认的门店话 1266 //如果会员是有默认的门店话
1235 if (!th.data.def_pick_store && th.data.fir_def_store) { 1267 if (!th.data.def_pick_store && th.data.fir_def_store) {
1236 - th.setData({def_pick_store: th.data.fir_def_store}); 1268 + th.setData({
  1269 + def_pick_store: th.data.fir_def_store
  1270 + });
1237 } 1271 }
1238 1272
1239 wx.showLoading({ 1273 wx.showLoading({
@@ -1246,14 +1280,15 @@ Page({ @@ -1246,14 +1280,15 @@ Page({
1246 var e = res; 1280 var e = res;
1247 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { 1281 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
1248 1282
1249 - var his_cate_num=0;  
1250 - for(let i in e.data.data.pageData){  
1251 - let item=e.data.data.pageData[i];  
1252 - if(item.category_id>0){  
1253 - his_cate_num=1;break; 1283 + var his_cate_num = 0;
  1284 + for (let i in e.data.data.pageData) {
  1285 + let item = e.data.data.pageData[i];
  1286 + if (item.category_id > 0) {
  1287 + his_cate_num = 1;
  1288 + break;
1254 } 1289 }
1255 } 1290 }
1256 - e.his_cate_num=his_cate_num; 1291 + e.his_cate_num = his_cate_num;
1257 1292
1258 //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 1293 //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
1259 if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { 1294 if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
@@ -1277,14 +1312,16 @@ Page({ @@ -1277,14 +1312,16 @@ Page({
1277 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 1312 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
1278 } 1313 }
1279 1314
1280 - th.setData({all_pick_list: e.data.data.pageData}); 1315 + th.setData({
  1316 + all_pick_list: e.data.data.pageData
  1317 + });
1281 th.deal_pickup(e); 1318 th.deal_pickup(e);
1282 } 1319 }
1283 }) 1320 })
1284 }) 1321 })
1285 }, 1322 },
1286 //------------处理门店--------------- 1323 //------------处理门店---------------
1287 - deal_pickup(e){ 1324 + deal_pickup(e) {
1288 var th = this; 1325 var th = this;
1289 wx.hideLoading(); 1326 wx.hideLoading();
1290 //单总量超出5个的时候 1327 //单总量超出5个的时候
@@ -1299,12 +1336,13 @@ Page({ @@ -1299,12 +1336,13 @@ Page({
1299 success: function (ee) { 1336 success: function (ee) {
1300 if (ee.data.code == 0) { 1337 if (ee.data.code == 0) {
1301 1338
1302 - var check_all_cate=0;  
1303 - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){  
1304 - for(let i in ee.data.data.pageData){  
1305 - let item=ee.data.data.pageData[i];  
1306 - if(item.is_show==1){  
1307 - check_all_cate=1;break 1339 + var check_all_cate = 0;
  1340 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  1341 + for (let i in ee.data.data.pageData) {
  1342 + let item = ee.data.data.pageData[i];
  1343 + if (item.is_show == 1) {
  1344 + check_all_cate = 1;
  1345 + break
1308 } 1346 }
1309 } 1347 }
1310 } 1348 }
@@ -1316,12 +1354,14 @@ Page({ @@ -1316,12 +1354,14 @@ Page({
1316 var newarr = new Array(); 1354 var newarr = new Array();
1317 var qita = new Array(); 1355 var qita = new Array();
1318 1356
1319 - var is_del_pk=0; 1357 + var is_del_pk = 0;
1320 //----要进行门店分组-------- 1358 //----要进行门店分组--------
1321 for (var i = 0; i < sto_arr.length; i++) { 1359 for (var i = 0; i < sto_arr.length; i++) {
1322 //找一下这个门店有没有在分类数组内 1360 //找一下这个门店有没有在分类数组内
1323 - var find2 = 0, find2name = "", sort = 0;  
1324 - is_del_pk=0; 1361 + var find2 = 0,
  1362 + find2name = "",
  1363 + sort = 0;
  1364 + is_del_pk = 0;
1325 for (var m = 0; m < sto_cate.length; m++) { 1365 for (var m = 0; m < sto_cate.length; m++) {
1326 if (sto_arr[i].category_id == sto_cate[m].cat_id) { 1366 if (sto_arr[i].category_id == sto_cate[m].cat_id) {
1327 if (sto_cate[m].is_show != 1) { 1367 if (sto_cate[m].is_show != 1) {
@@ -1337,7 +1377,7 @@ Page({ @@ -1337,7 +1377,7 @@ Page({
1337 break; 1377 break;
1338 } 1378 }
1339 } 1379 }
1340 - if(is_del_pk) continue; 1380 + if (is_del_pk) continue;
1341 1381
1342 if (newarr.length > 0) { 1382 if (newarr.length > 0) {
1343 var find = 0; 1383 var find = 0;
@@ -1416,13 +1456,13 @@ Page({ @@ -1416,13 +1456,13 @@ Page({
1416 } 1456 }
1417 1457
1418 1458
1419 - var sd={ 1459 + var sd = {
1420 all_sto: newarr, 1460 all_sto: newarr,
1421 - is_show_sto_cat:1 1461 + is_show_sto_cat: 1
1422 } 1462 }
1423 - if(!sto_arr || sto_arr.length<=10){  
1424 - sd.is_show_sto_cat=-1;  
1425 - sd.only_pk=sto_arr; 1463 + if (!sto_arr || sto_arr.length <= 10) {
  1464 + sd.is_show_sto_cat = -1;
  1465 + sd.only_pk = sto_arr;
1426 } 1466 }
1427 th.setData(sd); 1467 th.setData(sd);
1428 1468
@@ -1433,7 +1473,9 @@ Page({ @@ -1433,7 +1473,9 @@ Page({
1433 }); 1473 });
1434 //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ 1474 //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
1435 if (!th.data.def_pick_store) { 1475 if (!th.data.def_pick_store) {
1436 - th.setData({def_pick_store: e.data.data.pageData[0]}) 1476 + th.setData({
  1477 + def_pick_store: e.data.data.pageData[0]
  1478 + })
1437 } 1479 }
1438 } 1480 }
1439 } else { 1481 } else {
@@ -1443,7 +1485,9 @@ Page({ @@ -1443,7 +1485,9 @@ Page({
1443 }); 1485 });
1444 //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ 1486 //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
1445 if (!th.data.def_pick_store) { 1487 if (!th.data.def_pick_store) {
1446 - th.setData({def_pick_store: e.data.data.pageData[0]}) 1488 + th.setData({
  1489 + def_pick_store: e.data.data.pageData[0]
  1490 + })
1447 } 1491 }
1448 } 1492 }
1449 } 1493 }
@@ -1508,7 +1552,7 @@ Page({ @@ -1508,7 +1552,7 @@ Page({
1508 } 1552 }
1509 1553
1510 //判断门店的配送方式是不是匹配 1554 //判断门店的配送方式是不是匹配
1511 - var g_distr_type=0; 1555 + var g_distr_type = 0;
1512 if (th.data.sele_g) 1556 if (th.data.sele_g)
1513 g_distr_type = th.data.sele_g.distr_type; 1557 g_distr_type = th.data.sele_g.distr_type;
1514 if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { 1558 if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
@@ -1609,7 +1653,7 @@ Page({ @@ -1609,7 +1653,7 @@ Page({
1609 sto_sele_distr: item.distr_type, 1653 sto_sele_distr: item.distr_type,
1610 store: 0, 1654 store: 0,
1611 choice_sort_store: 0, 1655 choice_sort_store: 0,
1612 - sort_store: 0, //关闭门店2级 1656 + sort_store: 0, //关闭门店2级
1613 }); 1657 });
1614 1658
1615 th.add_cart_func(); 1659 th.add_cart_func();
@@ -1643,7 +1687,8 @@ Page({ @@ -1643,7 +1687,8 @@ Page({
1643 //-------------获取购买数量的总函数---------------- 1687 //-------------获取购买数量的总函数----------------
1644 get_buy_num: function (gd, func) { 1688 get_buy_num: function (gd, func) {
1645 var map = this.data.g_buy_num, 1689 var map = this.data.g_buy_num,
1646 - th = this, user_id = getApp().globalData.user_id; 1690 + th = this,
  1691 + user_id = getApp().globalData.user_id;
1647 1692
1648 if (user_id == null) { 1693 if (user_id == null) {
1649 getApp().goto("/pages/togoin/togoin"); 1694 getApp().goto("/pages/togoin/togoin");
@@ -1652,7 +1697,7 @@ Page({ @@ -1652,7 +1697,7 @@ Page({
1652 if (map && map.has(gd.goods_id)) { 1697 if (map && map.has(gd.goods_id)) {
1653 "function" == typeof func && func(); 1698 "function" == typeof func && func();
1654 } else { 1699 } else {
1655 - var res1=null; 1700 + var res1 = null;
1656 //----获取商品购买数---- 1701 //----获取商品购买数----
1657 getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 1702 getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
1658 data: { 1703 data: {
@@ -1662,9 +1707,9 @@ Page({ @@ -1662,9 +1707,9 @@ Page({
1662 prom_type: 7, 1707 prom_type: 7,
1663 prom_id: th.data.act.id 1708 prom_id: th.data.act.id
1664 }, 1709 },
1665 - }).then(res2=>{  
1666 - var g_buy_num=0;  
1667 - var promgoodsbuynum=0; 1710 + }).then(res2 => {
  1711 + var g_buy_num = 0;
  1712 + var promgoodsbuynum = 0;
1668 if (res2.data.code == 0) { 1713 if (res2.data.code == 0) {
1669 var buy_num_data = res2.data.data; 1714 var buy_num_data = res2.data.data;
1670 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; 1715 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
@@ -1672,9 +1717,9 @@ Page({ @@ -1672,9 +1717,9 @@ Page({
1672 } 1717 }
1673 1718
1674 if (!map) map = new Map(); 1719 if (!map) map = new Map();
1675 - var ob={  
1676 - gd_buynum:g_buy_num,  
1677 - prom_buybum:promgoodsbuynum, 1720 + var ob = {
  1721 + gd_buynum: g_buy_num,
  1722 + prom_buybum: promgoodsbuynum,
1678 } 1723 }
1679 map.set(gd.goods_id, ob); 1724 map.set(gd.goods_id, ob);
1680 th.setData({ 1725 th.setData({
@@ -1686,7 +1731,7 @@ Page({ @@ -1686,7 +1731,7 @@ Page({
1686 }, 1731 },
1687 1732
1688 //-- 当是减数量的调用 -- 1733 //-- 当是减数量的调用 --
1689 - sub_updata_cart(){ 1734 + sub_updata_cart() {
1690 var th = this; 1735 var th = this;
1691 var index = this.data.sele_index; 1736 var index = this.data.sele_index;
1692 var txt = "list[" + index + "].haveAdded"; 1737 var txt = "list[" + index + "].haveAdded";
@@ -1704,14 +1749,14 @@ Page({ @@ -1704,14 +1749,14 @@ Page({
1704 store_id: os.stoid, 1749 store_id: os.stoid,
1705 }; 1750 };
1706 1751
1707 - if(th.data.s_cart_num){  
1708 - updata.goods_num=th.data.s_cart_num; 1752 + if (th.data.s_cart_num) {
  1753 + updata.goods_num = th.data.s_cart_num;
1709 } 1754 }
1710 1755
1711 //---是不是从收藏夹出来的--- 1756 //---是不是从收藏夹出来的---
1712 if (th.data.c_guide_id) { 1757 if (th.data.c_guide_id) {
1713 updata['guide_id'] = th.data.c_guide_id; 1758 updata['guide_id'] = th.data.c_guide_id;
1714 - updata['guide_type'] = 3; //加入购物车之后就变成了3 1759 + updata['guide_type'] = 3; //加入购物车之后就变成了3
1715 } else { 1760 } else {
1716 if (getApp().globalData.guide_id) { 1761 if (getApp().globalData.guide_id) {
1717 updata['guide_id'] = getApp().globalData.guide_id; 1762 updata['guide_id'] = getApp().globalData.guide_id;
@@ -1729,12 +1774,14 @@ Page({ @@ -1729,12 +1774,14 @@ Page({
1729 }); 1774 });
1730 th.data.adding = 0; 1775 th.data.adding = 0;
1731 th.data.sele_store = 1; 1776 th.data.sele_store = 1;
1732 - if(th.data.s_cart_num){ 1777 + if (th.data.s_cart_num) {
1733 var txt_temp = "list[" + index + "].cart_num"; 1778 var txt_temp = "list[" + index + "].cart_num";
1734 - th.setData({[txt_temp]:th.data.s_cart_num}) 1779 + th.setData({
  1780 + [txt_temp]: th.data.s_cart_num
  1781 + })
1735 } 1782 }
1736 1783
1737 - th.re_sum_price();//重新统计数量和总金额 1784 + th.re_sum_price(); //重新统计数量和总金额
1738 } 1785 }
1739 }); 1786 });
1740 }, 1787 },
@@ -1776,24 +1823,24 @@ Page({ @@ -1776,24 +1823,24 @@ Page({
1776 success: function (re) { 1823 success: function (re) {
1777 if (re.data.data.total > 0) { 1824 if (re.data.data.total > 0) {
1778 var item = re.data.data.pageData[0]; 1825 var item = re.data.data.pageData[0];
1779 - th.get_buy_num(th.data.sele_g,function () { 1826 + th.get_buy_num(th.data.sele_g, function () {
1780 //当前的价格要更新进去 1827 //当前的价格要更新进去
1781 var cur_price = th.data.sele_g.shop_price; 1828 var cur_price = th.data.sele_g.shop_price;
1782 if (th.data.card_field && th.data.sele_g[th.data.card_field]) { 1829 if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
1783 cur_price = th.data.sele_g[th.data.card_field]; 1830 cur_price = th.data.sele_g[th.data.card_field];
1784 } 1831 }
1785 1832
1786 - var prom_buybum=0;  
1787 - var gd_buynum=0; 1833 + var prom_buybum = 0;
  1834 + var gd_buynum = 0;
1788 //加入也要控制一下限购 1835 //加入也要控制一下限购
1789 - var check_obj=th.data.g_buy_num.get(th.data.sele_g.goods_id);  
1790 - if(check_obj.gd_buynum && check_obj.gd_buynum>0) gd_buynum=check_obj.gd_buynum;  
1791 - if(check_obj.prom_buybum && check_obj.prom_buybum>0) prom_buybum=check_obj.prom_buybum;  
1792 -  
1793 - if(check_obj){  
1794 - if(check_obj.prom_buybum && check_obj.prom_buybum>=th.data.sele_g.buyqty &&  
1795 - th.data.sele_g.buyqty>0  
1796 - ){ 1836 + var check_obj = th.data.g_buy_num.get(th.data.sele_g.goods_id);
  1837 + if (check_obj.gd_buynum && check_obj.gd_buynum > 0) gd_buynum = check_obj.gd_buynum;
  1838 + if (check_obj.prom_buybum && check_obj.prom_buybum > 0) prom_buybum = check_obj.prom_buybum;
  1839 +
  1840 + if (check_obj) {
  1841 + if (check_obj.prom_buybum && check_obj.prom_buybum >= th.data.sele_g.buyqty &&
  1842 + th.data.sele_g.buyqty > 0
  1843 + ) {
1797 wx.showToast({ 1844 wx.showToast({
1798 title: "您的已购数量超出活动的限购", 1845 title: "您的已购数量超出活动的限购",
1799 icon: 'none', 1846 icon: 'none',
@@ -1801,9 +1848,9 @@ Page({ @@ -1801,9 +1848,9 @@ Page({
1801 }); 1848 });
1802 return false; 1849 return false;
1803 } 1850 }
1804 - if(check_obj.gd_buynum && check_obj.gd_buynum>=th.data.sele_g.viplimited &&  
1805 - th.data.sele_g.viplimited>0  
1806 - ){ 1851 + if (check_obj.gd_buynum && check_obj.gd_buynum >= th.data.sele_g.viplimited &&
  1852 + th.data.sele_g.viplimited > 0
  1853 + ) {
1807 wx.showToast({ 1854 wx.showToast({
1808 title: "您的已购数量超出商品的限购", 1855 title: "您的已购数量超出商品的限购",
1809 icon: 'none', 1856 icon: 'none',
@@ -1813,17 +1860,17 @@ Page({ @@ -1813,17 +1860,17 @@ Page({
1813 } 1860 }
1814 } 1861 }
1815 1862
1816 - item.cbuy='no';  
1817 - var cbuy=th.data.sele_g.viplimited>0?th.data.sele_g.viplimited-gd_buynum:'no';  
1818 - if(cbuy!='no') item.cbuy=cbuy;  
1819 - var cbuy2=th.data.sele_g.buyqty>0?th.data.sele_g.buyqty-prom_buybum:'no';  
1820 - if(cbuy2!='no'){  
1821 - if(item.cbuy=='no' || item.cbuy>cbuy2) item.cbuy=cbuy2; 1863 + item.cbuy = 'no';
  1864 + var cbuy = th.data.sele_g.viplimited > 0 ? th.data.sele_g.viplimited - gd_buynum : 'no';
  1865 + if (cbuy != 'no') item.cbuy = cbuy;
  1866 + var cbuy2 = th.data.sele_g.buyqty > 0 ? th.data.sele_g.buyqty - prom_buybum : 'no';
  1867 + if (cbuy2 != 'no') {
  1868 + if (item.cbuy == 'no' || item.cbuy > cbuy2) item.cbuy = cbuy2;
1822 } 1869 }
1823 1870
1824 - var num=item.goods_num;  
1825 - if(item.cbuy>-1 && item.cbuy<item.goods_num){  
1826 - num=item.cbuy; 1871 + var num = item.goods_num;
  1872 + if (item.cbuy > -1 && item.cbuy < item.goods_num) {
  1873 + num = item.cbuy;
1827 } 1874 }
1828 th.setData({ 1875 th.setData({
1829 [txt1]: num, 1876 [txt1]: num,
@@ -1848,11 +1895,10 @@ Page({ @@ -1848,11 +1895,10 @@ Page({
1848 1895
1849 getApp().request.put("/api/weshop/cart/update", { 1896 getApp().request.put("/api/weshop/cart/update", {
1850 data: updata, 1897 data: updata,
1851 - success: function (t) {  
1852 - } 1898 + success: function (t) {}
1853 }); 1899 });
1854 th.re_sum_price(); 1900 th.re_sum_price();
1855 - }) 1901 + })
1856 1902
1857 } else { 1903 } else {
1858 func(); 1904 func();
@@ -1863,12 +1909,12 @@ Page({ @@ -1863,12 +1909,12 @@ Page({
1863 1909
1864 //-- 计算统计之后的金额 -- 1910 //-- 计算统计之后的金额 --
1865 re_sum_price: function () { 1911 re_sum_price: function () {
1866 - var all_num = 0; //商品数量之和 1912 + var all_num = 0; //商品数量之和
1867 var all_price = 0; 1913 var all_price = 0;
1868 var need_to_buy = 0; 1914 var need_to_buy = 0;
1869 var data = this.data.list; 1915 var data = this.data.list;
1870 - var all_zhqty = 0; //所有商品要求起购数之后  
1871 - 1916 + var all_zhqty = 0; //所有商品要求起购数之后
  1917 + var zhqty_bz=[]; //超量
1872 var no_in_arr = []; 1918 var no_in_arr = [];
1873 for (var i in data) { 1919 for (var i in data) {
1874 var item = data[i]; 1920 var item = data[i];
@@ -1877,18 +1923,25 @@ Page({ @@ -1877,18 +1923,25 @@ Page({
1877 all_price += item.num * item.current_price; 1923 all_price += item.num * item.current_price;
1878 //当有起购数的控制的时候 1924 //当有起购数的控制的时候
1879 if (item.zhqty) { 1925 if (item.zhqty) {
  1926 + zhqty_bz.push(item);
1880 all_zhqty += item.zhqty; 1927 all_zhqty += item.zhqty;
1881 if (item.num < item.zhqty) { 1928 if (item.num < item.zhqty) {
1882 need_to_buy += item.zhqty - item.num; 1929 need_to_buy += item.zhqty - item.num;
1883 } 1930 }
1884 if (item.num > item.zhqty) { 1931 if (item.num > item.zhqty) {
1885 for (var i = 0; i < item.num - item.zhqty; i++) { 1932 for (var i = 0; i < item.num - item.zhqty; i++) {
1886 - no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); 1933 + no_in_arr.push({
  1934 + price: item.current_price,
  1935 + goods_id: item.goods_id
  1936 + });
1887 } 1937 }
1888 } 1938 }
1889 } else { 1939 } else {
1890 for (var j = 0; j < item.num; j++) { 1940 for (var j = 0; j < item.num; j++) {
1891 - no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); 1941 + no_in_arr.push({
  1942 + price: item.current_price,
  1943 + goods_id: item.goods_id
  1944 + });
1892 } 1945 }
1893 } 1946 }
1894 } else { 1947 } else {
@@ -1901,23 +1954,49 @@ Page({ @@ -1901,23 +1954,49 @@ Page({
1901 function sortData(a, b) { 1954 function sortData(a, b) {
1902 return a.price - b.price 1955 return a.price - b.price
1903 } 1956 }
1904 - if(no_in_arr.length) no_in_arr.sort(sortData); 1957 + if (no_in_arr.length) no_in_arr.sort(sortData);
1905 1958
1906 var aprice = this.data.act.zhprice; 1959 var aprice = this.data.act.zhprice;
1907 if (this.data.act.zhbuyqty > all_zhqty) { 1960 if (this.data.act.zhbuyqty > all_zhqty) {
1908 - for (var n = 0; n < this.data.act.zhbuyqty-all_zhqty; n++) { 1961 + for (var n = 0; n < this.data.act.zhbuyqty - all_zhqty; n++) {
1909 no_in_arr.pop(); 1962 no_in_arr.pop();
1910 } 1963 }
1911 } 1964 }
1912 1965
1913 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 1966 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
1914 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { 1967 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
1915 - //看一下是几倍 1968 + let zhqty_map=new map();
  1969 + //看一下是几倍
1916 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); 1970 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
1917 - aprice += be * aprice;  
1918 - for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {  
1919 - no_in_arr.pop(); 1971 + if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){
  1972 + for(let i=0;i<zhqty_bz.length;i++){
  1973 + let vv=zhqty_bz[i];
  1974 + let num=0;
  1975 + let bz_num=be*vv.zhqty;
  1976 + for(let j=0;j<no_in_arr.length;j++){
  1977 + let ii=no_in_arr[j];
  1978 + if(vv.goods_id===ii.goods_id){
  1979 + num++;
  1980 + zhqty_map.set('num',num);
  1981 + zhqty_map.set('price',ii.price);
  1982 + }
  1983 +
  1984 + }
  1985 + }
1920 } 1986 }
  1987 + if(bz_num <= num){
  1988 + aprice += be * aprice;
  1989 + let pop_num=(be * this.data.act.zhbuyqty)-bz_num;
  1990 + console.log(pop_num);
  1991 + for (var m = 0; m < pop_num; m++) {
  1992 + no_in_arr.pop();
  1993 + }
  1994 + }
  1995 + // var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
  1996 + // aprice += be * aprice;
  1997 + // for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {
  1998 + // no_in_arr.pop();
  1999 + // }
1921 } 2000 }
1922 2001
1923 //算一下剩余的钱 2002 //算一下剩余的钱
@@ -1929,146 +2008,148 @@ Page({ @@ -1929,146 +2008,148 @@ Page({
1929 } 2008 }
1930 all_price = aprice; 2009 all_price = aprice;
1931 } 2010 }
1932 - this.data.changing=0; 2011 + this.data.changing = 0;
1933 this.setData({ 2012 this.setData({
1934 all_price: all_price, 2013 all_price: all_price,
1935 need_to_buy: need_to_buy, 2014 need_to_buy: need_to_buy,
1936 all_num: all_num 2015 all_num: all_num
1937 }) 2016 })
1938 2017
1939 - if(all_num<=0){  
1940 - this.data.sele_store = 0; //什么都没有选,就没有选择了门店 2018 + if (all_num <= 0) {
  2019 + this.data.sele_store = 0; //什么都没有选,就没有选择了门店
1941 } 2020 }
1942 2021
1943 }, 2022 },
1944 2023
1945 - go_cart:function () { 2024 + go_cart: function () {
1946 getApp().goto("/pages/cart/cart/cart"); 2025 getApp().goto("/pages/cart/cart/cart");
1947 }, 2026 },
1948 2027
1949 //获取购物车中,相应的门店已购买的商品 2028 //获取购物车中,相应的门店已购买的商品
1950 - get_cart_val:function (e) {  
1951 - var th=this;  
1952 - var user_id=getApp().globalData.user_id;  
1953 - var req={  
1954 - user_id: user_id,  
1955 - store_id: os.stoid,  
1956 - pageSize: 600,  
1957 - state:0,  
1958 - prom_type:7,  
1959 - prom_id:this.data.act.id 2029 + get_cart_val: function (e) {
  2030 + var th = this;
  2031 + var user_id = getApp().globalData.user_id;
  2032 + var req = {
  2033 + user_id: user_id,
  2034 + store_id: os.stoid,
  2035 + pageSize: 600,
  2036 + state: 0,
  2037 + prom_type: 7,
  2038 + prom_id: this.data.act.id
1960 }; 2039 };
1961 //获取购物车列表 2040 //获取购物车列表
1962 - getApp().request.get("/api/weshop/cart/list",{  
1963 - data:req,  
1964 - success: async function(e) { 2041 + getApp().request.get("/api/weshop/cart/list", {
  2042 + data: req,
  2043 + success: async function (e) {
1965 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) { 2044 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) {
1966 - var map={};  
1967 - var mlist=e.data.data.pageData;  
1968 - th.data.cart_list=mlist;  
1969 -  
1970 - for(let i in mlist){  
1971 - let item=mlist[i];  
1972 - if(item.prom_type!=7) continue;  
1973 - if(item.prom_id!=th.data.act.id) continue;  
1974 - map[item.goods_id]=item; 2045 + var map = {};
  2046 + var mlist = e.data.data.pageData;
  2047 + th.data.cart_list = mlist;
  2048 +
  2049 + for (let i in mlist) {
  2050 + let item = mlist[i];
  2051 + if (item.prom_type != 7) continue;
  2052 + if (item.prom_id != th.data.act.id) continue;
  2053 + map[item.goods_id] = item;
1975 } 2054 }
1976 - for(let j in th.data.list){  
1977 - let item_j=th.data.list[j];  
1978 - item_j.current_price=item_j.shop_price; 2055 + for (let j in th.data.list) {
  2056 + let item_j = th.data.list[j];
  2057 + item_j.current_price = item_j.shop_price;
1979 2058
1980 - var card_price=0; 2059 + var card_price = 0;
1981 //如果会员有等级价 2060 //如果会员有等级价
1982 if (th.data.card_field) { 2061 if (th.data.card_field) {
1983 card_price = item_j[th.data.card_field]; 2062 card_price = item_j[th.data.card_field];
1984 if (card_price > 0) { 2063 if (card_price > 0) {
1985 - item_j.current_price=card_price; 2064 + item_j.current_price = card_price;
1986 } 2065 }
1987 } 2066 }
1988 2067
1989 2068
1990 - if(map[item_j.goods_id]){  
1991 - var cart_num=map[item_j.goods_id].goods_num;  
1992 - item_j.num=cart_num;  
1993 - item_j.cart_num=cart_num;  
1994 - item_j.cart_id=map[item_j.goods_id].id;  
1995 - if(item_j.buyqty>0){  
1996 - var g_buy_num=0;  
1997 - var promgoodsbuynum=0;  
1998 - //----获取商品购买数----  
1999 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
2000 - data: {  
2001 - store_id: os.stoid,  
2002 - user_id: user_id,  
2003 - goods_id: item_j.goods_id,  
2004 - prom_type: 7,  
2005 - prom_id: th.data.act.id  
2006 - },  
2007 - }).then(res2=>{  
2008 - if (res2.data.code == 0) {  
2009 - var buy_num_data = res2.data.data;  
2010 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
2011 - g_buy_num = buy_num_data.goodsbuynum;  
2012 - }  
2013 - })  
2014 -  
2015 - if(item_j.viplimited>0){  
2016 - var cby=item_j.viplimited-g_buy_num;  
2017 - if(cby<=0) continue;//不能买就continue下一个  
2018 - item_j.num=cby>item_j.num?item_j.num:cby;  
2019 - }  
2020 - if(item_j.buyqty>0){  
2021 - var cby=item_j.buyqty-promgoodsbuynum;  
2022 - if(cby<=0) continue;//不能买就continue下一个  
2023 - item_j.num=cby>item_j.num?item_j.num:cby;  
2024 - }  
2025 - }  
2026 -  
2027 - item_j.haveAdded=1;  
2028 - item_j.showNum=true; 2069 + if (map[item_j.goods_id]) {
  2070 + var cart_num = map[item_j.goods_id].goods_num;
  2071 + item_j.num = cart_num;
  2072 + item_j.cart_num = cart_num;
  2073 + item_j.cart_id = map[item_j.goods_id].id;
  2074 + if (item_j.buyqty > 0) {
  2075 + var g_buy_num = 0;
  2076 + var promgoodsbuynum = 0;
  2077 + //----获取商品购买数----
  2078 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  2079 + data: {
  2080 + store_id: os.stoid,
  2081 + user_id: user_id,
  2082 + goods_id: item_j.goods_id,
  2083 + prom_type: 7,
  2084 + prom_id: th.data.act.id
  2085 + },
  2086 + }).then(res2 => {
  2087 + if (res2.data.code == 0) {
  2088 + var buy_num_data = res2.data.data;
  2089 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  2090 + g_buy_num = buy_num_data.goodsbuynum;
  2091 + }
  2092 + })
  2093 +
  2094 + if (item_j.viplimited > 0) {
  2095 + var cby = item_j.viplimited - g_buy_num;
  2096 + if (cby <= 0) continue; //不能买就continue下一个
  2097 + item_j.num = cby > item_j.num ? item_j.num : cby;
  2098 + }
  2099 + if (item_j.buyqty > 0) {
  2100 + var cby = item_j.buyqty - promgoodsbuynum;
  2101 + if (cby <= 0) continue; //不能买就continue下一个
  2102 + item_j.num = cby > item_j.num ? item_j.num : cby;
  2103 + }
  2104 + }
  2105 +
  2106 + item_j.haveAdded = 1;
  2107 + item_j.showNum = true;
2029 } 2108 }
2030 } 2109 }
2031 - th.setData({list:th.data.list}); 2110 + th.setData({
  2111 + list: th.data.list
  2112 + });
2032 th.re_sum_price(); 2113 th.re_sum_price();
2033 } 2114 }
2034 - }  
2035 - }); 2115 + }
  2116 + });
2036 }, 2117 },
2037 2118
2038 //滚动加载跟多的时候的计算 2119 //滚动加载跟多的时候的计算
2039 - async calc_more(list,func){  
2040 - var th=this;  
2041 - var map={};  
2042 - var mlist=this.data.cart_list;  
2043 - for(let i in mlist){  
2044 - let item=mlist[i];  
2045 - if(item.prom_type!=7) continue;  
2046 - if(item.prom_id!=th.data.act.id) continue;  
2047 - map[item.goods_id]=item; 2120 + async calc_more(list, func) {
  2121 + var th = this;
  2122 + var map = {};
  2123 + var mlist = this.data.cart_list;
  2124 + for (let i in mlist) {
  2125 + let item = mlist[i];
  2126 + if (item.prom_type != 7) continue;
  2127 + if (item.prom_id != th.data.act.id) continue;
  2128 + map[item.goods_id] = item;
2048 } 2129 }
2049 2130
2050 - for(let j in list){  
2051 - let item_j=list[j];  
2052 - item_j.current_price=item_j.shop_price; 2131 + for (let j in list) {
  2132 + let item_j = list[j];
  2133 + item_j.current_price = item_j.shop_price;
2053 2134
2054 - var card_price=0; 2135 + var card_price = 0;
2055 //如果会员有等级价 2136 //如果会员有等级价
2056 if (th.data.card_field) { 2137 if (th.data.card_field) {
2057 card_price = item_j[th.data.card_field]; 2138 card_price = item_j[th.data.card_field];
2058 if (card_price > 0) { 2139 if (card_price > 0) {
2059 - item_j.current_price=card_price; 2140 + item_j.current_price = card_price;
2060 } 2141 }
2061 } 2142 }
2062 2143
2063 2144
2064 - if(map[item_j.goods_id]){  
2065 - var cart_num=map[item_j.goods_id].goods_num;  
2066 - item_j.num=cart_num;  
2067 - item_j.cart_num=cart_num;  
2068 - item_j.cart_id=map[item_j.goods_id].id;  
2069 - if(item_j.buyqty>0){  
2070 - var g_buy_num=0;  
2071 - var promgoodsbuynum=0; 2145 + if (map[item_j.goods_id]) {
  2146 + var cart_num = map[item_j.goods_id].goods_num;
  2147 + item_j.num = cart_num;
  2148 + item_j.cart_num = cart_num;
  2149 + item_j.cart_id = map[item_j.goods_id].id;
  2150 + if (item_j.buyqty > 0) {
  2151 + var g_buy_num = 0;
  2152 + var promgoodsbuynum = 0;
2072 //----获取商品购买数---- 2153 //----获取商品购买数----
2073 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 2154 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
2074 data: { 2155 data: {
@@ -2078,7 +2159,7 @@ Page({ @@ -2078,7 +2159,7 @@ Page({
2078 prom_type: 7, 2159 prom_type: 7,
2079 prom_id: th.data.act.id 2160 prom_id: th.data.act.id
2080 }, 2161 },
2081 - }).then(res2=>{ 2162 + }).then(res2 => {
2082 if (res2.data.code == 0) { 2163 if (res2.data.code == 0) {
2083 var buy_num_data = res2.data.data; 2164 var buy_num_data = res2.data.data;
2084 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; 2165 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
@@ -2086,23 +2167,23 @@ Page({ @@ -2086,23 +2167,23 @@ Page({
2086 } 2167 }
2087 }) 2168 })
2088 2169
2089 - if(item_j.viplimited>0){  
2090 - var cby=item_j.viplimited-g_buy_num;  
2091 - if(cby<=0) continue;//不能买就continue下一个  
2092 - item_j.num=cby>item_j.num?item_j.num:cby; 2170 + if (item_j.viplimited > 0) {
  2171 + var cby = item_j.viplimited - g_buy_num;
  2172 + if (cby <= 0) continue; //不能买就continue下一个
  2173 + item_j.num = cby > item_j.num ? item_j.num : cby;
2093 } 2174 }
2094 - if(item_j.buyqty>0){  
2095 - var cby=item_j.buyqty-promgoodsbuynum;  
2096 - if(cby<=0) continue;//不能买就continue下一个  
2097 - item_j.num=cby>item_j.num?item_j.num:cby; 2175 + if (item_j.buyqty > 0) {
  2176 + var cby = item_j.buyqty - promgoodsbuynum;
  2177 + if (cby <= 0) continue; //不能买就continue下一个
  2178 + item_j.num = cby > item_j.num ? item_j.num : cby;
2098 } 2179 }
2099 } 2180 }
2100 2181
2101 - item_j.haveAdded=1;  
2102 - item_j.showNum=true; 2182 + item_j.haveAdded = 1;
  2183 + item_j.showNum = true;
2103 } 2184 }
2104 } 2185 }
2105 - if(func) func(list) 2186 + if (func) func(list)
2106 2187
2107 } 2188 }
2108 2189
packageB/pages/zuhegou/list/list.wxml
@@ -23,19 +23,15 @@ @@ -23,19 +23,15 @@
23 23
24 </block> 24 </block>
25 </swiper> 25 </swiper>
26 -  
27 26
28 </block> 27 </block>
29 <block wx:else> 28 <block wx:else>
30 <image class="xc-top-img" src="{{url}}/miniapp/images/seckill_top_img.jpg"></image> 29 <image class="xc-top-img" src="{{url}}/miniapp/images/seckill_top_img.jpg"></image>
31 </block> 30 </block>
32 31
33 -  
34 -  
35 <view class="kill-list"> 32 <view class="kill-list">
36 <view class="kill-item" wx:for="{{goodlist}}"> 33 <view class="kill-item" wx:for="{{goodlist}}">
37 <navigator class="kill-pic rel" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none"> 34 <navigator class="kill-pic rel" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none">
38 - <!-- <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> -->  
39 <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}" 35 <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}"
40 data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image> 36 data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image>
41 </navigator> 37 </navigator>
@@ -47,78 +43,16 @@ @@ -47,78 +43,16 @@
47 <view> 43 <view>
48 <view>组合数量: {{item.zhbuyqty}}</view> 44 <view>组合数量: {{item.zhbuyqty}}</view>
49 <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view> 45 <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view>
50 - <!-- <view class="{{type==1?'xc-wc':'blue_c'}}">  
51 - <text>剩余:</text>  
52 - <text class='tui-conutdown-box'> {{item.djs.day}}</text>天  
53 - <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时  
54 - <text class='tui-conutdown-box'>{{item.djs.min}}</text>分  
55 - <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒  
56 - </view> -->  
57 <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > 46 <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" >
58 <view class="fs28" style="line-height: 16px;">¥</view> 47 <view class="fs28" style="line-height: 16px;">¥</view>
59 <text>{{item.zhprice}}</text> 48 <text>{{item.zhprice}}</text>
60 - <!-- <span class="underline fs20">零售价¥{{item.market_price}}</span> -->  
61 </view> 49 </view>
62 -  
63 </view> 50 </view>
64 - <!-- <view class="kill-btn "> -->  
65 - <!-- <navigator style="background-color: #059de5;" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{type==0}}" >即将开始</navigator> -->  
66 - <!-- <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{item.status==1 && type==1}}">马上抢</navigator>  
67 - <navigator class="huise"url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{item.status==3 && type==1}}">已抢光</navigator> -->  
68 - <!-- </view> -->  
69 </view> 51 </view>
70 -  
71 -  
72 </navigator> 52 </navigator>
73 -  
74 - <!-- <view class="flex-vertical xc-strip-frame">  
75 - <view class="xc-strip-blank rel">  
76 -  
77 - <view class="flex-vertical rel total">  
78 - <view class="t-c abs xc-fill"style="width:{{type==1?(100-(item.buy_num+item.virtual) /(item.goods_num+item.virtual)*100)>3?(100-(item.buy_num+item.virtual) /(item.goods_num+item.virtual)*100):'3':'100'}}%;background:{{type==1?'#e4374d':'#059de5'}};">  
79 - </view>  
80 - <text class="fs20 white abs xc-fill-text" style="">剩余{{type==1?filters.toFix(100-(item.buy_num+item.virtual)/(item.goods_num+item.virtual)*100,0):'100'}}%</text>  
81 - </view>  
82 -  
83 - </view>  
84 - <view class=" ml10 fs20 " wx:if="{{type==1}}"> 已抢{{item.buy_num+item.virtual}}件</view>  
85 - <view class=" ml10 fs20 " wx:else> 已抢0件</view>  
86 -  
87 - </view> -->  
88 -  
89 -  
90 - <!-- <view class="goods-num">  
91 - <view>  
92 - <view>组合数量: {{item.zhbuyqty}}</view>  
93 - <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view>  
94 -  
95 - <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" >  
96 - <view class="fs28" style="line-height: 16px;">¥</view>  
97 - <text>{{item.zhprice}}</text>  
98 -  
99 - </view>  
100 -  
101 - </view>  
102 - </view> -->  
103 </view> 53 </view>
104 </view> 54 </view>
105 - <!-- <view style="height:120rpx"></view> -->  
106 </view> 55 </view>
107 -  
108 -<!-- <view class="kill-time xc-seckill-bottom">  
109 - <view class="theader" >  
110 - <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}">  
111 - <image class="xc-bottom"  
112 - src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image>  
113 - 火热进行中</view>  
114 - <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}">  
115 - <image class="xc-bottom"  
116 - src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image>  
117 - 即将开始</view>  
118 - </view>  
119 -</view> -->  
120 -  
121 -  
122 <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> 56 <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view>
123 </view> 57 </view>
124 58
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1272,9 +1272,10 @@ Page({ @@ -1272,9 +1272,10 @@ Page({
1272 var all_cutprice = 0; //所有的优惠减 1272 var all_cutprice = 0; //所有的优惠减
1273 var all_zh_cutprice = 0; //所有的组合优惠减 1273 var all_zh_cutprice = 0; //所有的组合优惠减
1274 var all_order_prom = 0; //所有的订单优惠 1274 var all_order_prom = 0; //所有的订单优惠
1275 - 1275 + var out_of_weight=0; //超出多少重量
1276 var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); 1276 var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0);
1277 var freight_free = ee.freight_free; //全场满多少包邮 1277 var freight_free = ee.freight_free; //全场满多少包邮
  1278 + var weight_free = ee.weight_free; //多少kg内包邮
1278 var no_ex_id = ee.no_ex_id; 1279 var no_ex_id = ee.no_ex_id;
1279 var no_ex_good = null; 1280 var no_ex_good = null;
1280 var by_qc = {}; 1281 var by_qc = {};
@@ -1371,6 +1372,16 @@ Page({ @@ -1371,6 +1372,16 @@ Page({
1371 o_price_no_zh += item[j].goods_price * item[j].goods_num; 1372 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1372 } 1373 }
1373 o_price += item[j].goods_price * item[j].goods_num; 1374 o_price += item[j].goods_price * item[j].goods_num;
  1375 +
  1376 + //判断是否有设置限制重量包邮
  1377 + if(weight_free){
  1378 + if( item[j]['exp_sum_type']==2 ){
  1379 + if (goods_weight < 0) goods_weight = 0;
  1380 + //累积商品重量 每种商品的重量 * 数量
  1381 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1382 + out_of_weight = (weight_free*1000) - goods_weight;
  1383 + }
  1384 + }
1374 } 1385 }
1375 //判断是不是有组合购的金额 1386 //判断是不是有组合购的金额
1376 var f_o_price = o_price; 1387 var f_o_price = o_price;
@@ -1410,7 +1421,7 @@ Page({ @@ -1410,7 +1421,7 @@ Page({
1410 1421
1411 1422
1412 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- 1423 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
1413 - if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) { 1424 + if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) && out_of_weight > 0) {
1414 //如果有设置不包邮区域的时候 1425 //如果有设置不包邮区域的时候
1415 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { 1426 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
1416 if (th.check_by_area(by_qc.region_list)) { 1427 if (th.check_by_area(by_qc.region_list)) {
@@ -1533,13 +1544,13 @@ Page({ @@ -1533,13 +1544,13 @@ Page({
1533 //统一运费 1544 //统一运费
1534 o_shipping_price += item[j]['uniform_exp_sum']; 1545 o_shipping_price += item[j]['uniform_exp_sum'];
1535 break; 1546 break;
1536 - case 2:  
1537 - +''  
1538 - if (goods_weight < 0) goods_weight = 0;  
1539 - //累积商品重量 每种商品的重量 * 数量  
1540 - goods_weight += item[j]['weight'] * item[j]['goods_num'];  
1541 -  
1542 - break; 1547 + // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮
  1548 + // +''
  1549 + // if (goods_weight < 0) goods_weight = 0;
  1550 + // //累积商品重量 每种商品的重量 * 数量
  1551 + // goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1552 + // out_of_weight = (weight_free*1000) - goods_weight;
  1553 + // break;
1543 case 3: 1554 case 3:
1544 if (goods_piece < 0) goods_piece = 0; 1555 if (goods_piece < 0) goods_piece = 0;
1545 //累积商品数量 1556 //累积商品数量
@@ -1548,6 +1559,11 @@ Page({ @@ -1548,6 +1559,11 @@ Page({
1548 } 1559 }
1549 } 1560 }
1550 1561
  1562 + }else{
  1563 + if(goods_weight && out_of_weight !== 0){
  1564 + goods_weight=-1;
  1565 + out_of_weight=0;
  1566 + }
1551 } 1567 }
1552 } 1568 }
1553 1569
@@ -1558,7 +1574,7 @@ Page({ @@ -1558,7 +1574,7 @@ Page({
1558 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) 1574 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
1559 code = th.data.wu_arr[cart_item.wind].code; 1575 code = th.data.wu_arr[cart_item.wind].code;
1560 cart_item.shipping_price = 1576 cart_item.shipping_price =
1561 - th.calculatewuliu(code, o_shipping_price, goods_weight, 1577 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
1562 goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); 1578 goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs);
1563 1579
1564 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1580 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
@@ -1777,7 +1793,10 @@ Page({ @@ -1777,7 +1793,10 @@ Page({
1777 to.getwuliuprice(async function (rs) { 1793 to.getwuliuprice(async function (rs) {
1778 1794
1779 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 1795 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
1780 - 1796 + var out_of_weight=null; //超出多少重量
  1797 + var freight_free = ee.freight_free; //全场满多少包邮
  1798 + var weight_free = ee.weight_free; //多少kg内包邮
  1799 + var no_ex_id = ee.no_ex_id;
1781 //---如果有选择优惠券的情况下--- 1800 //---如果有选择优惠券的情况下---
1782 var quan_price = 0, bn_pick = th.data.bn_pick; 1801 var quan_price = 0, bn_pick = th.data.bn_pick;
1783 var quan_no = null; 1802 var quan_no = null;
@@ -1844,6 +1863,7 @@ Page({ @@ -1844,6 +1863,7 @@ Page({
1844 if (goods_weight < 0) goods_weight = 0; 1863 if (goods_weight < 0) goods_weight = 0;
1845 //累积商品重量 每种商品的重量 * 数量 1864 //累积商品重量 每种商品的重量 * 数量
1846 goods_weight += good['weight'] * good['buynum']; 1865 goods_weight += good['weight'] * good['buynum'];
  1866 + out_of_weight = (weight_free * 1000 ) - goods_weight;
1847 break; 1867 break;
1848 case 3: 1868 case 3:
1849 if (goods_piece < 0) goods_piece = 0; 1869 if (goods_piece < 0) goods_piece = 0;
@@ -1854,8 +1874,7 @@ Page({ @@ -1854,8 +1874,7 @@ Page({
1854 1874
1855 var code = ""; 1875 var code = "";
1856 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 1876 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
1857 - var freight_free = ee.freight_free; //全场满多少包邮  
1858 - var no_ex_id = ee.no_ex_id; 1877 +
1859 th.data.is_no_by[th.data.bn_pick] = 0; 1878 th.data.is_no_by[th.data.bn_pick] = 0;
1860 1879
1861 var no_by_data = null; 1880 var no_by_data = null;
@@ -1891,12 +1910,12 @@ Page({ @@ -1891,12 +1910,12 @@ Page({
1891 th.data.is_by[th.data.bn_pick] = 0; 1910 th.data.is_by[th.data.bn_pick] = 0;
1892 //--------------开始计算物流------------------ 1911 //--------------开始计算物流------------------
1893 var shipping_price = 1912 var shipping_price =
1894 - th.calculatewuliu(code, o_shipping_price, goods_weight, 1913 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
1895 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 1914 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
1896 1915
1897 //如果有赠品的时候,也要计算赠品的物流费用 1916 //如果有赠品的时候,也要计算赠品的物流费用
1898 if (th.data.buy_now_gift_goods) { 1917 if (th.data.buy_now_gift_goods) {
1899 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, 1918 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,
1900 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 1919 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
1901 } 1920 }
1902 1921
@@ -2832,12 +2851,12 @@ Page({ @@ -2832,12 +2851,12 @@ Page({
2832 th.calculatePrice(); 2851 th.calculatePrice();
2833 }, 2852 },
2834 //-------------------计算物流--------------- 2853 //-------------------计算物流---------------
2835 - calculatewuliu: function (code, o_shipping_price, goods_weight, 2854 + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
2836 goods_piece, user_addr, freight_free, o_price, rs) { 2855 goods_piece, user_addr, freight_free, o_price, rs) {
2837 var price = 0, th = this; 2856 var price = 0, th = this;
2838 price += parseFloat(o_shipping_price); 2857 price += parseFloat(o_shipping_price);
2839 //如果是包邮 2858 //如果是包邮
2840 - if (freight_free > 0 && o_price >= freight_free) { 2859 + if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) {
2841 return 0; 2860 return 0;
2842 } 2861 }
2843 if (user_addr == null) { 2862 if (user_addr == null) {
@@ -2855,7 +2874,7 @@ Page({ @@ -2855,7 +2874,7 @@ Page({
2855 item = item.config; 2874 item = item.config;
2856 if (item == null) return o_shipping_price; 2875 if (item == null) return o_shipping_price;
2857 //------按重量---------- 2876 //------按重量----------
2858 - if (goods_weight >= 0 && item['money']) { 2877 + if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
2859 fw_price = parseFloat(item['money']); 2878 fw_price = parseFloat(item['money']);
2860 if (goods_weight > item['first_weight']) { 2879 if (goods_weight > item['first_weight']) {
2861 var fw = goods_weight - item['first_weight']; 2880 var fw = goods_weight - item['first_weight'];
@@ -2863,6 +2882,13 @@ Page({ @@ -2863,6 +2882,13 @@ Page({
2863 fw_price = fw_price + n * parseFloat(item['add_money']); 2882 fw_price = fw_price + n * parseFloat(item['add_money']);
2864 } 2883 }
2865 } 2884 }
  2885 + //------超出重量----------
  2886 + if(out_of_weight < 0){
  2887 + fw_price = parseFloat(item['money']);
  2888 + var out_of_weight = Math.abs(out_of_weight);
  2889 + var n = Math.ceil(out_of_weight / item['second_weight'])
  2890 + fw_price = fw_price + n * parseFloat(item['add_money']);
  2891 + }
2866 //------按件数---------- 2892 //------按件数----------
2867 if (goods_piece > 0 && item['piecemoney']) { 2893 if (goods_piece > 0 && item['piecemoney']) {
2868 fp_price = parseFloat(item['piecemoney']); 2894 fp_price = parseFloat(item['piecemoney']);
@@ -3718,7 +3744,7 @@ Page({ @@ -3718,7 +3744,7 @@ Page({
3718 }, 3744 },
3719 3745
3720 //计算立即购买赠品的物流费用 3746 //计算立即购买赠品的物流费用
3721 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 3747 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
3722 var good = this.data.buy_now_gift_goods; 3748 var good = this.data.buy_now_gift_goods;
3723 var goods_weight = -1, goods_piece = -1; 3749 var goods_weight = -1, goods_piece = -1;
3724 var gift_shipping_price = 0; 3750 var gift_shipping_price = 0;
@@ -3735,6 +3761,7 @@ Page({ @@ -3735,6 +3761,7 @@ Page({
3735 goods_weight += good['weight'] * good['buynum']; 3761 goods_weight += good['weight'] * good['buynum'];
3736 if (goods_weight1 > 0) { 3762 if (goods_weight1 > 0) {
3737 goods_weight += goods_weight1; 3763 goods_weight += goods_weight1;
  3764 + out_of_weight = (gift_weight_free*1000) - goods_weight;
3738 } 3765 }
3739 break; 3766 break;
3740 case 3: 3767 case 3:
packageC/pages/presell/cart/cart2.js
@@ -612,7 +612,10 @@ Page({ @@ -612,7 +612,10 @@ Page({
612 to.getwuliuprice(async function (rs) { 612 to.getwuliuprice(async function (rs) {
613 613
614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
615 - 615 + var out_of_weight=null; //超出多少重量
  616 + var freight_free = ee.freight_free; //全场满多少包邮
  617 + var weight_free = ee.weight_free; //多少kg内包邮
  618 + var no_ex_id = ee.no_ex_id;
616 //---如果有选择优惠券的情况下--- 619 //---如果有选择优惠券的情况下---
617 var quan_price = 0, bn_pick = th.data.bn_pick; 620 var quan_price = 0, bn_pick = th.data.bn_pick;
618 var quan_no = null; 621 var quan_no = null;
@@ -679,6 +682,7 @@ Page({ @@ -679,6 +682,7 @@ Page({
679 if (goods_weight < 0) goods_weight = 0; 682 if (goods_weight < 0) goods_weight = 0;
680 //累积商品重量 每种商品的重量 * 数量 683 //累积商品重量 每种商品的重量 * 数量
681 goods_weight += good['weight'] * good['buynum']; 684 goods_weight += good['weight'] * good['buynum'];
  685 + out_of_weight = (weight_free * 1000 ) - goods_weight;
682 break; 686 break;
683 case 3: 687 case 3:
684 if (goods_piece < 0) goods_piece = 0; 688 if (goods_piece < 0) goods_piece = 0;
@@ -689,8 +693,7 @@ Page({ @@ -689,8 +693,7 @@ Page({
689 693
690 var code = ""; 694 var code = "";
691 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 695 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
692 - var freight_free = ee.freight_free; //全场满多少包邮  
693 - var no_ex_id = ee.no_ex_id; 696 +
694 th.data.is_no_by[th.data.bn_pick] = 0; 697 th.data.is_no_by[th.data.bn_pick] = 0;
695 698
696 var no_by_data = null; 699 var no_by_data = null;
@@ -726,12 +729,12 @@ Page({ @@ -726,12 +729,12 @@ Page({
726 th.data.is_by[th.data.bn_pick] = 0; 729 th.data.is_by[th.data.bn_pick] = 0;
727 //--------------开始计算物流------------------ 730 //--------------开始计算物流------------------
728 var shipping_price = 731 var shipping_price =
729 - th.calculatewuliu(code, o_shipping_price, goods_weight, 732 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
730 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 733 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
731 734
732 //如果有赠品的时候,也要计算赠品的物流费用 735 //如果有赠品的时候,也要计算赠品的物流费用
733 if (th.data.buy_now_gift_goods) { 736 if (th.data.buy_now_gift_goods) {
734 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, 737 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free,
735 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 738 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
736 } 739 }
737 740
@@ -1665,12 +1668,12 @@ Page({ @@ -1665,12 +1668,12 @@ Page({
1665 th.calculatePrice(); 1668 th.calculatePrice();
1666 }, 1669 },
1667 //-------------------计算物流--------------- 1670 //-------------------计算物流---------------
1668 - calculatewuliu: function (code, o_shipping_price, goods_weight, 1671 + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
1669 goods_piece, user_addr, freight_free, o_price, rs) { 1672 goods_piece, user_addr, freight_free, o_price, rs) {
1670 var price = 0, th = this; 1673 var price = 0, th = this;
1671 price += parseFloat(o_shipping_price); 1674 price += parseFloat(o_shipping_price);
1672 //如果是包邮 1675 //如果是包邮
1673 - if (freight_free > 0 && o_price >= freight_free) { 1676 + if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) {
1674 return 0; 1677 return 0;
1675 } 1678 }
1676 if (user_addr == null) { 1679 if (user_addr == null) {
@@ -1688,7 +1691,7 @@ Page({ @@ -1688,7 +1691,7 @@ Page({
1688 item = item.config; 1691 item = item.config;
1689 if (item == null) return o_shipping_price; 1692 if (item == null) return o_shipping_price;
1690 //------按重量---------- 1693 //------按重量----------
1691 - if (goods_weight >= 0 && item['money']) { 1694 + if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
1692 fw_price = parseFloat(item['money']); 1695 fw_price = parseFloat(item['money']);
1693 if (goods_weight > item['first_weight']) { 1696 if (goods_weight > item['first_weight']) {
1694 var fw = goods_weight - item['first_weight']; 1697 var fw = goods_weight - item['first_weight'];
@@ -1696,6 +1699,14 @@ Page({ @@ -1696,6 +1699,14 @@ Page({
1696 fw_price = fw_price + n * parseFloat(item['add_money']); 1699 fw_price = fw_price + n * parseFloat(item['add_money']);
1697 } 1700 }
1698 } 1701 }
  1702 +
  1703 + //------超出重量----------
  1704 + if(out_of_weight < 0){
  1705 + fw_price = parseFloat(item['money']);
  1706 + var out_of_weight = Math.abs(out_of_weight);
  1707 + var n = Math.ceil(out_of_weight / item['second_weight'])
  1708 + fw_price = fw_price + n * parseFloat(item['add_money']);
  1709 + }
1699 //------按件数---------- 1710 //------按件数----------
1700 if (goods_piece > 0 && item['piecemoney']) { 1711 if (goods_piece > 0 && item['piecemoney']) {
1701 fp_price = parseFloat(item['piecemoney']); 1712 fp_price = parseFloat(item['piecemoney']);
@@ -2527,7 +2538,7 @@ Page({ @@ -2527,7 +2538,7 @@ Page({
2527 }, 2538 },
2528 2539
2529 //计算立即购买赠品的物流费用 2540 //计算立即购买赠品的物流费用
2530 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 2541 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
2531 var good = this.data.buy_now_gift_goods; 2542 var good = this.data.buy_now_gift_goods;
2532 var goods_weight = -1, goods_piece = -1; 2543 var goods_weight = -1, goods_piece = -1;
2533 var gift_shipping_price = 0; 2544 var gift_shipping_price = 0;
@@ -2544,6 +2555,7 @@ Page({ @@ -2544,6 +2555,7 @@ Page({
2544 goods_weight += good['weight'] * good['buynum']; 2555 goods_weight += good['weight'] * good['buynum'];
2545 if (goods_weight1 > 0) { 2556 if (goods_weight1 > 0) {
2546 goods_weight += goods_weight1; 2557 goods_weight += goods_weight1;
  2558 + out_of_weight = (gift_weight_free*1000) - goods_weight;
2547 } 2559 }
2548 break; 2560 break;
2549 case 3: 2561 case 3:
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -16,6 +16,22 @@ @@ -16,6 +16,22 @@
16 </view> 16 </view>
17 <view class="goods-detail"> 17 <view class="goods-detail">
18 <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}"> 18 <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}">
  19 +
  20 + <!-- 历史购买记录 -->
  21 + <view class="swiper-container">
  22 + <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="3000">
  23 + <swiper-item class="swiper-item" wx:for="">
  24 + <view class="item">
  25 + <view class="avatar-container">
  26 + <image src=""></image>
  27 + </view>
  28 + <view class="flex ai_c pd10">
  29 + <view class="nickname ellipsis-1x">abson下单成功</view>
  30 + </view>
  31 + </view>
  32 + </swiper-item>
  33 + </swiper>
  34 + </view>
19 <!-- 视频 --> 35 <!-- 视频 -->
20 <!-- <swiper bindchange="swiperChange"class="xc-pictures swiperContainer rel" current="{{swiperCurrent}}" 36 <!-- <swiper bindchange="swiperChange"class="xc-pictures swiperContainer rel" current="{{swiperCurrent}}"
21 indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> --> 37 indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> -->
pages/activity/pind_list/pind_list.js
1 -var e = getApp(),  
2 -i = e.request,  
3 - a = e.globalData.setting,  
4 - os=a,ut = require("../../../utils/util.js"); 1 +var e = getApp(),
  2 + i = e.request,
  3 + a = e.globalData.setting,
  4 + os = a,
  5 + ut = require("../../../utils/util.js");
5 var regeneratorRuntime = require('../../../utils/runtime.js'); 6 var regeneratorRuntime = require('../../../utils/runtime.js');
6 7
7 -Page({  
8 - data: {  
9 - url: a.imghost,  
10 - killtime: null,  
11 - currentPage: 1,  
12 - goodlist: null,  
13 - type:1,  
14 - timer:null,  
15 - ismore:1,  
16 - isshow:0,  
17 - iurl: os.imghost,  
18 - ad_data:null,  
19 - max_sw_height:200,  
20 - },  
21 -  
22 - //------初始化加载----------  
23 - onLoad: function(t) {  
24 - wx.setNavigationBarTitle({ title: "天天拼单",})  
25 - var first_leader = t.first_leader;  
26 - var th=this;  
27 -  
28 - console.log("------------");  
29 - console.log(first_leader);  
30 - getApp().getConfig();  
31 -  
32 - if (first_leader) {  
33 - getApp().globalData.first_leader = first_leader;  
34 - //调用接口判断是不是会员  
35 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {  
36 - if (res.data.code == 0) {  
37 - getApp().globalData.guide_id = res.data.data.id;  
38 - }  
39 - }) 8 +Page({
  9 + data: {
  10 + url: a.imghost,
  11 + killtime: null,
  12 + currentPage: 1,
  13 + goodlist: [],
  14 + type: 1,
  15 + timer: null,
  16 + ismore: 1,
  17 + isshow: 0,
  18 + iurl: os.imghost,
  19 + ad_data: null,
  20 + max_sw_height: 200,
  21 + },
  22 +
  23 + //------初始化加载----------
  24 + onLoad: function (t) {
  25 + wx.setNavigationBarTitle({
  26 + title: "天天拼单",
  27 + })
  28 + var first_leader = t.first_leader;
  29 + var th = this;
  30 +
  31 + console.log("------------");
  32 + console.log(first_leader);
  33 + getApp().getConfig();
  34 +
  35 + if (first_leader) {
  36 + getApp().globalData.first_leader = first_leader;
  37 + //调用接口判断是不是会员
  38 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  39 + if (res.data.code == 0) {
  40 + getApp().globalData.guide_id = res.data.data.id;
40 } 41 }
41 -  
42 - getApp().request.promiseGet("/api/weshop/ad/page?pid=801&store_id=" + os.stoid, {  
43 - data: {  
44 - enabled: 1  
45 - }  
46 - }).then(res => {  
47 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){  
48 - var a = res.data.data.pageData;  
49 - var narr=[];  
50 - for(var i in a){  
51 - var tt = {  
52 - 'ad_code': os.imghost + a[i].ad_code,  
53 - 'media_link': '',  
54 - 'ad_weapplink':a[i].ad_weapplink  
55 - };  
56 - narr.push(tt);  
57 - }  
58 -  
59 - th.setData({ad_data:narr});  
60 - }  
61 - })  
62 - },  
63 -  
64 - onShow: function(t) {  
65 -  
66 - this.data.is_timer=1;  
67 - this.data.currentPage=1;  
68 - this.data.ismore=1;  
69 - this.setData({goodlist:null});  
70 - var th=this;  
71 - this.requestSalelist();  
72 - //设置全局定时器  
73 - th.data.timer=setInterval(function () {  
74 - th.countDown();  
75 - },1000);  
76 - },  
77 -  
78 - onHide:function(){  
79 - //--清理定时器--  
80 - clearInterval(this.timer);  
81 - this.setData({isshow:0});  
82 - },  
83 -  
84 - //---小于10的格式化函数----  
85 - timeFormat(param) {  
86 - return param < 10 ? '0' + param : param;  
87 - }, 42 + })
  43 + }
  44 +
  45 + getApp().request.promiseGet("/api/weshop/ad/page?pid=801&store_id=" + os.stoid, {
  46 + data: {
  47 + enabled: 1
  48 + }
  49 + }).then(res => {
  50 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
  51 + var a = res.data.data.pageData;
  52 + var narr = [];
  53 + for (var i in a) {
  54 + var tt = {
  55 + 'ad_code': os.imghost + a[i].ad_code,
  56 + 'media_link': '',
  57 + 'ad_weapplink': a[i].ad_weapplink
  58 + };
  59 + narr.push(tt);
  60 + }
  61 +
  62 + th.setData({
  63 + ad_data: narr
  64 + });
  65 + }
  66 + })
  67 +
  68 + },
  69 +
  70 + onShow: function (t) {
  71 +
  72 + this.data.is_timer = 1;
  73 + this.data.currentPage = 1;
  74 + this.data.ismore = 1;
  75 + var th = this;
  76 + var userInfo = wx.getStorageSync('userinfo');
  77 + console.log(userInfo,30000);
  78 + if (userInfo && th.data.goodlist.length==0) {
  79 + //调用列表
  80 + this.requestSalelist(userInfo.user_id);
  81 + } else {
  82 + getApp().goto("/pages/togoin/togoin");
  83 + }
  84 + //设置全局定时器
  85 + th.data.timer = setInterval(function () {
  86 + th.countDown();
  87 + }, 1000);
  88 + },
  89 +
  90 + onHide: function () {
  91 + //--清理定时器--
  92 + clearInterval(this.timer);
  93 + this.setData({
  94 + isshow: 0
  95 + });
  96 + },
  97 +
  98 + //---小于10的格式化函数----
  99 + timeFormat(param) {
  100 + return param < 10 ? '0' + param : param;
  101 + },
88 102
89 //----倒计时函数----- 103 //----倒计时函数-----
90 - countDown() {  
91 - if(!this.data.goodlist) return false;  
92 - var th=this; 104 + countDown() {
  105 + if (!this.data.goodlist) return false;
  106 + var th = this;
93 // 获取当前时间,同时得到活动结束时间数组 107 // 获取当前时间,同时得到活动结束时间数组
94 var newTime = ut.gettimestamp(); 108 var newTime = ut.gettimestamp();
95 var endTimeList = this.data.goodlist; 109 var endTimeList = this.data.goodlist;
@@ -119,119 +133,138 @@ Page({ @@ -119,119 +133,138 @@ Page({
119 } 133 }
120 }, 134 },
121 135
122 - //读取数据  
123 - async requestSalelist(){  
124 - if(!this.data.ismore) return false;  
125 - var e = this,th=e,i = "/api/weshop/teamlist/pageteam/"+th.data.type+"?page=" + e.data.currentPage;  
126 - var plist=null,alllist=th.data.goodlist;  
127 - if(!alllist) alllist=[];  
128 -  
129 - await getApp().request.promiseGet(i,  
130 - {isShowLoading:1,data:{store_id:os.stoid,is_end:0,is_show:1}}  
131 - ).then(res=>{  
132 - if(ut.ajax_ok(res)) plist=res.data.data.pageData;  
133 - }); 136 + //读取数据
  137 + async requestSalelist(user_id) {
  138 + if (!this.data.ismore) return false;
  139 + var e = this,
  140 + th = e,
  141 + i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage;
  142 + var plist = null,
  143 + alllist = th.data.goodlist;
  144 + if (!alllist) alllist = [];
  145 + await getApp().request.promiseGet(i, {
  146 + isShowLoading: 1,
  147 + data: {
  148 + store_id: os.stoid,
  149 + is_end: 0,
  150 + is_show: 1,
  151 + user_id,
  152 + }
  153 + }).then(res => {
  154 + plist = res.data.data.pageData;
  155 + });
134 156
135 - if(!plist || plist.length<=0){  
136 - getApp().showWarning("没有更多数据");  
137 - th.data.ismore=0;  
138 - return false;  
139 - }  
140 - //--循环读取接口---  
141 - for(var i=0;i<plist.length;i++){  
142 - var prom_id=plist[i].id;  
143 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/"+  
144 - os.stoid+"/6/"+prom_id,{}).then(res=>{  
145 - if(res.data.code==0){  
146 - plist[i].status=1;  
147 - if(res.data.data<=0) plist[i].status=3;  
148 - }  
149 - });  
150 - alllist.push(plist[i]);  
151 - }  
152 - e.data.currentPage++;  
153 -  
154 - th.setData({goodlist:alllist,isshow:1});  
155 - },  
156 -  
157 - onPullDownRefresh: function() {  
158 - this.reloadGoodList();  
159 - },  
160 - reloadGoodList: function() {  
161 - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist();  
162 - },  
163 - onReachBottom: function() {  
164 - this.requestSalelist();  
165 - },  
166 -  
167 - //点击tab事件  
168 - tip:function(e){  
169 - var a=e.currentTarget.dataset.ty,th=this; th.data.ismore=1;th.data.currentPage=1;  
170 - this.setData({type:a,goodlist:null});  
171 - this.reloadGoodList();  
172 - },  
173 -  
174 -  
175 -  
176 - //---------分享配置--------  
177 - onShareAppMessage: function (e) {  
178 - var curPage=this;  
179 - var pagePath = curPage.route; //当前页面url  
180 - if (pagePath.indexOf('/') != 0) {  
181 - pagePath = '/' + pagePath; 157 + if (plist.length <= 0) {
  158 + getApp().showWarning("没有更多数据");
  159 + th.data.ismore = 0;
  160 + }
  161 + //--循环读取接口---
  162 + for (var i = 0; i < plist.length; i++) {
  163 + var prom_id = plist[i].id;
  164 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  165 + os.stoid + "/6/" + prom_id, {}).then(res => {
  166 + if (res.data.code == 0) {
  167 + plist[i].status = 1;
  168 + if (res.data.data <= 0) plist[i].status = 3;
182 } 169 }
183 - if(getApp().globalData.user_id){ 170 + });
  171 + alllist.push(plist[i]);
  172 + }
  173 + e.data.currentPage++;
184 174
185 - if(pagePath.indexOf("?")>0){  
186 - pagePath+="&first_leader="+getApp().globalData.user_id;  
187 - }else{  
188 - pagePath+="?first_leader="+getApp().globalData.user_id;  
189 - }  
190 - } 175 + th.setData({
  176 + goodlist: alllist,
  177 + isshow: 1,
  178 + ismore:0,
  179 + });
  180 + },
191 181
192 - console.log("11"+pagePath); 182 + onPullDownRefresh: function () {
  183 + this.reloadGoodList();
  184 + },
  185 + reloadGoodList: function () {
  186 + this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist();
  187 + },
  188 + onReachBottom: function () {
  189 + this.requestSalelist();
  190 + },
193 191
194 - return {  
195 - title: "限时团购",  
196 - path:pagePath,  
197 - }  
198 - },  
199 -  
200 -  
201 -  
202 -  
203 - //图片失败,默认图片  
204 - bind_bnerr2: function (e) {  
205 - var _errImg = e.target.dataset.errorimg;  
206 - var val = e.target.dataset.val;  
207 - if(val!="/public/images/default_goods_image_240.gif"){  
208 - var _errObj = {};  
209 - _errObj[_errImg] = "/public/images/default_goods_image_240.gif";  
210 - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;  
211 - }  
212 - },  
213 -  
214 - imageLoad:function(e){  
215 - var imgwidth = e.detail.width;  
216 - var imgheight = e.detail.height;  
217 - //宽高比  
218 - var ratio = imgwidth / imgheight;  
219 - //计算的高度值  
220 - var viewHeight = 750 / ratio;  
221 - var hei=this.data.max_sw_height;  
222 -  
223 - if (hei< viewHeight) {  
224 - this.setData({ max_sw_height: viewHeight });  
225 - }  
226 - },  
227 -  
228 - onShareTimeline() {  
229 - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';  
230 - if(!store_name)  
231 - store_name=getApp().globalData.setting.appName;  
232 - return {  
233 - title: '秒杀活动-' + store_name,  
234 - }  
235 - },  
236 -  
237 -}); 192 + //点击tab事件
  193 + tip: function (e) {
  194 + var a = e.currentTarget.dataset.ty,
  195 + th = this;
  196 + th.data.ismore = 1;
  197 + th.data.currentPage = 1;
  198 + this.setData({
  199 + type: a,
  200 + goodlist: []
  201 + });
  202 + this.reloadGoodList();
  203 + },
  204 +
  205 +
  206 +
  207 + //---------分享配置--------
  208 + onShareAppMessage: function (e) {
  209 + var curPage = this;
  210 + var pagePath = curPage.route; //当前页面url
  211 + if (pagePath.indexOf('/') != 0) {
  212 + pagePath = '/' + pagePath;
  213 + }
  214 + if (getApp().globalData.user_id) {
  215 +
  216 + if (pagePath.indexOf("?") > 0) {
  217 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  218 + } else {
  219 + pagePath += "?first_leader=" + getApp().globalData.user_id;
  220 + }
  221 + }
  222 +
  223 + console.log("11" + pagePath);
  224 +
  225 + return {
  226 + title: "限时团购",
  227 + path: pagePath,
  228 + }
  229 + },
  230 +
  231 +
  232 +
  233 +
  234 + //图片失败,默认图片
  235 + bind_bnerr2: function (e) {
  236 + var _errImg = e.target.dataset.errorimg;
  237 + var val = e.target.dataset.val;
  238 + if (val != "/public/images/default_goods_image_240.gif") {
  239 + var _errObj = {};
  240 + _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
  241 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  242 + }
  243 + },
  244 +
  245 + imageLoad: function (e) {
  246 + var imgwidth = e.detail.width;
  247 + var imgheight = e.detail.height;
  248 + //宽高比
  249 + var ratio = imgwidth / imgheight;
  250 + //计算的高度值
  251 + var viewHeight = 750 / ratio;
  252 + var hei = this.data.max_sw_height;
  253 +
  254 + if (hei < viewHeight) {
  255 + this.setData({
  256 + max_sw_height: viewHeight
  257 + });
  258 + }
  259 + },
  260 +
  261 + onShareTimeline() {
  262 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  263 + if (!store_name)
  264 + store_name = getApp().globalData.setting.appName;
  265 + return {
  266 + title: '秒杀活动-' + store_name,
  267 + }
  268 + },
  269 +
  270 +});
238 \ No newline at end of file 271 \ No newline at end of file
pages/activity/pind_list/pind_list.wxml
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 104
105 </view> 105 </view>
106 106
107 -<view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> 107 +<view class="no-more" wx:if="{{goodlist.length==0 && !ismore}}">没有相关内容</view>
108 </view> 108 </view>
109 109
110 110
pages/cart/cart/cart.js
1 var t = getApp(), 1 var t = getApp(),
2 a = t.request, 2 a = t.request,
3 oo = t.globalData.setting, 3 oo = t.globalData.setting,
4 - os=oo, 4 + os = oo,
5 app = getApp(), 5 app = getApp(),
6 rq = t.request, 6 rq = t.request,
7 ut = require("../../../utils/util.js"), 7 ut = require("../../../utils/util.js"),
@@ -9,6 +9,7 @@ var t = getApp(), @@ -9,6 +9,7 @@ var t = getApp(),
9 ladder_calc = require("ladder_calculate.js"); 9 ladder_calc = require("ladder_calculate.js");
10 var regeneratorRuntime = require('../../../utils/runtime.js'); 10 var regeneratorRuntime = require('../../../utils/runtime.js');
11 11
  12 +
12 Page({ 13 Page({
13 data: { 14 data: {
14 url: t.globalData.setting.url, 15 url: t.globalData.setting.url,
@@ -41,33 +42,35 @@ Page({ @@ -41,33 +42,35 @@ Page({
41 in_zhact_gdmap:{}, //不同门店参与同一活动的限购 42 in_zhact_gdmap:{}, //不同门店参与同一活动的限购
42 43
43 ladder_map:{}, //阶梯促销需要的map 44 ladder_map:{}, //阶梯促销需要的map
  45 +
44 }, 46 },
45 - onLoad: function() {  
46 - var a = this,ee=a; 47 + onLoad: function () {
  48 + var a = this,
  49 + ee = a;
47 //----获取系统参数----- 50 //----获取系统参数-----
48 - getApp().getConfig2(function(e) {  
49 - ee.setData({  
50 - bconfig: e,  
51 - sales_rules:e.sales_rules  
52 - });  
53 - }) 51 + // getApp().getConfig2(function (e) {
  52 + // ee.setData({
  53 + // bconfig: e,
  54 + // sales_rules: e.sales_rules
  55 + // });
  56 + // })
54 57
55 wx.setNavigationBarTitle({ 58 wx.setNavigationBarTitle({
56 title: "购物车", 59 title: "购物车",
57 }) 60 })
58 61
59 //判断是否有登录 62 //判断是否有登录
60 - t.auth.hadAuth() && t.getUserInfo(function() { 63 + t.auth.hadAuth() && t.getUserInfo(function () {
61 //a.getCardList(); 64 //a.getCardList();
62 }); 65 });
63 66
64 }, 67 },
65 - onShow: function() { 68 + onShow: function () {
66 //每次显示都清空 69 //每次显示都清空
67 - this.data.in_zhact_gdmap={}; 70 + this.data.in_zhact_gdmap = {};
68 71
69 if (typeof this.getTabBar === 'function' && this.getTabBar()) { 72 if (typeof this.getTabBar === 'function' && this.getTabBar()) {
70 - var index=getApp().getPageIndex(this); 73 + var index = getApp().getPageIndex(this);
71 this.getTabBar().setData({ 74 this.getTabBar().setData({
72 active: index //数字是当前页面在tabbar的索引 75 active: index //数字是当前页面在tabbar的索引
73 }) 76 })
@@ -76,7 +79,10 @@ Page({ @@ -76,7 +79,10 @@ Page({
76 } 79 }
77 80
78 var th = this; 81 var th = this;
79 - this.setData({requestData:null,is_load:0}); 82 + this.setData({
  83 + requestData: null,
  84 + is_load: 0
  85 + });
80 //调用底部导航 86 //调用底部导航
81 //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); 87 //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
82 //----获取系统参数----- 88 //----获取系统参数-----
@@ -84,7 +90,10 @@ Page({ @@ -84,7 +90,10 @@ Page({
84 var json_d = JSON.parse(e.switch_list); 90 var json_d = JSON.parse(e.switch_list);
85 var is_open_offline=json_d.is_pricing_open; 91 var is_open_offline=json_d.is_pricing_open;
86 th.setData({ 92 th.setData({
87 - bconfig: e,sales_rules:e.sales_rules 93 + bconfig: e,
  94 + freight_free:e.freight_free,
  95 + weight_free:e.weight_free,
  96 + sales_rules:e.sales_rules,
88 }); 97 });
89 getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=6",{}).then(res=>{ 98 getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=6",{}).then(res=>{
90 //未购买 99 //未购买
@@ -131,58 +140,60 @@ Page({ @@ -131,58 +140,60 @@ Page({
131 is_end: 0, 140 is_end: 0,
132 is_show: 1, 141 is_show: 1,
133 pageSize: 1, 142 pageSize: 1,
134 - user_id:user_id 143 + user_id: user_id
135 } 144 }
136 - //--获取是否又秒杀活动--  
137 - getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {  
138 - data:req_d,  
139 - }).then(res => {  
140 - if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) {  
141 - th.setData({  
142 - is_has_flash: 1  
143 - })  
144 - }  
145 - });  
146 - }  
147 - })  
148 -  
149 - 145 + //--获取是否又秒杀活动--
  146 + getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
  147 + data: req_d,
  148 + }).then(res => {
  149 + if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) {
  150 + th.setData({
  151 + is_has_flash: 1
  152 + })
  153 + }
  154 + });
  155 + }
  156 + })
  157 +
  158 +
150 }, 159 },
151 160
152 - onHide(){  
153 - this.data.zuhe_map={}; 161 + onHide() {
  162 + this.data.zuhe_map = {};
154 }, 163 },
155 - onUnLoad(){  
156 - getApp().globalData.cart_zh_act=null; 164 + onUnLoad() {
  165 + getApp().globalData.cart_zh_act = null;
157 }, 166 },
158 //-------------获取购物车列表,要安装门店进行分类订单----------- 167 //-------------获取购物车列表,要安装门店进行分类订单-----------
159 - getCardList: function() {  
160 - 168 + getCardList: function () {
  169 +
161 var th = this; 170 var th = this;
162 171
163 //要获取会员是不是等级会员 172 //要获取会员是不是等级会员
164 - getApp().getConfig2(function(conf){ 173 + getApp().getConfig2(function (conf) {
165 //--- 看后台是不是有开通等级卡 --- 174 //--- 看后台是不是有开通等级卡 ---
166 - if(conf.switch_list){  
167 - var s_list=JSON.parse(conf.switch_list);  
168 - var user=getApp().globalData.userInfo; 175 + if (conf.switch_list) {
  176 + var s_list = JSON.parse(conf.switch_list);
  177 + var user = getApp().globalData.userInfo;
169 //如果后台有开启等级价的功能 178 //如果后台有开启等级价的功能
170 - if(user && parseInt(s_list.rank_switch)==2 && user['card_expiredate']){ 179 + if (user && parseInt(s_list.rank_switch) == 2 && user['card_expiredate']) {
171 180
172 var str = user['card_expiredate'].replace(/-/g, '/'); 181 var str = user['card_expiredate'].replace(/-/g, '/');
173 var end = new Date(str); 182 var end = new Date(str);
174 end = Date.parse(end) / 1000; 183 end = Date.parse(end) / 1000;
175 var now = ut.gettimestamp(); 184 var now = ut.gettimestamp();
176 //--- 判断是等级会员,且在有效期范围内 --- 185 //--- 判断是等级会员,且在有效期范围内 ---
177 - if(user.card_field && now<end){  
178 - th.setData({card_field:user.card_field}) 186 + if (user.card_field && now < end) {
  187 + th.setData({
  188 + card_field: user.card_field
  189 + })
179 } 190 }
180 } 191 }
181 192
182 //如果门店还未读出来的时候 193 //如果门店还未读出来的时候
183 if (th.data.allsto == null) { 194 if (th.data.allsto == null) {
184 //读取门店 195 //读取门店
185 - app.get_allsto(function(e) { 196 + app.get_allsto(function (e) {
186 th.setData({ 197 th.setData({
187 allsto: e 198 allsto: e
188 }); 199 });
@@ -193,57 +204,56 @@ Page({ @@ -193,57 +204,56 @@ Page({
193 th.get_cart(); 204 th.get_cart();
194 th.get_ser_cart(); 205 th.get_ser_cart();
195 } 206 }
196 - 207 +
197 208
198 } 209 }
199 }) 210 })
200 - if( (!this.data.requestData || this.data.requestData.length==0) && (!this.data.service_data || this.data.service_data.length==0)) { 211 + if ((!this.data.requestData || this.data.requestData.length == 0) && (!this.data.service_data || this.data.service_data.length == 0)) {
201 setTimeout(function () { 212 setTimeout(function () {
202 var goods_list = th.selectComponent("#goods_list"); //组件的id 213 var goods_list = th.selectComponent("#goods_list"); //组件的id
203 - if(goods_list){ 214 + if (goods_list) {
204 goods_list.init(); 215 goods_list.init();
205 goods_list.get_list(); 216 goods_list.get_list();
206 } 217 }
207 }, 800) 218 }, 800)
208 } 219 }
209 }, 220 },
210 -  
211 - //-----真的获取购物车--------  
212 - get_cart: function() { 221 +
  222 + //-----真的获取购物车--------
  223 + get_cart: function () {
213 var th = this; 224 var th = this;
214 th.data.in_zhact_gdmap={}; 225 th.data.in_zhact_gdmap={};
215 th.data.ladder_map={}; 226 th.data.ladder_map={};
216 -  
217 var rd = Math.random().toString(36).substr(2, 15); 227 var rd = Math.random().toString(36).substr(2, 15);
218 - var user_id=getApp().globalData.userInfo.user_id; 228 + var user_id = getApp().globalData.userInfo.user_id;
219 getApp().request.get("/api/weshop/cart/list", { 229 getApp().request.get("/api/weshop/cart/list", {
220 data: { 230 data: {
221 user_id: app.globalData.user_id, 231 user_id: app.globalData.user_id,
222 rd: rd, 232 rd: rd,
223 store_id: oo.stoid, 233 store_id: oo.stoid,
224 pageSize: 600, 234 pageSize: 600,
225 - state:0 235 + state: 0
226 }, 236 },
227 - success:async function(su) {  
228 - console.log(su,10000); 237 + success: async function (su) {
  238 + console.log(su, 10000);
229 //按门店分类的数组 239 //按门店分类的数组
230 var arr = new Array(), carr = su.data.data.pageData; 240 var arr = new Array(), carr = su.data.data.pageData;
231 var all_num = 0; 241 var all_num = 0;
232 242
233 - if(carr && carr.length>0) {  
234 - var g_arr=[]; 243 + if (carr && carr.length > 0) {
  244 + var g_arr = [];
235 for (var i = 0; i < carr.length; i++) { 245 for (var i = 0; i < carr.length; i++) {
236 - if(g_arr.length==0) g_arr.push(carr[i].goods_id);  
237 - else{  
238 - var ind=g_arr.findIndex(function (ele) {  
239 - return ele.goods_id==carr[i].goods_id  
240 - })  
241 - if(ind>-1) continue;  
242 - g_arr.push(carr[i].goods_id)  
243 - } 246 + if (g_arr.length == 0) g_arr.push(carr[i].goods_id);
  247 + else {
  248 + var ind = g_arr.findIndex(function (ele) {
  249 + return ele.goods_id == carr[i].goods_id
  250 + })
  251 + if (ind > -1) continue;
  252 + g_arr.push(carr[i].goods_id)
  253 + }
244 } 254 }
245 255
246 - var by_map=null; 256 + var by_map = null;
247 //--要获得商品,该用户买了多少件,同步应用-- 257 //--要获得商品,该用户买了多少件,同步应用--
248 await getApp().request.promiseGet("/api/weshop/ordergoods/listUserBuyGoodsNum", { 258 await getApp().request.promiseGet("/api/weshop/ordergoods/listUserBuyGoodsNum", {
249 data: { 259 data: {
@@ -253,11 +263,11 @@ Page({ @@ -253,11 +263,11 @@ Page({
253 263
254 }, 264 },
255 }).then(res => { 265 }).then(res => {
256 - if(res.data.code==0 && res.data.data && res.data.data.length>0){  
257 - by_map={};  
258 - for(let i in res.data.data){  
259 - let item=res.data.data[i];  
260 - by_map[item.goods_id]=item; 266 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  267 + by_map = {};
  268 + for (let i in res.data.data) {
  269 + let item = res.data.data[i];
  270 + by_map[item.goods_id] = item;
261 } 271 }
262 } 272 }
263 }) 273 })
@@ -265,11 +275,10 @@ Page({ @@ -265,11 +275,10 @@ Page({
265 for (var i = 0; i < carr.length; i++) { 275 for (var i = 0; i < carr.length; i++) {
266 var item = carr[i]; 276 var item = carr[i];
267 var good = item; 277 var good = item;
268 - if(item.is_gift){ 278 + if (item.is_gift) {
269 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 279 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
270 getApp().request.delete(url, { 280 getApp().request.delete(url, {
271 - success: function (t) {  
272 - } 281 + success: function (t) {}
273 }); 282 });
274 //商品已经下架 283 //商品已经下架
275 continue; 284 continue;
@@ -280,77 +289,92 @@ Page({ @@ -280,77 +289,92 @@ Page({
280 if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) { 289 if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) {
281 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 290 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
282 getApp().request.delete(url, { 291 getApp().request.delete(url, {
283 - success: function (t) {  
284 - } 292 + success: function (t) {}
285 }); 293 });
286 //商品已经下架 294 //商品已经下架
287 continue; 295 continue;
288 } 296 }
289 - var goodsbuynum=0,promgoodsbuynum=0,limit=0;  
290 - if(by_map && by_map[good.goods_id]){  
291 - goodsbuynum=by_map[good.goods_id].goodsbuynum;  
292 - promgoodsbuynum=by_map[good.goods_id].promgoodsbuynum; 297 + var goodsbuynum = 0,
  298 + promgoodsbuynum = 0,
  299 + limit = 0;
  300 + if (by_map && by_map[good.goods_id]) {
  301 + goodsbuynum = by_map[good.goods_id].goodsbuynum;
  302 + promgoodsbuynum = by_map[good.goods_id].promgoodsbuynum;
293 } 303 }
294 304
295 - limit=good.viplimited; 305 + limit = good.viplimited;
296 //判断商品的限购 306 //判断商品的限购
297 - if(item.goods_num+goodsbuynum>limit && limit>0){  
298 - var cbuy=limit-goodsbuynum;  
299 - if(cbuy<=0){ 307 + if (item.goods_num + goodsbuynum > limit && limit > 0) {
  308 + var cbuy = limit - goodsbuynum;
  309 + if (cbuy <= 0) {
300 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 310 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
301 a.delete(url, {}); 311 a.delete(url, {});
302 continue; 312 continue;
303 } 313 }
304 //-- 购物车更新 -- 314 //-- 购物车更新 --
305 - var updata1={id: item.id,goods_num:cbuy,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id }; 315 + var updata1 = {
  316 + id: item.id,
  317 + goods_num: cbuy,
  318 + store_id: os.stoid,
  319 + user_id: getApp().globalData.userInfo.user_id
  320 + };
306 getApp().request.put("/api/weshop/cart/update", { 321 getApp().request.put("/api/weshop/cart/update", {
307 data: updata1, 322 data: updata1,
308 }) 323 })
309 - item.goods_num=cbuy; 324 + item.goods_num = cbuy;
310 } 325 }
311 326
312 //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 327 //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着
313 if (item.prom_type == 1) { 328 if (item.prom_type == 1) {
314 var prom = null; 329 var prom = null;
315 var now = ut.gettimestamp(); 330 var now = ut.gettimestamp();
316 - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid +'/'+user_id+ "/" + item.prom_id, {}).then(res => {  
317 - if (res.data.code == 0){ 331 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => {
  332 + if (res.data.code == 0) {
318 prom = res.data.data; 333 prom = res.data.data;
319 - prom.price=prom.user_price; 334 + prom.price = prom.user_price;
320 } 335 }
321 }) 336 })
322 //---如果互动都已经过期,或者还未开始,或者无活动 337 //---如果互动都已经过期,或者还未开始,或者无活动
323 if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { 338 if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) {
324 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 339 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
325 a.delete(url, { 340 a.delete(url, {
326 - success: function (t) {  
327 - } 341 + success: function (t) {}
328 }); 342 });
329 //商品已经下架 343 //商品已经下架
330 continue; 344 continue;
331 } 345 }
332 346
333 //判断秒杀的限购 347 //判断秒杀的限购
334 - if(item.goods_num+promgoodsbuynum>prom.buy_limit && prom.buy_limit>0){  
335 - var cbuy=prom.buy_limit-promgoodsbuynum;  
336 - if(cbuy<=0){ 348 + if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) {
  349 + var cbuy = prom.buy_limit - promgoodsbuynum;
  350 + if (cbuy <= 0) {
337 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 351 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
338 a.delete(url, {}); 352 a.delete(url, {});
339 continue; 353 continue;
340 } 354 }
341 //-- 购物车更新 -- 355 //-- 购物车更新 --
342 - var updata1={id: item.id,goods_num:cbuy,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id }; 356 + var updata1 = {
  357 + id: item.id,
  358 + goods_num: cbuy,
  359 + store_id: os.stoid,
  360 + user_id: getApp().globalData.userInfo.user_id
  361 + };
343 getApp().request.put("/api/weshop/cart/update", { 362 getApp().request.put("/api/weshop/cart/update", {
344 data: updata1, 363 data: updata1,
345 }) 364 })
346 - item.goods_num=cbuy; 365 + item.goods_num = cbuy;
347 } 366 }
348 367
349 //价格不对,就要更新一下 368 //价格不对,就要更新一下
350 - if(good.goods_price!=prom.price){  
351 - good.goods_price=prom.price; 369 + if (good.goods_price != prom.price) {
  370 + good.goods_price = prom.price;
352 //-- 购物车更新秒杀价格 -- 371 //-- 购物车更新秒杀价格 --
353 - var updata1={id: item.id,goods_price:prom.price,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id }; 372 + var updata1 = {
  373 + id: item.id,
  374 + goods_price: prom.price,
  375 + store_id: os.stoid,
  376 + user_id: getApp().globalData.userInfo.user_id
  377 + };
354 getApp().request.put("/api/weshop/cart/update", { 378 getApp().request.put("/api/weshop/cart/update", {
355 data: updata1, 379 data: updata1,
356 }) 380 })
@@ -371,13 +395,12 @@ Page({ @@ -371,13 +395,12 @@ Page({
371 let item=res.data.data[i]; 395 let item=res.data.data[i];
372 if(item.prom_type==3) { 396 if(item.prom_type==3) {
373 is_g_prom=1; break; 397 is_g_prom=1; break;
374 -  
375 } 398 }
376 } 399 }
377 } 400 }
378 }) 401 })
379 402
380 - if(is_g_prom){ 403 + if (is_g_prom) {
381 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { 404 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => {
382 if (res.data.code == 0) { 405 if (res.data.code == 0) {
383 var r_data = res.data.data; 406 var r_data = res.data.data;
@@ -386,9 +409,9 @@ Page({ @@ -386,9 +409,9 @@ Page({
386 getApp().request.delete(url, {}); 409 getApp().request.delete(url, {});
387 //商品已经无活动 410 //商品已经无活动
388 isok = 0; 411 isok = 0;
389 - }else{ 412 + } else {
390 //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 413 //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
391 - if(item.prom_id!=r_data.promGoodsLists[0].prom_id ){ 414 + if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
392 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 415 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
393 getApp().request.delete(url, {}); 416 getApp().request.delete(url, {});
394 //商品已经下架 417 //商品已经下架
@@ -404,7 +427,7 @@ Page({ @@ -404,7 +427,7 @@ Page({
404 } 427 }
405 }) 428 })
406 429
407 - }else{ 430 + } else {
408 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + item.goods_id, {}).then(res => { 431 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + item.goods_id, {}).then(res => {
409 if (res.data.code == 0) { 432 if (res.data.code == 0) {
410 var r_data = res.data.data; 433 var r_data = res.data.data;
@@ -413,9 +436,9 @@ Page({ @@ -413,9 +436,9 @@ Page({
413 getApp().request.delete(url, {}); 436 getApp().request.delete(url, {});
414 //商品已经无活动 437 //商品已经无活动
415 isok = 0; 438 isok = 0;
416 - }else{ 439 + } else {
417 //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 440 //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
418 - if(item.prom_id!=r_data.promGoodsLists[0].prom_id ){ 441 + if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
419 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 442 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
420 getApp().request.delete(url, {}); 443 getApp().request.delete(url, {});
421 //商品已经下架 444 //商品已经下架
@@ -434,47 +457,47 @@ Page({ @@ -434,47 +457,47 @@ Page({
434 } 457 }
435 458
436 if (!isok) continue; 459 if (!isok) continue;
437 -  
438 } 460 }
439 else if (item.prom_type == 7) { 461 else if (item.prom_type == 7) {
440 if(!th.data.zuhe_map[item.prom_id]){ 462 if(!th.data.zuhe_map[item.prom_id]){
  463 +
441 //如果有组合购 464 //如果有组合购
442 var isok = 1; 465 var isok = 1;
443 - var is_flag=1;  
444 - var act=null;  
445 - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+item.prom_id+"/"+getApp().globalData.userInfo.user_id; 466 + var is_flag = 1;
  467 + var act = null;
  468 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id;
446 await getApp().request.promiseGet(url, {}).then(res => { 469 await getApp().request.promiseGet(url, {}).then(res => {
447 - console.log(res,1000);  
448 - if(res.data.code==0 && res.data.data){  
449 - if(res.data.data.is_show!=1){  
450 - isok=0;  
451 - }  
452 - //如果活动已经结束  
453 - if(res.data.data.is_end==1){  
454 - isok=0;  
455 - }  
456 - //已经结束  
457 - if(ut.gettimestamp()>res.data.data.end_time){  
458 - isok=0;  
459 - }  
460 - //还未开始  
461 - if(ut.gettimestamp()<res.data.data.start_time){  
462 - isok=0;  
463 - }  
464 - act=res.data.data;  
465 -  
466 - }else{  
467 - //未找到商品的活动  
468 - is_flag = 0;  
469 - } 470 + console.log(res, 1000);
  471 + if (res.data.code == 0 && res.data.data) {
  472 + if (res.data.data.is_show != 1) {
  473 + isok = 0;
  474 + }
  475 + //如果活动已经结束
  476 + if (res.data.data.is_end == 1) {
  477 + isok = 0;
  478 + }
  479 + //已经结束
  480 + if (ut.gettimestamp() > res.data.data.end_time) {
  481 + isok = 0;
  482 + }
  483 + //还未开始
  484 + if (ut.gettimestamp() < res.data.data.start_time) {
  485 + isok = 0;
  486 + }
  487 + act = res.data.data;
  488 +
  489 + } else {
  490 + //未找到商品的活动
  491 + is_flag = 0;
  492 + }
470 }) 493 })
471 - if (!isok){ 494 + if (!isok) {
472 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 495 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
473 getApp().request.delete(url, {}); 496 getApp().request.delete(url, {});
474 - th.data.zuhe_map[item.prom_id]=-1; 497 + th.data.zuhe_map[item.prom_id] = -1;
475 continue; 498 continue;
476 } 499 }
477 - th.data.zuhe_map[item.prom_id]=act; 500 + th.data.zuhe_map[item.prom_id] = act;
478 var url1 = "/api/weshop/prom/zhbuyGoods/page"; 501 var url1 = "/api/weshop/prom/zhbuyGoods/page";
479 var req_data = { 502 var req_data = {
480 page: 1, 503 page: 1,
@@ -485,37 +508,37 @@ Page({ @@ -485,37 +508,37 @@ Page({
485 await getApp().request.promiseGet(url1, { 508 await getApp().request.promiseGet(url1, {
486 data: req_data 509 data: req_data
487 }).then(res => { 510 }).then(res => {
488 - console.log(res,2000); 511 + console.log(res, 2000);
489 if (ut.ajax_ok(res)) { 512 if (ut.ajax_ok(res)) {
490 var gdlist = res.data.data.pageData; 513 var gdlist = res.data.data.pageData;
491 - gdlist.forEach(i=>{  
492 - if(item.goods_id==i.goods_id&&!is_flag){  
493 - item.prom_type=0;  
494 - item.prom_type1=0;  
495 - item.prom_id=0;  
496 - item.prom_id1=0 514 + gdlist.forEach(i => {
  515 + if (item.goods_id == i.goods_id && !is_flag) {
  516 + item.prom_type = 0;
  517 + item.prom_type1 = 0;
  518 + item.prom_id = 0;
  519 + item.prom_id1 = 0
497 } 520 }
498 }) 521 })
499 - th.data.zuhe_map_good[item.prom_id]=gdlist; 522 + th.data.zuhe_map_good[item.prom_id] = gdlist;
500 } 523 }
501 }) 524 })
502 } 525 }
503 526
504 - if(th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id]!=-1 ){  
505 - var gdlist=th.data.zuhe_map_good[item.prom_id];  
506 - var t_item=gdlist.find(function (ele) {  
507 - return ele.goods_id==item.goods_id 527 + if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) {
  528 + var gdlist = th.data.zuhe_map_good[item.prom_id];
  529 + var t_item = gdlist.find(function (ele) {
  530 + return ele.goods_id == item.goods_id
508 }) 531 })
509 - if(!t_item){ 532 + if (!t_item) {
510 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 533 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
511 getApp().request.delete(url, {}); 534 getApp().request.delete(url, {});
512 - th.data.zuhe_map[item.prom_id]=-1; 535 + th.data.zuhe_map[item.prom_id] = -1;
513 continue; 536 continue;
514 } 537 }
515 - item.buyqty=t_item.buyqty;  
516 - item.zh_b_num=promgoodsbuynum;  
517 - item.act=th.data.zuhe_map[item.prom_id];  
518 - }//else{ 538 + item.buyqty = t_item.buyqty;
  539 + item.zh_b_num = promgoodsbuynum;
  540 + item.act = th.data.zuhe_map[item.prom_id];
  541 + } //else{
519 // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 542 // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
520 // getApp().request.delete(url, {}); 543 // getApp().request.delete(url, {});
521 // th.data.zuhe_map[item.prom_id]=-1; 544 // th.data.zuhe_map[item.prom_id]=-1;
@@ -524,7 +547,7 @@ Page({ @@ -524,7 +547,7 @@ Page({
524 } 547 }
525 else if (item.prom_type == 10) { 548 else if (item.prom_type == 10) {
526 if(!th.data.ladder_map[item.prom_id]){ 549 if(!th.data.ladder_map[item.prom_id]){
527 - //如果有组合 550 + //如果有阶梯
528 var isok = 1; 551 var isok = 1;
529 var is_flag=1; 552 var is_flag=1;
530 var act=null; 553 var act=null;
@@ -585,6 +608,7 @@ Page({ @@ -585,6 +608,7 @@ Page({
585 } 608 }
586 609
587 else if(item.prom_type == 0) { 610 else if(item.prom_type == 0) {
  611 +
588 //如果有优惠活动,要更新活动 612 //如果有优惠活动,要更新活动
589 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { 613 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => {
590 if (res.data.code == 0) { 614 if (res.data.code == 0) {
@@ -592,7 +616,12 @@ Page({ @@ -592,7 +616,12 @@ Page({
592 if (r_data.promGoodsLists) { 616 if (r_data.promGoodsLists) {
593 var url = '/api/weshop/cart/update'; 617 var url = '/api/weshop/cart/update';
594 getApp().request.put(url, { 618 getApp().request.put(url, {
595 - data:{id:item.id,store_id:oo.stoid,prom_type:3,prom_id:r_data.promGoodsLists[0].prom_id} 619 + data: {
  620 + id: item.id,
  621 + store_id: oo.stoid,
  622 + prom_type: 3,
  623 + prom_id: r_data.promGoodsLists[0].prom_id
  624 + }
596 }); 625 });
597 item.prom_type=3; 626 item.prom_type=3;
598 item.prom_id=r_data.promGoodsLists[0].prom_id; 627 item.prom_id=r_data.promGoodsLists[0].prom_id;
@@ -681,19 +710,27 @@ Page({ @@ -681,19 +710,27 @@ Page({
681 all_num += item.goods_num; 710 all_num += item.goods_num;
682 item.original_img = oo.imghost + item.original_img; 711 item.original_img = oo.imghost + item.original_img;
683 item.selected = 0; 712 item.selected = 0;
684 - item.erpwareid=good.erpwareid; //要同步下线商品的id  
685 - item.shop_price=good.shop_price; //要同步下线商品的id 713 + item.erpwareid = good.erpwareid; //要同步下线商品的id
  714 + item.shop_price = good.shop_price; //要同步下线商品的id
686 715
687 //当商品要计算等级价的售 716 //当商品要计算等级价的售
688 - if(item.prom_type == 0 || item.prom_type == 3 || item.prom_type == 5 || item.prom_type == 7){  
689 - if(th.data.card_field && good[th.data.card_field]){  
690 - item.goods_price=good[th.data.card_field]; //要同步下线商品的id  
691 - }else{  
692 - item.goods_price=good.shop_price; 717 + if (item.prom_type == 0 || item.prom_type == 3 || item.prom_type == 5 || item.prom_type == 7) {
  718 + if (th.data.card_field && good[th.data.card_field]) {
  719 + item.goods_price = good[th.data.card_field]; //要同步下线商品的id
  720 + } else {
  721 + item.goods_price = good.shop_price;
693 } 722 }
694 723
695 - var t={id:item.id,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id,goods_price:item.goods_price}  
696 - getApp().request.put("/api/weshop/cart/update", {isShowLoading:0,data: t,}) 724 + var t = {
  725 + id: item.id,
  726 + store_id: os.stoid,
  727 + user_id: getApp().globalData.userInfo.user_id,
  728 + goods_price: item.goods_price
  729 + }
  730 + getApp().request.put("/api/weshop/cart/update", {
  731 + isShowLoading: 0,
  732 + data: t,
  733 + })
697 734
698 } 735 }
699 736
@@ -733,20 +770,20 @@ Page({ @@ -733,20 +770,20 @@ Page({
733 } 770 }
734 } 771 }
735 772
736 - if(th.data.is_open_offline && th.data.is_open_offline>0 && th.data.sales_rules==2){  
737 - //-- 此时要实时更新线下取价价格 --  
738 - for(var i=0;i<arr.length;i++){  
739 - //每个门店都去看下线下取价  
740 - var list=arr[i];  
741 - await th.set_offline(list);  
742 - }  
743 - }else{ 773 + if (th.data.is_open_offline && th.data.is_open_offline > 0 && th.data.sales_rules == 2) {
  774 + //-- 此时要实时更新线下取价价格 --
  775 + for (var i = 0; i < arr.length; i++) {
  776 + //每个门店都去看下线下取价
  777 + var list = arr[i];
  778 + await th.set_offline(list);
  779 + }
  780 + } else {
744 //-- 此时要实时更新线下取价价格 -- 781 //-- 此时要实时更新线下取价价格 --
745 - for(var ij in arr){ 782 + for (var ij in arr) {
746 //每个门店都去看下线下取价 783 //每个门店都去看下线下取价
747 - var list=arr[ij];  
748 - for(var i in list.goods){  
749 - list.goods[i].offline_price=0 784 + var list = arr[ij];
  785 + for (var i in list.goods) {
  786 + list.goods[i].offline_price = 0
750 } 787 }
751 } 788 }
752 } 789 }
@@ -779,7 +816,7 @@ Page({ @@ -779,7 +816,7 @@ Page({
779 }, 816 },
780 817
781 //-----真的获取购物车-------- 818 //-----真的获取购物车--------
782 - get_ser_cart: function() { 819 + get_ser_cart: function () {
783 var th = this; 820 var th = this;
784 var rd = Math.random().toString(36).substr(2, 15); 821 var rd = Math.random().toString(36).substr(2, 15);
785 getApp().request.get("/api/weshop/cartService/page", { 822 getApp().request.get("/api/weshop/cartService/page", {
@@ -787,27 +824,26 @@ Page({ @@ -787,27 +824,26 @@ Page({
787 user_id: app.globalData.user_id, 824 user_id: app.globalData.user_id,
788 rd: rd, 825 rd: rd,
789 store_id: oo.stoid, 826 store_id: oo.stoid,
790 - pageSize: 600, 827 + pageSize: 600,
791 }, 828 },
792 - success:async function(su) { 829 + success: async function (su) {
793 //按门店分类的数组 830 //按门店分类的数组
794 var arr = new Array(), 831 var arr = new Array(),
795 carr = su.data.data.pageData; 832 carr = su.data.data.pageData;
796 var all_num = 0; 833 var all_num = 0;
797 -  
798 - if(carr && carr.length>0) { 834 +
  835 + if (carr && carr.length > 0) {
799 for (var i = 0; i < carr.length; i++) { 836 for (var i = 0; i < carr.length; i++) {
800 var item = carr[i]; 837 var item = carr[i];
801 var good = null; 838 var good = null;
802 - 839 +
803 await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then(res => { 840 await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then(res => {
804 good = res.data.data; 841 good = res.data.data;
805 }) 842 })
806 - if(!good){ 843 + if (!good) {
807 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 844 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
808 getApp().request.delete(url, { 845 getApp().request.delete(url, {
809 - success: function (t) {  
810 - } 846 + success: function (t) {}
811 }); 847 });
812 continue; 848 continue;
813 } 849 }
@@ -816,8 +852,7 @@ Page({ @@ -816,8 +852,7 @@ Page({
816 if (good.is_show == 0) { 852 if (good.is_show == 0) {
817 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 853 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
818 getApp().request.delete(url, { 854 getApp().request.delete(url, {
819 - success: function (t) {  
820 - } 855 + success: function (t) {}
821 }); 856 });
822 //商品已经下架 857 //商品已经下架
823 continue; 858 continue;
@@ -826,7 +861,7 @@ Page({ @@ -826,7 +861,7 @@ Page({
826 all_num += item.goods_num; 861 all_num += item.goods_num;
827 item.img_url = oo.imghost + good.imgUrl; 862 item.img_url = oo.imghost + good.imgUrl;
828 item.selected = 0; 863 item.selected = 0;
829 - 864 +
830 865
831 var pcid = item.pick_id; 866 var pcid = item.pick_id;
832 var find = 0; 867 var find = 0;
@@ -840,7 +875,7 @@ Page({ @@ -840,7 +875,7 @@ Page({
840 } 875 }
841 } 876 }
842 } 877 }
843 - 878 +
844 //------如果没有找到----- 879 //------如果没有找到-----
845 if (find == 0) { 880 if (find == 0) {
846 var pikname = ''; 881 var pikname = '';
@@ -863,75 +898,74 @@ Page({ @@ -863,75 +898,74 @@ Page({
863 } 898 }
864 } 899 }
865 } 900 }
866 -  
867 - // console.log('BBBBBB', all_num); 901 +
  902 + // console.log('BBBBBB', all_num);
868 th.setData({ 903 th.setData({
869 - service_data: arr,  
870 - all_num2: all_num,  
871 - is_edit: 0  
872 - }),  
873 - th.doCheckAll(), wx.stopPullDownRefresh();  
874 - 904 + service_data: arr,
  905 + all_num2: all_num,
  906 + is_edit: 0
  907 + }),
  908 + th.doCheckAll(), wx.stopPullDownRefresh();
  909 +
875 } 910 }
876 }); 911 });
877 }, 912 },
878 -  
879 - 913 +
  914 +
880 //设置莫个门店的所有线下价格 915 //设置莫个门店的所有线下价格
881 - async set_offline(list){  
882 - var th=this;  
883 - var userInfo=getApp().globalData.userInfo; 916 + async set_offline(list) {
  917 + var th = this;
  918 + var userInfo = getApp().globalData.userInfo;
884 //组织一下商品,然后进行线下价格的赋值 919 //组织一下商品,然后进行线下价格的赋值
885 - var wlist="";  
886 - for(var i in list.goods){ 920 + var wlist = "";
  921 + for (var i in list.goods) {
887 //如果商品有促销活动 922 //如果商品有促销活动
888 - if(list.goods[i].prom_type>0 && list.goods[i].prom_type!=7) continue;  
889 - wlist+= encodeURIComponent(list.goods[i].erpwareid)+","; 923 + if (list.goods[i].prom_type > 0 && list.goods[i].prom_type != 7) continue;
  924 + wlist += encodeURIComponent(list.goods[i].erpwareid) + ",";
890 } 925 }
891 - wlist=ut.sub_last(wlist); 926 + wlist = ut.sub_last(wlist);
892 //调用接口进行赋值 927 //调用接口进行赋值
893 - await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {  
894 - data:{  
895 - store_id:os.stoid,  
896 - PickupId:list.pid,  
897 - WareIds:wlist,  
898 - VIPId:encodeURIComponent(userInfo.erpvipid) 928 + await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
  929 + data: {
  930 + store_id: os.stoid,
  931 + PickupId: list.pid,
  932 + WareIds: wlist,
  933 + VIPId: encodeURIComponent(userInfo.erpvipid)
899 } 934 }
900 }).then(res => { 935 }).then(res => {
901 - if(res.data.code==0 && res.data.data && res.data.data.length>0){  
902 - for(var e in res.data.data){  
903 - th.set_cart_offline_price(res.data.data[e],list.goods); 936 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  937 + for (var e in res.data.data) {
  938 + th.set_cart_offline_price(res.data.data[e], list.goods);
904 } 939 }
905 } 940 }
906 }) 941 })
907 }, 942 },
908 943
909 //-- 设置购物车线下 -- 944 //-- 设置购物车线下 --
910 - set_cart_offline_price:function(data,glist)  
911 - {  
912 - for(var i in glist) {  
913 - if(glist[i].erpwareid==data.WareId && (glist[i].prom_type==0 || glist[i].prom_type==7)){  
914 - if(glist[i].goods_price>=data.WarePrice){  
915 - glist[i].is_offline=1;  
916 - glist[i].offline_price=data.WarePrice;  
917 - glist[i].pricing_type=data.PriceType; 945 + set_cart_offline_price: function (data, glist) {
  946 + for (var i in glist) {
  947 + if (glist[i].erpwareid == data.WareId && (glist[i].prom_type == 0 || glist[i].prom_type == 7)) {
  948 + if (glist[i].goods_price >= data.WarePrice) {
  949 + glist[i].is_offline = 1;
  950 + glist[i].offline_price = data.WarePrice;
  951 + glist[i].pricing_type = data.PriceType;
918 } 952 }
919 } 953 }
920 } 954 }
921 }, 955 },
922 //删除商品 956 //删除商品
923 - delete_th_item: function(t) { 957 + delete_th_item: function (t) {
924 var e = this; 958 var e = this;
925 var a = rq; 959 var a = rq;
926 console.log(a); 960 console.log(a);
927 wx.showModal({ 961 wx.showModal({
928 title: "确定删除?", 962 title: "确定删除?",
929 - success: function(s) { 963 + success: function (s) {
930 if (s.confirm) { 964 if (s.confirm) {
931 var r = t.currentTarget.dataset.cartid; 965 var r = t.currentTarget.dataset.cartid;
932 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + r; 966 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + r;
933 a.delete(url, { 967 a.delete(url, {
934 - success: function(t) { 968 + success: function (t) {
935 e.getCardList(); 969 e.getCardList();
936 } 970 }
937 }); 971 });
@@ -941,19 +975,19 @@ Page({ @@ -941,19 +975,19 @@ Page({
941 }, 975 },
942 976
943 //-----------------点击输入修改商品数量--------------- 977 //-----------------点击输入修改商品数量---------------
944 - valueToNum: function(t) {  
945 - if(!this.data.is_load) return false; 978 + valueToNum: function (t) {
  979 + if (!this.data.is_load) return false;
946 //控制住,避免事件响应冲突,只有input有输入的时候,才刷新 980 //控制住,避免事件响应冲突,只有input有输入的时候,才刷新
947 - if(this.data.btn_click){ 981 + if (this.data.btn_click) {
948 return false; 982 return false;
949 } 983 }
950 - this.data.btn_click=1; 984 + this.data.btn_click = 1;
951 985
952 var a = t.currentTarget.dataset.item; 986 var a = t.currentTarget.dataset.item;
953 var b = t.currentTarget.dataset.pitems; 987 var b = t.currentTarget.dataset.pitems;
954 a = this.data.requestData[b].goods[a]; 988 a = this.data.requestData[b].goods[a];
955 var e = a; 989 var e = a;
956 - var th=this; 990 + var th = this;
957 991
958 if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) { 992 if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
959 var s = { 993 var s = {
@@ -967,24 +1001,24 @@ Page({ @@ -967,24 +1001,24 @@ Page({
967 }, 1001 },
968 1002
969 //-------------加数量--------------------- 1003 //-------------加数量---------------------
970 - addNum: function(t) {  
971 - if(!this.data.is_load) return false; 1004 + addNum: function (t) {
  1005 + if (!this.data.is_load) return false;
972 if (this.data.up_dating == 1) return false; 1006 if (this.data.up_dating == 1) return false;
973 this.data.up_dating = 1; 1007 this.data.up_dating = 1;
974 1008
975 var a = t.currentTarget.dataset.item; 1009 var a = t.currentTarget.dataset.item;
976 var b = t.currentTarget.dataset.pitems; 1010 var b = t.currentTarget.dataset.pitems;
977 a = this.data.requestData[b].goods[a]; 1011 a = this.data.requestData[b].goods[a];
978 -  
979 - console.log('add+');  
980 - if (a.goods_num<a.store_count) { 1012 +
  1013 + console.log('add+');
  1014 + if (a.goods_num < a.store_count) {
981 var e = { 1015 var e = {
982 goods_num: a.goods_num + 1, 1016 goods_num: a.goods_num + 1,
983 id: a.id, 1017 id: a.id,
984 goods_id: a.goods_id, 1018 goods_id: a.goods_id,
985 store_id: oo.stoid 1019 store_id: oo.stoid
986 }; 1020 };
987 - // console.log('goods_num', e.goods_num); 1021 + // console.log('goods_num', e.goods_num);
988 this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); 1022 this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
989 } else { 1023 } else {
990 wx.showModal({ 1024 wx.showModal({
@@ -995,17 +1029,17 @@ Page({ @@ -995,17 +1029,17 @@ Page({
995 } 1029 }
996 }, 1030 },
997 //-------------减数量--------------------- 1031 //-------------减数量---------------------
998 - subNum: function(t) {  
999 - if(!this.data.is_load) return false; 1032 + subNum: function (t) {
  1033 + if (!this.data.is_load) return false;
1000 if (this.data.up_dating == 1) return false; 1034 if (this.data.up_dating == 1) return false;
1001 this.data.up_dating = 1; 1035 this.data.up_dating = 1;
1002 1036
1003 var a = t.currentTarget.dataset.item; 1037 var a = t.currentTarget.dataset.item;
1004 var b = t.currentTarget.dataset.pitems; 1038 var b = t.currentTarget.dataset.pitems;
1005 a = this.data.requestData[b].goods[a]; 1039 a = this.data.requestData[b].goods[a];
1006 - this.data.btn_click=1; 1040 + this.data.btn_click = 1;
1007 1041
1008 - if (a.goods_num - 1 < 0){ 1042 + if (a.goods_num - 1 < 0) {
1009 this.data.up_dating = 0; 1043 this.data.up_dating = 0;
1010 return false; 1044 return false;
1011 } 1045 }
@@ -1020,91 +1054,92 @@ Page({ @@ -1020,91 +1054,92 @@ Page({
1020 this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); 1054 this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
1021 } 1055 }
1022 }, 1056 },
1023 -  
1024 -  
1025 - //-----------------点击输入修改商品数量---------------  
1026 - valueToNum_ser: function(t) {  
1027 - if(!this.data.is_load) return false;  
1028 - //控制住,避免事件响应冲突,只有input有输入的时候,才刷新  
1029 - if(this.data.btn_click){  
1030 - return false;  
1031 - }  
1032 - this.data.btn_click=1;  
1033 -  
1034 - var a = t.currentTarget.dataset.item;  
1035 - var b = t.currentTarget.dataset.pitems;  
1036 - a = this.data.service_data[b].goods[a];  
1037 - var e = a;  
1038 - var th=this;  
1039 -  
1040 - if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {  
1041 - var s = {  
1042 - goods_num: a,  
1043 - goods_id: e.goods_id,  
1044 - id: e.id,  
1045 - store_id: oo.stoid  
1046 - };  
1047 - th.postCardList_ser(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);  
1048 - }  
1049 - },  
1050 - //-------------加数量---------------------  
1051 - addNum_ser: function(t) {  
1052 - if(!this.data.is_load) return false;  
1053 - if (this.data.up_dating == 1) return false;  
1054 - this.data.up_dating = 1;  
1055 -  
1056 - var a = t.currentTarget.dataset.item;  
1057 - var b = t.currentTarget.dataset.pitems;  
1058 - a = this.data.service_data[b].goods[a];  
1059 -  
1060 - var e = {  
1061 - goods_num: a.goods_num + 1,  
1062 - id: a.id,  
1063 - goods_id: a.goods_id,  
1064 - store_id: oo.stoid  
1065 - };  
1066 - // this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);  
1067 -  
1068 - },  
1069 - //-------------减数量---------------------  
1070 - subNum_ser: function(t) {  
1071 - if(!this.data.is_load) return false;  
1072 - if (this.data.up_dating == 1) return false;  
1073 - this.data.up_dating = 1;  
1074 -  
1075 - var a = t.currentTarget.dataset.item;  
1076 - var b = t.currentTarget.dataset.pitems;  
1077 - a = this.data.service_data[b].goods[a];  
1078 - this.data.btn_click=1;  
1079 -  
1080 - if (a.goods_num - 1 < 0){  
1081 - this.data.up_dating = 0;  
1082 - return false;  
1083 - }  
1084 -  
1085 - if (1 != a.goods_num) {  
1086 - var e = {  
1087 - goods_num: a.goods_num - 1,  
1088 - id: a.id,  
1089 - goods_id: a.goods_id,  
1090 - store_id: oo.stoid  
1091 - };  
1092 - this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);  
1093 - }  
1094 - },  
1095 -  
1096 -  
1097 - //---------------全选,全选的时候要判断是否门店的匹配方式一致--------------  
1098 - checkAll: function() {  
1099 - var e = this,th=this, 1057 +
  1058 +
  1059 + //-----------------点击输入修改商品数量---------------
  1060 + valueToNum_ser: function (t) {
  1061 + if (!this.data.is_load) return false;
  1062 + //控制住,避免事件响应冲突,只有input有输入的时候,才刷新
  1063 + if (this.data.btn_click) {
  1064 + return false;
  1065 + }
  1066 + this.data.btn_click = 1;
  1067 +
  1068 + var a = t.currentTarget.dataset.item;
  1069 + var b = t.currentTarget.dataset.pitems;
  1070 + a = this.data.service_data[b].goods[a];
  1071 + var e = a;
  1072 + var th = this;
  1073 +
  1074 + if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
  1075 + var s = {
  1076 + goods_num: a,
  1077 + goods_id: e.goods_id,
  1078 + id: e.id,
  1079 + store_id: oo.stoid
  1080 + };
  1081 + th.postCardList_ser(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  1082 + }
  1083 + },
  1084 + //-------------加数量---------------------
  1085 + addNum_ser: function (t) {
  1086 + if (!this.data.is_load) return false;
  1087 + if (this.data.up_dating == 1) return false;
  1088 + this.data.up_dating = 1;
  1089 +
  1090 + var a = t.currentTarget.dataset.item;
  1091 + var b = t.currentTarget.dataset.pitems;
  1092 + a = this.data.service_data[b].goods[a];
  1093 +
  1094 + var e = {
  1095 + goods_num: a.goods_num + 1,
  1096 + id: a.id,
  1097 + goods_id: a.goods_id,
  1098 + store_id: oo.stoid
  1099 + };
  1100 + // this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  1101 +
  1102 + },
  1103 + //-------------减数量---------------------
  1104 + subNum_ser: function (t) {
  1105 + if (!this.data.is_load) return false;
  1106 + if (this.data.up_dating == 1) return false;
  1107 + this.data.up_dating = 1;
  1108 +
  1109 + var a = t.currentTarget.dataset.item;
  1110 + var b = t.currentTarget.dataset.pitems;
  1111 + a = this.data.service_data[b].goods[a];
  1112 + this.data.btn_click = 1;
  1113 +
  1114 + if (a.goods_num - 1 < 0) {
  1115 + this.data.up_dating = 0;
  1116 + return false;
  1117 + }
  1118 +
  1119 + if (1 != a.goods_num) {
  1120 + var e = {
  1121 + goods_num: a.goods_num - 1,
  1122 + id: a.id,
  1123 + goods_id: a.goods_id,
  1124 + store_id: oo.stoid
  1125 + };
  1126 + this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  1127 + }
  1128 + },
  1129 +
  1130 +
  1131 + //---------------全选,全选的时候要判断是否门店的匹配方式一致--------------
  1132 + checkAll: function () {
  1133 + var e = this,
  1134 + th = this,
1100 dda = e.data.requestData, 1135 dda = e.data.requestData,
1101 sdda = e.data.service_data, 1136 sdda = e.data.service_data,
1102 tfeel = 0, 1137 tfeel = 0,
1103 t_num = 0, 1138 t_num = 0,
1104 text_arr = ""; 1139 text_arr = "";
1105 1140
1106 - if(e.data.requestData && e.data.requestData.length>0  
1107 - && e.data.service_data && e.data.service_data.length>0){ 1141 + if (e.data.requestData && e.data.requestData.length > 0 &&
  1142 + e.data.service_data && e.data.service_data.length > 0) {
1108 wx.showModal({ 1143 wx.showModal({
1109 title: '提示', 1144 title: '提示',
1110 content: '服务卡项目不能和商品一起选择' 1145 content: '服务卡项目不能和商品一起选择'
@@ -1112,19 +1147,19 @@ Page({ @@ -1112,19 +1147,19 @@ Page({
1112 return false; 1147 return false;
1113 } 1148 }
1114 1149
1115 - this.data.btn_click=1; 1150 + this.data.btn_click = 1;
1116 1151
1117 1152
1118 1153
1119 - var offline_price=0;  
1120 - var offline_num=0;  
1121 - th.data.in_zhact_gdmap={}; 1154 + var offline_price = 0;
  1155 + var offline_num = 0;
  1156 + th.data.in_zhact_gdmap = {};
1122 1157
1123 1158
1124 - if(dda && dda.length>0){ 1159 + if (dda && dda.length > 0) {
1125 for (var i = 0; i < dda.length; i++) { 1160 for (var i = 0; i < dda.length; i++) {
1126 var item = dda[i].goods; 1161 var item = dda[i].goods;
1127 - 1162 +
1128 if (e.data.checkAllToggle) { 1163 if (e.data.checkAllToggle) {
1129 var txt = "requestData[" + i + "].selected"; 1164 var txt = "requestData[" + i + "].selected";
1130 e.setData({ 1165 e.setData({
@@ -1143,6 +1178,7 @@ Page({ @@ -1143,6 +1178,7 @@ Page({
1143 if(obj.prom_type==10) 1178 if(obj.prom_type==10)
1144 ladder_calc.remove_ladder_prom(dda,i,obj); 1179 ladder_calc.remove_ladder_prom(dda,i,obj);
1145 1180
  1181 +
1146 if (fir == 0) { 1182 if (fir == 0) {
1147 fir = item[j].distr_type; 1183 fir = item[j].distr_type;
1148 } else { 1184 } else {
@@ -1160,27 +1196,27 @@ Page({ @@ -1160,27 +1196,27 @@ Page({
1160 if(obj.prom_type==7) zh_calc.add_zhprom(dda,i,obj); 1196 if(obj.prom_type==7) zh_calc.add_zhprom(dda,i,obj);
1161 //加入阶梯促销计算 1197 //加入阶梯促销计算
1162 if(obj.prom_type==10) ladder_calc.add_ladder_prom(dda,i,obj); 1198 if(obj.prom_type==10) ladder_calc.add_ladder_prom(dda,i,obj);
1163 -  
1164 1199
1165 e.setData({ 1200 e.setData({
  1201 +
1166 [txt]: !e.data.checkAllToggle, 1202 [txt]: !e.data.checkAllToggle,
1167 }) 1203 })
1168 - 1204 +
1169 if (!e.data.checkAllToggle) { 1205 if (!e.data.checkAllToggle) {
1170 //组合购的金额要另外算 1206 //组合购的金额要另外算
1171 if(item[j].prom_type!=7 && item[j].prom_type!=10) 1207 if(item[j].prom_type!=7 && item[j].prom_type!=10)
1172 tfeel += item[j].goods_num * item[j].goods_price; 1208 tfeel += item[j].goods_num * item[j].goods_price;
1173 - t_num += item[j].goods_num; 1209 + t_num += item[j].goods_num;
1174 } 1210 }
1175 1211
1176 //-- 如果这个商品是线下取价的时候 -- 1212 //-- 如果这个商品是线下取价的时候 --
1177 - if(item[j].is_offline && item[j].prom_type!=7){  
1178 - offline_price+= (item[j].goods_price-item[j].offline_price)*item[j].goods_num;  
1179 - offline_num+=item[j].goods_num; 1213 + if (item[j].is_offline && item[j].prom_type != 7) {
  1214 + offline_price += (item[j].goods_price - item[j].offline_price) * item[j].goods_num;
  1215 + offline_num += item[j].goods_num;
1180 } 1216 }
1181 1217
1182 - }  
1183 - } 1218 + }
  1219 + }
1184 1220
1185 1221
1186 if (text_arr != "") { 1222 if (text_arr != "") {
@@ -1191,7 +1227,7 @@ Page({ @@ -1191,7 +1227,7 @@ Page({
1191 return false; 1227 return false;
1192 } else { 1228 } else {
1193 1229
1194 - for (var i = 0; i < dda.length; i++) { 1230 + for (var i = 0; i < dda.length; i++) {
1195 1231
1196 if (!e.data.checkAllToggle) { 1232 if (!e.data.checkAllToggle) {
1197 var txt = "requestData[" + i + "].selected"; 1233 var txt = "requestData[" + i + "].selected";
@@ -1200,11 +1236,11 @@ Page({ @@ -1200,11 +1236,11 @@ Page({
1200 }); 1236 });
1201 } 1237 }
1202 1238
1203 - //总的价格,把组合商品的价格拿出来  
1204 - var zh_calc_res=zh_calc.calculate_zh(dda,i,this);  
1205 - tfeel+=zh_calc_res.tfeel;  
1206 - offline_price+=zh_calc_res.offline_price;  
1207 - offline_num+=zh_calc_res.offline_num; 1239 + //总的价格,把组合商品的价格拿出来
  1240 + var zh_calc_res = zh_calc.calculate_zh(dda, i, this);
  1241 + tfeel += zh_calc_res.tfeel;
  1242 + offline_price += zh_calc_res.offline_price;
  1243 + offline_num += zh_calc_res.offline_num;
1208 1244
1209 //总的价格,把阶梯促销的商品的价格拿出来 1245 //总的价格,把阶梯促销的商品的价格拿出来
1210 var ladder_calc_res=ladder_calc.calculate_ladder(dda,i,this); 1246 var ladder_calc_res=ladder_calc.calculate_ladder(dda,i,this);
@@ -1213,24 +1249,24 @@ Page({ @@ -1213,24 +1249,24 @@ Page({
1213 offline_num+=ladder_calc_res.offline_num; 1249 offline_num+=ladder_calc_res.offline_num;
1214 1250
1215 //当有线下取价的时候 1251 //当有线下取价的时候
1216 - if(offline_price){  
1217 - var txt1= "requestData[" + i + "].offline_price";  
1218 - var txt2= "requestData[" + i+ "].offline_num"; 1252 + if (offline_price) {
  1253 + var txt1 = "requestData[" + i + "].offline_price";
  1254 + var txt2 = "requestData[" + i + "].offline_num";
1219 th.setData({ 1255 th.setData({
1220 [txt1]: offline_price.toFixed(2), 1256 [txt1]: offline_price.toFixed(2),
1221 [txt2]: offline_num, 1257 [txt2]: offline_num,
1222 }); 1258 });
1223 - }else{  
1224 - if(dda[i].offline_price>0){  
1225 - var txt1= "requestData[" + i + "].offline_price";  
1226 - var txt2= "requestData[" + i + "].offline_num"; 1259 + } else {
  1260 + if (dda[i].offline_price > 0) {
  1261 + var txt1 = "requestData[" + i + "].offline_price";
  1262 + var txt2 = "requestData[" + i + "].offline_num";
1227 th.setData({ 1263 th.setData({
1228 [txt1]: 0, 1264 [txt1]: 0,
1229 [txt2]: 0 1265 [txt2]: 0
1230 }); 1266 });
1231 } 1267 }
1232 } 1268 }
1233 - } 1269 + }
1234 1270
1235 e.setData({ 1271 e.setData({
1236 checkAllToggle: !e.data.checkAllToggle, 1272 checkAllToggle: !e.data.checkAllToggle,
@@ -1238,13 +1274,13 @@ Page({ @@ -1238,13 +1274,13 @@ Page({
1238 total_num: t_num, 1274 total_num: t_num,
1239 }); 1275 });
1240 1276
1241 - for(var i in e.data.requestData){ 1277 + for (var i in e.data.requestData) {
1242 e.check_prom_activity(i) 1278 e.check_prom_activity(i)
1243 } 1279 }
1244 } 1280 }
1245 } 1281 }
1246 1282
1247 - if(sdda && sdda.length>0){ 1283 + if (sdda && sdda.length > 0) {
1248 for (var i = 0; i < sdda.length; i++) { 1284 for (var i = 0; i < sdda.length; i++) {
1249 var item = sdda[i].goods; 1285 var item = sdda[i].goods;
1250 if (e.data.checkAllToggle) { 1286 if (e.data.checkAllToggle) {
@@ -1274,30 +1310,30 @@ Page({ @@ -1274,30 +1310,30 @@ Page({
1274 1310
1275 }, 1311 },
1276 //------门店全选按钮,要判断是否门店的匹配方式一致--------- 1312 //------门店全选按钮,要判断是否门店的匹配方式一致---------
1277 - check_th_all_item:async function(ele) { 1313 + check_th_all_item: async function (ele) {
1278 var e = this, 1314 var e = this,
1279 pitems = ele.currentTarget.dataset.pitems, 1315 pitems = ele.currentTarget.dataset.pitems,
1280 item = this.data.requestData[pitems].goods, 1316 item = this.data.requestData[pitems].goods,
1281 sele = this.data.requestData[pitems].selected; 1317 sele = this.data.requestData[pitems].selected;
1282 - this.data.btn_click=1;  
1283 - var garr=e.data.service_data; 1318 + this.data.btn_click = 1;
  1319 + var garr = e.data.service_data;
1284 1320
1285 var isok = 1, 1321 var isok = 1,
1286 fir = 0, 1322 fir = 0,
1287 iarr = item; 1323 iarr = item;
1288 1324
1289 - if(!sele){  
1290 - var check_is_service_selected=0;  
1291 - for (var ii in garr){  
1292 - for (var ij in garr[ii].goods){  
1293 - if( garr[ii].goods[ij].selected){  
1294 - check_is_service_selected=1; 1325 + if (!sele) {
  1326 + var check_is_service_selected = 0;
  1327 + for (var ii in garr) {
  1328 + for (var ij in garr[ii].goods) {
  1329 + if (garr[ii].goods[ij].selected) {
  1330 + check_is_service_selected = 1;
1295 break; 1331 break;
1296 } 1332 }
1297 } 1333 }
1298 } 1334 }
1299 1335
1300 - if(check_is_service_selected){ 1336 + if (check_is_service_selected) {
1301 wx.showModal({ 1337 wx.showModal({
1302 title: '提示', 1338 title: '提示',
1303 content: '服务卡项目不能和商品一起选择' 1339 content: '服务卡项目不能和商品一起选择'
@@ -1308,7 +1344,7 @@ Page({ @@ -1308,7 +1344,7 @@ Page({
1308 1344
1309 if (!sele && item.length > 0) { 1345 if (!sele && item.length > 0) {
1310 for (var i = 0; i < iarr.length; i++) { 1346 for (var i = 0; i < iarr.length; i++) {
1311 - if(iarr[i].is_gift==1) continue; 1347 + if (iarr[i].is_gift == 1) continue;
1312 if (iarr[i].distr_type != 0) { 1348 if (iarr[i].distr_type != 0) {
1313 if (fir == 0) { 1349 if (fir == 0) {
1314 fir = iarr[i].distr_type; 1350 fir = iarr[i].distr_type;
@@ -1340,23 +1376,24 @@ Page({ @@ -1340,23 +1376,24 @@ Page({
1340 e.setData({ 1376 e.setData({
1341 [txt]: Number(!sele), 1377 [txt]: Number(!sele),
1342 }); 1378 });
1343 -  
1344 - await e.check_prom_activity(pitems);  
1345 - for(var i in e.data.requestData){  
1346 - if(i!=pitems) await e.check_prom_activity(i);  
1347 - } 1379 +
  1380 + await e.check_prom_activity(pitems);
  1381 + for (var i in e.data.requestData) {
  1382 + if (i != pitems) await e.check_prom_activity(i);
  1383 + }
1348 this.doCheckAll(); 1384 this.doCheckAll();
1349 }, 1385 },
1350 //---------------单选,也要判断门店的配送方式是否一致-------------- 1386 //---------------单选,也要判断门店的配送方式是否一致--------------
1351 - check_th_item: async function(t) { 1387 + check_th_item: async function (t) {
1352 var e = this, 1388 var e = this,
1353 item = t.currentTarget.dataset.item, 1389 item = t.currentTarget.dataset.item,
1354 pitems = t.currentTarget.dataset.pitems; 1390 pitems = t.currentTarget.dataset.pitems;
1355 a = this.data.requestData[pitems].goods[item]; 1391 a = this.data.requestData[pitems].goods[item];
1356 - var isok = 1,fir = 0; 1392 + var isok = 1,
  1393 + fir = 0;
1357 var iarr = e.data.requestData[pitems].goods; 1394 var iarr = e.data.requestData[pitems].goods;
1358 - this.data.btn_click=1;  
1359 - var garr= e.data.service_data; 1395 + this.data.btn_click = 1;
  1396 + var garr = e.data.service_data;
1360 1397
1361 if (!a.selected) { 1398 if (!a.selected) {
1362 var check_is_service_selected = 0; 1399 var check_is_service_selected = 0;
@@ -1381,7 +1418,7 @@ Page({ @@ -1381,7 +1418,7 @@ Page({
1381 if (iarr.length > 1 && !a.selected) { 1418 if (iarr.length > 1 && !a.selected) {
1382 1419
1383 for (var i = 0; i < iarr.length; i++) { 1420 for (var i = 0; i < iarr.length; i++) {
1384 - if(iarr[i].is_gift==1) continue; 1421 + if (iarr[i].is_gift == 1) continue;
1385 //---当不是本身选择项目---- 1422 //---当不是本身选择项目----
1386 var sel = iarr[i].selected; 1423 var sel = iarr[i].selected;
1387 if (iarr[i].distr_type != 0 && (sel || iarr[i].id == a.id)) { 1424 if (iarr[i].distr_type != 0 && (sel || iarr[i].id == a.id)) {
@@ -1407,42 +1444,42 @@ Page({ @@ -1407,42 +1444,42 @@ Page({
1407 [txt]: Number(!a.selected), 1444 [txt]: Number(!a.selected),
1408 }); 1445 });
1409 1446
1410 - if(a.prom_type==3){  
1411 -  
1412 - await e.check_prom_activity(pitems); 1447 + if (a.prom_type == 3) {
  1448 +
  1449 + await e.check_prom_activity(pitems);
1413 //判断商品是不是优惠活动 1450 //判断商品是不是优惠活动
1414 - for(var i in e.data.requestData){  
1415 - if(i!=pitems) await e.check_prom_activity(i);  
1416 - } 1451 + for (var i in e.data.requestData) {
  1452 + if (i != pitems) await e.check_prom_activity(i);
  1453 + }
1417 } 1454 }
1418 this.doCheckAll(); 1455 this.doCheckAll();
1419 } 1456 }
1420 }, 1457 },
1421 1458
1422 //------门店全选按钮,要判断是否门店的匹配方式一致--------- 1459 //------门店全选按钮,要判断是否门店的匹配方式一致---------
1423 - check_th_all_item_ser:async function(ele) { 1460 + check_th_all_item_ser: async function (ele) {
1424 var e = this, 1461 var e = this,
1425 pitems = ele.currentTarget.dataset.pitems, 1462 pitems = ele.currentTarget.dataset.pitems,
1426 item = this.data.service_data[pitems].goods, 1463 item = this.data.service_data[pitems].goods,
1427 sele = this.data.service_data[pitems].selected; 1464 sele = this.data.service_data[pitems].selected;
1428 - this.data.btn_click=1;  
1429 - var garr= e.data.requestData; 1465 + this.data.btn_click = 1;
  1466 + var garr = e.data.requestData;
1430 1467
1431 var isok = 1, 1468 var isok = 1,
1432 fir = 0, 1469 fir = 0,
1433 iarr = item; 1470 iarr = item;
1434 1471
1435 - if(!sele){  
1436 - var check_is_goods_selected=0;  
1437 - for (var ii in garr){  
1438 - for (var ij in garr[ii].goods){  
1439 - if( garr[ii].goods[ij].selected){  
1440 - check_is_goods_selected=1; 1472 + if (!sele) {
  1473 + var check_is_goods_selected = 0;
  1474 + for (var ii in garr) {
  1475 + for (var ij in garr[ii].goods) {
  1476 + if (garr[ii].goods[ij].selected) {
  1477 + check_is_goods_selected = 1;
1441 break; 1478 break;
1442 } 1479 }
1443 } 1480 }
1444 } 1481 }
1445 - if(check_is_goods_selected){ 1482 + if (check_is_goods_selected) {
1446 wx.showModal({ 1483 wx.showModal({
1447 title: '提示', 1484 title: '提示',
1448 content: '服务卡项目不能和商品一起选择' 1485 content: '服务卡项目不能和商品一起选择'
@@ -1464,29 +1501,30 @@ Page({ @@ -1464,29 +1501,30 @@ Page({
1464 this.doCheckAll(); 1501 this.doCheckAll();
1465 }, 1502 },
1466 //---------------单选,也要判断门店的配送方式是否一致-------------- 1503 //---------------单选,也要判断门店的配送方式是否一致--------------
1467 - check_th_item_ser: async function(t) { 1504 + check_th_item_ser: async function (t) {
1468 var e = this, 1505 var e = this,
1469 item = t.currentTarget.dataset.item, 1506 item = t.currentTarget.dataset.item,
1470 pitems = t.currentTarget.dataset.pitems; 1507 pitems = t.currentTarget.dataset.pitems;
1471 a = this.data.service_data[pitems].goods[item]; 1508 a = this.data.service_data[pitems].goods[item];
1472 - var isok = 1,fir = 0; 1509 + var isok = 1,
  1510 + fir = 0;
1473 var iarr = e.data.service_data[pitems].goods; 1511 var iarr = e.data.service_data[pitems].goods;
1474 - this.data.btn_click=1; 1512 + this.data.btn_click = 1;
1475 1513
1476 - var garr= e.data.requestData; 1514 + var garr = e.data.requestData;
1477 1515
1478 - if(!a.selected){  
1479 - var check_is_goods_selected=0;  
1480 - for (var ii in garr){  
1481 - for (var ij in garr[ii].goods){  
1482 - if( garr[ii].goods[ij].selected){  
1483 - check_is_goods_selected=1; 1516 + if (!a.selected) {
  1517 + var check_is_goods_selected = 0;
  1518 + for (var ii in garr) {
  1519 + for (var ij in garr[ii].goods) {
  1520 + if (garr[ii].goods[ij].selected) {
  1521 + check_is_goods_selected = 1;
1484 break; 1522 break;
1485 } 1523 }
1486 } 1524 }
1487 } 1525 }
1488 1526
1489 - if(check_is_goods_selected){ 1527 + if (check_is_goods_selected) {
1490 wx.showModal({ 1528 wx.showModal({
1491 title: '提示', 1529 title: '提示',
1492 content: '服务卡项目不能和商品一起选择' 1530 content: '服务卡项目不能和商品一起选择'
@@ -1503,7 +1541,7 @@ Page({ @@ -1503,7 +1541,7 @@ Page({
1503 }, 1541 },
1504 1542
1505 //----------检查是否全选--------- 1543 //----------检查是否全选---------
1506 - doCheckAll: function() { 1544 + doCheckAll: function () {
1507 var th = this, 1545 var th = this,
1508 tfeel = 0, 1546 tfeel = 0,
1509 t_num = 0, 1547 t_num = 0,
@@ -1513,28 +1551,27 @@ Page({ @@ -1513,28 +1551,27 @@ Page({
1513 all_num = 0; 1551 all_num = 0;
1514 1552
1515 //-- 购物车 -- 1553 //-- 购物车 --
1516 - if(car && car.length>0){  
1517 - th.data.in_zhact_gdmap={}; 1554 + if (car && car.length > 0) {
  1555 + th.data.in_zhact_gdmap = {};
1518 for (var a = 0; a < car.length; a++) { 1556 for (var a = 0; a < car.length; a++) {
1519 var item = car[a].goods,is_s_sele = 1; 1557 var item = car[a].goods,is_s_sele = 1;
1520 var offline_price=0; 1558 var offline_price=0;
1521 var offline_num=0; 1559 var offline_num=0;
1522 for (var c = 0; c < item.length; c++) { 1560 for (var c = 0; c < item.length; c++) {
1523 - if(item[c].is_gift) continue; 1561 + if (item[c].is_gift) continue;
1524 all_num += item[c].goods_num; 1562 all_num += item[c].goods_num;
1525 1563
1526 //不管怎么样都要移出去 1564 //不管怎么样都要移出去
1527 var obj=JSON.parse(JSON.stringify(item[c])); 1565 var obj=JSON.parse(JSON.stringify(item[c]));
1528 -  
1529 zh_calc.remove_zhprom(car,a,obj); 1566 zh_calc.remove_zhprom(car,a,obj);
1530 ladder_calc.remove_ladder_prom(car,a,obj); 1567 ladder_calc.remove_ladder_prom(car,a,obj);
1531 1568
1532 if (item[c].selected == 0) { 1569 if (item[c].selected == 0) {
1533 ischeck = 0; 1570 ischeck = 0;
1534 is_s_sele = 0; 1571 is_s_sele = 0;
1535 - if(item[c].prom_type==7) {  
1536 - obj.goods_num=0;  
1537 - zh_calc.add_zhprom(car,a,obj); 1572 + if (item[c].prom_type == 7) {
  1573 + obj.goods_num = 0;
  1574 + zh_calc.add_zhprom(car, a, obj);
1538 } 1575 }
1539 if(item[c].prom_type==10) { 1576 if(item[c].prom_type==10) {
1540 obj.goods_num=0; 1577 obj.goods_num=0;
@@ -1556,9 +1593,9 @@ Page({ @@ -1556,9 +1593,9 @@ Page({
1556 } 1593 }
1557 1594
1558 //-- 如果这个商品是线下取价的时候 -- 1595 //-- 如果这个商品是线下取价的时候 --
1559 - if(item[c].is_offline && item[c].prom_type!=7){  
1560 - offline_price+= (item[c].goods_price-item[c].offline_price)*item[c].goods_num;  
1561 - offline_num+=item[c].goods_num; 1596 + if (item[c].is_offline && item[c].prom_type != 7) {
  1597 + offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num;
  1598 + offline_num += item[c].goods_num;
1562 } 1599 }
1563 } 1600 }
1564 1601
@@ -1581,35 +1618,36 @@ Page({ @@ -1581,35 +1618,36 @@ Page({
1581 }); 1618 });
1582 1619
1583 //当有线下取价的时候 1620 //当有线下取价的时候
1584 - if(offline_price){  
1585 - var txt1= "requestData[" + a + "].offline_price";  
1586 - var txt2= "requestData[" + a + "].offline_num"; 1621 + if (offline_price) {
  1622 + var txt1 = "requestData[" + a + "].offline_price";
  1623 + var txt2 = "requestData[" + a + "].offline_num";
1587 th.setData({ 1624 th.setData({
1588 [txt1]: offline_price.toFixed(2), 1625 [txt1]: offline_price.toFixed(2),
1589 [txt2]: offline_num, 1626 [txt2]: offline_num,
1590 }); 1627 });
1591 - }else{  
1592 - if(car[a].offline_price>0){  
1593 - var txt1= "requestData[" + a + "].offline_price";  
1594 - var txt2= "requestData[" + a + "].offline_num";  
1595 - th.setData({  
1596 - [txt1]: 0,  
1597 - [txt2]: 0  
1598 - });  
1599 - } 1628 + } else {
  1629 + if (car[a].offline_price > 0) {
  1630 + var txt1 = "requestData[" + a + "].offline_price";
  1631 + var txt2 = "requestData[" + a + "].offline_num";
  1632 + th.setData({
  1633 + [txt1]: 0,
  1634 + [txt2]: 0
  1635 + });
  1636 + }
1600 } 1637 }
1601 1638
1602 } 1639 }
1603 } 1640 }
1604 1641
1605 //-- 服务卡 -- 1642 //-- 服务卡 --
1606 - if(car2 && car2.length>0){ 1643 + if (car2 && car2.length > 0) {
1607 for (var a = 0; a < car2.length; a++) { 1644 for (var a = 0; a < car2.length; a++) {
1608 - var c_item=car2[a];  
1609 - var item = car2[a].goods, is_s_sele = 1; 1645 + var c_item = car2[a];
  1646 + var item = car2[a].goods,
  1647 + is_s_sele = 1;
1610 1648
1611 for (var c = 0; c < item.length; c++) { 1649 for (var c = 0; c < item.length; c++) {
1612 - if(item[c].is_gift) continue; 1650 + if (item[c].is_gift) continue;
1613 all_num += item[c].goods_num; 1651 all_num += item[c].goods_num;
1614 if (item[c].selected == 0) { 1652 if (item[c].selected == 0) {
1615 ischeck = 0; 1653 ischeck = 0;
@@ -1637,28 +1675,31 @@ Page({ @@ -1637,28 +1675,31 @@ Page({
1637 }, 1675 },
1638 1676
1639 //----------------------更新购物数量,加减,调用接口--------------------- 1677 //----------------------更新购物数量,加减,调用接口---------------------
1640 - postCardList: function(t, item, pitem) {  
1641 - var e = this,th=e,user_id = getApp().globalData.user_id;  
1642 - function normal_check(store_count,goodsinfo,wareIds) {  
1643 - //--- 看一下是不是线下库存 ---  
1644 - if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){  
1645 - th.check_down_line(t, pitem, item,wareIds);  
1646 - }else{  
1647 - if (t.goods_num > store_count) {  
1648 - wx.showModal({  
1649 - title: '提示',  
1650 - content: '购买数量超出商品库存'  
1651 - });  
1652 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
1653 - e.setData({  
1654 - [txt]: store_count  
1655 - });  
1656 - e.doCheckAll();  
1657 - t.goods_num=store_count;  
1658 - }  
1659 - e.update_cart(t, pitem, item);  
1660 - }  
1661 - } 1678 + postCardList: function (t, item, pitem) {
  1679 + var e = this,
  1680 + th = e,
  1681 + user_id = getApp().globalData.user_id;
  1682 +
  1683 + function normal_check(store_count, goodsinfo, wareIds) {
  1684 + //--- 看一下是不是线下库存 ---
  1685 + if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7) {
  1686 + th.check_down_line(t, pitem, item, wareIds);
  1687 + } else {
  1688 + if (t.goods_num > store_count) {
  1689 + wx.showModal({
  1690 + title: '提示',
  1691 + content: '购买数量超出商品库存'
  1692 + });
  1693 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  1694 + e.setData({
  1695 + [txt]: store_count
  1696 + });
  1697 + e.doCheckAll();
  1698 + t.goods_num = store_count;
  1699 + }
  1700 + e.update_cart(t, pitem, item);
  1701 + }
  1702 + }
1662 1703
1663 // console.log('update'); 1704 // console.log('update');
1664 // console.log('9995959595959',t); 1705 // console.log('9995959595959',t);
@@ -1688,8 +1729,10 @@ Page({ @@ -1688,8 +1729,10 @@ Page({
1688 var buy_num_data = res.data.data; 1729 var buy_num_data = res.data.data;
1689 if (buy_num_data.promgoodsbuynum) { 1730 if (buy_num_data.promgoodsbuynum) {
1690 promgoodsbuynum = buy_num_data.promgoodsbuynum; 1731 promgoodsbuynum = buy_num_data.promgoodsbuynum;
1691 - var txt="requestData[" + pitem + "].goods[" + item + "].zh_b_num";  
1692 - th.setData({[txt]:promgoodsbuynum}); 1732 + var txt = "requestData[" + pitem + "].goods[" + item + "].zh_b_num";
  1733 + th.setData({
  1734 + [txt]: promgoodsbuynum
  1735 + });
1693 } 1736 }
1694 goodsbuynum = buy_num_data.goodsbuynum; 1737 goodsbuynum = buy_num_data.goodsbuynum;
1695 1738
@@ -1710,19 +1753,19 @@ Page({ @@ -1710,19 +1753,19 @@ Page({
1710 }); 1753 });
1711 e.doCheckAll(); 1754 e.doCheckAll();
1712 1755
1713 - t.goods_num=cbuy > 0 ? cbuy : 0, 1756 + t.goods_num = cbuy > 0 ? cbuy : 0,
1714 e.update_cart(t, pitem, item); 1757 e.update_cart(t, pitem, item);
1715 return false; 1758 return false;
1716 } 1759 }
1717 1760
1718 1761
1719 - switch (goodsinfo.prom_type){  
1720 - case 1: 1762 + switch (goodsinfo.prom_type) {
  1763 + case 1:
1721 //读取秒杀 1764 //读取秒杀
1722 rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { 1765 rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, {
1723 isShowLoading: 0, 1766 isShowLoading: 0,
1724 - success: function(res_d) {  
1725 - if(res_d.data.code==0 && res_d.data.data){ 1767 + success: function (res_d) {
  1768 + if (res_d.data.code == 0 && res_d.data.data) {
1726 if (t.goods_num > store_count) { 1769 if (t.goods_num > store_count) {
1727 wx.showModal({ 1770 wx.showModal({
1728 title: '提示', 1771 title: '提示',
@@ -1734,7 +1777,7 @@ Page({ @@ -1734,7 +1777,7 @@ Page({
1734 }); 1777 });
1735 e.doCheckAll(); 1778 e.doCheckAll();
1736 1779
1737 - t.goods_num=store_count; 1780 + t.goods_num = store_count;
1738 e.update_cart(t, pitem, item); 1781 e.update_cart(t, pitem, item);
1739 1782
1740 return false; 1783 return false;
@@ -1753,7 +1796,7 @@ Page({ @@ -1753,7 +1796,7 @@ Page({
1753 }); 1796 });
1754 e.doCheckAll(); 1797 e.doCheckAll();
1755 1798
1756 - t.goods_num=false_data.goods_num - false_data.buy_num; 1799 + t.goods_num = false_data.goods_num - false_data.buy_num;
1757 e.update_cart(t, pitem, item); 1800 e.update_cart(t, pitem, item);
1758 1801
1759 return false; 1802 return false;
@@ -1771,7 +1814,7 @@ Page({ @@ -1771,7 +1814,7 @@ Page({
1771 }); 1814 });
1772 e.doCheckAll(); 1815 e.doCheckAll();
1773 1816
1774 - t.goods_num=false_data.redisnum; 1817 + t.goods_num = false_data.redisnum;
1775 e.update_cart(t, pitem, item); 1818 e.update_cart(t, pitem, item);
1776 return false; 1819 return false;
1777 } 1820 }
@@ -1787,110 +1830,110 @@ Page({ @@ -1787,110 +1830,110 @@ Page({
1787 [txt]: false_data.buy_limit 1830 [txt]: false_data.buy_limit
1788 }); 1831 });
1789 e.doCheckAll(); 1832 e.doCheckAll();
1790 - t.goods_num=(false_data.buy_limit-promgoodsbuynum)?false_data.buy_limit-promgoodsbuynum:0; 1833 + t.goods_num = (false_data.buy_limit - promgoodsbuynum) ? false_data.buy_limit - promgoodsbuynum : 0;
1791 e.update_cart(t, pitem, item); 1834 e.update_cart(t, pitem, item);
1792 return false; 1835 return false;
1793 } 1836 }
1794 e.update_cart(t, pitem, item); 1837 e.update_cart(t, pitem, item);
1795 1838
1796 - }else{  
1797 - normal_check(store_count,goodsinfo,wareIds); 1839 + } else {
  1840 + normal_check(store_count, goodsinfo, wareIds);
1798 } 1841 }
1799 } 1842 }
1800 }) 1843 })
1801 - break;  
1802 - case 2:  
1803 - getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {  
1804 - }).then(res => {  
1805 - if(res.data.code==0 && res.data.data){  
1806 - if (t.goods_num > store_count) {  
1807 - wx.showModal({  
1808 - title: '提示',  
1809 - content: '购买数量超出商品库存'  
1810 - });  
1811 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
1812 - e.setData({  
1813 - [txt]: store_count  
1814 - });  
1815 - e.doCheckAll();  
1816 -  
1817 - t.goods_num=store_count;  
1818 - e.update_cart(t, pitem, item);  
1819 -  
1820 - return false;  
1821 - }  
1822 -  
1823 - var gr_data = res.data.data;  
1824 - //--判断库存--  
1825 - if (t.goods_num > gr_data.goods_num - gr_data.buy_num) {  
1826 - wx.showModal({  
1827 - title: '提示',  
1828 - content: '购买数量超出活动库存'  
1829 - });  
1830 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
1831 - e.setData({  
1832 - [txt]: gr_data.goods_num - gr_data.buy_num  
1833 - });  
1834 - e.doCheckAll();  
1835 -  
1836 - t.goods_num=gr_data.goods_num - gr_data.buy_num;  
1837 - e.update_cart(t, pitem, item);  
1838 -  
1839 - return false;  
1840 - }  
1841 -  
1842 - //--判断redis数量是否已经超出--  
1843 - if (t.goods_num > gr_data.redisnum) {  
1844 - wx.showModal({  
1845 - title: '提示',  
1846 - content: '购买数量超出商品库存'  
1847 - });  
1848 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
1849 - e.setData({  
1850 - [txt]: gr_data.redisnum  
1851 - });  
1852 - e.doCheckAll();  
1853 -  
1854 - t.goods_num=gr_data.redisnum;  
1855 - e.update_cart(t, pitem, item);  
1856 - return false;  
1857 - }  
1858 -  
1859 - //--活动的限购是不是要判断--  
1860 - if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) {  
1861 - wx.showModal({  
1862 - title: '提示',  
1863 - content: '购买数量超出团购限购'  
1864 - });  
1865 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
1866 - e.setData({  
1867 - [txt]: gr_data.buy_limit  
1868 - });  
1869 - e.doCheckAll();  
1870 -  
1871 - t.goods_num=(gr_data.buy_limit-promgoodsbuynum)?gr_data.buy_limit-promgoodsbuynum:0;  
1872 - e.update_cart(t, pitem, item);  
1873 - return false;  
1874 - }  
1875 - e.update_cart(t, pitem, item);  
1876 -  
1877 - }else{  
1878 - normal_check(store_count,goodsinfo,wareIds);  
1879 - } 1844 + break;
  1845 + case 2:
  1846 + getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {
  1847 + if (res.data.code == 0 && res.data.data) {
  1848 + if (t.goods_num > store_count) {
  1849 + wx.showModal({
  1850 + title: '提示',
  1851 + content: '购买数量超出商品库存'
  1852 + });
  1853 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  1854 + e.setData({
  1855 + [txt]: store_count
  1856 + });
  1857 + e.doCheckAll();
  1858 +
  1859 + t.goods_num = store_count;
  1860 + e.update_cart(t, pitem, item);
  1861 +
  1862 + return false;
  1863 + }
  1864 +
  1865 + var gr_data = res.data.data;
  1866 + //--判断库存--
  1867 + if (t.goods_num > gr_data.goods_num - gr_data.buy_num) {
  1868 + wx.showModal({
  1869 + title: '提示',
  1870 + content: '购买数量超出活动库存'
  1871 + });
  1872 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  1873 + e.setData({
  1874 + [txt]: gr_data.goods_num - gr_data.buy_num
  1875 + });
  1876 + e.doCheckAll();
  1877 +
  1878 + t.goods_num = gr_data.goods_num - gr_data.buy_num;
  1879 + e.update_cart(t, pitem, item);
  1880 +
  1881 + return false;
  1882 + }
  1883 +
  1884 + //--判断redis数量是否已经超出--
  1885 + if (t.goods_num > gr_data.redisnum) {
  1886 + wx.showModal({
  1887 + title: '提示',
  1888 + content: '购买数量超出商品库存'
  1889 + });
  1890 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  1891 + e.setData({
  1892 + [txt]: gr_data.redisnum
  1893 + });
  1894 + e.doCheckAll();
  1895 +
  1896 + t.goods_num = gr_data.redisnum;
  1897 + e.update_cart(t, pitem, item);
  1898 + return false;
  1899 + }
  1900 +
  1901 + //--活动的限购是不是要判断--
  1902 + if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) {
  1903 + wx.showModal({
  1904 + title: '提示',
  1905 + content: '购买数量超出团购限购'
  1906 + });
  1907 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  1908 + e.setData({
  1909 + [txt]: gr_data.buy_limit
  1910 + });
  1911 + e.doCheckAll();
  1912 +
  1913 + t.goods_num = (gr_data.buy_limit - promgoodsbuynum) ? gr_data.buy_limit - promgoodsbuynum : 0;
  1914 + e.update_cart(t, pitem, item);
  1915 + return false;
  1916 + }
  1917 + e.update_cart(t, pitem, item);
  1918 +
  1919 + } else {
  1920 + normal_check(store_count, goodsinfo, wareIds);
  1921 + }
1880 }) 1922 })
1881 1923
1882 - break;  
1883 - default:  
1884 - normal_check(store_count,goodsinfo,wareIds);  
1885 - break  
1886 - } 1924 + break;
  1925 + default:
  1926 + normal_check(store_count, goodsinfo, wareIds);
  1927 + break
  1928 + }
1887 } 1929 }
1888 }); 1930 });
1889 }, 1931 },
1890 1932
1891 //----------------------更新购物数量,加减,调用接口--------------------- 1933 //----------------------更新购物数量,加减,调用接口---------------------
1892 - postCardList_ser: function(t, item, pitem) {  
1893 - var e = this,th=e; 1934 + postCardList_ser: function (t, item, pitem) {
  1935 + var e = this,
  1936 + th = e;
1894 var user_id = getApp().globalData.user_id; 1937 var user_id = getApp().globalData.user_id;
1895 var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; 1938 var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
1896 e.setData({ 1939 e.setData({
@@ -1899,17 +1942,18 @@ Page({ @@ -1899,17 +1942,18 @@ Page({
1899 e.doCheckAll(); 1942 e.doCheckAll();
1900 e.update_cart_ser(t, pitem, item); 1943 e.update_cart_ser(t, pitem, item);
1901 }, 1944 },
1902 - 1945 +
1903 1946
1904 1947
1905 //---检验线下库存的数量--- 1948 //---检验线下库存的数量---
1906 - async check_down_line(t, pitem, item,erpwareid){  
1907 - var ob={},th=this;  
1908 - await this.check_down_line_next(t, pitem, item,erpwareid,function(res){  
1909 - ob=res; 1949 + async check_down_line(t, pitem, item, erpwareid) {
  1950 + var ob = {},
  1951 + th = this;
  1952 + await this.check_down_line_next(t, pitem, item, erpwareid, function (res) {
  1953 + ob = res;
1910 }); 1954 });
1911 - var log=0;  
1912 - if(ob.code==-1){ 1955 + var log = 0;
  1956 + if (ob.code == -1) {
1913 wx.showModal({ 1957 wx.showModal({
1914 title: '提示', 1958 title: '提示',
1915 content: '购买数量超出商品库存' 1959 content: '购买数量超出商品库存'
@@ -1919,31 +1963,41 @@ Page({ @@ -1919,31 +1963,41 @@ Page({
1919 [txt]: ob.CanOutQty 1963 [txt]: ob.CanOutQty
1920 }); 1964 });
1921 th.doCheckAll(); 1965 th.doCheckAll();
1922 - t.goods_num=ob.CanOutQty; 1966 + t.goods_num = ob.CanOutQty;
1923 } 1967 }
1924 this.update_cart(t, pitem, item); 1968 this.update_cart(t, pitem, item);
1925 }, 1969 },
1926 1970
1927 //---检验线下库存的数量的子函数--- 1971 //---检验线下库存的数量的子函数---
1928 - async check_down_line_next(t, pitem, item,erpwareid,func){ 1972 + async check_down_line_next(t, pitem, item, erpwareid, func) {
1929 1973
1930 var goodsinfo = this.data.requestData[pitem].goods[item]; 1974 var goodsinfo = this.data.requestData[pitem].goods[item];
1931 - var lock=0,pick_no,plist; 1975 + var lock = 0,
  1976 + pick_no, plist;
1932 //先读取门店的lock 1977 //先读取门店的lock
1933 - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{  
1934 - data:{store_id:os.stoid,wareId:t.goods_id,storageId:goodsinfo.pick_id,pageSize:1000}  
1935 - }).then(res=>{  
1936 - if(res.data.code==0 && res.data.data.total>0){  
1937 - for(var i in res.data.data.pageData)  
1938 - lock+=res.data.data.pageData[i].outQty; 1978 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
  1979 + data: {
  1980 + store_id: os.stoid,
  1981 + wareId: t.goods_id,
  1982 + storageId: goodsinfo.pick_id,
  1983 + pageSize: 1000
  1984 + }
  1985 + }).then(res => {
  1986 + if (res.data.code == 0 && res.data.data.total > 0) {
  1987 + for (var i in res.data.data.pageData)
  1988 + lock += res.data.data.pageData[i].outQty;
1939 } 1989 }
1940 }) 1990 })
1941 //先获取门店的编号 1991 //先获取门店的编号
1942 - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+goodsinfo.pick_id,{  
1943 - data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:goodsinfo.pick_id}  
1944 - }).then(res=>{  
1945 - if(res.data.code==0){  
1946 - pick_no=res.data.data.pickup_no; 1992 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + goodsinfo.pick_id, {
  1993 + data: {
  1994 + storeId: os.stoid,
  1995 + goodsId: t.goods_id,
  1996 + pickupId: goodsinfo.pick_id
  1997 + }
  1998 + }).then(res => {
  1999 + if (res.data.code == 0) {
  2000 + pick_no = res.data.data.pickup_no;
1947 } 2001 }
1948 }) 2002 })
1949 //读取线下的门店库存 2003 //读取线下的门店库存
@@ -1954,40 +2008,44 @@ Page({ @@ -1954,40 +2008,44 @@ Page({
1954 plist=res.data.data.pageData[0]; 2008 plist=res.data.data.pageData[0];
1955 } 2009 }
1956 }) 2010 })
1957 - var ob={}; ob.code=1; 2011 + var ob = {};
  2012 + ob.code = 1;
1958 2013
1959 - if(!plist){  
1960 - ob.code=-1;ob.CanOutQty=0;func(ob); return false; 2014 + if (!plist) {
  2015 + ob.code = -1;
  2016 + ob.CanOutQty = 0;
  2017 + func(ob);
  2018 + return false;
1961 } 2019 }
1962 2020
1963 - var c_num=t.goods_num;  
1964 - if(t.need_downlow_num) c_num=t.need_downlow_num; 2021 + var c_num = t.goods_num;
  2022 + if (t.need_downlow_num) c_num = t.need_downlow_num;
1965 2023
1966 - if( c_num>plist.CanOutQty-lock){  
1967 - ob.code=-1;  
1968 - ob.CanOutQty=plist.CanOutQty-lock  
1969 - if(ob.CanOutQty<0) ob.CanOutQty=0; 2024 + if (c_num > plist.CanOutQty - lock) {
  2025 + ob.code = -1;
  2026 + ob.CanOutQty = plist.CanOutQty - lock
  2027 + if (ob.CanOutQty < 0) ob.CanOutQty = 0;
1970 } 2028 }
1971 func(ob) 2029 func(ob)
1972 }, 2030 },
1973 2031
1974 2032
1975 //--更新购物车--- 2033 //--更新购物车---
1976 - update_cart: function(t, pitem, item) { 2034 + update_cart: function (t, pitem, item) {
1977 var e = this; 2035 var e = this;
1978 2036
1979 getApp().request.put("/api/weshop/cart/update", { 2037 getApp().request.put("/api/weshop/cart/update", {
1980 data: t, 2038 data: t,
1981 - success:async function(ee) { 2039 + success: async function (ee) {
1982 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; 2040 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1983 2041
1984 e.setData({ 2042 e.setData({
1985 [txt]: t.goods_num, 2043 [txt]: t.goods_num,
1986 }); 2044 });
1987 -  
1988 - await e.check_prom_activity(pitem)  
1989 - for(var i in e.data.requestData){  
1990 - if(i!=pitem) await e.check_prom_activity(i) 2045 +
  2046 + await e.check_prom_activity(pitem)
  2047 + for (var i in e.data.requestData) {
  2048 + if (i != pitem) await e.check_prom_activity(i)
1991 } 2049 }
1992 e.doCheckAll(); 2050 e.doCheckAll();
1993 getApp().requestCardNum(e); 2051 getApp().requestCardNum(e);
@@ -1996,11 +2054,11 @@ Page({ @@ -1996,11 +2054,11 @@ Page({
1996 }, 2054 },
1997 2055
1998 //--更新购物车--- 2056 //--更新购物车---
1999 - update_cart_ser: function(t, pitem, item) { 2057 + update_cart_ser: function (t, pitem, item) {
2000 var e = this; 2058 var e = this;
2001 getApp().request.put("/api/weshop/cartService/update", { 2059 getApp().request.put("/api/weshop/cartService/update", {
2002 data: t, 2060 data: t,
2003 - success:async function(ee) { 2061 + success: async function (ee) {
2004 var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; 2062 var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
2005 e.setData({ 2063 e.setData({
2006 [txt]: t.goods_num, 2064 [txt]: t.goods_num,
@@ -2013,22 +2071,22 @@ Page({ @@ -2013,22 +2071,22 @@ Page({
2013 2071
2014 2072
2015 //-------下拉刷新--------- 2073 //-------下拉刷新---------
2016 - onPullDownRefresh: function(t) { 2074 + onPullDownRefresh: function (t) {
2017 this.getCardList(); 2075 this.getCardList();
2018 }, 2076 },
2019 2077
2020 //--------------去结算------------ 2078 //--------------去结算------------
2021 async checkout() { 2079 async checkout() {
2022 - if(!this.data.total_num || this.data.total_num<=0) return false;  
2023 - if(!this.data.is_load) return false;  
2024 - if(this.data.up_dating) { 2080 + if (!this.data.total_num || this.data.total_num <= 0) return false;
  2081 + if (!this.data.is_load) return false;
  2082 + if (this.data.up_dating) {
2025 wx.showLoading({ 2083 wx.showLoading({
2026 - title:"计算中" 2084 + title: "计算中"
2027 }) 2085 })
2028 } 2086 }
2029 - var garr=this.data.requestData;  
2030 - var check_is_goods_selected=0;  
2031 - if(garr) { 2087 + var garr = this.data.requestData;
  2088 + var check_is_goods_selected = 0;
  2089 + if (garr) {
2032 for (var ii in garr) { 2090 for (var ii in garr) {
2033 for (var ij in garr[ii].goods) { 2091 for (var ij in garr[ii].goods) {
2034 if (garr[ii].goods[ij].selected) { 2092 if (garr[ii].goods[ij].selected) {
@@ -2039,7 +2097,7 @@ Page({ @@ -2039,7 +2097,7 @@ Page({
2039 } 2097 }
2040 } 2098 }
2041 //-- 如果是商品的结算 -- 2099 //-- 如果是商品的结算 --
2042 - if(check_is_goods_selected) { 2100 + if (check_is_goods_selected) {
2043 var glist = ""; //用逗号隔开的 2101 var glist = ""; //用逗号隔开的
2044 var map = new Map(); //使用map值键进行运算 2102 var map = new Map(); //使用map值键进行运算
2045 var map_limit = new Map(); //使用map值键进行存储限购 2103 var map_limit = new Map(); //使用map值键进行存储限购
@@ -2055,7 +2113,7 @@ Page({ @@ -2055,7 +2113,7 @@ Page({
2055 for (var j = 0; j < i_arr.length; j++) { 2113 for (var j = 0; j < i_arr.length; j++) {
2056 if (i_arr[j].selected && i_arr[j].is_gift != 1) { 2114 if (i_arr[j].selected && i_arr[j].is_gift != 1) {
2057 2115
2058 - if (i_arr[j].is_pd_normal || i_arr[j].prom_type==0 || i_arr[j].prom_type==3) { 2116 + if (i_arr[j].is_pd_normal || i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3) {
2059 normal_arr[i_arr[j].goods_id] = 1; 2117 normal_arr[i_arr[j].goods_id] = 1;
2060 } 2118 }
2061 2119
@@ -2083,8 +2141,8 @@ Page({ @@ -2083,8 +2141,8 @@ Page({
2083 glist += i_arr[j].goods_id + ","; 2141 glist += i_arr[j].goods_id + ",";
2084 ab = 1; 2142 ab = 1;
2085 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- 2143 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
2086 - if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5  
2087 - || i_arr[j].need_downlow_num ) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) { 2144 + if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 ||
  2145 + i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) {
2088 //--获取商品的线下商品ID-- 2146 //--获取商品的线下商品ID--
2089 var gd = null; 2147 var gd = null;
2090 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { 2148 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => {
@@ -2254,7 +2312,7 @@ Page({ @@ -2254,7 +2312,7 @@ Page({
2254 throw "商品价格已经变化"; 2312 throw "商品价格已经变化";
2255 } 2313 }
2256 } else { 2314 } else {
2257 - if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price>0) { 2315 + if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price > 0) {
2258 isok = 0; 2316 isok = 0;
2259 gname = val.goods_name; 2317 gname = val.goods_name;
2260 throw "商品价格已经变化"; 2318 throw "商品价格已经变化";
@@ -2297,7 +2355,7 @@ Page({ @@ -2297,7 +2355,7 @@ Page({
2297 } 2355 }
2298 } 2356 }
2299 }); 2357 });
2300 - }else{ 2358 + } else {
2301 //-- 开始服务卡的购物车购买 -- 2359 //-- 开始服务卡的购物车购买 --
2302 for (var i = 0; i < this.data.service_data.length; i++) { 2360 for (var i = 0; i < this.data.service_data.length; i++) {
2303 var i_arr = this.data.service_data[i].goods; 2361 var i_arr = this.data.service_data[i].goods;
@@ -2319,7 +2377,7 @@ Page({ @@ -2319,7 +2377,7 @@ Page({
2319 }, 2377 },
2320 2378
2321 //结算到最后一个商品 2379 //结算到最后一个商品
2322 - set_last: function(ab, isok, gname) { 2380 + set_last: function (ab, isok, gname) {
2323 if (isok == 0) { 2381 if (isok == 0) {
2324 t.my_warnning(gname + "商品超出库存", 0, this); 2382 t.my_warnning(gname + "商品超出库存", 0, this);
2325 } else { 2383 } else {
@@ -2331,7 +2389,7 @@ Page({ @@ -2331,7 +2389,7 @@ Page({
2331 2389
2332 2390
2333 //图片失败,默认图片 2391 //图片失败,默认图片
2334 - bind_bnerr2: function(e) { 2392 + bind_bnerr2: function (e) {
2335 var _errImg = e.target.dataset.errorimg; 2393 var _errImg = e.target.dataset.errorimg;
2336 var _errurl = e.target.dataset.url; 2394 var _errurl = e.target.dataset.url;
2337 var ii = _errurl.indexOf(oo.imghost); 2395 var ii = _errurl.indexOf(oo.imghost);
@@ -2342,13 +2400,13 @@ Page({ @@ -2342,13 +2400,13 @@ Page({
2342 } 2400 }
2343 }, 2401 },
2344 //设置点击按钮为true或者false 2402 //设置点击按钮为true或者false
2345 - radio_chick: function(checked, num) { 2403 + radio_chick: function (checked, num) {
2346 var th = this; 2404 var th = this;
2347 var requestData = th.data.requestData; 2405 var requestData = th.data.requestData;
2348 }, 2406 },
2349 2407
2350 //点击编辑后的效果 2408 //点击编辑后的效果
2351 - edit_cart: function(e) { 2409 + edit_cart: function (e) {
2352 var type = parseFloat(e.currentTarget.dataset.type); 2410 var type = parseFloat(e.currentTarget.dataset.type);
2353 this.setData({ 2411 this.setData({
2354 is_edit: type 2412 is_edit: type
@@ -2356,13 +2414,14 @@ Page({ @@ -2356,13 +2414,14 @@ Page({
2356 }, 2414 },
2357 2415
2358 //--多个删除购物车商品--- 2416 //--多个删除购物车商品---
2359 - check_del: function() {  
2360 - var glist = "",slist=''; //用逗号隔开的 2417 + check_del: function () {
  2418 + var glist = "",
  2419 + slist = ''; //用逗号隔开的
2361 var user_id = getApp().globalData.user_id; 2420 var user_id = getApp().globalData.user_id;
2362 var th = this; 2421 var th = this;
2363 2422
2364 var ab = 0; //选中 2423 var ab = 0; //选中
2365 - var abc=0; // 2424 + var abc = 0; //
2366 for (var i = 0; i < this.data.requestData.length; i++) { 2425 for (var i = 0; i < this.data.requestData.length; i++) {
2367 var i_arr = this.data.requestData[i].goods; 2426 var i_arr = this.data.requestData[i].goods;
2368 for (var j = 0; j < i_arr.length; j++) { 2427 for (var j = 0; j < i_arr.length; j++) {
@@ -2383,104 +2442,112 @@ Page({ @@ -2383,104 +2442,112 @@ Page({
2383 } 2442 }
2384 } 2443 }
2385 2444
2386 - if (ab == 0 && abc==0) { 2445 + if (ab == 0 && abc == 0) {
2387 t.my_warnning("未选择商品或者服务卡", 0, th); 2446 t.my_warnning("未选择商品或者服务卡", 0, th);
2388 return false; 2447 return false;
2389 } 2448 }
2390 2449
2391 - if(ab){ 2450 + if (ab) {
2392 glist = glist.substring(0, glist.length - 1); 2451 glist = glist.substring(0, glist.length - 1);
2393 //要删除购物车中的商品 2452 //要删除购物车中的商品
2394 var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + "/" + glist; 2453 var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + "/" + glist;
2395 getApp().request.delete(url, { 2454 getApp().request.delete(url, {
2396 - success: function(t) {  
2397 - // console.log('del done1111111111'); 2455 + success: function (t) {
  2456 + // console.log('del done1111111111');
2398 th.getCardList(); 2457 th.getCardList();
2399 - getApp().requestCardNum(th);  
2400 - // console.log('all================', th.data.all_num);  
2401 - // getApp().globalData.cartGoodsNum = 2458 + getApp().requestCardNum(th);
  2459 + // console.log('all================', th.data.all_num);
  2460 + // getApp().globalData.cartGoodsNum =
2402 } 2461 }
2403 }); 2462 });
2404 } 2463 }
2405 - if(abc){ 2464 + if (abc) {
2406 slist = slist.substring(0, slist.length - 1); 2465 slist = slist.substring(0, slist.length - 1);
2407 //要删除购物车中的商品 2466 //要删除购物车中的商品
2408 var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + "/" + slist; 2467 var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + "/" + slist;
2409 getApp().request.delete(url, { 2468 getApp().request.delete(url, {
2410 - success: function(t) { 2469 + success: function (t) {
2411 th.getCardList(); 2470 th.getCardList();
2412 - getApp().requestCardNum(th);  
2413 - console.log('all2================', th.data.all_num); 2471 + getApp().requestCardNum(th);
  2472 + console.log('all2================', th.data.all_num);
2414 } 2473 }
2415 }); 2474 });
2416 } 2475 }
2417 - 2476 +
2418 }, 2477 },
2419 //跳到首页 2478 //跳到首页
2420 - goto: function(e) {  
2421 - var url='/pages/index/index/index';  
2422 - getApp().goto(url); 2479 + goto: function (e) {
  2480 + var url = '/pages/index/index/index';
  2481 + getApp().goto(url);
2423 }, 2482 },
2424 2483
2425 //---加载更多是靠这个函数---- 2484 //---加载更多是靠这个函数----
2426 - onReachBottom: function() {  
2427 - if(this.data.requestData && this.data.requestData.length==0) { 2485 + onReachBottom: function () {
  2486 + if (this.data.requestData && this.data.requestData.length == 0) {
2428 var goods_list = this.selectComponent("#goods_list"); //组件的id 2487 var goods_list = this.selectComponent("#goods_list"); //组件的id
2429 if (goods_list) goods_list.get_list(); 2488 if (goods_list) goods_list.get_list();
2430 } 2489 }
2431 }, 2490 },
2432 2491
2433 //检查莫个门店下的商品是不是优惠活动,有的话,看要不要送礼品,同时有没有倍增 2492 //检查莫个门店下的商品是不是优惠活动,有的话,看要不要送礼品,同时有没有倍增
2434 - check_prom_activity:async function (cindex) {  
2435 - var make_up_arr=new Array();  
2436 - var th=this;  
2437 - var map=new Map();  
2438 - var list= JSON.parse(JSON.stringify(this.data.requestData[cindex])); 2493 + check_prom_activity: async function (cindex) {
  2494 + var make_up_arr = new Array();
  2495 + var th = this;
  2496 + var map = new Map();
  2497 + var list = JSON.parse(JSON.stringify(this.data.requestData[cindex]));
2439 //循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量 2498 //循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量
2440 -  
2441 - //-- 所有的购物车的数据,要用拷贝的赖进行计算 --  
2442 - var alllist= JSON.parse(JSON.stringify(this.data.requestData));  
2443 - var list2=alllist[cindex];  
2444 - var no_gift_arr=[];  
2445 -  
2446 - //主要判断有没有促销活动  
2447 - var is_sele_prom=0;  
2448 - var is_gift_del=0;  
2449 - for(var i=0;i<list.goods.length;i++){  
2450 - var item=list.goods[i];  
2451 - if(item.prom_type==3 && item.selected && !item.is_gift){  
2452 - is_sele_prom=1;  
2453 - if(map.has(item.prom_id+"")){  
2454 - var ob=map.get(item.prom_id+"");  
2455 - ob.num+=item.goods_num;  
2456 - ob.price+=item.goods_num*item.goods_price;  
2457 - delete map[item.prom_id+""];  
2458 - map.set(item.prom_id+"",ob);  
2459 - }else{  
2460 - var ob={};  
2461 - ob.num=item.goods_num;  
2462 - ob.price=item.goods_num*item.goods_price;  
2463 - map.set(item.prom_id+"",ob); 2499 +
  2500 + //-- 所有的购物车的数据,要用拷贝的赖进行计算 --
  2501 + var alllist = JSON.parse(JSON.stringify(this.data.requestData));
  2502 + var list2 = alllist[cindex];
  2503 + var no_gift_arr = [];
  2504 +
  2505 + //主要判断有没有促销活动
  2506 + var is_sele_prom = 0;
  2507 + var is_gift_del = 0;
  2508 + for (var i = 0; i < list.goods.length; i++) {
  2509 + var item = list.goods[i];
  2510 + if (item.prom_type == 3 && item.selected && !item.is_gift) {
  2511 + is_sele_prom = 1;
  2512 + if (map.has(item.prom_id + "")) {
  2513 + var ob = map.get(item.prom_id + "");
  2514 + ob.num += item.goods_num;
  2515 + ob.price += item.goods_num * item.goods_price;
  2516 + delete map[item.prom_id + ""];
  2517 + map.set(item.prom_id + "", ob);
  2518 + } else {
  2519 + var ob = {};
  2520 + ob.num = item.goods_num;
  2521 + ob.price = item.goods_num * item.goods_price;
  2522 + if (item.guide_id) {
  2523 + ob.guide_id = item.guide_id;
  2524 + }
  2525 + if (item.guide_type) {
  2526 + ob.guide_type = item.guide_type;
  2527 + }
  2528 + map.set(item.prom_id + "", ob);
2464 } 2529 }
2465 } 2530 }
2466 - if(item.is_gift==1){ 2531 + if (item.is_gift == 1) {
2467 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 2532 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
2468 //getApp().request.delete(url, {}); 2533 //getApp().request.delete(url, {});
2469 - await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除  
2470 - list2.goods.splice(i,1);  
2471 - list.goods.splice(i--,1);  
2472 - is_gift_del=1; 2534 + await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除
  2535 + list2.goods.splice(i, 1);
  2536 + list.goods.splice(i--, 1);
  2537 + is_gift_del = 1;
  2538 + }
  2539 + }
  2540 + //--如果没有选中的促销活动的,直接退出 --
  2541 + if (!is_sele_prom) {
  2542 + //如果有赠品,要重新更新购物车的前台渲染--
  2543 + if (is_gift_del) {
  2544 + var rq_text = "requestData[" + cindex + "]";
  2545 + this.setData({
  2546 + [rq_text]: list
  2547 + });
2473 } 2548 }
  2549 + return false;
2474 } 2550 }
2475 - //--如果没有选中的促销活动的,直接退出 --  
2476 - if(!is_sele_prom){  
2477 - //如果有赠品,要重新更新购物车的前台渲染--  
2478 - if(is_gift_del){  
2479 - var rq_text="requestData["+cindex+"]";  
2480 - this.setData({[rq_text]:list});  
2481 - }  
2482 - return false;  
2483 - }  
2484 /*-- 2551 /*--
2485 var map2=new Map(); 2552 var map2=new Map();
2486 //请那些是赠品,但是优惠活动并没有被选中的商品要删除,同时满足条件的要放到map2, 2553 //请那些是赠品,但是优惠活动并没有被选中的商品要删除,同时满足条件的要放到map2,
@@ -2499,20 +2566,20 @@ Page({ @@ -2499,20 +2566,20 @@ Page({
2499 } 2566 }
2500 }--*/ 2567 }--*/
2501 2568
2502 - var t_prom_list=new Array();  
2503 - for(let p_item of map.entries()){  
2504 - var prom=null;  
2505 - await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+p_item[0],{}).then(res=> {  
2506 - if(res.data.code==0){  
2507 - prom=res.data.data; 2569 + var t_prom_list = new Array();
  2570 + for (let p_item of map.entries()) {
  2571 + var prom = null;
  2572 + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + p_item[0], {}).then(res => {
  2573 + if (res.data.code == 0) {
  2574 + prom = res.data.data;
2508 } 2575 }
2509 }) 2576 })
2510 //如果活动已经结束 2577 //如果活动已经结束
2511 - if(!prom || prom.is_end || prom.end_time<ut.gettimestamp() ){  
2512 - for(var ii in list.goods){  
2513 - var item=list.goods[ii];  
2514 - list.goods.splice(ii,1);  
2515 - if(item.prom_id==p_item[0] && item.prom_type==3){ 2578 + if (!prom || prom.is_end || prom.end_time < ut.gettimestamp()) {
  2579 + for (var ii in list.goods) {
  2580 + var item = list.goods[ii];
  2581 + list.goods.splice(ii, 1);
  2582 + if (item.prom_id == p_item[0] && item.prom_type == 3) {
2516 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 2583 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
2517 getApp().request.delete(url, {}); 2584 getApp().request.delete(url, {});
2518 } 2585 }
@@ -2522,8 +2589,9 @@ Page({ @@ -2522,8 +2589,9 @@ Page({
2522 2589
2523 t_prom_list.push(prom); 2590 t_prom_list.push(prom);
2524 //---读取打折的详情--- 2591 //---读取打折的详情---
2525 - var ob=p_item[1];var discount=null;  
2526 - await getApp().request.promiseGet("/api/weshop/goods/getDiscount",{ 2592 + var ob = p_item[1];
  2593 + var discount = null;
  2594 + await getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
2527 data: { 2595 data: {
2528 price: ob.price, 2596 price: ob.price,
2529 prom_id: p_item[0], 2597 prom_id: p_item[0],
@@ -2531,15 +2599,15 @@ Page({ @@ -2531,15 +2599,15 @@ Page({
2531 user_id: getApp().globalData.user_id, 2599 user_id: getApp().globalData.user_id,
2532 is_bz: prom.is_bz 2600 is_bz: prom.is_bz
2533 } 2601 }
2534 - }).then(res=>{  
2535 - if(res.data.code==0) discount=res.data.data; 2602 + }).then(res => {
  2603 + if (res.data.code == 0) discount = res.data.data;
2536 }) 2604 })
2537 2605
2538 //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量--- 2606 //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
2539 - if(discount && discount['goods_id'] && discount.limit_num>=discount.bs && discount.gift_storecount>=discount.bs){  
2540 - //如果这礼品超了情况下  
2541 - if(no_gift_arr.indexOf(discount.gift_id)!=-1) continue;  
2542 - var o=discount.goodsinfo; 2607 + if (discount && discount['goods_id'] && discount.limit_num >= discount.bs && discount.gift_storecount >= discount.bs) {
  2608 + //如果这礼品超了情况下
  2609 + if (no_gift_arr.indexOf(discount.gift_id) != -1) continue;
  2610 + var o = discount.goodsinfo;
2543 var newd = { 2611 var newd = {
2544 goods_id: o.goods_id, 2612 goods_id: o.goods_id,
2545 goods_num: discount.bs, 2613 goods_num: discount.bs,
@@ -2547,88 +2615,107 @@ Page({ @@ -2547,88 +2615,107 @@ Page({
2547 user_id: app.globalData.user_id, 2615 user_id: app.globalData.user_id,
2548 store_id: os.stoid, 2616 store_id: os.stoid,
2549 goods_price: 0, 2617 goods_price: 0,
  2618 + guide_id:ob.guide_id?ob.guide_id:0,
  2619 + guide_type:ob.guide_type?ob.guide_type:0,
2550 member_goods_price: 0, 2620 member_goods_price: 0,
2551 goods_name: o.goods_name, 2621 goods_name: o.goods_name,
2552 goods_sn: o.goods_sn, 2622 goods_sn: o.goods_sn,
2553 sku: o.sku, 2623 sku: o.sku,
2554 is_gift: 1, 2624 is_gift: 1,
2555 - prom_id:p_item[0],  
2556 - prom_type:3,  
2557 - selected:1,  
2558 - gift_id:discount.gift_id,  
2559 - original_img:th.data.imgUrl+o.original_img 2625 + prom_id: p_item[0],
  2626 + prom_type: 3,
  2627 + selected: 1,
  2628 + gift_id: discount.gift_id,
  2629 + original_img: th.data.imgUrl + o.original_img
2560 }; 2630 };
2561 2631
2562 -  
2563 - list2.goods.push(newd);  
2564 - var all_num=0;  
2565 - var all_limit_num=0;  
2566 -  
2567 - for(var i in alllist){  
2568 - var list_item=alllist[i];  
2569 - for(var j in list_item.goods){  
2570 - //如果赠品的ID一样,要进行统计数量  
2571 - if(list_item.goods[j].is_gift==1 && list_item.goods[j].gift_id==newd.gift_id){  
2572 - all_num+= list_item.goods[j].goods_num;  
2573 - }  
2574 - if(list_item.goods[j].is_gift==1 && list_item.goods[j].gift_id==newd.gift_id && list_item.goods[j].prom_id==p_item[0]){  
2575 - all_limit_num+= list_item.goods[j].goods_num;  
2576 - }  
2577 -  
2578 - }  
2579 - }  
2580 -  
2581 - //-- 赠品的数量超出库存数量和会员的限制,这里是保证所有的赠品部会超出 --  
2582 - if(discount.gift_storecount<all_num || discount.limit_num<all_limit_num ){  
2583 - no_gift_arr.push(discount.gift_id);  
2584 - //--进入下一个循环 --  
2585 - continue;  
2586 - }  
2587 -  
2588 -  
2589 - var url="/api/weshop/cart/delGift?store_id="+newd.store_id+"&user_id="  
2590 - +newd.user_id+"&goods_id="+newd.goods_id+"&is_gift=1&pick_id="+newd.pick_id+"&prom_id="+newd.prom_id 2632 + list2.goods.push(newd);
  2633 + var all_num = 0;
  2634 + var all_limit_num = 0;
  2635 +
  2636 + for (var i in alllist) {
  2637 + var list_item = alllist[i];
  2638 + for (var j in list_item.goods) {
  2639 + //如果赠品的ID一样,要进行统计数量
  2640 + if (list_item.goods[j].is_gift == 1 && list_item.goods[j].gift_id == newd.gift_id) {
  2641 + all_num += list_item.goods[j].goods_num;
  2642 + }
  2643 + if (list_item.goods[j].is_gift == 1 && list_item.goods[j].gift_id == newd.gift_id && list_item.goods[j].prom_id == p_item[0]) {
  2644 + all_limit_num += list_item.goods[j].goods_num;
  2645 + }
  2646 +
  2647 + }
  2648 + }
  2649 +
  2650 + //-- 赠品的数量超出库存数量和会员的限制,这里是保证所有的赠品部会超出 --
  2651 + if (discount.gift_storecount < all_num || discount.limit_num < all_limit_num) {
  2652 + no_gift_arr.push(discount.gift_id);
  2653 + //--进入下一个循环 --
  2654 + continue;
  2655 + }
  2656 +
  2657 +
  2658 + var url = "/api/weshop/cart/delGift?store_id=" + newd.store_id + "&user_id=" +
  2659 + newd.user_id + "&goods_id=" + newd.goods_id + "&is_gift=1&pick_id=" + newd.pick_id + "&prom_id=" + newd.prom_id
2591 await getApp().request.promiseDelete(url, {}) 2660 await getApp().request.promiseDelete(url, {})
2592 2661
2593 - var add_data=null;  
2594 - await getApp().request.promisePost("/api/weshop/cart/save", { data: newd }).then(res=>{  
2595 - if(res.data.code==0){  
2596 - add_data=res.data.data; 2662 + var add_data = null;
  2663 + await getApp().request.promisePost("/api/weshop/cart/save", {
  2664 + data: newd
  2665 + }).then(res => {
  2666 + if (res.data.code == 0) {
  2667 + add_data = res.data.data;
2597 } 2668 }
2598 }) 2669 })
2599 - if(add_data){  
2600 - newd.id=add_data.id; 2670 + if (add_data) {
  2671 + newd.id = add_data.id;
2601 list.goods.push(newd); 2672 list.goods.push(newd);
2602 - } 2673 + }
2603 } 2674 }
2604 2675
2605 } 2676 }
2606 //--更新购物车的前台渲染-- 2677 //--更新购物车的前台渲染--
2607 - var rq_text="requestData["+cindex+"]";  
2608 - this.setData({[rq_text]:list}); 2678 + var rq_text = "requestData[" + cindex + "]";
  2679 + this.setData({
  2680 + [rq_text]: list
  2681 + });
2609 2682
2610 - if(!t_prom_list || t_prom_list.length==0 ) return false; 2683 + if (!t_prom_list || t_prom_list.length == 0) return false;
2611 2684
2612 //-- 提示凑单的,放在最后显示 -- 2685 //-- 提示凑单的,放在最后显示 --
2613 - for(let prid in t_prom_list){  
2614 - var prom=t_prom_list[prid]; 2686 + for (let prid in t_prom_list) {
  2687 + var prom = t_prom_list[prid];
2615 //-- 获取凑单提示 -- 2688 //-- 获取凑单提示 --
2616 - await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{  
2617 - data:{prom_id:prom.id}  
2618 - }).then(res=>{  
2619 - if(res.data.code==0){  
2620 - var list=res.data.data;  
2621 - for(var i in list){  
2622 - var item=list[i];  
2623 - if(item.prom_type==0){  
2624 - if(ob.price<item.condition){  
2625 - var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)}  
2626 - make_up_arr.push(elem); break; 2689 + await getApp().request.promiseGet("/api/weshop/promgoodslist/list", {
  2690 + data: {
  2691 + prom_id: prom.id
  2692 + }
  2693 + }).then(res => {
  2694 + if (res.data.code == 0) {
  2695 + var list = res.data.data;
  2696 + for (var i in list) {
  2697 + var item = list[i];
  2698 + if (item.prom_type == 0) {
  2699 + if (ob.price < item.condition) {
  2700 + var elem = {
  2701 + prom_id: prom.id,
  2702 + diff_type: item.prom_type,
  2703 + diff: (item.condition - ob.price).toFixed(2),
  2704 + content: JSON.parse(item.preferential_type)
  2705 + }
  2706 + make_up_arr.push(elem);
  2707 + break;
2627 } 2708 }
2628 - }else{  
2629 - if(ob.num<item.condition){  
2630 - var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.num).toFixed(2), content:JSON.parse(item.preferential_type)}  
2631 - make_up_arr.push(elem);break; 2709 + } else {
  2710 + if (ob.num < item.condition) {
  2711 + var elem = {
  2712 + prom_id: prom.id,
  2713 + diff_type: item.prom_type,
  2714 + diff: (item.condition - ob.num).toFixed(2),
  2715 + content: JSON.parse(item.preferential_type)
  2716 + }
  2717 + make_up_arr.push(elem);
  2718 + break;
2632 } 2719 }
2633 } 2720 }
2634 } 2721 }
@@ -2637,50 +2724,56 @@ Page({ @@ -2637,50 +2724,56 @@ Page({
2637 } 2724 }
2638 2725
2639 2726
2640 - var diff_text="requestData["+cindex+"].make_up_arr"; 2727 + var diff_text = "requestData[" + cindex + "].make_up_arr";
2641 //-- 如果有凑单的话 -- 2728 //-- 如果有凑单的话 --
2642 - if(make_up_arr.length>0){  
2643 - this.setData({[diff_text]:make_up_arr});  
2644 - }else{  
2645 - this.setData({[diff_text]:null}); 2729 + if (make_up_arr.length > 0) {
  2730 + this.setData({
  2731 + [diff_text]: make_up_arr
  2732 + });
  2733 + } else {
  2734 + this.setData({
  2735 + [diff_text]: null
  2736 + });
2646 } 2737 }
2647 }, 2738 },
2648 2739
2649 //去凑单 2740 //去凑单
2650 - go_cou_dang:function (e) {  
2651 - var prom_id=e.currentTarget.dataset.prom_id;  
2652 - var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; 2741 + go_cou_dang: function (e) {
  2742 + var prom_id = e.currentTarget.dataset.prom_id;
  2743 + var url = "/pages/goods/goodsList/goodsList?prom_type=3&prom_id=" + prom_id;
2653 getApp().goto(url); 2744 getApp().goto(url);
2654 }, 2745 },
2655 2746
2656 //导航跳转 2747 //导航跳转
2657 - nav_goto:function(e){  
2658 - var url=e.currentTarget.dataset.url;  
2659 - if(!url || url=='') return;  
2660 - if(url[0]!='/') url='/'+url; 2748 + nav_goto: function (e) {
  2749 + var url = e.currentTarget.dataset.url;
  2750 + if (!url || url == '') return;
  2751 + if (url[0] != '/') url = '/' + url;
2661 getApp().goto(url); 2752 getApp().goto(url);
2662 }, 2753 },
2663 2754
2664 - refresh_input:function(){  
2665 - this.data.btn_click=0; 2755 + refresh_input: function () {
  2756 + this.data.btn_click = 0;
  2757 + },
  2758 +
  2759 + imageLoad: function (e) {
  2760 + var imgwidth = e.detail.width;
  2761 + var imgheight = e.detail.height;
  2762 + //宽高比
  2763 + var ratio = imgwidth / imgheight;
  2764 + //计算的高度值
  2765 + var viewHeight = 715 / ratio;
  2766 + var hei = this.data.max_sw_height;
  2767 +
  2768 + if (hei < viewHeight) {
  2769 + this.setData({
  2770 + max_sw_height: viewHeight
  2771 + });
  2772 + }
2666 }, 2773 },
2667 -  
2668 - imageLoad:function(e){  
2669 - var imgwidth = e.detail.width;  
2670 - var imgheight = e.detail.height;  
2671 - //宽高比  
2672 - var ratio = imgwidth / imgheight;  
2673 - //计算的高度值  
2674 - var viewHeight = 715 / ratio;  
2675 - var hei=this.data.max_sw_height;  
2676 -  
2677 - if (hei< viewHeight) {  
2678 - this.setData({ max_sw_height: viewHeight });  
2679 - }  
2680 - },  
2681 -  
2682 - go_url(e){  
2683 - var url=e.currentTarget.dataset.url; 2774 +
  2775 + go_url(e) {
  2776 + var url = e.currentTarget.dataset.url;
2684 getApp().goto(url); 2777 getApp().goto(url);
2685 }, 2778 },
2686 2779
@@ -2713,10 +2806,10 @@ Page({ @@ -2713,10 +2806,10 @@ Page({
2713 } 2806 }
2714 getApp().goto(good_url); 2807 getApp().goto(good_url);
2715 2808
2716 - }else{  
2717 - getApp().goto(good_url); 2809 + } else {
  2810 + getApp().goto(good_url);
2718 } 2811 }
2719 }) 2812 })
2720 } 2813 }
2721 - 2814 +
2722 }); 2815 });
2723 \ No newline at end of file 2816 \ No newline at end of file
pages/cart/cart/cart.wxml
@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 <view class="flex"> 43 <view class="flex">
44 <view>总数量:</view> 44 <view>总数量:</view>
45 <view class="goods_num">{{all_num}}</view> 45 <view class="goods_num">{{all_num}}</view>
  46 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="co-red weight_free">再买{{freight_free - total_fee}}元可享包邮({{weight_free}}kg内);</view>
46 </view> 47 </view>
47 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view> 48 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
48 <view wx:else bindtap="edit_cart" data-type="0">完成</view> 49 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
pages/cart/cart/cart.wxss
@@ -234,6 +234,12 @@ radio { @@ -234,6 +234,12 @@ radio {
234 margin-left: 13rpx; 234 margin-left: 13rpx;
235 } 235 }
236 236
  237 +.login-in .weight_free {
  238 + font-size: 26rpx;
  239 + line-height: 48rpx;
  240 + margin-left: 30rpx;
  241 +}
  242 +
237 .allradio { 243 .allradio {
238 width: 600rpx; 244 width: 600rpx;
239 height: 100%; 245 height: 100%;
pages/cart/cart/zh_calculate.js
1 module.exports = { 1 module.exports = {
2 //辅助数组添加元素功能 2 //辅助数组添加元素功能
3 - find_in_add: function(list, ele) { 3 + find_in_add: function (list, ele) {
4 for (var i in list) { 4 for (var i in list) {
5 var item = list[i]; 5 var item = list[i];
6 if (item.goods_id == ele.goods_id) { 6 if (item.goods_id == ele.goods_id) {
@@ -10,7 +10,7 @@ module.exports = { @@ -10,7 +10,7 @@ module.exports = {
10 list.push(ele); 10 list.push(ele);
11 }, 11 },
12 //辅助数组添加元素功能 12 //辅助数组添加元素功能
13 - find_in_remove: function(list, ele) { 13 + find_in_remove: function (list, ele) {
14 for (var i in list) { 14 for (var i in list) {
15 var item = list[i]; 15 var item = list[i];
16 if (item.goods_id == ele.goods_id) { 16 if (item.goods_id == ele.goods_id) {
@@ -20,7 +20,7 @@ module.exports = { @@ -20,7 +20,7 @@ module.exports = {
20 }, 20 },
21 21
22 //主要是把组合购的商品分离出来 22 //主要是把组合购的商品分离出来
23 - add_zhprom: function(car, a, ele) { 23 + add_zhprom: function (car, a, ele) {
24 var point = car[a]; 24 var point = car[a];
25 if (point.zh_map) { 25 if (point.zh_map) {
26 if (point.zh_map[ele.prom_id]) { 26 if (point.zh_map[ele.prom_id]) {
@@ -42,7 +42,7 @@ module.exports = { @@ -42,7 +42,7 @@ module.exports = {
42 } 42 }
43 }, 43 },
44 //未选中的商品,要从中剔除 44 //未选中的商品,要从中剔除
45 - remove_zhprom: function(car, a, ele) { 45 + remove_zhprom: function (car, a, ele) {
46 var point = car[a]; 46 var point = car[a];
47 if (point.zh_map) { 47 if (point.zh_map) {
48 if (point.zh_map[ele.prom_id]) { 48 if (point.zh_map[ele.prom_id]) {
@@ -52,14 +52,14 @@ module.exports = { @@ -52,14 +52,14 @@ module.exports = {
52 }, 52 },
53 53
54 //把组合购的商品价格计算出来,同时每个会员都有购买组合商品的上限!zh_b_num是已经购买了多少件 54 //把组合购的商品价格计算出来,同时每个会员都有购买组合商品的上限!zh_b_num是已经购买了多少件
55 - calculate_zh: function(car, a, th) { 55 + calculate_zh: function (car, a, th) {
56 var car_item = car[a]; 56 var car_item = car[a];
57 var tfeel = 0, 57 var tfeel = 0,
58 offline_price = 0, 58 offline_price = 0,
59 offline_num = 0; 59 offline_num = 0;
60 var txt = "requestData[" + a + "].need_list"; 60 var txt = "requestData[" + a + "].need_list";
61 - //活动的列表都存储在这里面,可以快速查询  
62 - var zh_prom_goods=car_item.zh_prom_goods; 61 + //活动的列表都存储在这里面,可以快速查询
  62 + var zh_prom_goods = car_item.zh_prom_goods;
63 if (!car_item.zh_map || !zh_prom_goods) { 63 if (!car_item.zh_map || !zh_prom_goods) {
64 var res = { 64 var res = {
65 tfeel: tfeel, 65 tfeel: tfeel,
@@ -71,7 +71,7 @@ module.exports = { @@ -71,7 +71,7 @@ module.exports = {
71 }); 71 });
72 return res; 72 return res;
73 } 73 }
74 - 74 +
75 //因为可能有多个组合购的活动 75 //因为可能有多个组合购的活动
76 for (var i in car_item.zh_map) { 76 for (var i in car_item.zh_map) {
77 var bitem = car_item.zh_map[i]; 77 var bitem = car_item.zh_map[i];
@@ -81,14 +81,13 @@ module.exports = { @@ -81,14 +81,13 @@ module.exports = {
81 var need_to_buy = 0; 81 var need_to_buy = 0;
82 var all_zhqty = 0; //所有商品要求起购数之和 82 var all_zhqty = 0; //所有商品要求起购数之和
83 var no_in_arr = []; //剩余的未加入组合购 83 var no_in_arr = []; //剩余的未加入组合购
84 - var out_arr=[]; //超出活动限购的商品放入  
85 -  
86 - var title =""; //提示语; 84 + var out_arr = []; //超出活动限购的商品放入
  85 + var zhqty_bz = []; //超量
  86 + var title = ""; //提示语;
87 //var goods = bitem.goods; 87 //var goods = bitem.goods;
88 var goods = zh_prom_goods[act.id]; 88 var goods = zh_prom_goods[act.id];
89 -  
90 - for (let v3 in car_item.goods) {  
91 - car_item.goods[v3].need_downlow_num=0; 89 + for (let v3 in car_item.goods) {
  90 + car_item.goods[v3].need_downlow_num = 0;
92 } 91 }
93 92
94 //寻找一下 93 //寻找一下
@@ -102,71 +101,76 @@ module.exports = { @@ -102,71 +101,76 @@ module.exports = {
102 return 0; 101 return 0;
103 } 102 }
104 103
105 - //寻找一下  
106 - function get_num2(ite) {  
107 - for (let v2 in car_item.goods) {  
108 - var vh = car_item.goods[v2];  
109 - if (vh.goods_id == ite.goods_id) {  
110 - return vh;  
111 - }  
112 - }  
113 - return 0;  
114 - } 104 + //寻找一下
  105 + function get_num2(ite) {
  106 + for (let v2 in car_item.goods) {
  107 + var vh = car_item.goods[v2];
  108 + if (vh.goods_id == ite.goods_id) {
  109 + return vh;
  110 + }
  111 + }
  112 + return 0;
  113 + }
115 114
116 for (var i in goods) { 115 for (var i in goods) {
117 var item = goods[i]; 116 var item = goods[i];
118 - item.goods_price=get_num(item).goods_price;  
119 - item.offline_price=get_num(item).offline_price;  
120 - var cart_num=get_num(item).goods_num;  
121 - var zh_b_num=get_num2(item).zh_b_num;  
122 - if(!cart_num) {  
123 - if (item.zhqty) {  
124 - title="必买商品未加购,下单立享【"+act.zhprice+"元任选"+act.zhbuyqty+"件】";  
125 - need_to_buy += item.zhqty;  
126 - }  
127 - continue; 117 + item.goods_price = get_num(item).goods_price;
  118 + item.offline_price = get_num(item).offline_price;
  119 + var cart_num = get_num(item).goods_num;
  120 + var zh_b_num = get_num2(item).zh_b_num;
  121 + if (!cart_num) {
  122 + if (item.zhqty) {
  123 + title = "必买商品未加购,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
  124 + need_to_buy += item.zhqty;
  125 + }
  126 + continue;
128 } 127 }
129 128
130 - item.cart_num =cart_num;  
131 - //-- 当商品有购买的时候,以及有限购的时候 --  
132 - if(item.buyqty>0){  
133 -  
134 - console.log(111,th.data.in_zhact_gdmap);  
135 -  
136 - var cbuy=item.buyqty-zh_b_num;  
137 - var key=item.goods_id+""+act.id;  
138 - if(th.data.in_zhact_gdmap[key]){  
139 - var cbuy=item.buyqty-zh_b_num-th.data.in_zhact_gdmap[key];  
140 - }  
141 - //当可买的数量为0  
142 - if(cbuy<=0){  
143 - item.num=0;  
144 - out_arr.push({  
145 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num  
146 - })  
147 - }else{  
148 - if(cbuy>=cart_num) item.num =cart_num;  
149 - else{  
150 - item.num =cbuy;  
151 - out_arr.push({  
152 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy  
153 - })  
154 - }  
155 - }  
156 -  
157 - }else{  
158 - item.num =cart_num; 129 + item.cart_num = cart_num;
  130 + //-- 当商品有购买的时候,以及有限购的时候 --
  131 + if (item.buyqty > 0) {
  132 + console.log(111, th.data.in_zhact_gdmap);
  133 + var cbuy = item.buyqty - zh_b_num;
  134 + var key = item.goods_id + "" + act.id;
  135 + if (th.data.in_zhact_gdmap[key]) {
  136 + var cbuy = item.buyqty - zh_b_num - th.data.in_zhact_gdmap[key];
  137 + }
  138 + //当可买的数量为0
  139 + if (cbuy <= 0) {
  140 + item.num = 0;
  141 + out_arr.push({
  142 + price: item.goods_price,
  143 + offline_price: item.offline_price,
  144 + goods_id: item.goods_id,
  145 + num: cart_num
  146 + })
  147 + } else {
  148 + if (cbuy >= cart_num) item.num = cart_num;
  149 + else {
  150 + item.num = cbuy;
  151 + out_arr.push({
  152 + price: item.goods_price,
  153 + offline_price: item.offline_price,
  154 + goods_id: item.goods_id,
  155 + num: cart_num - cbuy
  156 + })
  157 + }
  158 + }
  159 +
  160 + } else {
  161 + item.num = cart_num;
159 } 162 }
160 163
161 - item.goods_price=get_num(item).goods_price;  
162 - item.offline_price=get_num(item).offline_price;  
163 - if(item.cart_num){  
164 - all_price += item.cart_num * item.goods_price; 164 + item.goods_price = get_num(item).goods_price;
  165 + item.offline_price = get_num(item).offline_price;
  166 + if (item.cart_num) {
  167 + all_price += item.cart_num * item.goods_price;
165 } 168 }
166 if (item.num) { 169 if (item.num) {
167 all_num += item.num; 170 all_num += item.num;
168 //当有起购数的控制的时候 171 //当有起购数的控制的时候
169 if (item.zhqty) { 172 if (item.zhqty) {
  173 + zhqty_bz.push(item);
170 all_zhqty += item.zhqty; 174 all_zhqty += item.zhqty;
171 if (item.num < item.zhqty) { 175 if (item.num < item.zhqty) {
172 need_to_buy += item.zhqty - item.num; 176 need_to_buy += item.zhqty - item.num;
@@ -174,20 +178,24 @@ module.exports = { @@ -174,20 +178,24 @@ module.exports = {
174 if (item.num > item.zhqty) { 178 if (item.num > item.zhqty) {
175 for (var i = 0; i < item.num - item.zhqty; i++) { 179 for (var i = 0; i < item.num - item.zhqty; i++) {
176 no_in_arr.push({ 180 no_in_arr.push({
177 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id 181 + price: item.goods_price,
  182 + offline_price: item.offline_price,
  183 + goods_id: item.goods_id
178 }) 184 })
179 } 185 }
180 } 186 }
181 } else { 187 } else {
182 for (var j = 0; j < item.num; j++) { 188 for (var j = 0; j < item.num; j++) {
183 no_in_arr.push({ 189 no_in_arr.push({
184 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id 190 + price: item.goods_price,
  191 + offline_price: item.offline_price,
  192 + goods_id: item.goods_id
185 }) 193 })
186 } 194 }
187 } 195 }
188 } else { 196 } else {
189 - if (item.zhqty) {  
190 - title="必买商品未加购,下单立享【"+act.zhprice+"元任选"+act.zhbuyqty+"件】"; 197 + if (item.zhqty) {
  198 + title = "必买商品未加购,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
191 need_to_buy += item.zhqty; 199 need_to_buy += item.zhqty;
192 } 200 }
193 } 201 }
@@ -195,83 +203,97 @@ module.exports = { @@ -195,83 +203,97 @@ module.exports = {
195 203
196 //当满足组合的要求:总数要满足,起购数要满足 204 //当满足组合的要求:总数要满足,起购数要满足
197 if (all_num >= act.zhbuyqty && !need_to_buy) { 205 if (all_num >= act.zhbuyqty && !need_to_buy) {
198 - //商品的列表  
199 - for (var u in goods) {  
200 - var ite=goods[u];  
201 - if(ite.buyqty>0 && ite.num>0){  
202 -  
203 - console.log(222,th.data.in_zhact_gdmap);  
204 -  
205 - var key=ite.goods_id+""+act.id;  
206 - if(th.data.in_zhact_gdmap[key]){  
207 - th.data.in_zhact_gdmap[key]+=ite.num;  
208 - }else{  
209 - th.data.in_zhact_gdmap[key]=ite.num;  
210 - }  
211 - } 206 + //商品的列表
  207 + for (var u in goods) {
  208 + var ite = goods[u];
  209 + if (ite.buyqty > 0 && ite.num > 0) {
  210 +
  211 + console.log(222, th.data.in_zhact_gdmap);
  212 +
  213 + var key = ite.goods_id + "" + act.id;
  214 + if (th.data.in_zhact_gdmap[key]) {
  215 + th.data.in_zhact_gdmap[key] += ite.num;
  216 + } else {
  217 + th.data.in_zhact_gdmap[key] = ite.num;
  218 + }
  219 + }
212 } 220 }
213 221
214 - function sortData(a, b) {  
215 - return a.price - b.price  
216 - }  
217 - if(no_in_arr.length>0) no_in_arr.sort(sortData); 222 + function sortData(a, b) {
  223 + return a.price - b.price
  224 + }
  225 + if (no_in_arr.length > 0) no_in_arr.sort(sortData);
218 226
219 var aprice = act.zhprice; 227 var aprice = act.zhprice;
220 if (act.zhbuyqty > all_zhqty) { 228 if (act.zhbuyqty > all_zhqty) {
221 - for (var n = 0; n < act.zhbuyqty-all_zhqty; n++) { 229 + for (var n = 0; n < act.zhbuyqty - all_zhqty; n++) {
222 no_in_arr.pop(); 230 no_in_arr.pop();
223 } 231 }
224 } 232 }
225 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 233 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
226 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 234 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
227 //看一下是几倍 235 //看一下是几倍
  236 + let num = 0;
  237 + let bz_num = 0;
228 var be = parseInt(no_in_arr.length / act.zhbuyqty); 238 var be = parseInt(no_in_arr.length / act.zhbuyqty);
229 - aprice += be * act.zhprice;  
230 - for (var m = 0; m < be * act.zhbuyqty; m++) {  
231 - no_in_arr.pop(); 239 + if (act.is_bzyh && zhqty_bz.length > 0) {
  240 + for (let i = 0; i < zhqty_bz.length; i++) {
  241 + let item = zhqty_bz[i];
  242 + bz_num = be * item.zhqty;
  243 + for (let j = 0; j < no_in_arr.length; j++) {
  244 + let i = no_in_arr[j];
  245 + if (item.goods_id === i.goods_id) {
  246 + num++
  247 + }
  248 + }
  249 + }
  250 + }
  251 + if (bz_num <= num) {
  252 + aprice += be * act.zhprice;
  253 + for (var m = 0; m < be * act.zhbuyqty; m++) {
  254 + no_in_arr.pop();
  255 + }
232 } 256 }
233 } 257 }
234 //算一下剩余的钱 258 //算一下剩余的钱
235 if (no_in_arr.length) { 259 if (no_in_arr.length) {
236 for (var ii in no_in_arr) { 260 for (var ii in no_in_arr) {
237 var item = no_in_arr[ii]; 261 var item = no_in_arr[ii];
238 - var gitem=get_num2(item);  
239 - if(gitem) {  
240 - if (!gitem.need_downlow_num) {  
241 - gitem.need_downlow_num = 1;  
242 - }  
243 - else {  
244 - gitem.need_downlow_num++;  
245 - }  
246 - aprice += item.price;  
247 - if (item.offline_price) {  
248 - offline_price += gitem.goods_price - gitem.offline_price;  
249 - offline_num += 1;  
250 - }  
251 - } 262 + var gitem = get_num2(item);
  263 + if (gitem) {
  264 + if (!gitem.need_downlow_num) {
  265 + gitem.need_downlow_num = 1;
  266 + } else {
  267 + gitem.need_downlow_num++;
  268 + }
  269 + aprice += item.price;
  270 + if (item.offline_price) {
  271 + offline_price += gitem.goods_price - gitem.offline_price;
  272 + offline_num += 1;
  273 + }
  274 + }
252 } 275 }
253 } 276 }
254 277
255 //超量的部分也要计算一下 278 //超量的部分也要计算一下
256 - if(out_arr.length){  
257 - for (var m in out_arr) {  
258 - var item = out_arr[m];  
259 - var gitem=get_num2(item);  
260 - if(gitem) {  
261 - if (!gitem.need_downlow_num) {  
262 - gitem.need_downlow_num = item.num;  
263 - }  
264 - else {  
265 - gitem.need_downlow_num+=item.num;  
266 - }  
267 - aprice += item.price*item.num;  
268 - if (item.offline_price && th.data.sales_rules==2) {  
269 - offline_price += (gitem.goods_price - gitem.offline_price)*item.num;  
270 - offline_num += item.num;  
271 - } 279 + if (out_arr.length) {
  280 + for (var m in out_arr) {
  281 + var item = out_arr[m];
  282 + var gitem = get_num2(item);
  283 + if (gitem) {
  284 + if (!gitem.need_downlow_num) {
  285 + gitem.need_downlow_num = item.num;
  286 + } else {
  287 + gitem.need_downlow_num += item.num;
  288 + }
  289 + aprice += item.price * item.num;
  290 + if (item.offline_price && th.data.sales_rules == 2) {
  291 + offline_price += (gitem.goods_price - gitem.offline_price) * item.num;
  292 + offline_num += item.num;
  293 + }
272 294
273 } 295 }
274 - } 296 + }
275 } 297 }
276 298
277 299
@@ -291,16 +313,16 @@ module.exports = { @@ -291,16 +313,16 @@ module.exports = {
291 } else { 313 } else {
292 for (var ii in goods) { 314 for (var ii in goods) {
293 var item = goods[ii]; 315 var item = goods[ii];
294 - var gitem=get_num2(item);  
295 - if(gitem && gitem.selected) { 316 + var gitem = get_num2(item);
  317 + if (gitem && gitem.selected) {
296 318
297 - gitem.need_downlow_num = gitem.goods_num; 319 + gitem.need_downlow_num = gitem.goods_num;
298 320
299 - if (item.offline_price && th.data.sales_rules==2) {  
300 - offline_price += (item.goods_price - item.offline_price) * gitem.goods_num;  
301 - offline_num += gitem.goods_num;  
302 - }  
303 - } 321 + if (item.offline_price && th.data.sales_rules == 2) {
  322 + offline_price += (item.goods_price - item.offline_price) * gitem.goods_num;
  323 + offline_num += gitem.goods_num;
  324 + }
  325 + }
304 } 326 }
305 if (act.zhbuyqty - all_num > need_to_buy) { 327 if (act.zhbuyqty - all_num > need_to_buy) {
306 need_to_buy = act.zhbuyqty - all_num; 328 need_to_buy = act.zhbuyqty - all_num;
@@ -317,8 +339,8 @@ module.exports = { @@ -317,8 +339,8 @@ module.exports = {
317 } 339 }
318 } else { 340 } else {
319 var index = this.find_need_to(need_to, act); 341 var index = this.find_need_to(need_to, act);
320 - if(title=='')  
321 - title = "再买" + need_to_buy + "件,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】"; 342 + if (title == '')
  343 + title = "再买" + need_to_buy + "件,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
322 if (index != -1) { 344 if (index != -1) {
323 need_to[index].title = title; 345 need_to[index].title = title;
324 } else { 346 } else {
@@ -339,7 +361,7 @@ module.exports = { @@ -339,7 +361,7 @@ module.exports = {
339 tfeel += all_price; 361 tfeel += all_price;
340 } 362 }
341 363
342 - console.log('nyf111'); 364 + console.log('nyf111');
343 console.log(car_item); 365 console.log(car_item);
344 366
345 var res = { 367 var res = {
@@ -352,7 +374,7 @@ module.exports = { @@ -352,7 +374,7 @@ module.exports = {
352 374
353 }, 375 },
354 376
355 - find_need_to: function(list, iter) { 377 + find_need_to: function (list, iter) {
356 if (!list || list.length <= 0) return -1; 378 if (!list || list.length <= 0) return -1;
357 for (var i in list) { 379 for (var i in list) {
358 var item = list[i]; 380 var item = list[i];
@@ -364,30 +386,31 @@ module.exports = { @@ -364,30 +386,31 @@ module.exports = {
364 }, 386 },
365 387
366 //筛选组合购,纯粹的数组按活动id分组 388 //筛选组合购,纯粹的数组按活动id分组
367 - find_split: function(arr) { 389 + find_split: function (arr) {
368 //过滤只有团购的商品 390 //过滤只有团购的商品
369 - var oarr = arr.goods.filter(function(ele) { 391 + var oarr = arr.goods.filter(function (ele) {
370 return ele.prom_type == 7 392 return ele.prom_type == 7
371 }) 393 })
372 - if(!oarr || oarr.length==0) return null; 394 + if (!oarr || oarr.length == 0) return null;
373 //看一下有多少个不同的团购 395 //看一下有多少个不同的团购
374 - var map = {},dest = []; 396 + var map = {},
  397 + dest = [];
375 for (var i = 0; i < oarr.length; i++) { 398 for (var i = 0; i < oarr.length; i++) {
376 var ai = oarr[i]; 399 var ai = oarr[i];
377 - var index=map[ai.prom_id]  
378 - if (!index) { 400 + var index = map[ai.prom_id]
  401 + if (!index) {
379 dest.push({ 402 dest.push({
380 prom_id: ai.prom_id, 403 prom_id: ai.prom_id,
381 data: [ai] 404 data: [ai]
382 }); 405 });
383 - map[ai.prom_id]=dest.length; //存储下标  
384 - } else {  
385 - var dj = dest[index-1];  
386 - dj.data.push(ai); 406 + map[ai.prom_id] = dest.length; //存储下标
  407 + } else {
  408 + var dj = dest[index - 1];
  409 + dj.data.push(ai);
387 } 410 }
388 } 411 }
389 return dest; 412 return dest;
390 } 413 }
391 414
392 415
393 -} 416 -}
  417 +}
394 \ No newline at end of file 418 \ No newline at end of file
pages/cart/cart2/cart2.js
@@ -146,12 +146,20 @@ Page({ @@ -146,12 +146,20 @@ Page({
146 } 146 }
147 }); 147 });
148 148
149 - //阶梯购的立即购买 149 + //阶梯购 或者 组合购的立即购买
150 if(t.state){ 150 if(t.state){
151 th.data.state=1; 151 th.data.state=1;
152 } 152 }
153 -  
154 - 153 + getApp().promiseGet("/api/wx/weappSendlist/page", {
  154 + data: {
  155 + store_id: os.stoid,
  156 + typeid: "1001"
  157 + }}).then(res=>{
  158 + if (res.data.code == 0 && res.data.data.pageData.length > 0) {
  159 + var template_id = res.data.data.pageData[0].template_id;
  160 + th.setData({template_id:template_id});
  161 + }
  162 + })
155 }, 163 },
156 onUnload: function () { 164 onUnload: function () {
157 this.setData({isclose: 1}) 165 this.setData({isclose: 1})
@@ -883,7 +891,6 @@ Page({ @@ -883,7 +891,6 @@ Page({
883 } 891 }
884 } 892 }
885 893
886 -  
887 gd.prom_type=gg.prom_type?gg.prom_type:0; 894 gd.prom_type=gg.prom_type?gg.prom_type:0;
888 gd.prom_id=gg.prom_id?gg.prom_id:0; 895 gd.prom_id=gg.prom_id?gg.prom_id:0;
889 896
@@ -1025,7 +1032,7 @@ Page({ @@ -1025,7 +1032,7 @@ Page({
1025 th.data.old_cartlist = cart_arr; 1032 th.data.old_cartlist = cart_arr;
1026 } 1033 }
1027 th.setData({ 1034 th.setData({
1028 - bn_goods: t.data.data, bn_pickname: gg.pick_name, index: m_wind, 1035 + bn_goods: gd, bn_pickname: gg.pick_name, index: m_wind,
1029 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et 1036 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
1030 }); 1037 });
1031 1038
@@ -1333,7 +1340,7 @@ Page({ @@ -1333,7 +1340,7 @@ Page({
1333 }, 1340 },
1334 1341
1335 //-------------------计算订单价格------------------- 1342 //-------------------计算订单价格-------------------
1336 - calculatePrice: function (t, s) { 1343 + calculatePrice : function (t, s) {
1337 var th = this; 1344 var th = this;
1338 to.getConfig2(function (ee) { 1345 to.getConfig2(function (ee) {
1339 to.getwuliuprice(async function (rs) { 1346 to.getwuliuprice(async function (rs) {
@@ -1353,10 +1360,11 @@ Page({ @@ -1353,10 +1360,11 @@ Page({
1353 1360
1354 var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); 1361 var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0);
1355 var freight_free = ee.freight_free; //全场满多少包邮 1362 var freight_free = ee.freight_free; //全场满多少包邮
  1363 + var weight_free = ee.weight_free; //多少kg内包邮
1356 var no_ex_id = ee.no_ex_id; 1364 var no_ex_id = ee.no_ex_id;
1357 var no_ex_good = null; 1365 var no_ex_good = null;
1358 var by_qc = {}; 1366 var by_qc = {};
1359 - 1367 + var out_of_weight=0; //超出多少重量
1360 if (no_ex_id && freight_free > 0) { 1368 if (no_ex_id && freight_free > 0) {
1361 //-----------获取不包邮区域,不包邮商品------- 1369 //-----------获取不包邮区域,不包邮商品-------
1362 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 1370 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
@@ -1466,6 +1474,16 @@ Page({ @@ -1466,6 +1474,16 @@ Page({
1466 o_price_no_zh += item[j].goods_price * item[j].goods_num; 1474 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1467 } 1475 }
1468 o_price += item[j].goods_price * item[j].goods_num; 1476 o_price += item[j].goods_price * item[j].goods_num;
  1477 +
  1478 + //判断是否有设置限制重量包邮
  1479 + if(weight_free){
  1480 + if( item[j]['exp_sum_type']==2 ){
  1481 + if (goods_weight < 0) goods_weight = 0;
  1482 + //累积商品重量 每种商品的重量 * 数量
  1483 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1484 + out_of_weight = (weight_free*1000) - goods_weight;
  1485 + }
  1486 + }
1469 } 1487 }
1470 //判断是不是有组合购的金额 1488 //判断是不是有组合购的金额
1471 var f_o_price = o_price; 1489 var f_o_price = o_price;
@@ -1515,9 +1533,8 @@ Page({ @@ -1515,9 +1533,8 @@ Page({
1515 //计算物流费用 1533 //计算物流费用
1516 cart_item.shipping_price = 0; 1534 cart_item.shipping_price = 0;
1517 1535
1518 -  
1519 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- 1536 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
1520 - if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) { 1537 + if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) && out_of_weight > 0) {
1521 //如果有设置不包邮区域的时候 1538 //如果有设置不包邮区域的时候
1522 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { 1539 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
1523 if (th.check_by_area(by_qc.region_list)) { 1540 if (th.check_by_area(by_qc.region_list)) {
@@ -1640,13 +1657,13 @@ Page({ @@ -1640,13 +1657,13 @@ Page({
1640 //统一运费 1657 //统一运费
1641 o_shipping_price += item[j]['uniform_exp_sum']; 1658 o_shipping_price += item[j]['uniform_exp_sum'];
1642 break; 1659 break;
1643 - case 2:  
1644 - +''  
1645 - if (goods_weight < 0) goods_weight = 0;  
1646 - //累积商品重量 每种商品的重量 * 数量  
1647 - goods_weight += item[j]['weight'] * item[j]['goods_num'];  
1648 -  
1649 - break; 1660 + // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮
  1661 + // +''
  1662 + // if (goods_weight < 0) goods_weight = 0;
  1663 + // //累积商品重量 每种商品的重量 * 数量
  1664 + // goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1665 + // out_of_weight = (weight_free*1000) - goods_weight;
  1666 + // break;
1650 case 3: 1667 case 3:
1651 if (goods_piece < 0) goods_piece = 0; 1668 if (goods_piece < 0) goods_piece = 0;
1652 //累积商品数量 1669 //累积商品数量
@@ -1655,6 +1672,11 @@ Page({ @@ -1655,6 +1672,11 @@ Page({
1655 } 1672 }
1656 } 1673 }
1657 1674
  1675 + }else{
  1676 + if(goods_weight && out_of_weight !==0){
  1677 + goods_weight=-1;
  1678 + out_of_weight=0;
  1679 + }
1658 } 1680 }
1659 } 1681 }
1660 1682
@@ -1665,7 +1687,7 @@ Page({ @@ -1665,7 +1687,7 @@ Page({
1665 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) 1687 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
1666 code = th.data.wu_arr[cart_item.wind].code; 1688 code = th.data.wu_arr[cart_item.wind].code;
1667 cart_item.shipping_price = 1689 cart_item.shipping_price =
1668 - th.calculatewuliu(code, o_shipping_price, goods_weight, 1690 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
1669 goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); 1691 goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs);
1670 1692
1671 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1693 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
@@ -1851,7 +1873,7 @@ Page({ @@ -1851,7 +1873,7 @@ Page({
1851 1873
1852 1874
1853 //---------计算立即购买---------- 1875 //---------计算立即购买----------
1854 - calculatePrice2: function () { 1876 + calculatePrice2 : function () {
1855 var th = this, good = this.data.bn_goods; 1877 var th = this, good = this.data.bn_goods;
1856 1878
1857 if (!good) return false; 1879 if (!good) return false;
@@ -1893,7 +1915,11 @@ Page({ @@ -1893,7 +1915,11 @@ Page({
1893 to.getConfig2(function (ee) { 1915 to.getConfig2(function (ee) {
1894 to.getwuliuprice(async function (rs) { 1916 to.getwuliuprice(async function (rs) {
1895 1917
1896 - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 1918 + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1;
  1919 + var out_of_weight=null; //超出多少重量
  1920 + var freight_free = ee.freight_free; //全场满多少包邮
  1921 + var weight_free = ee.weight_free; //多少kg内包邮
  1922 + var no_ex_id = ee.no_ex_id;
1897 1923
1898 //---如果有选择优惠券的情况下--- 1924 //---如果有选择优惠券的情况下---
1899 var quan_price = 0, bn_pick = th.data.bn_pick; 1925 var quan_price = 0, bn_pick = th.data.bn_pick;
@@ -1959,8 +1985,10 @@ Page({ @@ -1959,8 +1985,10 @@ Page({
1959 break; 1985 break;
1960 case 2: 1986 case 2:
1961 if (goods_weight < 0) goods_weight = 0; 1987 if (goods_weight < 0) goods_weight = 0;
  1988 + //dw
1962 //累积商品重量 每种商品的重量 * 数量 1989 //累积商品重量 每种商品的重量 * 数量
1963 goods_weight += good['weight'] * good['buynum']; 1990 goods_weight += good['weight'] * good['buynum'];
  1991 + out_of_weight = (weight_free * 1000 ) - goods_weight;
1964 break; 1992 break;
1965 case 3: 1993 case 3:
1966 if (goods_piece < 0) goods_piece = 0; 1994 if (goods_piece < 0) goods_piece = 0;
@@ -1971,8 +1999,7 @@ Page({ @@ -1971,8 +1999,7 @@ Page({
1971 1999
1972 var code = ""; 2000 var code = "";
1973 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 2001 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
1974 - var freight_free = ee.freight_free; //全场满多少包邮  
1975 - var no_ex_id = ee.no_ex_id; 2002 +
1976 th.data.is_no_by[th.data.bn_pick] = 0; 2003 th.data.is_no_by[th.data.bn_pick] = 0;
1977 2004
1978 var no_by_data = null; 2005 var no_by_data = null;
@@ -2008,12 +2035,12 @@ Page({ @@ -2008,12 +2035,12 @@ Page({
2008 th.data.is_by[th.data.bn_pick] = 0; 2035 th.data.is_by[th.data.bn_pick] = 0;
2009 //--------------开始计算物流------------------ 2036 //--------------开始计算物流------------------
2010 var shipping_price = 2037 var shipping_price =
2011 - th.calculatewuliu(code, o_shipping_price, goods_weight, 2038 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
2012 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 2039 goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
2013 2040
2014 //如果有赠品的时候,也要计算赠品的物流费用 2041 //如果有赠品的时候,也要计算赠品的物流费用
2015 if (th.data.buy_now_gift_goods) { 2042 if (th.data.buy_now_gift_goods) {
2016 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, 2043 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,
2017 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 2044 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
2018 } 2045 }
2019 2046
@@ -2186,10 +2213,26 @@ Page({ @@ -2186,10 +2213,26 @@ Page({
2186 }); 2213 });
2187 }, 2214 },
2188 2215
2189 - //--------------------提交订单-----------------------  
2190 - async submitForm(t){  
2191 - var sub_value = t; 2216 + requestSubscribe(){
  2217 + const th=this;
  2218 + const template_id = this.data.template_id;
  2219 + wx.getSetting({
  2220 + withSubscriptions:true,
  2221 + success(res){
  2222 + let itemSettings=res.subscriptionsSetting.itemSettings;
  2223 + if(itemSettings && itemSettings[template_id]=="accept"){
  2224 + th.submit_func();
  2225 + }else{
  2226 + th.sendsm(function(){
  2227 + th.submit_func();
  2228 + })
  2229 + }
  2230 + }
  2231 + })
  2232 + },
2192 2233
  2234 + //--------------------提交订单-----------------------
  2235 + async submit_func(){
2193 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 2236 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
2194 this.data.is_summit_ing = 1; 2237 this.data.is_summit_ing = 1;
2195 var th = this, pdata = new Array(); 2238 var th = this, pdata = new Array();
@@ -2233,7 +2276,7 @@ Page({ @@ -2233,7 +2276,7 @@ Page({
2233 'user_money': th.data.formData.user_money, //使用余额 2276 'user_money': th.data.formData.user_money, //使用余额
2234 'total_amount': th.data.formData.total_amount, //订单总价 2277 'total_amount': th.data.formData.total_amount, //订单总价
2235 'order_amount': th.data.formData.order_amount, //应付 2278 'order_amount': th.data.formData.order_amount, //应付
2236 - 'user_note': t.detail.value.user_note, //用户备注 2279 + 'user_note': th.data.user_note, //用户备注
2237 'store_id': oo.stoid, //商家 2280 'store_id': oo.stoid, //商家
2238 'pickup_id': th.data.bn_pick, //门店 2281 'pickup_id': th.data.bn_pick, //门店
2239 'exp_type': th.data.bn_exp_type, //配送方式 2282 'exp_type': th.data.bn_exp_type, //配送方式
@@ -2432,7 +2475,7 @@ Page({ @@ -2432,7 +2475,7 @@ Page({
2432 2475
2433 var addr = th.data.user_addr; 2476 var addr = th.data.user_addr;
2434 if (th.data.is_all_zt == 1) addr = null; 2477 if (th.data.is_all_zt == 1) addr = null;
2435 - var val_arr = t.detail.value; 2478 + var val_arr = th.data.user_note;
2436 2479
2437 if (th.data.is_all_zt != 1) 2480 if (th.data.is_all_zt != 1)
2438 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { 2481 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
@@ -2465,7 +2508,7 @@ Page({ @@ -2465,7 +2508,7 @@ Page({
2465 'user_money': t_item.user_money, //使用余额 2508 'user_money': t_item.user_money, //使用余额
2466 'total_amount': t_item.total_amount, //订单总价 2509 'total_amount': t_item.total_amount, //订单总价
2467 'order_amount': t_item.order_amount, //应付 2510 'order_amount': t_item.order_amount, //应付
2468 - 'user_note': val_arr['user_note_' + t_item.pickup_id], //用户备注 2511 + 'user_note': val_arr[i], //用户备注
2469 'store_id': oo.stoid, //商家 2512 'store_id': oo.stoid, //商家
2470 'pickup_id': t_item.pickup_id, //门店 2513 'pickup_id': t_item.pickup_id, //门店
2471 'exp_type': t_item.exp_type, //配送方式 2514 'exp_type': t_item.exp_type, //配送方式
@@ -2774,7 +2817,7 @@ Page({ @@ -2774,7 +2817,7 @@ Page({
2774 } else if (res.confirm) { 2817 } else if (res.confirm) {
2775 th.data.is_continue = 1; 2818 th.data.is_continue = 1;
2776 th.data.is_summit_ing = 0; //是否提交中 2819 th.data.is_summit_ing = 0; //是否提交中
2777 - th.submitForm(sub_value); 2820 + th.submit_func();
2778 } 2821 }
2779 } 2822 }
2780 }) 2823 })
@@ -2966,12 +3009,12 @@ Page({ @@ -2966,12 +3009,12 @@ Page({
2966 th.calculatePrice(); 3009 th.calculatePrice();
2967 }, 3010 },
2968 //-------------------计算物流--------------- 3011 //-------------------计算物流---------------
2969 - calculatewuliu: function (code, o_shipping_price, goods_weight, 3012 + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
2970 goods_piece, user_addr, freight_free, o_price, rs) { 3013 goods_piece, user_addr, freight_free, o_price, rs) {
2971 var price = 0, th = this; 3014 var price = 0, th = this;
2972 price += parseFloat(o_shipping_price); 3015 price += parseFloat(o_shipping_price);
2973 //如果是包邮 3016 //如果是包邮
2974 - if (freight_free > 0 && o_price >= freight_free) { 3017 + if (freight_free > 0 && o_price >= freight_free && out_of_weight>0) {
2975 return 0; 3018 return 0;
2976 } 3019 }
2977 if (user_addr == null) { 3020 if (user_addr == null) {
@@ -2989,7 +3032,7 @@ Page({ @@ -2989,7 +3032,7 @@ Page({
2989 item = item.config; 3032 item = item.config;
2990 if (item == null) return o_shipping_price; 3033 if (item == null) return o_shipping_price;
2991 //------按重量---------- 3034 //------按重量----------
2992 - if (goods_weight >= 0 && item['money']) { 3035 + if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
2993 fw_price = parseFloat(item['money']); 3036 fw_price = parseFloat(item['money']);
2994 if (goods_weight > item['first_weight']) { 3037 if (goods_weight > item['first_weight']) {
2995 var fw = goods_weight - item['first_weight']; 3038 var fw = goods_weight - item['first_weight'];
@@ -2997,6 +3040,13 @@ Page({ @@ -2997,6 +3040,13 @@ Page({
2997 fw_price = fw_price + n * parseFloat(item['add_money']); 3040 fw_price = fw_price + n * parseFloat(item['add_money']);
2998 } 3041 }
2999 } 3042 }
  3043 + //------超出重量----------
  3044 + if(out_of_weight < 0){
  3045 + fw_price = parseFloat(item['money']);
  3046 + var out_of_weight = Math.abs(out_of_weight);
  3047 + var n = Math.ceil(out_of_weight / item['second_weight'])
  3048 + fw_price = fw_price + n * parseFloat(item['add_money']);
  3049 + }
3000 //------按件数---------- 3050 //------按件数----------
3001 if (goods_piece > 0 && item['piecemoney']) { 3051 if (goods_piece > 0 && item['piecemoney']) {
3002 fp_price = parseFloat(item['piecemoney']); 3052 fp_price = parseFloat(item['piecemoney']);
@@ -3875,7 +3925,7 @@ Page({ @@ -3875,7 +3925,7 @@ Page({
3875 }, 3925 },
3876 3926
3877 //计算立即购买赠品的物流费用 3927 //计算立即购买赠品的物流费用
3878 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 3928 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
3879 var good = this.data.buy_now_gift_goods; 3929 var good = this.data.buy_now_gift_goods;
3880 var goods_weight = -1, goods_piece = -1; 3930 var goods_weight = -1, goods_piece = -1;
3881 var gift_shipping_price = 0; 3931 var gift_shipping_price = 0;
@@ -3892,6 +3942,7 @@ Page({ @@ -3892,6 +3942,7 @@ Page({
3892 goods_weight += good['weight'] * good['buynum']; 3942 goods_weight += good['weight'] * good['buynum'];
3893 if (goods_weight1 > 0) { 3943 if (goods_weight1 > 0) {
3894 goods_weight += goods_weight1; 3944 goods_weight += goods_weight1;
  3945 + out_of_weight = (gift_weight_free*1000) - goods_weight;
3895 } 3946 }
3896 break; 3947 break;
3897 case 3: 3948 case 3:
@@ -3921,7 +3972,7 @@ Page({ @@ -3921,7 +3972,7 @@ Page({
3921 } 3972 }
3922 3973
3923 var t_shipping_price = 3974 var t_shipping_price =
3924 - this.calculatewuliu(code, gift_shipping_price, goods_weight, 3975 + this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,
3925 goods_piece, user_addr, gift_freight_free, allpice, rs); 3976 goods_piece, user_addr, gift_freight_free, allpice, rs);
3926 return t_shipping_price; 3977 return t_shipping_price;
3927 3978
@@ -4042,17 +4093,17 @@ Page({ @@ -4042,17 +4093,17 @@ Page({
4042 }); 4093 });
4043 }, 4094 },
4044 4095
4045 - set_hid_inp:function (e) {  
4046 - var index = e.currentTarget.dataset.index;  
4047 - var txt = "cartlist[" + index + "].focus";  
4048 - this.setData({[txt]:1})  
4049 - },  
4050 -  
4051 - clear_hid_inp:function (e) {  
4052 - var index = e.currentTarget.dataset.index;  
4053 - var txt = "cartlist[" + index + "].focus";  
4054 - this.setData({[txt]:0})  
4055 - }, 4096 + // set_hid_inp:function (e) {
  4097 + // var index = e.currentTarget.dataset.index;
  4098 + // var txt = "cartlist[" + index + "].focus";
  4099 + // this.setData({[txt]:1})
  4100 + // },
  4101 + //
  4102 + // clear_hid_inp:function (e) {
  4103 + // var index = e.currentTarget.dataset.index;
  4104 + // var txt = "cartlist[" + index + "].focus";
  4105 + // this.setData({[txt]:0})
  4106 + // },
4056 4107
4057 go_url:function (e) { 4108 go_url:function (e) {
4058 var url = e.currentTarget.dataset.url; 4109 var url = e.currentTarget.dataset.url;
@@ -4124,7 +4175,23 @@ Page({ @@ -4124,7 +4175,23 @@ Page({
4124 } 4175 }
4125 } 4176 }
4126 } 4177 }
4127 - } 4178 + },
  4179 + //订阅消息提醒
  4180 + sendsm:function(func)
  4181 + {
  4182 + var template_id = this.data.template_id;
  4183 + // //授权订阅
  4184 + wx.requestSubscribeMessage({
  4185 + tmplIds: [template_id],
  4186 + success(res) {
  4187 + func();
  4188 + },
  4189 + fail(res) {
  4190 + func();
  4191 + }
  4192 + })
  4193 +
  4194 + },
4128 4195
4129 4196
4130 }); 4197 });
pages/cart/cart2/cart2.wxml
@@ -2,38 +2,38 @@ @@ -2,38 +2,38 @@
2 <wxs src="filter.wxs" module="util"></wxs> 2 <wxs src="filter.wxs" module="util"></wxs>
3 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 3 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
4 4
5 -<form bindsubmit="submitForm"> 5 +<form>
6 <view class="container"> 6 <view class="container">
7 - 7 +
8 <!-- 立即购买的时候 --> 8 <!-- 立即购买的时候 -->
9 <block wx:if="{{is_b_now==1}}"> 9 <block wx:if="{{is_b_now==1}}">
10 <view class="tab-container"> 10 <view class="tab-container">
11 - <view class="tab-wrapper">  
12 - <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" 11 + <view class="tab-wrapper">
  12 + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
13 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> 13 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
14 -  
15 - <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" 14 +
  15 + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
16 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 16 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
17 - 17 +
18 </view> 18 </view>
19 </view> 19 </view>
20 - </block> 20 + </block>
21 <!-- 购物购买只有一单的时候 --> 21 <!-- 购物购买只有一单的时候 -->
22 <block wx:if="{{is_b_now==0 && cartlist.length==1}}"> 22 <block wx:if="{{is_b_now==0 && cartlist.length==1}}">
23 <view class="tab-container"> 23 <view class="tab-container">
24 - <view class="tab-wrapper">  
25 - <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}" 24 + <view class="tab-wrapper">
  25 + <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}"
26 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> 26 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
27 -  
28 - <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}" 27 +
  28 + <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}"
29 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 29 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
30 - 30 +
31 </view> 31 </view>
32 </view> 32 </view>
33 - </block>  
34 -  
35 -  
36 - <!--要进行判断地址是否显示----> 33 + </block>
  34 +
  35 +
  36 + <!--要进行判断地址是否显示---->
37 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> 37 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'>
38 <!---默认地址显示------> 38 <!---默认地址显示------>
39 <block wx:if="{{user_addr!=null}}"> 39 <block wx:if="{{user_addr!=null}}">
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 </view> 49 </view>
50 {{user_addr.more_address}}{{' '}}{{user_addr.address}} 50 {{user_addr.more_address}}{{' '}}{{user_addr.address}}
51 </view> 51 </view>
52 - 52 +
53 </view> 53 </view>
54 <view class="update-logistics"> 54 <view class="update-logistics">
55 <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> --> 55 <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> -->
@@ -108,19 +108,19 @@ @@ -108,19 +108,19 @@
108 <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> 108 <view class="card_bg ellipsis-1" style="margin-right: 10rpx;">
109 <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> 109 <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image>
110 <text class="card_name">{{show_card.CardName}}</text> 110 <text class="card_name">{{show_card.CardName}}</text>
111 - </view> 111 + </view>
112 <view>立减 <text style="color:#f23030;">{{filters.toFix(item.card_cut_price,2) }}</text> 元</view> 112 <view>立减 <text style="color:#f23030;">{{filters.toFix(item.card_cut_price,2) }}</text> 元</view>
113 </view> 113 </view>
114 <view> 114 <view>
115 <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> 115 <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text>
116 - </view> 116 + </view>
117 <!-- 三角形 --> 117 <!-- 三角形 -->
118 <view class="car_tri_up"></view> 118 <view class="car_tri_up"></view>
119 <!-- 立即开通跳转 --> 119 <!-- 立即开通跳转 -->
120 - <view bindtap="buycard" class="card_op">立即开通</view>  
121 - </view>  
122 -  
123 - 120 + <view bindtap="buycard" class="card_op">立即开通</view>
  121 + </view>
  122 +
  123 +
124 <!-----使用优惠券------> 124 <!-----使用优惠券------>
125 <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" 125 <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}"
126 data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> 126 data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}">
@@ -141,14 +141,14 @@ @@ -141,14 +141,14 @@
141 <icon color="#f23030" size="16" type="info"></icon> 141 <icon color="#f23030" size="16" type="info"></icon>
142 {{order.store_prom}} 142 {{order.store_prom}}
143 </view> 143 </view>
144 - 144 +
145 <!-- 当是物流很多单的时候 --> 145 <!-- 当是物流很多单的时候 -->
146 <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}"> 146 <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}">
147 <view class="flex-vertical" > 147 <view class="flex-vertical" >
148 - <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' 148 + <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type'
149 style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> 149 style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};">
150 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> 150 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> -->
151 - 151 +
152 <block wx:if="{{item.exp_type==1}}"> 152 <block wx:if="{{item.exp_type==1}}">
153 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> 153 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> -->
154 <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> 154 <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon>
@@ -158,7 +158,7 @@ @@ -158,7 +158,7 @@
158 </block> 158 </block>
159 <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> 159 <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view>
160 </view> 160 </view>
161 - 161 +
162 <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> 162 <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};">
163 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> 163 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> -->
164 <block wx:if="{{item.exp_type==0}}"> 164 <block wx:if="{{item.exp_type==0}}">
@@ -168,49 +168,49 @@ @@ -168,49 +168,49 @@
168 <block wx:else> 168 <block wx:else>
169 <view class="circle xc-hookts on"></view> 169 <view class="circle xc-hookts on"></view>
170 </block> 170 </block>
171 - 171 +
172 <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' 172 <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind'
173 class="yu_er">快递邮寄</view> 173 class="yu_er">快递邮寄</view>
174 </view> 174 </view>
175 </view> 175 </view>
176 -  
177 - 176 +
  177 +
178 <!-- 点击显示物流选择,如果是默认使用的情况不成立 --> 178 <!-- 点击显示物流选择,如果是默认使用的情况不成立 -->
179 <view wx:if="{{!is_default_logistics && item.exp_type!=1}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> 179 <view wx:if="{{!is_default_logistics && item.exp_type!=1}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;">
180 <view>{{wu_arr[item.wind].name}}</view> 180 <view>{{wu_arr[item.wind].name}}</view>
181 <view class="xc-right"></view> 181 <view class="xc-right"></view>
182 </view> 182 </view>
183 - 183 +
184 </view> 184 </view>
185 - 185 +
186 <!-- 当是物流,只有一单的时候 --> 186 <!-- 当是物流,只有一单的时候 -->
187 - <block wx:else >  
188 - <view class="use-item flex-space-between" wx:if="{{item.exp_type==0 && !is_default_logistics}}"> 187 + <block wx:else >
  188 + <view class="use-item flex-space-between" wx:if="{{item.exp_type==0 && !is_default_logistics}}">
189 <view class="flex jc_sb" style="width: 100%; padding: 0 13rpx;"> 189 <view class="flex jc_sb" style="width: 100%; padding: 0 13rpx;">
190 <view>选择物流</view> 190 <view>选择物流</view>
191 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> 191 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;">
192 <view>{{wu_arr[item.wind].name}}</view> 192 <view>{{wu_arr[item.wind].name}}</view>
193 <view class="xc-right"></view> 193 <view class="xc-right"></view>
194 </view> 194 </view>
195 - </view>  
196 - </view>  
197 - </block>  
198 -  
199 - 195 + </view>
  196 + </view>
  197 + </block>
  198 +
  199 +
200 </view> 200 </view>
201 201
202 <!-- 留言 --> 202 <!-- 留言 -->
203 <view class="coupon-mes flex-vertical"> 203 <view class="coupon-mes flex-vertical">
204 <view>留言</view> 204 <view>留言</view>
205 <view class="leave-word"> 205 <view class="leave-word">
206 - <input hidden="{{!item.focus}}" bindinput="keyUpChangeNum" disabled="{{disabled}}"  
207 - data-index="{{index}}" bindblur="clear_hid_inp" focus="{{item.focus}}" value="{{user_note[index]}}" 206 + <input placeholder="给商家留言,最多100字" bindinput="keyUpChangeNum"
  207 + data-index="{{pidx}}" value="{{user_note[pidx]}}"
208 class="word-box" maxlength="100" name="user_note_{{item.pickup_id}}" /> 208 class="word-box" maxlength="100" name="user_note_{{item.pickup_id}}" />
209 209
210 - <view class="{{user_note[index]?'':'c-a'}}" style="width: 80%;font-size: 26rpx" data-index="{{index}}"  
211 - bindtap="set_hid_inp" wx:if="{{!item.focus}}">  
212 - {{user_note[index]?user_note[index]:'给商家留言,最多100字'}}  
213 - </view> 210 +<!-- <view class="{{user_note[index]?'':'c-a'}}" style="width: 80%;font-size: 26rpx" data-index="{{index}}"-->
  211 +<!-- bindtap="set_hid_inp" wx:if="{{!item.focus}}">-->
  212 +<!-- {{user_note[index]?user_note[index]:}}-->
  213 +<!-- </view>-->
214 </view> 214 </view>
215 </view> 215 </view>
216 216
@@ -329,18 +329,18 @@ @@ -329,18 +329,18 @@
329 <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> 329 <view class="card_bg ellipsis-1" style="margin-right: 10rpx;">
330 <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> 330 <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image>
331 <text class="card_name">{{show_card.CardName}}</text> 331 <text class="card_name">{{show_card.CardName}}</text>
332 - </view> 332 + </view>
333 <view>立减 <text style="color:#f23030;">{{filters.toFix(card_cut_price,2) }}</text> 元</view> 333 <view>立减 <text style="color:#f23030;">{{filters.toFix(card_cut_price,2) }}</text> 元</view>
334 </view> 334 </view>
335 <view> 335 <view>
336 <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> 336 <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text>
337 - </view> 337 + </view>
338 <!-- 三角形 --> 338 <!-- 三角形 -->
339 <view class="car_tri_up"></view> 339 <view class="car_tri_up"></view>
340 <!-- 立即开通跳转 --> 340 <!-- 立即开通跳转 -->
341 - <view bindtap="buycard" class="card_op">立即开通</view>  
342 - </view>  
343 - 341 + <view bindtap="buycard" class="card_op">立即开通</view>
  342 + </view>
  343 +
344 344
345 <view class="set-mes bdr_b-14"> 345 <view class="set-mes bdr_b-14">
346 <view wx:if="{{order.store_prom}}"> 346 <view wx:if="{{order.store_prom}}">
@@ -363,41 +363,41 @@ @@ -363,41 +363,41 @@
363 </view> 363 </view>
364 </view> 364 </view>
365 365
366 - <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> 366 + <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
367 <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;"> 367 <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;">
368 - <view>选择物流</view> 368 + <view>选择物流</view>
369 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;"> 369 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;">
370 <view class="logistics-name">{{wu_arr[index].name}}</view> 370 <view class="logistics-name">{{wu_arr[index].name}}</view>
371 <view class="xc-right"></view> 371 <view class="xc-right"></view>
372 </view> 372 </view>
373 - </view> 373 + </view>
374 </view> 374 </view>
375 </view> 375 </view>
376 <!-- 留言 --> 376 <!-- 留言 -->
377 - <view class="coupon-mes flex-vertical">  
378 - <view>留言</view>  
379 - <view class="leave-word">  
380 - <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}"  
381 - class="word-box" maxlength="100" name="user_note"></input>  
382 - </view>  
383 - </view>  
384 - 377 +<!-- <view class="coupon-mes flex-vertical">-->
  378 +<!-- <view>留言</view>-->
  379 +<!-- <view class="leave-word">-->
  380 +<!-- <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}"-->
  381 +<!-- class="word-box" maxlength="100" name="user_note"></input>-->
  382 +<!-- </view>-->
  383 +<!-- </view>-->
  384 +
385 <!-- 是否参与店铺优惠 --> 385 <!-- 是否参与店铺优惠 -->
386 <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}"> 386 <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}">
387 <view>店铺优惠</view> 387 <view>店铺优惠</view>
388 <view class="leave-word fs32" style="color: #999;"> 388 <view class="leave-word fs32" style="color: #999;">
389 省{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}元 389 省{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}元
390 - </view> 390 + </view>
391 <block wx:if="{{bn_goods.is_offline}}"> 391 <block wx:if="{{bn_goods.is_offline}}">
392 - <text style="color: #d7642b;">-¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}</text> 392 + <text style="color: #d7642b;">-¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}</text>
393 </block> 393 </block>
394 <block wx:else> 394 <block wx:else>
395 - <text style="color: #d7642b;">不使用优惠</text> 395 + <text style="color: #d7642b;">不使用优惠</text>
396 </block> 396 </block>
397 <!-- 右边点击 --> 397 <!-- 右边点击 -->
398 <view class="xc-right" style="margin-right: 12rpx; border-color: #d7642b;"></view> 398 <view class="xc-right" style="margin-right: 12rpx; border-color: #d7642b;"></view>
399 </view> 399 </view>
400 - 400 +
401 401
402 <!-----使用余额------> 402 <!-----使用余额------>
403 <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}"> 403 <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}">
@@ -406,7 +406,7 @@ @@ -406,7 +406,7 @@
406 <view class="yu_er">使用余额 :¥{{yuer}} </view> 406 <view class="yu_er">使用余额 :¥{{yuer}} </view>
407 </view> 407 </view>
408 </view> 408 </view>
409 - 409 +
410 </block> 410 </block>
411 411
412 <view class="information bdr14"> 412 <view class="information bdr14">
@@ -455,7 +455,7 @@ @@ -455,7 +455,7 @@
455 <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> 455 <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view>
456 <!-- <view class="co-red big"></view> --> 456 <!-- <view class="co-red big"></view> -->
457 </view> 457 </view>
458 - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> 458 + <button class="tips-btn" formType="submit" id="submitOrder" bindtap="requestSubscribe">提交订单</button>
459 </view> 459 </view>
460 </form> 460 </form>
461 461
@@ -671,9 +671,9 @@ @@ -671,9 +671,9 @@
671 <view style="background-color: #fff; width: 540rpx; margin: 0 auto; border-radius: 20rpx;"> 671 <view style="background-color: #fff; width: 540rpx; margin: 0 auto; border-radius: 20rpx;">
672 <view class="fs32" style="text-align: center;height: 80rpx; line-height: 80rpx;">店铺优惠</view> 672 <view class="fs32" style="text-align: center;height: 80rpx; line-height: 80rpx;">店铺优惠</view>
673 <view class="flex jc_sb ai-center fs28" style="height: 80rpx; width: 400rpx; margin-left: 70rpx;"> 673 <view class="flex jc_sb ai-center fs28" style="height: 80rpx; width: 400rpx; margin-left: 70rpx;">
674 - <view catchtap="sure_offline" class="flex ai-center" >优惠¥{{show_off_price}} 674 + <view catchtap="sure_offline" class="flex ai-center" >优惠¥{{show_off_price}}
675 <icon style="margin-left: 10rpx;" color="{{is_get_offline?'red':'gray'}}" size="14" type="success" role="img"></icon></view> 675 <icon style="margin-left: 10rpx;" color="{{is_get_offline?'red':'gray'}}" size="14" type="success" role="img"></icon></view>
676 - <view catchtap="cancle_offline" class="flex ai-center" >不用优惠 676 + <view catchtap="cancle_offline" class="flex ai-center" >不用优惠
677 <icon style="margin-left: 10rpx;" color="{{is_get_offline!=1?'red':'gray'}}" size="14" type="success" role="img"></icon> </view> 677 <icon style="margin-left: 10rpx;" color="{{is_get_offline!=1?'red':'gray'}}" size="14" type="success" role="img"></icon> </view>
678 </view> 678 </view>
679 </view> 679 </view>
pages/cart/cart2/zh_calculate.js
@@ -2,15 +2,18 @@ var regeneratorRuntime = require(&#39;../../../utils/runtime.js&#39;); @@ -2,15 +2,18 @@ var regeneratorRuntime = require(&#39;../../../utils/runtime.js&#39;);
2 module.exports = { 2 module.exports = {
3 //主要的作用,就是把组合购多余的商品进行拆分, 3 //主要的作用,就是把组合购多余的商品进行拆分,
4 //如果没有达成组合购的要求,所有的商品都打回原价购买 4 //如果没有达成组合购的要求,所有的商品都打回原价购买
5 - fir_set_arr: function (c_item,th) { 5 + fir_set_arr: function (c_item, th) {
6 //组合活动,以及组合活动从表的商品 6 //组合活动,以及组合活动从表的商品
7 let zh_prom_goods = c_item.zh_prom_goods; 7 let zh_prom_goods = c_item.zh_prom_goods;
8 - let goods = c_item.goods; //一个门店中所有的商品  
9 - let tfeel = 0,cut_price=0, offline_price = 0, offline_num = 0; 8 + let goods = c_item.goods; //一个门店中所有的商品
  9 + let tfeel = 0,
  10 + cut_price = 0,
  11 + offline_price = 0,
  12 + offline_num = 0;
10 let txt_ite = c_item.need_list; 13 let txt_ite = c_item.need_list;
11 //多个活动要拿来循环一下 14 //多个活动要拿来循环一下
12 for (let i in zh_prom_goods) { 15 for (let i in zh_prom_goods) {
13 - let title = ""; //提示语; 16 + let title = ""; //提示语;
14 //其中的一个活动 17 //其中的一个活动
15 let act_item = zh_prom_goods[i]; 18 let act_item = zh_prom_goods[i];
16 let act_goos = act_item.gdlist; 19 let act_goos = act_item.gdlist;
@@ -19,12 +22,12 @@ module.exports = { @@ -19,12 +22,12 @@ module.exports = {
19 22
20 let all_num = 0; //商品数量之和 23 let all_num = 0; //商品数量之和
21 let all_price0 = 0; //商品数量之和 24 let all_price0 = 0; //商品数量之和
22 - let aprice=0; //达到活动条件的购买价格 25 + let aprice = 0; //达到活动条件的购买价格
23 let need_to_buy = 0; 26 let need_to_buy = 0;
24 let all_zhqty = 0; //所有商品要求起购数之和 27 let all_zhqty = 0; //所有商品要求起购数之和
25 let no_in_arr = []; //剩余的未加入组合购 28 let no_in_arr = []; //剩余的未加入组合购
26 - let out_arr=[]; //超出活动限购的商品放入  
27 - 29 + let out_arr = []; //超出活动限购的商品放入
  30 + let zhqty_bz = []; //超量
28 //-- 寻找一下 -- 31 //-- 寻找一下 --
29 function get_num2(ite) { 32 function get_num2(ite) {
30 for (let v2 in goods) { 33 for (let v2 in goods) {
@@ -39,35 +42,42 @@ module.exports = { @@ -39,35 +42,42 @@ module.exports = {
39 for (let j in act_goos) { 42 for (let j in act_goos) {
40 let item = act_goos[j]; 43 let item = act_goos[j];
41 let item_j = goods.find(function (ele) { 44 let item_j = goods.find(function (ele) {
  45 + console.log('ele',ele);
42 return ele.goods_id == act_goos[j].goods_id; 46 return ele.goods_id == act_goos[j].goods_id;
43 }) 47 })
44 //-- 如果有找到的话 -- 48 //-- 如果有找到的话 --
45 if (item_j) { 49 if (item_j) {
46 act_goos[j].num = item_j.goods_num; 50 act_goos[j].num = item_j.goods_num;
47 act_goos[j].goods_price = item_j.goods_price; 51 act_goos[j].goods_price = item_j.goods_price;
48 - var cart_num=item.cart_num =item_j.goods_num;  
49 - var zh_b_num=item_j.promgoodsbuynum;  
50 - if(item.buyqty>0){  
51 -  
52 - var key=item.goods_id+""+act.id;  
53 - var cbuy=item.buyqty-zh_b_num;  
54 - if(th.data.in_zhact_gdmap[key]){  
55 - var cbuy=item.buyqty-zh_b_num-th.data.in_zhact_gdmap[key]; 52 + var cart_num = item.cart_num = item_j.goods_num;
  53 + var zh_b_num = item_j.promgoodsbuynum;
  54 + if (item.buyqty > 0) {
  55 +
  56 + var key = item.goods_id + "" + act.id;
  57 + var cbuy = item.buyqty - zh_b_num;
  58 + if (th.data.in_zhact_gdmap[key]) {
  59 + var cbuy = item.buyqty - zh_b_num - th.data.in_zhact_gdmap[key];
56 } 60 }
57 61
58 62
59 //当可买的数量为0 63 //当可买的数量为0
60 - if(cbuy<=0){  
61 - item.num=0; 64 + if (cbuy <= 0) {
  65 + item.num = 0;
62 out_arr.push({ 66 out_arr.push({
63 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num 67 + price: item.goods_price,
  68 + offline_price: item.offline_price,
  69 + goods_id: item.goods_id,
  70 + num: cart_num
64 }) 71 })
65 - }else{  
66 - if(cbuy>=cart_num) item.num =cart_num;  
67 - else{  
68 - item.num =cbuy; 72 + } else {
  73 + if (cbuy >= cart_num) item.num = cart_num;
  74 + else {
  75 + item.num = cbuy;
69 out_arr.push({ 76 out_arr.push({
70 - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy 77 + price: item.goods_price,
  78 + offline_price: item.offline_price,
  79 + goods_id: item.goods_id,
  80 + num: cart_num - cbuy
71 }) 81 })
72 } 82 }
73 } 83 }
@@ -76,6 +86,7 @@ module.exports = { @@ -76,6 +86,7 @@ module.exports = {
76 all_num += item.num; 86 all_num += item.num;
77 //当有起购数的控制的时候 87 //当有起购数的控制的时候
78 if (item.zhqty) { 88 if (item.zhqty) {
  89 + zhqty_bz.push(item);
79 all_zhqty += item.zhqty; 90 all_zhqty += item.zhqty;
80 if (item.num < item.zhqty) { 91 if (item.num < item.zhqty) {
81 need_to_buy += item.zhqty - item.num; 92 need_to_buy += item.zhqty - item.num;
@@ -83,14 +94,18 @@ module.exports = { @@ -83,14 +94,18 @@ module.exports = {
83 if (item.num > item.zhqty) { 94 if (item.num > item.zhqty) {
84 for (let i = 0; i < item.num - item.zhqty; i++) { 95 for (let i = 0; i < item.num - item.zhqty; i++) {
85 no_in_arr.push({ 96 no_in_arr.push({
86 - price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price 97 + price: item.goods_price,
  98 + goods_id: item.goods_id,
  99 + offline_price: item_j.offline_price
87 }) 100 })
88 } 101 }
89 } 102 }
90 } else { 103 } else {
91 for (let j = 0; j < item.num; j++) { 104 for (let j = 0; j < item.num; j++) {
92 no_in_arr.push({ 105 no_in_arr.push({
93 - price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price 106 + price: item.goods_price,
  107 + goods_id: item.goods_id,
  108 + offline_price: item_j.offline_price
94 }) 109 })
95 } 110 }
96 } 111 }
@@ -105,47 +120,58 @@ module.exports = { @@ -105,47 +120,58 @@ module.exports = {
105 120
106 //当满足组合的要求:总数要满足,起购数要满足 121 //当满足组合的要求:总数要满足,起购数要满足
107 if (act && all_num >= act.zhbuyqty && !need_to_buy) { 122 if (act && all_num >= act.zhbuyqty && !need_to_buy) {
108 -  
109 //商品的列表 123 //商品的列表
110 for (var u in act_goos) { 124 for (var u in act_goos) {
111 - var ite=act_goos[u];  
112 - if(ite.buyqty>0 && ite.num>0){  
113 - var key=ite.goods_id+""+act.id;  
114 - if(th.data.in_zhact_gdmap[key]){  
115 - th.data.in_zhact_gdmap[key]+=ite.num;  
116 - }else{  
117 - th.data.in_zhact_gdmap[key]=ite.num; 125 + var ite = act_goos[u];
  126 + if (ite.buyqty > 0 && ite.num > 0) {
  127 + var key = ite.goods_id + "" + act.id;
  128 + if (th.data.in_zhact_gdmap[key]) {
  129 + th.data.in_zhact_gdmap[key] += ite.num;
  130 + } else {
  131 + th.data.in_zhact_gdmap[key] = ite.num;
118 } 132 }
119 } 133 }
120 } 134 }
121 -  
122 -  
123 function sortData(a, b) { 135 function sortData(a, b) {
124 return a.price - b.price 136 return a.price - b.price
125 } 137 }
126 -  
127 - if(no_in_arr.length>0) no_in_arr.sort(sortData);  
128 - 138 + if (no_in_arr.length > 0) no_in_arr.sort(sortData);
129 aprice = act.zhprice; 139 aprice = act.zhprice;
130 if (act.zhbuyqty > all_zhqty) { 140 if (act.zhbuyqty > all_zhqty) {
131 - for (let n = 0; n < act.zhbuyqty-all_zhqty; n++) { 141 + for (let n = 0; n < act.zhbuyqty - all_zhqty; n++) {
132 no_in_arr.pop(); 142 no_in_arr.pop();
133 } 143 }
134 } 144 }
135 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 145 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
136 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 146 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
137 //看一下是几倍 147 //看一下是几倍
138 - let be = parseInt(no_in_arr.length / act.zhbuyqty);  
139 - aprice += be * act.zhprice;  
140 - for (let m = 0; m < be * act.zhbuyqty; m++) {  
141 - no_in_arr.pop();  
142 - } 148 + let num = 0;
  149 + let bz_num = 0;
  150 + let be = parseInt(no_in_arr.length / act.zhbuyqty);
  151 + if (act.is_bzyh && zhqty_bz.length > 0) {
  152 + for (let i = 0; i < zhqty_bz.length; i++) {
  153 + let item = zhqty_bz[i];
  154 + bz_num = be * item.zhqty;
  155 + for (let j = 0; j < no_in_arr.length; j++) {
  156 + let i = no_in_arr[j];
  157 + if (item.goods_id === i.goods_id) {
  158 + num++
  159 + }
  160 + }
  161 + }
  162 + }
  163 + if (bz_num <= num) {
  164 + aprice += be * act.zhprice;
  165 + for (var m = 0; m < be * act.zhbuyqty; m++) {
  166 + no_in_arr.pop();
  167 + }
  168 + }
  169 +
143 } 170 }
144 171
145 -  
146 let goods_map = {}; 172 let goods_map = {};
147 //算一下剩余的商品 173 //算一下剩余的商品
148 - if(no_in_arr.length) { 174 + if (no_in_arr.length) {
149 for (let ii in no_in_arr) { 175 for (let ii in no_in_arr) {
150 let item = no_in_arr[ii]; 176 let item = no_in_arr[ii];
151 if (item.offline_price) { 177 if (item.offline_price) {
@@ -162,24 +188,24 @@ module.exports = { @@ -162,24 +188,24 @@ module.exports = {
162 } 188 }
163 189
164 //超量的部分也要计算一下 190 //超量的部分也要计算一下
165 - if(out_arr.length){ 191 + if (out_arr.length) {
166 for (var m in out_arr) { 192 for (var m in out_arr) {
167 var item = out_arr[m]; 193 var item = out_arr[m];
168 if (item.offline_price) { 194 if (item.offline_price) {
169 - offline_price += (item.price - item.offline_price)*item.num; 195 + offline_price += (item.price - item.offline_price) * item.num;
170 offline_num += item.num; 196 offline_num += item.num;
171 } 197 }
172 if (goods_map[item.goods_id]) { 198 if (goods_map[item.goods_id]) {
173 var num = goods_map[item.goods_id]; 199 var num = goods_map[item.goods_id];
174 - num+=item.num  
175 - goods_map[item.goods_id] =num; 200 + num += item.num
  201 + goods_map[item.goods_id] = num;
176 } else { 202 } else {
177 goods_map[item.goods_id] = item.num; 203 goods_map[item.goods_id] = item.num;
178 } 204 }
179 } 205 }
180 } 206 }
181 207
182 - if(Object.keys(goods_map).length) { 208 + if (Object.keys(goods_map).length) {
183 //这里就开始拆分提交订单时的列表 209 //这里就开始拆分提交订单时的列表
184 for (let j in goods_map) { 210 for (let j in goods_map) {
185 //map中存的就是商品的数量 211 //map中存的就是商品的数量
@@ -196,24 +222,26 @@ module.exports = { @@ -196,24 +222,26 @@ module.exports = {
196 goods.push(new_g); 222 goods.push(new_g);
197 223
198 //如果商品的数量已经为空了 224 //如果商品的数量已经为空了
199 - if(goods[idx].goods_num<=0){  
200 - goods.splice(idx,1); 225 + if (goods[idx].goods_num <= 0) {
  226 + goods.splice(idx, 1);
201 } 227 }
202 } 228 }
203 } 229 }
204 230
205 231
206 //-- 只统计是参与活动的商品 -- 232 //-- 只统计是参与活动的商品 --
207 - for(var ij in goods){  
208 - var iter=goods[ij];  
209 - if(iter.prom_type!=7 || iter.prom_id!=act.id){ continue; }  
210 - all_price0+=iter.goods_num*iter.goods_price; 233 + for (var ij in goods) {
  234 + var iter = goods[ij];
  235 + if (iter.prom_type != 7 || iter.prom_id != act.id) {
  236 + continue;
  237 + }
  238 + all_price0 += iter.goods_num * iter.goods_price;
211 } 239 }
212 //-- 活动的条件已经满足 -- 240 //-- 活动的条件已经满足 --
213 c_item.zh_prom_goods[act.id].is_has_zh = 1; 241 c_item.zh_prom_goods[act.id].is_has_zh = 1;
214 c_item.is_has_zh = 1; 242 c_item.is_has_zh = 1;
215 c_item.zh_prom_goods[act.id].actual_price = aprice; 243 c_item.zh_prom_goods[act.id].actual_price = aprice;
216 - c_item.zh_prom_goods[act.id].cut_price =all_price0-aprice; 244 + c_item.zh_prom_goods[act.id].cut_price = all_price0 - aprice;
217 245
218 //-- 设置还需要购买多少件,享受活动,前段显示 -- 246 //-- 设置还需要购买多少件,享受活动,前段显示 --
219 let need_to = c_item.need_list; 247 let need_to = c_item.need_list;
@@ -257,7 +285,7 @@ module.exports = { @@ -257,7 +285,7 @@ module.exports = {
257 txt_ite = need_to; 285 txt_ite = need_to;
258 } 286 }
259 tfeel += aprice; 287 tfeel += aprice;
260 - cut_price+=all_price0-aprice;; 288 + cut_price += all_price0 - aprice;;
261 } 289 }
262 290
263 c_item.zh_all_price = tfeel; 291 c_item.zh_all_price = tfeel;
@@ -315,10 +343,10 @@ module.exports = { @@ -315,10 +343,10 @@ module.exports = {
315 calc_zh_split_price: async function (c_arr, th) { 343 calc_zh_split_price: async function (c_arr, th) {
316 //-- 循环处理 -- 344 //-- 循环处理 --
317 for (var k in c_arr) { 345 for (var k in c_arr) {
318 - var cart_item = c_arr[k]; //就是每一单的意思  
319 - var ord_goods = c_arr[k].goods; //就是每一单的从表的意思 346 + var cart_item = c_arr[k]; //就是每一单的意思
  347 + var ord_goods = c_arr[k].goods; //就是每一单的从表的意思
320 348
321 - var zh_prom_goods = cart_item.zh_prom_goods; //一单中所有的组合购的集合 349 + var zh_prom_goods = cart_item.zh_prom_goods; //一单中所有的组合购的集合
322 var item_map = {}; 350 var item_map = {};
323 for (let i in zh_prom_goods) { 351 for (let i in zh_prom_goods) {
324 let item = zh_prom_goods[i]; 352 let item = zh_prom_goods[i];
@@ -330,14 +358,14 @@ module.exports = { @@ -330,14 +358,14 @@ module.exports = {
330 return ele.prom_type == 7 && ele.prom_id == i; 358 return ele.prom_type == 7 && ele.prom_id == i;
331 }) 359 })
332 var all_good_price = 0; 360 var all_good_price = 0;
333 - var post_gd=[]; 361 + var post_gd = [];
334 for (let j in glist) { 362 for (let j in glist) {
335 let item = glist[j]; 363 let item = glist[j];
336 all_good_price += item.goods_price * item.goods_num; 364 all_good_price += item.goods_price * item.goods_num;
337 - var gitem={  
338 - goods_id:item.goods_id,  
339 - goods_num:item.goods_num,  
340 - goods_price:item.goods_price 365 + var gitem = {
  366 + goods_id: item.goods_id,
  367 + goods_num: item.goods_num,
  368 + goods_price: item.goods_price
341 } 369 }
342 post_gd.push(gitem); 370 post_gd.push(gitem);
343 } 371 }
@@ -365,7 +393,7 @@ module.exports = { @@ -365,7 +393,7 @@ module.exports = {
365 'goods': post_gd 393 'goods': post_gd
366 } 394 }
367 var pt_res = null; 395 var pt_res = null;
368 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 396 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
369 is_json: 1, 397 is_json: 1,
370 data: pt_data 398 data: pt_data
371 }).then(res => { 399 }).then(res => {
@@ -376,7 +404,7 @@ module.exports = { @@ -376,7 +404,7 @@ module.exports = {
376 if (pt_res) { 404 if (pt_res) {
377 for (var io in glist) { 405 for (var io in glist) {
378 var goods_id = glist[io].goods_id; 406 var goods_id = glist[io].goods_id;
379 - item_map[goods_id]={}; 407 + item_map[goods_id] = {};
380 //平摊赋值 408 //平摊赋值
381 item_map[goods_id].account_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account; 409 item_map[goods_id].account_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account;
382 item_map[goods_id].account_yu_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account_yu; 410 item_map[goods_id].account_yu_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account_yu;
@@ -404,4 +432,4 @@ module.exports = { @@ -404,4 +432,4 @@ module.exports = {
404 } 432 }
405 433
406 434
407 -} 435 -}
  436 +}
408 \ No newline at end of file 437 \ No newline at end of file
pages/giftpack/birthdaygift/birthdaygift.js
@@ -119,7 +119,7 @@ Page({ @@ -119,7 +119,7 @@ Page({
119 var th = this; 119 var th = this;
120 th.setData({ 120 th.setData({
121 getActId: options.actId, 121 getActId: options.actId,
122 - giftID: options.giftBagId 122 + giftID: options.giftBagId,
123 }) 123 })
124 124
125 }, 125 },
@@ -131,6 +131,7 @@ Page({ @@ -131,6 +131,7 @@ Page({
131 return false; 131 return false;
132 } 132 }
133 this.GetList(); 133 this.GetList();
  134 + this.is_birthdayInfo()
134 135
135 }, 136 },
136 GetReceive: function() { 137 GetReceive: function() {
@@ -175,6 +176,29 @@ Page({ @@ -175,6 +176,29 @@ Page({
175 176
176 } 177 }
177 }, 178 },
  179 + //获取生日有礼信息
  180 + is_birthdayInfo: function(e) {
  181 + var th = this;
  182 + var url = `/api/weshop/marketing/get/${a.stoid}/${th.data.getActId}`;
  183 + console.log(th.data.getActId);
  184 + getApp().request.promiseGet(url, {
  185 +
  186 + }).then(res => {
  187 + console.log(res,20000);
  188 + if (res.data.code == 0) {
  189 + let birthdayStyle=`
  190 + --bg-color:${res.data.data.actBgColor};
  191 + --color:${res.data.data.actFontColor};
  192 + `
  193 + th.setData({
  194 + bimg: res.data.data.actBoundImg,
  195 + birthdayStyle,
  196 + // actFontColor: res.data.actFontColor, //字体颜色
  197 + // actBgColor: res.data.actBgColor, //背景颜色
  198 + })
  199 + }
  200 + })
  201 + },
178 //界面跳转 202 //界面跳转
179 goto: function(e) { 203 goto: function(e) {
180 var url = e.currentTarget.dataset.url; 204 var url = e.currentTarget.dataset.url;
pages/giftpack/birthdaygift/birthdaygift.wxml
1 -<view> 1 +<view style="{{birthdayStyle}}" class="font_and_bg">
2 <view class="image_box"> 2 <view class="image_box">
3 - <image src="{{iurl+'/miniapp/images/giftbag/birth00.png'}}" lazy-load="true"></image> 3 + <image src="{{iurl}}{{bimg?bimg:'/miniapp/images/default_g_img.gif'}}" binderror="bind_bnerr1" data-errorimg="bimg" lazy-load="true"></image>
4 </view> 4 </view>
5 <block wx:if="{{itemShow}}"> 5 <block wx:if="{{itemShow}}">
6 <view class="top rel"> 6 <view class="top rel">
pages/giftpack/birthdaygift/birthdaygift.wxss
@@ -246,7 +246,7 @@ @@ -246,7 +246,7 @@
246 } 246 }
247 .top_box_image button { 247 .top_box_image button {
248 margin: 15rpx 95rpx 0rpx 95rpx; 248 margin: 15rpx 95rpx 0rpx 95rpx;
249 - background: #fe6a6a; 249 + background: var(--color);
250 border-radius: 50rpx; 250 border-radius: 50rpx;
251 line-height: 60rpx; 251 line-height: 60rpx;
252 height: 60rpx; 252 height: 60rpx;
@@ -275,7 +275,7 @@ @@ -275,7 +275,7 @@
275 } 275 }
276 .button { 276 .button {
277 margin: 0 30rpx; 277 margin: 0 30rpx;
278 - background: #61d3dd; 278 + background:var(--bg-color);
279 border-radius: 50rpx; 279 border-radius: 50rpx;
280 line-height: 80rpx; 280 line-height: 80rpx;
281 height: 80rpx; 281 height: 80rpx;
@@ -308,7 +308,7 @@ @@ -308,7 +308,7 @@
308 width: 100%; 308 width: 100%;
309 } 309 }
310 .foot_button_buy { 310 .foot_button_buy {
311 - background: #e4010c; 311 + background:var(--color);
312 color: #FFFFFF; 312 color: #FFFFFF;
313 width: 400rpx; 313 width: 400rpx;
314 height: 70rpx; 314 height: 70rpx;
@@ -351,4 +351,9 @@ button::after { @@ -351,4 +351,9 @@ button::after {
351 width: 20rpx; 351 width: 20rpx;
352 height: 90rpx; 352 height: 90rpx;
353 z-index: 5; 353 z-index: 5;
  354 +}
  355 +
  356 +.font_and_bg {
  357 + background-color: var(--bg-color);
  358 + color:var(--color);
354 } 359 }
355 \ No newline at end of file 360 \ No newline at end of file
pages/goods/goodsInfo/buy_pt.wxml
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@
144 <view class="stitle" hidden="{{is_sec_mend==0}}" bindtap="hide_sec_mend"> 144 <view class="stitle" hidden="{{is_sec_mend==0}}" bindtap="hide_sec_mend">
145 <image class="tubiao" src="{{iurl}}/miniapp/images/icon-left.png"></image>{{sec_sto.name}}</view> 145 <image class="tubiao" src="{{iurl}}/miniapp/images/icon-left.png"></image>{{sec_sto.name}}</view>
146 <view class="itemlists" hidden="{{is_sec_mend==0}}"> 146 <view class="itemlists" hidden="{{is_sec_mend==0}}">
147 - <view wx:for="{{sec_sto.s_arr}}" wx:key="{{index}}" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}">{{item.pickup_name}} 147 + <view wx:for="{{sec_sto.s_arr}}" wx:key="index" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}">{{item.pickup_name}}
148 </view> 148 </view>
149 </view> 149 </view>
150 </view> 150 </view>
pages/goods/goodsInfo/goodsInfo.js
@@ -254,7 +254,6 @@ Page({ @@ -254,7 +254,6 @@ Page({
254 254
255 //------初始化加载---------- 255 //------初始化加载----------
256 onLoad: function (t) { 256 onLoad: function (t) {
257 -  
258 var ee = this, 257 var ee = this,
259 that = ee, 258 that = ee,
260 th = ee, 259 th = ee,
@@ -408,7 +407,6 @@ Page({ @@ -408,7 +407,6 @@ Page({
408 var user = getApp().globalData.userInfo; 407 var user = getApp().globalData.userInfo;
409 if (!user) return false; 408 if (!user) return false;
410 clearInterval(ti); 409 clearInterval(ti);
411 -  
412 if (user.card_field && user['card_expiredate']) { 410 if (user.card_field && user['card_expiredate']) {
413 var str = user['card_expiredate'].replace(/-/g, '/'); 411 var str = user['card_expiredate'].replace(/-/g, '/');
414 var end = new Date(str); 412 var end = new Date(str);
@@ -691,7 +689,7 @@ Page({ @@ -691,7 +689,7 @@ Page({
691 mapurl_f_img = res1.data.data.video_img; 689 mapurl_f_img = res1.data.data.video_img;
692 } 690 }
693 }) 691 })
694 - 692 + this.getHistoryBuy(); //获取历史购买
695 ee.setData({ 693 ee.setData({
696 gallery: gallery, 694 gallery: gallery,
697 is_collect: is_collect, 695 is_collect: is_collect,
@@ -707,7 +705,6 @@ Page({ @@ -707,7 +705,6 @@ Page({
707 705
708 //---展示--- 706 //---展示---
709 onShow: function () { 707 onShow: function () {
710 - // console.log('djfijsaoifjoisadjfoij');  
711 var goods_list = null, th = this, that = this; 708 var goods_list = null, th = this, that = this;
712 var show_prew_img = this.data.show_prew_img 709 var show_prew_img = this.data.show_prew_img
713 if (show_prew_img) { 710 if (show_prew_img) {
@@ -1525,38 +1522,36 @@ Page({ @@ -1525,38 +1522,36 @@ Page({
1525 } 1522 }
1526 else { 1523 else {
1527 1524
1528 - if(newd.prom_type==10){  
1529 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
1530 - getApp().request.get("/api/weshop/cart/page", {  
1531 - data: {  
1532 - store_id: e.data.stoid,  
1533 - user_id: oo.user_id,  
1534 - state:1  
1535 - },  
1536 - success: function (res) {  
1537 - //-------如果购物车中有相关的数据---------  
1538 - if (res.data.code==0 && res.data.data.total > 0) {  
1539 - for(let j in res.data.data.pageData){  
1540 - let item_j=res.data.data.pageData[j];  
1541 - var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item_j.id;  
1542 - getApp().request.delete(url, {});  
1543 - } 1525 + //这一步主要是要让立即购买 走 购物车的逻辑 参与活动
  1526 + if(newd.prom_type==10 || newd.prom_type==7){
  1527 + //----先看会员在购物车中是否加入了该商品,立即购买的-----
  1528 + getApp().request.get("/api/weshop/cart/page", {
  1529 + data: {
  1530 + store_id: e.data.stoid,
  1531 + user_id: oo.user_id,
  1532 + state:1
  1533 + },
  1534 + success: function (res) {
  1535 + //-------如果购物车中有相关的数据---------
  1536 + if (res.data.code==0 && res.data.data.total > 0) {
  1537 + for(let j in res.data.data.pageData){
  1538 + let item_j=res.data.data.pageData[j];
  1539 + var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item_j.id;
  1540 + getApp().request.delete(url, {});
1544 } 1541 }
1545 - newd.state=1;  
1546 - getApp().request.post("/api/weshop/cart/save", {  
1547 - data: newd,  
1548 - success: function (t) {  
1549 - th.closeSpecModal();  
1550 - getApp().goto("/pages/cart/cart2/cart2?state=1");  
1551 - }  
1552 - });  
1553 -  
1554 -  
1555 - }  
1556 - })  
1557 - return false;  
1558 - }  
1559 - 1542 + }
  1543 + newd.state=1;
  1544 + getApp().request.post("/api/weshop/cart/save", {
  1545 + data: newd,
  1546 + success: function (t) {
  1547 + th.closeSpecModal();
  1548 + getApp().goto("/pages/cart/cart2/cart2?state=1");
  1549 + }
  1550 + });
  1551 + }
  1552 + })
  1553 + return false;
  1554 + }
1560 1555
1561 if (th.data.prom_goods) { 1556 if (th.data.prom_goods) {
1562 var prom_d = th.data.prom_goods; 1557 var prom_d = th.data.prom_goods;
@@ -2414,9 +2409,9 @@ Page({ @@ -2414,9 +2409,9 @@ Page({
2414 } 2409 }
2415 }, 2410 },
2416 2411
2417 - //-----------选择属性的按钮事件---------- 2412 + //-----------选择属性的按钮事件----------
2418 sele_spec: function (e) { 2413 sele_spec: function (e) {
2419 - var that = this, ee = this, th = this; 2414 + var that = this;
2420 var gid = e.currentTarget.dataset.gid; 2415 var gid = e.currentTarget.dataset.gid;
2421 var nor = e.currentTarget.dataset.nor; 2416 var nor = e.currentTarget.dataset.nor;
2422 2417
@@ -2435,25 +2430,33 @@ Page({ @@ -2435,25 +2430,33 @@ Page({
2435 break 2430 break
2436 } 2431 }
2437 } 2432 }
  2433 + console.log(item,2000);
  2434 + var cur_price = item.shop_price;
  2435 + if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
  2436 + var cfile = getApp().globalData.userInfo.card_field;
  2437 + console.log('cfile',cfile);
  2438 + if (item[cfile]) {
  2439 + cur_price =item[cfile];
  2440 + }
  2441 + }
  2442 + var txt = (cur_price / item.market_price * 10).toFixed(2).toString();
  2443 + txt = parseFloat(txt);
  2444 + item['disc'] = txt;
2438 if (item) this.setData({ 2445 if (item) this.setData({
2439 sele_g: item, 2446 sele_g: item,
2440 - gid: gid 2447 + gid: gid,
  2448 + data:item,
2441 }); 2449 });
2442 2450
2443 2451
2444 -  
2445 -  
2446 that.check_is_youhui(gid, that.data.is_normal); 2452 that.check_is_youhui(gid, that.data.is_normal);
2447 2453
2448 - this.get_sto(that.data.is_normal);  
2449 -  
2450 -  
2451 //默认门店要拿下门店库存 2454 //默认门店要拿下门店库存
2452 if (that.data.sales_rules == 2 && that.data.def_pick_store) { 2455 if (that.data.sales_rules == 2 && that.data.def_pick_store) {
2453 var lock = 0, plist = null; 2456 var lock = 0, plist = null;
2454 //先读取门店的lock,采用链式写法,少用await 2457 //先读取门店的lock,采用链式写法,少用await
2455 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2458 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
2456 - data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 } 2459 + data: { store_id: os.stoid, wareId: that.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }
2457 }).then(res => { 2460 }).then(res => {
2458 if (res.data.code == 0 && res.data.data.total > 0) { 2461 if (res.data.code == 0 && res.data.data.total > 0) {
2459 for (var i in res.data.data.pageData) 2462 for (var i in res.data.data.pageData)
@@ -2461,7 +2464,7 @@ Page({ @@ -2461,7 +2464,7 @@ Page({
2461 } 2464 }
2462 //---通过接口获取门店的线下库存信息-- 2465 //---通过接口获取门店的线下库存信息--
2463 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 2466 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
2464 - data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid } 2467 + data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(that.data.sele_g.erpwareid), storeId: os.stoid }
2465 }) 2468 })
2466 }).then(res => { 2469 }).then(res => {
2467 if (res.data.code == 0 && res.data.data.total > 0) { 2470 if (res.data.code == 0 && res.data.data.total > 0) {
@@ -2473,11 +2476,9 @@ Page({ @@ -2473,11 +2476,9 @@ Page({
2473 that.data.def_pick_store.CanOutQty = 0; 2476 that.data.def_pick_store.CanOutQty = 0;
2474 } 2477 }
2475 //--给门店赋值线下库存-- 2478 //--给门店赋值线下库存--
2476 - th.setData({ def_pick_store: that.data.def_pick_store }); 2479 + that.setData({ def_pick_store: that.data.def_pick_store });
2477 }) 2480 })
2478 } 2481 }
2479 -  
2480 -  
2481 this.sele_spec_chech_activity(); 2482 this.sele_spec_chech_activity();
2482 }, 2483 },
2483 2484
@@ -2581,6 +2582,7 @@ Page({ @@ -2581,6 +2582,7 @@ Page({
2581 2582
2582 //---------拿出门店分类和门店------------ 2583 //---------拿出门店分类和门店------------
2583 get_sto(e) { 2584 get_sto(e) {
  2585 + console.log('get_sto')
2584 var th = this, that = this; 2586 var th = this, that = this;
2585 var is_normal = e; 2587 var is_normal = e;
2586 2588
@@ -3103,6 +3105,7 @@ Page({ @@ -3103,6 +3105,7 @@ Page({
3103 3105
3104 //--------检查是否活动,活动是否开始,或者是否结束------- 3106 //--------检查是否活动,活动是否开始,或者是否结束-------
3105 async check_prom(gid, prom_type, prom_id) { 3107 async check_prom(gid, prom_type, prom_id) {
  3108 + console.log('check_prom');
3106 var ee = this,th = ee; 3109 var ee = this,th = ee;
3107 var user_id=getApp().globalData.user_id; 3110 var user_id=getApp().globalData.user_id;
3108 if(!user_id) user_id=0; 3111 if(!user_id) user_id=0;
@@ -3383,8 +3386,8 @@ Page({ @@ -3383,8 +3386,8 @@ Page({
3383 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { 3386 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
3384 1: 1 3387 1: 1
3385 }).then(res => { 3388 }).then(res => {
3386 - console.log(res,3114);  
3387 var em = res; 3389 var em = res;
  3390 + var flag=null;
3388 if (em.data.code == 0) { 3391 if (em.data.code == 0) {
3389 if (em.data.data <= 0) ee.setData({ 3392 if (em.data.data <= 0) ee.setData({
3390 prom_r_null: 1 3393 prom_r_null: 1
@@ -3392,8 +3395,7 @@ Page({ @@ -3392,8 +3395,7 @@ Page({
3392 //拿取价格并且判断时间-- 3395 //拿取价格并且判断时间--
3393 getApp().request.get("/api/weshop/teamlist/get/" + 3396 getApp().request.get("/api/weshop/teamlist/get/" +
3394 os.stoid + "/" + prom_id, { 3397 os.stoid + "/" + prom_id, {
3395 - success: function (t) {  
3396 - console.log(t,3124); 3398 + success: async function (t) {
3397 if (t.data.code != 0) { 3399 if (t.data.code != 0) {
3398 ee.get_normal(gid); 3400 ee.get_normal(gid);
3399 return false; 3401 return false;
@@ -3432,25 +3434,40 @@ Page({ @@ -3432,25 +3434,40 @@ Page({
3432 } 3434 }
3433 }); 3435 });
3434 return false 3436 return false
3435 - ee.setData({  
3436 - prom_type: 0,  
3437 - isshow: 1,  
3438 - });  
3439 - ee.get_sku(os.stoid, ee.data.data, gid);  
3440 - ee.get_sto();  
3441 - return false;  
3442 } 3437 }
3443 3438
  3439 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
  3440 + data:{
  3441 + store_id: os.stoid,
  3442 + is_end: 0,
  3443 + is_show: 1,
  3444 + user_id: getApp().globalData.user_id,
  3445 + pageSize:1000
  3446 + }
  3447 + }).then(res=>{
  3448 +
  3449 + let pd_list=res.data.data.pageData;
  3450 + if(res.data.code==0 && pd_list.length>0){
  3451 + flag =pd_list.some(pd=>{
  3452 + return pd.goods_id==gid
  3453 + })
  3454 + }
  3455 + })
  3456 + if(!flag){
  3457 + ee.get_normal(gid);
  3458 + return false;
  3459 +
  3460 + }
3444 //-------查看自己是不是有买过该团的商品,并还为支付,或者在进行中------- 3461 //-------查看自己是不是有买过该团的商品,并还为支付,或者在进行中-------
3445 - getApp().request.get("/api/weshop/order/page", { 3462 + await getApp().request.promiseGet("/api/weshop/order/page", {
3446 data: { 3463 data: {
3447 pt_prom_id: prom_id, 3464 pt_prom_id: prom_id,
3448 user_id: oo.user_id, 3465 user_id: oo.user_id,
3449 store_id: os.stoid, 3466 store_id: os.stoid,
3450 pageSize: 1, 3467 pageSize: 1,
3451 page: 1 3468 page: 1
3452 - },  
3453 - success: function (e) { 3469 + }
  3470 + }).then(e=>{
3454 if (e.data.code == 0 && e.data.data.pageData.length > 0) { 3471 if (e.data.code == 0 && e.data.data.pageData.length > 0) {
3455 var odr = e.data.data.pageData[0]; 3472 var odr = e.data.data.pageData[0];
3456 th.data.buy_order = odr; 3473 th.data.buy_order = odr;
@@ -3496,8 +3513,7 @@ Page({ @@ -3496,8 +3513,7 @@ Page({
3496 th.data.wk_order_id = odr.order_id; 3513 th.data.wk_order_id = odr.order_id;
3497 } 3514 }
3498 } 3515 }
3499 - },  
3500 - }); 3516 + })
3501 3517
3502 //----------查看阶梯团------------ 3518 //----------查看阶梯团------------
3503 if (t.data.data.ct_rylist != "null" && t.data.data.ct_rylist != "" && t.data.data.ct_rylist != null && t.data.data.ct_rylist != undefined) { 3519 if (t.data.data.ct_rylist != "null" && t.data.data.ct_rylist != "" && t.data.data.ct_rylist != null && t.data.data.ct_rylist != undefined) {
@@ -5782,7 +5798,7 @@ Page({ @@ -5782,7 +5798,7 @@ Page({
5782 //调用接口判断订单优惠, 5798 //调用接口判断订单优惠,
5783 getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", { 5799 getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", {
5784 success: function (res) { 5800 success: function (res) {
5785 - console.log(res); 5801 +
5786 if (res.data.code == 0 && res.data.data) { 5802 if (res.data.code == 0 && res.data.data) {
5787 var r_data = res.data.data; 5803 var r_data = res.data.data;
5788 var max = 0, min = 0; 5804 var max = 0, min = 0;
@@ -5940,11 +5956,11 @@ Page({ @@ -5940,11 +5956,11 @@ Page({
5940 }) 5956 })
5941 }, 5957 },
5942 5958
5943 - previewImage() { 5959 + previewImage(e) {
5944 this.data.show_prew_img = 1; 5960 this.data.show_prew_img = 1;
5945 wx.previewImage({ 5961 wx.previewImage({
5946 //将图片预览出来 5962 //将图片预览出来
5947 - urls: [this.data.shareImgPath] 5963 + urls: [this.data.sele_g.original_img]
5948 }); 5964 });
5949 }, 5965 },
5950 5966
@@ -6226,9 +6242,25 @@ Page({ @@ -6226,9 +6242,25 @@ Page({
6226 go_more_ladder:function (e) { 6242 go_more_ladder:function (e) {
6227 var prom_id=e.currentTarget.dataset.id; 6243 var prom_id=e.currentTarget.dataset.id;
6228 getApp().goto("/pages/goods/goodsList/goodsList?ladder_id="+prom_id); 6244 getApp().goto("/pages/goods/goodsList/goodsList?ladder_id="+prom_id);
6229 - }  
6230 -  
6231 -  
6232 - 6245 + },
6233 6246
  6247 + getHistoryBuy() {
  6248 + let _this=this;
  6249 + let req_data = {
  6250 + store_id:os.stoid,
  6251 + goods_id:this.data.gid,
  6252 + pay_status:1,
  6253 + rndid:1
  6254 + };
  6255 + getApp().request.promiseGet('/api/weshop/ordergoods/list',{
  6256 + data:req_data,
  6257 + })
  6258 + .then(res=>{
  6259 + if(t.ajax_ok(res)){
  6260 + _this.setData({
  6261 + historyBuyInfo:res.data.data.pageData,
  6262 + })
  6263 + }
  6264 + })
  6265 + }
6234 }); 6266 });
pages/goods/goodsInfo/goodsInfo.wxml
@@ -7,12 +7,30 @@ @@ -7,12 +7,30 @@
7 <block wx:if="{{isshow}}"> 7 <block wx:if="{{isshow}}">
8 <view class="container"> 8 <view class="container">
9 <view class="type-navbar"> 9 <view class="type-navbar">
10 - <view class="type-box" wx:for="{{categories}}" wx:key="categories"> 10 + <view class="type-box" wx:for="{{categories}}" wx:key="id">
11 <view bindtap="tabClick" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}" id="{{item.id}}">{{item.name}}</view> 11 <view bindtap="tabClick" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}" id="{{item.id}}">{{item.name}}</view>
12 </view> 12 </view>
13 </view> 13 </view>
14 <view class="goods-detail"> 14 <view class="goods-detail">
15 - <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}"> 15 + <view class="goods-info" style="position: relative;" hidden="{{activeCategoryId==0?false:true}}">
  16 +
  17 + <!-- 历史购买记录 -->
  18 + <view class="swiper-container" wx:if="{{historyBuyInfo.length}}">
  19 + <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="3000">
  20 + <swiper-item class="swiper-item" wx:for="{{historyBuyInfo}}" wx:key="order_id">
  21 + <view class="item">
  22 + <view class="avatar-container">
  23 + <image src="{{item.head_pic}}"></image>
  24 + </view>
  25 + <view class="flex ai_c pd10">
  26 + <view class="nickname ellipsis-1x">{{item.nickname}}下单成功</view>
  27 + <!-- <view style="flex-shrink: 0;"></view> -->
  28 + </view>
  29 + </view>
  30 + </swiper-item>
  31 + </swiper>
  32 + </view>
  33 +
16 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove"> 34 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove">
17 <view class="xc-videos-picture rel"> 35 <view class="xc-videos-picture rel">
18 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange"> 36 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange">
@@ -219,71 +237,7 @@ @@ -219,71 +237,7 @@
219 </view> 237 </view>
220 </view> 238 </view>
221 </view> 239 </view>
222 -  
223 - <!-- 幸运购 -->  
224 - <view class="pt_fir se2 bdt16" wx:if="{{teamgroup}}" hidden="{{true}}">  
225 - <view class="xc-partner-frame">  
226 - <view class="zzk-1 flex jc_sb" bindtap="go_t_more">  
227 - <view class="pdl10">已参团4人,还差<text class="c-red">1</text>人成团</view>  
228 - <view class="ckgd flex ai_c">  
229 - 查看奖励  
230 - <view class="bg_right arrow-one"></view>  
231 - </view>  
232 - </view>  
233 - </view>  
234 - <view class='group'>  
235 - <view class='group-list luck' bindtap="go_cj_team" data-ind="{{t_ind}}">  
236 - <!-- <view class="flex ai_c"> -->  
237 - <!-- //选项框头像 -->  
238 - <view class='gtou' wx:for="{{teamgroup}}" wx:for-index="t_ind" wx:key="teamgroup">  
239 - <image src='{{item.user.head_pic}}'></image>  
240 - </view>  
241 - <view class='gtou more'>  
242 - <text class="iconfont icon-sandian"></text>  
243 - </view>  
244 - <!-- <view class='gtou'>  
245 - <image src='{{item.user.head_pic}}'></image>  
246 - </view> -->  
247 - <!-- //等你来拼 -->  
248 - <!-- <view class='gdn ellipsis-1'>{{item.user.nickname}}</view> -->  
249 - <!-- </view> -->  
250 - <!-- //还差几人,剩余时间 -->  
251 - <!-- <view class="rel">  
252 - <view class='ghaicha ellipsis-2'>  
253 - <text class='gred' wx:if="{{prom_act.max_ct_num >0}}">  
254 - <text class="flex" wx:if="{{prom_act.max_ct_num - item.open_num>0}}">  
255 - 还差  
256 - <text class="word-color">{{prom_act.max_ct_num - item.open_num}}</text>  
257 - 人享最低优惠  
258 - </text>  
259 - <text wx:else>您已经享最低优惠</text>  
260 - </text>  
261 - <text class='gred' wx:else>  
262 - 还差  
263 - <text style='color:#ff2753'>{{prom_act.ct_num - item.open_num}}</text>  
264 - 人成团  
265 - </text>  
266 - <view class="t_show">  
267 - 剩余  
268 - <text wx:if="{{timer[t_ind].day}}">{{timer[t_ind].day}}天:</text>  
269 - <text>{{timer[t_ind].hou}}</text>  
270 - :  
271 - <text>{{timer[t_ind].min}}</text>  
272 - :  
273 - <text>{{timer[t_ind].sec}}</text>  
274 - </view>  
275 - </view>  
276 - </view> -->  
277 - <!-- //参加团 -->  
278 - <!-- <view class='cjt t-c'>去参团</view> -->  
279 - <!-- <view class="clear"></view> -->  
280 - </view>  
281 -  
282 - <view class="fs24 pdh20 pdt20">*<text class="c-red">5</text>人成团,<text class="c-red">5</text>人得商品,<text class="c-red">5</text>人全额退款并获得<text class="c-red">惊喜礼品</text>!</view>  
283 - </view>  
284 - </view>  
285 -  
286 - 240 +
287 241
288 </view> 242 </view>
289 <!-- 积分购 --> 243 <!-- 积分购 -->
@@ -328,12 +282,10 @@ @@ -328,12 +282,10 @@
328 <!-- 不是拼团,不是积分购 --> 282 <!-- 不是拼团,不是积分购 -->
329 <block wx:if="{{prom_type!=6 && prom_type!=4}}"> 283 <block wx:if="{{prom_type!=6 && prom_type!=4}}">
330 284
331 -  
332 -  
333 <view class="goods-price"> 285 <view class="goods-price">
334 286
335 <view class="flex jc_sb"> 287 <view class="flex jc_sb">
336 - <view class="co-red" style="" wx:if="{{prom_type==0 || prom_type==3}}"> 288 + <view class="co-red" wx:if="{{prom_type==0 || prom_type==3}}">
337 289
338 <view class="market-price flex" style="align-items: baseline;"> 290 <view class="market-price flex" style="align-items: baseline;">
339 <block wx:if="{{card_field && data[card_field]>0}}"> 291 <block wx:if="{{card_field && data[card_field]>0}}">
@@ -571,7 +523,7 @@ @@ -571,7 +523,7 @@
571 <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> 523 <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}">
572 <view class="cx-sizs fs30">领券</view> 524 <view class="cx-sizs fs30">领券</view>
573 <view class="flex ai_c f1 pdh20"> 525 <view class="flex ai_c f1 pdh20">
574 - <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="{{index}}"> 526 + <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id">
575 <view class="circle xc-circular xc-one"></view> 527 <view class="circle xc-circular xc-one"></view>
576 <view class="xc-coupon t-c four-level-word"> 528 <view class="xc-coupon t-c four-level-word">
577 满{{item.condition}}减{{item.money}} 529 满{{item.condition}}减{{item.money}}
@@ -1197,7 +1149,7 @@ @@ -1197,7 +1149,7 @@
1197 <view class="pding"> 1149 <view class="pding">
1198 <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon> 1150 <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
1199 <view class="spec-goods"> 1151 <view class="spec-goods">
1200 - <image class="wh100 spec-img xc-distance-bottom" src="{{sele_g.original_img}}" binderror="pop_err_img" data-errorimg="sele_g.original_img"></image> 1152 + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{sele_g.original_img}}" binderror="pop_err_img" data-errorimg="sele_g.original_img"></image>
1201 <view class="spec-goods-info"> 1153 <view class="spec-goods-info">
1202 <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> 1154 <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view>
1203 <view class="flex ai_end xc-val-money"> 1155 <view class="flex ai_end xc-val-money">
@@ -1403,7 +1355,7 @@ @@ -1403,7 +1355,7 @@
1403 {{sec_sto.name}} 1355 {{sec_sto.name}}
1404 </view> 1356 </view>
1405 <view class="itemlists" hidden="{{is_sec_mend==0}}"> 1357 <view class="itemlists" hidden="{{is_sec_mend==0}}">
1406 - <view wx:for="{{sec_sto.s_arr}}" wx:key="{{index}}" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}"> 1358 + <view wx:for="{{sec_sto.s_arr}}" wx:key="index" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}">
1407 {{item.pickup_name}} 1359 {{item.pickup_name}}
1408 </view> 1360 </view>
1409 </view> 1361 </view>
@@ -1428,7 +1380,7 @@ @@ -1428,7 +1380,7 @@
1428 <view class="prom-model"> 1380 <view class="prom-model">
1429 <icon bindtap="closePromModal" class="modal-close" color="gray" size="22" type="cancel"></icon> 1381 <icon bindtap="closePromModal" class="modal-close" color="gray" size="22" type="cancel"></icon>
1430 <view class="prom-title">优惠信息</view> 1382 <view class="prom-title">优惠信息</view>
1431 - <view class="logistics-item" wx:for="{{select.activity.data}}" wx:key="{{index}}"> 1383 + <view class="logistics-item" wx:for="{{select.activity.data}}" wx:key="index">
1432 <view class="item-title"> 1384 <view class="item-title">
1433 <text class="prom-item">{{item.title}}</text> 1385 <text class="prom-item">{{item.title}}</text>
1434 </view> 1386 </view>
@@ -1495,7 +1447,7 @@ @@ -1495,7 +1447,7 @@
1495 </view> 1447 </view>
1496 <view class="xc-coupon-right flex"> 1448 <view class="xc-coupon-right flex">
1497 <view class="xc-detail-coupon"> 1449 <view class="xc-detail-coupon">
1498 - <view class="four-level-word">订单金额满{{item.condition}}元可用</view> 1450 + <view class="four-level-word">{{item.name}}</view>
1499 <view class="four-level-word xc-below"> 1451 <view class="four-level-word xc-below">
1500 {{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}} 1452 {{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}}
1501 </view> 1453 </view>
pages/goods/goodsInfo/goodsInfo.wxss
@@ -3884,3 +3884,49 @@ button.custom-service::after { @@ -3884,3 +3884,49 @@ button.custom-service::after {
3884 3884
3885 .jie_show{ display: inline-block; width: 40rpx; height: 40rpx; background-color:#ff0505;border-radius:50%;color: #fff;text-align: center; margin: 0 20rpx } 3885 .jie_show{ display: inline-block; width: 40rpx; height: 40rpx; background-color:#ff0505;border-radius:50%;color: #fff;text-align: center; margin: 0 20rpx }
3886 3886
  3887 +.jie_show{ display: inline-block; width: 40rpx; height: 40rpx; background-color:#ff0505;border-radius:50%;color: #fff;text-align: center; margin: 0 20rpx }
  3888 +/* 历史购买 */
  3889 +.swiper-container {
  3890 + position: absolute;
  3891 + top: 0;
  3892 + left: 0;
  3893 + padding: 20rpx 10rpx;
  3894 + width: 100%;
  3895 + box-sizing: border-box;
  3896 + z-index: 98;
  3897 +}
  3898 +
  3899 +.swiper {
  3900 + height: 60rpx;
  3901 + color: white;
  3902 + font-size: 26rpx;
  3903 +}
  3904 +
  3905 +.swiper-item {
  3906 + /* width: auto !important;
  3907 + background-color: rgba(0,0,0,.4);
  3908 + border-radius: 60rpx; */
  3909 + position: relative;
  3910 +}
  3911 +
  3912 +.swiper-item .item {
  3913 + position: absolute;
  3914 +}
  3915 +
  3916 +.item {
  3917 + /* position: absolute; */
  3918 + display: flex;
  3919 + align-items: center;
  3920 + /* justify-content: center; */
  3921 + border-radius: 60rpx;
  3922 + background-color: rgba(0,0,0,.4);
  3923 + /* position: absolute; */
  3924 +}
  3925 +
  3926 +.avatar-container {
  3927 + width: 60rpx;
  3928 + height: 60rpx;
  3929 + border-radius: 50%;
  3930 + overflow: hidden;
  3931 + flex-shrink: 0;
  3932 +}
pages/goods/search/search.js
@@ -186,6 +186,28 @@ Page({ @@ -186,6 +186,28 @@ Page({
186 break; 186 break;
187 case 6: 187 case 6:
188 url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; 188 url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id;
  189 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
  190 + data:{
  191 + store_id: oo.stoid,
  192 + is_end: 0,
  193 + is_show: 1,
  194 + user_id: getApp().globalData.user_id,
  195 + pageSize:1000,
  196 + }
  197 + }).then(pd=>{
  198 + let pd_list=pd.data.data.pageData;
  199 + if(res.data.code==0 && pd_list.length>0){
  200 + var flag = pd_list.some(pd=>{
  201 + return pd.goods_id==item.goods_id
  202 + })
  203 +
  204 + if(!flag){
  205 + item.prom_type=0;
  206 + item.prom_id=0;
  207 + item.prom_price=null;
  208 + }
  209 + }
  210 + })
189 break; 211 break;
190 case 8: 212 case 8:
191 var presell_id = prom_id; 213 var presell_id = prom_id;
@@ -212,7 +234,6 @@ Page({ @@ -212,7 +234,6 @@ Page({
212 if(url!=null && url!=''){ 234 if(url!=null && url!=''){
213 await getApp().request.promiseGet(url, {}).then(async res => { 235 await getApp().request.promiseGet(url, {}).then(async res => {
214 var prom =null; 236 var prom =null;
215 - var flag=null;  
216 if(res.data.code==0 && res.data.data){ 237 if(res.data.code==0 && res.data.data){
217 prom=res.data.data; 238 prom=res.data.data;
218 239
pages/index/index/index.js
@@ -73,7 +73,7 @@ Page({ @@ -73,7 +73,7 @@ Page({
73 max_sw_height: 0, //banner的最大高度 73 max_sw_height: 0, //banner的最大高度
74 is_disgraceful: 0, //是否显示新人广告 74 is_disgraceful: 0, //是否显示新人广告
75 new_image: "", //新人有礼弹窗图片 75 new_image: "", //新人有礼弹窗图片
76 - new_nav: "", //新人页面跳转地址 76 + new_nav: "", //新人页面跳转地址
77 w_holiday_pop: 0, 77 w_holiday_pop: 0,
78 78
79 showHongbao: false, 79 showHongbao: false,
@@ -176,7 +176,7 @@ Page({ @@ -176,7 +176,7 @@ Page({
176 }) 176 })
177 } 177 }
178 178
179 - // 判断是否有红包活动 179 + // 判断是否有红包活动
180 getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { 180 getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
181 data: {} 181 data: {}
182 }).then(function (data) { 182 }).then(function (data) {
@@ -194,7 +194,7 @@ Page({ @@ -194,7 +194,7 @@ Page({
194 }); 194 });
195 195
196 196
197 - // console.log(9090909); 197 + // console.log(9090909);
198 //看一下商家是否开通了权益 198 //看一下商家是否开通了权益
199 //--初始化是否有打勾-- 199 //--初始化是否有打勾--
200 getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { 200 getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
@@ -458,7 +458,7 @@ Page({ @@ -458,7 +458,7 @@ Page({
458 getApp().globalData.isLoad_ad = 1; 458 getApp().globalData.isLoad_ad = 1;
459 } 459 }
460 }, 1500) 460 }, 1500)
461 - 461 +
462 462
463 }, 463 },
464 //当隐藏的时候就关闭计时器 464 //当隐藏的时候就关闭计时器
@@ -536,6 +536,7 @@ Page({ @@ -536,6 +536,7 @@ Page({
536 wx.stopPullDownRefresh(); 536 wx.stopPullDownRefresh();
537 } 537 }
538 }) 538 })
  539 + let user_id=getApp().globalData.user_id;
539 540
540 //----拼单----- 541 //----拼单-----
541 await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { 542 await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
@@ -543,7 +544,8 @@ Page({ @@ -543,7 +544,8 @@ Page({
543 store_id: os.stoid, 544 store_id: os.stoid,
544 is_end: 0, 545 is_end: 0,
545 is_show: 1, 546 is_show: 1,
546 - pageSize: 6 547 + pageSize: 6,
  548 + user_id,
547 } 549 }
548 }).then(res => { 550 }).then(res => {
549 var e = res; 551 var e = res;
@@ -747,7 +749,7 @@ Page({ @@ -747,7 +749,7 @@ Page({
747 } 749 }
748 console.log("---首页---分享--"); 750 console.log("---首页---分享--");
749 var title = "商城首页" 751 var title = "商城首页"
750 - //分享 752 + //分享
751 if (getApp().globalData.config && getApp().globalData.config.store_name) { 753 if (getApp().globalData.config && getApp().globalData.config.store_name) {
752 title = getApp().globalData.config.store_name; 754 title = getApp().globalData.config.store_name;
753 } else if (getApp().globalData.setting.appName) { 755 } else if (getApp().globalData.setting.appName) {
@@ -1182,7 +1184,7 @@ Page({ @@ -1182,7 +1184,7 @@ Page({
1182 var url=e.currentTarget.dataset.url; 1184 var url=e.currentTarget.dataset.url;
1183 getApp().goto(url); 1185 getApp().goto(url);
1184 }, 1186 },
1185 -  
1186 1187
1187 1188
1188 -});  
1189 \ No newline at end of file 1189 \ No newline at end of file
  1190 +
  1191 +});
pages/team/team_ping/team_ping.js
@@ -114,7 +114,7 @@ Page({ @@ -114,7 +114,7 @@ Page({
114 }).then(res => { 114 }).then(res => {
115 order_goods = res.data.data.pageData; 115 order_goods = res.data.data.pageData;
116 order[i].order_goods = order_goods; 116 order[i].order_goods = order_goods;
117 - order[i].gimage = ee.data.imageurl + order_goods[0].original_img; 117 + order[i].gimage = ee.data.imageurl + order_goods[0]?.original_img;
118 }) 118 })
119 119
120 120
pages/team/team_ping/team_ping.wxml
1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
2 - 2 +
3 <!--选择款--> 3 <!--选择款-->
4 <view class='top'> 4 <view class='top'>
5 <view class='tyi' class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">全部</view> 5 <view class='tyi' class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">全部</view>
@@ -10,113 +10,114 @@ @@ -10,113 +10,114 @@
10 10
11 <!--单号显示--> 11 <!--单号显示-->
12 <view class='wu' wx:if="{{order.length>0}}"> 12 <view class='wu' wx:if="{{order.length>0}}">
13 -<view class='pd' wx:for="{{order}}" wx:key>  
14 - <view class='pd-list' bindtap="go_team_success" data-ordsn="{{item.order_sn}}">  
15 - <!--top-->  
16 - <view class='pd-list-top'>  
17 - <!-- <image src='{{iurl}}/miniapp/images/dianpu.png'></image> -->  
18 - <text class='pd-wz'>订单编号:{{item.order_sn}}</text>  
19 - <image class='jt' src='{{iurl}}/miniapp/images/icojiantou1.png'></image>  
20 - </view>  
21 - <!--image-->  
22 - <view class='pd-list-image'>  
23 - <view class="xc-list flex">  
24 - <view class="frame">  
25 - <image src='{{item.gimage}}' binderror='images_err' data-err="order[{{index}}].gimage"></image>  
26 - </view>  
27 - <view>  
28 - <view class='pd-img-wz1 ellipsis-2'>{{item.order_goods[0].goods_name}} 13 + <view class='pd' wx:for="{{order}}" wx:key>
  14 + <view class='pd-list' bindtap="go_team_success" data-ordsn="{{item.order_sn}}">
  15 + <!--top-->
  16 + <view class='pd-list-top'>
  17 + <!-- <image src='{{iurl}}/miniapp/images/dianpu.png'></image> -->
  18 + <text class='pd-wz'>订单编号:{{item.order_sn}}</text>
  19 + <image class='jt' src='{{iurl}}/miniapp/images/icojiantou1.png'></image>
29 </view> 20 </view>
30 -  
31 -  
32 - <view class="flex-space-between {{item.pt_status==1? 'xc-price-sn':'xc-price-no'}}">  
33 - <view class="flex">  
34 - <text class='fs24 xc-wc {{item.pt_status==1?"xc-rmbs":"xc-rmb"}}'>¥</text>  
35 - <view class='pd-jg xc-wc'>{{item.order_goods[0].goods_price}}</view>  
36 - <view class="flex word-line xc-ash {{item.pt_status==1?'xc-rmbs':'xc-rmb'}}"><text class="fs24 xc-black">零售价:</text><text class="fs24 xc-wc">¥</text><text class="fs26 xc-wc">{{item.order_goods[0].market_price}}</text> </view>  
37 -</view>  
38 -  
39 - <view class="xc-img-frame" wx:if="{{item.pt_status==2 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}">  
40 - <image style='width' class=""src="{{iurl}}/miniapp/images/xc_qtcg.png"></image>  
41 - </view>  
42 - <view class="xc-img-frame" wx:if="{{item.pt_status==3}}">  
43 - <image src="{{iurl}}/miniapp/images/xc-qtshibai.png"></image></view>  
44 - </view> 21 + <!--image-->
  22 + <view class='pd-list-image'>
  23 + <view class="xc-list flex">
  24 + <view class="frame">
  25 + <image src='{{item.gimage}}' binderror='images_err' data-err="order[{{index}}].gimage"></image>
  26 + </view>
  27 + <view>
  28 + <view class='pd-img-wz1 ellipsis-2'>{{item.order_goods[0].goods_name}}
  29 + </view>
45 30
46 -<view class="xc-still-bad flex fs24" wx:if="{{item.pt_status==1}}">  
47 - <block wx:if="{{item.ct_num-item.tx.length>0}}">  
48 - 还差<text class="xc-wc">{{item.ct_num-item.tx.length}}</text>人成团  
49 - </block>  
50 - <block wx:elif="{{item.max_ct_num-item.tx.length>0}}">  
51 - 还差<text class="xc-wc">{{item.max_ct_num-item.tx.length}}</text>人享受最价</block>  
52 - <block wx:else>您已经可以享受最低价</block>  
53 - </view>  
54 31
  32 + <view class="flex-space-between {{item.pt_status==1? 'xc-price-sn':'xc-price-no'}}">
  33 + <view class="flex">
  34 + <text class='fs24 xc-wc {{item.pt_status==1?"xc-rmbs":"xc-rmb"}}'>¥</text>
  35 + <view class='pd-jg xc-wc'>{{item.order_goods[0].goods_price}}</view>
  36 + <view class="flex word-line xc-ash {{item.pt_status==1?'xc-rmbs':'xc-rmb'}}"><text class="fs24 xc-black">零售价:</text><text class="fs24 xc-wc">¥</text><text class="fs26 xc-wc">{{item.order_goods[0].market_price}}</text> </view>
  37 + </view>
55 38
  39 + <view class="xc-img-frame" wx:if="{{item.pt_status==2 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}">
  40 + <image style='width' class="" src="{{iurl}}/miniapp/images/xc_qtcg.png"></image>
  41 + </view>
  42 + <view class="xc-img-frame" wx:if="{{item.pt_status==3}}">
  43 + <image src="{{iurl}}/miniapp/images/xc-qtshibai.png"></image>
  44 + </view>
  45 + </view>
  46 +
  47 + <view class="xc-still-bad flex fs24" wx:if="{{item.pt_status==1}}">
  48 + <block wx:if="{{item.ct_num-item.tx.length>0}}">
  49 + 还差<text class="xc-wc">{{item.ct_num-item.tx.length}}</text>人成团
  50 + </block>
  51 + <block wx:elif="{{item.max_ct_num-item.tx.length>0}}">
  52 + 还差<text class="xc-wc">{{item.max_ct_num-item.tx.length}}</text>人享受最价</block>
  53 + <block wx:else>您已经可以享受最低价</block>
  54 + </view>
  55 + </view>
56 </view> 56 </view>
57 -  
58 - </view>  
59 -  
60 - </view>  
61 - <!--foot-->  
62 - <view style='width:100%;border-bottom:10rpx solid #eee; '>  
63 - <view class='pd-list-foot'>  
64 - <view class='foot-left flex'>  
65 - 共{{item.order_goods[0].goods_num}}件,  
66 - <view class="t-c">  
67 - <block wx:if="{{item.is_zsorder==4}}">  
68 - <block wx:if="{{item.pt_status==3 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}">  
69 - 金额:<text class="xc-wc">¥</text>  
70 - <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount+item.pt_tail_money,2)}}</view>  
71 - </block>  
72 - <block wx:else> 57 +
  58 + </view>
  59 + <!--foot-->
  60 + <view style='width:100%;border-bottom:10rpx solid #eee; '>
  61 + <view class='pd-list-foot'>
  62 + <view class='foot-left flex fdc'>
  63 + <view class="t-c flex {{item.pt_status==3?'jietitun':''}}">
  64 + <view>共{{item.order_goods[0].goods_num}}件,</view>
  65 + <block wx:if="{{item.is_zsorder==4}}">
  66 + <block wx:if="{{item.pt_status==3 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}">
  67 + <view>金额:<text class="xc-wc">¥</text></view>
  68 + <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount+item.pt_tail_money,2)}}</view>
  69 + </block>
  70 + <block wx:else>
73 <view class='foot-l-wz fs35' wx:if="item.is_zsorder==4"> 71 <view class='foot-l-wz fs35' wx:if="item.is_zsorder==4">
74 - 定金:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view> 72 + 定金:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view>
75 <view class='foot-l-wz fs35' wx:else>金额:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view> 73 <view class='foot-l-wz fs35' wx:else>金额:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view>
76 - <view class='foot-l-wz2 fs35' wx:if="{{item.pt_tail_money>0}}">尾款:¥{{item.pt_tail_money}}</view>  
77 - </block>  
78 -  
79 - </block>  
80 - <block wx:else>  
81 - 金额:<text class="xc-wc">¥</text>  
82 - <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount,2)}}</view>  
83 - </block>  
84 - </view>  
85 - </view> 74 + <view class='foot-l-wz2 fs35' wx:if="{{item.pt_tail_money>0}}">尾款:¥{{item.pt_tail_money}}</view>
  75 + </block>
86 76
87 - <view class='foot-right'>  
88 - <!--头像遍历-->  
89 - <view class='foot-right-r'>  
90 - <view class='foot-l-tx' style="margin-right:20rpx">  
91 - <view wx:if="{{item.tx}}" style="display: flex">  
92 - <image wx:for="{{item.tx}}" wx:for-item="aitem" src='{{aitem.head_pic}}'></image>  
93 - <image src='{{iurl}}/miniapp/images/shafa.png' wx:for="{{item.sf_num}}" ></image>  
94 - <view class="xc-ellipsis" wx:if="{{item.tx.length>3}}">...</view> 77 + </block>
  78 + <block wx:else>
  79 + <view>金额:<text class="xc-wc">¥</text></view>
  80 + <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount,2)}}</view>
  81 + </block>
  82 +
  83 +
95 </view> 84 </view>
  85 + <view wx:if="{{item.pt_status==3}}" class="jietitun">退款时间:{{filters.format_time(item.is_back_time,1)}}</view>
96 </view> 86 </view>
97 87
98 - <view class='C'>  
99 - <view class='yao' wx:if="{{item.pt_status==1}}">邀请好友</view>  
100 - <view class='s_and_f' wx:if="{{item.pt_status==2 || item.pt_status==3 || item.pt_status==4 || item.pt_status==5 }}">查看详情</view>  
101 - <view class='s_and_f' wx:if="{{item.pt_status==6}}">支付尾款失败</view> 88 + <view class='foot-right'>
  89 + <!--头像遍历-->
  90 + <view class='foot-right-r'>
  91 + <view class='foot-l-tx' style="margin-right:20rpx">
  92 + <view wx:if="{{item.tx}}" style="display: flex">
  93 + <image wx:for="{{item.tx}}" wx:for-item="aitem" src='{{aitem.head_pic}}'></image>
  94 + <image src='{{iurl}}/miniapp/images/shafa.png' wx:for="{{item.sf_num}}"></image>
  95 + <view class="xc-ellipsis" wx:if="{{item.tx.length>3}}">...</view>
  96 + </view>
  97 + </view>
  98 +
  99 + <view class='C'>
  100 + <view class='yao' wx:if="{{item.pt_status==1}}">邀请好友</view>
  101 + <view class='s_and_f' wx:if="{{item.pt_status==2 || item.pt_status==3 || item.pt_status==4 || item.pt_status==5 }}">查看详情</view>
  102 + <view class='s_and_f' wx:if="{{item.pt_status==6}}">支付尾款失败</view>
  103 + </view>
  104 +
  105 + </view>
  106 +
102 </view> 107 </view>
103 - 108 +
  109 +
  110 + </view>
  111 + <view class='bodytimecen flex' wx:if="{{item.pt_status==1}}">
  112 + 剩余:
  113 + <span>{{item.djs.day}}</span>天
  114 + <span>{{item.djs.hou}}</span>时
  115 + <span>{{item.djs.min}}</span>分
  116 + <span>{{item.djs.sec}}</span>秒
104 </view> 117 </view>
105 -  
106 </view> 118 </view>
107 -  
108 -  
109 </view> 119 </view>
110 - <view class='bodytimecen flex' wx:if="{{item.pt_status==1}}">  
111 - 剩余:  
112 - <span>{{item.djs.day}}</span>天  
113 - <span>{{item.djs.hou}}</span>时  
114 - <span>{{item.djs.min}}</span>分  
115 - <span>{{item.djs.sec}}</span>秒  
116 - </view>  
117 -</view>  
118 </view> 120 </view>
119 -</view>  
120 121
121 122
122 </view> 123 </view>
pages/team/team_ping/team_ping.wxss
@@ -191,11 +191,15 @@ height:222rpx; @@ -191,11 +191,15 @@ height:222rpx;
191 } 191 }
192 192
193 .foot-left{ 193 .foot-left{
194 -  
195 - margin-left:19rpx;  
196 - min-width: 360rpx;  
197 - line-height: 100rpx;  
198 - font-size:26rpx; 194 + margin-left:19rpx;
  195 + min-width: 360rpx;
  196 + height: 100rpx;
  197 + line-height: 100rpx;
  198 + font-size:26rpx;
  199 +}
  200 +.foot-left .jietitun {
  201 + height: 50rpx;
  202 + line-height: 50rpx;
199 } 203 }
200 204
201 .foot-right{ 205 .foot-right{
@@ -211,6 +215,7 @@ height:222rpx; @@ -211,6 +215,7 @@ height:222rpx;
211 215
212 } 216 }
213 217
  218 +
214 .foot-right-wz{ 219 .foot-right-wz{
215 220
216 padding: 6rpx 20rpx; 221 padding: 6rpx 20rpx;
pages/togoin/togoin.js
1 -var t = require("../../utils/common.js"); 1 +var t = require("../../utils/common.js");
2 const app=getApp(); 2 const app=getApp();
3 var os = app.globalData.setting; 3 var os = app.globalData.setting;
4 var regeneratorRuntime = require('../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../utils/runtime.js');
@@ -18,53 +18,86 @@ Page({ @@ -18,53 +18,86 @@ Page({
18 canIUseGetUserProfile: true 18 canIUseGetUserProfile: true
19 }) 19 })
20 } 20 }
21 -  
22 - getApp().globalData.isLoad_ad=1; 21 +
  22 + getApp().globalData.isLoad_ad=1;
23 //--判断是否有接受到邀请人的ID-- 23 //--判断是否有接受到邀请人的ID--
24 if(options.first_leader){ 24 if(options.first_leader){
25 this.setData({first_leader:options.first_leader}); 25 this.setData({first_leader:options.first_leader});
26 }else if(getApp().globalData.first_leader){ 26 }else if(getApp().globalData.first_leader){
27 - this.setData({first_leader:getApp().globalData.first_leader});  
28 - } 27 + this.setData({first_leader:getApp().globalData.first_leader});
  28 + }
29 var th=this; 29 var th=this;
30 app.getConfig(function (e) { 30 app.getConfig(function (e) {
31 - var logo=th.data.imghots+e.store_logo; 31 + var logo=th.data.imghots+e.store_logo;
32 th.setData({ store: e,store_logo:logo}); 32 th.setData({ store: e,store_logo:logo});
33 - })  
34 -  
35 - //判断注册的条件 33 + })
  34 +
  35 + //判断注册的条件
36 app.getConfig2(function (e) { 36 app.getConfig2(function (e) {
37 - if(e.reg_type==1){  
38 - var arr=JSON.parse(e.reg_info); 37 + if(e.reg_type==1){
  38 + var arr=JSON.parse(e.reg_info);
39 if(arr['name_state']==1) th.data.name_need_go=1; 39 if(arr['name_state']==1) th.data.name_need_go=1;
40 if(arr['birthday_state']==1) th.data.birth_need_go=1; 40 if(arr['birthday_state']==1) th.data.birth_need_go=1;
41 if(arr['idcard_state']==1) th.data.idcard_need_go=1; 41 if(arr['idcard_state']==1) th.data.idcard_need_go=1;
42 if(arr['address_state']==1) th.data.address_need_go=1; 42 if(arr['address_state']==1) th.data.address_need_go=1;
43 if(arr['pick_state']==1) th.data.pick_need_go=1; 43 if(arr['pick_state']==1) th.data.pick_need_go=1;
44 if(arr['sex_state']==1) th.data.sex_need_go=1; 44 if(arr['sex_state']==1) th.data.sex_need_go=1;
45 - if(arr['introducer_state']==1) th.data.introducer_need_go=1;  
46 - }  
47 - },1) 45 + if(arr['introducer_state']==1) th.data.introducer_need_go=1;
  46 + }
  47 + },1)
  48 +
  49 + getApp().promiseGet("/api/wx/weappSendlist/page", {
  50 + data: {
  51 + store_id: os.stoid,
  52 + typeid: "1007"
  53 + }}).then(res=>{
  54 + if (res.data.code == 0 && res.data.data.pageData.length > 0) {
  55 + var template_id = res.data.data.pageData[0].template_id;
  56 + th.setData({template_id:template_id});
  57 + }
  58 + })
48 }, 59 },
  60 +
  61 +
49 //绑定手机号 62 //绑定手机号
50 getphone:function (e) { 63 getphone:function (e) {
51 //接下来写业务代码登录 64 //接下来写业务代码登录
52 e=e.detail; 65 e=e.detail;
53 - if (e.encryptedData==undefined){ 66 + if (e.encryptedData==undefined){
54 this.setData({show_bind:0}) 67 this.setData({show_bind:0})
55 return app.my_warnning("登录需要授权手机号码!", 0, this); 68 return app.my_warnning("登录需要授权手机号码!", 0, this);
56 return false; 69 return false;
57 - }  
58 - var th=this; 70 + }
  71 + var th=this;
59 var sessionKey = getApp().globalData.sessionKey; 72 var sessionKey = getApp().globalData.sessionKey;
60 var openid = getApp().globalData.openid; 73 var openid = getApp().globalData.openid;
61 - var r=getApp().globalData.getu;  
62 - th.save_the_data(r,e,sessionKey,openid) 74 + var r=getApp().globalData.getu;
  75 +
  76 + if(e){
  77 + wx.showModal({
  78 + title: '授权通知',
  79 + content:'是否接受注册成功通知',
  80 + success(res){
  81 + if(res.confirm){
  82 + th.sendsm(function (){
  83 + th.save_the_data(r,e,sessionKey,openid)
  84 + })
  85 + }else if(res.cancel){
  86 + th.save_the_data(r,e,sessionKey,openid)
  87 + }
  88 + }
  89 +
  90 + })
  91 + }
  92 +
  93 +
63 }, 94 },
  95 + requestSubscribe(){
  96 +
  97 + },
64 98
65 //-- 会员授权 -- 99 //-- 会员授权 --
66 bindGetUserInfo: function(ee) { 100 bindGetUserInfo: function(ee) {
67 -  
68 if(!this.data.isAgree) { 101 if(!this.data.isAgree) {
69 wx.showToast({ 102 wx.showToast({
70 title: '请您先阅读和勾选指定的内容', 103 title: '请您先阅读和勾选指定的内容',
@@ -83,27 +116,27 @@ Page({ @@ -83,27 +116,27 @@ Page({
83 js_code:o.code, 116 js_code:o.code,
84 store_id: os.stoid, 117 store_id: os.stoid,
85 nickname: app.clear_word(app.globalData.getu.nickName), 118 nickname: app.clear_word(app.globalData.getu.nickName),
86 - head_pic: app.clear_word(app.globalData.getu.avatarUrl)  
87 - }; 119 + head_pic: app.clear_word(app.globalData.getu.avatarUrl)
  120 + };
88 //-- 导购会员ID -- 121 //-- 导购会员ID --
89 if(getApp().globalData.guide_id){ 122 if(getApp().globalData.guide_id){
90 dd.guide_id=getApp().globalData.guide_id; 123 dd.guide_id=getApp().globalData.guide_id;
91 } 124 }
92 - 125 +
93 getApp().request.get("/api/weshop/users/openidandkey", { 126 getApp().request.get("/api/weshop/users/openidandkey", {
94 data: dd, 127 data: dd,
95 success: function (e) { 128 success: function (e) {
96 - if(e.data.code==0){  
97 - that.setData({user:user}) 129 + if(e.data.code==0){
  130 + that.setData({user:user})
98 //如果有会员的话,没有sessionKey 131 //如果有会员的话,没有sessionKey
99 if(!e.data.data.sessionKey){ 132 if(!e.data.data.sessionKey){
100 getApp().showWarning("登录成功"); 133 getApp().showWarning("登录成功");
101 getApp().globalData.userInfo=e.data.data; 134 getApp().globalData.userInfo=e.data.data;
102 getApp().globalData.user_id=e.data.data.user_id; 135 getApp().globalData.user_id=e.data.data.user_id;
103 getApp().globalData.openid = e.data.data.weapp_openid; 136 getApp().globalData.openid = e.data.data.weapp_openid;
104 - //把会员的信息存在内存 137 + //把会员的信息存在内存
105 wx.setStorageSync("userinfo",e.data.data); 138 wx.setStorageSync("userinfo",e.data.data);
106 - 139 +
107 setTimeout(function () { 140 setTimeout(function () {
108 getApp().globalData.login_back=1; 141 getApp().globalData.login_back=1;
109 wx.navigateBack({ delta: 1}) //返回上一页 142 wx.navigateBack({ delta: 1}) //返回上一页
@@ -111,45 +144,48 @@ Page({ @@ -111,45 +144,48 @@ Page({
111 }else{ 144 }else{
112 getApp().globalData.sessionKey=e.data.data.sessionKey; 145 getApp().globalData.sessionKey=e.data.data.sessionKey;
113 getApp().globalData.openid=e.data.data.openid; 146 getApp().globalData.openid=e.data.data.openid;
114 - that.setData({show_bind:1}); 147 + that.setData({show_bind:1});
115 } 148 }
116 }else{ 149 }else{
117 - getApp().confirmBox(e.data.msg); 150 + getApp().confirmBox(e.data.msg);
118 } 151 }
119 } 152 }
120 }); 153 });
121 } 154 }
122 - })  
123 -  
124 - }) 155 + })
  156 +
  157 + })
125 }, 158 },
126 - 159 +
127 //-- 调整后的获取会员信息 -- 160 //-- 调整后的获取会员信息 --
128 getUserProfile:function(func){ 161 getUserProfile:function(func){
129 - var that=this; 162 + var that=this;
130 wx.getUserProfile({ 163 wx.getUserProfile({
131 desc:'获取用户相关信息', 164 desc:'获取用户相关信息',
132 success:res=>{ 165 success:res=>{
133 console.log("getUserProfile",res); 166 console.log("getUserProfile",res);
134 //此处授权得到userInfo 167 //此处授权得到userInfo
135 - getApp().globalData.getu = res.userInfo;  
136 - func(res.userInfo); 168 + getApp().globalData.getu = res.userInfo;
  169 + func(res.userInfo);
137 } 170 }
138 - }); 171 + });
139 }, 172 },
140 - 173 +
141 //暂不登录,返回上一页 174 //暂不登录,返回上一页
142 cancle_bind:function () { 175 cancle_bind:function () {
143 wx.navigateBack({ delta: 1}) 176 wx.navigateBack({ delta: 1})
144 }, 177 },
145 - 178 +
146 close_pop:function(){ 179 close_pop:function(){
147 this.setData({show_bind:0}) 180 this.setData({show_bind:0})
148 }, 181 },
149 show_bind_mobile:function(){ 182 show_bind_mobile:function(){
150 - this.setData({show_bind:1}) 183 + let th=this;
  184 + th.sendsm(function (){
  185 + th.setData({show_bind:1})
  186 + })
151 }, 187 },
152 - 188 +
153 save_the_data: async function (r,e,sessionKey,openid) { 189 save_the_data: async function (r,e,sessionKey,openid) {
154 var app=getApp(),a=app,th=this; 190 var app=getApp(),a=app,th=this;
155 var dd = { 191 var dd = {
@@ -174,39 +210,39 @@ Page({ @@ -174,39 +210,39 @@ Page({
174 dd.first_leader=th.data.first_leader; 210 dd.first_leader=th.data.first_leader;
175 } 211 }
176 } 212 }
177 - })  
178 - } 213 + })
  214 + }
179 //-- 导购会员ID -- 215 //-- 导购会员ID --
180 if(getApp().globalData.guide_id){ 216 if(getApp().globalData.guide_id){
181 dd.guide_id=getApp().globalData.guide_id; 217 dd.guide_id=getApp().globalData.guide_id;
182 } 218 }
183 - 219 +
184 //门店的扫描识别码 220 //门店的扫描识别码
185 if(getApp().globalData.store_number){ 221 if(getApp().globalData.store_number){
186 dd.SunCode=encodeURIComponent(getApp().globalData.store_number.trim()); 222 dd.SunCode=encodeURIComponent(getApp().globalData.store_number.trim());
187 } 223 }
188 -  
189 - console.log("-----会员注册的信息-------"); 224 +
  225 + console.log("-----会员注册的信息-------");
190 console.log(dd); 226 console.log(dd);
191 app.request.get("/api/weshop/users/thirdLogin", { 227 app.request.get("/api/weshop/users/thirdLogin", {
192 data: dd, 228 data: dd,
193 success: function (e) { 229 success: function (e) {
194 - 230 +
195 if (e.data.code == 0) { 231 if (e.data.code == 0) {
196 app.globalData.user_id = e.data.data.user_id; 232 app.globalData.user_id = e.data.data.user_id;
197 } else { 233 } else {
198 return app.showWarning("授权登入失败!"+e.data.msg); 234 return app.showWarning("授权登入失败!"+e.data.msg);
199 } 235 }
200 -  
201 -  
202 - var need_go=0; 236 +
  237 +
  238 + var need_go=0;
203 var t_user=e.data.data; 239 var t_user=e.data.data;
204 240
205 241
206 getApp().globalData.login_back=1; 242 getApp().globalData.login_back=1;
207 wx.setStorageSync("userinfo",e.data.data); 243 wx.setStorageSync("userinfo",e.data.data);
208 wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); 244 wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic);
209 - 245 +
210 //如果有需要完善的信息没有完善,就需要跳转 246 //如果有需要完善的信息没有完善,就需要跳转
211 if(!t_user['vipname'] && th.data.name_need_go){ need_go=1;} 247 if(!t_user['vipname'] && th.data.name_need_go){ need_go=1;}
212 if(!t_user['birthday'] && th.data.birth_need_go){ need_go=1;} 248 if(!t_user['birthday'] && th.data.birth_need_go){ need_go=1;}
@@ -215,15 +251,15 @@ Page({ @@ -215,15 +251,15 @@ Page({
215 if(!t_user['pickup_id'] && th.data.pick_need_go){ need_go=1;} 251 if(!t_user['pickup_id'] && th.data.pick_need_go){ need_go=1;}
216 if(!t_user['sex'] && th.data.sex_need_go){ need_go=1;} 252 if(!t_user['sex'] && th.data.sex_need_go){ need_go=1;}
217 if(!t_user['fromuser_id'] && th.data.introducer_need_go){ need_go=1;} 253 if(!t_user['fromuser_id'] && th.data.introducer_need_go){ need_go=1;}
218 - 254 +
219 if(need_go){ 255 if(need_go){
220 getApp().goto("/packageA/pages/profile/profile"); 256 getApp().goto("/packageA/pages/profile/profile");
221 }else{ 257 }else{
222 wx.navigateBack({ delta: 1}) 258 wx.navigateBack({ delta: 1})
223 } 259 }
224 - 260 +
225 }, 261 },
226 - failStatus: function (t) { 262 + failStatus: function (t) {
227 return app.my_warnning("授权登入失败,请稍后再试!", 0, that); 263 return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
228 }, 264 },
229 fail: function (t) { 265 fail: function (t) {
@@ -238,14 +274,14 @@ Page({ @@ -238,14 +274,14 @@ Page({
238 _errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png"; 274 _errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png";
239 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 275 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
240 }, 276 },
241 - 277 +
242 //-- 会员授权 -- 278 //-- 会员授权 --
243 bindUserInfo: function(ee) { 279 bindUserInfo: function(ee) {
244 var that = this; 280 var that = this;
245 var user=ee.detail.userInfo; 281 var user=ee.detail.userInfo;
246 //此处授权得到userInfo 282 //此处授权得到userInfo
247 getApp().globalData.getu = user; 283 getApp().globalData.getu = user;
248 - 284 +
249 //--拿下code-- 285 //--拿下code--
250 wx.login({ 286 wx.login({
251 success: function (o) { 287 success: function (o) {
@@ -253,27 +289,27 @@ Page({ @@ -253,27 +289,27 @@ Page({
253 js_code:o.code, 289 js_code:o.code,
254 store_id: os.stoid, 290 store_id: os.stoid,
255 nickname: app.clear_word(app.globalData.getu.nickName), 291 nickname: app.clear_word(app.globalData.getu.nickName),
256 - head_pic: app.clear_word(app.globalData.getu.avatarUrl)  
257 - }; 292 + head_pic: app.clear_word(app.globalData.getu.avatarUrl)
  293 + };
258 //-- 导购会员ID -- 294 //-- 导购会员ID --
259 if(getApp().globalData.guide_id){ 295 if(getApp().globalData.guide_id){
260 dd.guide_id=getApp().globalData.guide_id; 296 dd.guide_id=getApp().globalData.guide_id;
261 } 297 }
262 - 298 +
263 getApp().request.get("/api/weshop/users/openidandkey", { 299 getApp().request.get("/api/weshop/users/openidandkey", {
264 data: dd, 300 data: dd,
265 success: function (e) { 301 success: function (e) {
266 - if(e.data.code==0){  
267 - that.setData({user:user}) 302 + if(e.data.code==0){
  303 + that.setData({user:user})
268 //如果有会员的话,没有sessionKey 304 //如果有会员的话,没有sessionKey
269 if(!e.data.data.sessionKey){ 305 if(!e.data.data.sessionKey){
270 getApp().showWarning("登录成功"); 306 getApp().showWarning("登录成功");
271 getApp().globalData.userInfo=e.data.data; 307 getApp().globalData.userInfo=e.data.data;
272 getApp().globalData.user_id=e.data.data.user_id; 308 getApp().globalData.user_id=e.data.data.user_id;
273 getApp().globalData.openid = e.data.data.weapp_openid; 309 getApp().globalData.openid = e.data.data.weapp_openid;
274 - //把会员的信息存在内存 310 + //把会员的信息存在内存
275 wx.setStorageSync("userinfo",e.data.data); 311 wx.setStorageSync("userinfo",e.data.data);
276 - 312 +
277 setTimeout(function () { 313 setTimeout(function () {
278 getApp().globalData.login_back=1; 314 getApp().globalData.login_back=1;
279 wx.navigateBack({ delta: 1}) //返回上一页 315 wx.navigateBack({ delta: 1}) //返回上一页
@@ -281,26 +317,26 @@ Page({ @@ -281,26 +317,26 @@ Page({
281 }else{ 317 }else{
282 getApp().globalData.sessionKey=e.data.data.sessionKey; 318 getApp().globalData.sessionKey=e.data.data.sessionKey;
283 getApp().globalData.openid=e.data.data.openid; 319 getApp().globalData.openid=e.data.data.openid;
284 - that.setData({show_bind:1}); 320 + that.setData({show_bind:1});
285 } 321 }
286 }else{ 322 }else{
287 - getApp().confirmBox(e.data.msg); 323 + getApp().confirmBox(e.data.msg);
288 } 324 }
289 } 325 }
290 }); 326 });
291 } 327 }
292 - })  
293 -  
294 - 328 + })
  329 +
  330 +
295 }, 331 },
296 -  
297 - 332 +
  333 +
298 close_pop_back:function(){ 334 close_pop_back:function(){
299 this.close_pop(); 335 this.close_pop();
300 wx.navigateBack({ delta: 1}) 336 wx.navigateBack({ delta: 1})
301 }, 337 },
302 -  
303 - 338 +
  339 +
304 // 是否同意协议 340 // 是否同意协议
305 isAgree(e) { 341 isAgree(e) {
306 let isAgree = null; 342 let isAgree = null;
@@ -308,22 +344,37 @@ Page({ @@ -308,22 +344,37 @@ Page({
308 isAgree = true; 344 isAgree = true;
309 } else { 345 } else {
310 isAgree = false; 346 isAgree = false;
311 - }; 347 + };
312 // this.data.isAgree = isAgree; 348 // this.data.isAgree = isAgree;
313 this.setData({ 349 this.setData({
314 isAgree, 350 isAgree,
315 }); 351 });
316 }, 352 },
317 -  
318 - 353 +
  354 +
319 //通过路径跳转到其他页面 355 //通过路径跳转到其他页面
320 goto: function(e) { 356 goto: function(e) {
321 console.log('xxxx', e); 357 console.log('xxxx', e);
322 var url = e.currentTarget.dataset.url; 358 var url = e.currentTarget.dataset.url;
323 getApp().goto(url); 359 getApp().goto(url);
324 }, 360 },
325 -  
326 -  
327 -  
328 - 361 +
  362 + //订阅消息提醒
  363 + sendsm:function(func)
  364 + {
  365 + var template_id = this.data.template_id;
  366 + // //授权订阅
  367 + wx.requestSubscribeMessage({
  368 + tmplIds: [template_id],
  369 + success(res) {
  370 + func();
  371 + },
  372 + fail(res) {
  373 + func();
  374 + }
  375 + })
  376 +
  377 + },
  378 +
  379 +
329 }) 380 })
pages/togoin/togoin.wxml
@@ -14,45 +14,45 @@ @@ -14,45 +14,45 @@
14 <!-- 登录按钮 --> 14 <!-- 登录按钮 -->
15 <view> 15 <view>
16 <view class="phones"> 16 <view class="phones">
17 - 17 +
18 <view bindtap="" class="user-name flex-vertical fs24 jc-center"> 18 <view bindtap="" class="user-name flex-vertical fs24 jc-center">
19 <checkbox-group bindchange="isAgree"> 19 <checkbox-group bindchange="isAgree">
20 <checkbox value="true"/> 20 <checkbox value="true"/>
21 </checkbox-group> 21 </checkbox-group>
22 <view class="user-name-txt">我已阅读同意 <text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=0">《用户使用协议》</text>与<text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=1">《隐私政策》</text></view> 22 <view class="user-name-txt">我已阅读同意 <text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=0">《用户使用协议》</text>与<text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=1">《隐私政策》</text></view>
23 - </view>  
24 - 23 + </view>
  24 +
25 <!-- 授权获取基础信息 --> 25 <!-- 授权获取基础信息 -->
26 - <block wx:if="{{canIUseGetUserProfile}}"> 26 + <block wx:if="{{canIUseGetUserProfile}}">
27 <button hidden="{{user}}" class="getPhoneNumber" bindtap="bindGetUserInfo"> 27 <button hidden="{{user}}" class="getPhoneNumber" bindtap="bindGetUserInfo">
28 <view class="flex flex-center ali-c"> 28 <view class="flex flex-center ali-c">
29 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> 29 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image>
30 <view>微信账号快捷登录</view> 30 <view>微信账号快捷登录</view>
31 </view> 31 </view>
32 - </button>  
33 - </block> 32 + </button>
  33 + </block>
34 34
35 - <block wx:else>  
36 - <!-- 授权获取基础信息 --> 35 + <block wx:else>
  36 + <!-- 授权获取基础信息 -->
37 <button hidden="{{user}}" class="getPhoneNumber" open-type="getUserInfo" bindgetuserinfo="bindUserInfo"> 37 <button hidden="{{user}}" class="getPhoneNumber" open-type="getUserInfo" bindgetuserinfo="bindUserInfo">
38 <view class="flex flex-center ali-c"> 38 <view class="flex flex-center ali-c">
39 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> 39 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image>
40 <view>微信账号快捷登录</view> 40 <view>微信账号快捷登录</view>
41 </view> 41 </view>
42 - </button>  
43 - </block>  
44 -  
45 - <!-- 点击显示绑定手机的对话框 --> 42 + </button>
  43 + </block>
  44 +
  45 + <!-- 点击显示绑定手机的对话框 -->
46 <button hidden="{{!user}}" class="getPhoneNumber" bindtap="show_bind_mobile"> 46 <button hidden="{{!user}}" class="getPhoneNumber" bindtap="show_bind_mobile">
47 <view class="flex flex-center2 ali-c" > 47 <view class="flex flex-center2 ali-c" >
48 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> 48 <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image>
49 <view>微信账号快捷登录</view> 49 <view>微信账号快捷登录</view>
50 </view> 50 </view>
51 - </button> 51 + </button>
52 </view> 52 </view>
53 53
54 <view class="userlongin flex-center2 flex fs30 jc_sb" style="margin: 0 130rpx"> 54 <view class="userlongin flex-center2 flex fs30 jc_sb" style="margin: 0 130rpx">
55 - <view bindtap="cancle_bind">暂不登录</view> 55 + <view bindtap="cancle_bind">暂不登录</view>
56 </view> 56 </view>
57 57
58 </view> 58 </view>
@@ -60,14 +60,14 @@ @@ -60,14 +60,14 @@
60 </view> 60 </view>
61 61
62 62
63 -<view wx:if="{{show_bind}}">  
64 - <view class="cover-layer" bindtap="close_pop"></view> 63 +<view wx:if="{{show_bind}}">
  64 + <view class="cover-layer" bindtap="close_pop"></view>
65 <view class="p_content"> 65 <view class="p_content">
66 <view class="p_title flex ali-c fs34"> 66 <view class="p_title flex ali-c fs34">
67 登录手机号,同步会员信息以及订单记录 67 登录手机号,同步会员信息以及订单记录
68 </view> 68 </view>
69 <view class="flex btn_view"> 69 <view class="flex btn_view">
70 - <view bindtap="close_pop_back" style="height: 100%; line-height:normal;" class="txt-center f2 flex ali-c flex-center2 fs36 b_right">暂不授权</view> 70 + <view bindtap="close_pop_back" style="height: 100%; line-height:normal;" class="txt-center f2 flex ali-c flex-center2 fs36 b_right">暂不授权</view>
71 <button style="height: 100%;" class="g_mobile f2 flex ali-c flex-center2 fs36 txt-red" open-type="getPhoneNumber" bindgetphonenumber="getphone">立即授权</button> 71 <button style="height: 100%;" class="g_mobile f2 flex ali-c flex-center2 fs36 txt-red" open-type="getPhoneNumber" bindgetphonenumber="getphone">立即授权</button>
72 </view> 72 </view>
73 </view> 73 </view>
pages/user/index/index.js
@@ -58,7 +58,6 @@ Page({ @@ -58,7 +58,6 @@ Page({
58 * 生命周期函数--监听页面加载 58 * 生命周期函数--监听页面加载
59 */ 59 */
60 onLoad: function(options) { 60 onLoad: function(options) {
61 -  
62 var th=this; 61 var th=this;
63 //-- 读取会员中心按钮列表 -- 62 //-- 读取会员中心按钮列表 --
64 getApp().request.get("/api/weshop/userTool/page?pageSize=100", { 63 getApp().request.get("/api/weshop/userTool/page?pageSize=100", {
@@ -99,9 +98,6 @@ Page({ @@ -99,9 +98,6 @@ Page({
99 * 生命周期函数--监听页面显示 98 * 生命周期函数--监听页面显示
100 */ 99 */
101 onShow: function() { 100 onShow: function() {
102 - this.getTabBar().setData({  
103 - cartGoodsNum: getApp().globalData.cartGoodsNum,  
104 - })  
105 //看一下小程序是不是过期了 101 //看一下小程序是不是过期了
106 getApp().getConfig2(function(config2){ 102 getApp().getConfig2(function(config2){
107 if(config2 && config2.is_overdue==1){ 103 if(config2 && config2.is_overdue==1){
@@ -739,8 +735,6 @@ Page({ @@ -739,8 +735,6 @@ Page({
739 735
740 } 736 }
741 }) 737 })
742 -  
743 -  
744 }, 738 },
745 clike_banne: function() { 739 clike_banne: function() {
746 var th = this; 740 var th = this;
@@ -755,6 +749,7 @@ Page({ @@ -755,6 +749,7 @@ Page({
755 getApp().showWarning("请稍后重试"); 749 getApp().showWarning("请稍后重试");
756 } 750 }
757 }, 751 },
  752 +
758 // 判断助力活动是不是存在 753 // 判断助力活动是不是存在
759 is_assistance: function() { 754 is_assistance: function() {
760 var th = this,r=Math.random()*100; 755 var th = this,r=Math.random()*100;
utils/util.js
@@ -13,7 +13,22 @@ function trim(str) { return str.replace(/(^s*)|(s*$)/g, &quot;&quot;);} @@ -13,7 +13,22 @@ function trim(str) { return str.replace(/(^s*)|(s*$)/g, &quot;&quot;);}
13 function e(e) { 13 function e(e) {
14 var r = ""; for (var t in e) r += (r ? "&" : "") + t + "=" + e[t]; return r; 14 var r = ""; for (var t in e) r += (r ? "&" : "") + t + "=" + e[t]; return r;
15 } 15 }
16 - 16 +//节流
  17 +let _throttle =function (fn, interval) {
  18 + var enterTime = 0;//触发的时间
  19 + console.log(1);
  20 +
  21 + var gapTime = interval || 300 ;//间隔时间,如果interval不传,则默认300ms
  22 + return function() {
  23 + console.log(2);
  24 + var context = this;
  25 + var backTime = new Date();//第一次函数return即触发的时间
  26 + if (backTime - enterTime > gapTime) {
  27 + fn.call(context,arguments);
  28 + enterTime = backTime;//赋值给第一次触发的时间,这样就保存了第二次触发的时间
  29 + }
  30 + };
  31 +}.bind(this);
17 function utf16to8(str) { 32 function utf16to8(str) {
18 var out, i, len, c; out = ""; len = str.length; 33 var out, i, len, c; out = ""; len = str.length;
19 for (i = 0; i < len; i++) { 34 for (i = 0; i < len; i++) {
@@ -577,6 +592,7 @@ module.exports = { @@ -577,6 +592,7 @@ module.exports = {
577 }); 592 });
578 }, 593 },
579 unserialize: unserialize, 594 unserialize: unserialize,
  595 + _throttle:_throttle,
580 unserialize_o: unserialize_o, 596 unserialize_o: unserialize_o,
581 trim: trim, //去空格 597 trim: trim, //去空格
582 isEmptyObject: isEmptyObject, //判断空对象 598 isEmptyObject: isEmptyObject, //判断空对象
utils/wxParse/wxParse.wxml
1 <template name="wxParse11"> 1 <template name="wxParse11">
2 <block wx:if="{{item.node=='element'}}"> 2 <block wx:if="{{item.node=='element'}}">
3 <button size="mini" type="default" wx:if="{{item.tag=='button'}}"> 3 <button size="mini" type="default" wx:if="{{item.tag=='button'}}">
4 - <template is="wxParse12" data="{{item:item}}" wx:for="{{item.nodes}}"></template> 4 + <template is="wxParse12" data="{{item:item}}" wx:for="{{item.nodes}}" wx:key="index"></template>
5 </button> 5 </button>
6 <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}" wx:elif="{{item.tag=='li'}}"> 6 <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}" wx:elif="{{item.tag=='li'}}">
7 <view class="{{item.classStr}} wxParse-li-inner"> 7 <view class="{{item.classStr}} wxParse-li-inner">
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <template is="wxParseVideo" data="{{item:item}}" wx:elif="{{item.tag=='video'}}"></template> 16 <template is="wxParseVideo" data="{{item:item}}" wx:elif="{{item.tag=='video'}}"></template>
17 <template is="wxParseImg" data="{{item:item}}" wx:elif="{{item.tag=='img'}}"></template> 17 <template is="wxParseImg" data="{{item:item}}" wx:elif="{{item.tag=='img'}}"></template>
18 <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}" wx:elif="{{item.tag=='a'}}"> 18 <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}" wx:elif="{{item.tag=='a'}}">
19 - <template is="wxParse12" data="{{item:item}}" wx:for="{{item.nodes}}"></template> 19 + <template is="wxParse12" data="{{item:item}}" wx:for="{{item.nodes}}" wx:key="index"></template>
20 </view> 20 </view>
21 <template is="WxParseBr" data wx:elif="{{item.tag=='br'}}"></template> 21 <template is="WxParseBr" data wx:elif="{{item.tag=='br'}}"></template>
22 <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}" wx:elif="{{item.tagType=='block'}}"> 22 <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}" wx:elif="{{item.tagType=='block'}}">