Commit a73bb16da64abef3af4e188ce5fb1e88ea76d8c8

Authored by yvan.ni
1 parent 420e7cc9

组合购活动界面的优化

packageB/pages/zuhegou/index/index.js
1   -
2 1 const app = getApp();
3 2 let self = null;
  3 +var os = app.globalData.setting;
  4 +var ut = require("../../../../utils/util.js");
  5 +var oo = app.globalData;
  6 +
4 7  
5 8 let imgDraw = {
6   - "width": "650px",
7   - "height": "843px",
8   - "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg",
9   - "views": [
10   - { // 头像
11   - "type": "image",
12   - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
13   - "css": {
14   - "width": "100px",
15   - "height": "100px",
16   - "top": "20px",
17   - "left": "275px",
18   - "borderRadius": "100px",
19   - "mode": "scaleToFill",
20   - "borderWidth": "2px",
21   - "borderColor": "#fff",
22   - }
23   - },
24   - { //昵称
25   - "type": "text",
26   - "text": "我是店铺",
27   - "css": {
28   - "width": "650px",
29   - "color": "#fff",
30   - "top": "136px",
31   - "fontSize": "26px",
32   - "maxLines": "1",
33   - "textAlign": "center",
34   - }
35   - },
36   - { //10元任选3件
37   - "type": "text",
38   - "text": "10元任选3件",
39   - "css": {
40   - "color": "#fff",
41   - "width": "650px",
42   - "top": "270px",
43   - "fontSize": "70px",
44   - "maxLines": "1",
45   - "textAlign": "center",
46   - "fontWeight": "bold",
47   - }
48   - },
49   - { //活动时间
50   - "type": "text",
51   - "text": "活动时间:2021.07.06 - 2021.07.08",
52   - "css": {
53   - "color": "#333",
54   - "width": "650px",
55   - "top": "440px",
56   - "fontSize": "26px",
57   - "fontWeight": "normal",
58   - "maxLines": "1",
59   - "textAlign": "center"
60   - }
61   - },
62   - { // 码
63   - "type": "qrcode",
64   - "content": "二维码地址",
65   - "css": {
66   - "color": "#000",
67   - "width": "200px",
68   - "height": "200px",
69   - "top": "525px",
70   - "left": "225px",
71   - }
72   - },
73   - { // 扫码提示
74   - "type": "text",
75   - "text": "长按扫码即可参与活动",
76   - "css": {
77   - "color": "#666",
78   - "width": "650px",
79   - "top": "750px",
80   - "fontSize": "26px",
81   - "textAlign": "center"
82   - }
83   - },
84   - ]
  9 + "width": "650px",
  10 + "height": "843px",
  11 + "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg",
  12 + "views": [
  13 + { // 头像
  14 + "type": "image",
  15 + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
  16 + "css": {
  17 + "width": "100px",
  18 + "height": "100px",
  19 + "top": "20px",
  20 + "left": "275px",
  21 + "borderRadius": "100px",
  22 + "mode": "scaleToFill",
  23 + "borderWidth": "2px",
  24 + "borderColor": "#fff",
  25 + }
  26 + },
  27 + { //昵称
  28 + "type": "text",
  29 + "text": "我是店铺名",
  30 + "css": {
  31 + "width": "650px",
  32 + "color": "#fff",
  33 + "top": "136px",
  34 + // "left": "137px",
  35 + "textAlign": "center",
  36 + "fontSize": "26px",
  37 + "maxLines": "1",
  38 + }
  39 + },
  40 + { //10元任选3件
  41 + "type": "text",
  42 + "text": "10元任选3件",
  43 + "css": {
  44 + "color": "#fff",
  45 + "width": "650px",
  46 + "top": "270px",
  47 + "fontSize": "70px",
  48 + "maxLines": "1",
  49 + "textAlign": "center",
  50 + "fontWeight": "bold",
  51 + }
  52 + },
  53 + { //活动时间
  54 + "type": "text",
  55 + "text": "活动时间:2021.07.06 - 2021.07.08",
  56 + "css": {
  57 + "color": "#333",
  58 + "width": "650px",
  59 + "top": "440px",
  60 + "fontSize": "26px",
  61 + "fontWeight": "normal",
  62 + "maxLines": "1",
  63 + "textAlign": "center"
  64 + }
  65 + },
  66 + { // 码
  67 + "type": "image",
  68 + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
  69 + "css": {
  70 + "color": "#000",
  71 + "width": "200px",
  72 + "height": "200px",
  73 + "top": "525px",
  74 + "left": "225px",
  75 + }
  76 + },
  77 + { // 扫码提示
  78 + "type": "text",
  79 + "text": "长按扫码即可参与活动",
  80 + "css": {
  81 + "color": "#666",
  82 + "width": "650px",
  83 + "top": "750px",
  84 + "fontSize": "26px",
  85 + "textAlign": "center"
  86 + }
  87 + },
  88 + ]
85 89 };
86 90  
87 91  
88 92 Page({
89 93  
90   - /**
91   - * 页面的初始数据
92   - */
93   - data: {
94   - showRule: false,
95   - showMask: false,
96   - showNum: false,
97   - haveAdded: false,
98   - imgDraw: imgDraw,
99   - },
100   -
101   - /**
102   - * 生命周期函数--监听页面加载
103   - */
104   - onLoad: function (options) {
105   - self = this;
106   - },
107   -
108   - /**
109   - * 生命周期函数--监听页面初次渲染完成
110   - */
111   - onReady: function () {
112   -
113   - },
114   -
115   - /**
116   - * 生命周期函数--监听页面显示
117   - */
118   - onShow: function () {
119   -
120   - },
121   -
122   - /**
123   - * 生命周期函数--监听页面隐藏
124   - */
125   - onHide: function () {
126   -
127   - },
128   -
129   - /**
130   - * 生命周期函数--监听页面卸载
131   - */
132   - onUnload: function () {
133   -
134   - },
135   -
136   - /**
137   - * 页面相关事件处理函数--监听用户下拉动作
138   - */
139   - onPullDownRefresh: function () {
140   -
141   - },
142   -
143   - /**
144   - * 页面上拉触底事件的处理函数
145   - */
146   - onReachBottom: function () {
147   -
148   - },
149   -
150   - /**
151   - * 用户点击右上角分享
152   - */
153   - onShareAppMessage: function () {
154   -
155   - },
156   -
157   - /**
158   - * 点击规则详情,弹出规则
159   - */
160   - showRule() {
161   - this.setData({
162   - type: 0, //控制显示规则详情还是提示信息,0规则详情,1提示信息
163   - showRule: true,
164   - showMask: true,
165   - });
166   - },
167   -
168   - /**
169   - * 点击关闭按钮关闭规则详情弹窗
170   - */
171   - closeRule() {
172   - this.setData({
173   - showRule: false,
174   - showMask: false,
175   - });
176   - },
177   -
178   - /**
179   - * 点击提示信息
180   - */
181   - showInfo() {
182   - this.setData({
183   - type: 1,
184   - showRule: true,
185   - showMask: true,
186   - });
187   - },
188   -
189   - /**
190   - * 加入购物车
191   - */
192   - addToCart() {
193   - let haveAdded = !this.data.haveAdded;
194   - let title = '';
195   - if(haveAdded) {
196   - title = '加入购物车成功';
197   - this.setData({
198   - num: 1,
199   - showNum: true,
200   - haveAdded,
201   - });
202   - wx.showToast({
203   - title: title,
204   - icon: 'success',
205   - });
206   - } else {
207   - wx.showModal({
208   - title: '温馨提示',
209   - content: '确定将该商品移出购物车?',
210   - success (res) {
211   - if (res.confirm) {
212   - console.log('用户点击确定');
213   - title = '移除购物车成功';
214   - self.setData({
215   - showNum: false,
216   - haveAdded: false,
217   - });
218   - wx.showToast({
219   - title: title,
220   - icon: 'success',
221   - });
222   - } else if (res.cancel) {
223   - console.log('用户点击取消')
224   - self.setData({
225   - haveAdded: true,
226   - });
227   - }
228   - }
229   - })
230   -
231   - }
232   -
233   - },
234   -
235   - /**
236   - * 增加数量
237   - */
238   - add() {
239   - this.setData({
240   - num: ++this.data.num,
241   - });
242   - },
243   -
244   - /**
245   - * 减少数量
246   - */
247   - sub() {
248   - let num = this.data.num;
249   - if(num >= 2) {
250   - this.setData({
251   - num: --this.data.num,
252   - });
253   - };
254   - if(num == 1) {
255   - // this.setData({
256   - // showNum: false,
257   - // haveAdded: false,
258   - // });
259   - wx.showModal({
260   - title: '温馨提示',
261   - content: '确定将该商品移出购物车?',
262   - success (res) {
263   - if (res.confirm) {
264   - console.log('用户点击确定');
265   - // title = '移除购物车成功';
266   - self.setData({
267   - showNum: false,
268   - haveAdded: false,
269   - });
270   - wx.showToast({
271   - title: '移除购物车成功',
272   - icon: 'success',
273   - });
274   - } else if (res.cancel) {
275   - console.log('用户点击取消')
276   - self.setData({
277   - haveAdded: true,
278   - });
279   - }
280   - }
281   - })
282   - }
283   - },
284   -
285   - /**
286   - * 分享
287   - */
288   - share() {
289   - this.setData({
290   - showMask: true,
291   - showPoster: true,
292   - });
293   - },
294   -
295   - /**
296   - * 关闭海报
297   - */
298   - closePoster() {
299   - this.setData({
300   - showMask: false,
301   - showPoster: false,
302   - });
303   - },
304   -
305   - onImgOK(e) {
306   - console.log(e.detail.path);
307   - this.setData({
308   - myimg: e.detail.path,
309   - });
310   - },
  94 + /**
  95 + * 页面的初始数据
  96 + */
  97 + data: {
  98 + iurl: os.imghost,
  99 + showRule: false,
  100 + showMask: false,
  101 + showNum: false,
  102 + haveAdded: false,
  103 + //imgDraw: imgDraw, 分享内容
  104 + id: 0, //获得活动id
  105 + page: 1, //第一页
  106 + no_more: 0, //没有更多
  107 + loading: 0, //加载中
  108 + list: [], //商品列表的显示
  109 + act: null, //组合活动
  110 + all_price: 0, //合计价格
  111 + all_num: 0, //全部数量
  112 + sele_pick_id: 0, //默认选择门店,当用户什么商品都没有选,sele_pick_id=0
  113 + def_store: null, //用户默认的门店
  114 + sele_store: 0, //是不是选择了门店
  115 + more_store: 0, //选择门店
  116 + sort_store: 0, //门店分类
  117 + choice_sort_store: 0, //选择分类门店
  118 + fir_pick_index: 0, //门店选择的下标
  119 + sec_pick_index: 0 //门店选择的下标,地区选择之后的内页
  120 + },
  121 +
  122 + /**
  123 + * 生命周期函数--监听页面加载
  124 + */
  125 + onLoad: function (options) {
  126 + self = this;
  127 + this.data.id = options.id;
  128 +
  129 + //获取活动信息
  130 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + options.id;
  131 + getApp().request.get(url, {
  132 + success: function (e) {
  133 + if (e.data.code == 0 && e.data.data) {
  134 + self.setData({act: e.data.data});
  135 + if (e.data.data.is_end == 0) {
  136 + //-- 获取商品列表 --
  137 + self.get_list();
  138 + self.countDown();
  139 + }
  140 + } else {
  141 + wx.showToast({
  142 + title: e.data.msg,
  143 + icon: 'none',
  144 + duration: 2000
  145 + })
  146 + }
  147 + }
  148 + });
  149 + },
  150 +
  151 + /**
  152 + * 生命周期函数--监听页面显示
  153 + */
  154 + onShow: function () {
  155 + var th = this, that = this, ee = this;
  156 + this.data.is_timer = 1;
  157 + if (this.data.act) this.countDown();
  158 + //如果有会员的时候
  159 + var userInfo = getApp().globalData.userInfo;
  160 + if (userInfo) {
  161 + //等待活动值
  162 + this.waitfor(10, th.data.act, function () {
  163 + //获取头像的分享
  164 + th.get_head_temp(function () {
  165 + var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件";
  166 + imgDraw.views[0].url = th.data.share_head;
  167 + imgDraw.views[1].text = userInfo.nickname;
  168 + imgDraw.views[2].text = txt;
  169 +
  170 + var start = ut.formar_no_full(th.data.act.start_time, '.');
  171 + var end = ut.formar_no_full(th.data.act.end_time, '.');
  172 + txt = "活动时间:" + start + " - " + end;
  173 + imgDraw.views[3].text = txt;
  174 +
  175 + var scene = th.data.gid + "";
  176 + var user_id = getApp().globalData.user_id;
  177 + scene += "_" + user_id;
  178 + ///二微码
  179 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  180 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  181 + wx.getImageInfo({
  182 + src: path3,
  183 + success: function (res) {
  184 + var vpath = res.path;
  185 + imgDraw.views[4].url = vpath;
  186 + th.setData({imgDraw: imgDraw})
  187 + }
  188 + })
  189 + })
  190 + })
  191 + //获取用户的默认门店
  192 + getApp().get_user_store(function (e) {
  193 + if (!e) {
  194 + th.data.fir_def_store = {}; //赋值空对象
  195 + return false;
  196 + }
  197 + var ee = JSON.parse(JSON.stringify(e));
  198 + var appd = getApp().globalData;
  199 + //-- 等待定位系统的开启 --
  200 + th.waitfor(15, th.data.is_get_local_ok, function () {
  201 + var e = JSON.parse(JSON.stringify(ee));
  202 + //如果有开启近距离的话,同时距离优不一样了
  203 + if (that.data.lat != null) {
  204 + //如果经纬度有变化的话
  205 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  206 + that.set_def_storage(e);
  207 + } else {
  208 + //要用接口是获取距离,js的计算不准
  209 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  210 + data: {
  211 + store_id: os.stoid,
  212 + pickup_id: e.pickup_id,
  213 + lat: th.data.lat,
  214 + lon: th.data.lon
  215 + },
  216 + }).then(res => {
  217 + if (res.data.code == 0) {
  218 + e = res.data.data.pageData[0];
  219 + if (e) {
  220 + e.is_no_dis = ee.is_no_dis;
  221 + appd.pk_store = e;
  222 + that.set_def_storage(e);
  223 + }
  224 +
  225 + }
  226 + })
  227 + }
  228 + appd.lat = that.data.lat;
  229 + appd.lon = that.data.lon;
  230 + } else {
  231 + if (e) {
  232 + e.distance = null;
  233 + that.set_def_storage(e);
  234 + }
  235 + }
  236 + })
  237 + });
  238 + }
  239 +
  240 + //----获取系统参数-----
  241 + getApp().getConfig2(function (e) {
  242 + ee.setData({
  243 + bconfig: e,
  244 + sales_rules: e.sales_rules,
  245 + });
  246 + //设置基本参数
  247 + th.wait_for_store_config(e);
  248 +
  249 + var json_d = JSON.parse(e.switch_list);
  250 + ee.setData({
  251 + store_config: e,
  252 + sys_switch: json_d,
  253 + is_closecoupon: json_d.is_closecoupon,
  254 + is_newsales_rules: json_d.is_newsales_rules,
  255 + is_open_offline: json_d.is_pricing_open,
  256 + sales_rules: e.sales_rules
  257 + });
  258 +
  259 + //-- 计算等级价相关 --
  260 + var swithc_list = e.switch_list;
  261 + var sw_arr = JSON.parse(swithc_list);
  262 + //---如果后台又开等级卡的开关---
  263 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  264 + th.setData({rank_switch: true});
  265 + //---回调卡的列表---
  266 + th.getPlusCardType(function (ob) {
  267 + th.setData({card_list: ob.card_list});
  268 + var user = getApp().globalData.userInfo;
  269 + if (!user) return false;
  270 + if (user.card_field && user['card_expiredate']) {
  271 + var str = user['card_expiredate'].replace(/-/g, '/');
  272 + var end = new Date(str);
  273 + end = Date.parse(end) / 1000;
  274 + var now = ut.gettimestamp();
  275 + //--- 判断是等级会员,且在有效期范围内 ---
  276 + if (user.card_field && now < end) {
  277 + var card_name = ob.name_map.get(user.card_field);
  278 + th.setData({
  279 + card_field: user.card_field,
  280 + card_name: card_name,
  281 + card_list: ob.card_list
  282 + });
  283 + }
  284 + }
  285 +
  286 + })
  287 + }
  288 + }, 1);
  289 +
  290 + },
  291 +
  292 + onHide: function () {
  293 + this.data.is_timer = 0;
  294 + },
  295 +
  296 + //-- 调用接口的LIST,获取商品 --
  297 + get_list: function () {
  298 + var th = this;
  299 + if (this.data.loading) return false;
  300 + if (this.data.no_more) return false;
  301 + this.data.loading = 1;
  302 + var url = "/api/weshop/prom/zhbuyGoods/page";
  303 + var req_data = {
  304 + page: this.data.page,
  305 + pageSize: 10,
  306 + store_id: os.stoid,
  307 + zh_id: this.data.id
  308 + }
  309 + //开始调用接口
  310 + getApp().request.get(url, {
  311 + data: req_data,
  312 + success: function (res) {
  313 + th.data.loading = 0;
  314 + th.setData({is_get: 1})
  315 + if (ut.ajax_ok(res)) {
  316 + th.data.page++;
  317 + var list = th.data.list;
  318 + for (var i in res.data.data.pageData) {
  319 + list.push(res.data.data.pageData[i]);
  320 + }
  321 + th.setData({list: list});
  322 + if (res.data.data.total <= 10) {
  323 + th.setData({no_more: 1});
  324 + }
  325 + } else {
  326 + th.setData({no_more: 1});
  327 + }
  328 + }
  329 + })
  330 + },
  331 +
  332 + //-- 滚动到底部触发 --
  333 + get_more_list: function () {
  334 + this.get_list();
  335 + },
  336 +
  337 + /**
  338 + * 用户点击右上角分享
  339 + */
  340 + onShareAppMessage: function () {
  341 + },
  342 +
  343 + /**
  344 + * 点击规则详情,弹出规则
  345 + */
  346 + showRule() {
  347 + this.setData({
  348 + type: 0, //控制显示规则详情还是提示信息,0规则详情,1提示信息
  349 + showRule: true,
  350 + showMask: true,
  351 + });
  352 + },
  353 +
  354 + /**
  355 + * 点击关闭按钮关闭规则详情弹窗
  356 + */
  357 + closeRule() {
  358 + this.setData({
  359 + showRule: false,
  360 + showMask: false,
  361 + });
  362 + },
  363 +
  364 + /**
  365 + * 点击提示信息
  366 + */
  367 + showInfo() {
  368 + this.setData({
  369 + type: 1,
  370 + showRule: true,
  371 + showMask: true,
  372 + });
  373 + },
  374 +
  375 + /**
  376 + * 加入购物车
  377 + */
  378 + addToCart(e) {
  379 + var th = this;
  380 + var index = e.currentTarget.dataset.index;
  381 + var userInfo = getApp().globalData.userInfo;
  382 + if (!userInfo) {
  383 + getApp().goto("/pages/togoin/togoin");
  384 + return false;
  385 + }
  386 + let haveAdded = this.data.list[index].haveAdded;
  387 + this.data.sele_index = index;
  388 + let title = '';
  389 + self = this;
  390 +
  391 + //说明是加入购物车是时候
  392 + this.data.is_zuhe_addcart = 1;
  393 + if (!haveAdded) {
  394 + th.data.sele_g = this.data.list[index];
  395 + if (!th.data.sele_g.num) th.data.goodsInputNum = 1;
  396 +
  397 + //如果没有门店,活动商品的配送方式和门店的配送方式不一样
  398 + if (!th.data.def_pick_store ||
  399 + (th.data.sele_g.distr_type != 0 && th.data.def_pick_store.distr_type != 0 && th.data.sele_g.distr_type != th.data.def_pick_store.distr_type)) {
  400 + //选择了门店
  401 + if (th.data.sele_store) {
  402 + wx.showToast({
  403 + title: "该商品的物流配送方式和默认门店不匹配!",
  404 + icon: 'none',
  405 + duration: 2000
  406 + })
  407 + } else {
  408 + wx.showModal({
  409 + title: '温馨提示',
  410 + content: '该商品的物流配送方式和默认门店不匹配,是否要切换门店?',
  411 + success (res) {
  412 + if (res.confirm) {
  413 + //物流的配送方式不一样
  414 + th.get_sto();
  415 + var set_data = {
  416 + store: 1
  417 + };
  418 + if (th.data.def_pick_store) {
  419 + set_data.is_no_pipei = th.data.def_pick_store.pickup_id;
  420 + }
  421 + th.setData(set_data);
  422 + }
  423 + }
  424 + })
  425 + }
  426 + return false;
  427 + } else {
  428 + th.setData({is_no_pipei: 0});
  429 + th.add_cart_func();
  430 + }
  431 + } else {
  432 + wx.showModal({
  433 + title: '温馨提示',
  434 + content: '确定将该商品移出购物车?',
  435 + success (res) {
  436 + if (res.confirm) {
  437 + console.log('用户点击确定');
  438 + title = '移除购物车成功';
  439 + th.setData({
  440 + [txt1]: 1,
  441 + [txt2]: false,
  442 + [txt]: !haveAdded,
  443 + });
  444 + wx.showToast({
  445 + title: title,
  446 + icon: 'success',
  447 + });
  448 + } else if (res.cancel) {
  449 + console.log('用户点击取消')
  450 + self.setData({
  451 + haveAdded: true,
  452 + });
  453 + }
  454 + }
  455 + })
  456 + }
  457 +
  458 + },
  459 +
  460 + /**
  461 + * 增加数量
  462 + */
  463 + add(e) {
  464 +
  465 + var th = this;
  466 + var userInfo = getApp().globalData.userInfo;
  467 + if (!userInfo) {
  468 + getApp().goto("/pages/togoin/togoin");
  469 + return false;
  470 + }
  471 +
  472 + var index = e.currentTarget.dataset.index;
  473 + this.data.sele_g = this.data.list[index];
  474 + this.data.sele_index=index;
  475 + th.data.goodsInputNum = this.data.sele_g.num + 1;
  476 + th.add_cart_func();
  477 + },
  478 +
  479 + /**
  480 + * 减少数量
  481 + */
  482 + sub(e) {
  483 + var userInfo = getApp().globalData.userInfo;
  484 + if (!userInfo) {
  485 + getApp().goto("/pages/togoin/togoin");
  486 + return false;
  487 + }
  488 +
  489 + var th = this;
  490 + var index = e.currentTarget.dataset.index;
  491 + var item = this.data.list[index];
  492 + let num = item.num;
  493 +
  494 + if (num >= 2) {
  495 + var check_num = num - 1;
  496 + //小于起购数
  497 + if (check_num < item.zhqty) {
  498 + wx.showToast({
  499 + title: "该商品至少要购买" + item.zhqty + "件",
  500 + icon: 'none',
  501 + duration: 2000
  502 + })
  503 + return false;
  504 + }
  505 +
  506 + th.data.sele_g = item;
  507 + th.data.sele_index = index;
  508 + th.data.goodsInputNum = check_num;
  509 + th.sub_updata_cart();
  510 + return false;
  511 + }
  512 +
  513 + wx.showModal({
  514 + title: '温馨提示',
  515 + content: '确定将该商品移出购物车?',
  516 + success (res) {
  517 + if (res.confirm) {
  518 +
  519 + self.setData({
  520 + showNum: false,
  521 + haveAdded: false,
  522 + });
  523 + wx.showToast({
  524 + title: '移除购物车成功',
  525 + icon: 'success',
  526 + });
  527 + th.re_sum_price();//重新统计数量和总金额
  528 + } else if (res.cancel) {
  529 + console.log('用户点击取消')
  530 + self.setData({
  531 + haveAdded: true,
  532 + });
  533 + }
  534 + }
  535 + })
  536 + return false;
  537 +
  538 + },
  539 +
  540 + /** 分享 **/
  541 + share() {
  542 + var th = this;
  543 + var userInfo = getApp().globalData.userInfo;
  544 + if (!userInfo) {
  545 + getApp().goto("/pages/togoin/togoin");
  546 + return false;
  547 + }
  548 + wx.showLoading();
  549 + setTimeout(function () {
  550 + th.setData({
  551 + showMask: true,
  552 + showPoster: true,
  553 + });
  554 + wx.hideLoading();
  555 + }, 1000);
  556 + },
  557 +
  558 + /**
  559 + * 关闭海报
  560 + */
  561 + closePoster() {
  562 + this.setData({
  563 + showMask: false,
  564 + showPoster: false,
  565 + });
  566 + },
  567 +
  568 + onImgOK(e) {
  569 + console.log(e.detail.path);
  570 + this.setData({
  571 + myimg: e.detail.path,
  572 + });
  573 +
  574 + },
  575 +
  576 + //---小于10的格式化函数----
  577 + timeFormat(param) {
  578 + return param < 10 ? '0' + param : param;
  579 + },
  580 +
  581 + //----倒计时函数-----
  582 + countDown() {
  583 + if (!this.data.is_timer) return false;
  584 + var th = this;
  585 + // 获取当前时间,同时得到活动结束时间数组
  586 + var endTime = this.data.act.end_time;
  587 + var newTime = ut.gettimestamp();
  588 + // 对结束时间进行处理渲染到页面
  589 + var obj = null;
  590 + // 如果活动未结束,对时间进行处理
  591 + if (endTime - newTime > 0) {
  592 + var time = (endTime - newTime);
  593 + // 获取天、时、分、秒
  594 + var day = parseInt(time / (60 * 60 * 24));
  595 + var hou = parseInt(time % (60 * 60 * 24) / 3600);
  596 + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  597 + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  598 + obj = {
  599 + hou: this.timeFormat(hou),
  600 + min: this.timeFormat(min),
  601 + sec: this.timeFormat(sec)
  602 + }
  603 + if (day > 0) {
  604 + obj.day = this.timeFormat(day);
  605 + }
  606 + } else {
  607 + //活动已结束,全部设置为'00'
  608 + obj = {
  609 + day: '00',
  610 + hou: '00',
  611 + min: '00',
  612 + sec: '00'
  613 + }
  614 + th.setData({
  615 + prom_time_text: '活动已经结束:',
  616 + prom_st: 3
  617 + })
  618 + th.setData({
  619 + djs: obj
  620 + });
  621 + return false;
  622 + }
  623 +
  624 + th.setData({
  625 + djs: obj
  626 + });
  627 + setTimeout(function () {
  628 + th.countDown()
  629 + }, 1000);
  630 + },
  631 +
  632 + close_all: function () {
  633 + this.setData({
  634 + showMask: false,
  635 + showPoster: false,
  636 + showRule: false
  637 + });
  638 + },
  639 +
  640 +
  641 + //------定时等待某个值,有值才进行运算--------
  642 + waitfor: function (n, pop_value, func) {
  643 + var th = this;
  644 + if (n <= 0) {
  645 + func()
  646 + return false
  647 + }
  648 + if (pop_value) {
  649 + func();
  650 + return false;
  651 + }
  652 + setTimeout(function () {
  653 + --n;
  654 + th.waitfor(n, pop_value, func)
  655 + }, 1000);
  656 + },
  657 +
  658 + //--获取头像的本地缓存,回调写法--
  659 + get_head_temp: function (tt) {
  660 + var ee = this;
  661 + if (ee.data.share_head) {
  662 + tt();
  663 + return false;
  664 + }
  665 + //---获取分享图片的本地地址,头像和商品图片----
  666 + var path2 = getApp().globalData.userInfo.head_pic;
  667 + if (path2 == "") {
  668 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png";
  669 + tt();
  670 + } else {
  671 + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  672 + path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  673 + wx.getImageInfo({
  674 + src: path2,
  675 + success: function (res) {
  676 + //res.path是网络图片的本地地址
  677 + console.log(res);
  678 + ee.data.share_head = res.path;
  679 + tt();
  680 + },
  681 + fail: function () {
  682 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  683 + tt();
  684 + }
  685 + });
  686 + }
  687 + },
  688 +
  689 + go_url: function (e) {
  690 + var url = e.currentTarget.dataset.url;
  691 + getApp().goto(url);
  692 + },
  693 +
  694 + //-- 加入购物的函数 --
  695 + add_cart_func: function () {
  696 + if (oo.user_id == null) {
  697 + return getApp().my_warnning("还未登录!", 0, this);
  698 + }
  699 + if (!getApp().globalData.userInfo) {
  700 + return getApp().my_warnning("还未登录!", 0, this);
  701 + }
  702 +
  703 + var e = this,
  704 + th = e,
  705 + o = this.data.sele_g,
  706 + a = o.goods_id;
  707 +
  708 + //----------添加到购物车时,要判断限购数量,--------
  709 + e.get_buy_num(o, function (ee) {
  710 + //---判断商品是否超出限购---
  711 + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  712 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
  713 + wx.showModal({
  714 + title: '提示',
  715 + content: '超出商品限购'
  716 + });
  717 + return false;
  718 + }
  719 + }
  720 + //---判断商品是否超出活动限购---
  721 + if (th.data.sele_g.buyqty > 0) {
  722 + if (th.data.goodsInputNum > th.data.sele_g.buyqty) {
  723 + wx.showModal({
  724 + title: '提示',
  725 + content: '超出商品活动限购'
  726 + });
  727 + return false;
  728 + }
  729 + }
  730 +
  731 + if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
  732 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  733 + this.setData({
  734 + sto_sele_name: ""
  735 + });
  736 + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  737 +
  738 + //--------------此时操作的数据------------
  739 + var newd = {
  740 + goods_id: o.goods_id,
  741 + goods_num: th.data.goodsInputNum,
  742 + pick_id: th.data.sto_sele_id,
  743 + user_id: oo.user_id,
  744 + store_id: os.stoid,
  745 + goods_price: o.shop_price,
  746 + member_goods_price: o.shop_price,
  747 + goods_name: o.goods_name,
  748 + goods_sn: o.goods_sn,
  749 + };
  750 +
  751 + //---是不是从收藏夹出来的---
  752 + if (th.data.c_guide_id) {
  753 + newd['guide_id'] = th.data.c_guide_id;
  754 + newd['guide_type'] = 2;
  755 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;
  756 + } else {
  757 + if (getApp().globalData.guide_id) {
  758 + newd['guide_id'] = getApp().globalData.guide_id;
  759 + newd['guide_type'] = 0;
  760 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;
  761 + }
  762 + }
  763 +
  764 + //让商品带上房间号
  765 + if (th.data.sys_switch.is_skuroom_id == 1) {
  766 + if (th.data.data.goods_id == getApp().globalData.room_goods_id) {
  767 + newd.room_id = getApp().globalData.room_id;
  768 + }
  769 + } else {
  770 + if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
  771 + }
  772 +
  773 + if (o.store_count <= 0) return getApp().my_warnning("库存已为空!", 0, th);
  774 + if (o.store_count < e.data.goodsInputNum) return getApp().my_warnning("库存不足!", 0, th);
  775 + th.add_cart_next(o, newd); //加入购物车下一步
  776 +
  777 + })
  778 + },
  779 +
  780 + //---加入购物车的最后一步---
  781 + add_cart_next(o, newd){
  782 + var th = this;
  783 + //如果会员有等级价
  784 + if (th.data.card_field) {
  785 + var card_price = o[th.data.card_field];
  786 + if (card_price > 0) {
  787 + newd.goods_price = card_price;
  788 + newd.member_goods_price = card_price;
  789 + }
  790 + }
  791 +
  792 + var index = this.data.sele_index;
  793 + var txt = "list[" + index + "].haveAdded";
  794 + var txt1 = "list[" + index + "].num";
  795 + var txt2 = "list[" + index + "].showNum";
  796 + var txt3 = "list[" + index + "].current_price";
  797 +
  798 +
  799 + newd.prom_type = 7;
  800 + newd.prom_id = th.data.act.id;
  801 +
  802 + if (th.data.adding) return false;
  803 + th.data.adding = 1;
  804 + //-------如果购物车中有相关的数据---------
  805 + if (th.data.goodsInputNum > 1) {
  806 + var item = th.data.sele_g;
  807 + if (th.data.goodsInputNum > o.store_count) {
  808 + th.data.adding = 0;
  809 + return getApp().my_warnning("库存不足!", 0, th);
  810 + }
  811 + if (th.data.goodsInputNum > o.buyqty) {
  812 + th.data.adding = 0;
  813 + return getApp().my_warnning("超出商品活动限购!", 0, th);
  814 + }
  815 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited
  816 + && th.data.sele_g.viplimited > 0
  817 + ) {
  818 + th.data.adding = 0;
  819 + return getApp().my_warnning("超出商品限购!", 0, th);
  820 + }
  821 +
  822 + //如果商品没有其他活动,要取一下线下价格
  823 + var updata = {
  824 + id: item.cart_id,
  825 + goods_num: th.data.goodsInputNum,
  826 + goods_price: newd.goods_price,
  827 + member_goods_price: newd.goods_price,
  828 + store_id: os.stoid,
  829 + };
  830 +
  831 + //---是不是从收藏夹出来的---
  832 + if (th.data.c_guide_id) {
  833 + updata['guide_id'] = th.data.c_guide_id;
  834 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  835 + } else {
  836 + if (getApp().globalData.guide_id) {
  837 + updata['guide_id'] = getApp().globalData.guide_id;
  838 + updata['guide_type'] = 0;
  839 + }
  840 + }
  841 + getApp().request.put("/api/weshop/cart/update", {
  842 + data: updata,
  843 + success: function (t) {
  844 + th.setData({
  845 + [txt1]: updata.goods_num,
  846 + [txt2]: true,
  847 + [txt]: true,
  848 + [txt3]: newd.goods_price,
  849 + });
  850 + th.data.adding = 0;
  851 + th.data.sele_store = 1;
  852 + th.re_sum_price();//重新统计数量和总金额
  853 + }
  854 + });
  855 +
  856 +
  857 + } else {
  858 +
  859 + getApp().request.post("/api/weshop/cart/save", {
  860 + data: newd,
  861 + success: function (t) {
  862 + if (t.data.code == 0) {
  863 + var txt4 = "list[" + th.data.sele_index + "].cart_id";
  864 + th.setData({
  865 + [txt1]: newd.goods_num,
  866 + [txt2]: true,
  867 + [txt3]: newd.goods_price,
  868 + [txt]: true,
  869 + [txt4]: t.data.data.id,
  870 + });
  871 +
  872 + th.data.adding = 0;
  873 + th.data.sele_store = 1;
  874 + th.re_sum_price();//重新统计数量和总金额
  875 + }
  876 + }
  877 + });
  878 + }
  879 + },
  880 +
  881 + //等待获取配置
  882 + wait_for_store_config: function (bconfig) {
  883 + var th = this;
  884 + var e = bconfig;
  885 + if (e && e.is_sort_storage) {
  886 + wx.getLocation({
  887 + type: 'gcj02',
  888 + success: function (res) {
  889 + th.data.lat = res.latitude;
  890 + th.data.lon = res.longitude;
  891 + th.data.is_get_local_ok = 1;
  892 + },
  893 + fail: function (res) {
  894 + if (res.errCode == 2) {
  895 + th.setData({
  896 + is_gps: 0
  897 + });
  898 + if (th.data.is_gps == 0) {
  899 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  900 + }
  901 +
  902 + } else {
  903 + th.setData({
  904 + is_gps: "3"
  905 + });
  906 + }
  907 +
  908 + th.data.is_get_local_ok = 1;
  909 + }
  910 + })
  911 + } else {
  912 + th.data.is_get_local_ok = 1;
  913 + }
  914 + },
  915 +
  916 + //--- 获取卡类列表 ---
  917 + getPlusCardType: function (func) {
  918 + var storid = os.stoid;
  919 + var user = getApp().globalData.userInfo;
  920 + if (!user) return false;
  921 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  922 + var plusCard = res.data.data;
  923 + var arr = [1219, 2089, 3031];
  924 + var new_arr = new Array();
  925 + var card_name_map = new Map();
  926 +
  927 + var list = [];
  928 + for (var i = 0; i < plusCard.length; i++) {
  929 + if ((!user || user.card_field == null || user.card_field == "") && plusCard[i].IsStopBuy == true) continue;
  930 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  931 + card_name_map.set(name, plusCard[i].CardName);
  932 + list.push(plusCard[i]);
  933 + }
  934 +
  935 + var ob = {"card_list": list, "name_map": card_name_map};
  936 + func(ob);
  937 + })
  938 + },
  939 +
  940 +
  941 + //--- 设置一下默认库存的数量 ----
  942 + set_def_storage(ee){
  943 + var that = this;
  944 + that.data.fir_def_store = ee;
  945 + that.setData({
  946 + def_pick_store: ee,
  947 + sto_sele_name: ee.pickup_name,
  948 + sto_sele_id: ee.pickup_id,
  949 + sto_sele_distr: ee.distr_type
  950 + })
  951 + },
  952 +
  953 + //---------拿出门店分类和门店------------
  954 + get_sto(e) {
  955 + var th = this;
  956 + this.waitfor(15, th.data.is_get_local_ok, function () {
  957 + if (!th.data.sele_g) return false;
  958 + var dd = null;
  959 + var g_distr_type = th.data.sele_g.distr_type;
  960 + if (g_distr_type != 0) {
  961 + dd = {
  962 + store_id: os.stoid,
  963 + distr_type: g_distr_type,
  964 + isstop: 0,
  965 + pageSize: 2000
  966 + }
  967 + } else {
  968 + dd = {
  969 + store_id: o.stoid,
  970 + isstop: 0,
  971 + pageSize: 2000
  972 + }
  973 + }
  974 +
  975 + //如果有距离的话
  976 + if (th.data.lat != null) {
  977 + dd.lat = th.data.lat;
  978 + dd.lon = th.data.lon;
  979 + }
  980 +
  981 + //如果会员是有默认的门店话
  982 + if (!th.data.def_pick_store && th.data.fir_def_store) {
  983 + th.setData({def_pick_store: th.data.fir_def_store});
  984 + }
  985 +
  986 + wx.showLoading({
  987 + title: '加载中.'
  988 + });
  989 + //----------获取门店----------------
  990 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  991 + data: dd,
  992 + }).then(res => {
  993 + var e = res;
  994 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  995 +
  996 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  997 + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  998 + th.setData({
  999 + def_pick_store: e.data.data.pageData[0],
  1000 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1001 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1002 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1003 + });
  1004 + th.data.fir_def_store = e.data.data.pageData[0];
  1005 + }
  1006 +
  1007 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  1008 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  1009 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  1010 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  1011 + e.data.data.pageData.splice(k, 1); //删除
  1012 + break;
  1013 + }
  1014 + }
  1015 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  1016 + }
  1017 +
  1018 + th.setData({all_pick_list: e.data.data.pageData});
  1019 + th.deal_pickup(e);
  1020 +
  1021 +
  1022 + }
  1023 + })
  1024 + })
  1025 + },
  1026 + //------------处理门店---------------
  1027 + deal_pickup(e){
  1028 + var th = this;
  1029 + wx.hideLoading();
  1030 + //单总量超出5个的时候
  1031 + if (e.data.data.total > 5) {
  1032 + getApp().request.get("/api/weshop/storagecategory/page", {
  1033 + data: {
  1034 + store_id: os.stoid,
  1035 + is_show: 1,
  1036 + pageSize: 1000,
  1037 + orderField: "sort",
  1038 + orderType: 'asc',
  1039 + },
  1040 + success: function (ee) {
  1041 + if (ee.data.code == 0) {
  1042 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  1043 + var def_arr = new Array();
  1044 + //-- 开始就看5个门店 --
  1045 + for (var k = 0; k < 5; k++) {
  1046 + if (k == e.data.data.pageData.length) break;
  1047 + def_arr.push(e.data.data.pageData[k]);
  1048 + }
  1049 +
  1050 + th.setData({
  1051 + def_pickpu_list: def_arr,
  1052 + pickpu_list: ee.data.data.pageData
  1053 + });
  1054 + var sto_cate = ee.data.data.pageData;
  1055 + var sto_arr = e.data.data.pageData;
  1056 + var newarr = new Array();
  1057 + var qita = new Array();
  1058 +
  1059 + //----要进行门店分组--------
  1060 + for (var i = 0; i < sto_arr.length; i++) {
  1061 + //找一下这个门店有没有在分类数组内
  1062 + var find2 = 0, find2name = "", sort = 0;
  1063 + for (var m = 0; m < sto_cate.length; m++) {
  1064 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  1065 + find2 = sto_cate[m].cat_id;
  1066 + find2name = sto_cate[m].cat_name;
  1067 + sort = sto_cate[m].sort;
  1068 + break;
  1069 + }
  1070 + }
  1071 +
  1072 + if (newarr.length > 0) {
  1073 + var find = 0;
  1074 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1075 + if (find2 != 0) {
  1076 + for (var ii = 0; ii < newarr.length; ii++) {
  1077 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  1078 + newarr[ii].s_arr.push(sto_arr[i]);
  1079 + find = 1;
  1080 + break;
  1081 + }
  1082 + }
  1083 + if (find == 0) {
  1084 + var arr0 = new Array();
  1085 + arr0.push(sto_arr[i]);
  1086 + var item = {
  1087 + cat_id: find2,
  1088 + name: find2name,
  1089 + sort: sort,
  1090 + s_arr: arr0
  1091 + };
  1092 + newarr.push(item);
  1093 + }
  1094 + } else {
  1095 + qita.push(sto_arr[i]);
  1096 + }
  1097 + } else {
  1098 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1099 + if (find2 != 0) {
  1100 + var arr0 = new Array();
  1101 + arr0.push(sto_arr[i]);
  1102 + var item = {
  1103 + cat_id: find2,
  1104 + name: find2name,
  1105 + sort: sort,
  1106 + s_arr: arr0
  1107 + };
  1108 + newarr.push(item);
  1109 + } else {
  1110 + qita.push(sto_arr[i]);
  1111 + }
  1112 + }
  1113 + }
  1114 +
  1115 + //门店分类要排序下
  1116 + function compare(property) {
  1117 + return function (a, b) {
  1118 + var value1 = a[property];
  1119 + var value2 = b[property];
  1120 + return value1 - value2;
  1121 + }
  1122 + }
  1123 +
  1124 + if (newarr.length > 0)
  1125 + newarr.sort(compare("sort"));
  1126 + //----安排其他的分类-----
  1127 + if (qita.length > 0) {
  1128 + var item = {
  1129 + cat_id: -1,
  1130 + name: "其他",
  1131 + s_arr: qita
  1132 + };
  1133 + newarr.push(item);
  1134 + }
  1135 + th.setData({
  1136 + is_show_sto_cat: 1,
  1137 + all_sto: newarr
  1138 + });
  1139 +
  1140 + } else {
  1141 + th.setData({
  1142 + is_show_sto_cat: -1,
  1143 + only_pk: e.data.data.pageData
  1144 + });
  1145 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1146 + if (!th.data.def_pick_store) {
  1147 + th.setData({def_pick_store: e.data.data.pageData[0]})
  1148 + }
  1149 + }
  1150 + } else {
  1151 + th.setData({
  1152 + is_show_sto_cat: -1,
  1153 + only_pk: e.data.data.pageData
  1154 + });
  1155 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1156 + if (!th.data.def_pick_store) {
  1157 + th.setData({def_pick_store: e.data.data.pageData[0]})
  1158 + }
  1159 + }
  1160 + }
  1161 + });
  1162 + } else {
  1163 + th.setData({
  1164 + is_show_sto_cat: 0,
  1165 + only_pk: e.data.data.pageData
  1166 + });
  1167 + //-----如果没有默认门店,要取第一个门店作为默认店------
  1168 + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  1169 + if (e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  1170 + th.setData({
  1171 + def_pick_store: e.data.data.pageData[0],
  1172 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1173 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1174 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1175 + })
  1176 + }
  1177 + }
  1178 + }
  1179 + },
  1180 +
  1181 + //---选择分类门店---
  1182 + choice_sort_store: function (e) {
  1183 + var index = e.currentTarget.dataset.index;
  1184 + var region_name = e.currentTarget.dataset.region;
  1185 + var item = this.data.all_sto[index];
  1186 + this.setData({
  1187 + region_name: region_name,
  1188 + sort_store: 0,
  1189 + choice_sort_store: 1,
  1190 + sec_sto: item,
  1191 + sec_pick_index: 0
  1192 + });
  1193 + },
  1194 +
  1195 + choose_for_store_fir: function (e) {
  1196 + var index_c = e.currentTarget.dataset.ind;
  1197 + var th = this;
  1198 + th.setData({
  1199 + fir_pick_index: index_c
  1200 + })
  1201 + },
  1202 +
  1203 + //确定def_pick为选择的门店
  1204 + sure_pick: function (e) {
  1205 + var th = this;
  1206 + var item = null;
  1207 + var openindstore = th.data.open_ind_store;
  1208 +
  1209 + if (th.data.choice_sort_store == 0) {
  1210 + var index = th.data.fir_pick_index;
  1211 + if (th.data.is_show_sto_cat == 1) {
  1212 + item = th.data.def_pickpu_list[index];
  1213 + } else {
  1214 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1215 + }
  1216 +
  1217 + } else {
  1218 + var index = th.data.sec_pick_index;
  1219 + item = th.data.sec_sto.s_arr[index];
  1220 + }
  1221 +
  1222 + if (!th.data.sele_g) return false;
  1223 + //判断门店的配送方式是不是匹配
  1224 + var g_distr_type = th.data.sele_g.distr_type;
  1225 + if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
  1226 + wx.showToast({
  1227 + title: "门店配送方式不匹配",
  1228 + icon: 'none',
  1229 + duration: 2000
  1230 + });
  1231 + return false;
  1232 + }
  1233 +
  1234 + th.setData({
  1235 + def_pick_store: item,
  1236 + sto_sele_name: item.pickup_name,
  1237 + sto_sele_id: item.pickup_id,
  1238 + sto_sele_distr: item.distr_type,
  1239 + store: 0,
  1240 + choice_sort_store: 0,
  1241 + fir_pick_index: 0,
  1242 + sort_store: 0
  1243 + });
  1244 +
  1245 + //只是单纯的选择门店
  1246 + if (this.data.only) {
  1247 + this.data.only = 0;
  1248 + return false;
  1249 + }
  1250 + th.check_is_in_cart(function () {
  1251 + th.add_cart_func();
  1252 + })
  1253 + },
  1254 +
  1255 +
  1256 + //---点击二级之后的选择---
  1257 + choose_for_store: function (e) {
  1258 + var index_c = e.currentTarget.dataset.ind;
  1259 + var th = this;
  1260 + th.setData({
  1261 + sec_pick_index: index_c,
  1262 + fir_pick_index: index_c
  1263 + })
  1264 +
  1265 + },
  1266 + //把选择的门店设置成默认的门店def_pick
  1267 + set_def_pick: function (e) {
  1268 + var th = this;
  1269 + var item = null;
  1270 + if (th.data.choice_sort_store == 0) {
  1271 + var index = th.data.fir_pick_index;
  1272 + if (th.data.is_show_sto_cat == 1) {
  1273 + item = th.data.def_pickpu_list[index];
  1274 + } else {
  1275 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1276 + }
  1277 + } else {
  1278 + var index = th.data.sec_pick_index;
  1279 + item = th.data.sec_sto.s_arr[index];
  1280 + }
  1281 +
  1282 + //判断门店的配送方式是不是匹配
  1283 + var g_distr_type = th.data.sele_g.distr_type;
  1284 + if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
  1285 + wx.showToast({
  1286 + title: "门店配送方式不匹配",
  1287 + icon: 'none',
  1288 + duration: 2000
  1289 + });
  1290 + return false;
  1291 + }
  1292 +
  1293 + //先设置之前,要判断是不是有库存
  1294 + var user_id = getApp().globalData.user_id;
  1295 + var def_pickup_id = item.pickup_id;
  1296 +
  1297 + getApp().request.put('/api/weshop/users/update', {
  1298 + data: {
  1299 + user_id: user_id,
  1300 + def_pickup_id: def_pickup_id
  1301 + },
  1302 + success: function (res) {
  1303 + if (res.data.code == 0) {
  1304 + if (th.data.choice_sort_store == 0) th.setData({
  1305 + fir_pick_index: 0
  1306 + });
  1307 + getApp().globalData.pk_store = item;
  1308 + } else {
  1309 + //s.showWarning("设置默认门店地址失败", null, 500, !1);
  1310 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  1311 + }
  1312 +
  1313 + }
  1314 + });
  1315 +
  1316 + th.setData({
  1317 + def_pick_store: item,
  1318 + sto_sele_name: item.pickup_name,
  1319 + sto_sele_id: item.pickup_id,
  1320 + sto_sele_distr: item.distr_type,
  1321 + store: 0,
  1322 + choice_sort_store: 0,
  1323 + sort_store: 0, //关闭门店2级
  1324 + });
  1325 +
  1326 + th.add_cart_func();
  1327 + },
  1328 +
  1329 + // 返回按钮
  1330 + returns: function () {
  1331 + this.setData({
  1332 + sort_store: 0,
  1333 + choice_sort_store: 0
  1334 + });
  1335 + },
  1336 + //选择更多门店
  1337 + more_store: function () {
  1338 + this.setData({
  1339 + sort_store: 1
  1340 + });
  1341 + },
  1342 + //关闭选择门店
  1343 + close_popup: function (e) {
  1344 + var th = this;
  1345 + this.setData({
  1346 + store: 0,
  1347 + choice_sort_store: 0,
  1348 + sort_store: 0,
  1349 + fir_pick_index: 0,
  1350 + sec_pick_index: 0
  1351 + })
  1352 + },
  1353 +
  1354 + //-------------获取购买数量的总函数----------------
  1355 + get_buy_num: function (gd, func) {
  1356 + var map = this.data.g_buy_num,
  1357 + th = this, user_id = getApp().globalData.user_id;
  1358 +
  1359 + if (user_id == null) {
  1360 + getApp().goto("/pages/togoin/togoin");
  1361 + return false;
  1362 + }
  1363 + if (map && map.has(gd.goods_id)) {
  1364 + "function" == typeof func && func();
  1365 + } else {
  1366 + //----获取商品购买数----
  1367 + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1368 + data: {
  1369 + store_id: os.stoid,
  1370 + user_id: user_id,
  1371 + goods_id: gd.goods_id
  1372 + },
  1373 + success: function (t) {
  1374 + if (t.data.code == 0) {
  1375 + var g_buy_num = t.data.data.goodsbuynum;
  1376 + if (!map) map = new Map();
  1377 + map.set(gd.goods_id, g_buy_num);
  1378 + th.setData({
  1379 + g_buy_num: map
  1380 + });
  1381 + "function" == typeof func && func();
  1382 + }
  1383 + }
  1384 + });
  1385 + }
  1386 + },
  1387 +
  1388 + //-- 当是减数量的调用 --
  1389 + sub_updata_cart(){
  1390 + var th = this;
  1391 + var index = this.data.sele_index;
  1392 + var txt = "list[" + index + "].haveAdded";
  1393 + var txt1 = "list[" + index + "].num";
  1394 + var txt2 = "list[" + index + "].showNum";
  1395 +
  1396 + var cur_price = this.data.sele_g.shop_price;
  1397 + if (th.data.card_field && this.data.sele_g[th.data.card_field]) {
  1398 + cur_price = this.data.sele_g[th.data.card_field];
  1399 + }
  1400 + var updata = {
  1401 + id: th.data.sele_g.cart_id,
  1402 + goods_num: th.data.goodsInputNum,
  1403 + goods_price: cur_price,
  1404 + store_id: os.stoid,
  1405 + };
  1406 + //---是不是从收藏夹出来的---
  1407 + if (th.data.c_guide_id) {
  1408 + updata['guide_id'] = th.data.c_guide_id;
  1409 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  1410 + } else {
  1411 + if (getApp().globalData.guide_id) {
  1412 + updata['guide_id'] = getApp().globalData.guide_id;
  1413 + updata['guide_type'] = 0;
  1414 + }
  1415 + }
  1416 + //调用接口,更新购物车
  1417 + getApp().request.put("/api/weshop/cart/update", {
  1418 + data: updata,
  1419 + success: function (t) {
  1420 + th.setData({
  1421 + [txt1]: updata.goods_num,
  1422 + [txt2]: true,
  1423 + [txt]: true,
  1424 + });
  1425 +
  1426 + th.data.adding = 0;
  1427 + th.data.sele_store = 1;
  1428 + th.re_sum_price();//重新统计数量和总金额
  1429 + }
  1430 + });
  1431 + },
  1432 + //一 开始的选择门店 --
  1433 + choose_store: function (e) {
  1434 + var userInfo = getApp().globalData.userInfo;
  1435 + if (!userInfo) {
  1436 + getApp().goto("/pages/togoin/togoin");
  1437 + return false;
  1438 + }
  1439 + this.data.only = 1;
  1440 + this.setData({
  1441 + store: 1
  1442 + })
  1443 + },
  1444 +
  1445 + // -- 加入之前,先判断有没有在购物车中,没有商品就添加 --
  1446 + check_is_in_cart: function (func) {
  1447 + var th = this;
  1448 + var index = th.data.sele_index;
  1449 + var txt = "list[" + index + "].haveAdded";
  1450 + var txt1 = "list[" + index + "].num";
  1451 + var txt2 = "list[" + index + "].showNum";
  1452 + var txt3 = "list[" + index + "].cart_id";
  1453 + var txt4 = "list[" + index + "].current_price";
  1454 +
  1455 +
  1456 +
  1457 + //----先看会员在购物车中是否加入了该商品-----
  1458 + getApp().request.get("/api/weshop/cart/page", {
  1459 + data: {
  1460 + store_id: os.stoid,
  1461 + user_id: oo.user_id,
  1462 + goods_id: th.data.sele_g.goods_id,
  1463 + pick_id: th.data.sto_sele_id,
  1464 + },
  1465 + success: function (re) {
  1466 + if (re.data.data.total > 0) {
  1467 + var item = re.data.data.pageData[0];
  1468 +
  1469 + //当前的价格要更新进去
  1470 + var cur_price = th.data.sele_g.shop_price;
  1471 + if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
  1472 + cur_price = th.data.sele_g[th.data.card_field];
  1473 + }
  1474 +
  1475 + th.setData({
  1476 + [txt1]: item.goods_num,
  1477 + [txt2]: true,
  1478 + [txt]: true,
  1479 + [txt3]: item.id,
  1480 + [txt4]: cur_price,
  1481 + });
  1482 +
  1483 + var updata = {
  1484 + id: item.id,
  1485 + prom_type: 7,
  1486 + goods_price: cur_price,
  1487 + prom_id: th.data.act.id
  1488 + };
  1489 + if (getApp().globalData.guide_id) {
  1490 + updata['guide_id'] = getApp().globalData.guide_id;
  1491 + updata['guide_type'] = 0;
  1492 + }
  1493 +
  1494 + getApp().request.put("/api/weshop/cart/update", {
  1495 + data: updata,
  1496 + success: function (t) {
  1497 + }
  1498 + });
  1499 +
  1500 + th.re_sum_price();
  1501 + } else {
  1502 + func();
  1503 + }
  1504 + }
  1505 + })
  1506 + },
  1507 +
  1508 + //-- 计算统计之后的金额 --
  1509 + re_sum_price: function () {
  1510 + var all_num = 0; //商品数量之和
  1511 + var all_price = 0;
  1512 + var need_to_buy = 0;
  1513 + var data = this.data.list;
  1514 + var all_zhqty = 0; //所有商品要求起购数之后
  1515 +
  1516 + var no_in_arr = [];
  1517 + for (var i in data) {
  1518 + var item = data[i];
  1519 + if (item.num) {
  1520 + all_num += item.num;
  1521 + all_price += item.num * item.current_price;
  1522 + //当有起购数的控制的时候
  1523 + if (item.zhqty) {
  1524 + all_zhqty += item.zhqty;
  1525 + if (item.num < item.zhqty) {
  1526 + need_to_buy += item.zhqty - item.num;
  1527 + }
  1528 + if (item.num > item.zhqty) {
  1529 + for (var i = 0; i < item.num - item.zhqty; i++) {
  1530 + no_in_arr.push({price: item.current_price})
  1531 + }
  1532 + }
  1533 + } else {
  1534 + for (var j = 0; j < item.num; j++) {
  1535 + no_in_arr.push({price: item.current_price})
  1536 + }
  1537 + }
  1538 + } else {
  1539 + if (item.zhqty) need_to_buy += item.zhqty;
  1540 + }
  1541 + }
  1542 +
  1543 + //当满足组合的要求:总数要满足,起购数要满足
  1544 + if (all_num >= this.data.act.zhbuyqty && !need_to_buy) {
  1545 + function sortData(a, b) {
  1546 + return a.price - b.price
  1547 + }
  1548 +
  1549 + no_in_arr.sort(sortData);
  1550 + var aprice = this.data.act.zhprice;
  1551 + if (this.data.act.zhbuyqty > all_zhqty) {
  1552 + for (var n = 0; n < this.data.act.zhbuyqty; n++) {
  1553 + no_in_arr.pop();
  1554 + }
  1555 + }
  1556 +
  1557 + //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
  1558 + if (this.data.act.is_bz && no_in_arr.length > this.data.act.zhbuyqty) {
  1559 + //看一下是几倍
  1560 + var be = parseInt(no_in_arr / this.data.act.zhbuyqty);
  1561 + aprice += be * aprice;
  1562 + for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {
  1563 + no_in_arr.pop();
  1564 + }
  1565 + }
  1566 +
  1567 + //算一下剩余的钱
  1568 + if (no_in_arr.length) {
  1569 + for (var ii in no_in_arr) {
  1570 + var item = no_in_arr[ii];
  1571 + aprice += item.price;
  1572 + }
  1573 + }
  1574 + all_price = aprice;
  1575 + }
  1576 +
  1577 + this.setData({
  1578 + all_price: all_price,
  1579 + need_to_buy: need_to_buy,
  1580 + all_num: all_num
  1581 + })
  1582 + },
  1583 +
  1584 + go_cart:function () {
  1585 + getApp().goto("/pages/cart/cart/cart");
  1586 + }
  1587 +
