Commit 7365c10e2c4aef305b99a0fa82df53ef6de34d3c

Authored by 前端开发-罗建龙
1 parent 434be1c8

oa单权益门店选择组件

components/store_popup/store_popup.js 0 → 100644
  1 +// components/store_popup.js
  2 +var e = getApp(),
  3 + a = e.globalData.setting,
  4 + os = a
  5 +Component({
  6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + store: {
  11 + type: Number,
  12 + value: 0
  13 + }
  14 + },
  15 + lifetimes: {
  16 + attached: function () {
  17 + // 在组件实例进入页面节点树时执行
  18 + this.init()
  19 + },
  20 + detached: function () {
  21 + // 在组件实例被从页面节点树移除时执行
  22 + },
  23 + },
  24 + /**
  25 + * 组件的初始数据
  26 + */
  27 + data: {
  28 + //门店相关
  29 + ismend: 0,
  30 + is_sec_mend: 0,
  31 + sto_sele_name: "", //选中的门店名称
  32 + sto_sele_id: "", //选中的门店id
  33 + sto_sele_distr: "", //选择的门店的配送方式
  34 + is_show_sto_cat: 1, //是否显示门店分类
  35 + only_pk: null,
  36 + all_sto: null,
  37 + sec_sto: null, //选择了的门店分类
  38 + pickpu_list: null, //读出的所有门店list
  39 + def_pickpu_list: null, //一开始5个门店list
  40 + sec_pick_index: 0, //第二级门店选择ID
  41 + fir_pick_index: 0, //第一级门店选择ID
  42 + all_pick_list: null,//所有的门店先记录起来
  43 +
  44 + select_store: 0, //选择更多
  45 + index: 1,
  46 + more_store: 0, //选择门店
  47 + sort_store: 0, //门店分类
  48 + choice_sort_store: 0, //选择分类门店
  49 + new_user: 0, //新用户
  50 +
  51 + def_pick_store: null, // 默认的门店
  52 + fir_def_store: null, //客户默认的门店的
  53 + lat: null, //维度
  54 + lon: null, //经度
  55 +
  56 + is_get_local_ok: 0, //获取坐标是否完成
  57 + region_name: "门店分类", //区域的名字
  58 + is_gps: 1,
  59 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  60 + default_store: {}, //创建添加默认门店地址的对象
  61 +
  62 +
  63 + openSpecModal: 0,
  64 +
  65 + is_get_guide: 0,
  66 + keyword: '', //门店搜索
  67 + sec_i: -1,//选中分类门店 下标
  68 + },
  69 +
  70 + /**
  71 + * 组件的方法列表
  72 + */
  73 + methods: {
  74 + init() {
  75 + getApp().getConfig2((e) => {
  76 + this.setData({
  77 + bconfig: e,
  78 + });
  79 + })
  80 + this.wait_for_store_config()
  81 + this.set_user_mo_store(() => {
  82 + this.get_sto()
  83 + })
  84 + },
  85 + //开启定位
  86 + wait_for_store_config: function () {
  87 + let th = this
  88 + var t_time = setInterval(function () {
  89 + if (th.data.bconfig == null) false;
  90 + var e = th.data.bconfig;
  91 + if (e && e.is_sort_storage) {
  92 + wx.getLocation({
  93 + type: 'gcj02',
  94 + success: function (res) {
  95 + th.data.lat = res.latitude;
  96 + th.data.lon = res.longitude;
  97 + th.data.is_get_local_ok = 1;
  98 + },
  99 + fail: function (res) {
  100 + if (res.errCode == 2) {
  101 + th.setData({
  102 + is_gps: 0
  103 + });
  104 + if (th.data.is_gps == 0) {
  105 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  106 + }
  107 +
  108 + } else {
  109 + th.setData({
  110 + is_gps: "3"
  111 + });
  112 + }
  113 +
  114 + th.data.is_get_local_ok = 1;
  115 + }
  116 + })
  117 + } else {
  118 + th.data.is_get_local_ok = 1;
  119 + }
  120 + clearInterval(t_time);
  121 + }, 500)
  122 + },
  123 + set_user_mo_store(func) {
  124 + let th = this;
  125 + let that = th;
  126 +
  127 + //获取用户的默认门店
  128 + getApp().get_user_store(function (e) {
  129 + if (!e) {
  130 + th.data.fir_def_store = {}; //赋值空对象
  131 + return false;
  132 + }
  133 +
  134 + if (getApp().globalData.is_dj_pk) th.setData({ has_def: 1 })
  135 +
  136 + var ee = JSON.parse(JSON.stringify(e));
  137 + //--定时器推迟一下--
  138 + setTimeout(function () {
  139 + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
  140 + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
  141 + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
  142 + ee.is_no_dis = 1;
  143 + }
  144 +
  145 + var appd = getApp().globalData;
  146 + var w_time = setInterval(function () {
  147 + if (that.data.is_get_local_ok == 0) return false;
  148 + clearInterval(w_time);
  149 + var distance = null;
  150 + var e = JSON.parse(JSON.stringify(ee));
  151 +
  152 + //如果有开启近距离的话,同时距离优不一样了
  153 + if (that.data.lat != null) {
  154 + //如果经纬度有变化的话
  155 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  156 + that.set_def_storage(e);
  157 + if (func) func();
  158 + } else {
  159 + //要用接口是获取距离,js的计算不准
  160 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  161 + data: {
  162 + store_id: os.stoid,
  163 + pickup_id: e.pickup_id,
  164 + lat: th.data.lat,
  165 + lon: th.data.lon,
  166 + isstop: 0,
  167 + is_pos: 1
  168 + },
  169 + }).then(res => {
  170 + if (res.data.code == 0) {
  171 + e = res.data.data.pageData[0];
  172 + if (e) {
  173 + e.is_no_dis = ee.is_no_dis;
  174 + appd.pk_store = e;
  175 + that.set_def_storage(e);
  176 + }
  177 +
  178 + }
  179 + if (func) func();
  180 + })
  181 + }
  182 + //e.distance = distance;
  183 + appd.lat = that.data.lat;
  184 + appd.lon = that.data.lon;
  185 +
  186 + } else {
  187 + if (e) {
  188 + e.distance = null;
  189 + that.set_def_storage(e);
  190 + }
  191 + if (func) func();
  192 + }
  193 + }, 500)
  194 + }, 700)
  195 + })
  196 +
  197 + },
  198 + //--- 设置一下默认库存的数量 ----
  199 + set_def_storage(ee) {
  200 + var that = this, th = this;
  201 + that.data.fir_def_store = ee;
  202 + that.setData({
  203 + def_pick_store: ee,
  204 + sto_sele_name: ee.pickup_name,
  205 + sto_sele_id: ee.pickup_id,
  206 + sto_sele_distr: ee.distr_type
  207 + })
  208 + },
  209 + //---------拿出门店分类和门店------------
  210 + get_sto() {
  211 + let th = this
  212 + var that = th;
  213 + var self = this;
  214 + var timer_get = setInterval(function () {
  215 + if (th.data.is_get_local_ok == 0) return false;
  216 + var dd = null;
  217 +
  218 + dd = {
  219 + store_id: os.stoid,
  220 + isstop: 0,
  221 + is_pos: 1,
  222 + pageSize: 2000,
  223 + }
  224 +
  225 + //如果有距离的话
  226 + if (th.data.lat != null) {
  227 + dd.lat = th.data.lat;
  228 + dd.lon = th.data.lon;
  229 + }
  230 +
  231 + if (th.data.sele_g && th.data.sele_g.pickup_list) {
  232 + dd.ids = th.data.sele_g.pickup_list
  233 + }
  234 +
  235 + clearInterval(timer_get);
  236 +
  237 + //如果会员是有默认的门店话
  238 + if (!th.data.def_pick_store && th.data.fir_def_store) {
  239 + th.setData({ def_pick_store: th.data.fir_def_store });
  240 + }
  241 + wx.showLoading({
  242 + title: '加载中.'
  243 + });
  244 + //----------获取门店----------------
  245 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  246 + data: dd,
  247 + }).then(res => {
  248 + var e = res;
  249 + wx.hideLoading()
  250 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  251 +
  252 + var his_cate_num = 0;
  253 + for (let i in e.data.data.pageData) {
  254 + let item = e.data.data.pageData[i];
  255 + if (item.category_id > 0) {
  256 + his_cate_num = 1;
  257 + break;
  258 + }
  259 + }
  260 + e.his_cate_num = his_cate_num;
  261 +
  262 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  263 + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  264 + th.setData({
  265 + def_pick_store: e.data.data.pageData[0],
  266 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  267 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  268 + sto_sele_distr: e.data.data.pageData[0].distr_type
  269 + });
  270 + th.data.fir_def_store = e.data.data.pageData[0];
  271 + }
  272 +
  273 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  274 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  275 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  276 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  277 + e.data.data.pageData.splice(k, 1); //删除
  278 + break;
  279 + }
  280 + }
  281 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  282 + }
  283 +
  284 + th.setData({ all_pick_list: e.data.data.pageData });
  285 +
  286 + setTimeout(function () {
  287 +
  288 + self.deal_pickup(e, th, os); //--普通门店排版--
  289 + }, 800)
  290 +
  291 + }
  292 + })
  293 + }, 200)
  294 +
  295 + },
  296 + //---点击二级之后的选择---
  297 + choose_for_store: function (e) {
  298 + var index_c = e.currentTarget.dataset.ind;
  299 + var th = this;
  300 + th.setData({
  301 + sec_pick_index: index_c,
  302 + fir_pick_index: index_c
  303 + })
  304 +
  305 + },
  306 + choose_for_store_fir: function (e) {
  307 + console.log(e);
  308 + var index_c = e.currentTarget.dataset.ind;
  309 + var th = this;
  310 + th.setData({
  311 + fir_pick_index: index_c
  312 + })
  313 +
  314 + },
  315 + close_popup() {
  316 + this.setData({
  317 + store: 0
  318 + })
  319 + },
  320 + //选择更多门店
  321 + more_store: function () {
  322 + this.setData({
  323 + sort_store: 1
  324 + });
  325 + },
  326 + // 返回按钮
  327 + returns: function () {
  328 + this.setData({
  329 + sort_store: 0,
  330 + choice_sort_store: 0
  331 + });
  332 + },
  333 + //---选择分类门店---
  334 + choice_sort_store: function (e) {
  335 + var index = e.currentTarget.dataset.index;
  336 + var region_name = e.currentTarget.dataset.region;
  337 + var item = this.data.all_sto[index];
  338 + this.setData({
  339 + region_name: region_name,
  340 + sort_store: 0,
  341 + choice_sort_store: 1,
  342 + sec_i: index,
  343 + sec_sto: item,
  344 + sec_pick_index: 0
  345 + });
  346 + },
  347 + //------------处理门店---------------
  348 + deal_pickup(e, th, os) {
  349 + // if (!th.data.sele_g) return false
  350 + wx.hideLoading();
  351 + //单总量超出10个的时候,同时门店有分类
  352 + if (e.data.data.total > 10 && e.his_cate_num) {
  353 + getApp().request.get("/api/weshop/storagecategory/page", {
  354 + data: {
  355 + store_id: os.stoid,
  356 + pageSize: 1000,
  357 + orderField: "sort",
  358 + orderType: 'asc',
  359 + },
  360 + success: function (ee) {
  361 + if (ee.data.code == 0) {
  362 + var check_all_cate = 0;
  363 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  364 + for (let i in ee.data.data.pageData) {
  365 + let item = ee.data.data.pageData[i];
  366 + if (item.is_show == 1) {
  367 + check_all_cate = 1;
  368 + break
  369 + }
  370 + }
  371 + }
  372 + if (check_all_cate) {
  373 + var sto_cate = ee.data.data.pageData;
  374 + var sto_arr = e.data.data.pageData;
  375 + var newarr = new Array();
  376 + var qita = new Array();
  377 +
  378 +
  379 + var is_del_pk = 0;
  380 + //----要进行门店分组--------
  381 + for (var i = 0; i < sto_arr.length; i++) {
  382 + //找一下这个门店有没有在分类数组内
  383 + var find2 = 0, find2name = "", sort = 0;
  384 + is_del_pk = 0;
  385 + for (var m = 0; m < sto_cate.length; m++) {
  386 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  387 + if (sto_cate[m].is_show != 1) {
  388 + is_del_pk = 1;
  389 + sto_arr.splice(i, 1);
  390 + i--;
  391 + } else {
  392 + find2 = sto_cate[m].cat_id;
  393 + find2name = sto_cate[m].cat_name;
  394 + sort = sto_cate[m].sort;
  395 + is_del_pk = 0;
  396 + }
  397 + break;
  398 + }
  399 + }
  400 + if (is_del_pk) continue;
  401 +
  402 + if (newarr.length > 0) {
  403 + var find = 0;
  404 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  405 + if (find2 != 0) {
  406 + for (var ii = 0; ii < newarr.length; ii++) {
  407 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  408 + newarr[ii].s_arr.push(sto_arr[i]);
  409 + find = 1;
  410 + break;
  411 + }
  412 + }
  413 + if (find == 0) {
  414 + var arr0 = new Array();
  415 + arr0.push(sto_arr[i]);
  416 + var item = {
  417 + cat_id: find2,
  418 + name: find2name,
  419 + sort: sort,
  420 + s_arr: arr0
  421 + };
  422 + newarr.push(item);
  423 + }
  424 + } else {
  425 + qita.push(sto_arr[i]);
  426 + }
  427 + } else {
  428 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  429 + if (find2 != 0) {
  430 + var arr0 = new Array();
  431 + arr0.push(sto_arr[i]);
  432 + var item = {
  433 + cat_id: find2,
  434 + name: find2name,
  435 + sort: sort,
  436 + s_arr: arr0
  437 + };
  438 + newarr.push(item);
  439 + } else {
  440 + qita.push(sto_arr[i]);
  441 + }
  442 + }
  443 + }
  444 +
  445 + var def_arr = new Array();
  446 + //-- 开始就看10个门店 --
  447 + for (var k = 0; k < 10; k++) {
  448 + if (k == sto_arr.length) break;
  449 + def_arr.push(sto_arr[k]);
  450 + }
  451 +
  452 + th.setData({
  453 + def_pickpu_list: def_arr,
  454 + pickpu_list: ee.data.data.pageData
  455 + });
  456 +
  457 +
  458 + //门店分类要排序下
  459 + function compare(property) {
  460 + return function (a, b) {
  461 + var value1 = a[property];
  462 + var value2 = b[property];
  463 + return value1 - value2;
  464 + }
  465 + }
  466 +
  467 + if (newarr.length > 0)
  468 + newarr.sort(compare("sort"));
  469 +
  470 +
  471 + //----安排其他的分类-----
  472 + if (qita.length > 0) {
  473 + var item = {
  474 + cat_id: -1,
  475 + name: "其他",
  476 + s_arr: qita
  477 + };
  478 + newarr.push(item);
  479 + }
  480 +
  481 + var sd = {
  482 + all_sto: newarr,
  483 + is_show_sto_cat: 1
  484 + }
  485 + if (!sto_arr || sto_arr.length <= 10) {
  486 + sd.is_show_sto_cat = -1;
  487 + sd.only_pk = sto_arr;
  488 + }
  489 + th.setData(sd);
  490 +
  491 + } else {
  492 + th.setData({
  493 + is_show_sto_cat: -1,
  494 + only_pk: e.data.data.pageData
  495 + });
  496 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  497 + if (!th.data.def_pick_store) {
  498 + th.setData({
  499 + def_pick_store: e.data.data.pageData[0],
  500 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  501 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  502 + sto_sele_distr: e.data.data.pageData[0].distr_type
  503 + })
  504 + }
  505 + }
  506 + } else {
  507 + th.setData({
  508 + is_show_sto_cat: -1,
  509 + only_pk: e.data.data.pageData
  510 + });
  511 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  512 + if (!th.data.def_pick_store) {
  513 + th.setData({
  514 + def_pick_store: e.data.data.pageData[0],
  515 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  516 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  517 + sto_sele_distr: e.data.data.pageData[0].distr_type
  518 + })
  519 + }
  520 +
  521 + }
  522 + }
  523 + });
  524 + } else {
  525 + th.setData({
  526 + is_show_sto_cat: 0,
  527 + only_pk: e.data.data.pageData
  528 + });
  529 + //-----如果没有默认门店,要取第一个门店作为默认店------
  530 + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  531 + th.setData({
  532 + def_pick_store: e.data.data.pageData[0],
  533 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  534 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  535 + sto_sele_distr: e.data.data.pageData[0].distr_type
  536 + })
  537 + }
  538 + }
  539 + },
  540 +
  541 + check_def_pk: function () {
  542 + let th = this
  543 + th.data.def_pick_store.is_no_dis = 0;
  544 + var def_pick_store = th.data.def_pick_store
  545 + var sele_g = th.data.sele_g;
  546 + var arr = sele_g.pickup_list.split(',');
  547 +
  548 + var idx = arr.findIndex(function (e) {
  549 + return e == def_pick_store.pickup_id;
  550 + })
  551 +
  552 + if (idx == -1) {
  553 + def_pick_store.is_no_dis = 1;
  554 + }
  555 + th.setData({ def_pick_store })
  556 +
  557 + },
  558 + //获取搜索门店输入的值
  559 + input_store: function (e) {
  560 + this.setData({
  561 + keyword: e.detail.value
  562 + })
  563 + },
  564 + //搜索门店
  565 + searchfn() {
  566 + let choice_sort_store = this.data.choice_sort_store
  567 + if (choice_sort_store == 0) { //全局搜索
  568 + let all_pick_list = this.data.all_pick_list
  569 + let def_pickpu_list = this.data.def_pickpu_list
  570 + let keyword = this.data.keyword
  571 + if (keyword) {
  572 + let arr = all_pick_list.filter(item => {
  573 + let i = item.pickup_name.indexOf(keyword)
  574 + if (i > -1) {
  575 + return true
  576 + } else {
  577 + return false
  578 + }
  579 + })
  580 + if (arr && arr.length > 0) {
  581 + if (this.data.is_show_sto_cat == 1) {
  582 + this.setData({
  583 + def_pickpu_list: arr
  584 + })
  585 + } else {
  586 + this.setData({
  587 + only_pk: arr
  588 + })
  589 + }
  590 + } else {
  591 + wx.showToast({
  592 + title: '没有搜索到门店',
  593 + icon: 'none',
  594 + duration: 2000
  595 + })
  596 + }
  597 + } else {
  598 + if (this.data.is_show_sto_cat == 1) {
  599 + this.setData({
  600 + def_pickpu_list: all_pick_list.slice(0, 10)
  601 + })
  602 + } else {
  603 + this.setData({
  604 + only_pk: all_pick_list
  605 + })
  606 + }
  607 +
  608 + }
  609 + } else { //分类下搜索
  610 + let sec_i = this.data.sec_i
  611 + let all_sto = this.data.all_sto
  612 + let sec_sto = this.data.sec_sto
  613 + let sec_arr = sec_sto.s_arr
  614 + let keyword = this.data.keyword
  615 + let text = 'sec_sto.s_arr'
  616 + if (keyword) {
  617 + let arr = sec_arr.filter(item => {
  618 + let i = item.pickup_name.indexOf(keyword)
  619 + if (i > -1) {
  620 + return true
  621 + } else {
  622 + return false
  623 + }
  624 + })
  625 + if (arr && arr.length > 0) {
  626 + this.setData({
  627 + [text]: arr
  628 + })
  629 + } else {
  630 + wx.showToast({
  631 + title: '没有搜索到门店',
  632 + icon: 'none',
  633 + duration: 2000
  634 + })
  635 + }
  636 + } else {
  637 + console.error(sec_i);
  638 + console.log(all_sto);
  639 + console.error(all_sto[sec_i].s_arr);
  640 + this.setData({
  641 + [text]: all_sto[sec_i].s_arr
  642 + })
  643 + }
  644 +
  645 +
  646 + }
  647 + },
  648 + //确定def_pick为选择的门店
  649 + sure_pick: function (e) {
  650 +
  651 + var th = this;
  652 + var item = null;
  653 + var openindstore = th.data.open_ind_store;
  654 + if (th.data.choice_sort_store == 0) {
  655 + var index = th.data.fir_pick_index;
  656 + if (th.data.is_show_sto_cat == 1) {
  657 + item = th.data.def_pickpu_list[index];
  658 + } else {
  659 + item = th.data.only_pk ? th.data.only_pk[index] : null; //当没有门店分类的时候
  660 + }
  661 + } else {
  662 + var index = th.data.sec_pick_index;
  663 + item = th.data.sec_sto.s_arr[index];
  664 + }
  665 +
  666 + if (!item) return false;
  667 +
  668 + // if (!th.data.sele_g) return false;
  669 +
  670 + console.error('选中的门店');
  671 + console.error(item);
  672 +
  673 + th.setData({
  674 + def_pick_store: item,
  675 + sto_sele_name: item.pickup_name,
  676 + sto_sele_id: item.pickup_id,
  677 + sto_sele_distr: item.distr_type,
  678 + store: 0,
  679 + choice_sort_store: 0,
  680 + fir_pick_index: 0,
  681 + openSpecModal: !0,
  682 + });
  683 +
  684 +
  685 + },
  686 + }
  687 +})
