Commit a7eb046ecb318d684ef415ad3272da94cbda752a

Authored by antploy
1 parent 016529b1

分销小店新增分类功能

app.json
... ... @@ -160,7 +160,10 @@
160 160 "pages": [
161 161 "pages/presell/list/list",
162 162 "pages/presell/cart/cart",
163   - "pages/presell/goodsInfo/goodsInfo"
  163 + "pages/presell/goodsInfo/goodsInfo",
  164 + "pages/goods/distributionCategoryList/index",
  165 + "pages/goods/goodsList/goodsList",
  166 + "pages/payForAnother/payForAnother"
164 167 ]
165 168 }
166 169  
... ...
packageC/pages/goods/distributionCategoryList/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 +
  20 + var arr=[];
  21 + var min_price= 0;
  22 + var min_name="";
  23 +
  24 + var min_price=null;
  25 + var min_name=null;
  26 + //---设置对应的价格名字----
  27 + for(var i=0;i<3;i++) {
  28 + var vl=all_card[i];
  29 + if(!vl) continue;
  30 + if(vl['CorrPrice']=="Price1" && price1>0)
  31 + {
  32 +
  33 + if(min_price==null) {
  34 + min_price=price1;min_name=vl['CardName'];
  35 + }
  36 + else if(price1<min_price) {
  37 + min_price=price1;min_name=vl['CardName'];
  38 + }
  39 + }
  40 + if(vl['CorrPrice']=="Price2" && price2>0)
  41 + {
  42 + if(min_price==null) {
  43 + min_price=price2;min_name=vl['CardName'];
  44 + }
  45 + else if(price2<min_price) {
  46 + min_price=price2;min_name=vl['CardName'];
  47 + }
  48 + }
  49 +
  50 + if(vl['CorrPrice']=="Price3" && price3>0)
  51 + {
  52 + if(min_price==null) {
  53 + min_price=price3;min_name=vl['CardName'];
  54 + }
  55 + else if(price3<min_price) {
  56 + min_price=price3;min_name=vl['CardName'];
  57 + }
  58 + }
  59 +
  60 + }
  61 +
  62 +
  63 + if(min_price==null){
  64 + if(type==0) return 0;
  65 + return "";
  66 + }
  67 +
  68 +
  69 + //if(type==0) return arr.length;
  70 + //--进行排序,升序---
  71 + /*---
  72 + arr.sort(function(a,b){
  73 + if (a.price < b.price) {
  74 + return -1;
  75 + } else if (a.fee == b.fee) {
  76 + return 0;
  77 + } else {
  78 + return 1;
  79 + }
  80 + })--*/
  81 + //-- 获取最下价钱,和相应的卡的名称 --
  82 + if(type==0) return min_price.toFixed(2);
  83 +
  84 + if(min_name.length>4) min_name=min_name.substring(0, 8);
  85 + return min_name;
  86 + },
  87 +}
  88 +module.exports = {
  89 + is_has_rank:g_filters.is_has_rank,
  90 + get_card_price:g_filters.get_card_price,
  91 +}
