Commit b8a4dca775119a84c31d09778d62d5b31545a3ec

Authored by abson
1 parent 0640f004

oa2dan

pages/goods/goodsInfo/goodsInfo.js
... ... @@ -25,7 +25,7 @@ Page({
25 25 color_type: 0, //线条控制
26 26 color_type_one: 0,
27 27 color_type_two: 1,
28   -
  28 + is_no_plus:1,
29 29 gid: "",
30 30 stoid: o.stoid,
31 31 url: o.url,
... ... @@ -354,6 +354,22 @@ Page({
354 354 th.data.c_guide_id = c_guide_id;
355 355 }
356 356  
  357 + //调用接口判断商家plus有没有过期
  358 + i.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => {
  359 + if (res.data.code == 0) {
  360 + var arr = res.data.data.pageData;
  361 + if (arr.length > 0) {
  362 + var item = arr[0];
  363 + if (item.is_sy == 0) {
  364 + var now = Date.parse(new Date()); now = now / 1000;
  365 + if (item.end_time < now) {
  366 + th.setData({ is_no_plus: 0 })
  367 + }
  368 + }
  369 + }
  370 + }
  371 + })
  372 +
357 373 getApp().getConfig(function (e) {
358 374 ee.setData({sto_sele_name_1: e.store_name})
359 375 })
... ... @@ -3526,6 +3542,7 @@ Page({
3526 3542  
3527 3543 //---判断拼单----
3528 3544 if (prom_type == 6) {
  3545 + console.log('判断拼单');
3529 3546 //-------判断活动是否抢光---------
3530 3547 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
3531 3548 1: 1
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -324,7 +324,7 @@
324 324 </view>
325 325 <!-- 不是秒杀 -->
326 326 <!-- 等级卡的价格,不是等级卡会员,且商品又有设置等级级价,商家后台有开通升级卡同能 -->
327   - <view class="flex ai_and" wx:if="{{!card_field && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
  327 + <view class="flex ai_and" wx:if="{{!card_field && is_no_plus && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
328 328 <view class="flex ai-center grade-card-frame card-frame">
329 329 <image class="img" src="{{iurl}}/miniapp/images/userinfo/userinfo/privilege_t.png"></image>
330 330 <view class="fs24 white view card-name ellipsis-1">
... ... @@ -336,7 +336,7 @@
336 336 </view>
337 337 </view>
338 338 <!-- 等级卡的显示,购买, 等级卡近30天要显示续费 -->
339   - <block wx:if="{{g_filters.is_has_rank(rank_switch,data)}}">
  339 + <block wx:if="{{g_filters.is_has_rank(rank_switch,data) && is_no_plus}}">
340 340 <!-- 不是秒杀,且会员不是等级会员 -->
341 341 <view wx:if="{{!card_field && prom_type!=1 && prom_type!=2 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
342 342 <view class="beauty-makeup-frame flex ai-center">
... ...
pages/goods/search/search.js
1   -var t = function(t) {
  1 +var t = function (t) {
2 2 return t && t.__esModule ? t : {
3 3 default: t
4 4 };
5 5 }(require("../../../utils/LoadMore.js")), ut = require("../../../utils/util.js"),
6   - a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
  6 + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
7 7  
8 8 Page({
9 9 data: {
... ... @@ -18,143 +18,157 @@ Page({
18 18 requestUrl: "",
19 19 //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ]
20 20 hotWords: null,
21   -
  21 + is_no_plus:1,
22 22 tabname: "sort", //排序的字段
23 23 adname: "asc", //升降的字段
24   - rq_data:null,
25   -
26   -
27   - searchRecord: [],
28   - keyword: '',
29   - is_his:0,
  24 + rq_data: null,
  25 + searchRecord: [],
  26 + keyword: '',
  27 + is_his: 0,
30 28 },
31   -
32   - onLoad: function(t) {
33   - this.data.rq_data=t;
  29 +
  30 + onLoad: function (t) {
  31 + this.data.rq_data = t;
34 32 //接受有没有导购的参数
35   - var first_leader=t.first_leader;
36   - if(first_leader){
37   - getApp().globalData.first_leader=first_leader;
  33 + var first_leader = t.first_leader;
  34 + if (first_leader) {
  35 + getApp().globalData.first_leader = first_leader;
38 36 //调用接口判断是不是会员
39   - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
40   - if(res.data.code==0){
41   - getApp().globalData.guide_id=res.data.data.id;
  37 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => {
  38 + if (res.data.code == 0) {
  39 + getApp().globalData.guide_id = res.data.data.id;
42 40 }
43 41 })
44 42 }
45   -
46   - var th=this;
47   - a.getConfig2(function(rs){
48   - var arr=new Array(),arr2=new Array();
49   - if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){
50   - var arr1 = rs.hot_keywords.split('|');
51   - for (var i = 0; i < arr1.length;i++){
52   - if(i%5==0 && i!=0){
53   - arr.push(arr2);
54   - arr2=[];
55   - }else{
56   - arr2.push(arr1[i]);
  43 + var th = this;
  44 + //调用接口判断商家plus有没有过期
  45 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => {
  46 + if (res.data.code == 0) {
  47 + var arr = res.data.data.pageData;
  48 + if (arr.length > 0) {
  49 + var item = arr[0];
  50 + if (item.is_sy == 0) {
  51 + var now = Date.parse(new Date()); now = now / 1000;
  52 + if (item.end_time < now) {
  53 + th.setData({ is_no_plus: 0 })
  54 + }
  55 + }
57 56 }
58 57 }
59   - if (arr2.length > 0) arr.push(arr2);
60   - th.setData({ hotWords: arr});
61   - }
62   -
63   -
64   - //计算等级价相关
65   - var swithc_list=rs.switch_list;
66   - var sw_arr=JSON.parse(swithc_list);
67   - //---如果后台又开等级卡的开关---
68   - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
69   - th.setData({rank_switch:true});
70   - var user=getApp().globalData.userInfo;
71   - var ti=setInterval(function(){
72   - if(!user) return false;
73   - clearInterval(ti);
74   - //---回调卡的列表---
75   - th.getPlusCardType(function(ob){
76   - th.setData({card_list:ob.card_list});
77   - if(user.card_field ){
78   - var str = user['card_expiredate'].replace(/-/g, '/');
79   - var end = new Date(str);
80   - end = Date.parse(end) / 1000;
81   - var now = ut.gettimestamp();
82   -
83   - //--- 判断是等级会员,且在有效期范围内 ---
84   - if(user.card_field && now<end){
85   - var card_name=ob.name_map.get(user.card_field);
86   - if(card_name.length>7) card_name=card_name.substring(0,8);
87   - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
88   - }
89   - }
90   - })
91   - },500)
92   - }
93   -
94   -
95   -
96   - })
97   - //e.init(this, "", "requestData");
98   - var url = this.data.baseUrl;
99   -
100   - //扫一扫过来,显示搜索的内容
101   - var s_key = t.s_key;
102   - if (s_key){
103   - s_key=s_key.trim();
104   - this.search(s_key); this.openSearchModal();
105   - return;
106   - }
107   -
108   - if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;}
109   - if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;}
110   - if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;}
111   - if (0 != t.ladder_id && t.ladder_id != undefined) {
112   - url += "&ladder_id=" + t.ladder_id;
113   - this.setData({
114   - baseUrl:url,
  58 + })
  59 + a.getConfig2(function (rs) {
  60 + console.log('getConfig2', rs);
  61 + var arr = new Array(), arr2 = new Array();
  62 + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") {
  63 + var arr1 = rs.hot_keywords.split('|');
  64 + for (var i = 0; i < arr1.length; i++) {
  65 + if (i % 5 == 0 && i != 0) {
  66 + arr.push(arr2);
  67 + arr2 = [];
  68 + } else {
  69 + arr2.push(arr1[i]);
  70 + }
  71 + }
  72 + if (arr2.length > 0) arr.push(arr2);
  73 + th.setData({ hotWords: arr });
  74 + }
  75 +
  76 +
  77 + //计算等级价相关
  78 + var swithc_list = rs.switch_list;
  79 + var sw_arr = JSON.parse(swithc_list);
  80 + console.log('sw_arr', sw_arr);
  81 + //---如果后台又开等级卡的开关---
  82 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  83 + th.setData({ rank_switch: true });
  84 + var user = getApp().globalData.userInfo;
  85 + var ti = setInterval(function () {
  86 + if (!user) return false;
  87 + clearInterval(ti);
  88 + //---回调卡的列表---
  89 + th.getPlusCardType(function (ob) {
  90 + th.setData({ card_list: ob.card_list });
  91 + if (user.card_field) {
  92 + var str = user['card_expiredate'].replace(/-/g, '/');
  93 + var end = new Date(str);
  94 + end = Date.parse(end) / 1000;
  95 + var now = ut.gettimestamp();
  96 +
  97 + //--- 判断是等级会员,且在有效期范围内 ---
  98 + if (user.card_field && now < end) {
  99 + var card_name = ob.name_map.get(user.card_field);
  100 + if (card_name.length > 7) card_name = card_name.substring(0, 8);
  101 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  102 + }
  103 + }
  104 + })
  105 + }, 500)
  106 + }
  107 +
  108 +
115 109  
116 110 })
117   - }
118   - if (url != this.data.baseUrl) return this.requestSearch(url);
119   - this.openSearchModal();
  111 + //e.init(this, "", "requestData");
  112 + var url = this.data.baseUrl;
  113 +
  114 + //扫一扫过来,显示搜索的内容
  115 + var s_key = t.s_key;
  116 + if (s_key) {
  117 + s_key = s_key.trim();
  118 + this.search(s_key); this.openSearchModal();
  119 + return;
  120 + }
  121 +
  122 + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
  123 + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
  124 + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
  125 + if (0 != t.ladder_id && t.ladder_id != undefined) {
  126 + url += "&ladder_id=" + t.ladder_id;
  127 + this.setData({
  128 + baseUrl: url,
  129 +
  130 + })
  131 + }
  132 + if (url != this.data.baseUrl) return this.requestSearch(url);
  133 + this.openSearchModal();
120 134 // 获取历史搜索记录
121   - this.getHistorySearch();
  135 + this.getHistorySearch();
122 136 },
123   - changeTab: function(t) {
124   - var ord = t.currentTarget.dataset.href;
125   - var ad = t.currentTarget.dataset.ad;
  137 + changeTab: function (t) {
  138 + var ord = t.currentTarget.dataset.href;
  139 + var ad = t.currentTarget.dataset.ad;
126 140  
127   - var url = this.data.requestUrl;
  141 + var url = this.data.requestUrl;
128 142  
129   - if (this.data.tabname != ord) {
130   - this.setData({ tabname: ord, adname: "desc" });
131   - } else {
132   - ad = ad == "desc" ? "asc" : "desc";
133   - this.setData({ adname: ad });
134   - }
135   - this.resetData(), this.requestSearch(url);
  143 + if (this.data.tabname != ord) {
  144 + this.setData({ tabname: ord, adname: "desc" });
  145 + } else {
  146 + ad = ad == "desc" ? "asc" : "desc";
  147 + this.setData({ adname: ad });
  148 + }
  149 + this.resetData(), this.requestSearch(url);
136 150  
137 151 },
138 152  
139 153 //-----------真的调用地址进行搜索------------
140   - requestSearch: function(t) {
141   - if(this.data.loading) return false;
142   - this.data.loading=1;
143   - var e = this,th=e;
144   - if(getApp().globalData.userInfo){
145   - t += "&user_id=" + getApp().globalData.userInfo.user_id;
146   - }
  154 + requestSearch: function (t) {
  155 + if (this.data.loading) return false;
  156 + this.data.loading = 1;
  157 + var e = this, th = e;
  158 + if (getApp().globalData.userInfo) {
  159 + t += "&user_id=" + getApp().globalData.userInfo.user_id;
  160 + }
147 161 this.data.requestUrl = t;
148 162  
149   - var user_id=getApp().globalData.user_id;
150   - if(!user_id) user_id=0;
  163 + var user_id = getApp().globalData.user_id;
  164 + if (!user_id) user_id = 0;
151 165  
152   - getApp().request.promiseGet(t, {data:{is_mainshow: 1, isonsale: 1, store_id: oo.stoid,orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage}}).then(async res=>{
153   - th.data.loading=0;
154   - if(ut.ajax_ok(res)){
155   - if(!e.data.requestData) e.data.requestData=[];
156   - for(let i in res.data.data.pageData){
157   - let item=res.data.data.pageData[i];
  166 + getApp().request.promiseGet(t, { data: { is_mainshow: 1, isonsale: 1, store_id: oo.stoid, orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage } }).then(async res => {
  167 + th.data.loading = 0;
  168 + if (ut.ajax_ok(res)) {
  169 + if (!e.data.requestData) e.data.requestData = [];
  170 + for (let i in res.data.data.pageData) {
  171 + let item = res.data.data.pageData[i];
158 172 item.original_img = th.data.url + item.original_img;
159 173  
160 174 /*--
... ... @@ -171,48 +185,48 @@ Page({
171 185 })--*/
172 186  
173 187 var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购
174   - var prom_id=item.prom_id;
175   - var now=ut.gettimestamp();
  188 + var prom_id = item.prom_id;
  189 + var now = ut.gettimestamp();
176 190 var url = "";
177   - switch (prom_type){
  191 + switch (prom_type) {
178 192 case 1:
179   - url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id;
  193 + url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id;
180 194 break;
181 195 case 2:
182   - url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id
  196 + url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id
183 197 break;
184 198 case 4:
185   - url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id;
  199 + url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id;
186 200 break;
187 201 case 6:
188 202 url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id;
189   - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
190   - data:{
191   - store_id: oo.stoid,
192   - is_end: 0,
193   - is_show: 1,
194   - user_id: getApp().globalData.user_id,
195   - pageSize:1000,
  203 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", {
  204 + data: {
  205 + store_id: oo.stoid,
  206 + is_end: 0,
  207 + is_show: 1,
  208 + user_id: getApp().globalData.user_id,
  209 + pageSize: 1000,
196 210 }
197   - }).then(pd=>{
198   - let pd_list=pd.data.data.pageData;
199   - if(res.data.code==0 && pd_list.length>0){
200   - var flag = pd_list.some(pd=>{
201   - return pd.goods_id==item.goods_id
202   - })
203   -
204   - if(!flag){
205   - item.prom_type=0;
206   - item.prom_id=0;
207   - item.prom_price=null;
208   - }
  211 + }).then(pd => {
  212 + let pd_list = pd.data.data.pageData;
  213 + if (res.data.code == 0 && pd_list.length > 0) {
  214 + var flag = pd_list.some(pd => {
  215 + return pd.goods_id == item.goods_id
  216 + })
  217 +
  218 + if (!flag) {
  219 + item.prom_type = 0;
  220 + item.prom_id = 0;
  221 + item.prom_price = null;
  222 + }
209 223 }
210   - })
  224 + })
211 225 break;
212 226 case 8:
213 227 var presell_id = prom_id;
214 228 var url1 = "/api/weshop/marketing/marketingPresellList/list";
215   - var rd= {
  229 + var rd = {
216 230 store_id: oo.stoid,
217 231 presell_id: presell_id,
218 232 goods_id: item.goods_id
... ... @@ -224,247 +238,247 @@ Page({
224 238 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
225 239 var arr = res.data.data[0];
226 240 item.prom_price = arr.luck_goods_price;
227   - item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0);
  241 + item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0);
228 242 }
229 243 })
230 244 break;
231 245 default:
232 246 break
233 247 }
234   - if(url!=null && url!=''){
  248 + if (url != null && url != '') {
235 249 await getApp().request.promiseGet(url, {}).then(async res => {
236   - var prom =null;
237   - if(res.data.code==0 && res.data.data){
238   - prom=res.data.data;
  250 + var prom = null;
  251 + if (res.data.code == 0 && res.data.data) {
  252 + prom = res.data.data;
239 253  
240   - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time<now || (prom.show_time && prom.show_time<now)) ) {
  254 + if (prom != null && prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom.show_time && prom.show_time < now))) {
241 255 item.prom_price = res.data.data.price;
242   - if(res.data.data.user_price) item.prom_price=res.data.data.user_price;
243   - var vNum=prom.virtual_num?prom.virtual_num:0;
244   - var vNum1=prom.virtualNum?prom.virtualNum:0;
245   - var vNum2=prom.virtual?prom.virtual:0;
246   - item.sales_sum=prom.buy_num+(vNum+vNum1+vNum2);
247   - }else{
248   - item.prom_type=0;
249   - item.prom_id=0;
250   - item.prom_price=null;
  256 + if (res.data.data.user_price) item.prom_price = res.data.data.user_price;
  257 + var vNum = prom.virtual_num ? prom.virtual_num : 0;
  258 + var vNum1 = prom.virtualNum ? prom.virtualNum : 0;
  259 + var vNum2 = prom.virtual ? prom.virtual : 0;
  260 + item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2);
  261 + } else {
  262 + item.prom_type = 0;
  263 + item.prom_id = 0;
  264 + item.prom_price = null;
251 265 }
252 266  
253 267  
254 268 }
255 269 })
256 270 }
257   - if(!th.data.requestData) th.data.requestData=[];
  271 + if (!th.data.requestData) th.data.requestData = [];
258 272 th.data.requestData.push(item);
259   - e.setData({requestData: e.data.requestData});
  273 + e.setData({ requestData: e.data.requestData });
260 274 }
261 275 }
262 276 e.closeSearchModal();
263 277 })
264 278 },
265   - onReachBottom: function() {
  279 + onReachBottom: function () {
266 280 this.data.currentPage++
267 281 this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl);
268 282 },
269   - openFilterModal: function() {
  283 + openFilterModal: function () {
270 284 this.setData({
271 285 openFilterModal: !0
272 286 });
273 287 },
274   - closeFilterModal: function() {
  288 + closeFilterModal: function () {
275 289 this.setData({
276 290 openFilterModal: !1
277 291 });
278 292 },
279   - filterGoods: function(t) {
  293 + filterGoods: function (t) {
280 294 this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal();
281 295 },
282   - resetData: function() {
  296 + resetData: function () {
283 297 e.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
284 298 },
285 299  
286 300 //---回复最初的设置---显示全部分类--
287   - restoreData: function() {
  301 + restoreData: function () {
288 302 this.setData({
289 303 requestData: this.data.allData,
290 304 });
291   - this.data.currentPage=2;
  305 + this.data.currentPage = 2;
292 306 },
293   - openSearchModal: function() {
  307 + openSearchModal: function () {
294 308 this.setData({
295 309 openSearchModal: !0
296 310 });
297 311 },
298   - closeSearchModal: function() {
  312 + closeSearchModal: function () {
299 313 this.setData({
300 314 openSearchModal: !1
301 315 });
302 316 },
303   - submitSearch: function(t) {
304   - console.log(111,t);
305   - var val=t.detail.value.word;
306   - if(val==undefined) val=t.detail.value;
307   - val=val?val.trim():'';
308   - if(!val){
309   - a.showWarning("请输入搜索关键词");
310   - }
  317 + submitSearch: function (t) {
  318 + console.log(111, t);
  319 + var val = t.detail.value.word;
  320 + if (val == undefined) val = t.detail.value;
  321 + val = val ? val.trim() : '';
  322 + if (!val) {
  323 + a.showWarning("请输入搜索关键词");
  324 + }
311 325 this.search(val);
312   -
  326 +
313 327 },
314 328  
315 329 //热搜关键字
316   - searchHotWord: function(t) {
317   -
318   - var word= t.currentTarget.dataset.word;
319   - this.historyRecord(word);
320   - this.search(word);
  330 + searchHotWord: function (t) {
  331 +
  332 + var word = t.currentTarget.dataset.word;
  333 + this.historyRecord(word);
  334 + this.search(word);
321 335 },
322 336  
323 337 //-----点击搜索按钮----
324   - search: function(t) {
  338 + search: function (t) {
325 339 if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词");
326   - this.data.key_str=t;
327   - this.historyRecord();
  340 + this.data.key_str = t;
  341 + this.historyRecord();
328 342 this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
329 343 },
330 344  
331 345 //---------分享配置--------
332 346 onShareAppMessage: function (e) {
333   - var curPage=this;
  347 + var curPage = this;
334 348 var pagePath = curPage.route; //当前页面url
335 349 if (pagePath.indexOf('/') != 0) {
336 350 pagePath = '/' + pagePath;
337 351 }
338 352  
339   - if(this.data.key_str) {
  353 + if (this.data.key_str) {
340 354 pagePath += "?s_key=" + this.data.key_str;
341 355 }
342 356  
343   - if(getApp().globalData.user_id){
  357 + if (getApp().globalData.user_id) {
344 358  
345   - if(pagePath.indexOf("?")>0){
346   - pagePath+="&first_leader="+getApp().globalData.user_id;
347   - }else{
348   - pagePath+="?first_leader="+getApp().globalData.user_id;
  359 + if (pagePath.indexOf("?") > 0) {
  360 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  361 + } else {
  362 + pagePath += "?first_leader=" + getApp().globalData.user_id;
349 363 }
350 364 }
351 365  
352   - console.log("11-11"+pagePath);
  366 + console.log("11-11" + pagePath);
353 367 return {
354 368 title: "商品搜索",
355   - path:pagePath,
  369 + path: pagePath,
356 370 }
357 371 },
358 372  
359 373  
360 374 //---------图片失败,默认图片--------
361 375 bind_bnerr: function (e) {
362   - var _errImg = e.target.dataset.errorimg;
363   - var _errObj = {};
364   - _errObj[_errImg] = this.data.url+ "/miniapp/images/default_g_img.gif";
365   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  376 + var _errImg = e.target.dataset.errorimg;
  377 + var _errObj = {};
  378 + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif";
  379 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  380 + },
  381 +
  382 + //--- 获取卡类列表 ---
  383 + getPlusCardType: function (func) {
  384 + var storid = oo.stoid;
  385 + var th = this;
  386 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  387 + var plusCard = res.data.data;
  388 + var arr = [1219, 2089, 3031];
  389 + var new_arr = new Array();
  390 + var card_name_map = new Map();
  391 + var user = getApp().globalData.userInfo;
  392 +
  393 + for (var i = 0; i < plusCard.length; i++) {
  394 + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  395 + continue;
  396 + }
  397 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  398 + card_name_map.set(name, plusCard[i].CardName);
  399 + new_arr.push(plusCard[i]);
  400 +
  401 + }
  402 +
  403 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  404 + func(ob);
  405 + })
  406 + },
  407 +
  408 +
  409 + getInput(e) {
  410 + this.setData({
  411 + keyword: e.detail.value
  412 + });
  413 + },
  414 +
  415 + historyRecord(w) {
  416 + let keyword = w;
  417 + let self = this;
  418 + if (!keyword) {
  419 + keyword = this.data.key_str.trim();
  420 + }
  421 + let searchRecord = this.data.searchRecord;
  422 + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || [];
  423 +
  424 + if (keyword) {
  425 +
  426 + var index = searchRecord.indexOf(keyword);
  427 + if (index > -1) {
  428 + // 已经存在该值
  429 + searchRecord.splice(index, 1);
  430 + searchRecord.unshift(keyword);
  431 +
  432 + // 将历史记录添加到缓存中
  433 + wx.setStorage({
  434 + key: 'searchRecord',
  435 + data: searchRecord,
  436 + success: function (res) {
  437 + self.setData({
  438 + searchRecord,
  439 + })
  440 + }
  441 + })
  442 +
  443 + return;
  444 + } else {
  445 + if (searchRecord.length >= 10) {
  446 + searchRecord.pop(); // 删除最早的一条记录
  447 + };
  448 + searchRecord.unshift(keyword);
  449 +
  450 + // // 将历史记录添加到缓存中
  451 + wx.setStorage({
  452 + key: 'searchRecord',
  453 + data: searchRecord,
  454 + success: function (res) {
  455 + self.setData({
  456 + searchRecord,
  457 + })
  458 + }
  459 + })
  460 + };
  461 + };
366 462 },
367   -
368   - //--- 获取卡类列表 ---
369   - getPlusCardType: function (func) {
370   - var storid = oo.stoid;
371   - var th = this;
372   - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
373   - var plusCard = res.data.data;
374   - var arr = [1219, 2089, 3031];
375   - var new_arr = new Array();
376   - var card_name_map=new Map();
377   - var user = getApp().globalData.userInfo;
378   -
379   - for (var i = 0; i < plusCard.length; i++) {
380   - if ((!user || user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
381   - continue;
382   - }
383   - var name="card"+plusCard[i].CorrPrice.toLowerCase();
384   - card_name_map.set(name,plusCard[i].CardName);
385   - new_arr.push(plusCard[i]);
386   -
387   - }
388   -
389   - var ob={"card_list":new_arr,"name_map":card_name_map};
390   - func(ob);
391   - })
392   - },
393   -
394   -
395   - getInput(e) {
396   - this.setData({
397   - keyword: e.detail.value
398   - });
399   - },
400   -
401   - historyRecord(w) {
402   - let keyword =w;
403   - let self = this;
404   - if(!keyword){
405   - keyword = this.data.key_str.trim();
406   - }
407   - let searchRecord = this.data.searchRecord;
408   - if(!searchRecord || searchRecord.length==0) searchRecord=wx.getStorageSync('searchRecord') || [];
409   -
410   - if(keyword) {
411   -
412   - var index=searchRecord.indexOf(keyword);
413   - if(index > -1) {
414   - // 已经存在该值
415   - searchRecord.splice(index,1);
416   - searchRecord.unshift(keyword);
417   -
418   - // 将历史记录添加到缓存中
419   - wx.setStorage({
420   - key: 'searchRecord',
421   - data: searchRecord,
422   - success: function(res) {
423   - self.setData({
424   - searchRecord,
425   - })
426   - }
427   - })
428   -
429   - return;
430   - } else {
431   - if(searchRecord.length >= 10) {
432   - searchRecord.pop(); // 删除最早的一条记录
433   - };
434   - searchRecord.unshift(keyword);
435   -
436   - // // 将历史记录添加到缓存中
437   - wx.setStorage({
438   - key: 'searchRecord',
439   - data: searchRecord,
440   - success: function(res) {
441   - self.setData({
442   - searchRecord,
443   - })
444   - }
445   - })
446   - };
447   - };
448   - },
449   -
450   -
451   -
452   -
453   - getHistorySearch() {
454   - this.setData({
455   - searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
456   - });
457   - },
458   -
459   - clearSearchRecord() {
460   - wx.clearStorageSync('searchRecord');
461   - this.setData({
462   - searchRecord: []
463   - });
464   - },
465   -
466   - go_url:function (e) {
467   - var url=e.currentTarget.dataset.url;
  463 +
  464 +
  465 +
  466 +
  467 + getHistorySearch() {
  468 + this.setData({
  469 + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
  470 + });
  471 + },
  472 +
  473 + clearSearchRecord() {
  474 + wx.clearStorageSync('searchRecord');
  475 + this.setData({
  476 + searchRecord: []
  477 + });
  478 + },
  479 +
  480 + go_url: function (e) {
  481 + var url = e.currentTarget.dataset.url;
468 482 getApp().goto(url);
469 483 }
470 484 });
471 485 \ No newline at end of file
... ...
pages/goods/search/search.wxml
... ... @@ -38,10 +38,10 @@
38 38 <block wx:if="{{(item.prom_price>0 || item.prom_integral) && item.prom_id>0 && item.prom_type!=7}}">
39 39 <!-- 活动价 -->
40 40 <view class="price">
41   - <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
42   - <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
43   - <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
44   - </view>
  41 + <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
  42 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  43 + <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
  44 + </view>
45 45 <view class="comment flex jc_sb">
46 46 <view class="word-line xc-ash">¥{{item.market_price}}</view>
47 47 <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
... ... @@ -49,7 +49,7 @@
49 49 </block>
50 50 <block wx:else>
51 51 <!-- 商品价格,先判断下是后又等级价-->
52   - <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  52 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item) && is_no_plus}}">
53 53 <!-- 当会员是等级卡的时候 -->
54 54 <block wx:if="{{card_field}}">
55 55 <!-- 等级价>0 -->
... ... @@ -57,9 +57,9 @@
57 57 <view class="flex ai_center">
58 58 <view class="price">¥{{item[card_field]}}</view>
59 59 <view class="card_bg flex ai-center">
60   - <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
61   - <!-- <view class="card_name ellipsis-1">{{card_name}}</view> -->
62   - <text class="ellipsis-1">{{card_name}}</text>
  60 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  61 + <!-- <view class="card_name ellipsis-1">{{card_name}}</view> -->
  62 + <text class="ellipsis-1">{{card_name}}</text>
63 63 </view>
64 64 </view>
65 65 <view class="comment flex jc_sb">
... ... @@ -85,10 +85,10 @@
85 85 <view class="flex ai_center">
86 86 <view class="">¥{{g_filter.get_card_price(item,card_list,0)}}</view>
87 87 <view class="card_bg flex">
88   - <view class="flex ai-center">
89   - <image src="{{url}}/miniapp/images/plus/dj_icon.png" class=""></image>
90   - <text class="ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
91   - </view>
  88 + <view class="flex ai-center">
  89 + <image src="{{url}}/miniapp/images/plus/dj_icon.png" class=""></image>
  90 + <text class="ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
  91 + </view>
92 92 </view>
93 93 </view>
94 94 <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
... ... @@ -120,7 +120,7 @@
120 120 <view class="no-data" wx:if="{{!requestData||requestData.length==0}}">
121 121 <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image>
122 122 <view class="no-data-title">没有相关的数据</view>
123   - <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index"> 去逛逛 </navigator>
  123 + <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index"> 去逛逛 </navigator>
124 124 </view>
125 125 </view>
126 126 <view hidden="{{!openFilterModal}}">
... ... @@ -176,17 +176,17 @@
176 176 </view>
177 177 </block>
178 178 </view>
179   - <view class="search-hot">
180   - <view class="hot-title flex jc_sb ai_c">
181   - <text>历史搜索</text>
182   - <text class="iconfont icon-shanchu xc-ash" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
183   - </view>
184   - <block wx:if="{{searchRecord.length>0}}">
185   - <view class="hot-row flex flex-wrap" wx:key="{{index}}">
186   - <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
187   - </view>
188   - </block>
189   - <view wx:else class="fs24">暂无历史搜索记录</view>
190   - </view>
  179 + <view class="search-hot">
  180 + <view class="hot-title flex jc_sb ai_c">
  181 + <text>历史搜索</text>
  182 + <text class="iconfont icon-shanchu xc-ash" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
  183 + </view>
  184 + <block wx:if="{{searchRecord.length>0}}">
  185 + <view class="hot-row flex flex-wrap" wx:key="{{index}}">
  186 + <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
  187 + </view>
  188 + </block>
  189 + <view wx:else class="fs24">暂无历史搜索记录</view>
  190 + </view>
191 191 </view>
192 192 </view>
193 193 \ No newline at end of file
... ...