Commit c3bc66e6547e21d6a8ec07908acbbd2446956a00

Authored by 后端研发-苏泰源
2 parents c2b4d10c 5df9b85a

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

packageB/pages/zuhegou/preindex/index.js 0 → 100644
  1 +const app = getApp();
  2 +let self = null;
  3 +var os = app.globalData.setting;
  4 +var ut = require("../../../../utils/util.js");
  5 +var regeneratorRuntime = require('../../../../utils/runtime.js');
  6 +var oo = app.globalData;
  7 +
  8 +
  9 +let imgDraw = {
  10 + "width": "650px",
  11 + "height": "843px",
  12 + "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg",
  13 + "views": [{ // 头像
  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 + ]
  89 +};
  90 +
  91 +
  92 +Page({
  93 +
  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: null, //商品列表的显示
  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 + console.log(options, 111);
  127 + self = this;
  128 + var the_id = options.id;
  129 + if (options.title) {
  130 + wx.setNavigationBarTitle({
  131 + title: options.title,
  132 + });
  133 + };
  134 + var first_leader = options.first_leader;
  135 +
  136 + //--如果tg_id是空的话,分享回来--
  137 + if (the_id == undefined || the_id == null || the_id == "") {
  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];
  143 + }
  144 + }
  145 +
  146 + this.data.id = the_id;
  147 + if (first_leader) {
  148 + getApp().globalData.first_leader = first_leader;
  149 + //调用接口判断是不是会员
  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;
  153 + }
  154 + })
  155 + }
  156 +
  157 + //如果有会员的时候
  158 + var userInfo = getApp().globalData.userInfo;
  159 + if (!userInfo) {
  160 + getApp().goto("/pages/togoin/togoin");
  161 + return false;
  162 + }
  163 + },
  164 +
  165 + /**
  166 + * 生命周期函数--监听页面显示
  167 + */
  168 + onShow: function () {
  169 + var th = this,
  170 + that = this,
  171 + ee = this;
  172 + this.data.is_timer = 1;
  173 + if (this.data.act) this.countDown();
  174 + //如果有会员的时候
  175 + var userInfo = getApp().globalData.userInfo;
  176 + if (userInfo) {
  177 + if (!th.data.is_get_act) {
  178 + //获取活动信息
  179 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id;
  180 + getApp().request.get(url, {
  181 + success: function (e) {
  182 + th.data.is_get_act = 1;
  183 + if (e.data.code == 0 && e.data.data) {
  184 + self.setData({
  185 + act: e.data.data
  186 + });
  187 + if (e.data.data.is_show != 1) {
  188 + th.setData({
  189 + error: '活动未开启'
  190 + });
  191 + return false;
  192 + }
  193 + if (ut.gettimestamp() < e.data.data.start_time) {
  194 + th.setData({
  195 + error: '活动还未开始'
  196 + });
  197 + return false;
  198 + }
  199 + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) {
  200 + //-- 获取商品列表 --
  201 + self.get_list();
  202 + self.countDown();
  203 + } else {
  204 + th.setData({
  205 + error: '活动已经过期'
  206 + });
  207 + return false;
  208 + }
  209 + } else {
  210 + th.data.is_get_act = 0;
  211 + th.setData({
  212 + error: e.data.msg
  213 + });
  214 + return false;
  215 + }
  216 + }
  217 + });
  218 + }
  219 +
  220 + //等待活动值
  221 + this.waitfor2(10, 'list', function () {
  222 + if (!th.data.list) return false;
  223 + if (ut.gettimestamp() < th.data.act.start_time) {
  224 + return false;
  225 + }
  226 + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) {
  227 + return false;
  228 + }
  229 + //获取头像的分享
  230 + th.get_head_temp(function () {
  231 + var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件";
  232 + imgDraw.views[0].url = th.data.share_head;
  233 + imgDraw.views[1].text = userInfo.nickname;
  234 + imgDraw.views[2].text = txt;
  235 +
  236 + var start = ut.formar_no_full(th.data.act.start_time, '.');
  237 + var end = ut.formar_no_full(th.data.act.end_time, '.');
  238 + txt = "活动时间:" + start + " - " + end;
  239 + imgDraw.views[3].text = txt;
  240 +
  241 + var scene = th.data.id + "";
  242 + var user_id = getApp().globalData.user_id;
  243 + scene += "_" + user_id;
  244 + ///二微码
  245 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  246 + os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index";
  247 + wx.getImageInfo({
  248 + src: path3,
  249 + success: function (res) {
  250 + var vpath = res.path;
  251 + imgDraw.views[4].url = vpath;
  252 + th.setData({
  253 + imgDraw: imgDraw
  254 + })
  255 + }
  256 + })
  257 + })
  258 +
  259 + //获取用户的默认门店
  260 + getApp().get_user_store(function (e) {
  261 + if (!e) {
  262 + th.data.fir_def_store = {}; //赋值空对象
  263 + return false;
  264 + }
  265 +
  266 +
  267 +
  268 + var ee = JSON.parse(JSON.stringify(e));
  269 + var appd = getApp().globalData;
  270 + //-- 等待定位系统的开启 --
  271 + th.waitfor2(15, 'is_get_local_ok', function () {
  272 +
  273 + if (!th.data.is_get_local_ok) return false;
  274 +
  275 + var e = JSON.parse(JSON.stringify(ee));
  276 + //如果有开启近距离的话,同时距离优不一样了
  277 + if (that.data.lat != null) {
  278 + //如果经纬度有变化的话
  279 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  280 + that.set_def_storage(e);
  281 + } else {
  282 + //要用接口是获取距离,js的计算不准
  283 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  284 + data: {
  285 + store_id: os.stoid,
  286 + pickup_id: e.pickup_id,
  287 + is_pos: 1,
  288 + lat: th.data.lat,
  289 + lon: th.data.lon
  290 + },
  291 + }).then(res => {
  292 + if (res.data.code == 0) {
  293 + e = res.data.data.pageData[0];
  294 + if (e) {
  295 + e.is_no_dis = ee.is_no_dis;
  296 + appd.pk_store = e;
  297 + that.set_def_storage(e);
  298 + }
  299 +
  300 + }
  301 + })
  302 + }
  303 + appd.lat = that.data.lat;
  304 + appd.lon = that.data.lon;
  305 + } else {
  306 + if (e) {
  307 + e.distance = null;
  308 + that.set_def_storage(e);
  309 + }
  310 + }
  311 + })
  312 + });
  313 +
  314 + //----获取系统参数-----
  315 + getApp().getConfig2(function (e) {
  316 + ee.setData({
  317 + bconfig: e,
  318 + sales_rules: e.sales_rules,
  319 + });
  320 + //设置基本参数
  321 + th.wait_for_store_config(e);
  322 +
  323 + var json_d = JSON.parse(e.switch_list);
  324 + ee.setData({
  325 + store_config: e,
  326 + sys_switch: json_d,
  327 + is_closecoupon: json_d.is_closecoupon,
  328 + is_newsales_rules: json_d.is_newsales_rules,
  329 + is_open_offline: json_d.is_pricing_open,
  330 + sales_rules: e.sales_rules
  331 + });
  332 +
  333 + //-- 计算等级价相关 --
  334 + var swithc_list = e.switch_list;
  335 + var sw_arr = JSON.parse(swithc_list);
  336 + //---如果后台又开等级卡的开关---
  337 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  338 + th.setData({
  339 + rank_switch: true
  340 + });
  341 + //---回调卡的列表---
  342 + th.getPlusCardType(function (ob) {
  343 + th.setData({
  344 + card_list: ob.card_list
  345 + });
  346 + var user = getApp().globalData.userInfo;
  347 + if (!user) return false;
  348 + if (user.card_field && user['card_expiredate']) {
  349 + var str = user['card_expiredate'].replace(/-/g, '/');
  350 + var end = new Date(str);
  351 + end = Date.parse(end) / 1000;
  352 + var now = ut.gettimestamp();
  353 + //--- 判断是等级会员,且在有效期范围内 ---
  354 + if (user.card_field && now < end) {
  355 + var card_name = ob.name_map.get(user.card_field);
  356 + th.setData({
  357 + card_field: user.card_field,
  358 + card_name: card_name,
  359 + card_list: ob.card_list
  360 + });
  361 + }
  362 + }
  363 + //获取购物车的内容
  364 + th.get_cart_val(e);
  365 +
  366 + })
  367 + } else {
  368 + //获取购物车的内容
  369 + th.get_cart_val(e);
  370 + }
  371 + }, 1);
  372 +
  373 + })
  374 +
  375 + }
  376 + },
  377 +
  378 + onHide: function () {
  379 + this.data.is_timer = 0;
  380 + },
  381 +
  382 + //-- 调用接口的LIST,获取商品 --
  383 + get_list: function () {
  384 + var th = this;
  385 + if (this.data.loading) return false;
  386 + if (this.data.no_more) return false;
  387 + this.data.loading = 1;
  388 + var url = "/api/weshop/prom/zhbuyGoods/page";
  389 + var req_data = {
  390 + page: this.data.page,
  391 + pageSize: 10,
  392 + store_id: os.stoid,
  393 + zh_id: this.data.id
  394 + }
  395 + //开始调用接口
  396 + getApp().request.get(url, {
  397 + data: req_data,
  398 + success: function (res) {
  399 + th.data.loading = 0;
  400 + th.setData({
  401 + is_get: 1
  402 + })
  403 + if (ut.ajax_ok(res)) {
  404 + th.data.page++;
  405 + var list = th.data.list;
  406 + if (!list) list = [];
  407 +
  408 + //当是下拉刷新的时候
  409 + if (th.data.page > 1 && th.data.cart_list) {
  410 + //下拉之后也要重新计算一下金额
  411 + th.calc_more(res.data.data.pageData, function (list1) {
  412 + for (var i in list1) {
  413 + list.push(list1[i]);
  414 + }
  415 + th.setData({
  416 + list: list
  417 + });
  418 + th.re_sum_price();
  419 + })
  420 + } else {
  421 + for (var i in res.data.data.pageData) {
  422 + list.push(res.data.data.pageData[i]);
  423 + }
  424 + th.setData({
  425 + list: list
  426 + });
  427 + if (res.data.data.total <= 10) {
  428 + th.setData({
  429 + no_more: 1
  430 + });
  431 + }
  432 + }
  433 + } else {
  434 + th.setData({
  435 + no_more: 1
  436 + });
  437 + }
  438 + }
  439 + })
  440 + },
  441 +
  442 + //-- 滚动到底部触发 --
  443 + get_more_list: function () {
  444 + this.get_list();
  445 + },
  446 +
  447 + /**
  448 + * 用户点击右上角分享
  449 + */
  450 + onShareAppMessage: function () {
  451 + var title = this.data.act.name;
  452 + var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
  453 + if (getApp().globalData.user_id) {
  454 + url += "&first_leader=" + getApp().globalData.user_id;
  455 + }
  456 + var ob = {
  457 + title: title,
  458 + path: url,
  459 + };
  460 + if (this.data.act.img_url)
  461 + ob.imageUrl = this.data.iurl + this.data.act.img_url;
  462 + return ob;
  463 + },
  464 +
  465 + /**
  466 + * 用户分享朋友圈
  467 + */
  468 + onShareTimeline() {
  469 + var title = this.data.act.name;
  470 + var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
  471 + if (getApp().globalData.user_id) {
  472 + url += "&first_leader=" + getApp().globalData.user_id;
  473 + }
  474 + var ob = {
  475 + title: title,
  476 + path: url,
  477 + };
  478 + if (this.data.act.img_url)
  479 + ob.imageUrl = this.data.iurl + this.data.act.img_url;
  480 + return ob;
  481 + },
  482 + /**
  483 + * 点击规则详情,弹出规则
  484 + */
  485 + showRule() {
  486 + this.setData({
  487 + type: 0, //控制显示规则详情还是提示信息,0规则详情,1提示信息
  488 + showRule: true,
  489 + showMask: true,
  490 + });
  491 + },
  492 +
  493 + /**
  494 + * 点击关闭按钮关闭规则详情弹窗
  495 + */
  496 + closeRule() {
  497 + this.setData({
  498 + showRule: false,
  499 + showMask: false,
  500 + });
  501 + },
  502 +
  503 + /**
  504 + * 点击提示信息
  505 + */
  506 + showInfo() {
  507 + this.setData({
  508 + type: 1,
  509 + showRule: true,
  510 + showMask: true,
  511 + });
  512 + },
  513 +
  514 + /**
  515 + * 加入购物车
  516 + */
  517 + addToCart(e) {
  518 + var th = this;
  519 + var index = e.currentTarget.dataset.index;
  520 + var userInfo = getApp().globalData.userInfo;
  521 + if (!userInfo) {
  522 + getApp().goto("/pages/togoin/togoin");
  523 + return false;
  524 + }
  525 + let haveAdded = this.data.list[index].haveAdded;
  526 + this.data.sele_index = index;
  527 + let title = '';
  528 + self = this;
  529 + th.data.s_cart_num = 0;
  530 +
  531 + //说明是加入购物车是时候
  532 + this.data.is_zuhe_addcart = 1;
  533 + if (!haveAdded) {
  534 + th.data.sele_g = this.data.list[index];
  535 + if (!th.data.sele_g.num) th.data.goodsInputNum = 1;
  536 +
  537 + //如果没有门店,活动商品的配送方式和门店的配送方式不一样
  538 + if (!th.data.def_pick_store ||
  539 + (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)) {
  540 + //选择了门店
  541 + if (th.data.sele_store) {
  542 + wx.showToast({
  543 + title: "该商品的物流配送方式和默认门店不匹配!",
  544 + icon: 'none',
  545 + duration: 2000
  546 + })
  547 + } else {
  548 + wx.showModal({
  549 + title: '温馨提示',
  550 + content: '该商品的物流配送方式和默认门店不匹配,是否要切换门店?',
  551 + success(res) {
  552 + if (res.confirm) {
  553 + //物流的配送方式不一样
  554 + th.get_sto();
  555 + var set_data = {
  556 + store: 1
  557 + };
  558 + if (th.data.def_pick_store) {
  559 + set_data.is_no_pipei = th.data.def_pick_store.pickup_id;
  560 + }
  561 + th.setData(set_data);
  562 + }
  563 + }
  564 + })
  565 + }
  566 + return false;
  567 + } else {
  568 + th.setData({
  569 + is_no_pipei: 0
  570 + });
  571 + th.check_is_in_cart(function () {
  572 + th.add_cart_func();
  573 + })
  574 + }
  575 + } else {
  576 +
  577 + var txt = "list[" + index + "].haveAdded";
  578 + var txt1 = "list[" + index + "].num";
  579 + var txt2 = "list[" + index + "].showNum";
  580 + th.data.sele_g = this.data.list[index];
  581 +
  582 + wx.showModal({
  583 + title: '温馨提示',
  584 + content: "确定取消该商品参与活动?",
  585 + success(res) {
  586 + if (res.confirm) {
  587 + console.log('用户点击确定');
  588 + if (th.data.sele_g.cart_num && th.data.sele_g.cart_num - th.data.sele_g.num > 0) {
  589 +
  590 + var updata = {
  591 + id: th.data.sele_g.cart_id,
  592 + goods_num: th.data.sele_g.cart_num - th.data.sele_g.num,
  593 + store_id: os.stoid
  594 + }
  595 + getApp().request.put("/api/weshop/cart/update", {
  596 + data: updata,
  597 + success: function (rs) {
  598 + if (rs.data.code == 0) {
  599 + title = '取消成功';
  600 + th.setData({
  601 + [txt1]: 0,
  602 + [txt2]: false,
  603 + [txt]: false,
  604 + });
  605 + wx.showToast({
  606 + title: title,
  607 + icon: 'success',
  608 + });
  609 + th.re_sum_price();
  610 + }
  611 + }
  612 + })
  613 +
  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) {
  618 +
  619 + if (res.data.code == 0) {
  620 + title = '取消成功';
  621 + th.setData({
  622 + [txt1]: 0,
  623 + [txt2]: false,
  624 + [txt]: false,
  625 + });
  626 + wx.showToast({
  627 + title: title,
  628 + icon: 'success',
  629 + });
  630 +
  631 + th.re_sum_price();
  632 + }
  633 + }
  634 + });
  635 + }
  636 +
  637 + } else if (res.cancel) {
  638 + console.log('用户点击取消')
  639 + self.setData({
  640 + haveAdded: true,
  641 + });
  642 + }
  643 + }
  644 + })
  645 + }
  646 +
  647 + },
  648 +
  649 + /**
  650 + * 增加数量
  651 + */
  652 + add(e) {
  653 +
  654 + var th = this;
  655 + var userInfo = getApp().globalData.userInfo;
  656 + if (!userInfo) {
  657 + getApp().goto("/pages/togoin/togoin");
  658 + return false;
  659 + }
  660 +
  661 + if (this.data.changing) return false;
  662 + this.data.changing = 1;
  663 +
  664 + var index = e.currentTarget.dataset.index;
  665 + this.data.sele_g = this.data.list[index];
  666 + this.data.sele_index = index;
  667 + th.data.goodsInputNum = this.data.sele_g.num + 1;
  668 + if (this.data.sele_g.cart_num) {
  669 + th.data.s_cart_num = this.data.sele_g.cart_num + 1;
  670 + }
  671 + th.add_cart_func();
  672 + },
  673 +
  674 + /**
  675 + * 减少数量
  676 + */
  677 + sub(e) {
  678 + var userInfo = getApp().globalData.userInfo;
  679 + if (!userInfo) {
  680 + getApp().goto("/pages/togoin/togoin");
  681 + return false;
  682 + }
  683 +
  684 + var th = this;
  685 + var index = e.currentTarget.dataset.index;
  686 + var item = this.data.list[index];
  687 + this.data.sele_g = item;
  688 + let num = item.num;
  689 + th.data.s_cart_num = item.cart_num - 1;
  690 +
  691 + if (num >= 2) {
  692 + var check_num = num - 1;
  693 + //小于起购数
  694 + if (check_num < item.zhqty) {
  695 + wx.showToast({
  696 + title: "该商品至少要购买" + item.zhqty + "件",
  697 + icon: 'none',
  698 + duration: 2000
  699 + })
  700 + return false;
  701 + }
  702 +
  703 + if (th.data.changing) return false;
  704 + th.data.changing = 1;
  705 + th.data.sele_g = item;
  706 + th.data.sele_index = index;
  707 + th.data.goodsInputNum = check_num;
  708 +
  709 + th.sub_updata_cart();
  710 + return false;
  711 + }
  712 +
  713 + var txt = "list[" + index + "].haveAdded";
  714 + var txt1 = "list[" + index + "].num";
  715 + var txt2 = "list[" + index + "].showNum";
  716 +
  717 + wx.showModal({
  718 + title: '温馨提示',
  719 + content: '确定取消该商品参与活动?',
  720 + success(res) {
  721 + if (res.confirm) {
  722 +
  723 + if (th.data.s_cart_num) {
  724 + var updata = {
  725 + id: th.data.sele_g.cart_id,
  726 + goods_num: th.data.s_cart_num,
  727 + store_id: os.stoid
  728 + }
  729 + getApp().request.put("/api/weshop/cart/update", {
  730 + data: updata,
  731 + success: function (rs) {
  732 + if (rs.data.code == 0) {
  733 + var title = '取消成功';
  734 + th.setData({
  735 + [txt1]: 0,
  736 + [txt2]: false,
  737 + [txt]: false,
  738 + });
  739 + wx.showToast({
  740 + title: title,
  741 + icon: 'success',
  742 + });
  743 + th.re_sum_price();
  744 + }
  745 + }
  746 + })
  747 + } else {
  748 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id;
  749 + getApp().request.delete(url, {
  750 + success: function (res) {
  751 + if (res.data.code == 0) {
  752 + var title = '移除购物车成功';
  753 + th.setData({
  754 + [txt1]: 0,
  755 + [txt2]: false,
  756 + [txt]: false,
  757 + });
  758 + wx.showToast({
  759 + title: title,
  760 + icon: 'success',
  761 + });
  762 + th.re_sum_price(); //重新统计数量和总金额
  763 + }
  764 + }
  765 + });
  766 + }
  767 +
  768 + } else if (res.cancel) {
  769 + console.log('用户点击取消')
  770 + self.setData({
  771 + haveAdded: true,
  772 + });
  773 + }
  774 + }
  775 + })
  776 + return false;
  777 +
  778 + },
  779 +
  780 + /** 分享 **/
  781 + share() {
  782 + var th = this;
  783 + var userInfo = getApp().globalData.userInfo;
  784 + if (!userInfo) {
  785 + getApp().goto("/pages/togoin/togoin");
  786 + return false;
  787 + }
  788 + wx.showLoading();
  789 + setTimeout(function () {
  790 + th.setData({
  791 + showMask: true,
  792 + showPoster: true,
  793 + });
  794 + wx.hideLoading();
  795 + }, 1000);
  796 + },
  797 +
  798 + /**
  799 + * 关闭海报
  800 + */
  801 + closePoster() {
  802 + this.setData({
  803 + showMask: false,
  804 + showPoster: false,
  805 + });
  806 + },
  807 +
  808 + onImgOK(e) {
  809 + console.log(e.detail.path);
  810 + this.setData({
  811 + myimg: e.detail.path,
  812 + });
  813 +
  814 + },
  815 +
  816 + //---小于10的格式化函数----
  817 + timeFormat(param) {
  818 + return param < 10 ? '0' + param : param;
  819 + },
  820 +
  821 + //----倒计时函数-----
  822 + countDown() {
  823 + if (!this.data.is_timer) return false;
  824 + var th = this;
  825 + // 获取当前时间,同时得到活动结束时间数组
  826 + var endTime = this.data.act.end_time;
  827 + var newTime = ut.gettimestamp();
  828 + // 对结束时间进行处理渲染到页面
  829 + var obj = null;
  830 + // 如果活动未结束,对时间进行处理
  831 + if (endTime - newTime > 0) {
  832 + var time = (endTime - newTime);
  833 + // 获取天、时、分、秒
  834 + var day = parseInt(time / (60 * 60 * 24));
  835 + var hou = parseInt(time % (60 * 60 * 24) / 3600);
  836 + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  837 + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  838 + obj = {
  839 + hou: this.timeFormat(hou),
  840 + min: this.timeFormat(min),
  841 + sec: this.timeFormat(sec)
  842 + }
  843 + if (day > 0) {
  844 + obj.day = this.timeFormat(day);
  845 + }
  846 + } else {
  847 + //活动已结束,全部设置为'00'
  848 + obj = {
  849 + day: '00',
  850 + hou: '00',
  851 + min: '00',
  852 + sec: '00'
  853 + }
  854 + th.setData({
  855 + prom_time_text: '活动已经结束:',
  856 + prom_st: 3
  857 + })
  858 + th.setData({
  859 + djs: obj
  860 + });
  861 + return false;
  862 + }
  863 +
  864 + th.setData({
  865 + djs: obj
  866 + });
  867 + setTimeout(function () {
  868 + th.countDown()
  869 + }, 1000);
  870 + },
  871 +
  872 + close_all: function () {
  873 + this.setData({
  874 + showMask: false,
  875 + showPoster: false,
  876 + showRule: false
  877 + });
  878 + },
  879 +
  880 +
  881 + //------定时等待某个值,有值才进行运算--------
  882 + waitfor2: function (n, pop_value, func) {
  883 + var th = this;
  884 + if (n <= 0) {
  885 + func()
  886 + return false
  887 + }
  888 + if (th.data[pop_value]) {
  889 + func();
  890 + return false;
  891 + }
  892 + setTimeout(function () {
  893 + --n;
  894 + th.waitfor2(n, pop_value, func)
  895 + }, 1000);
  896 + },
  897 +
  898 + //--获取头像的本地缓存,回调写法--
  899 + get_head_temp: function (tt) {
  900 + var ee = this;
  901 + if (ee.data.share_head) {
  902 + tt();
  903 + return false;
  904 + }
  905 + //---获取分享图片的本地地址,头像和商品图片----
  906 + var path2 = getApp().globalData.userInfo.head_pic;
  907 + if (path2 == "") {
  908 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png";
  909 + tt();
  910 + } else {
  911 + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  912 + path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  913 + wx.getImageInfo({
  914 + src: path2,
  915 + success: function (res) {
  916 + //res.path是网络图片的本地地址
  917 + console.log(res);
  918 + ee.data.share_head = res.path;
  919 + tt();
  920 + },
  921 + fail: function () {
  922 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  923 + tt();
  924 + }
  925 + });
  926 + }
  927 + },
  928 +
  929 + go_url: function (e) {
  930 + var url = e.currentTarget.dataset.url;
  931 + getApp().goto(url);
  932 + },
  933 +
  934 + //-- 加入购物的函数 --
  935 + add_cart_func: function () {
  936 + if (oo.user_id == null) {
  937 + this.data.changing = 0;
  938 + return getApp().my_warnning("还未登录!", 0, this);
  939 + }
  940 + if (!getApp().globalData.userInfo) {
  941 + this.data.changing = 0;
  942 + return getApp().my_warnning("还未登录!", 0, this);
  943 + }
  944 +
  945 + var e = this,
  946 + th = e,
  947 + o = this.data.sele_g,
  948 + a = o.goods_id;
  949 +
  950 + //----------添加到购物车时,要判断限购数量,--------
  951 + e.get_buy_num(o, function (ee) {
  952 + //---判断商品是否超出限购---
  953 + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  954 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).gd_buynum > th.data.sele_g.viplimited) {
  955 + wx.showModal({
  956 + title: '提示',
  957 + content: '超出商品限购'
  958 + });
  959 + th.data.changing = 0;
  960 + return false;
  961 + }
  962 + if (th.data.s_cart_num) {
  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) {
  964 + wx.showModal({
  965 + title: '提示',
  966 + content: '超出商品限购'
  967 + });
  968 + th.data.changing = 0;
  969 + return false;
  970 + }
  971 + }
  972 +
  973 + }
  974 + //---判断商品是否超出活动限购---
  975 + if (th.data.sele_g.buyqty > 0) {
  976 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.buyqty) {
  977 + wx.showModal({
  978 + title: '提示',
  979 + content: '超出商品活动限购'
  980 + });
  981 + th.data.changing = 0;
  982 + return false;
  983 + }
  984 + }
  985 +
  986 + if (th.data.goodsInputNum <= 0) {
  987 + this.data.changing = 0;
  988 + return s.my_warnning("商品数量不能为0", 0, th);
  989 + }
  990 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  991 + this.setData({
  992 + sto_sele_name: ""
  993 + });
  994 + if (th.data.sto_sele_name == "") {
  995 + th.data.changing = 0;
  996 + return s.my_warnning("请选择门店", 0, th);
  997 + }
  998 +
  999 + //--------------此时操作的数据------------
  1000 + var newd = {
  1001 + goods_id: o.goods_id,
  1002 + goods_num: th.data.goodsInputNum,
  1003 + pick_id: th.data.sto_sele_id,
  1004 + user_id: oo.user_id,
  1005 + store_id: os.stoid,
  1006 + goods_price: o.shop_price,
  1007 + member_goods_price: o.shop_price,
  1008 + goods_name: o.goods_name,
  1009 + goods_sn: o.goods_sn,
  1010 + };
  1011 +
  1012 + if (th.data.s_cart_num) {
  1013 + newd.goods_num = th.data.s_cart_num;
  1014 + }
  1015 +
  1016 + //---是不是从收藏夹出来的---
  1017 + if (th.data.c_guide_id) {
  1018 + newd['guide_id'] = th.data.c_guide_id;
  1019 + newd['guide_type'] = 2;
  1020 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;
  1021 + } else {
  1022 + if (getApp().globalData.guide_id) {
  1023 + newd['guide_id'] = getApp().globalData.guide_id;
  1024 + newd['guide_type'] = 0;
  1025 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;
  1026 + }
  1027 + }
  1028 +
  1029 + //让商品带上房间号
  1030 + if (th.data.sys_switch.is_skuroom_id == 1) {
  1031 + if (th.data.sele_g.goods_id == getApp().globalData.room_goods_id) {
  1032 + newd.room_id = getApp().globalData.room_id;
  1033 + }
  1034 + } else {
  1035 + if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
  1036 + }
  1037 +
  1038 + if (o.store_count <= 0) {
  1039 + th.data.changing = 0;
  1040 + return getApp().my_warnning("库存已为空!", 0, th);
  1041 + }
  1042 + if (o.store_count < e.data.goodsInputNum) {
  1043 + th.data.changing = 0;
  1044 + return getApp().my_warnning("库存不足!", 0, th);
  1045 + }
  1046 + th.add_cart_next(o, newd); //加入购物车下一步
  1047 +
  1048 + })
  1049 + },
  1050 +
  1051 + //---加入购物车的最后一步---
  1052 + add_cart_next(o, newd) {
  1053 + var th = this;
  1054 + //如果会员有等级价
  1055 + if (th.data.card_field) {
  1056 + var card_price = o[th.data.card_field];
  1057 + if (card_price > 0) {
  1058 + newd.goods_price = card_price;
  1059 + newd.member_goods_price = card_price;
  1060 + }
  1061 + }
  1062 +
  1063 + var index = this.data.sele_index;
  1064 + var txt = "list[" + index + "].haveAdded";
  1065 + var txt1 = "list[" + index + "].num";
  1066 + var txt2 = "list[" + index + "].showNum";
  1067 + var txt3 = "list[" + index + "].current_price";
  1068 +
  1069 +
  1070 + newd.prom_type = 7;
  1071 + newd.prom_id = th.data.act.id;
  1072 +
  1073 + if (th.data.adding) return false;
  1074 + th.data.adding = 1;
  1075 + //-------如果购物车中有相关的数据---------
  1076 + if (th.data.goodsInputNum > 1) {
  1077 + var item = th.data.sele_g;
  1078 + if (th.data.goodsInputNum > o.store_count) {
  1079 + th.data.adding = 0;
  1080 + return getApp().my_warnning("库存不足!", 0, th);
  1081 + }
  1082 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > o.buyqty && o.buyqty > 0) {
  1083 + th.data.adding = 0;
  1084 + return getApp().my_warnning("超出商品活动限购!", 0, th);
  1085 + }
  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
  1088 + ) {
  1089 + th.data.adding = 0;
  1090 + return getApp().my_warnning("超出商品限购!", 0, th);
  1091 + }
  1092 +
  1093 + //如果商品没有其他活动,要取一下线下价格
  1094 + var updata = {
  1095 + id: item.cart_id,
  1096 + goods_num: th.data.goodsInputNum,
  1097 + goods_price: newd.goods_price,
  1098 + member_goods_price: newd.goods_price,
  1099 + store_id: os.stoid,
  1100 + };
  1101 + if (th.data.s_cart_num) {
  1102 + updata.goods_num = th.data.s_cart_num;
  1103 + }
  1104 + //---是不是从收藏夹出来的---
  1105 + if (th.data.c_guide_id) {
  1106 + updata['guide_id'] = th.data.c_guide_id;
  1107 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  1108 + } else {
  1109 + if (getApp().globalData.guide_id) {
  1110 + updata['guide_id'] = getApp().globalData.guide_id;
  1111 + updata['guide_type'] = 0;
  1112 + }
  1113 + }
  1114 + getApp().request.put("/api/weshop/cart/update", {
  1115 + data: updata,
  1116 + success: function (t) {
  1117 + th.setData({
  1118 + [txt1]: th.data.goodsInputNum,
  1119 + [txt2]: true,
  1120 + [txt]: true,
  1121 + [txt3]: newd.goods_price,
  1122 + });
  1123 + th.data.adding = 0;
  1124 + th.data.sele_store = 1;
  1125 +
  1126 + if (th.data.s_cart_num) {
  1127 + var txt_temp = "list[" + index + "].cart_num";
  1128 + th.setData({
  1129 + [txt_temp]: th.data.s_cart_num
  1130 + })
  1131 + }
  1132 +
  1133 + th.re_sum_price(); //重新统计数量和总金额
  1134 + }
  1135 + });
  1136 + } else {
  1137 +
  1138 + getApp().request.post("/api/weshop/cart/save", {
  1139 + data: newd,
  1140 + success: function (t) {
  1141 + if (t.data.code == 0) {
  1142 + var txt4 = "list[" + th.data.sele_index + "].cart_id";
  1143 + th.setData({
  1144 + [txt1]: newd.goods_num,
  1145 + [txt2]: true,
  1146 + [txt3]: newd.goods_price,
  1147 + [txt]: true,
  1148 + [txt4]: t.data.data.id,
  1149 + });
  1150 +
  1151 + th.data.adding = 0;
  1152 + th.data.sele_store = 1;
  1153 + th.re_sum_price(); //重新统计数量和总金额
  1154 + }
  1155 + }
  1156 + });
  1157 + }
  1158 + },
  1159 +
  1160 + //等待获取配置
  1161 + wait_for_store_config: function (bconfig) {
  1162 + var th = this;
  1163 + var e = bconfig;
  1164 + if (e && e.is_sort_storage) {
  1165 + wx.getLocation({
  1166 + type: 'gcj02',
  1167 + success: function (res) {
  1168 + th.data.lat = res.latitude;
  1169 + th.data.lon = res.longitude;
  1170 + th.data.is_get_local_ok = 1;
  1171 + },
  1172 + fail: function (res) {
  1173 + if (res.errCode == 2) {
  1174 + th.setData({
  1175 + is_gps: 0
  1176 + });
  1177 + if (th.data.is_gps == 0) {
  1178 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  1179 + }
  1180 +
  1181 + } else {
  1182 + th.setData({
  1183 + is_gps: "3"
  1184 + });
  1185 + }
  1186 +
  1187 + th.data.is_get_local_ok = 1;
  1188 + }
  1189 + })
  1190 + } else {
  1191 + th.data.is_get_local_ok = 1;
  1192 + }
  1193 + },
  1194 +
  1195 + //--- 获取卡类列表 ---
  1196 + getPlusCardType: function (func) {
  1197 + var storid = os.stoid;
  1198 + var user = getApp().globalData.userInfo;
  1199 + if (!user) return false;
  1200 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  1201 + var plusCard = res.data.data;
  1202 + var arr = [1219, 2089, 3031];
  1203 + var new_arr = new Array();
  1204 + var card_name_map = new Map();
  1205 +
  1206 + var list = [];
  1207 + for (var i = 0; i < plusCard.length; i++) {
  1208 + if ((!user || user.card_field == null || user.card_field == "") && plusCard[i].IsStopBuy == true) continue;
  1209 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  1210 + card_name_map.set(name, plusCard[i].CardName);
  1211 + list.push(plusCard[i]);
  1212 + }
  1213 +
  1214 + var ob = {
  1215 + "card_list": list,
  1216 + "name_map": card_name_map
  1217 + };
  1218 + func(ob);
  1219 + })
  1220 + },
  1221 +
  1222 +
  1223 + //--- 设置一下默认库存的数量 ----
  1224 + set_def_storage(ee) {
  1225 + var that = this;
  1226 + that.data.fir_def_store = ee;
  1227 + that.setData({
  1228 + def_pick_store: ee,
  1229 + sto_sele_name: ee.pickup_name,
  1230 + sto_sele_id: ee.pickup_id,
  1231 + sto_sele_distr: ee.distr_type
  1232 + })
  1233 + },
  1234 +
  1235 + //---------拿出门店分类和门店------------
  1236 + get_sto(e) {
  1237 + var th = this;
  1238 + this.waitfor2(15, 'is_get_local_ok', function () {
  1239 + //if (!th.data.sele_g) return false;
  1240 + var dd = null;
  1241 + var g_distr_type = 0;
  1242 + if (th.data.sele_g) g_distr_type = th.data.sele_g.distr_type;
  1243 + if (g_distr_type != 0) {
  1244 + dd = {
  1245 + store_id: os.stoid,
  1246 + distr_type: g_distr_type,
  1247 + isstop: 0,
  1248 + is_pos: 1,
  1249 + pageSize: 2000
  1250 + }
  1251 + } else {
  1252 + dd = {
  1253 + store_id: os.stoid,
  1254 + isstop: 0,
  1255 + is_pos: 1,
  1256 + pageSize: 2000
  1257 + }
  1258 + }
  1259 +
  1260 + //如果有距离的话
  1261 + if (th.data.lat != null) {
  1262 + dd.lat = th.data.lat;
  1263 + dd.lon = th.data.lon;
  1264 + }
  1265 +
  1266 + //如果会员是有默认的门店话
  1267 + if (!th.data.def_pick_store && th.data.fir_def_store) {
  1268 + th.setData({
  1269 + def_pick_store: th.data.fir_def_store
  1270 + });
  1271 + }
  1272 +
  1273 + wx.showLoading({
  1274 + title: '加载中.'
  1275 + });
  1276 + //----------获取门店----------------
  1277 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  1278 + data: dd,
  1279 + }).then(res => {
  1280 + var e = res;
  1281 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  1282 +
  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;
  1289 + }
  1290 + }
  1291 + e.his_cate_num = his_cate_num;
  1292 +
  1293 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  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) {
  1295 + th.setData({
  1296 + def_pick_store: e.data.data.pageData[0],
  1297 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1298 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1299 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1300 + });
  1301 + th.data.fir_def_store = e.data.data.pageData[0];
  1302 + }
  1303 +
  1304 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  1305 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  1306 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  1307 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  1308 + e.data.data.pageData.splice(k, 1); //删除
  1309 + break;
  1310 + }
  1311 + }
  1312 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  1313 + }
  1314 +
  1315 + th.setData({
  1316 + all_pick_list: e.data.data.pageData
  1317 + });
  1318 + th.deal_pickup(e);
  1319 + }
  1320 + })
  1321 + })
  1322 + },
  1323 + //------------处理门店---------------
  1324 + deal_pickup(e) {
  1325 + var th = this;
  1326 + wx.hideLoading();
  1327 + //单总量超出5个的时候
  1328 + if (e.data.data.total > 10 && e.his_cate_num) {
  1329 + getApp().request.get("/api/weshop/storagecategory/page", {
  1330 + data: {
  1331 + store_id: os.stoid,
  1332 + pageSize: 1000,
  1333 + orderField: "sort",
  1334 + orderType: 'asc',
  1335 + },
  1336 + success: function (ee) {
  1337 + if (ee.data.code == 0) {
  1338 +
  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
  1346 + }
  1347 + }
  1348 + }
  1349 +
  1350 + if (check_all_cate) {
  1351 +
  1352 + var sto_cate = ee.data.data.pageData;
  1353 + var sto_arr = e.data.data.pageData;
  1354 + var newarr = new Array();
  1355 + var qita = new Array();
  1356 +
  1357 + var is_del_pk = 0;
  1358 + //----要进行门店分组--------
  1359 + for (var i = 0; i < sto_arr.length; i++) {
  1360 + //找一下这个门店有没有在分类数组内
  1361 + var find2 = 0,
  1362 + find2name = "",
  1363 + sort = 0;
  1364 + is_del_pk = 0;
  1365 + for (var m = 0; m < sto_cate.length; m++) {
  1366 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  1367 + if (sto_cate[m].is_show != 1) {
  1368 + is_del_pk = 1;
  1369 + sto_arr.splice(i, 1);
  1370 + i--;
  1371 + } else {
  1372 + find2 = sto_cate[m].cat_id;
  1373 + find2name = sto_cate[m].cat_name;
  1374 + sort = sto_cate[m].sort;
  1375 + is_del_pk = 0;
  1376 + }
  1377 + break;
  1378 + }
  1379 + }
  1380 + if (is_del_pk) continue;
  1381 +
  1382 + if (newarr.length > 0) {
  1383 + var find = 0;
  1384 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1385 + if (find2 != 0) {
  1386 + for (var ii = 0; ii < newarr.length; ii++) {
  1387 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  1388 + newarr[ii].s_arr.push(sto_arr[i]);
  1389 + find = 1;
  1390 + break;
  1391 + }
  1392 + }
  1393 + if (find == 0) {
  1394 + var arr0 = new Array();
  1395 + arr0.push(sto_arr[i]);
  1396 + var item = {
  1397 + cat_id: find2,
  1398 + name: find2name,
  1399 + sort: sort,
  1400 + s_arr: arr0
  1401 + };
  1402 + newarr.push(item);
  1403 + }
  1404 + } else {
  1405 + qita.push(sto_arr[i]);
  1406 + }
  1407 + } else {
  1408 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1409 + if (find2 != 0) {
  1410 + var arr0 = new Array();
  1411 + arr0.push(sto_arr[i]);
  1412 + var item = {
  1413 + cat_id: find2,
  1414 + name: find2name,
  1415 + sort: sort,
  1416 + s_arr: arr0
  1417 + };
  1418 + newarr.push(item);
  1419 + } else {
  1420 + qita.push(sto_arr[i]);
  1421 + }
  1422 + }
  1423 + }
  1424 +
  1425 + var def_arr = new Array();
  1426 + //-- 开始就看10个门店 --
  1427 + for (var k = 0; k < 10; k++) {
  1428 + if (k == sto_arr.length) break;
  1429 + def_arr.push(sto_arr[k]);
  1430 + }
  1431 +
  1432 + th.setData({
  1433 + def_pickpu_list: def_arr,
  1434 + pickpu_list: ee.data.data.pageData
  1435 + });
  1436 +
  1437 + //门店分类要排序下
  1438 + function compare(property) {
  1439 + return function (a, b) {
  1440 + var value1 = a[property];
  1441 + var value2 = b[property];
  1442 + return value1 - value2;
  1443 + }
  1444 + }
  1445 +
  1446 + if (newarr.length > 0)
  1447 + newarr.sort(compare("sort"));
  1448 + //----安排其他的分类-----
  1449 + if (qita.length > 0) {
  1450 + var item = {
  1451 + cat_id: -1,
  1452 + name: "其他",
  1453 + s_arr: qita
  1454 + };
  1455 + newarr.push(item);
  1456 + }
  1457 +
  1458 +
  1459 + var sd = {
  1460 + all_sto: newarr,
  1461 + is_show_sto_cat: 1
  1462 + }
  1463 + if (!sto_arr || sto_arr.length <= 10) {
  1464 + sd.is_show_sto_cat = -1;
  1465 + sd.only_pk = sto_arr;
  1466 + }
  1467 + th.setData(sd);
  1468 +
  1469 + } else {
  1470 + th.setData({
  1471 + is_show_sto_cat: -1,
  1472 + only_pk: e.data.data.pageData
  1473 + });
  1474 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1475 + if (!th.data.def_pick_store) {
  1476 + th.setData({
  1477 + def_pick_store: e.data.data.pageData[0]
  1478 + })
  1479 + }
  1480 + }
  1481 + } else {
  1482 + th.setData({
  1483 + is_show_sto_cat: -1,
  1484 + only_pk: e.data.data.pageData
  1485 + });
  1486 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1487 + if (!th.data.def_pick_store) {
  1488 + th.setData({
  1489 + def_pick_store: e.data.data.pageData[0]
  1490 + })
  1491 + }
  1492 + }
  1493 + }
  1494 + });
  1495 + } else {
  1496 + th.setData({
  1497 + is_show_sto_cat: 0,
  1498 + only_pk: e.data.data.pageData
  1499 + });
  1500 + //-----如果没有默认门店,要取第一个门店作为默认店------
  1501 + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  1502 + if (e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  1503 + th.setData({
  1504 + def_pick_store: e.data.data.pageData[0],
  1505 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1506 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1507 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1508 + })
  1509 + }
  1510 + }
  1511 + }
  1512 + },
  1513 +
  1514 + //---选择分类门店---
  1515 + choice_sort_store: function (e) {
  1516 + var index = e.currentTarget.dataset.index;
  1517 + var region_name = e.currentTarget.dataset.region;
  1518 + var item = this.data.all_sto[index];
  1519 + this.setData({
  1520 + region_name: region_name,
  1521 + sort_store: 0,
  1522 + choice_sort_store: 1,
  1523 + sec_sto: item,
  1524 + sec_pick_index: 0
  1525 + });
  1526 + },
  1527 +
  1528 + choose_for_store_fir: function (e) {
  1529 + var index_c = e.currentTarget.dataset.ind;
  1530 + var th = this;
  1531 + th.setData({
  1532 + fir_pick_index: index_c
  1533 + })
  1534 + },
  1535 +
  1536 + //确定def_pick为选择的门店
  1537 + sure_pick: function (e) {
  1538 + var th = this;
  1539 + var item = null;
  1540 + var openindstore = th.data.open_ind_store;
  1541 +
  1542 + if (th.data.choice_sort_store == 0) {
  1543 + var index = th.data.fir_pick_index;
  1544 + if (th.data.is_show_sto_cat == 1) {
  1545 + item = th.data.def_pickpu_list[index];
  1546 + } else {
  1547 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1548 + }
  1549 + } else {
  1550 + var index = th.data.sec_pick_index;
  1551 + item = th.data.sec_sto.s_arr[index];
  1552 + }
  1553 +
  1554 + //判断门店的配送方式是不是匹配
  1555 + var g_distr_type = 0;
  1556 + if (th.data.sele_g)
  1557 + g_distr_type = th.data.sele_g.distr_type;
  1558 + if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
  1559 + wx.showToast({
  1560 + title: "门店配送方式不匹配",
  1561 + icon: 'none',
  1562 + duration: 2000
  1563 + });
  1564 + return false;
  1565 + }
  1566 +
  1567 + th.setData({
  1568 + def_pick_store: item,
  1569 + sto_sele_name: item.pickup_name,
  1570 + sto_sele_id: item.pickup_id,
  1571 + sto_sele_distr: item.distr_type,
  1572 + store: 0,
  1573 + choice_sort_store: 0,
  1574 + fir_pick_index: 0,
  1575 + sort_store: 0
  1576 + });
  1577 +
  1578 + //只是单纯的选择门店
  1579 + if (this.data.only) {
  1580 + this.data.only = 0;
  1581 + return false;
  1582 + }
  1583 + th.check_is_in_cart(function () {
  1584 + th.add_cart_func();
  1585 + })
  1586 + },
  1587 +
  1588 +
  1589 + //---点击二级之后的选择---
  1590 + choose_for_store: function (e) {
  1591 + var index_c = e.currentTarget.dataset.ind;
  1592 + var th = this;
  1593 + th.setData({
  1594 + sec_pick_index: index_c,
  1595 + fir_pick_index: index_c
  1596 + })
  1597 +
  1598 + },
  1599 + //把选择的门店设置成默认的门店def_pick
  1600 + set_def_pick: function (e) {
  1601 + var th = this;
  1602 + var item = null;
  1603 + if (th.data.choice_sort_store == 0) {
  1604 + var index = th.data.fir_pick_index;
  1605 + if (th.data.is_show_sto_cat == 1) {
  1606 + item = th.data.def_pickpu_list[index];
  1607 + } else {
  1608 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1609 + }
  1610 + } else {
  1611 + var index = th.data.sec_pick_index;
  1612 + item = th.data.sec_sto.s_arr[index];
  1613 + }
  1614 +
  1615 + //判断门店的配送方式是不是匹配
  1616 + var g_distr_type = th.data.sele_g.distr_type;
  1617 + if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
  1618 + wx.showToast({
  1619 + title: "门店配送方式不匹配",
  1620 + icon: 'none',
  1621 + duration: 2000
  1622 + });
  1623 + return false;
  1624 + }
  1625 +
  1626 + //先设置之前,要判断是不是有库存
  1627 + var user_id = getApp().globalData.user_id;
  1628 + var def_pickup_id = item.pickup_id;
  1629 +
  1630 + getApp().request.put('/api/weshop/users/update', {
  1631 + data: {
  1632 + user_id: user_id,
  1633 + def_pickup_id: def_pickup_id
  1634 + },
  1635 + success: function (res) {
  1636 + if (res.data.code == 0) {
  1637 + if (th.data.choice_sort_store == 0) th.setData({
  1638 + fir_pick_index: 0
  1639 + });
  1640 + getApp().globalData.pk_store = item;
  1641 + } else {
  1642 + //s.showWarning("设置默认门店地址失败", null, 500, !1);
  1643 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  1644 + }
  1645 +
  1646 + }
  1647 + });
  1648 +
  1649 + th.setData({
  1650 + def_pick_store: item,
  1651 + sto_sele_name: item.pickup_name,
  1652 + sto_sele_id: item.pickup_id,
  1653 + sto_sele_distr: item.distr_type,
  1654 + store: 0,
  1655 + choice_sort_store: 0,
  1656 + sort_store: 0, //关闭门店2级
  1657 + });
  1658 +
  1659 + th.add_cart_func();
  1660 + },
  1661 +
  1662 + // 返回按钮
  1663 + returns: function () {
  1664 + this.setData({
  1665 + sort_store: 0,
  1666 + choice_sort_store: 0
  1667 + });
  1668 + },
  1669 + //选择更多门店
  1670 + more_store: function () {
  1671 + this.setData({
  1672 + sort_store: 1
  1673 + });
  1674 + },
  1675 + //关闭选择门店
  1676 + close_popup: function (e) {
  1677 + var th = this;
  1678 + this.setData({
  1679 + store: 0,
  1680 + choice_sort_store: 0,
  1681 + sort_store: 0,
  1682 + fir_pick_index: 0,
  1683 + sec_pick_index: 0
  1684 + })
  1685 + },
  1686 +
  1687 + //-------------获取购买数量的总函数----------------
  1688 + get_buy_num: function (gd, func) {
  1689 + var map = this.data.g_buy_num,
  1690 + th = this,
  1691 + user_id = getApp().globalData.user_id;
  1692 +
  1693 + if (user_id == null) {
  1694 + getApp().goto("/pages/togoin/togoin");
  1695 + return false;
  1696 + }
  1697 + if (map && map.has(gd.goods_id)) {
  1698 + "function" == typeof func && func();
  1699 + } else {
  1700 + var res1 = null;
  1701 + //----获取商品购买数----
  1702 + getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1703 + data: {
  1704 + store_id: os.stoid,
  1705 + user_id: user_id,
  1706 + goods_id: gd.goods_id,
  1707 + prom_type: 7,
  1708 + prom_id: th.data.act.id
  1709 + },
  1710 + }).then(res2 => {
  1711 + var g_buy_num = 0;
  1712 + var promgoodsbuynum = 0;
  1713 + if (res2.data.code == 0) {
  1714 + var buy_num_data = res2.data.data;
  1715 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  1716 + g_buy_num = buy_num_data.goodsbuynum;
  1717 + }
  1718 +
  1719 + if (!map) map = new Map();
  1720 + var ob = {
  1721 + gd_buynum: g_buy_num,
  1722 + prom_buybum: promgoodsbuynum,
  1723 + }
  1724 + map.set(gd.goods_id, ob);
  1725 + th.setData({
  1726 + g_buy_num: map
  1727 + });
  1728 + "function" == typeof func && func();
  1729 + })
  1730 + }
  1731 + },
  1732 +
  1733 + //-- 当是减数量的调用 --
  1734 + sub_updata_cart() {
  1735 + var th = this;
  1736 + var index = this.data.sele_index;
  1737 + var txt = "list[" + index + "].haveAdded";
  1738 + var txt1 = "list[" + index + "].num";
  1739 + var txt2 = "list[" + index + "].showNum";
  1740 +
  1741 + var cur_price = this.data.sele_g.shop_price;
  1742 + if (th.data.card_field && this.data.sele_g[th.data.card_field]) {
  1743 + cur_price = this.data.sele_g[th.data.card_field];
  1744 + }
  1745 + var updata = {
  1746 + id: th.data.sele_g.cart_id,
  1747 + goods_num: th.data.goodsInputNum,
  1748 + goods_price: cur_price,
  1749 + store_id: os.stoid,
  1750 + };
  1751 +
  1752 + if (th.data.s_cart_num) {
  1753 + updata.goods_num = th.data.s_cart_num;
  1754 + }
  1755 +
  1756 + //---是不是从收藏夹出来的---
  1757 + if (th.data.c_guide_id) {
  1758 + updata['guide_id'] = th.data.c_guide_id;
  1759 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  1760 + } else {
  1761 + if (getApp().globalData.guide_id) {
  1762 + updata['guide_id'] = getApp().globalData.guide_id;
  1763 + updata['guide_type'] = 0;
  1764 + }
  1765 + }
  1766 + //调用接口,更新购物车
  1767 + getApp().request.put("/api/weshop/cart/update", {
  1768 + data: updata,
  1769 + success: function (t) {
  1770 + th.setData({
  1771 + [txt1]: th.data.goodsInputNum,
  1772 + [txt2]: true,
  1773 + [txt]: true,
  1774 + });
  1775 + th.data.adding = 0;
  1776 + th.data.sele_store = 1;
  1777 + if (th.data.s_cart_num) {
  1778 + var txt_temp = "list[" + index + "].cart_num";
  1779 + th.setData({
  1780 + [txt_temp]: th.data.s_cart_num
  1781 + })
  1782 + }
  1783 +
  1784 + th.re_sum_price(); //重新统计数量和总金额
  1785 + }
  1786 + });
  1787 + },
  1788 + //一 开始的选择门店 --
  1789 + choose_store: function (e) {
  1790 + var userInfo = getApp().globalData.userInfo;
  1791 + if (!userInfo) {
  1792 + getApp().goto("/pages/togoin/togoin");
  1793 + return false;
  1794 + }
  1795 + this.data.only = 1;
  1796 + this.setData({
  1797 + store: 1
  1798 + })
  1799 +
  1800 +
  1801 + this.get_sto()
  1802 + },
  1803 +
  1804 + // -- 加入之前,先判断有没有在购物车中,没有商品就添加 --
  1805 + check_is_in_cart: function (func) {
  1806 + var th = this;
  1807 + var index = th.data.sele_index;
  1808 + var txt = "list[" + index + "].haveAdded";
  1809 + var txt1 = "list[" + index + "].num";
  1810 + var txt2 = "list[" + index + "].showNum";
  1811 + var txt3 = "list[" + index + "].cart_id";
  1812 + var txt4 = "list[" + index + "].current_price";
  1813 + var txt5 = "list[" + index + "].cart_num";
  1814 +
  1815 + //----先看会员在购物车中是否加入了该商品-----
  1816 + getApp().request.get("/api/weshop/cart/page", {
  1817 + data: {
  1818 + store_id: os.stoid,
  1819 + user_id: oo.user_id,
  1820 + goods_id: th.data.sele_g.goods_id,
  1821 + pick_id: th.data.sto_sele_id,
  1822 + },
  1823 + success: function (re) {
  1824 + if (re.data.data.total > 0) {
  1825 + var item = re.data.data.pageData[0];
  1826 + th.get_buy_num(th.data.sele_g, function () {
  1827 + //当前的价格要更新进去
  1828 + var cur_price = th.data.sele_g.shop_price;
  1829 + if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
  1830 + cur_price = th.data.sele_g[th.data.card_field];
  1831 + }
  1832 +
  1833 + var prom_buybum = 0;
  1834 + var gd_buynum = 0;
  1835 + //加入也要控制一下限购
  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 + ) {
  1844 + wx.showToast({
  1845 + title: "您的已购数量超出活动的限购",
  1846 + icon: 'none',
  1847 + duration: 2000
  1848 + });
  1849 + return false;
  1850 + }
  1851 + if (check_obj.gd_buynum && check_obj.gd_buynum >= th.data.sele_g.viplimited &&
  1852 + th.data.sele_g.viplimited > 0
  1853 + ) {
  1854 + wx.showToast({
  1855 + title: "您的已购数量超出商品的限购",
  1856 + icon: 'none',
  1857 + duration: 2000
  1858 + });
  1859 + return false;
  1860 + }
  1861 + }
  1862 +
  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;
  1869 + }
  1870 +
  1871 + var num = item.goods_num;
  1872 + if (item.cbuy > -1 && item.cbuy < item.goods_num) {
  1873 + num = item.cbuy;
  1874 + }
  1875 + th.setData({
  1876 + [txt1]: num,
  1877 + [txt2]: true,
  1878 + [txt]: true,
  1879 + [txt3]: item.id,
  1880 + [txt4]: cur_price,
  1881 + [txt5]: item.goods_num,
  1882 + });
  1883 +
  1884 + var updata = {
  1885 + id: item.id,
  1886 + prom_type: 7,
  1887 + goods_price: cur_price,
  1888 + prom_id: th.data.act.id,
  1889 + store_id: os.stoid,
  1890 + };
  1891 + if (getApp().globalData.guide_id) {
  1892 + updata['guide_id'] = getApp().globalData.guide_id;
  1893 + updata['guide_type'] = 0;
  1894 + }
  1895 +
  1896 + getApp().request.put("/api/weshop/cart/update", {
  1897 + data: updata,
  1898 + success: function (t) {}
  1899 + });
  1900 + th.re_sum_price();
  1901 + })
  1902 +
  1903 + } else {
  1904 + func();
  1905 + }
  1906 + }
  1907 + })
  1908 + },
  1909 +
  1910 + //-- 计算统计之后的金额 --
  1911 + re_sum_price: function () {
  1912 + var all_num = 0; //商品数量之和
  1913 + var all_price = 0;
  1914 + var need_to_buy = 0;
  1915 + var data = this.data.list;
  1916 + var all_zhqty = 0; //所有商品要求起购数之后
  1917 + var zhqty_bz=[]; //超量
  1918 + var no_in_arr = [];
  1919 + for (var i in data) {
  1920 + var item = data[i];
  1921 + if (item.num) {
  1922 + all_num += item.num;
  1923 + all_price += item.num * item.current_price;
  1924 + //当有起购数的控制的时候
  1925 + if (item.zhqty) {
  1926 + zhqty_bz.push(item);
  1927 + all_zhqty += item.zhqty;
  1928 + if (item.num < item.zhqty) {
  1929 + need_to_buy += item.zhqty - item.num;
  1930 + }
  1931 + if (item.num > item.zhqty) {
  1932 + for (var i = 0; i < item.num - item.zhqty; i++) {
  1933 + no_in_arr.push({
  1934 + price: item.current_price,
  1935 + goods_id: item.goods_id
  1936 + });
  1937 + }
  1938 + }
  1939 + } else {
  1940 + for (var j = 0; j < item.num; j++) {
  1941 + no_in_arr.push({
  1942 + price: item.current_price,
  1943 + goods_id: item.goods_id
  1944 + });
  1945 + }
  1946 + }
  1947 + } else {
  1948 + if (item.zhqty) need_to_buy += item.zhqty;
  1949 + }
  1950 + }
  1951 +
  1952 + //当满足组合的要求:总数要满足,起购数要满足
  1953 + if (all_num >= this.data.act.zhbuyqty && !need_to_buy) {
  1954 + function sortData(a, b) {
  1955 + return a.price - b.price
  1956 + }
  1957 + if (no_in_arr.length) no_in_arr.sort(sortData);
  1958 +
  1959 + var aprice = this.data.act.zhprice;
  1960 + if (this.data.act.zhbuyqty > all_zhqty) {
  1961 + for (var n = 0; n < this.data.act.zhbuyqty - all_zhqty; n++) {
  1962 + no_in_arr.pop();
  1963 + }
  1964 + }
  1965 +
  1966 + //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
  1967 + if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
  1968 + let zhqty_map=new map();
  1969 + //看一下是几倍
  1970 + var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
  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 + }
  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 + // }
  2000 + }
  2001 +
  2002 + //算一下剩余的钱
  2003 + if (no_in_arr.length) {
  2004 + for (var ii in no_in_arr) {
  2005 + var item = no_in_arr[ii];
  2006 + aprice += item.price;
  2007 + }
  2008 + }
  2009 + all_price = aprice;
  2010 + }
  2011 + this.data.changing = 0;
  2012 + this.setData({
  2013 + all_price: all_price,
  2014 + need_to_buy: need_to_buy,
  2015 + all_num: all_num
  2016 + })
  2017 +
  2018 + if (all_num <= 0) {
  2019 + this.data.sele_store = 0; //什么都没有选,就没有选择了门店
  2020 + }
  2021 +
  2022 + },
  2023 +
  2024 + go_cart: function () {
  2025 + getApp().goto("/pages/cart/cart/cart");
  2026 + },
  2027 +
  2028 + //获取购物车中,相应的门店已购买的商品
  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
  2039 + };
  2040 + //获取购物车列表
  2041 + getApp().request.get("/api/weshop/cart/list", {
  2042 + data: req,
  2043 + success: async function (e) {
  2044 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) {
  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;
  2054 + }
  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;
  2058 +
  2059 + var card_price = 0;
  2060 + //如果会员有等级价
  2061 + if (th.data.card_field) {
  2062 + card_price = item_j[th.data.card_field];
  2063 + if (card_price > 0) {
  2064 + item_j.current_price = card_price;
  2065 + }
  2066 + }
  2067 +
  2068 +
  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;
  2108 + }
  2109 + }
  2110 + th.setData({
  2111 + list: th.data.list
  2112 + });
  2113 + th.re_sum_price();
  2114 + }
  2115 + }
  2116 + });
  2117 + },
  2118 +
  2119 + //滚动加载跟多的时候的计算
  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;
  2129 + }
  2130 +
  2131 + for (let j in list) {
  2132 + let item_j = list[j];
  2133 + item_j.current_price = item_j.shop_price;
  2134 +
  2135 + var card_price = 0;
  2136 + //如果会员有等级价
  2137 + if (th.data.card_field) {
  2138 + card_price = item_j[th.data.card_field];
  2139 + if (card_price > 0) {
  2140 + item_j.current_price = card_price;
  2141 + }
  2142 + }
  2143 +
  2144 +
  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;
  2153 + //----获取商品购买数----
  2154 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  2155 + data: {
  2156 + store_id: os.stoid,
  2157 + user_id: oo.user_id,
  2158 + goods_id: item_j.goods_id,
  2159 + prom_type: 7,
  2160 + prom_id: th.data.act.id
  2161 + },
  2162 + }).then(res2 => {
  2163 + if (res2.data.code == 0) {
  2164 + var buy_num_data = res2.data.data;
  2165 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  2166 + g_buy_num = buy_num_data.goodsbuynum;
  2167 + }
  2168 + })
  2169 +
  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;
  2174 + }
  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;
  2179 + }
  2180 + }
  2181 +
  2182 + item_j.haveAdded = 1;
  2183 + item_j.showNum = true;
  2184 + }
  2185 + }
  2186 + if (func) func(list)
  2187 +
  2188 + }
  2189 +
  2190 +})