0 92 \ No newline at end of file
... ...
packageC/pages/goods/distributionCategoryList/index.js 0 → 100644
  1 +const { app } = require("../../../../utils/common");
  2 +let startY = 0;
  3 +let endY = 0;
  4 +let scrolltop = 0;
  5 +let moveDistance = 0;
  6 +const t = getApp(), e = t.request, oo = t.globalData.setting;
  7 +var i = function (i) {
  8 + return i && i.__esModule ? i : {
  9 + default: i
  10 + };
  11 +}(require("../../../../utils/LoadMore")), a = new i.default(), ut = require("../../../../utils/util.js");
  12 +//t = i,e = t
  13 +Page({
  14 + data: {
  15 + is_date: true,
  16 + scrollHeight: 0,
  17 + currentTab: -1,
  18 + abc: 0,
  19 + windowHeight: 0,
  20 + windowWidth: 0,
  21 + eachLetterHeight: 0,
  22 + lettersPosition: 0,
  23 + catelist: null, //分类读取
  24 + nationlist: null,//国家读取
  25 + groups: null, //品牌读取
  26 + iurl: oo.imghost,//图片地址
  27 +
  28 + //控制新旧分类版本
  29 + is_used_share: 0,
  30 + //国家的控制属性
  31 + is_country: 1,
  32 + //品牌的控制属性
  33 + is_brand: 1,
  34 + //选择分类的控制属性
  35 + select_classify_on: 223,
  36 + index: 223,
  37 + classify_name: "国家",//项目类型
  38 + brand_list: null,//品牌列表
  39 +
  40 + catelist: [],// 新的版本左边的边分类1级
  41 + is_level_three: 0,//判断有没有3级
  42 + cat_id: 0,
  43 + pl_timer: null,//只有品类的定时器
  44 + is_pl_time: 0,
  45 + requestData: null, //风格三的商品数据列表 分页
  46 + stylePage: 1, //商品列表分页标识
  47 +
  48 + //风格三使用
  49 + url: t.globalData.setting.imghost,
  50 + currentPage: 1,
  51 + allData: null,
  52 + openFilterModal: !1,
  53 + baseUrl: "/api/weshop/users/distribut/pagemyshop?orderType=desc",
  54 + requestUrl: "",
  55 + tabname: "goods_id", //排序的字段
  56 + adname: "desc", //升降的字段
  57 + is_new: 0,
  58 + is_hot: 0,
  59 + msgStatus: false, //页面显示暂无数据状态
  60 + countDownNum: 3,
  61 + timer: '', //定时器
  62 + lastMsg: false,
  63 + toView: "",
  64 + is_show_class: false,//是否添加新样式
  65 + status_show: 0,
  66 + currentTab: 0, //预设当前项的值
  67 + load: 0,
  68 + },
  69 +
  70 +
  71 + //判断当前滚动超过一屏时,设置tab标题滚动条。
  72 + checkCor: function () {
  73 + let that = this;
  74 + //这里计算按照实际情况进行修改,动态数据要进行动态分析
  75 + //思路:窗体高度/单个分类高度 200rpx 转px计算 =>得到一屏幕所显示的个数,结合后台传回分类总数进行计算
  76 + //数据很多可以多次if判断然后进行滚动距离计算即可
  77 + if (that.data.currentTab > 7) {
  78 + that.setData({
  79 + scrollTop: 500
  80 + })
  81 + } else {
  82 + that.setData({
  83 + scrollTop: 0
  84 + })
  85 + }
  86 + },
  87 + /* onPageScroll(e){
  88 + console.log(e);
  89 + },
  90 + calcHeight: function calcHeight(callback) {
  91 + var query = this.createSelectorQuery();
  92 + query.select('.weui-vtabs-content__item').boundingClientRect(function (rect) {
  93 + callback && callback(rect);
  94 + }).exec();
  95 +}, */
  96 +
  97 + onLoad: function (tt) {
  98 + wx.setNavigationBarTitle({
  99 + title: "分类",
  100 + });
  101 + var that = this;//保存全局指针
  102 + t.isLogin().then(function (data) {//进入页面前已经授权登录成功
  103 + console.log(data);
  104 + that.setData({
  105 + userInfo: data,
  106 + });
  107 + });
  108 + var first_leader = tt.first_leader;
  109 + if (first_leader) {
  110 + //-- user_id代过来免登录 --
  111 + getApp().globalData.first_leader = first_leader;
  112 + }
  113 +
  114 + that.get_brand();
  115 + clearInterval(that.data.timer);
  116 + that.setData({ countDownNum: 3, stylePage: 1 });
  117 +
  118 + const res = wx.getSystemInfoSync(),
  119 + letters = this.data.letters;
  120 + this.setData({
  121 + abc: t.globalData.heigth - 88 - 88 - 16,
  122 + windowHeight: res.windowHeight,
  123 + windowWidth: res.windowWidth,
  124 +
  125 + });
  126 +
  127 + if (this.data.is_used_share == 0) {
  128 + this.get_nation();
  129 + }
  130 +
  131 + getApp().getConfig2(function (e) {
  132 + var data = e;
  133 + var switch_list_data = data.switch_list;
  134 + var switch_list = JSON.parse(switch_list_data);
  135 + var is_newsgoodstype = switch_list.is_newsgoodstype;
  136 + if (is_newsgoodstype == undefined) {
  137 + is_newsgoodstype = 0;
  138 + }
  139 + that.setData({ is_used_share: is_newsgoodstype });
  140 + if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); }
  141 + if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); }
  142 + if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); }
  143 + that.setData({ store_config: e, is_do: 1 });
  144 +
  145 + //---有勾品类---
  146 + if (that.data.is_show_pl) {
  147 + that.getGoodsCategoris();
  148 + }
  149 + if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) {
  150 + that.data.pl_timer = setInterval(function () {
  151 + if (that.data.catelist.length > 0) {
  152 + console.log(catelist);
  153 + var item = that.data.catelist[0], arr = item.array;
  154 + //----如果有下级的时候-----
  155 + if (item.array && item.array.length > 0) {
  156 + var is_lev_thr = 0
  157 + for (var i = 0; i < arr.length; i++) {
  158 + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
  159 + }
  160 + that.setData({ is_level_three: is_lev_thr });
  161 + if (is_lev_thr != 1) {
  162 + that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: item.array });
  163 + console.log("id:=" + item.items.id)
  164 + that.style(that.data.stylePage, that.data.cat_id);
  165 + } else {
  166 + that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: arr });
  167 + console.log("id:=" + item.items.id)
  168 + that.style(that.data.stylePage, that.data.cat_id);
  169 + }
  170 + }
  171 + else {
  172 + that.setData({ select_classify_on: 0, index: 0, goodslist: null, classify_name: item.items.name, is_level_three: 0 });
  173 + }
  174 + clearInterval(that.data.pl_timer);
  175 + }
  176 + }, 1000);
  177 +
  178 + } else if (that.data.is_show_gb != 1 && that.data.is_show_pp) {
  179 + that.setData({ select_classify_on: 220, classify_name: "品牌" });
  180 + }
  181 +
  182 + //---如果后台又开等级卡的开关---
  183 + if (switch_list.rank_switch && switch_list.rank_switch == "2") {
  184 + that.setData({ rank_switch: true });
  185 + var user = getApp().globalData.userInfo;
  186 + var ti = setInterval(function () {
  187 + if (!user) return false;
  188 + clearInterval(ti);
  189 + //---回调卡的列表---
  190 + that.getPlusCardType(function (ob) {
  191 + that.setData({ card_list: ob.card_list });
  192 + if (user.card_field && user['card_expiredate']) {
  193 + var str = user['card_expiredate'].replace(/-/g, '/');
  194 + var end = new Date(str);
  195 + end = Date.parse(end) / 1000;
  196 + var now = ut.gettimestamp();
  197 +
  198 + //--- 判断是等级会员,且在有效期范围内 ---
  199 + if (user.card_field && now < end) {
  200 + var card_name = ob.name_map.get(user.card_field);
  201 + //if (card_name.length > 4) card_name = card_name.substring(0, 4);
  202 + that.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  203 + }
  204 + }
  205 + })
  206 + }, 500)
  207 + }
  208 + var catelist = that.data.catelist;
  209 +
  210 + if (that.data.is_show_pl) that.setData({ currentTab: 0 });
  211 + else if (that.data.is_show_gb) { that.setData({ currentTab: 1 }); that.get_nation(); }
  212 + else if (that.data.is_show_pp) { that.setData({ currentTab: 2 }); that.get_brand(); }
  213 +
  214 + //----求传参过来的控制-----
  215 + if (getApp().globalData.cat_type == 1 && that.data.is_show_gb) {
  216 + that.setData({ currentTab: 1 });
  217 + that.get_nation();
  218 + } else if (getApp().globalData.cat_type == 2 && that.data.is_show_pp) {
  219 + that.setData({ currentTab: 2 });
  220 + that.get_brand();
  221 + } else if (that.data.is_show_pl) {
  222 + that.setData({ currentTab: 0 });
  223 + }
  224 + // 获取默认选中的第一个
  225 + if (that.data.is_show_gb && that.data.select_classify_on == 223) {
  226 + that.setData({ status_show: 1 });
  227 + } else if (that.data.is_show_pp && that.data.select_classify_on == 220) {
  228 + that.setData({ status_show: 2 });
  229 + }
  230 + that.data.load = 1;
  231 + })
  232 + },
  233 + onShow: function () {
  234 + if (t.globalData.userInfo) {
  235 + let currentData = {
  236 + store_id: t.globalData.setting.stoid,
  237 + user_id: t.globalData.user_id,
  238 + };
  239 + this.setData({
  240 + userInfo: t.globalData.userInfo,
  241 + imghost: t.globalData.setting.imghost,
  242 + currentData,
  243 + });
  244 + this.getGoodsCategoris();
  245 + }
  246 +
  247 + },
  248 +
  249 +
  250 +
  251 + //获取分类
  252 + async getGoodsCategoris() {
  253 + // if(this.data.is_no_more)return false;
  254 + // if(this.data.isLoading)return false;
  255 + let { currentData } = this.data;
  256 + let Plurl = `/api/weshop/users/distribut/listmyshopCat`;
  257 + const categoris = await e.promiseGet(Plurl, {
  258 + data: currentData,
  259 + isShowLoading: false,
  260 + });
  261 + console.log(categoris);
  262 + if (categoris.data.code == 0 && categoris.data.data.length > 0) {
  263 + let catelist = categoris.data.data;
  264 + this.setData({
  265 + catelist,
  266 + })
  267 + }
  268 +
  269 + },
  270 + requestCategories: function (t) {
  271 + var s = this;
  272 + e.get("/api/goods/goodsSecAndThirdCategoryList", {
  273 + data: {
  274 + parent_id: t
  275 + },
  276 + success: function (e) {
  277 + s.setData({
  278 + categories: e.data.result,
  279 + currentCategoryId: t
  280 + });
  281 + }
  282 + });
  283 + },
  284 +
  285 + //跳转到分类的商品列表
  286 + go_cate: function (t) {
  287 + var cid = t.currentTarget.dataset.cid;
  288 + var pid = t.currentTarget.dataset.pid;
  289 + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid;
  290 + lurl += "&pid=" + pid;
  291 + wx.navigateTo({ url: lurl });
  292 + },
  293 +
  294 + //跳转到品牌的商品列表
  295 + go_brand: function (t) {
  296 + var cid = t.currentTarget.dataset.bid;
  297 + var lurl = "../../goods/goodsList/goodsList?brand_id=" + cid;
  298 + wx.navigateTo({ url: lurl });
  299 + },
  300 +
  301 + //跳转到国别的商品列表
  302 + go_nation: function (t) {
  303 + var cid = t.currentTarget.dataset.nid;
  304 + var lurl = "../../goods/goodsList/goodsList?nation_id=" + cid;
  305 + wx.navigateTo({ url: lurl });
  306 + },
  307 + //获取国别
  308 + get_nation: function () {
  309 + var s = this;
  310 + e.get("/api/weshop/users/distribut/listmyshopNation", {
  311 + data: {
  312 + store_id: oo.stoid,
  313 + user_id: t.globalData.user_id,
  314 + },
  315 + success: function (e) {
  316 + console.log(e);
  317 + var dda = e.data.data;
  318 + s.setData({ nationlist: dda })
  319 + }
  320 + });
  321 + },
  322 +
  323 + //获取品牌
  324 + get_brand: function () {
  325 + var compare = function (prop) {
  326 + return function (obj1, obj2) {
  327 + var val1 = obj1[prop]; var val2 = obj2[prop];
  328 + if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
  329 + val1 = Number(val1); val2 = Number(val2);
  330 + }
  331 + if (val1 < val2) {
  332 + return -1;
  333 + } else if (val1 > val2) {
  334 + return 1;
  335 + } else { return 0; }
  336 + }
  337 + }
  338 +
  339 + var s = this;
  340 + e.get("/api/weshop/users/distribut/listmyshopBrand", {
  341 + data: {
  342 + store_id: oo.stoid,
  343 + user_id: t.globalData.user_id,
  344 + },
  345 + success: function (e) {
  346 + console.log(e);
  347 + var arr = new Array();
  348 + var dda = e.data.data;
  349 + s.setData({ brand_list: dda });
  350 +
  351 + for (var i = 0; i < dda.length; i++) {
  352 + //console.log(dda[i].logo)
  353 + if (dda[i].logo == "") {
  354 + dda[i].logo = s.data.iurl + "/miniapp/images/no_brand_def.jpg";
  355 + } else if (dda[i].logo && dda[i].logo.indexOf("http") < 0) {
  356 + dda[i].logo = oo.imghost + dda[i].logo;
  357 + }
  358 +
  359 + //进行排序,只有是默认排序的时候,才按首字母排序
  360 + if (parseInt(s.data.is_used_share) != 0) continue;
  361 +
  362 + if (arr.length > 0) {
  363 + var find = 0;
  364 + //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素
  365 + for (var k = 0; k < arr.length; k++) {
  366 + if (dda[i].zm == arr[k].zm) { find = k + 1; break; }
  367 + }
  368 + if (find == 0) {
  369 + var item = { zm: dda[i].zm, array: new Array() }
  370 + item.array.push(dda[i]);
  371 + arr.push(item);
  372 + } else {
  373 + arr[find - 1].array.push(dda[i]);
  374 + }
  375 + } else {
  376 + var item = { zm: dda[i].zm, array: new Array() }
  377 + item.array.push(dda[i]);
  378 + arr.push(item);
  379 + }
  380 + }
  381 + if (parseInt(s.data.is_used_share) == 0) {
  382 + arr.sort(compare("zm"));
  383 + } else {
  384 + var ob = { array: dda };
  385 + arr.push(ob);
  386 + }
  387 +
  388 +
  389 +
  390 + s.setData({ groups: arr });
  391 + //console.log(s.data.groups)
  392 + }
  393 + });
  394 + },
  395 + //---------分享配置--------
  396 + onShareAppMessage: function (e) {
  397 +
  398 + var url = "pages/goods/categoryList/categoryList";
  399 + var userInfo = getApp().globalData.userInfo;
  400 + //是分销商才带
  401 + if (userInfo) {
  402 + url += "?first_leader=" + userInfo.user_id;
  403 + }
  404 + console.log("--分类分享---分享--");
  405 + console.log(url);
  406 +
  407 + return {
  408 + title: "商品分类",
  409 + path: url,
  410 + }
  411 + },
  412 + //图片失败,默认图片
  413 + bind_bnerr: function (e) {
  414 + var _errImg = e.target.dataset.errorimg;
  415 + var _errObj = {};
  416 + _errObj[_errImg] = this.data.iurl + "/miniapp/images/default_g_img.gif";
  417 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  418 + },
  419 +
  420 +
  421 + getInput(e) {
  422 + this.setData({
  423 + keyword: e.detail.value.trim(),
  424 + });
  425 + },
  426 +
  427 + search: function (t) {
  428 + let keyword = this.data.keyword;
  429 + if (!keyword) {
  430 + t.showWarning("请输入搜索关键词");
  431 + return false
  432 + }
  433 + // this.search(val);
  434 + // wx.navigateTo({
  435 + // url: `/packageA/pages/distribution/shop/shop?key_word=${val}`,
  436 + // });
  437 + wx.navigateBack({
  438 + delta: 1
  439 + });
  440 + getApp().globalData.key_word = keyword;
  441 + },
  442 + //图片失败,默认图片
  443 + bind_bnerr_t3: function (e) {
  444 + var _errImg = e.target.dataset.errorimg;
  445 + var _errObj = {};
  446 + _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
  447 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  448 +
  449 + },
  450 +
  451 + async click_classify(e) {
  452 + let { cid, current } = e.currentTarget.dataset;
  453 + this.setData({
  454 + select_classify_on: current,
  455 + cat_id: cid,
  456 + is_no_more: 0,
  457 + isLoading: 0,
  458 + countDownNum: 3,
  459 + stylePage: 1,
  460 + is_none: 0,
  461 + });
  462 + if (current == 220 || current == 223) {
  463 + console.log(111);
  464 + let classify_name = null;
  465 + current == 220 ? classify_name = '品牌' : classify_name = '国家';
  466 + this.setData({
  467 + classify_name,
  468 + })
  469 + } else {
  470 + this.setData({
  471 + classify_name: this.data.catelist[current].name,
  472 + })
  473 + wx.pageScrollTo({
  474 + scrollTop: 0
  475 + })
  476 + this.checkCor();
  477 + this.requestGoodsList();
  478 + }
  479 + // classify_name
  480 + },
  481 + /* //分销小店的商品
  482 + async getShopGoods() {
  483 + let { currentData, baseUrl } = this.data;
  484 + console.log(currentData);
  485 + currentData.pageSize = 2000;
  486 + console.log(currentData);
  487 + const distriGoods = await e.promiseGet(baseUrl, {
  488 + data: currentData,
  489 + isShowLoading: false,
  490 + });
  491 + console.log(distriGoods);
  492 + if (distriGoods.data.code == 0 && distriGoods.data.data.pageData.length > 0) {
  493 + this.setData({
  494 + shopGoodsData: distriGoods.data.data.pageData,
  495 + })
  496 + }
  497 + }, */
  498 + async requestGoodsList() {
  499 + console.log('hanshu');
  500 + if (this.data.isLoading) return false;
  501 + // if(this.data.is_no_more)return
  502 + if (this.data.is_no_more && this.data.is_up) return false;
  503 + this.data.isLoading = 1;
  504 + let { currentData } = this.data;
  505 + currentData.cat_id = this.data.cat_id;
  506 + currentData.page = this.data.stylePage;
  507 + // console.log(data);
  508 + let url = `/api/weshop/users/distribut/pagemyshop`;
  509 + const { data: res } = await e.promiseGet(url, {
  510 + isShowLoading: true,
  511 + data: currentData,
  512 + });
  513 + console.log(res);
  514 +
  515 + let index = this.getCurrentIndex();
  516 + let next_classify_name = this.data.catelist[index].name;
  517 + this.setData({
  518 + isLoading: 0,
  519 + is_no_more: 0,
  520 + is_get: 1,
  521 + select_classify_on: index,
  522 + classify_name: next_classify_name,
  523 + next_classify_name,
  524 + });
  525 + if (res.code == 0 && res.data.pageData.length > 0) {
  526 + // if(res.data.pageData.length<res.data.pageSize){
  527 + // this.setData({
  528 + // is_no_more:1,
  529 + // })
  530 + // }
  531 + if (res.data.page > 1) {
  532 + this.setData({
  533 + requestData: this.data.requestData.concat(res.data.pageData),
  534 + });
  535 + } else {
  536 + this.setData({
  537 + requestData: res.data.pageData,
  538 + });
  539 + }
  540 +
  541 + } else {
  542 + //上拉加载
  543 + if (res.data.page > 1) {
  544 + this.setData({
  545 + is_no_more: 1,
  546 + })
  547 + } else {
  548 + this.setData({
  549 + requestData: [],
  550 + });
  551 + //如果类目为空则3秒后加载下一类目
  552 + this.data.timer = setInterval(() => {
  553 + this.setData({
  554 + countDownNum: this.data.countDownNum - 1,
  555 + });
  556 + if (this.data.countDownNum == 0) {
  557 + clearInterval(this.data.timer);
  558 + this.get_next_cate(index);
  559 + }
  560 + }, 1000);
  561 + }
  562 + }
  563 + },
  564 +
  565 + //查找当前类目在 catelist的下标 为后面下一个类目使用
  566 + getCurrentIndex() {
  567 +
  568 + let index = this.data.catelist.findIndex(item => {
  569 + return item.id == this.data.cat_id
  570 + });
  571 + //当前处于类目最后一个
  572 + if (index + 1 == this.data.catelist.length) {
  573 + this.setData({
  574 + is_none: 1,
  575 + })
  576 + };
  577 + return index;
  578 + },
  579 +
  580 +
  581 + get_next_cate(index) {
  582 + console.log('get_next_cate');
  583 + index = index + 1;
  584 + let nex_cat_id = this.data.catelist[index].id;
  585 + this.setData({
  586 + cat_id: nex_cat_id,
  587 + stylePage: 1,
  588 + is_get: 0,
  589 + next_classify_name: this.data.catelist[index].name,
  590 + });
  591 + this.data.is_up = 0;
  592 + this.requestGoodsList();
  593 + },
  594 + onReachBottom: function () {
  595 +
  596 + },
  597 + //选择更多
  598 + select_more: function (e) {
  599 + var cid = e.currentTarget.dataset.cid;
  600 + var pid = e.currentTarget.dataset.pid;
  601 + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
  602 + wx.navigateTo({ url: lurl });
  603 +
  604 + },
  605 + //扫一扫
  606 + getScancode: function () {
  607 + // 允许从相机和相册扫码
  608 + wx.scanCode({
  609 + success: (res) => {
  610 + console.log(res);
  611 + var key_word = res.result;
  612 + wx.navigateBack({
  613 + delta: 1
  614 + });
  615 + getApp().globalData.key_word = key_word;
  616 + }
  617 + })
  618 + },
  619 + onUnload: function () {
  620 + //this.destroyActivityTimer();
  621 + },
  622 +
  623 + onPullDownRefresh: function () {
  624 +
  625 + },
  626 + touchstart(e) {
  627 + // if (!this.data.is_no_more) return false;
  628 + // if(this.data.is_next){
  629 + // this.setData({
  630 + // is_no_more:0,
  631 + // })
  632 + // }
  633 + // this.data.is_next=0;
  634 + startY = e.changedTouches[0].clientY;
  635 + console.log('gdsg');
  636 + },
  637 + touchend(e) {
  638 +
  639 + endY = e.changedTouches[0].clientY;
  640 + moveDistance = startY - endY;
  641 + if(moveDistance<0){
  642 + scrolltop=0
  643 + }
  644 + console.log(scrolltop);
  645 + if (this.data.is_no_more && !this.data.is_up) {
  646 + this.data.is_up = 1;
  647 + return false;
  648 + }
  649 +
  650 + if (this.data.is_no_more && moveDistance >= 300 && scrolltop > 0) {
  651 + this.data.is_up = 0;
  652 + this.get_next_cate(this.data.select_classify_on);
  653 + }
  654 +
  655 + },
  656 + // 左侧更新
  657 + scrollLower: function () {
  658 + scrolltop = 1;
  659 + if (this.data.isLoading) return false;
  660 + if (this.data.is_no_more) return false;
  661 +
  662 +
  663 + this.setData({
  664 + stylePage: this.data.stylePage + 1,
  665 + countDownNum: 3,
  666 + });
  667 + !this.data.is_none && this.requestGoodsList();
  668 +
  669 +
  670 + },
  671 +
  672 + //--- 获取卡类列表 ---
  673 + getPlusCardType: function (func) {
  674 + var storid = oo.stoid;
  675 + var th = this;
  676 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  677 + var plusCard = res.data.data;
  678 + var arr = [1219, 2089, 3031];
  679 + var new_arr = new Array();
  680 + var card_name_map = new Map();
  681 + var user = getApp().globalData.userInfo;
  682 + for (var i = 0; i < plusCard.length; i++) {
  683 + if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  684 + continue;
  685 + }
  686 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  687 + card_name_map.set(name, plusCard[i].CardName);
  688 + new_arr.push(plusCard[i]);
  689 + }
  690 +
  691 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  692 + func(ob);
  693 + })
  694 + },
  695 +
  696 +});
0 697 \ No newline at end of file
... ...
packageC/pages/goods/distributionCategoryList/index.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "分类",
  3 + "enablePullDownRefresh": false
  4 +}