311 1588 })
312 1589 \ No newline at end of file
... ...
packageB/pages/zuhegou/index/index.json
... ... @@ -2,7 +2,8 @@
2 2 "usingComponents": {
3 3 "catch": "/components/catch/catch",
4 4 "nodata": "/components/nodata/nodata",
5   - "painter": "/packageB/components/painter/painter"
  5 + "painter": "/packageB/components/painter/painter",
  6 + "warn": "/components/long_warn/long_warn"
6 7 },
7 8 "enablePullDownRefresh": false,
8 9 "navigationBarTitleText": "组合购"
... ...
packageB/pages/zuhegou/index/index.wxml
  1 +<wxs module="filters" src="../../../../utils/filter.wxs"></wxs>
1 2 <view class="container">
2   - <view class="flex jc_sb">
3   - <view class="white">以下商品10元任选3件</view>
4   - <view class="rule-container" bindtap="showRule">规则详情<text class="iconfont icon-arrow_right"></text></view>
5   - </view>
6   - <view class="countdown-container">距结束还剩 1天<text class="num-box">12</text>:<text class="num-box">12</text>:<text class="num-box">00</text></view>
7   - <!-- 商品列表 -->
8   - <view class="list-container">
9   - <view class="list">
10   -
11   - <view class="list-item">
12   - <view class="img-container"><image src="../../../images/luckDraw/yhq.png" mode="aspectFit" class="img-block"></image></view>
13   - <view class="pdl20 flex f1 fdc jc_sb">
14   - <view>
15   - <view class="fs30 ellipsis-2">商品名称商品名称</view>
16   - <view class="num-container" wx:if="{{showNum}}">
17   - <text class="num-box c-dedfe3" bindtap="sub">-</text>
18   - <text class="num-box">{{num}}</text>
19   - <text class="num-box" bindtap="add">+</text>
20   - </view>
21   - </view>
22   -
23   - <view class="flex jc_sb ai_end pdt12">
24   - <view>
25   - <text class="rmb fs30 c-red">0.01</text>
26   - <text class="rmb fs20 line-through cb">200.00</text>
27   - </view>
28   - <view class="c-red pdr10 {{haveAdded ? 'active':''}}" bindtap="addToCart"><text class="iconfont icon-gouwuche fs60"></text></view>
29   - </view>
30   - </view>
31   - </view>
32   -
33   -
34   - <!-- <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> -->
35   - <nodata nodataContainer="t-c"></nodata>
36   - </view>
37   -
38   - <view class="noMore">没有更多了</view>
39   -
40   -
41   - </view>
42   - <!-- 底部栏 -->
43   - <view class="bar-container">
44   - <view class="t-c bg-fcfb c-fa8b2b fs28 pd20">再买2件,下单立享【10元任选3件】</view>
45   - <view class="flex jc_sb ai_c pd20">
46   - <view class="fs30">合计:<text class="rmb c-red fs40">0.01</text><text class="iconfont icon-info cb fs24 mgl10" bindtap="showInfo"></text></view>
47   - <view class="btn-container">去购物车</view>
48   - </view>
49   - </view>
50   - <!-- 分享 -->
51   - <view class="share-container" bindtap="share">
52   - <text class="iconfont icon-zhuanfa fs40"></text>
53   - <view class="fs22 c-8">分享</view>
54   - </view>
55   -
56   -
57   - <!-- 规则详情和提示信息弹窗 -->
58   - <view class="rule-pop-container" wx:if="{{showRule}}">
59   - <view class="pop-title">{{!type ? '规则详情':'提示'}}<text class="iconfont icon-guan" bindtap="closeRule"></text></view>
60   - <block wx:if="{{!type}}">
61   - <view class="pdt40">
62   - <view class="pdb20">活动时间</view>
63   - <view class="">2020.12.11 18:00:00 至 2020.12.11 18:00:00</view>
64   - </view>
65   - <view class="pdt40">
66   - <view class="pdb20">活动内容</view>
67   - <view class="">
68   - <view class="pdb10">1、活动商品范围内,任选3件仅需10元;</view>
69   - <view class="">2、此优惠可无限叠加,买得越多优惠越多;</view>
70   - </view>
71   - </view>
72   - <view class="pdt40 pdb20">
73   - <view class="pdb20">优惠叠加</view>
74   - <view class="">不可与其他优惠活动同时使用</view>
75   - </view>
76   - </block>
77   - <block wx:else>
78   - <view class="pdt40 pdb20">
79   -
80   - <!-- <view class="pdb20">优惠叠加</view> -->
81   -
82   - <view class="">合计金额及提示仅为初步预估,请以最终下单金额为准。</view>
83   - </view>
84   - </block>
85   - <view class="pdv20">
86   - <view class="btn" bindtap="closeRule">我知道了</view>
87   - </view>
88   - </view>
89   -
90   - <!-- 遮罩层 -->
91   - <view class="mask" wx:if="{{showMask}}"></view>
92   -
93   - <!-- 海报 -->
94   - <view class="poster-container" wx:if="{{showPoster}}">
95   - <view class="t-r pdb20 white2"><text class="iconfont icon-close fs40" bindtap="closePoster"></text></view>
96   - <image src="{{myimg}}" class="poster" show-menu-by-longpress></image>
97   - <view class="pdt10 fs26 white2"><text class="iconfont icon-zhiwen"></text> 长按图片保存至相册</view>
98   - </view>
99   -
100   -</view>
  3 + <view class="flex jc_sb">
  4 + <view class="white">以下商品{{act.zhprice}}元任选{{act.zhbuyqty}}件</view>
  5 + <view class="rule-container" bindtap="showRule">规则详情
  6 + <text class="iconfont icon-arrow_right"></text>
  7 + </view>
  8 + </view>
  9 + <view wx:if="{{djs}}" class="countdown-container">距结束还剩
  10 + <text wx:if="{{djs.day}}">{{djs.day}}天</text>
  11 + <text class="num-box">{{djs.hou}}</text>
  12 + :
  13 + <text class="num-box">{{djs.min}}</text>
  14 + :
  15 + <text class="num-box">{{djs.sec}}</text>
  16 + </view>
  17 +
  18 +
  19 + <view class="c_w mt20 fs32">门店:
  20 + <text wx:if="{{def_pick_store}}">{{def_pick_store.pickup_name}}</text>
  21 + <text wx:else bindtap="choose_store" >请选择门店</text>
  22 + </view>
  23 +
  24 + <!-- 商品列表 -->
  25 + <view class="list-container">
  26 + <scroll-view class="list" scroll-y bindscrolltolower="get_more_list">
  27 + <block wx:for="{{list}}">
  28 + <view class="list-item" bindtap="go_url"
  29 + data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">
  30 + <view class="img-container">
  31 + <image src="{{iurl}}{{item.original_img?item.original_img:'/miniapp/images/default_g_img.gif'}}"
  32 + mode="aspectFit" class="img-block"></image>
  33 + </view>
  34 + <view class="pdl20 flex f1 fdc jc_sb" >
  35 + <view>
  36 + <view class="fs30 ellipsis-2">{{item.goods_name}}</view>
  37 + <view class="c-fa8b2b fs28" wx:if="{{item.zhqty && (item.num<item.zhqty || !item.num)}}">此商品还需购买{{item.zhqty-(item.num?item.num:0)}}件</view>
  38 + <view class="num-container" wx:if="{{item.showNum}}">
  39 + <text class="num-box {{item.num<=1?'c-dedfe3':''}}" catchtap="sub"
  40 + data-index="{{index}}">-</text>
  41 + <text class="num-box">{{item.num}}</text>
  42 + <text class="num-box" catchtap="add" data-index="{{index}}">+</text>
  43 + </view>
  44 + </view>
  45 +
  46 + <view class="flex jc_sb ai_end pdt12">
  47 + <view>
  48 + <!-- 要判断实际价格,因为有等级卡价 -->
  49 + <block wx:if="{{card_field && item[card_field]>0}}">
  50 + <text class="rmb fs30 c-red">{{filters.toFix(item[card_field],2)}}</text>
  51 + </block>
  52 + <block wx:else>
  53 + <text class="rmb fs30 c-red">{{filters.toFix(item.shop_price,2)}}</text>
  54 + </block>
  55 + <text class="rmb fs20 line-through cb">{{filters.toFix(item.market_price,2)}}</text>
  56 + </view>
  57 + <view class="c-red pdr10 {{item.haveAdded ? 'active':''}}" catchtap="addToCart"
  58 + data-index="{{index}}">
  59 + <text class="iconfont icon-gouwuche fs60"></text>
  60 + </view>
  61 + </view>
  62 + </view>
  63 + </view>
  64 + </block>
  65 +
  66 + <nodata wx:if="{{list.length==0 && is_get}}" nodataContainer="t-c"></nodata>
  67 + <view wx:if="{{no_more}}" class="noMore">没有更多了</view>
  68 + </scroll-view>
  69 +
  70 + </view>
  71 +
  72 + <!-- 底部栏 -->
  73 + <view class="bar-container">
  74 + <block wx:if="{{all_num>=act.zhbuyqty}}">
  75 + <view wx:if="{{need_to_buy}}" class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  76 + 再买{{need_to_buy}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  77 + </view>
  78 + <view wx:else class="t-c bg-fcfb c-fa8b2b fs28 pd20">下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】</view>
  79 + </block>
  80 + <block wx:else>
  81 + <view wx:if="{{all_num>0}}" class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  82 + 再买{{act.zhbuyqty-all_num>need_to_buy?act.zhbuyqty-all_num:need_to_buy}}件,{{need_to_buy}}下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  83 + </view>
  84 + <view wx:else class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  85 + 买{{act.zhbuyqty}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  86 + </view>
  87 + </block>
  88 + <view class="flex jc_sb ai_c pd20">
  89 + <view class="fs30">合计:
  90 + <text class="rmb c-red fs40">{{filters.toFix(all_price,2)}}</text>
  91 + <text class="iconfont icon-info cb fs24 mgl10" bindtap="showInfo"></text>
  92 + </view>
  93 + <view bindtap="go_cart" class="btn-container">去购物车</view>
  94 + </view>
  95 + </view>
  96 + <!-- 分享 -->
  97 + <view wx:if="{{imgDraw}}" class="share-container" bindtap="share">
  98 + <text class="iconfont icon-zhuanfa fs40"></text>
  99 + <view class="fs22 c-8">分享</view>
  100 + </view>
  101 +
  102 +
  103 + <!-- 规则详情和提示信息弹窗 -->
  104 + <view class="rule-pop-container" wx:if="{{showRule}}">
  105 + <view class="pop-title">{{!type ? '规则详情':'提示'}}
  106 + <text class="iconfont icon-guan" bindtap="closeRule"></text>
  107 + </view>
  108 + <block wx:if="{{!type}}">
  109 + <view class="pdt40">
  110 + <view class="pdb20">活动时间</view>
  111 + <view class="">{{filters.format_time(act.start_time,1)}} 至 {{filters.format_time(act.end_time,1)}}
  112 + </view>
  113 + </view>
  114 + <view class="pdt40">
  115 + <view class="pdb20">活动内容</view>
  116 + <view class="">
  117 + <view class="pdb10">{{act.remark}}</view>
  118 + </view>
  119 + </view>
  120 + </block>
  121 +
  122 + <!-- 小的提示按钮的展示 -->
  123 + <block wx:else>
  124 + <view class="pdt40 pdb20">
  125 + <view class="">合计金额及提示仅为初步预估,请以最终下单金额为准。</view>
  126 + </view>
  127 + </block>
  128 +
  129 + <view class="pdv20">
  130 + <view class="btn" bindtap="closeRule">我知道了</view>
  131 + </view>
  132 + </view>
101 133  
102   -<painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK" />
  134 + <!-- 遮罩层 -->
  135 + <view class="mask" wx:if="{{showMask}}" bindtap="close_all"></view>
  136 + <!-- 海报 -->
  137 + <view class="poster-container" wx:if="{{showPoster}}">
  138 + <view class="t-r pdb20 white2">
  139 + <text class="iconfont icon-close fs40" bindtap="closePoster"></text>
  140 + </view>
  141 + <image src="{{myimg}}" class="poster" show-menu-by-longpress></image>
  142 + <view class="pdt10 fs26 white2">
  143 + <text class="iconfont icon-zhiwen"></text>
  144 + 长按图片保存至相册
  145 + </view>
  146 + </view>
103 147  
  148 +</view>
  149 +
  150 +<painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/>
104 151 <!-- 活动异常提醒 -->
105 152 <!-- <catch>当前活动已结束</catch> -->
  153 +<warn id="warn"></warn>
  154 +<!-- 选择门店的弹框,1.1版最新的 -->
  155 +<block wx:if="{{store==1}}">
  156 + <view class="mongolia-layer" bindtap="close_popup"></view>
  157 + <view class="popup-frame">
  158 + <block wx:if="{{sort_store==0}}">
  159 + <!-- 头部 标题 -->
  160 + <view class="popup-top flex-space-between">
  161 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  162 + <view>
  163 + <view>
  164 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  165 + </view>
  166 + <view class="flex choose_more" bindtap="more_store">
  167 + <text class="fs26 red-co" style="line-height: 30rpx;height: 30rpx" wx:if="{{is_show_sto_cat}}">{{choice_sort_store==0?'更多门店':'返回'}}</text>
  168 + <view class="bg_rights" wx:if="{{is_show_sto_cat}}"></view>
  169 + </view>
  170 + </view>
  171 + </view>
  172 + <!-- 门店列表,最外层的门店列表,一开始 -->
  173 + <view class="store-list">
  174 + <!--如果还没有点击更多门店的时候 -->
  175 + <block wx:if="{{choice_sort_store==0}}">
  176 + <!-- 需要for循环 -->
  177 + <block wx:if="{{is_show_sto_cat==1}}">
  178 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir"
  179 + data-ind="{{index}}">
  180 + <view class="store flex-vertical">
  181 + <!-- 需要点击事件 -->
  182 + <block wx:if="{{index==fir_pick_index}}">
  183 + <view class="circle white xc-hook fs20 red-b">Г</view>
  184 + </block>
  185 + <block wx:else>
  186 + <view class="circle xc-hooks"></view>
  187 + </block>
  188 + <view class="address-frame xc-ash">
  189 + <view class="flex-vertical-between butttem5">
  190 + <view class="flex xc-ash">
  191 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  192 + <text wx:if="{{item.pickup_id==is_no_pipei}}" class="c-red">(不匹配)</text>
  193 + </view>
  194 + </view>
  195 + <view>
  196 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  197 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}
  198 + </view>
  199 + </view>
  200 + </view>
  201 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  202 + </view>
  203 + </view>
  204 + </view>
  205 + </block>
  206 + <block wx:else>
  207 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir"
  208 + data-ind="{{index}}">
  209 + <view class="store flex-vertical">
  210 + <!-- 需要点击事件 -->
  211 + <block wx:if="{{index==fir_pick_index}}">
  212 + <view class="circle white xc-hook fs20 red-b">Г</view>
  213 + </block>
  214 + <block wx:else>
  215 + <view class="circle xc-hooks"></view>
  216 + </block>
  217 +
  218 + <view class="address-frame xc-ash">
  219 + <view class="flex-vertical-between ">
  220 + <view class="flex xc-ash">
  221 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  222 + <text wx:if="{{item.pickup_id==is_no_pipei}}" class="c-red">(不匹配)</text>
  223 + </view>
  224 + </view>
  225 + <view>
  226 + <view class="distance fs24 address-val"
  227 + wx:if="{{item.distance!=null}}">
  228 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  229 + </view>
  230 + </view>
  231 + </view>
  232 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  233 + </view>
  234 + </view>
  235 + </view>
  236 + </block>
  237 + </block>
  238 + <block wx:else> <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  239 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}"
  240 + bindtap="choose_for_store">
  241 + <view class="store flex-vertical">
  242 + <!-- 需要点击事件 -->
  243 + <block wx:if="{{index==sec_pick_index}}">
  244 + <view class="circle white xc-hook fs20 red-b">Г</view>
  245 + </block>
  246 + <block wx:else>
  247 + <view class="circle xc-hooks"></view>
  248 + </block>
  249 +
  250 + <view class="address-frame xc-ash">
  251 + <view class="flex-vertical-between ">
  252 + <view class="flex xc-ash">
  253 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  254 + </view>
  255 + <view>
  256 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  257 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  258 + </view>
  259 + </view>
  260 + </view>
  261 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  262 + </view>
  263 + </view>
  264 + </view>
  265 + </block>
  266 +
  267 + </view>
  268 +
  269 + <!-- 门店列表底部 -->
  270 + <view class="store-bottom-frame">
  271 + <view class="store-bottom flex-vertical-between">
  272 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick"
  273 + data-openindstore="{{open_ind_store}}">确定
  274 + </view>
  275 + <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">设为默认
  276 + </view>
  277 + </view>
  278 + </view>
  279 +
  280 + </block>
  281 +
  282 +
  283 + <block wx:else>
  284 + <view class="popup-top flex-space-between">
  285 + <text class="fs32 nearby_store">门店分类选择</text>
  286 + <view>
  287 + <view>
  288 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  289 + </view>
  290 + <view class="felx choose_mores" bindtap="returns">
  291 + <text class="fs26 red-co">返回</text>
  292 + </view>
  293 + </view>
  294 + </view>
  295 + <view class="sort_store_list">
  296 +
  297 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store"
  298 + data-region="{{item.name}}">
  299 + <view class="sort-store flex-vertical-between">
  300 + <view class="fs30" di>{{item.name}}</view>
  301 + <view class="black_rights-frame">
  302 + <view class="black_rights"></view>
  303 + </view>
  304 + </view>
  305 + </view>
  306 +
  307 + </view>
  308 + </block>
  309 + </view>
  310 +</block>