0 2191 \ No newline at end of file
... ...
packageB/pages/zuhegou/preindex/index.json 0 → 100644
  1 +{
  2 + "usingComponents": {
  3 + "catch": "/packageB//components/catch/catch",
  4 + "nodata": "/components/nodata/nodata",
  5 + "painter": "/packageB/components/painter/painter",
  6 + "warn": "/components/long_warn/long_warn"
  7 + },
  8 + "enablePullDownRefresh": false,
  9 + "navigationBarTitleText": "组合购"
  10 +}
0 11 \ No newline at end of file
... ...
packageB/pages/zuhegou/preindex/index.wxml 0 → 100644
  1 +<wxs module="filters" src="../../../../utils/filter.wxs"></wxs>
  2 +<view wx:if="{{act}}" class="container">
  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 + <block wx:if="{{def_pick_store}}">
  21 + <text wx:if="{{all_price>0}}">{{def_pick_store.pickup_name}}</text>
  22 + <text wx:else bindtap="choose_store">{{def_pick_store.pickup_name}}</text>
  23 + </block>
  24 +
  25 + <text wx:else bindtap="choose_store" >请选择门店</text>
  26 + </view>
  27 +
  28 + <!-- 商品列表 -->
  29 + <view class="list-container">
  30 + <scroll-view class="list" scroll-y bindscrolltolower="get_more_list">
  31 + <block wx:for="{{list}}">
  32 + <view class="list-item" bindtap="go_url"
  33 + data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">
  34 + <view class="img-container">
  35 + <image src="{{iurl}}{{item.original_img?item.original_img:'/miniapp/images/default_g_img.gif'}}"
  36 + mode="aspectFit" class="img-block"></image>
  37 + </view>
  38 + <view class="pdl20 flex f1 fdc jc_sb" >
  39 + <view>
  40 + <view class="fs30 ellipsis-2">{{item.goods_name}}</view>
  41 + <view class="c-fa8b2b fs28" wx:if="{{item.zhqty && (item.num<item.zhqty || !item.num)}}">此商品还需购买{{item.zhqty-(item.num?item.num:0)}}件</view>
  42 + <view class="num-container" wx:if="{{item.showNum}}">
  43 + <text class="num-box {{item.num<=1?'c-dedfe3':''}}" catchtap="sub"
  44 + data-index="{{index}}">-</text>
  45 + <text class="num-box">{{item.num}}</text>
  46 + <text class="num-box" catchtap="add" data-index="{{index}}">+</text>
  47 + </view>
  48 + </view>
  49 +
  50 + <view class="flex jc_sb ai_end pdt12">
  51 + <view>
  52 + <!-- 要判断实际价格,因为有等级卡价 -->
  53 + <block wx:if="{{card_field && item[card_field]>0}}">
  54 + <text class="rmb fs30 c-red">{{filters.toFix(item[card_field],2)}}</text>
  55 + </block>
  56 + <block wx:else>
  57 + <text class="rmb fs30 c-red">{{filters.toFix(item.shop_price,2)}}</text>
  58 + </block>
  59 + <text class="rmb fs20 line-through cb">{{filters.toFix(item.market_price,2)}}</text>
  60 + </view>
  61 + <view class="c-red pdr10 {{item.haveAdded ? 'active':''}}" catchtap="addToCart"
  62 + data-index="{{index}}">
  63 + <text class="iconfont icon-gouwuche fs60"></text>
  64 + </view>
  65 + </view>
  66 + </view>
  67 + </view>
  68 + </block>
  69 +
  70 + <nodata wx:if="{{list.length==0 && is_get}}" nodataContainer="t-c"></nodata>
  71 + <view wx:if="{{no_more}}" class="noMore">没有更多了</view>
  72 + </scroll-view>
  73 +
  74 + </view>
  75 +
  76 + <!-- 底部栏 -->
  77 + <view class="bar-container">
  78 + <block wx:if="{{all_num>=act.zhbuyqty}}">
  79 + <view wx:if="{{need_to_buy}}" class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  80 + 再买{{need_to_buy}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  81 + </view>
  82 + <view wx:else class="t-c bg-fcfb c-fa8b2b fs28 pd20">下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】</view>
  83 + </block>
  84 + <block wx:else>
  85 + <view wx:if="{{all_num>0}}" class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  86 + 再买{{act.zhbuyqty-all_num>need_to_buy?act.zhbuyqty-all_num:need_to_buy}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  87 + </view>
  88 + <view wx:else class="t-c bg-fcfb c-fa8b2b fs28 pd20">
  89 + 买{{act.zhbuyqty}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】
  90 + </view>
  91 + </block>
  92 + <view class="flex jc_sb ai_c pd20">
  93 + <view class="fs30">合计:
  94 + <text class="rmb c-red fs40">{{filters.toFix(all_price,2)}}</text>
  95 + <text class="iconfont icon-info cb fs24 mgl10" bindtap="showInfo"></text>
  96 + </view>
  97 + <view bindtap="go_cart" class="btn-container">去购物车</view>
  98 + </view>
  99 + </view>
  100 + <!-- 分享 -->
  101 + <view wx:if="{{imgDraw}}" class="share-container" bindtap="share">
  102 + <text class="iconfont icon-zhuanfa fs40"></text>
  103 + <view class="fs22 c-8">分享</view>
  104 + </view>
  105 +
  106 +
  107 + <!-- 规则详情和提示信息弹窗 -->
  108 + <view class="rule-pop-container" wx:if="{{showRule}}">
  109 + <view class="pop-title">{{!type ? '规则详情':'提示'}}
  110 + <text class="iconfont icon-guan" bindtap="closeRule"></text>
  111 + </view>
  112 + <block wx:if="{{!type}}">
  113 + <view class="pdt40">
  114 + <view class="pdb20">活动时间</view>
  115 + <view class="">{{filters.format_time(act.start_time,1)}} 至 {{filters.format_time(act.end_time,1)}}
  116 + </view>
  117 + </view>
  118 + <view class="pdt40">
  119 + <view class="pdb20">活动内容</view>
  120 + <view class="">
  121 + <view class="pdb10">{{act.remark}}</view>
  122 + </view>
  123 + </view>
  124 + </block>
  125 +
  126 + <!-- 小的提示按钮的展示 -->
  127 + <block wx:else>
  128 + <view class="pdt40 pdb20">
  129 + <view class="">合计金额及提示仅为初步预估,请以最终下单金额为准。</view>
  130 + </view>
  131 + </block>
  132 +
  133 + <view class="pdv20">
  134 + <view class="btn" bindtap="closeRule">我知道了</view>
  135 + </view>
  136 + </view>
  137 +
  138 + <!-- 遮罩层 -->
  139 + <view class="mask" wx:if="{{showMask}}" bindtap="close_all"></view>
  140 + <!-- 海报 -->
  141 + <view class="poster-container" wx:if="{{showPoster}}">
  142 + <view class="t-r pdb20 white2">
  143 + <text class="iconfont icon-close fs40" bindtap="closePoster"></text>
  144 + </view>
  145 + <image src="{{myimg}}" class="poster" show-menu-by-longpress></image>
  146 + <view class="pdt10 fs26 white2">
  147 + <text class="iconfont icon-zhiwen"></text>
  148 + 长按图片保存至相册
  149 + </view>
  150 + </view>
  151 +
  152 +</view>
  153 +
  154 +<painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/>
  155 +<!-- 活动异常提醒 -->
  156 +<catch wx:if="{{error}}">{{error}}</catch>
  157 +<warn id="warn"></warn>
  158 +<!-- 选择门店的弹框,1.1版最新的 -->
  159 +<block wx:if="{{store==1}}">
  160 + <view class="mongolia-layer" bindtap="close_popup"></view>
  161 + <view class="popup-frame">
  162 + <block wx:if="{{sort_store==0}}">
  163 + <!-- 头部 标题 -->
  164 + <view class="popup-top flex-space-between">
  165 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  166 + <view>
  167 + <view>
  168 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  169 + </view>
  170 + <view class="flex choose_more" bindtap="more_store" wx:if="{{is_show_sto_cat>0}}">
  171 + <text class="fs26 red-co" style="line-height: 30rpx;height: 30rpx" >{{choice_sort_store==0?'更多门店':'返回'}}</text>
  172 + <view class="bg_rights" ></view>
  173 + </view>
  174 + </view>
  175 + </view>
  176 + <!-- 门店列表,最外层的门店列表,一开始 -->
  177 + <view class="store-list">
  178 + <!--如果还没有点击更多门店的时候 -->
  179 + <block wx:if="{{choice_sort_store==0}}">
  180 + <!-- 需要for循环 -->
  181 + <block wx:if="{{is_show_sto_cat==1}}">
  182 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir"
  183 + data-ind="{{index}}">
  184 + <view class="store flex-vertical">
  185 + <!-- 需要点击事件 -->
  186 + <block wx:if="{{index==fir_pick_index}}">
  187 + <view class="circle white xc-hook fs20 red-b">Г</view>
  188 + </block>
  189 + <block wx:else>
  190 + <view class="circle xc-hooks"></view>
  191 + </block>
  192 + <view class="address-frame xc-ash">
  193 + <view class="flex-vertical-between butttem5">
  194 + <view class="flex xc-ash">
  195 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  196 + <text wx:if="{{item.pickup_id==is_no_pipei}}" class="c-red">(不匹配)</text>
  197 + </view>
  198 + </view>
  199 + <view>
  200 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  201 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}
  202 + </view>
  203 + </view>
  204 + </view>
  205 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  206 + </view>
  207 + </view>
  208 + </view>
  209 + </block>
  210 + <block wx:else>
  211 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir"
  212 + data-ind="{{index}}">
  213 + <view class="store flex-vertical">
  214 + <!-- 需要点击事件 -->
  215 + <block wx:if="{{index==fir_pick_index}}">
  216 + <view class="circle white xc-hook fs20 red-b">Г</view>
  217 + </block>
  218 + <block wx:else>
  219 + <view class="circle xc-hooks"></view>
  220 + </block>
  221 +
  222 + <view class="address-frame xc-ash">
  223 + <view class="flex-vertical-between ">
  224 + <view class="flex xc-ash">
  225 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  226 + <text wx:if="{{item.pickup_id==is_no_pipei}}" class="c-red">(不匹配)</text>
  227 + </view>
  228 + </view>
  229 + <view>
  230 + <view class="distance fs24 address-val"
  231 + wx:if="{{item.distance!=null}}">
  232 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  233 + </view>
  234 + </view>
  235 + </view>
  236 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  237 + </view>
  238 + </view>
  239 + </view>
  240 + </block>
  241 + </block>
  242 + <block wx:else> <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  243 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}"
  244 + bindtap="choose_for_store">
  245 + <view class="store flex-vertical">
  246 + <!-- 需要点击事件 -->
  247 + <block wx:if="{{index==sec_pick_index}}">
  248 + <view class="circle white xc-hook fs20 red-b">Г</view>
  249 + </block>
  250 + <block wx:else>
  251 + <view class="circle xc-hooks"></view>
  252 + </block>
  253 +
  254 + <view class="address-frame xc-ash">
  255 + <view class="flex-vertical-between ">
  256 + <view class="flex xc-ash">
  257 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  258 + </view>
  259 + <view>
  260 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  261 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  262 + </view>
  263 + </view>
  264 + </view>
  265 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  266 + </view>
  267 + </view>
  268 + </view>
  269 + </block>
  270 +
  271 + </view>
  272 +
  273 + <!-- 门店列表底部 -->
  274 + <view class="store-bottom-frame">
  275 + <view class="store-bottom flex-vertical-between">
  276 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick"
  277 + data-openindstore="{{open_ind_store}}">确定
  278 + </view>
  279 + <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">设为默认
  280 + </view>
  281 + </view>
  282 + </view>
  283 +
  284 + </block>
  285 +
  286 +
  287 + <block wx:else>
  288 + <view class="popup-top flex-space-between">
  289 + <text class="fs32 nearby_store">门店分类选择</text>
  290 + <view>
  291 + <view>
  292 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  293 + </view>
  294 + <view class="felx choose_mores" bindtap="returns">
  295 + <text class="fs26 red-co">返回</text>
  296 + </view>
  297 + </view>
  298 + </view>
  299 + <view class="sort_store_list">
  300 +
  301 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store"
  302 + data-region="{{item.name}}">
  303 + <view class="sort-store flex-vertical-between">
  304 + <view class="fs30" di>{{item.name}}</view>
  305 + <view class="black_rights-frame">
  306 + <view class="black_rights"></view>
  307 + </view>
  308 + </view>
  309 + </view>
  310 +
  311 + </view>
  312 + </block>
  313 + </view>
  314 +</block>
  315 +
  316 +
  317 +
... ...
packageB/pages/zuhegou/preindex/index.wxss 0 → 100644
  1 +/* packageB//pages/zuhegou/index/index.wxss */
  2 +page {
  3 + background: #f5f5f5 linear-gradient(to bottom, #FB5A2F, #FA7958, #f5f5f5 26%) no-repeat;
  4 +}
  5 +.container {
  6 + padding: 20rpx;
  7 +}
  8 +.countdown-container {
  9 + font-size: 26rpx;
  10 + padding-top: 10rpx;
  11 + color: white;
  12 +}
  13 +
  14 +.num-box {
  15 + display: inline-block;
  16 + background-color: rgba(255,255,255,.2);
  17 + box-sizing: border-box;
  18 + min-width: 40rpx;
  19 + padding: 4rpx;
  20 + margin: 0 8rpx;
  21 + border-radius: 6rpx;
  22 + text-align: center;
  23 +}
  24 +
  25 +.rule-container {
  26 + font-size: 24rpx;
  27 + background-color: rgba(255,255,255,.2);
  28 + padding: 10rpx 5rpx 10rpx 20rpx;
  29 + border-radius: 26rpx 0 0 26rpx;
  30 + margin-right: -20rpx;
  31 + color: white;
  32 +}
  33 +
  34 +.icon-arrow_right {
  35 + font-size: 24rpx;
  36 +}
  37 +
  38 +.list-container {
  39 + padding-top: 30rpx;
  40 +}
  41 +
  42 +.list {
  43 + border-radius: 10rpx;
  44 + background-color: white;
  45 + max-height:calc(100vh - 360rpx);
  46 +}
  47 +
  48 +.list-item {
  49 + padding: 20rpx;
  50 + display: flex;
  51 +}
  52 +
  53 +.img-container {
  54 + width: 200rpx;
  55 + height: 200rpx;
  56 + background-color: #f0f0f0;
  57 + border-radius: 8rpx;
  58 +}
  59 +
  60 +.num-container {
  61 + font-size: 28rpx;
  62 + padding-top: 10rpx;
  63 + text-align: right;
  64 +}
  65 +
  66 +.num-container .num-box {
  67 + background-color: #f3f3f3;
  68 +}
  69 +
  70 +
  71 +
  72 +.noMore {
  73 + padding: 20rpx;
  74 + color: #bbb;
  75 + text-align: center;
  76 + font-size: 26rpx;
  77 +}
  78 +
  79 +.rmb::before {
  80 + content: '¥';
  81 + font-size: 22rpx;
  82 +}
  83 +
  84 +.bar-container {
  85 + position: fixed;
  86 + left: 0;
  87 + bottom: 0;
  88 + width: 100%;
  89 + background-color: white;
  90 +}
  91 +
  92 +.bg-fcfb {
  93 + background-color: #FCFBE5;
  94 +}
  95 +
  96 +.c-fa8b2b {
  97 + color: #FA8B2B;
  98 +}
  99 +
  100 +.c-8 {
  101 + color: #888;
  102 +}
  103 +
  104 +.c-dedfe3 {
  105 + color: #DEDFE3;
  106 +}
  107 +
  108 +.btn-container {
  109 + padding: 16rpx 40rpx;
  110 + background-color: red;
  111 + color: white;
  112 + font-size: 30rpx;
  113 + border-radius: 36rpx;
  114 + background: -webkit-linear-gradient(left,#ff5000,#ff2000) no-repeat;
  115 +}
  116 +
  117 +.share-container {
  118 + position: fixed;
  119 + right: 20rpx;
  120 + bottom: 125rpx;
  121 + width: 100rpx;
  122 + height: 100rpx;
  123 + border-radius: 50%;
  124 + background-color: white;
  125 + display: flex;
  126 + flex-direction: column;
  127 + justify-content: center;
  128 + align-items: center;
  129 + box-shadow: 0 0 16rpx #CCC;
  130 +}
  131 +
  132 +.mask {
  133 + position: fixed;
  134 + top: 0;
  135 + bottom: 0;
  136 + left: 0;
  137 + right: 0;
  138 + background-color: rgba(0,0,0,.6);
  139 +}
  140 +
  141 +.rule-pop-container {
  142 + position: fixed;
  143 + left: 0;
  144 + bottom: 0;
  145 + width: 100%;
  146 + background-color: white;
  147 + z-index: 1;
  148 + border-radius: 16rpx 16rpx 0 0;
  149 + padding: 0 40rpx;
  150 + box-sizing: border-box;
  151 + font-size: 28rpx;
  152 + color: #444;
  153 +}
  154 +
  155 +.pop-title {
  156 + padding: 20rpx 0;
  157 + text-align: center;
  158 + font-size: 32rpx;
  159 + position: relative;
  160 +}
  161 +.icon-guan {
  162 + position: absolute;
  163 + right: 0;
  164 + font-size: 26rpx;
  165 + top: 50%;
  166 + transform: translateY(-50%);
  167 + color: #ccc;
  168 +}
  169 +
  170 +.btn {
  171 + color: white;
  172 + padding: 20rpx 0;
  173 + text-align: center;
  174 + border-radius: 40rpx;
  175 + background: -webkit-linear-gradient(left,#ff5000,#ff2000) no-repeat;
  176 +}
  177 +
  178 +.active {
  179 + color: #ccc;
  180 +}
  181 +
  182 +.poster-container {
  183 + text-align: center;
  184 + color: white;
  185 + position: fixed;
  186 + top: 50%;
  187 + left: 50%;
  188 + transform: translate(-50%, -50%);
  189 +}
  190 +
  191 +.poster {
  192 + width: 650rpx;
  193 + height: 843rpx;
  194 + border-radius: 16rpx;
  195 + margin: 0 auto;
  196 +}
  197 +
  198 +.white2 {
  199 + color: rgba(255,255,255,.8);
  200 +}
  201 +
  202 +
  203 +
  204 +/* 选择门店的弹窗 */
  205 +.mongolia-layer{
  206 + position: fixed;
  207 + left: 0;
  208 + top: 0;
  209 + right: 0;
  210 + bottom: 0;
  211 + z-index: 11;
  212 + background: rgba(0,0,0,0.4);
  213 + width: 100%;
  214 + height: 91.9%;
  215 +
  216 +}
  217 +
  218 +.popup-frame{
  219 + position: fixed;
  220 + z-index: 20;
  221 + background: white;
  222 + width: 100%;
  223 + border-radius: 20rpx 20rpx 0 0;
  224 + height: auto;
  225 + bottom: 0;
  226 +}
  227 +.popup-top{
  228 + border-bottom: 1rpx solid #eee;
  229 + height: 155rpx;
  230 + width: 95%;
  231 + margin: auto;
  232 + line-height: 155rpx;
  233 +
  234 +}
  235 +.bg_rights{
  236 + border-top: 2rpx solid ;
  237 + border-right: 2rpx solid ;
  238 + transform: rotate(45deg);
  239 + display:inline-block;
  240 + width:15rpx;height:15rpx;
  241 + border-color:#da0b31;
  242 + position: relative;
  243 + top:5rpx
  244 +}
  245 +.modal-closes {
  246 + position: absolute;
  247 + right: 30rpx;
  248 + top: -15rpx;
  249 + height: 25rpx;
  250 +
  251 +}
  252 +.choose_more{
  253 + margin-top: 100rpx;
  254 + margin-right: 20rpx;
  255 +
  256 +}
  257 +.choose_mores{
  258 + margin-top: 30rpx;
  259 + margin-right: 15rpx;
  260 +
  261 +}
  262 +.store-list{
  263 + width: 95%;
  264 + min-height: 300rpx;
  265 + overflow-y: scroll;
  266 + margin: auto;
  267 + max-height: 610rpx;
  268 +}
  269 +.store-list .store_choose{
  270 + width: 100%;
  271 + height: 120rpx;
  272 + line-height: 125rpx;
  273 + border-bottom: 1rpx solid #eee;
  274 +
  275 +}
  276 +.store-list .store_choose .store{
  277 + width: 100%;
  278 + margin: auto;
  279 + line-height: 37rpx;
  280 + padding-left: 20rpx;
  281 +
  282 +}
  283 +.xc-hook{
  284 + width: 35rpx;
  285 + height: 35rpx;
  286 + transform: rotate(-145deg);
  287 + line-height: 37rpx;
  288 + text-align: center;
  289 +}
  290 +.xc-hooks{
  291 + width: 30rpx;
  292 + height: 30rpx;
  293 + border: 1rpx solid #999;
  294 +}
  295 +.address-frame{
  296 + width: 93%;
  297 + margin-left: 7rpx;
  298 +
  299 +}
  300 +.nearby_store{
  301 + margin-left: 17rpx;
  302 +}
  303 +.address_name{
  304 + margin-right: 10rpx;
  305 +
  306 +}
  307 +.address-val{
  308 + height: 38rpx;
  309 + line-height: 38rpx;
  310 +
  311 +}
  312 +.store-bottom{
  313 + width: 85%;
  314 + margin: auto;
  315 + height: 90rpx;
  316 +}
  317 +.determine{
  318 + width: 260rpx;
  319 + height: 55rpx;
  320 + border-radius: 50rpx;
  321 + line-height: 55rpx;
  322 +}
  323 +.default{
  324 + width: 260rpx;
  325 + height: 55rpx;
  326 + border:3rpx solid #c8c8c8;
  327 + border-radius: 50rpx;
  328 + line-height: 55rpx;
  329 +}
  330 +.store-bottom-frame{
  331 + width: 95%;
  332 + margin: auto;
  333 +
  334 +}
  335 +/* 门店分类列表 */
  336 +.sort_store_list{
  337 + height: 82%;
  338 + overflow: hidden;
  339 + overflow-y: scroll;
  340 + width: 95%;
  341 + margin: auto;
  342 +}
  343 +.sort_store_list .sort-store-frame{
  344 + width: 100%;
  345 + height: 100rpx;
  346 + line-height:100rpx;
  347 + border-bottom: 1rpx solid #eee;
  348 +
  349 +}
  350 +.sort_store_list .sort-store-frame .sort-store{
  351 + width: 94.5%;
  352 + margin: auto;
  353 +}
  354 +
  355 +.c_w{ color: #fff;}
  356 +.mt10{ margin-top: 10rpx;}
  357 +.mt20{ margin-top: 20rpx;}
0 358 \ No newline at end of file
... ...
packageC/pages/presell/list/list.wxml
... ... @@ -27,13 +27,13 @@
27 27  
28 28 <view class="kill-list seckill_list">
29 29 <view class="kill-item" wx:for="{{goodlist}}">
30   - <navigator class="kill-pic rel" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">
  30 + <navigator class="kill-pic rel" url="/packageC/pages/presell/pregoodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">
31 31 <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}"
32 32 data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image>
33 33 </navigator>
34 34 <view class="kill-cont">
35 35 <navigator class="goods-name ellipsis-2"
36   - url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator>
  36 + url="/packageC/pages/presell/pregoodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator>
37 37 <view class="flex-vertical xc-strip-frame">
38 38 <view class="xc-strip-blank rel">
39 39  
... ...