0 5 \ No newline at end of file
... ...
packageC/pages/goods/distributionCategoryList/index.wxml 0 → 100644
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
  2 +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs>
  3 +<!-- 风格3 -->
  4 +<block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
  5 + <!-- 头部 -->
  6 + <view class="xc-search-box flex-center white_b" id="navbar" style="position:fixed;top:0;z-index:99">
  7 + <view class="share-height t-c" bindtap="getScancode">
  8 + <image class="scanning_black-img" src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image>
  9 + <view class="fs24">扫一扫</view>
  10 + </view>
  11 + <view class="xc-search-inner ">
  12 + <view class="search-img left">
  13 + <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image>
  14 + </view>
  15 + <input class="search-cont" autoFocus bindconfirm="search" bindinput="getInput" placeholder="请输入您所搜索的商品" type="text"></input>
  16 + </view>
  17 + <view class="c-red fs26" bindtap="search">搜索</view>
  18 + </view>
  19 + <!-- 分类项目内容 -->
  20 + <view class="flex project_height" style="margin-left:-10rpx;">
  21 + <!-- 分类项目的类型 -->
  22 + <view class="project_type" style="background-color:#eee;overflow-y:auto;position:fixed;left:0;z-index:99;top:120rpx;" id="thress_type3">
  23 + <view class="project_type-frame">
  24 + <view wx:if="{{is_show_gb}}">
  25 + <view bindtap="click_classify" class="tab-bar-item {{select_classify_on==223 ? 'active' : ''}}" data-current="223" data-name="国家" wx:if="{{is_country}}">
  26 + <text style="letter-spacing:50rpx;">国家</text>
  27 + </view>
  28 + </view>
  29 + <view wx:if="{{is_show_pp}}">
  30 + <view bindtap="click_classify" class="tab-bar-item {{select_classify_on==220 ? 'active' : ''}}" wx:if="{{is_brand}}" data-current="220" data-name="品牌">
  31 + <text style="letter-spacing:50rpx;">品牌</text>
  32 + </view>
  33 + </view>
  34 + <view wx:if="{{is_show_pl}}">
  35 + <scroll-view scroll-y scroll-with-animation class="tab-view" scroll-top="{{scrollTop}}" style="height:88%">
  36 + <view wx:for="{{catelist}}" class="tab-bar-item {{select_classify_on==index ? 'active' : ''}}" data-current="{{index}}" catchtap="click_classify" data-cid="{{item.id}}" data-index="{{index}}" data-name="{{item.name}}">
  37 + <text>{{item.name}}</text>
  38 + </view>
  39 + </scroll-view>
  40 + <!-- </view> -->
  41 + </view>
  42 + </view>
  43 + </view>
  44 + <!-- 分类项目的内容 -->
  45 + <view class="classify_content" style="margin-left:27%;margin-top:120rpx">
  46 + <!-- 国家的样式 -->
  47 + <block wx:if="{{select_classify_on==223&&is_show_gb}}">
  48 + <view class="classify_name fs28 flex-space-between">
  49 + <view>{{ishaf_three==1?good_list.name:classify_name}}</view>
  50 + </view>
  51 + <view class=" classify_content-frame flex-space-between ">
  52 + <view bindtap="go_nation" class="country_img-frame rel outer_location" wx:for="{{nationlist}}" wx:for-item="bitem" wx:for-index="pidx" data-nid="{{bitem.id}}">
  53 + <image wx:if="{{bitem.imgtype==1}}" class="country_img" src="{{bitem.logo}}"></image>
  54 + <image wx:else class="country_img" src="{{iurl}}{{bitem.logo}}"></image>
  55 + <view class='nation_box abs box'>
  56 + <view class='nt_1 t-c line-height' style="height:50rpx">
  57 + <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.name}}</text>
  58 + </view>
  59 + <view class='nt_2 t-c line-height fs24' style="line-height: 50rpx">
  60 + <text class="nation_y_name ellipsis-1 nt_1_t height fs24">{{bitem.enname}}</text>
  61 + </view>
  62 + </view>
  63 + <!-- <view class='nation_box abs box' style="top:20rpx"> -->
  64 + <!-- </view> -->
  65 + </view>
  66 + </view>
  67 + </block>
  68 + <!-- 品牌 -->
  69 + <block wx:if="{{select_classify_on==220&&is_show_pp}}">
  70 + <view class="classify_name fs28 flex-space-between">
  71 + <view>{{classify_name}}</view>
  72 + </view>
  73 + <view class="classify_content-frame flex flex-wrap">
  74 + <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx">
  75 + <view class="brand_img_frame " wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}">
  76 + <view class="t-c">
  77 + <image class=" brand_img" src="{{user.logo}}" data-pix="{{pidx}}" data-idx="{{idx}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
  78 + <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view>
  79 + </view>
  80 + </view>
  81 + </block>
  82 + </view>
  83 + </block>
  84 + <!-- 品类 -->
  85 + <block wx:if="{{is_show_pl}}">
  86 + <block wx:if="{{select_classify_on!=220&&select_classify_on!=223}}">
  87 + <view style="width:100%;height:100%;">
  88 + <view class="classify_name fs28 flex-space-between" id="header" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more' style="position:fixed;z-index:999999;top:130rpx;width:70%;background-color:#ffffff;left:27%;padding:0 10rpx;">
  89 + <view class="classify_title ellipsis-1">{{classify_name}}</view>
  90 + <!-- <view class="flex select_more">
  91 + <view class="red-co fs24">更多</view>
  92 + <view class="bg_right width_height"></view>
  93 + </view> -->
  94 + </view>
  95 + <!-- 显示商品列表开始 -->
  96 + <!-- <view class="classify_content-frame flex-wrap" style="width:100%;overflow:hidden;heigth:100%;"> -->
  97 + <!-- <view class="null" style="width:100%;margin-top:70rpx;"></view> -->
  98 + <scroll-view wx:if="{{is_get}}" scroll-y scroll-top="{{scrollTop}}" bindtouchstart="touchstart" bindtouchend="touchend" bindscrolltolower='scrollLower' lower-threshold="200" style="height:{{windowHeight}};position:absolute;margin-top:70rpx;top:140rpx;bottom:0;rigth:0;left:26%;width:73%;">
  99 + <view class="null" style="width:100%;height:1px;"></view>
  100 + <!-- goodslist -->
  101 + <view class="choice_list" style="height:{{requestData.length?'100%':''}}">
  102 + <navigator class="choice_item" style="margin-bottom:{{dataLength -1 == index?'100px':'0'}}" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" data-id="{{item.id}}">
  103 + <view class="img-wrap" data-txt="已售:{{item.sales_sum}}">
  104 + <image src="{{url+item.original_img}}" binderror="bind_bnerr_t3" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
  105 + </view>
  106 + <view class="item-cont">
  107 + <view class="title">{{item.goods_name}}</view>
  108 + <!-- 判断是否有活动价 -->
  109 + <block wx:if="{{item.prom_price>0 || item.prom_integral}}">
  110 + <!-- 活动价 -->
  111 + <view class="price">
  112 + <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
  113 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  114 + <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
  115 + </view>
  116 + <view class="comment flex jc_sb">
  117 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  118 + </view>
  119 + <view class="fs24 c-a flex jc_sb">
  120 + <text class="money c-red">分成金额:{{filter.toFix(item.commission,2)}}</text>
  121 + <text>评论{{item.comment_count}}</text>
  122 + </view>
  123 + </block>
  124 + <block wx:else>
  125 + <!-- 商品价格,先判断下是否有等级价 -->
  126 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  127 + <!-- 当会员是等级卡的时候 -->
  128 + <block wx:if="{{card_field}}">
  129 + <!-- 等级价>0 -->
  130 + <block wx:if="{{item[card_field]>0}}">
  131 + <view class="flex ai_and">
  132 + <view class="price">¥{{item[card_field]}}</view>
  133 + <view class="card_bg ellipsis-1">
  134 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  135 + <view class="card_name">{{card_name}}</view>
  136 + </view>
  137 + </view>
  138 + <view class="comment flex jc_sb">
  139 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  140 + </view>
  141 + <view class="fs24 c-a flex jc_sb">
  142 + <text class="c-red">分成金额:{{filter.toFix(item.commission,2)}}</text>
  143 + <text>评论{{item.comment_count}}</text>
  144 + </view>
  145 + </block>
  146 + <block wx:else>
  147 + <view class="price">¥{{item.shop_price}}</view>
  148 + <view class="comment flex jc_sb">
  149 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  150 + </view>
  151 + <view class="fs24 c-a flex jc_sb">
  152 + <text class="c-red">分成金额:{{filter.toFix(item.commission,2)}}</text>
  153 + <text>评论{{item.comment_count}}</text>
  154 + </view>
  155 + </block>
  156 + </block>
  157 + <block wx:else>
  158 + <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}">
  159 + <view class="flex ai-center">
  160 + <view class="price">¥{{item.shop_price}}</view>
  161 + <view class="word-line xc-ash mk_price">¥{{item.market_price}}</view>
  162 + </view>
  163 + <view class="comment flex jc_sb">
  164 + <view class="flex ai-center">
  165 + <view class="">¥{{g_filter.get_card_price(item,card_list,0)}}</view>
  166 + <view class="card_bg ellipsis-1">
  167 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  168 + <view class="card_name">
  169 + {{g_filter.get_card_price(item,card_list,1)}}
  170 + </view>
  171 + </view>
  172 + </view>
  173 + </view>
  174 + <view class="fs24 c-a flex jc_sb">
  175 + <text class="c-red">分成金额:{{filter.toFix(item.commission,2)}}</text>
  176 + <text>评论{{item.comment_count}}</text>
  177 + </view>
  178 + </block>
  179 + <block wx:else>
  180 + <view class="price">¥{{item.shop_price}}</view>
  181 + <view class="comment flex jc_sb">
  182 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  183 + </view>
  184 + <view class="fs24 c-a flex jc_sb">
  185 + <text class="money c-red">
  186 + 分成金额:{{filter.toFix(item.commission,2)}}
  187 + </text>
  188 + <text>评论{{item.comment_count}}</text>
  189 + </view>
  190 + </block>
  191 + </block>
  192 + </block>
  193 + <block wx:else>
  194 + <view class="price">¥{{item.shop_price}}</view>
  195 + <view class="comment flex jc_sb">
  196 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  197 + </view>
  198 + <view class="fs24 c-a flex jc_sb">
  199 + <text class="money c-red">分成金额:{{filter.toFix(item.commission,2)}}</text>
  200 + <text>评论{{item.comment_count}}</text>
  201 + </view>
  202 + </block>
  203 + </block>
  204 + </view>
  205 + </navigator>
  206 + <!-- 暂无更多 -->
  207 + <view wx:if="{{is_no_more&&!is_none&&requestData.length}}" style="color:c-red; height: 200rpx;line-height: 30rpx;margin-top: 20rpx;font-size: 25rpx; text-align: center;">
  208 + <text style="font-size:32rpx;color:red;margin-right:10rpx" class="iconfont icon-arrowup"></text>
  209 + <text style="color:#999">向上拉继续浏览{{next_classify_name}}</text>
  210 + </view>
  211 + </view>
  212 + <view class="no-data" wx:if="{{requestData.length==0}}">
  213 + <!-- <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> -->
  214 + <view class="no-data-title" style="text-align:center;margin-top:100px">
  215 + <view style="color:#444;line-height:30px;">该类别暂无推荐商品</view>
  216 + <view style="color:#444;line-height:30px;">{{countDownNum}} 秒后自动跳到下一个类别</view>
  217 + </view>
  218 + <!-- <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator> -->
  219 + </view>
  220 + </scroll-view>
  221 + <!-- /goodslist -->
  222 + </view>
  223 + <!-- 商品列表结束 -->
  224 + </block>
  225 + </block>
  226 + </view>
  227 + </view>
  228 +</block>
  229 +<block wx:elif="{{is_do}}">
  230 + <view class="no-data">
  231 + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
  232 + <view class="no-data-title">商家暂未设置分类</view>
  233 + <navigator class="lookat" url="/pages/index/index/index">去逛逛</navigator>
  234 + </view>
  235 +</block>