components/store_popup/store_popup.json 0 → 100644
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
0 \ No newline at end of file 5 \ No newline at end of file
components/store_popup/store_popup.wxml 0 → 100644
  1 +<!--components/store_popup.wxml-->
  2 +<wxs module="filter" src="/utils/filter.wxs"></wxs>
  3 +<block wx:if="{{store}}">
  4 + <view class="mongolia-layer" bindtap="close_popup"></view>
  5 + <view class="popup-frame">
  6 + <block wx:if="{{sort_store==0}}">
  7 + <!-- 头部 标题 -->
  8 + <view class="popup-top flex-space-between">
  9 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  10 + <view>
  11 + <view>
  12 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  13 + </view>
  14 + <view class="felx choose_more" bindtap="more_store" wx:if="{{is_show_sto_cat>0}}">
  15 + <text class="fs26 red-co" >{{choice_sort_store==0?'更多门店':'返回'}}</text> <view class="bg_rights" ></view>
  16 + </view>
  17 + </view>
  18 + </view>
  19 + <view class="searchbar flex-vertical-between storeListpadd">
  20 + <input class="inputstore fs28" placeholder="输入要搜索的门店" value="{{keyword}}" placeholder-class="fs28" maxlength="16" bindinput="input_store" bindconfirm="searchfn" />
  21 + <view class="search flex-center" bindtap="searchfn">
  22 + <view class="fs28">搜索</view>
  23 + </view>
  24 + </view>
  25 + <!-- 门店列表,最外层的门店列表,一开始 -->
  26 + <view class="store-list">
  27 + <!-- 如果还没有点击更多门店的时候 -->
  28 + <block wx:if="{{choice_sort_store==0}}">
  29 + <!-- 需要for循环 -->
  30 + <block wx:if="{{is_show_sto_cat==1}}">
  31 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  32 + <view class="store flex-vertical">
  33 + <!-- 需要点击事件 -->
  34 + <block wx:if="{{index==fir_pick_index}}">
  35 + <view class="circle white xc-hook fs20 red-b">Г</view>
  36 + </block>
  37 + <block wx:else>
  38 + <view class="circle xc-hooks"></view>
  39 + </block>
  40 + <view class="address-frame xc-ash">
  41 + <view class="flex-vertical-between butttem5">
  42 + <view class="flex xc-ash">
  43 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  44 + </view>
  45 + <view>
  46 + <view class="distance fs24 address-val" wx:if="{{item.distance}}">
  47 + 距离:{{ item.distance>1000 ? filter.toFix(item.distance/1000,2)+'km' : filter.toFix(item.distance,0)+"m"}}
  48 + </view>
  49 + </view>
  50 + </view>
  51 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  52 + </view>
  53 + </view>
  54 + </view>
  55 + </block>
  56 + <block wx:else>
  57 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  58 + <view class="store flex-vertical">
  59 + <!-- 需要点击事件 -->
  60 + <block wx:if="{{index==fir_pick_index}}">
  61 + <view class="circle white xc-hook fs20 red-b">Г</view>
  62 + </block>
  63 + <block wx:else>
  64 + <view class="circle xc-hooks"></view>
  65 + </block>
  66 + <view class="address-frame xc-ash">
  67 + <view class="flex-vertical-between ">
  68 + <view class="flex xc-ash">
  69 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  70 + </view>
  71 + <view>
  72 + <view class="distance fs24 address-val" wx:if="{{item.distance}}">
  73 + 距离:{{ item.distance>1000 ? filter.toFix(item.distance/1000,2)+"km" : filter.toFix(item.distance,0)+"m"}}
  74 + </view>
  75 + </view>
  76 + </view>
  77 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  78 + </view>
  79 + </view>
  80 + </view>
  81 + </block>
  82 + </block>
  83 + <block wx:else>
  84 + <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  85 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store">
  86 + <view class="store flex-vertical">
  87 + <!-- 需要点击事件 -->
  88 + <block wx:if="{{index==sec_pick_index}}">
  89 + <view class="circle white xc-hook fs20 red-b">Г</view>
  90 + </block>
  91 + <block wx:else>
  92 + <view class="circle xc-hooks"></view>
  93 + </block>
  94 + <view class="address-frame xc-ash">
  95 + <view class="flex-vertical-between ">
  96 + <view class="flex xc-ash">
  97 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  98 + </view>
  99 + <view>
  100 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  101 + 距离:{{item.distance>1000?filter.toFix(item.distance/1000,2)+"km":filter.toFix(item.distance,0)+"m"}}
  102 + </view>
  103 + </view>
  104 + </view>
  105 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  106 + </view>
  107 + </view>
  108 + </view>
  109 + </block>
  110 + </view>
  111 + <!-- 门店列表底部 -->
  112 + <view class="store-bottom-frame">
  113 + <view class="store-bottom flex-center">
  114 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick" data-openindstore="{{open_ind_store}}">
  115 + 确定
  116 + </view>
  117 + <!-- <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">
  118 + 设为默认
  119 + </view> -->
  120 + </view>
  121 + </view>
  122 + </block>
  123 + <block wx:else>
  124 + <view class="popup-top flex-space-between">
  125 + <text class="fs32 nearby_store">门店分类选择</text>
  126 + <view>
  127 + <view>
  128 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  129 + </view>
  130 + <view class="felx choose_mores" bindtap="returns">
  131 + <text class="fs26 red-co">返回</text>
  132 + </view>
  133 + </view>
  134 + </view>
  135 + <view class="sort_store_list">
  136 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
  137 + <view class="sort-store flex-vertical-between">
  138 + <view class="fs30" di>{{item.name}}</view>
  139 + <view class="black_rights-frame">
  140 + <view class="black_rights"></view>
  141 + </view>
  142 + </view>
  143 + </view>
  144 + </view>
  145 + </block>
  146 + </view>
  147 +</block>