106 311  
107 312  
108 313  
... ...
packageB/pages/zuhegou/index/index.wxss
... ... @@ -3,7 +3,7 @@ page {
3 3 background: #f5f5f5 linear-gradient(to bottom, #FB5A2F, #FA7958, #f5f5f5 26%) no-repeat;
4 4 }
5 5 .container {
6   - padding: 20rpx 20rpx 240rpx 20rpx;
  6 + padding: 20rpx;
7 7 }
8 8 .countdown-container {
9 9 font-size: 26rpx;
... ... @@ -42,6 +42,7 @@ page {
42 42 .list {
43 43 border-radius: 10rpx;
44 44 background-color: white;
  45 + max-height:calc(100vh - 360rpx);
45 46 }
46 47  
47 48 .list-item {
... ... @@ -196,4 +197,161 @@ page {
196 197  
197 198 .white2 {
198 199 color: rgba(255,255,255,.8);
199   -}
200 200 \ No newline at end of file
  201 +}
  202 +
  203 +
  204 +
  205 +/* 选择门店的弹窗 */
  206 +.mongolia-layer{
  207 + position: fixed;
  208 + left: 0;
  209 + top: 0;
  210 + right: 0;
  211 + bottom: 0;
  212 + z-index: 11;
  213 + background: rgba(0,0,0,0.4);
  214 + width: 100%;
  215 + height: 91.9%;
  216 +
  217 +}
  218 +
  219 +.popup-frame{
  220 + position: fixed;
  221 + z-index: 20;
  222 + background: white;
  223 + width: 100%;
  224 + border-radius: 20rpx 20rpx 0 0;
  225 + height: auto;
  226 + bottom: 0;
  227 +}
  228 +.popup-top{
  229 + border-bottom: 1rpx solid #eee;
  230 + height: 155rpx;
  231 + width: 95%;
  232 + margin: auto;
  233 + line-height: 155rpx;
  234 +
  235 +}
  236 +.bg_rights{
  237 + border-top: 2rpx solid ;
  238 + border-right: 2rpx solid ;
  239 + transform: rotate(45deg);
  240 + display:inline-block;
  241 + width:15rpx;height:15rpx;
  242 + border-color:#da0b31;
  243 + position: relative;
  244 + top:5rpx
  245 +}
  246 +.modal-closes {
  247 + position: absolute;
  248 + right: 30rpx;
  249 + top: -15rpx;
  250 + height: 25rpx;
  251 +
  252 +}
  253 +.choose_more{
  254 + margin-top: 100rpx;
  255 + margin-right: 20rpx;
  256 +
  257 +}
  258 +.choose_mores{
  259 + margin-top: 30rpx;
  260 + margin-right: 15rpx;
  261 +
  262 +}
  263 +.store-list{
  264 + width: 95%;
  265 + min-height: 300rpx;
  266 + overflow-y: scroll;
  267 + margin: auto;
  268 + max-height: 610rpx;
  269 +}
  270 +.store-list .store_choose{
  271 + width: 100%;
  272 + height: 120rpx;
  273 + line-height: 125rpx;
  274 + border-bottom: 1rpx solid #eee;
  275 +
  276 +}
  277 +.store-list .store_choose .store{
  278 + width: 100%;
  279 + margin: auto;
  280 + line-height: 37rpx;
  281 + padding-left: 20rpx;
  282 +
  283 +}
  284 +.xc-hook{
  285 + width: 35rpx;
  286 + height: 35rpx;
  287 + transform: rotate(-145deg);
  288 + line-height: 37rpx;
  289 + text-align: center;
  290 +}
  291 +.xc-hooks{
  292 + width: 30rpx;
  293 + height: 30rpx;
  294 + border: 1rpx solid #999;
  295 +}
  296 +.address-frame{
  297 + width: 93%;
  298 + margin-left: 7rpx;
  299 +
  300 +}
  301 +.nearby_store{
  302 + margin-left: 17rpx;
  303 +}
  304 +.address_name{
  305 + margin-right: 10rpx;
  306 +
  307 +}
  308 +.address-val{
  309 + height: 38rpx;
  310 + line-height: 38rpx;
  311 +
  312 +}
  313 +.store-bottom{
  314 + width: 85%;
  315 + margin: auto;
  316 + height: 90rpx;
  317 +}
  318 +.determine{
  319 + width: 260rpx;
  320 + height: 55rpx;
  321 + border-radius: 50rpx;
  322 + line-height: 55rpx;
  323 +}
  324 +.default{
  325 + width: 260rpx;
  326 + height: 55rpx;
  327 + border:3rpx solid #c8c8c8;
  328 + border-radius: 50rpx;
  329 + line-height: 55rpx;
  330 +}
  331 +.store-bottom-frame{
  332 + width: 95%;
  333 + margin: auto;
  334 +
  335 +}
  336 +/* 门店分类列表 */
  337 +.sort_store_list{
  338 + height: 82%;
  339 + overflow: hidden;
  340 + overflow-y: scroll;
  341 + width: 95%;
  342 + margin: auto;
  343 +}
  344 +.sort_store_list .sort-store-frame{
  345 + width: 100%;
  346 + height: 100rpx;
  347 + line-height:100rpx;
  348 + border-bottom: 1rpx solid #eee;
  349 +
  350 +}
  351 +.sort_store_list .sort-store-frame .sort-store{
  352 + width: 94.5%;
  353 + margin: auto;
  354 +}
  355 +
  356 +.c_w{ color: #fff;}
  357 +.mt10{ margin-top: 10rpx;}
  358 +.mt20{ margin-top: 20rpx;}
201 359 \ No newline at end of file
... ...