0 236 \ No newline at end of file
... ...
packageC/pages/goods/distributionCategoryList/index.wxss 0 → 100644
  1 +/*---nyf 2018-9-7---*/
  2 +
  3 +page{height: 100%; background: #fff !important;}
  4 +.top_view{ width: 100%;background: #fff;}
  5 +
  6 +.swiper-tab{
  7 + width: 70%;
  8 + text-align: center;
  9 + height: 88rpx;
  10 + line-height: 88rpx;
  11 + display: flex;
  12 + flex-flow: row;
  13 + justify-content: center;
  14 + margin-left: 15%;
  15 +
  16 +}
  17 +.swiper-tab-item{
  18 + width: 30%;
  19 + color:#434343;
  20 +}
  21 +.active{
  22 + color:#F65959;
  23 + /* border-bottom: 4rpx solid #F65959; */
  24 +}
  25 +swiper{
  26 + text-align: center;
  27 + min-height:200rpx;
  28 + height: auto;
  29 +}
  30 +
  31 +/*--搜索--*/
  32 +.search-box {
  33 + width: 100% !important;
  34 + height: 88rpx !important;
  35 + z-index: 10 !important;
  36 + border-radius: 0 !important;
  37 + /*-background: linear-gradient(rgba(0,0,0,.2),rgba(255,255,255,0));-*/
  38 + background: #f2f2f2 !important;
  39 + padding: 0 !important;
  40 + font-size: medium !important;
  41 +}
  42 +
  43 +.logo {
  44 + width: 48rpx;
  45 + height: 48rpx;
  46 + margin: 0 18rpx;
  47 + border-radius: 50%;
  48 + overflow: hidden;
  49 +}
  50 +
  51 +.search-inner {
  52 + display: flex;
  53 + align-items: center;
  54 + margin: 0rpx 30rpx;
  55 + width: 675rpx;
  56 + height: 58rpx;
  57 + border-radius: 29rpx;
  58 + background-color: #fff;
  59 + position: relative;
  60 + top: 15rpx;
  61 +}
  62 +
  63 +.search-img {
  64 + margin-right: 12rpx;
  65 + width: 30rpx;
  66 + height: 30rpx;
  67 + margin-top: -8rpx;
  68 + margin-left: 20rpx;
  69 +}
  70 +
  71 +.search-cont {
  72 + /* height: 58rpx;
  73 + width: 536rpx; */
  74 + /* padding-left: 12rpx; */
  75 + line-height: 58rpx;
  76 + font-size: 28rpx;
  77 + color: #666;
  78 +}
  79 +
  80 +.search-fixed {
  81 + background: rgba(242,48,48,0.8);
  82 +}
  83 +
  84 +/*--分类--*/
  85 +.f_item{position: relative;}
  86 +.f_item .pic_view{position: relative; height: 240rpx;}
  87 +
  88 +.fl_img{width: 100%; height: 100%;}
  89 +.fenlei_text_v{text-align: left; margin-bottom: 10rpx; margin-top: 15rpx}
  90 +.over_view{width: 100%; height: 100%; position: absolute;top: 0; left: 0; background-color: rgba(0,0,0,0.1);}
  91 +.f_item_over_t{margin: 0 auto; position: absolute; top:80rpx;left: 50%; color: #fff; font-weight: bold;
  92 +
  93 +
  94 + margin-left: -100rpx; z-index: 8; width: 200rpx; text-align: center; font-size: 50rpx }
  95 +.f_text{width: 25%;
  96 +text-align: center;
  97 +display: inline-block;
  98 +font-size: 30rpx;
  99 +color: #9f9f9f;
  100 +overflow: hidden;
  101 +text-overflow: ellipsis;
  102 +white-space: nowrap;
  103 +line-height: 50rpx;
  104 +
  105 +}
  106 +
  107 +/*--国家--*/
  108 +.nation_box{ position: absolute;width: 260rpx; height: 160rpx; background-size: 100% 100%; background-repeat: no-repeat;
  109 + top:110rpx;left: 50%; /* margin-left: -130rpx; */z-index: 8; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAN8AAACACAYAAACLIbwOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkVDREM1NjhCMDU3MTFFNjg3NEZDNzlCNDg1N0FGRjUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkVDREM1NjlCMDU3MTFFNjg3NEZDNzlCNDg1N0FGRjUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRUNEQzU2NkIwNTcxMUU2ODc0RkM3OUI0ODU3QUZGNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyRUNEQzU2N0IwNTcxMUU2ODc0RkM3OUI0ODU3QUZGNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PlO56qEAAAFJSURBVHja7NfRCYAgFIbRDMd0Doe4a9ietxWUIjDOeZYefvhIS2aOA/jcaQIQH4gPEB+IDxAfiA8QH2ynzhyKiGYqWNN7vx7HN/MhYO2H5doJ3nwgPkB8ID5AfCA+QHwgPkB8ID5AfCA+EJ8JQHwgPkB8ID5AfCA+QHwgPkB8ID5AfCA+EB8gPhAfID4QHyA+EB8gPhAfID4QHyA+EB+IDxAfiA8QH4gPEB+IDxAfiA8QH4gPEB+ID8QHiA/EB4gPxAeID8QHiA/EB4gPxAeID8QH4gPEB+IDxAfiA8QH4gPEB+IDxAfiA8QH4gPxAeID8QHiA/EB4gPxAeID8QHiA/EB4gPxgfgA8YH4APGB+ADxgfgA8YH4APGB+ADxgfhAfID4QHyA+OB/6uzBiGjmgveUzBxmANdOEB8gPhAfID4QHyA+2MotwAD/ZBI/EDK5cgAAAABJRU5ErkJggg==");}
  110 +
  111 + .n_img{width: 100%; height: 375rpx;}
  112 + .nt_1{height:82rpx; line-height: 100rpx;}
  113 + .nt_1_t{ border-bottom: 1rpx solid #999; font-size: 32rpx; display: inline-block; height: 82rpx}
  114 + .nt_2{height: 66rpx;font-size: 32rpx; line-height: 66rpx;color:#999}
  115 + /*---品牌---*/
  116 + .nav {
  117 + position: fixed;
  118 + right: 3rpx;
  119 + height: 300rpx;
  120 + width: 48rpx;
  121 + top:0rpx;
  122 + font-family: Arial, Helvetica, sans-serif;
  123 + z-index: 99999999999;
  124 +}
  125 +.letter {
  126 + width: 35.6rpx;
  127 + height: 35.6rpx;
  128 + font-size: 30rpx;
  129 +}
  130 +.letter-text {
  131 + display: inline-block;
  132 + width: 100%;
  133 + height: 100%;
  134 + text-align: center;
  135 + line-height: 30rpx;
  136 + border-radius: 50%;
  137 +}
  138 +.letter-actived {
  139 + background-color: #ccc;
  140 +}
  141 +
  142 +.group-name {
  143 + padding: 10rpx 30rpx;
  144 + height: 50rpx;
  145 + line-height: 50rpx;
  146 + text-align: left;
  147 +}
  148 +.group-users {
  149 + background-color: #fff; text-align: left; padding-bottom: 10rpx;
  150 +}
  151 +.user {
  152 + height: 88rpx;
  153 + width: 208rpx;
  154 + border: 1px solid #eee;
  155 + display: inline-block;
  156 + margin-top:15rpx;
  157 + margin-left:20rpx;
  158 +}
  159 +.user-avatar {
  160 + border-right: 1px solid #eee;
  161 + width: 100rpx;
  162 +}
  163 +.user-avatar-img {
  164 + width: 100%;
  165 + height: 100%;
  166 +}
  167 +.user-name {
  168 + padding-left: 30rpx;
  169 +}
  170 +.fenlei-list{z-index: -1;}
  171 +
  172 +
  173 +
  174 +
  175 +
  176 +/* 商品分类新的版本 */
  177 +/* 分享样式*/
  178 +.xc-search-box {
  179 + width: 95%;
  180 + height: 120rpx;
  181 + padding: 0 20rpx;
  182 + z-index: 10;
  183 + background: #fff;
  184 + /* border-top: 4rpx solid #eee; */
  185 + border-bottom: 1rpx solid #eee;
  186 +}
  187 +
  188 +.share-height{
  189 + line-height: 20rpx;
  190 +/* margin-right: 15rpx; */
  191 +margin-top: 8rpx;
  192 +
  193 +}
  194 +.scanning_black-img{
  195 + width:50rpx;
  196 + height: 45rpx;
  197 + margin-bottom: 5rpx;
  198 +
  199 +}
  200 +/* .search-img.left{ */
  201 + /* margin-left: 35rpx; */
  202 +/* } */
  203 +
  204 +.xc-search-inner {
  205 + margin: 0 20rpx;
  206 + display: flex;
  207 + align-items: center;
  208 + flex: 1;
  209 + /* width: 600rpx; */
  210 + height: 58rpx;
  211 + border-radius: 29rpx;
  212 + background-color: #f2f2f2;
  213 +}
  214 +.project_height{
  215 + height: 100%;
  216 +
  217 +}
  218 +.project_type{
  219 + box-sizing: border-box;
  220 + width: 26%;
  221 + height: 100%;
  222 + padding-bottom: 100rpx;
  223 + border-right: 1rpx solid #eee;
  224 + white-space: nowrap;
  225 + overflow: hidden;
  226 + overflow-y: scroll;
  227 +}
  228 +.share_type{
  229 + margin: auto;
  230 + width: 58%;
  231 + /* margin-top: 40rpx; */
  232 +}
  233 +.xc-letter-spacing{
  234 +padding-left: 20rpx;
  235 +padding-right: 29rpx;
  236 +width: 58%;
  237 +margin: auto;
  238 +margin-top: 40rpx;
  239 +margin-left:28rpx;
  240 +}
  241 +
  242 +
  243 +#two_type .xc-letter-spacing{
  244 + padding-left: 20rpx;
  245 + padding-right: 29rpx;
  246 + width: 58%;
  247 + margin: auto;
  248 + margin-top: 40rpx;
  249 + margin-left:28rpx;
  250 + }
  251 +
  252 +/* 左边菜单点击样式 20200601 luca */
  253 +.is_show_class{
  254 +width: 100%;
  255 +background-color: white;
  256 +height: 50rpx;
  257 +line-height: 50rpx;
  258 +color:black;
  259 +font-weight: 700;
  260 +}
  261 +
  262 +.world_sn{
  263 +white-space: nowrap;
  264 +overflow: hidden;
  265 +width: 58%;
  266 +/* letter-spacing: 60rpx; */
  267 +margin: auto;
  268 +margin-top: 35rpx;
  269 +}
  270 +/* .select_classify{ */
  271 + /* 20200530 update 转用.is_show_class*/
  272 +/* background: #d60021;
  273 +border-radius: 30rpx;
  274 +color: #fff;
  275 +height: 48rpx;
  276 +line-height: 45rpx; */
  277 +/* font-weight:700; */
  278 +
  279 +/* } */
  280 +/* .select_classify.width80{ */
  281 + /* 20200530updata */
  282 + /* width: 74.5%; */
  283 + /* height: 100rpx;
  284 + line-height: 100rpx; */
  285 +/* } */
  286 +.class_set_height{
  287 + height: 50rpx;
  288 + line-height: 50rpx;
  289 + padding: 20rpx 0;
  290 +}
  291 +
  292 + .select_classify.width80.text-indent{
  293 + text-indent: 38rpx;
  294 + padding-right: 20px;
  295 +width: 60%;
  296 +
  297 + }
  298 + .classify_name{
  299 + /* width: 90%;
  300 + margin: auto; */
  301 + height: 70rpx;
  302 + border-bottom: 1rpx solid #f5f6f6;
  303 + line-height: 70rpx;
  304 + font-weight: 600;
  305 + padding-left: 20rpx;
  306 + padding-right: 20rpx;
  307 + }
  308 + .classify_content{
  309 + width: 100%
  310 +
  311 + }
  312 + .classify_content-frame{
  313 + box-sizing: border-box;
  314 + width: 100%;
  315 + padding: 0 20rpx;
  316 + flex-wrap:wrap;
  317 + overflow-y:scroll;
  318 + }
  319 + .country_img-frame{
  320 + width: 48%;
  321 + height: 140rpx;
  322 +
  323 + }
  324 + .country_img{
  325 + width: 100%;
  326 + height: 100%;
  327 + }
  328 + .outer_location{
  329 + top:0rpx;
  330 + left: 0rpx;
  331 + margin-top: 20rpx;
  332 +
  333 + }
  334 + .nation_box.box{
  335 + width:80%;
  336 + height:70%;
  337 + top: 50%;
  338 + left: 50%;
  339 + overflow: hidden;
  340 + transform: translate(-50%, -50%);
  341 + }
  342 + .nt_1.line-height{
  343 + line-height: 65rpx;
  344 + height: 72rpx;
  345 +margin-top: -5rpx;
  346 +
  347 + }
  348 + .nt_1_t.height{
  349 + height: 54rpx;
  350 + }
  351 + .nt_1.height{
  352 + height: 56rpx;
  353 +line-height: 65rpx;
  354 + }
  355 + .nt_2.line-height{
  356 + height: 0rpx;
  357 + line-height: 0rpx;
  358 +
  359 + }
  360 + .nt_1_t.fs24{
  361 + font-size: 24rpx;
  362 + }
  363 + .nt_2.fs24{
  364 + font-size: 24rpx;
  365 + }
  366 + .brand_img_frame{
  367 + width: 50%;
  368 + margin-top: 18rpx;
  369 + /* margin-right: 15rpx; */
  370 + height: 160rpx;
  371 + }
  372 + .brand_img{
  373 + width:220rpx;
  374 + height:86rpx;
  375 + margin-bottom: 10rpx;
  376 + margin-top: 10rpx;
  377 +
  378 + }
  379 + .type_img_frame {
  380 + width: calc(100% / 3);
  381 + height: 140rpx;
  382 + margin-top: 20rpx;
  383 + margin-bottom: 20rpx;
  384 + /* margin-right: 15rpx; */
  385 + }
  386 + /* .choice_item{
  387 + position: relative;
  388 + } */
  389 + .img-wrap::after {
  390 + content: attr(data-txt);
  391 + position: absolute;
  392 + right: 0;
  393 + bottom: 0;
  394 + background-color: rgba(0,0,0,.4);
  395 + color: white;
  396 + font-size: 20rpx;
  397 + /* padding: 4rpx; */
  398 + border-radius: 6rpx 6rpx 6rpx 0;
  399 +}
  400 +
  401 + .type_img{
  402 + width:80rpx;
  403 + height:80rpx;
  404 + margin-bottom: 10rpx;
  405 + margin-top: 10rpx;
  406 +
  407 + }
  408 + .brand_img-name{
  409 + width: 100%;
  410 + height: 80rpx;
  411 + }
  412 + .select_classify.width80.text3{
  413 +padding-right: 20rpx;
  414 +padding-left: 20rpx;
  415 +width: 62%;
  416 +
  417 + }
  418 + .width_height{
  419 + width: 13rpx;
  420 + height: 13rpx;
  421 + margin-top:12rpx;
  422 + }
  423 + .select_more{
  424 +line-height: 37rpx;
  425 +height: 35rpx;
  426 +margin-top: 24rpx;
  427 + }
  428 + .divider_line{
  429 + width: 100%;
  430 + border-bottom: 6rpx solid #eee;
  431 + }
  432 + .sort-name{
  433 + width: 132rpx;
  434 +overflow: hidden;
  435 +margin: auto;
  436 +
  437 +}
  438 +
  439 +.nation_z_name{ max-width: 130rpx}
  440 +.nation_y_name{ max-width: 130rpx; color: #888}
  441 +
  442 +.no_child_lev{width: 100%; text-align: center; color: #adadad; padding-top: 30rpx}
  443 +/* .classify_title { */
  444 + /* width: 80%; */
  445 +/* } */
  446 +
  447 +.brand_img_name {color: #666;}
  448 +
  449 +
  450 +.tab-view {
  451 + /* height: 100%; */
  452 + width: 200rpx;
  453 + /* position: fixed;
  454 + left: 0;
  455 + top: 92rpx;
  456 + z-index: 10; */
  457 +}
  458 +
  459 +#thress_type3 .tab-bar-item {
  460 + width: 200rpx;
  461 + height: 110rpx;
  462 + box-sizing: border-box;
  463 + display: flex;
  464 + align-items: center;
  465 + justify-content: left;
  466 + font-size: 30rpx;
  467 + padding-left: 30rpx;
  468 + color: #444;
  469 + font-weight: 400;
  470 +}
  471 +
  472 +#thress_type3 .active {
  473 + position: relative;
  474 + color: #000;
  475 + font-size: 30rpx;
  476 + font-weight: 600;
  477 + background: #fff;
  478 +}
  479 +
  480 +#thress_type3 .active::before {
  481 + content: "";
  482 + position: absolute;
  483 + border-left: 8rpx solid #E41F19;
  484 + height: 50rpx;
  485 + left: 0;
  486 +}
  487 +
  488 +
  489 +
  490 +
  491 +
  492 +
  493 +#two_type .tab-bar-item {
  494 + width: 200rpx;
  495 + height: 110rpx;
  496 + box-sizing: border-box;
  497 + display: flex;
  498 + align-items: center;
  499 + justify-content: left;
  500 + font-size: 30rpx;
  501 + padding-left: 30rpx;
  502 + color: #444;
  503 + font-weight: 400;
  504 +}
  505 +#two_type .select_classify {
  506 + position: relative;
  507 + color: #000;
  508 + font-size: 30rpx;
  509 + font-weight: 600;
  510 + background: #fff;
  511 +}
  512 +
  513 +#two_type .select_classify::before {
  514 + content: "";
  515 + position: absolute;
  516 + border-left: 8rpx solid #E41F19;
  517 + height: 50rpx;
  518 + left: 0;
  519 + top:50%;
  520 + transform: translateY(-50%);
  521 +}
  522 +
  523 +
  524 +
  525 +#two_type .is_show_class{
  526 + width: 100%;
  527 + background-color: white;
  528 + color:black;
  529 + font-weight: 700;
  530 + height: 110rpx;
  531 +
  532 + }
  533 +
  534 +
  535 + .classify_content > view:last-of-type .classify_content-frame {
  536 + padding-bottom: 100rpx;
  537 + }
  538 +
  539 + /* .classify_content > view:only-child .classify_content-frame { */
  540 + /* padding-bottom: 0; */
  541 + /* } */
  542 +
  543 + .classify_content > .classify_content-frame {
  544 + padding-bottom: 118rpx;
  545 + }
  546 +
  547 + .img-wrap {
  548 + position: relative;
  549 + width: 180rpx !important;
  550 + height: 180rpx !important;
  551 + }
  552 +
  553 + .rmb::before {
  554 + content: '¥';
  555 + font-size: 24rpx;
  556 + }
  557 +
  558 +
  559 + .item-cont .title {
  560 + margin-bottom: 0 !important;
  561 + }
  562 +
  563 +
  564 +
  565 +
  566 +/* 风格三商品列表样式引入 */
  567 +@import "/pages/goods/goodsList/goodsList.wxss";
0 568 \ No newline at end of file
... ...
packageC/pages/goods/goodsList/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + if(type==0) return min_price.toFixed(2);
  78 +
  79 + if(min_name.length>4) min_name=min_name.substring(0, 8);
  80 + return min_name;
  81 + },
  82 +}
  83 +module.exports = {
  84 + is_has_rank:g_filters.is_has_rank,
  85 + get_card_price:g_filters.get_card_price,
  86 +}