components/store_popup/store_popup.wxss 0 → 100644
  1 +/* 中间等距两边贴边 */
  2 +.flex-space-between{
  3 + display: flex;
  4 + justify-content:space-between;
  5 +}
  6 +.flex{display: flex}
  7 +/* 垂直居中 */
  8 +.flex-vertical{
  9 + display:flex;
  10 + align-items:center;
  11 + }
  12 + /* 圆 */
  13 +.circle{
  14 + border-radius: 50%;
  15 + -moz-border-radius: 50%;
  16 + -webkit-border-radius: 50%;
  17 +}
  18 +/* 7.26 */
  19 +.white{
  20 + color: #fff;
  21 +}
  22 +.red-b{
  23 + background: #d60021;
  24 +}
  25 +.fs20{
  26 + font-size: 20rpx;
  27 +}
  28 +.xc-ash{
  29 + color: #b9b9b9;
  30 + }
  31 +/* 水平垂直 */
  32 +.flex-center{
  33 + display:flex;
  34 + justify-content:center;
  35 + align-items:center;
  36 + }
  37 +/* 垂直居中 中间等距两边贴边 7.13*/
  38 +.flex-vertical-between{
  39 + display:flex;
  40 + align-items:center;
  41 + justify-content:space-between;
  42 + }
  43 + .xc-ash{
  44 + color: #b9b9b9;
  45 + }
  46 + .fs30{
  47 + font-size:30rpx;
  48 +}
  49 +.xc-black3{
  50 + color: #333;
  51 +}
  52 + .fs28{
  53 + font-size: 28rpx;
  54 +}
  55 + .fs32{
  56 + font-size:32rpx;
  57 +}
  58 +.fs26{
  59 + font-size: 26rpx;
  60 +}
  61 +.red-co{
  62 + color: #d60021;
  63 +
  64 +}
  65 +/* 门店分类列表 */
  66 +.sort_store_list {
  67 + max-height: 700rpx;
  68 + overflow: hidden;
  69 + overflow-y: scroll;
  70 + width: 95%;
  71 + margin: auto;
  72 +}
  73 +
  74 +.sort_store_list .sort-store-frame {
  75 + width: 100%;
  76 + height: 100rpx;
  77 + line-height: 100rpx;
  78 + border-bottom: 1rpx solid #eee;
  79 +
  80 +}
  81 +
  82 +.sort_store_list .sort-store-frame .sort-store {
  83 + width: 94.5%;
  84 + margin: auto;
  85 +}
  86 +.black_rights-frame {
  87 + width: 50%;
  88 +}
  89 +.black_rights-frame .black_rights {
  90 + border-top: 3rpx solid;
  91 + border-right: 3rpx solid;
  92 + transform: rotate(45deg);
  93 + display: inline-block;
  94 + width: 20rpx;
  95 + height: 20rpx;
  96 +}
  97 +/* 选择门店的弹窗 */
  98 +.mongolia-layer {
  99 + position: fixed;
  100 + left: 0;
  101 + top: 0;
  102 + right: 0;
  103 + bottom: 0;
  104 + z-index: 11;
  105 + background: rgba(0, 0, 0, 0.4);
  106 + width: 100%;
  107 + height: 91.9%;
  108 +
  109 +}
  110 +
  111 +.popup-frame {
  112 + position: fixed;
  113 + z-index: 20;
  114 + background: white;
  115 + width: 100%;
  116 + border-radius: 20rpx 20rpx 0 0;
  117 + height: auto;
  118 + bottom: 0;
  119 +}
  120 +
  121 +.popup-top {
  122 + border-bottom: 1rpx solid #eee;
  123 + height: 155rpx;
  124 + width: 95%;
  125 + margin: auto;
  126 + line-height: 155rpx;
  127 +
  128 +}
  129 +.fs32{
  130 + font-size: 32rpx;
  131 +}
  132 +.nearby_store {
  133 + margin-left: 17rpx;
  134 +}
  135 +.modal-closes {
  136 + position: absolute;
  137 + right: 30rpx;
  138 + top: -15rpx;
  139 + height: 25rpx;
  140 +
  141 +}
  142 +.choose_mores {
  143 + margin-top: 30rpx;
  144 + margin-right: 15rpx;
  145 +
  146 +}
  147 +.choose_more {
  148 + margin-top: 40rpx;
  149 + margin-right: 20rpx;
  150 +
  151 +}
  152 +.bg_rights {
  153 + border-top: 2rpx solid;
  154 + border-right: 2rpx solid;
  155 + transform: rotate(45deg);
  156 + display: inline-block;
  157 + width: 15rpx;
  158 + height: 15rpx;
  159 + border-color: #da0b31;
  160 +}
  161 +.searchbar {
  162 + height: 95rpx;
  163 + border-bottom: 2rpx solid rgb(238, 238, 238);
  164 +}
  165 +.storeListpadd {
  166 + padding: 0rpx 31rpx;
  167 +}
  168 +.search {
  169 + width: 125rpx;
  170 + height: 45rpx;
  171 + line-height: 45rpx;
  172 + background-color: rgb(219, 27, 52);
  173 + border-radius: 30rpx;
  174 + color: rgb(255, 255, 255);
  175 +}
  176 +.inputstore {
  177 + width: 510rpx;
  178 + height: 43rpx;
  179 + line-height: 43rpx;
  180 + border-radius: 30rpx;
  181 + border: 2rpx solid rgb(238, 238, 238);
  182 + padding-left: 30rpx;
  183 +}
  184 +
  185 +.store-list {
  186 + width: 95%;
  187 + min-height: 300rpx;
  188 + overflow-y: scroll;
  189 + margin: auto;
  190 + max-height: 610rpx;
  191 +}
  192 +.store-list .store_choose {
  193 + width: 100%;
  194 + height: 120rpx;
  195 + line-height: 125rpx;
  196 + border-bottom: 1rpx solid #eee;
  197 + padding: 10rpx 0;
  198 +}
  199 +
  200 +.store-list .store_choose .store {
  201 + width: 100%;
  202 + margin: auto;
  203 + line-height: 37rpx;
  204 + padding-left: 20rpx;
  205 +
  206 +}
  207 +.xc-hook {
  208 + width: 35rpx;
  209 + height: 35rpx;
  210 + transform: rotate(-145deg);
  211 + line-height: 37rpx;
  212 + text-align: center;
  213 +}
  214 +.address-frame {
  215 + width: 93%;
  216 + margin-left: 7rpx;
  217 +
  218 +}
  219 +.address_name {
  220 + margin-right: 10rpx;
  221 + width: 360rpx;
  222 +
  223 +}
  224 +.fs24{
  225 + font-size: 24rpx !important;
  226 +}
  227 +.xc-ash-9f{
  228 + color: #9fa1a0;
  229 +
  230 +}
  231 +.t-c {
  232 + text-align: center;
  233 +}
  234 +.distance {
  235 + padding-left: 20rpx;
  236 + padding-right: 20rpx;
  237 + background: #eee;
  238 + border-radius: 20rpx;
  239 + /* margin-right: 5rpx; */
  240 + color: #999;
  241 + height: 38rpx;
  242 + line-height: 38rpx;
  243 + position: relative;
  244 + top: 5rpx;
  245 +
  246 +}
  247 +.address-val {
  248 + height: 38rpx;
  249 + line-height: 38rpx;
  250 +
  251 +}
  252 +.butttem5 {
  253 + margin-bottom: 5rpx;
  254 +}
  255 +.store-bottom-frame {
  256 + width: 95%;
  257 + margin: auto;
  258 +
  259 +}
  260 +.store-bottom {
  261 + width: 85%;
  262 + margin: auto;
  263 + height: 90rpx;
  264 +}
  265 +.determine {
  266 + width: 260rpx;
  267 + height: 55rpx;
  268 + border-radius: 50rpx;
  269 + line-height: 55rpx;
  270 +}
  271 +
  272 +.default {
  273 + width: 260rpx;
  274 + height: 55rpx;
  275 + border: 3rpx solid #c8c8c8;
  276 + border-radius: 50rpx;
  277 + line-height: 55rpx;
  278 +}
  279 +.xc-hooks {
  280 + width: 30rpx;
  281 + height: 30rpx;
  282 + border: 1rpx solid #999;
  283 +}