0 87 \ No newline at end of file
... ...
packageC/pages/goods/goodsList/goodsList.js 0 → 100644
  1 +var t = function (t) {
  2 + return t && t.__esModule ? t : {
  3 + default: t
  4 + };
  5 +}(require("../../../../utils/LoadMore.js")), e = getApp(), a = new t.default(), oo = e.globalData.setting, ut = require("../../../../utils/util.js");
  6 +var regeneratorRuntime = require('../../../../utils/runtime.js');
  7 +
  8 +Page({
  9 + data: {
  10 + url: e.globalData.setting.imghost,
  11 + resourceUrl: e.globalData.setting.resourceUrl,
  12 + iurl: e.globalData.setting.imghost,
  13 + currentPage: 1,
  14 + requestData: null,
  15 + allData: null,
  16 + openFilterModal: !1,
  17 + baseUrl: "/api/weshop/goods/page?1=1",
  18 + requestUrl: "",
  19 + tabname: "sort", //排序的字段
  20 + adname: "asc", //升降的字段
  21 + is_new: 0,
  22 + is_hot: 0,
  23 + page:1,
  24 + prom_goods_list: null,
  25 + rq_data: null,
  26 + isToggle: false, //切换商品视图控制符
  27 + },
  28 +
  29 + onLoad: function (t) {
  30 +
  31 + this.data.rq_data = t;
  32 +
  33 + //接受有没有导购的参数
  34 + var first_leader = t.first_leader;
  35 + if (first_leader) {
  36 + getApp().globalData.first_leader = first_leader;
  37 + //调用接口判断是不是会员
  38 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => {
  39 + if (res.data.code == 0) {
  40 + getApp().globalData.guide_id = res.data.data.id;
  41 + }
  42 + })
  43 + }
  44 + // this.getShopGoods();
  45 + var th = this;
  46 + a.init(this, "", "requestData");
  47 + var url = this.data.baseUrl;
  48 + this.data.is_new = t.is_new;
  49 + this.data.is_hot = t.is_hot;
  50 + if (0 != t.cat_id && t.cat_id != undefined) {
  51 + url += "&cat_id=" + t.cat_id;
  52 + if (t.pid == undefined || t.pid == null) {
  53 + url += "&parent_id=0";
  54 + } else {
  55 + if (t.pid != "three") {
  56 + url += "&parent_id=" + t.pid;
  57 + }
  58 + }
  59 + }
  60 +
  61 + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
  62 + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
  63 +
  64 + if (0 != t.group_id && t.group_id != undefined) { url += "&group_id=" + t.group_id; }
  65 + if (0 != t.gid && t.gid != undefined) { url += "&group_id=" + t.gid; }
  66 +
  67 + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
  68 +
  69 + if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; }
  70 + if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; }
  71 +
  72 + if (getApp().globalData.userInfo) {
  73 + url += "&user_id=" + getApp().globalData.userInfo.user_id;
  74 + }
  75 + this.setData({
  76 + baseUrl:url,
  77 + })
  78 + //优惠活动的凑单
  79 + if (t.prom_type == 3) {
  80 + if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
  81 + if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
  82 + //-- 获取 --
  83 + getApp().request.promiseGet("/api/weshop/promgoodslist/list", {
  84 + data: { prom_id: t.prom_id }
  85 + }).then(res => {
  86 + if (res.data.code == 0) {
  87 + var arr = res.data.data;
  88 + th.set_prom_list(arr);
  89 + }
  90 + })
  91 + }
  92 + this.getInitData()
  93 +
  94 + getApp().getConfig2(function (rs) {
  95 + //计算等级价相关
  96 + var swithc_list = rs.switch_list;
  97 + var sw_arr = JSON.parse(swithc_list);
  98 + //---如果后台又开等级卡的开关---
  99 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  100 + th.setData({ rank_switch: true });
  101 + var user = getApp().globalData.userInfo;
  102 + var ti = setInterval(function () {
  103 + if (!user) return false;
  104 + clearInterval(ti);
  105 + //---回调卡的列表---
  106 + th.getPlusCardType(function (ob) {
  107 + th.setData({ card_list: ob.card_list });
  108 + if (user.card_field) {
  109 + var str = user['card_expiredate'].replace(/-/g, '/');
  110 + var end = new Date(str);
  111 + end = Date.parse(end) / 1000;
  112 + var now = ut.gettimestamp();
  113 +
  114 + //--- 判断是等级会员,且在有效期范围内 ---
  115 + if (user.card_field && now < end) {
  116 + var card_name = ob.name_map.get(user.card_field);
  117 + // if(card_name.length>4) card_name=card_name.substring(0,4);
  118 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  119 + }
  120 + }
  121 + })
  122 + }, 500)
  123 + }
  124 + });
  125 +
  126 + },
  127 + async getInitData(){
  128 + await this.getShopGoods();
  129 + await this.requestGoodsList(this.data.baseUrl);
  130 + },
  131 + //设置优惠券的
  132 + set_prom_list: async function (arr) {
  133 + var th = this;
  134 + for (var i in arr) {
  135 + //优惠的实际内容
  136 + var content = JSON.parse(arr[i].preferential_type);
  137 + arr[i].content = content;
  138 +
  139 + //--送礼包--
  140 + if (content.is_libao) {
  141 + //-- 获取 --
  142 + await getApp().request.promiseGet("/api/weshop/libao/libaoForm/page?id=" + content.libao + "&store_id=" + oo.stoid, {
  143 + }).then(res => {
  144 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0)
  145 + arr[i].content.lb_name = res.data.data.pageData[0].lbtitle;
  146 + })
  147 + }
  148 + //--送赠品--
  149 + if (content.is_gift) {
  150 + //-- 获取 --
  151 + await getApp().request.promiseGet("/api/weshop/prom/gift/page?id=" + content.gift + "&store_id=" + oo.stoid, {
  152 + }).then(res => {
  153 + if (res.data.code == 0)
  154 + arr[i].content.gift_name = res.data.data.pageData[0].goods_name;
  155 + })
  156 + }
  157 + }
  158 + th.setData({ prom_goods_list: arr });
  159 + },
  160 +
  161 + changeTab: function (t) {
  162 + var ord = t.currentTarget.dataset.href;
  163 + var ad = t.currentTarget.dataset.ad;
  164 + var url = this.data.requestUrl;
  165 +
  166 + if (this.data.tabname != ord) {
  167 + this.setData({ tabname: ord, adname: "desc" });
  168 + } else {
  169 + ad = ad == "desc" ? "asc" : "desc";
  170 + this.setData({ adname: ad });
  171 + }
  172 + this.resetData(), this.requestGoodsList(url);
  173 + },
  174 +
  175 + //分销小店的商品
  176 + async getShopGoods() {
  177 + let data= {
  178 + store_id: oo.stoid,
  179 + user_id: getApp().globalData.user_id,
  180 + page:this.data.page,
  181 + pageSize:2000,
  182 + };
  183 + // this.setData({
  184 + // is_go:0
  185 + // })
  186 + // a.init(this, "", "shopGoodsData");
  187 + // let url=`/api/weshop/users/distribut/pagemyshop?orderType=desc&store_id=${oo.stoid}&user_id=${getApp().globalData.user_id}`;
  188 + let url=`/api/weshop/users/distribut/pagemyshop?orderType=desc`;
  189 + const distriGoods = await getApp().request.promiseGet(url, {
  190 + data: data,
  191 + isShowLoading: false,
  192 + });
  193 + console.log(distriGoods,1);
  194 + if (distriGoods.data.code == 0 && distriGoods.data.data.pageData.length > 0) {
  195 + this.setData({
  196 + shopGoodsData: distriGoods.data.data.pageData,
  197 + })
  198 + }
  199 + // this.requestGoodsList(url)
  200 + },
  201 +
  202 +
  203 + requestGoodsList: async function (t) {
  204 +
  205 + if(this.data.is_no_more){
  206 + getApp().showWarning("加载完啦", null, 500, !1);
  207 + return false
  208 + }
  209 + var e = this;
  210 + this.data.requestUrl = t;
  211 +
  212 + //不是商品分组的,不是默认排序的
  213 + if (t.indexOf("group_id") == -1 || e.data.tabname != "sort") {
  214 + t += "&orderField=" + e.data.tabname;
  215 + t += "&orderType=" + e.data.adname;
  216 + }
  217 +
  218 + t += "&page=" + e.data.currentPage;
  219 + t += "&pageSize=" + 2000;
  220 + t +="&store_id=" +oo.stoid;
  221 + const { data: res } = await getApp().request.promiseGet(t, {
  222 + isShowLoading: true,
  223 + })
  224 + console.log(res);
  225 +
  226 + if (res.code == 0 && res.data.pageData.length > 0) {
  227 + let arr = [];
  228 + arr = res.data.pageData.filter(obj => this.data.shopGoodsData.some(item => item.goods_id == obj.goods_id));
  229 + console.log(arr);
  230 + this.setData({
  231 + requestData: arr,
  232 + is_no_more:1,
  233 + });
  234 + // if (res.data.page > 1) {
  235 + // this.setData({
  236 + // requestData: this.data.requestData.concat(arr),
  237 + // // select_classify_on: index,
  238 + // });
  239 + // } else {
  240 + // this.setData({
  241 + // requestData: arr,
  242 + // // select_classify_on: index,
  243 + // });
  244 + // };
  245 + }
  246 + // a.request(t,
  247 + // function (t) {
  248 + // let arr=[];
  249 + // e.setData({ is_go: 1 });
  250 + // null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)),
  251 + // wx.stopPullDownRefresh();
  252 +
  253 + // arr = e.data.requestData.filter(obj => e.data.shopGoodsData.some(item => item.goods_id == obj.goods_id));
  254 + // // e.data.requestData.map(item => {
  255 + // // e.data.shopGoodsData.forEach(i => {
  256 + // // if (i.nation_id = item.nation_id) {
  257 + // // return item
  258 + // // }
  259 + // // });
  260 + // // arr.push(item);
  261 + // // });
  262 + // console.log(arr);
  263 + // // e.setData({
  264 + // // requestData: arr,
  265 + // // });
  266 + // },
  267 + // null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid }
  268 + // );
  269 +
  270 + },
  271 + getInput(e) {
  272 + this.setData({
  273 + keyword: e.detail.value.trim(),
  274 + });
  275 + },
  276 +
  277 + search: function (t) {
  278 + let keyword = this.data.keyword;
  279 + if (!keyword) {
  280 + t.showWarning("请输入搜索关键词");
  281 + return false
  282 + }
  283 + // this.search(val);
  284 + // wx.navigateTo({
  285 + // url: `/packageA/pages/distribution/shop/shop?key_word=${val}`,
  286 + // });
  287 + wx.navigateBack({
  288 + delta: 2
  289 + });
  290 + getApp().globalData.key_word = keyword;
  291 + },
  292 + onReachBottom: function () {
  293 + a.canloadMore() && this.requestGoodsList(this.data.requestUrl);
  294 + },
  295 + onPullDownRefresh: function () {
  296 + this.resetData(), this.requestGoodsList(this.data.requestUrl);
  297 + },
  298 + openFilterModal: function () {
  299 + this.setData({
  300 + openFilterModal: !0
  301 + });
  302 + },
  303 + closeFilterModal: function () {
  304 + this.setData({
  305 + openFilterModal: !1
  306 + });
  307 + },
  308 + filterGoods: function (t) {
  309 + this.resetData(), this.requestGoodsList(t.currentTarget.dataset.href), this.closeFilterModal();
  310 + },
  311 + resetData: function () {
  312 + a.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
  313 + },
  314 +
  315 + //---回复最初的设置---
  316 + restoreData: function () {
  317 + this.setData({
  318 + requestData: null,
  319 + });
  320 + this.data.currentPage = 2;
  321 + },
  322 + //---------分享配置--------
  323 + onShareAppMessage: function (e) {
  324 + var curPage = this;
  325 + var pagePath = curPage.route; //当前页面url
  326 + if (pagePath.indexOf('/') != 0) {
  327 + pagePath = '/' + pagePath;
  328 + }
  329 +
  330 + if (this.data.rq_data && JSON.stringify(this.data.rq_data) != "{}") {
  331 + var parm = ut.ob_to_parm(this.data.rq_data);
  332 + pagePath += "?" + parm;
  333 + }
  334 +
  335 + if (getApp().globalData.user_id) {
  336 + if (pagePath.indexOf("?") > 0) {
  337 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  338 + } else {
  339 + pagePath += "?first_leader=" + getApp().globalData.user_id;
  340 + }
  341 + }
  342 + console.log("11-11" + pagePath);
  343 + return {
  344 + title: "商品列表",
  345 + path: pagePath,
  346 + }
  347 + },
  348 + //---图片失败,默认图片---
  349 + bind_bnerr2: function (e) {
  350 + var _errImg = e.target.dataset.errorimg;
  351 + var _errurl = e.target.dataset.url;
  352 + var ii = _errurl.indexOf(oo.imghost);
  353 + if (ii != -1) {
  354 + // var _errObj = {};
  355 + // _errObj[_errImg] = this.data.iurl + "/miniapp/images/default_g_img.gif";
  356 + this.setData({
  357 + [_errImg] : "/miniapp/images/default_g_img.gif",
  358 + }) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  359 + }
  360 + },
  361 +
  362 + //--- 获取卡类列表 ---
  363 + getPlusCardType: function (func) {
  364 + var storid = oo.stoid;
  365 + var th = this;
  366 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  367 + var plusCard = res.data.data;
  368 + var arr = [1219, 2089, 3031];
  369 + var new_arr = new Array();
  370 + var card_name_map = new Map();
  371 + var user = getApp().globalData.userInfo;
  372 + for (var i = 0; i < plusCard.length; i++) {
  373 + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  374 + continue;
  375 + }
  376 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  377 + card_name_map.set(name, plusCard[i].CardName);
  378 + new_arr.push(plusCard[i]);
  379 + }
  380 +
  381 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  382 + func(ob);
  383 + })
  384 + },
  385 +
  386 +
  387 +
  388 + // 切换显示
  389 + bindToggleDisplay() {
  390 + this.setData({
  391 + isToggle: !this.data.isToggle,
  392 + });
  393 + },
  394 +
  395 +
  396 +});
0 397 \ No newline at end of file
... ...
packageC/pages/goods/goodsList/goodsList.json 0 → 100644
  1 + {
  2 + "navigationBarTitleText": "商品列表",
  3 + "usingComponents": {
  4 + "share_box": "/components/share_box/share_box"
  5 + }
  6 +}
0 7 \ No newline at end of file
... ...
packageC/pages/goods/goodsList/goodsList.wxml 0 → 100644
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
  2 +<view class="container">
  3 + <view>
  4 + <block wx:for="{{prom_goods_list}}">
  5 + <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx">
  6 + 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text>
  7 + <text space="{{true}}" wx:if="{{item.content.is_money}}">减{{item.content.money}}元 </text>
  8 + <text space="{{true}}" wx:if="{{item.content.is_sale}}">打{{item.content.sale}}折 </text>
  9 + <text space="{{true}}" wx:if="{{item.content.is_int}}">送{{item.content.int}}积分 </text>
  10 + <text space="{{true}}" wx:if="{{item.content.is_coupon}}">送{{item.content.coupon}}元优惠券 </text>
  11 + <text space="{{true}}" wx:if="{{item.content.is_gift}}">送{{item.content.gift_name}} </text>
  12 + <text space="{{true}}" wx:if="{{item.content.is_libao}}">送{{item.content.lb_name}} </text>
  13 + </view>
  14 + </block>
  15 + </view>
  16 +
  17 + <view class="pd20 flex ai-center jc_sb">
  18 + <!-- 搜索框 -->
  19 + <view class="search-box f1">
  20 + <input style="color:#333" autoFocus bindconfirm="search" bindinput="getInput" placeholder="请输入您所搜索的商品" type="text"></input>
  21 + <text style="color:#333;line-height:43rpx" bind:tap="search">搜索</text>
  22 + </view>
  23 + <!-- 单列/双列 显示切换 -->
  24 + <text class="iconfont {{isToggle ? 'icon-fenxiang':'icon-fenlie'}} pdl30 fs36" bindtap="bindToggleDisplay"></text>
  25 + </view>
  26 +
  27 + <view class="nav">
  28 + <navigator bindtap="changeTab" class="nav-item" data-href="sort" data-ad="{{adname}}">综合
  29 + <view class="ico-dg" wx:if="{{tabname=='sort'}}">
  30 + <image class="wh100" src="{{iurl}}/miniapp/images/dg.png" wx:if="{{adname=='desc'}}"></image>
  31 + <image class="wh100" src="{{iurl}}/miniapp/images/up_s.png" wx:if="{{adname=='asc'}}"></image>
  32 + </view>
  33 + </navigator>
  34 + <navigator bindtap="changeTab" class="nav-item" data-href="sales_sum" data-ad="{{adname}}">销量
  35 + <view class="ico-dg" wx:if="{{tabname=='sales_sum'}}">
  36 + <image class="wh100" src="{{iurl}}/miniapp/images/dg.png" wx:if="{{adname=='desc'}}"></image>
  37 + <image class="wh100" src="{{iurl}}/miniapp/images/up_s.png" wx:if="{{adname=='asc'}}"></image>
  38 + </view>
  39 +
  40 + </navigator>
  41 + <navigator bindtap="changeTab" class="nav-item" data-href="final_price" data-ad="{{adname}}">
  42 + 价格
  43 + <view class="ico-dg" wx:if="{{tabname=='final_price'}}">
  44 + <image class="wh100" src="{{iurl}}/miniapp/images/dg.png" wx:if="{{adname=='desc'}}"></image>
  45 + <image class="wh100" src="{{iurl}}/miniapp/images/up_s.png" wx:if="{{adname=='asc'}}"></image>
  46 + </view>
  47 + </navigator>
  48 + <!-- <navigator bindtap="openFilterModal" class="nav-item">筛选<view class="ico-filter">
  49 + <image class="wh100" src="{{iurl}}/miniapp/images/xx.png"></image>
  50 + </view>
  51 + </navigator> -->
  52 +
  53 + <!-- <navigator class="nav-item search" url="/pages/goods/search/search">
  54 + <image class="wh100 search-img" src="{{iurl}}/miniapp/images/search.png"></image>
  55 + </navigator> -->
  56 + </view>
  57 +
  58 + <view class="choice_list" wx:if="{{!isToggle}}">
  59 + <navigator class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" wx:key="{{index}}">
  60 + <view class="img-wrap">
  61 + <image src="{{iurl}}{{item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
  62 + </view>
  63 + <view class="item-cont">
  64 + <view class="title ellipsis-2">{{item.goods_name}}</view>
  65 + <!-- 判断是否有活动价 -->
  66 + <block wx:if="{{(item.prom_price>0 || item.prom_integral>0) && item.prom_type!=2}}">
  67 + <view class="flex on">
  68 + <!-- 活动价 -->
  69 + <view class="price">
  70 + <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
  71 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  72 + <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
  73 + </view>
  74 + <view class="word-line xc-ash mgl10 rmb fs24">{{item.market_price}}</view>
  75 + </view>
  76 +
  77 +
  78 + <view class="comment pdt10">
  79 + <!-- <view class="word-line xc-ash">¥{{item.market_price}}</view> -->
  80 + <view class="fs24 t-r">
  81 + <span>评论{{item.comment_count}}</span>
  82 + <span class="pdl30">已售{{item.sales_sum}}</span>
  83 + </view>
  84 + </view>
  85 + </block>
  86 + <block wx:else>
  87 + <!-- 商品价格,先判断下是后又等级价-->
  88 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  89 + <!-- 当会员是等级卡的时候 -->
  90 + <block wx:if="{{card_field}}">
  91 + <!-- 等级价>0 -->
  92 + <block wx:if="{{item[card_field]>0}}">
  93 + <view class="flex ai-center">
  94 + <view class="price">¥{{item[card_field]}}</view>
  95 + <view class="card_bg ellipsis-1">
  96 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  97 + <text class="card_name">{{card_name}}</text>
  98 + </view>
  99 + </view>
  100 + <view class="comment">
  101 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  102 + <view class="fs24 t-r">
  103 + <span>评论{{item.comment_count}}</span>
  104 + <span class="pdl30">已售{{item.sales_sum}}</span>
  105 + </view>
  106 + </view>
  107 + </block>
  108 + <block wx:else>
  109 + <view class="price">¥{{item.shop_price}}</view>
  110 + <view class="comment">
  111 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  112 + <view class="fs24 t-r">
  113 + <span>评论{{item.comment_count}}</span>
  114 + <span class="pdl30">已售{{item.sales_sum}}</span>
  115 + </view>
  116 + </view>
  117 + </block>
  118 + </block>
  119 + <block wx:else>
  120 + <view wx:if="{{g_filter.get_card_price(item,card_list,0)}}">
  121 + <view class="flex ai-center">
  122 + <view class="price rmb">{{item.shop_price}}</view>
  123 + <view class="word-line xc-ash mk_price rmb">{{item.market_price}}</view>
  124 + </view>
  125 + <view class="comment">
  126 + <view class="flex ai-center">
  127 + <view class="rmb">{{g_filter.get_card_price(item,card_list,0)}}</view>
  128 + <view class="card_bg ellipsis-1">
  129 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  130 + <text class="card_name">{{g_filter.get_card_price(item,card_list,1)}}</text>
  131 + </view>
  132 + </view>
  133 + <view class="fs24 pdt10 t-r">
  134 + <span class="">评论{{item.comment_count}}</span>
  135 + <span class="pdl30">已售{{item.sales_sum}}</span>
  136 + </view>
  137 + </view>
  138 + </view>
  139 + <block wx:else>
  140 + <view>
  141 + <view class="price">¥{{item.shop_price}}</view>
  142 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  143 + </view>
  144 + <!-- <view class="price">¥{{item.shop_price}}</view> -->
  145 + <view class="comment pdt10">
  146 + <view class="fs24 t-r">
  147 + <span>评论{{item.comment_count}}</span>
  148 + <span class="pdl30">已售{{item.sales_sum}}</span>
  149 + </view>
  150 + </view>
  151 + </block>
  152 + </block>
  153 + </block>
  154 + <view wx:else>
  155 + <view class="flex ai-center">
  156 + <view class="price rmb">{{item.shop_price}}</view>
  157 + <view class="word-line xc-ash rmb fs24 mgl10">{{item.market_price}}</view>
  158 + </view>
  159 +
  160 + <view class="comment pdt10">
  161 + <view class="fs24 t-r">
  162 + <span>评论{{item.comment_count}}</span>
  163 + <span class="pdl30">已售{{item.sales_sum}}</span>
  164 + </view>
  165 + </view>
  166 + </view>
  167 + </block>
  168 + </view>
  169 + </navigator>
  170 + </view>
  171 +
  172 +
  173 + <view class="choice_list on" wx:else>
  174 + <navigator class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" wx:key="{{index}}">
  175 + <view class="img-wrap">
  176 + <image src="{{iurl}}{{item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
  177 + </view>
  178 + <view class="item-cont">
  179 + <view class="title ellipsis-2">{{item.goods_name}}</view>
  180 + <!-- 判断是否有活动价 -->
  181 + <block wx:if="{{(item.prom_price>0 || item.prom_integral>0) && item.prom_type!=2}}">
  182 + <view class="flex on">
  183 + <!-- 活动价 -->
  184 + <view class="price">
  185 + <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
  186 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  187 + <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
  188 + </view>
  189 + <view class="word-line xc-ash mgl10 rmb fs24">{{item.market_price}}</view>
  190 + </view>
  191 +
  192 +
  193 + <view class="comment pdt10">
  194 + <!-- <view class="word-line xc-ash">¥{{item.market_price}}</view> -->
  195 + <view class="fs24 t-r">
  196 + <span>评论{{item.comment_count}}</span>
  197 + <span class="pdl30">已售{{item.sales_sum}}</span>
  198 + </view>
  199 + </view>
  200 + </block>
  201 + <block wx:else>
  202 + <!-- 商品价格,先判断下是后又等级价-->
  203 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  204 + <!-- 当会员是等级卡的时候 -->
  205 + <block wx:if="{{card_field}}">
  206 + <!-- 等级价>0 -->
  207 + <block wx:if="{{item[card_field]>0}}">
  208 + <view class="flex ai-center">
  209 + <view class="price">¥{{item[card_field]}}</view>
  210 + <view class="card_bg ellipsis-1">
  211 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  212 + <text class="card_name">{{card_name}}</text>
  213 + </view>
  214 + </view>
  215 + <view class="comment">
  216 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  217 + <view class="fs24 t-r">
  218 + <span>评论{{item.comment_count}}</span>
  219 + <span class="pdl30">已售{{item.sales_sum}}</span>
  220 + </view>
  221 + </view>
  222 + </block>
  223 + <block wx:else>
  224 + <view class="price">¥{{item.shop_price}}</view>
  225 + <view class="comment">
  226 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  227 + <view class="fs24 t-r">
  228 + <span>评论{{item.comment_count}}</span>
  229 + <span class="pdl30">已售{{item.sales_sum}}</span>
  230 + </view>
  231 + </view>
  232 + </block>
  233 + </block>
  234 + <block wx:else>
  235 + <view wx:if="{{g_filter.get_card_price(item,card_list,0)}}">
  236 + <view class="flex ai-center">
  237 + <view class="price rmb">{{item.shop_price}}</view>
  238 + <view class="word-line xc-ash mk_price rmb">{{item.market_price}}</view>
  239 + </view>
  240 + <view class="comment">
  241 + <view class="flex ai-center">
  242 + <view class="rmb">{{g_filter.get_card_price(item,card_list,0)}}</view>
  243 + <view class="card_bg ellipsis-1">
  244 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  245 + <text class="card_name">{{g_filter.get_card_price(item,card_list,1)}}</text>
  246 + </view>
  247 + </view>
  248 + <view class="fs24 pdt10 t-r">
  249 + <span class="">评论{{item.comment_count}}</span>
  250 + <span class="pdl30">已售{{item.sales_sum}}</span>
  251 + </view>
  252 + </view>
  253 + </view>
  254 + <block wx:else>
  255 + <view>
  256 + <view class="price">¥{{item.shop_price}}</view>
  257 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  258 + </view>
  259 + <!-- <view class="price">¥{{item.shop_price}}</view> -->
  260 + <view class="comment pdt10">
  261 + <view class="fs24 t-r">
  262 + <span>评论{{item.comment_count}}</span>
  263 + <span class="pdl30">已售{{item.sales_sum}}</span>
  264 + </view>
  265 + </view>
  266 + </block>
  267 + </block>
  268 + </block>
  269 + <view wx:else>
  270 + <view class="">
  271 + <view class="price rmb">{{item.shop_price}}</view>
  272 + <view class="word-line xc-ash rmb fs24 mgl10">{{item.market_price}}</view>
  273 + </view>
  274 +
  275 + <view class="comment pdt10">
  276 + <view class="fs24 t-r">
  277 + <span>评论{{item.comment_count}}</span>
  278 + <span class="pdl30">已售{{item.sales_sum}}</span>
  279 + </view>
  280 + </view>
  281 + </view>
  282 + </block>
  283 + </view>
  284 + </navigator>
  285 + </view>
  286 +
  287 +
  288 +
  289 +
  290 +
  291 +
  292 +
  293 +
  294 +
  295 + <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}">
  296 + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
  297 + <view class="no-data-title">没有相关的数据</view>
  298 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
  299 + </view>
  300 + </view>
  301 + <view hidden="{{!openFilterModal}}">
  302 + <view bindtap="closeFilterModal" class="cover-layer"></view>
  303 + <view class="filter-modal">
  304 + <icon bindtap="closeFilterModal" class="modal-close" color="gray" size="22" type="cancel"></icon>
  305 + <button bindtap="restoreData" class="viewall-btn">显示全部分类</button>
  306 + <view class="filter-box" wx:for="{{requestData.filter_spec}}" wx:key="{{index}}">
  307 + <view class="filter-name">{{item.name}}</view>
  308 + <view class="filter-items">
  309 + <view bindtap="filterGoods" class="filter-item" data-href="{{item.href}}" wx:for="{{item.item}}" wx:key="{{index}}">
  310 + {{item.name}}</view>
  311 + </view>
  312 + </view>
  313 +
  314 + <view class="filter-box" wx:for="{{requestData.filter_attr}}" wx:key="{{index}}">
  315 + <view class="filter-name">{{item.name}}</view>
  316 + <view class="filter-items">
  317 + <view bindtap="filterGoods" class="filter-item" data-href="{{item.href}}" wx:for="{{item.item}}" wx:key="{{index}}">
  318 + {{item.name}}</view>
  319 + </view>
  320 + </view>
  321 + <view class="filter-box" wx:if="{{requestData.filter_brand.length>0}}">
  322 + <view class="filter-name">相关品牌</view>
  323 + <view class="filter-items">
  324 + <view bindtap="filterGoods" class="filter-item" data-href="{{item.href}}" wx:for="{{requestData.filter_brand}}" wx:key="{{index}}">
  325 + {{item.name}}</view>
  326 + </view>
  327 + </view>
  328 + <view class="filter-box" wx:if="{{requestData.filter_price.length>0}}">
  329 + <view class="filter-name">价格区间</view>
  330 + <view class="filter-items">
  331 + <view bindtap="filterGoods" class="filter-item" data-href="{{item.href}}" wx:for="{{requestData.filter_price}}" wx:key="{{index}}">
  332 + {{item.name}}</view>
  333 + </view>
  334 + </view>
  335 + </view>
  336 + </view>
  337 +
  338 +<share_box id="share"></share_box>