0 \ No newline at end of file 284 \ No newline at end of file
pages/user/user_spsy/user_spsy.js
@@ -159,5 +159,11 @@ Page({ @@ -159,5 +159,11 @@ Page({
159 159
160 close: function () { 160 close: function () {
161 this.getQrCode(this.data.FormId) 161 this.getQrCode(this.data.FormId)
  162 + },
  163 +
  164 + select_product(){
  165 + this.setData({
  166 + store:1
  167 + })
162 } 168 }
163 }) 169 })
164 \ No newline at end of file 170 \ No newline at end of file
pages/user/user_spsy/user_spsy.json
1 { 1 {
2 "navigationBarTitleText": "免费领取", 2 "navigationBarTitleText": "免费领取",
3 "usingComponents": { 3 "usingComponents": {
4 - "qr_code": "/components/qr_code/qr_code" 4 + "qr_code": "/components/qr_code/qr_code",
  5 + "store_popup":"/components/store_popup/store_popup"
5 } 6 }
6 } 7 }
7 \ No newline at end of file 8 \ No newline at end of file
pages/user/user_spsy/user_spsy.wxml
@@ -13,10 +13,14 @@ @@ -13,10 +13,14 @@
13 已使用{{list[0].freebh}} 13 已使用{{list[0].freebh}}
14 </view> --> 14 </view> -->
15 <view wx:if="{{is_use}}" class="btn1">已使用</view> 15 <view wx:if="{{is_use}}" class="btn1">已使用</view>
16 - <view wx:else bindtap="show_hxm" data-type="1" class="btn">立即使用</view> 16 + <!-- <view wx:else bindtap="show_hxm" data-type="1" class="btn">立即使用</view> -->
  17 + <view wx:else bindtap="select_product" data-type="1" class="btn">选门店</view>
17 <!-- <view bindtap="right_use" class="btn">立即使用</view></view> --> 18 <!-- <view bindtap="right_use" class="btn">立即使用</view></view> -->
18 </view> 19 </view>
19 </view> 20 </view>
20 21
21 <!-- 弹出框扫描 --> 22 <!-- 弹出框扫描 -->
22 -<qr_code id="qc_com" bindclose="close"></qr_code>  
23 \ No newline at end of file 23 \ No newline at end of file
  24 +<qr_code id="qc_com" bindclose="close"></qr_code>
  25 +
  26 +<!-- 门店选择弹窗 -->
  27 +<store_popup store="{{store}}" ></store_popup>
24 \ No newline at end of file 28 \ No newline at end of file