0 339 \ No newline at end of file
... ...
packageC/pages/goods/goodsList/goodsList.wxss 0 → 100644
  1 +page {
  2 + background-color: #f0f0f0;
  3 +}
  4 +
  5 +.container {
  6 + color: #666;
  7 +}
  8 +
  9 +.nav {
  10 + display: flex;
  11 + border-radius: 30rpx 30rpx 0 0;
  12 + overflow: hidden;
  13 +}
  14 +
  15 +.nav-item {
  16 + /* float: left; */
  17 + flex: 1;
  18 + /* width: 30%; */
  19 + height: 80rpx;
  20 + /* line-height: 90rpx; */
  21 + display: flex;
  22 + align-items: center;
  23 + justify-content: center;
  24 + font-size: 26rpx;
  25 + border-bottom: 1px solid #f5f5f5;
  26 + background-color: #fff;
  27 +}
  28 +
  29 +.nav-item .ico-dg {
  30 + width: 12rpx;
  31 + height: 8rpx;
  32 + margin-left: 10rpx;
  33 + line-height: 0;
  34 +}
  35 +
  36 +.nav-item .ico-filter {
  37 + width: 20rpx;
  38 + height: 20rpx;
  39 + margin-left: 10rpx;
  40 + line-height: 0;
  41 +}
  42 +
  43 +.ico-dir {
  44 + width: 16rpx;
  45 + height: 22rpx;
  46 + margin-left: 10rpx;
  47 + background-repeat: no-repeat;
  48 + background-size: cover;
  49 + background-position-x: 0;
  50 +}
  51 +
  52 +.ico-dir-dn {
  53 + background-position-x: -16rpx;
  54 +}
  55 +
  56 +.ico-dir-up {
  57 + background-position-x: -32rpx;
  58 +}
  59 +
  60 +.search-box {
  61 + color: #BEBEBE;
  62 + font-size: 24rpx;
  63 + /* border: 2rpx solid #f23030; */
  64 + border-radius: 40rpx;
  65 + padding: 16rpx;
  66 + display: flex;
  67 + justify-content: space-between;
  68 + background-color: #e0e0e0;
  69 +}
  70 +
  71 +.icon-sousuo {
  72 + font-size: 26rpx !important;
  73 +}
  74 +
  75 +.search {
  76 + width: 10%;
  77 +}
  78 +
  79 +.search-img {
  80 + width: 30rpx;
  81 + height: 30rpx;
  82 +}
  83 +
  84 +.choice_list {
  85 + background-color: #fff;
  86 + /* padding-left: 20rpx;
  87 + padding-right: 20rpx; */
  88 +}
  89 +
  90 +.choice_item {
  91 + position: relative;
  92 + width: 100%;
  93 + /* min-height: 200rpx; */
  94 + /* padding: 10rpx 0; */
  95 + /* border-bottom: 1px solid #f5f6f6; */
  96 + font-size: 30rpx;
  97 + display: flex;
  98 + padding: 20rpx;
  99 + box-sizing: border-box;
  100 +}
  101 +
  102 +.img-wrap {
  103 + /* float: left; */
  104 + width: 270rpx;
  105 + height: 270rpx;
  106 + margin-right: 22rpx;
  107 + border-radius: 15rpx;
  108 + overflow: hidden;
  109 + flex-shrink: 0;
  110 + /* padding: 0 10rpx 10rpx; */
  111 +}
  112 +
  113 +.img-wrap image {
  114 + width: 100%;
  115 + height: 100%;
  116 +}
  117 +
  118 +.item-cont .title {
  119 + font-size: 26rpx;
  120 + height: 72rpx;
  121 + margin-bottom: 20rpx;
  122 + /* padding-right: 10rpx; */
  123 + line-height: 36rpx;
  124 + color: #2C2C2C;
  125 + text-align: justify;
  126 + overflow: hidden;
  127 +}
  128 +
  129 +.price {
  130 + display: inline-block;
  131 + color: #f23030;
  132 + /* line-height: 24rpx; */
  133 + font-size: 30rpx;
  134 + /* font-weight: bold;
  135 + font-size: 28rpx; */
  136 + /* padding-bottom: 20rpx; */
  137 +}
  138 +
  139 +.rmb::before {
  140 + content: '¥';
  141 + font-size: 24rpx;
  142 +}
  143 +
  144 +.comment {
  145 + font-size: 24rpx;
  146 + /* margin-top: 4rpx; */
  147 + color: #8d8d8d;
  148 + /* padding-right: 30rpx; */
  149 +}
  150 +
  151 +.filter-modal {
  152 + position: fixed;
  153 + left: 150rpx;
  154 + top: 0;
  155 + right: 0;
  156 + bottom: 0;
  157 + z-index: 20;
  158 + background-color: white;
  159 + overflow-x: hidden;
  160 + padding-bottom: 30rpx;
  161 +}
  162 +
  163 +.filter-box {
  164 + box-sizing: border-box;
  165 + width: 100%;
  166 + font-size: 28rpx;
  167 + padding: 20rpx;
  168 +}
  169 +
  170 +.filter-name {
  171 + width: 100%;
  172 + padding: 20rpx 0;
  173 + word-break: keep-all;
  174 + white-space: nowrap;
  175 + text-overflow: ellipsis;
  176 + overflow: hidden;
  177 + font-size: 30rpx;
  178 +}
  179 +
  180 +.filter-items {
  181 + width: 100%;
  182 +}
  183 +
  184 +.filter-item {
  185 + float: left;
  186 + width: fit-content;
  187 + max-width: 500rpx;
  188 + word-break: keep-all;
  189 + white-space: nowrap;
  190 + text-overflow: ellipsis;
  191 + overflow: hidden;
  192 + padding: 10rpx;
  193 + border-radius: 10rpx;
  194 + border: 1rpx #ddd solid;
  195 + margin: 0 10rpx 10rpx 0;
  196 + background-color: #fdfdfd;
  197 + color: #666;
  198 +}
  199 +
  200 +.viewall-btn {
  201 + margin-top: 20rpx;
  202 + width: 300rpx;
  203 +}
  204 +
  205 +.card_bg {
  206 + /* display: flex;
  207 + max-width: 110rpx;
  208 + height: 25rpx;
  209 + align-items: center;
  210 + border-radius: 26rpx;
  211 + font-size: 19rpx;
  212 + background: #333;
  213 + color: #fff;
  214 + justify-content: center;
  215 + margin-left: 8rpx;
  216 + margin-top: 7rpx;
  217 + line-height: 25rpx;
  218 + padding: 2rpx 10rpx;
  219 + width: auto; */
  220 +
  221 +
  222 + box-sizing: border-box;
  223 + padding: 2rpx 10rpx;
  224 + height: 28rpx;
  225 + border-radius: 26rpx;
  226 + font-size: 18rpx;
  227 + line-height: 28rpx;
  228 + max-width: 220rpx;
  229 + background: #333;
  230 + color: #fff;
  231 + margin-left: 8rpx;
  232 +}
  233 +
  234 +/* .card_bg .card_name {
  235 + max-width: 76rpx;
  236 + width: auto;
  237 + overflow: hidden;
  238 + white-space: nowrap;
  239 +} */
  240 +
  241 +.card_name {
  242 + position: relative;
  243 + top: -3rpx;
  244 + display: inline-block;
  245 +}
  246 +
  247 +
  248 +.card_bg image {
  249 + width: 19rpx;
  250 + height: 19rpx;
  251 + margin-right: 8rpx;
  252 +}
  253 +
  254 +.mk_price {
  255 + margin-left: 10rpx;
  256 + font-size: 24rpx;
  257 +}
  258 +
  259 +.item-cont {
  260 + line-height: 38rpx;
  261 + display: flex;
  262 + flex-direction: column;
  263 + justify-content: space-evenly;
  264 + flex: 1;
  265 +}
  266 +
  267 +
  268 +.choice_list.on {
  269 + display: flex;
  270 + flex-wrap: wrap;
  271 + padding-bottom: 12rpx;
  272 + padding-left: 16rpx;
  273 + padding-right: 16rpx;
  274 + background-color: #f0f0f0;
  275 +}
  276 +
  277 +.choice_list.on .choice_item {
  278 + padding: 0;
  279 + margin-top: 16rpx;
  280 + display: block;
  281 + width: 350rpx;
  282 + background-color: white;
  283 + border-radius: 15rpx;
  284 +}
  285 +
  286 +.choice_list.on .choice_item:nth-child(even) {
  287 + margin-left: 18rpx;
  288 +}
  289 +
  290 +.choice_list.on .img-wrap {
  291 + width: 350rpx;
  292 + height: 350rpx;
  293 + border-bottom-left-radius: 0;
  294 + border-bottom-right-radius: 0;
  295 +}
  296 +
  297 +.choice_list.on .item-cont {
  298 + padding: 10rpx;
  299 + display: flex;
  300 + flex-direction: column;
  301 + justify-content: space-between;
  302 +}
  303 +
  304 +
  305 +.choice_list.on .item-cont .flex.on {
  306 + display: block;
  307 +}
... ...
packageC/pages/goods/search/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + //min_price=min.price;
  78 + //min_name=min.name;
  79 + if(type==0) return min_price.toFixed(2);
  80 + if(min_name.length>7 ) min_name=min_name.substring(0, 8);
  81 + return min_name;
  82 + },
  83 +}
  84 +module.exports = {
  85 + is_has_rank:g_filters.is_has_rank,
  86 + get_card_price:g_filters.get_card_price,
  87 +}
0 88 \ No newline at end of file
... ...
packageC/pages/goods/search/search.js 0 → 100644
  1 +const { app } = require("../../../../utils/common.js");
  2 +
  3 +var t = function (t) {
  4 + return t && t.__esModule ? t : {
  5 + default: t
  6 + };
  7 +}(require("../../../../utils/LoadMore.js")), ut = require("../../../../utils/util.js"),
  8 + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
  9 +
  10 +Page({
  11 + data: {
  12 + url: a.globalData.setting.imghost,
  13 + resourceUrl: a.globalData.setting.resourceUrl,
  14 + currentPage: 1,
  15 + requestData: null,
  16 + allData: null,
  17 + openFilterModal: !1,
  18 + openSearchModal: !1,
  19 + baseUrl: "/api/weshop/goods/page?1=1",
  20 + requestUrl: "",
  21 + //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ]
  22 + hotWords: null,
  23 +
  24 + tabname: "sort", //排序的字段
  25 + adname: "asc", //升降的字段
  26 + rq_data: null,
  27 +
  28 +
  29 + searchRecord: [],
  30 + keyword: '',
  31 + is_his: 0,
  32 + },
  33 +
  34 + onLoad: function (t) {
  35 + this.data.rq_data = t;
  36 +
  37 + //接受有没有导购的参数
  38 + var first_leader = t.first_leader;
  39 + if (first_leader) {
  40 + getApp().globalData.first_leader = first_leader;
  41 + //调用接口判断是不是会员
  42 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => {
  43 + if (res.data.code == 0) {
  44 + getApp().globalData.guide_id = res.data.data.id;
  45 + }
  46 + })
  47 + }
  48 +
  49 + var th = this;
  50 + a.getConfig2(function (rs) {
  51 + var arr = new Array(), arr2 = new Array();
  52 + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") {
  53 + var arr1 = rs.hot_keywords.split('|');
  54 + for (var i = 0; i < arr1.length; i++) {
  55 + if (i % 5 == 0 && i != 0) {
  56 + arr.push(arr2);
  57 + arr2 = [];
  58 + } else {
  59 + arr2.push(arr1[i]);
  60 + }
  61 + }
  62 + if (arr2.length > 0) arr.push(arr2);
  63 + th.setData({ hotWords: arr });
  64 + }
  65 +
  66 +
  67 + //计算等级价相关
  68 + var swithc_list = rs.switch_list;
  69 + var sw_arr = JSON.parse(swithc_list);
  70 + //---如果后台又开等级卡的开关---
  71 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  72 + th.setData({ rank_switch: true });
  73 + var user = getApp().globalData.userInfo;
  74 + var ti = setInterval(function () {
  75 + if (!user) return false;
  76 + clearInterval(ti);
  77 + //---回调卡的列表---
  78 + th.getPlusCardType(function (ob) {
  79 + th.setData({ card_list: ob.card_list });
  80 + if (user.card_field) {
  81 + var str = user['card_expiredate'].replace(/-/g, '/');
  82 + var end = new Date(str);
  83 + end = Date.parse(end) / 1000;
  84 + var now = ut.gettimestamp();
  85 +
  86 + //--- 判断是等级会员,且在有效期范围内 ---
  87 + if (user.card_field && now < end) {
  88 + var card_name = ob.name_map.get(user.card_field);
  89 + if (card_name.length > 7) card_name = card_name.substring(0, 8);
  90 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  91 + }
  92 + }
  93 + })
  94 + }, 500)
  95 + }
  96 +
  97 +
  98 +
  99 + })
  100 + e.init(this, "", "requestData");
  101 + var url = this.data.baseUrl;
  102 +
  103 + //扫一扫过来,显示搜索的内容
  104 + var s_key = t.s_key;
  105 + if (s_key) {
  106 + s_key = s_key.trim();
  107 + this.search(s_key); this.openSearchModal();
  108 + return;
  109 + }
  110 +
  111 + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
  112 + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
  113 + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
  114 +
  115 + if (url != this.data.baseUrl) return this.requestSearch(url);
  116 + this.openSearchModal();
  117 +
  118 + // 获取历史搜索记录
  119 + this.getHistorySearch();
  120 + },
  121 + changeTab: function (t) {
  122 + var ord = t.currentTarget.dataset.href;
  123 + var ad = t.currentTarget.dataset.ad;
  124 +
  125 + var url = this.data.requestUrl;
  126 +
  127 + if (this.data.tabname != ord) {
  128 + this.setData({ tabname: ord, adname: "desc" });
  129 + } else {
  130 + ad = ad == "desc" ? "asc" : "desc";
  131 + this.setData({ adname: ad });
  132 + }
  133 + this.resetData(), this.requestSearch(url);
  134 +
  135 + },
  136 +
  137 + //-----------真的调用地址进行搜索------------
  138 + requestSearch: function (t) {
  139 + var a = this;
  140 +
  141 + if (getApp().globalData.userInfo) {
  142 + t += "&user_id=" + getApp().globalData.userInfo.user_id;
  143 + }
  144 +
  145 + this.data.requestUrl = t,
  146 + //t += "&orderField=" + a.data.tabname;
  147 + //t += "&orderType=" + a.data.adname;
  148 + //t += "&page=" + a.data.currentPage,
  149 + e.request(t, function (t) {
  150 + a.data.currentPage++,
  151 + null == a.data.allData && (a.data.allData = t.data.data.pageData),
  152 + a.closeSearchModal();
  153 + },
  154 + null, {
  155 + is_mainshow: 1, isonsale: 1, store_id: oo.stoid,
  156 + orderField: a.data.tabname, orderType: a.data.adname, page: a.data.currentPage
  157 + }
  158 + );
  159 + },
  160 + onReachBottom: function () {
  161 + this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl);
  162 + },
  163 + openFilterModal: function () {
  164 + this.setData({
  165 + openFilterModal: !0
  166 + });
  167 + },
  168 + closeFilterModal: function () {
  169 + this.setData({
  170 + openFilterModal: !1
  171 + });
  172 + },
  173 + filterGoods: function (t) {
  174 + this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal();
  175 + },
  176 + resetData: function () {
  177 + e.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
  178 + },
  179 +
  180 + //---回复最初的设置---显示全部分类--
  181 + restoreData: function () {
  182 + this.setData({
  183 + requestData: this.data.allData,
  184 + });
  185 + this.data.currentPage = 2;
  186 + },
  187 + openSearchModal: function () {
  188 + this.setData({
  189 + openSearchModal: !0
  190 + });
  191 + },
  192 + closeSearchModal: function () {
  193 + this.setData({
  194 + openSearchModal: !1
  195 + });
  196 + },
  197 + submitSearch: function (t) {
  198 + console.log(111, t);
  199 + var val = t.detail.value.word;
  200 + if (val == undefined) val = t.detail.value;
  201 + val = val ? val.trim() : '';
  202 + if (!val) {
  203 + a.showWarning("请输入搜索关键词");
  204 + return false
  205 + }
  206 + // this.search(val);
  207 + // wx.navigateTo({
  208 + // url: `/packageA/pages/distribution/shop/shop?key_word=${val}`,
  209 + // });
  210 + wx.navigateBack({
  211 + delta: 2
  212 + });
  213 + getApp().globalData.key_word = val;
  214 + },
  215 +
  216 + //热搜关键字
  217 + searchHotWord: function (t) {
  218 +
  219 + var word = t.currentTarget.dataset.word;
  220 + this.historyRecord(word);
  221 + wx.navigateBack({
  222 + delta: 2
  223 + });
  224 + getApp().globalData.key_word = word;
  225 + // this.search(word);
  226 + },
  227 +
  228 + //-----点击搜索按钮----
  229 + search: function (t) {
  230 + if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词");
  231 + this.data.key_str = t;
  232 + this.historyRecord();
  233 + this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
  234 + },
  235 +
  236 + //---------分享配置--------
  237 + onShareAppMessage: function (e) {
  238 + var curPage = this;
  239 + var pagePath = curPage.route; //当前页面url
  240 + if (pagePath.indexOf('/') != 0) {
  241 + pagePath = '/' + pagePath;
  242 + }
  243 +
  244 + if (this.data.key_str) {
  245 + pagePath += "?s_key=" + this.data.key_str;
  246 + }
  247 +
  248 + if (getApp().globalData.user_id) {
  249 +
  250 + if (pagePath.indexOf("?") > 0) {
  251 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  252 + } else {
  253 + pagePath += "?first_leader=" + getApp().globalData.user_id;
  254 + }
  255 + }
  256 +
  257 + console.log("11-11" + pagePath);
  258 + return {
  259 + title: "商品搜索",
  260 + path: pagePath,
  261 + }
  262 + },
  263 +
  264 +
  265 + //---------图片失败,默认图片--------
  266 + bind_bnerr: function (e) {
  267 + var _errImg = e.target.dataset.errorimg;
  268 + var _errObj = {};
  269 + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif";
  270 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  271 + },
  272 +
  273 + //--- 获取卡类列表 ---
  274 + getPlusCardType: function (func) {
  275 + var storid = oo.stoid;
  276 + var th = this;
  277 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  278 + var plusCard = res.data.data;
  279 + var arr = [1219, 2089, 3031];
  280 + var new_arr = new Array();
  281 + var card_name_map = new Map();
  282 + var user = getApp().globalData.userInfo;
  283 +
  284 + for (var i = 0; i < plusCard.length; i++) {
  285 + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  286 + continue;
  287 + }
  288 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  289 + card_name_map.set(name, plusCard[i].CardName);
  290 + new_arr.push(plusCard[i]);
  291 +
  292 + }
  293 +
  294 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  295 + func(ob);
  296 + })
  297 + },
  298 +
  299 +
  300 + getInput(e) {
  301 + this.setData({
  302 + keyword: e.detail.value
  303 + });
  304 + },
  305 +
  306 + historyRecord(w) {
  307 + let keyword = w;
  308 + let self = this;
  309 + if (!keyword) {
  310 + keyword = this.data.key_str.trim();
  311 + }
  312 + let searchRecord = this.data.searchRecord;
  313 + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || [];
  314 +
  315 + if (keyword) {
  316 +
  317 + var index = searchRecord.indexOf(keyword);
  318 + if (index > -1) {
  319 + // 已经存在该值
  320 + searchRecord.splice(index, 1);
  321 + searchRecord.unshift(keyword);
  322 +
  323 + // 将历史记录添加到缓存中
  324 + wx.setStorage({
  325 + key: 'searchRecord',
  326 + data: searchRecord,
  327 + success: function (res) {
  328 + self.setData({
  329 + searchRecord,
  330 + })
  331 + }
  332 + })
  333 +
  334 + return;
  335 + } else {
  336 + if (searchRecord.length >= 10) {
  337 + searchRecord.pop(); // 删除最早的一条记录
  338 + };
  339 + searchRecord.unshift(keyword);
  340 +
  341 + // // 将历史记录添加到缓存中
  342 + wx.setStorage({
  343 + key: 'searchRecord',
  344 + data: searchRecord,
  345 + success: function (res) {
  346 + self.setData({
  347 + searchRecord,
  348 + })
  349 + }
  350 + })
  351 + };
  352 + };
  353 + },
  354 +
  355 +
  356 +
  357 +
  358 + getHistorySearch() {
  359 + this.setData({
  360 + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
  361 + });
  362 + },
  363 +
  364 + clearSearchRecord() {
  365 + wx.clearStorageSync('searchRecord');
  366 + this.setData({
  367 + searchRecord: []
  368 + });
  369 + },
  370 +});
0 371 \ No newline at end of file
... ...
packageC/pages/goods/search/search.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "商品搜索",
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "share_box": "/components/share_box/share_box"
  6 + }
  7 +}
0 8 \ No newline at end of file
... ...
packageC/pages/goods/search/search.wxml 0 → 100644
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
  2 +<view wx:if="{{openSearchModal}}">
  3 + <view class="search-modal">
  4 + <view class="search-bar">
  5 + <form bindsubmit="submitSearch">
  6 + <input autoFocus class="search-input" name="word" placeholder="搜索商品" bindconfirm="submitSearch" bindinput="getInput"></input>
  7 + <button class="search-btn" formType="submit">
  8 + <image class="wh100 search-img" src="{{url}}/miniapp/images/sea.png"></image>
  9 + </button>
  10 + </form>
  11 + </view>
  12 + <view class="search-hot">
  13 + <view class="hot-title">热门搜索</view>
  14 + <block wx:if="{{hotWords.length>0}}">
  15 + <view class="hot-row" wx:for="{{hotWords}}" wx:key="{{index}}">
  16 + <view bindtap="searchHotWord" class="hot-item" data-word="{{item}}" wx:for="{{item}}" wx:key="{{index}}">{{item}}</view>
  17 + </view>
  18 + </block>
  19 + </view>
  20 + <view class="search-hot">
  21 + <view class="hot-title flex jc_sb ai_c">
  22 + <text>历史搜索</text>
  23 + <text class="iconfont icon-shanchu xc-ash" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
  24 + </view>
  25 + <block wx:if="{{searchRecord.length>0}}">
  26 + <view class="hot-row flex flex-wrap" wx:key="{{index}}">
  27 + <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
  28 + </view>
  29 + </block>
  30 + <view wx:else class="fs24">暂无历史搜索记录</view>
  31 + </view>
  32 + </view>
  33 +</view>
0 34 \ No newline at end of file
... ...
packageC/pages/goods/search/search.wxss 0 → 100644
  1 +.container {
  2 + color: #666;
  3 +}
  4 +
  5 +.nav-item {
  6 + float: left;
  7 + width: 30%;
  8 + height: 90rpx;
  9 + line-height: 90rpx;
  10 + display: flex;
  11 + align-items: center;
  12 + justify-content: center;
  13 + font-size: 32rpx;
  14 + border-bottom: 2rpx solid #E6E6E6;
  15 + background-color: #fff;
  16 +}
  17 +
  18 +.nav-item .ico-dg {
  19 + width: 18rpx;
  20 + height: 12rpx;
  21 + margin-left: 10rpx;
  22 + line-height: 0;
  23 +}
  24 +
  25 +.nav-item .ico-filter {
  26 + width: 20rpx;
  27 + height: 20rpx;
  28 + margin-left: 10rpx;
  29 + line-height: 0;
  30 +}
  31 +
  32 +.ico-dir {
  33 + width: 16rpx;
  34 + height: 22rpx;
  35 + margin-left: 10rpx;
  36 + background-repeat: no-repeat;
  37 + background-size: cover;
  38 + background-position-x: 0;
  39 +}
  40 +
  41 +.ico-dir-dn {
  42 + background-position-x: -16rpx;
  43 +}
  44 +
  45 +.ico-dir-up {
  46 + background-position-x: -32rpx;
  47 +}
  48 +
  49 +.nav-search {
  50 + width: 10%;
  51 +}
  52 +
  53 +.nav-item .search-img {
  54 + width: 30rpx;
  55 + height: 30rpx;
  56 +}
  57 +
  58 +.choice_list {
  59 + background-color: #fff;
  60 +}
  61 +
  62 +.choice_item {
  63 + position: relative;
  64 + width: 100%;
  65 + min-height: 200rpx;
  66 + padding: 10rpx 0;
  67 + border-bottom: 2rpx solid #E6E6E6;
  68 + font-size: 30rpx;
  69 +}
  70 +
  71 +.img-wrap {
  72 + /* float: left; */
  73 + width: 180rpx;
  74 + height: 180rpx;
  75 + padding: 0 10rpx 0 30rpx;
  76 + flex-shrink: 0;
  77 + /* padding: 10rpx; */
  78 +}
  79 +
  80 +.img-wrap image {
  81 + width: 100%;
  82 + height: 100%;
  83 +}
  84 +
  85 +.item-cont .title {
  86 + height: 72rpx;
  87 + margin: 16rpx 0;
  88 + padding-right: 30rpx;
  89 + line-height: 36rpx;
  90 + color: #333;
  91 + overflow: hidden;
  92 + text-align: justify;
  93 +}
  94 +
  95 +.price {
  96 + display: inline-block;
  97 + color: #f23030;
  98 + /* line-height: 24rpx; */
  99 + /* padding-bottom: 20rpx; */
  100 +}
  101 +
  102 +.comment {
  103 + font-size: 25rpx;
  104 + padding-right: 30rpx;
  105 + margin-top: 4rpx;
  106 +}
  107 +
  108 +.filter-modal {
  109 + position: fixed;
  110 + left: 150rpx;
  111 + top: 0;
  112 + right: 0;
  113 + bottom: 0;
  114 + z-index: 20;
  115 + background-color: white;
  116 + overflow-x: hidden;
  117 + padding-bottom: 30rpx;
  118 +}
  119 +
  120 +.filter-box {
  121 + box-sizing: border-box;
  122 + width: 100%;
  123 + font-size: 28rpx;
  124 + padding: 20rpx;
  125 +}
  126 +
  127 +.filter-name {
  128 + width: 100%;
  129 + padding: 20rpx 0;
  130 + word-break: keep-all;
  131 + white-space: nowrap;
  132 + text-overflow: ellipsis;
  133 + overflow: hidden;
  134 + font-size: 30rpx;
  135 +}
  136 +
  137 +.filter-items {
  138 + width: 100%;
  139 +}
  140 +
  141 +.filter-item {
  142 + float: left;
  143 + width: fit-content;
  144 + max-width: 500rpx;
  145 + word-break: keep-all;
  146 + white-space: nowrap;
  147 + text-overflow: ellipsis;
  148 + overflow: hidden;
  149 + padding: 10rpx;
  150 + border-radius: 10rpx;
  151 + border: 1rpx #ddd solid;
  152 + margin: 0 10rpx 10rpx 0;
  153 + background-color: #fdfdfd;
  154 + color: #666;
  155 +}
  156 +
  157 +.viewall-btn {
  158 + margin-top: 20rpx;
  159 + width: 300rpx;
  160 +}
  161 +
  162 +.search-modal {
  163 + position: fixed;
  164 + top: 0;
  165 + right: 0;
  166 + left: 0;
  167 + bottom: 0;
  168 + z-index: 20;
  169 + background-color: white;
  170 + overflow-x: hidden;
  171 + padding: 80rpx 30rpx;
  172 + font-size: 30rpx;
  173 + color: #555;
  174 +}
  175 +
  176 +.search-bar {
  177 + width: 100%;
  178 + box-sizing: border-box;
  179 +}
  180 +
  181 +.search-input {
  182 + width: 80%;
  183 + float: left;
  184 + border: 1rpx solid #e0e0e0;
  185 + box-sizing: border-box;
  186 + height: 80rpx;
  187 + padding-left: 20rpx;
  188 + border-top-left-radius: 10rpx;
  189 + border-bottom-left-radius: 10rpx;
  190 +}
  191 +
  192 +.search-btn {
  193 + width: 20%;
  194 + height: 80rpx;
  195 + background-color: #f23030;
  196 + display: inline-block;
  197 + text-align: center;
  198 + border-top-right-radius: 10rpx;
  199 + border-bottom-right-radius: 10rpx;
  200 +}
  201 +
  202 +.search-btn .search-img {
  203 + height: 45rpx;
  204 + width: 45rpx;
  205 + padding: 20rpx;
  206 +}
  207 +
  208 +.search-hot {
  209 + margin-top: 40rpx;
  210 +}
  211 +
  212 +.hot-title {
  213 + font-size: 35rpx;
  214 + color: black;
  215 + margin-bottom: 30rpx;
  216 +}
  217 +
  218 +.hot-row {
  219 + display: flex;
  220 + /*--justify-content: space-between---*/
  221 + padding: 15rpx 10rpx;
  222 +}
  223 +
  224 +.hot-item {
  225 + padding: 8rpx 8rpx;
  226 + border: 1rpx solid #e0e0e0;
  227 + border-radius: 10rpx;
  228 + font-size: 28rpx;
  229 + margin-left: 15rpx;
  230 +}
  231 +
  232 +/* .card_bg {
  233 + display: flex;
  234 + max-width: 110rpx;
  235 + height: 25rpx;
  236 + align-items: center;
  237 + border-radius: 26rpx;
  238 + font-size: 19rpx;
  239 + padding: 2rpx 10rpx;
  240 + background: #333;
  241 + color: #fff;
  242 + justify-content: center;
  243 + margin-left: 8rpx;
  244 + margin-top: 7rpx;
  245 + line-height: 25rpx;
  246 + width: auto;
  247 +} */
  248 +
  249 +.card_bg {
  250 + box-sizing: border-box;
  251 + padding: 2rpx 10rpx;
  252 + /* height: 28rpx; */
  253 + border-radius: 26rpx;
  254 + font-size: 18rpx;
  255 + /* line-height: 28rpx; */
  256 + max-width: 210rpx;
  257 + background: #333;
  258 + color: #fff;
  259 + margin-left: 8rpx;
  260 +}
  261 +
  262 +.card_bg image {
  263 + width: 19rpx;
  264 + height: 19rpx;
  265 + margin-right: 8rpx;
  266 + flex-shrink: 0;
  267 +}
  268 +
  269 +.card_name {
  270 + position: relative;
  271 + top: -4rpx;
  272 +}
  273 +
  274 +/* .card_bg image {
  275 + width: 19rpx;
  276 + height: 19rpx;
  277 + margin-right: 1rpx;
  278 + vertical-align: middle;
  279 +}
  280 +
  281 +.card_bg .card_name {
  282 + max-width: 76rpx;
  283 + width: auto;
  284 + overflow: hidden;
  285 + white-space: nowrap;
  286 +} */
  287 +
  288 +.navigator-hover {
  289 + opacity: 1;
  290 +}
  291 +
  292 +.mk_price {
  293 + margin-left: 10rpx;
  294 + font-size: 25rpx;
  295 +}
  296 +
  297 +.item-cont {
  298 + /* line-height: 38rpx; */
  299 + flex-grow: 1;
  300 +}
  301 +
  302 +.history {
  303 + background-color: #f0f0f0;
  304 + color: #7b7b7b;
  305 + border: none;
  306 + margin-bottom: 8rpx;
  307 +}
  308 +
  309 +.history:first-of-type {
  310 + margin-left: 0;
  311 +}
... ...
utils/request.js
... ... @@ -187,7 +187,7 @@ module.exports = {
187 187 })
188 188 },
189 189  
190   - //---promise的使用get----
  190 + //---promise的使用post----
191 191 promisePost:function(url,data){
192 192 var th=this;
193 193 if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
... ... @@ -234,7 +234,7 @@ module.exports = {
234 234 },
235 235  
236 236  
237   - //---promise的使用delete----
  237 + //---promise的使用put----
238 238 promisePut:function(url,data){
239 239 var th=this;
240 240 if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
... ...