作者 朱振飞

121212

@@ -9,10 +9,8 @@ @@ -9,10 +9,8 @@
9 <view wx:if="{{item.price2!=null}}"> 9 <view wx:if="{{item.price2!=null}}">
10 10
11 <view class='goods_flex'> 11 <view class='goods_flex'>
12 - <view class='price'>¥{{item.goods_price}}</view> 12 + <view class='price'>¥{{item.price}}</view>
13 <view class="lineprice">¥{{item.line_price}}</view> 13 <view class="lineprice">¥{{item.line_price}}</view>
14 -  
15 -  
16 <view class='sell'>已卖出{{item.sales}}件</view> 14 <view class='sell'>已卖出{{item.sales}}件</view>
17 </view> 15 </view>
18 16
@@ -21,7 +19,7 @@ @@ -21,7 +19,7 @@
21 19
22 <view class='goods_flex' wx:else> 20 <view class='goods_flex' wx:else>
23 <!-- <view class='score'>积分</view> --> 21 <!-- <view class='score'>积分</view> -->
24 - <view class='price'>¥{{item.goods_price}}</view> 22 + <view class='price'>¥{{item.price}}</view>
25 <view class="lineprice">¥{{item.line_price}}</view> 23 <view class="lineprice">¥{{item.line_price}}</view>
26 <view class='sell'>已卖出{{item.sales}}件</view> 24 <view class='sell'>已卖出{{item.sales}}件</view>
27 </view> 25 </view>
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 } 91 }
92 92
93 .price { 93 .price {
94 - font-size:30rpx; 94 + font-size:36rpx;
95 font-family: PingFang SC; 95 font-family: PingFang SC;
96 font-weight: bold; 96 font-weight: bold;
97 color: rgba(242, 0, 0, 1); 97 color: rgba(242, 0, 0, 1);
@@ -5,6 +5,7 @@ Page({ @@ -5,6 +5,7 @@ Page({
5 * 页面的初始数据 5 * 页面的初始数据
6 */ 6 */
7 data: { 7 data: {
  8 + selected: 0,
8 autoplay: true, 9 autoplay: true,
9 interval: 5000, 10 interval: 5000,
10 duration: 500, 11 duration: 500,
@@ -30,41 +31,39 @@ Page({ @@ -30,41 +31,39 @@ Page({
30 status1: '', 31 status1: '',
31 status2: '', 32 status2: '',
32 title2: '', 33 title2: '',
33 - scrollTop:'',  
34 - pid:'',  
35 - logok:'',  
36 - selected:0,  
37 - list:[{  
38 -         pagePath: "/packageA/pages/index/index",  
39 -         text: "商品",  
40 -         iconPath: "/images/tabbar/icon_75.png",  
41 -         selectedIconPath: "/images/tabbar/icon_68.png"  
42 -       },  
43 -       {  
44 -         pagePath: "/packageA/pages/message/message",  
45 -         text: "消息",  
46 -         iconPath: "/images/tabbar/message.png",  
47 -         selectedIconPath: "/images/tabbar/messageactive.png"  
48 -       },  
49 -       {  
50 -         pagePath: "/packageA/pages/shop_cart/shop_cart",  
51 -         text: "购物车",  
52 -         iconPath: "/images/tabbar/icon_70.png",  
53 -         selectedIconPath: "/images/tabbar/icon_73.png"  
54 -       },  
55 -       {  
56 -         pagePath"/packageA/pages/my/my",  
57 -         text"我的",  
58 -         iconPath"/images/tabbar/icon_71.png",  
59 -         selectedIconPath"/images/tabbar/icon_72.png"  
60 -       }],  
61 - category_id1:'',  
62 - sort:'',  
63 - keyword:'',  
64 - shop_arr:[],  
65 - pricesheng:false,  
66 - xiaoliang:false 34 + scrollTop: '',
  35 + pid: '',
  36 + logok: '',
  37 + typename: 1,
  38 + list: [{
  39 + pagePath: "/packageA/pages/index/index",
  40 + text: "商品",
  41 + iconPath: "/images/tabbar/icon_75.png",
  42 + selectedIconPath: "/images/tabbar/icon_68.png"
67 }, 43 },
  44 + {
  45 + pagePath: "/packageA/pages/message/message",
  46 + text: "消息",
  47 + iconPath: "/images/tabbar/message.png",
  48 + selectedIconPath: "/images/tabbar/messageactive.png"
  49 + },
  50 + {
  51 + pagePath: "/packageA/pages/shop_cart/shop_cart",
  52 + text: "购物车",
  53 + iconPath: "/images/tabbar/icon_70.png",
  54 + selectedIconPath: "/images/tabbar/icon_73.png"
  55 + },
  56 + {
  57 + pagePath: "/packageA/pages/my/my",
  58 + text: "我的",
  59 + iconPath: "/images/tabbar/icon_71.png",
  60 + selectedIconPath: "/images/tabbar/icon_72.png"
  61 + }
  62 + ]
  63 + },
  64 +
  65 +
  66 +
68 67
69 scroll(e) { 68 scroll(e) {
70 // console.log(e.detail.scrollTop) 69 // console.log(e.detail.scrollTop)
@@ -83,74 +82,60 @@ Page({ @@ -83,74 +82,60 @@ Page({
83 }, 82 },
84 83
85 84
86 - onLoad: function(options) {  
87 - console.log( app.globalData.index)  
88 -if( app.globalData.index==undefined){ 85 + onLoad: function (options) {
  86 + console.log(app.globalData.index)
  87 + if (wx.getStorageSync('entrance_type') == '2') {
  88 + wx.setNavigationBarTitle({
  89 + title: '工会商城'
  90 + })
  91 + }else{
  92 + wx.setNavigationBarTitle({
  93 + title: '劳保商城'
  94 + })
  95 + }
  96 + if (app.globalData.index == undefined) {
89 let that = this; 97 let that = this;
90 - let token=wx.getStorageSync('token'); 98 + let token = wx.getStorageSync('token');
91 99
92 - console.log('woshitoe',token);  
93 - if(token!=""){ 100 + console.log('woshitoe', token);
  101 + if (token != "") {
94 console.log(9999) 102 console.log(9999)
95 this.getInfoFun() 103 this.getInfoFun()
96 } 104 }
  105 +
97 this.get_notice() 106 this.get_notice()
98 this.get_shopnum() 107 this.get_shopnum()
99 this.getmessagelist(); 108 this.getmessagelist();
100 - console.log('998867',this.data.pid)  
101 - // if(this.data.pid){  
102 - // this.get_info(this.data.pid, 2);  
103 - // }else{  
104 - // this.get_info(0, 1);  
105 - // } 109 + console.log('998867', this.data.pid)
  110 + if (this.data.pid) {
  111 + this.get_info(this.data.pid, 2);
  112 + } else {
  113 + this.get_info(0, 1);
  114 + }
106 115
107 // 获取活动专区 116 // 获取活动专区
108 this.getzhuanqulist(); 117 this.getzhuanqulist();
109 this.getxianshi(); 118 this.getxianshi();
110 - setTimeout(function() { 119 + setTimeout(function () {
111 that.setData({ 120 that.setData({
112 showtime: true 121 showtime: true
113 }) 122 })
114 }, 990) 123 }, 990)
115 -} 124 + }
116 //控制显示隐藏 125 //控制显示隐藏
117 this.ishow() 126 this.ishow()
118 -// 我写的项目  
119 -// 获取一级分类  
120 -this.getonkind();  
121 -// 获取商品列表  
122 -this.getgoodlist()  
123 127
124 }, 128 },
125 129
126 - // 获取一级分类  
127 - getonkind(){  
128 - let that= this;  
129 - let url="/sundry/get_category"  
130 - app.postk(url, {}).then((r) => {  
131 - console.log('商品分类',r)  
132 - let obj = {  
133 - name: '首页',  
134 - id: ''  
135 - }  
136 - r.data.unshift(obj)  
137 - that.setData({  
138 - nav_arr: r.data  
139 - })  
140 - })  
141 - },  
142 -  
143 -  
144 -  
145 // 获取个人信息 130 // 获取个人信息
146 getInfoFun() { 131 getInfoFun() {
147 - let that= this; 132 + let that = this;
148 let u = app.interface.readteacher; 133 let u = app.interface.readteacher;
149 app.post(u, {}).then((r) => { 134 app.post(u, {}).then((r) => {
150 - console.log('3489523498',r) 135 + console.log('3489523498', r)
151 if (r.code == 200) { 136 if (r.code == 200) {
152 137
153 - app.globalData.login_new=r.msg.login_new; 138 + app.globalData.login_new = r.msg.login_new;
154 app.globalData.status = r.msg.status; 139 app.globalData.status = r.msg.status;
155 console.log(app.globalData.status) 140 console.log(app.globalData.status)
156 // t.setData({ 141 // t.setData({
@@ -170,13 +155,12 @@ this.getgoodlist() @@ -170,13 +155,12 @@ this.getgoodlist()
170 wx.navigateTo({ 155 wx.navigateTo({
171 url: '/packageA/pages/register/register', 156 url: '/packageA/pages/register/register',
172 }) 157 })
173 - } else if (res.cancel) {  
174 - } 158 + } else if (res.cancel) {}
175 } 159 }
176 }) 160 })
177 - }else{  
178 - let login_new=wx.getStorageSync("login");  
179 - if(login_new==0){ 161 + } else {
  162 + let login_new = wx.getStorageSync("login");
  163 + if (login_new == 0) {
180 // wx.showToast({ 164 // wx.showToast({
181 // title: '您还不是会员', 165 // title: '您还不是会员',
182 // icon:"none" 166 // icon:"none"
@@ -196,8 +180,7 @@ this.getgoodlist() @@ -196,8 +180,7 @@ this.getgoodlist()
196 wx.navigateTo({ 180 wx.navigateTo({
197 url: '/packageA/pages/login/login', 181 url: '/packageA/pages/login/login',
198 }) 182 })
199 - } else if (res.cancel) {  
200 - } 183 + } else if (res.cancel) {}
201 } 184 }
202 }) 185 })
203 186
@@ -206,7 +189,7 @@ this.getgoodlist() @@ -206,7 +189,7 @@ this.getgoodlist()
206 189
207 } 190 }
208 wx.navigateTo({ 191 wx.navigateTo({
209 - url: '/packageA/pages/xianshi/xianshi?title2='+this.data.title2, 192 + url: '/packageA/pages/xianshi/xianshi?title2=' + this.data.title2,
210 }) 193 })
211 } 194 }
212 195
@@ -284,7 +267,7 @@ this.getgoodlist() @@ -284,7 +267,7 @@ this.getgoodlist()
284 var that = this; 267 var that = this;
285 console.log('999', that.data.endTime) 268 console.log('999', that.data.endTime)
286 var time = that.data.endTime; 269 var time = that.data.endTime;
287 - var interval = setInterval(function() { 270 + var interval = setInterval(function () {
288 // 秒数 271 // 秒数
289 let day = parseInt(time / (60 * 60 * 24)); 272 let day = parseInt(time / (60 * 60 * 24));
290 let hou = parseInt(time % (60 * 60 * 24) / 3600); 273 let hou = parseInt(time % (60 * 60 * 24) / 3600);
@@ -313,15 +296,15 @@ this.getgoodlist() @@ -313,15 +296,15 @@ this.getgoodlist()
313 //获取活动专区列表 296 //获取活动专区列表
314 getzhuanqulist() { 297 getzhuanqulist() {
315 let that = this 298 let that = this
316 - let url = '/activity/get_list'; 299 + let url = '/activity/get_all';
317 let data = { 300 let data = {
318 301
319 302
320 } 303 }
321 - app.postk(url, data, "POST").then((r) => { 304 + app.post(url, data, "POST").then((r) => {
322 console.log(r) 305 console.log(r)
323 that.setData({ 306 that.setData({
324 - activity: r.data 307 + activity: r.msg
325 }) 308 })
326 309
327 console.log(that.data.activity) 310 console.log(that.data.activity)
@@ -347,13 +330,12 @@ this.getgoodlist() @@ -347,13 +330,12 @@ this.getgoodlist()
347 wx.navigateTo({ 330 wx.navigateTo({
348 url: '/packageA/pages/register/register', 331 url: '/packageA/pages/register/register',
349 }) 332 })
350 - } else if (res.cancel) {  
351 - } 333 + } else if (res.cancel) {}
352 } 334 }
353 }) 335 })
354 - }else{  
355 - let login_new=wx.getStorageSync('login');  
356 - if(login_new==0){ 336 + } else {
  337 + let login_new = wx.getStorageSync('login');
  338 + if (login_new == 0) {
357 wx.showModal({ 339 wx.showModal({
358 title: '提示', 340 title: '提示',
359 content: '您还不是会员', 341 content: '您还不是会员',
@@ -364,8 +346,7 @@ this.getgoodlist() @@ -364,8 +346,7 @@ this.getgoodlist()
364 wx.navigateTo({ 346 wx.navigateTo({
365 url: '/packageA/pages/login/login', 347 url: '/packageA/pages/login/login',
366 }) 348 })
367 - } else if (res.cancel) {  
368 - } 349 + } else if (res.cancel) {}
369 } 350 }
370 }) 351 })
371 352
@@ -389,15 +370,14 @@ this.getgoodlist() @@ -389,15 +370,14 @@ this.getgoodlist()
389 wx.navigateTo({ 370 wx.navigateTo({
390 url: '/packageA/pages/register/register', 371 url: '/packageA/pages/register/register',
391 }) 372 })
392 - } else if (res.cancel) {  
393 - } 373 + } else if (res.cancel) {}
394 } 374 }
395 }) 375 })
396 376
397 return false 377 return false
398 } 378 }
399 - let login_new=wx.getStorageSync('login');  
400 - if(login_new==0){ 379 + let login_new = wx.getStorageSync('login');
  380 + if (login_new == 0) {
401 wx.showModal({ 381 wx.showModal({
402 title: '提示', 382 title: '提示',
403 content: '您还不是会员', 383 content: '您还不是会员',
@@ -408,8 +388,7 @@ this.getgoodlist() @@ -408,8 +388,7 @@ this.getgoodlist()
408 wx.navigateTo({ 388 wx.navigateTo({
409 url: '/packageA/pages/login/login', 389 url: '/packageA/pages/login/login',
410 }) 390 })
411 - } else if (res.cancel) {  
412 - } 391 + } else if (res.cancel) {}
413 } 392 }
414 }) 393 })
415 394
@@ -437,13 +416,12 @@ this.getgoodlist() @@ -437,13 +416,12 @@ this.getgoodlist()
437 wx.navigateTo({ 416 wx.navigateTo({
438 url: '/packageA/pages/register/register', 417 url: '/packageA/pages/register/register',
439 }) 418 })
440 - } else if (res.cancel) {  
441 - } 419 + } else if (res.cancel) {}
442 } 420 }
443 }) 421 })
444 - }else{  
445 - let login_new=wx.getStorageSync('login');  
446 - if(login_new==0){ 422 + } else {
  423 + let login_new = wx.getStorageSync('login');
  424 + if (login_new == 0) {
447 wx.showModal({ 425 wx.showModal({
448 title: '提示', 426 title: '提示',
449 content: '您还不是会员', 427 content: '您还不是会员',
@@ -454,24 +432,18 @@ this.getgoodlist() @@ -454,24 +432,18 @@ this.getgoodlist()
454 wx.navigateTo({ 432 wx.navigateTo({
455 url: '/packageA/pages/login/login', 433 url: '/packageA/pages/login/login',
456 }) 434 })
457 - } else if (res.cancel) {  
458 - } 435 + } else if (res.cancel) {}
459 } 436 }
460 }) 437 })
461 438
462 return false 439 return false
463 } 440 }
464 let title = this.data.nav_arr[this.data.nav_index].name 441 let title = this.data.nav_arr[this.data.nav_index].name
465 - let category_id2=e.currentTarget.dataset.id; 442 + let index = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
  443 + let pid = this.data.nav_arr[this.data.nav_index].id
466 wx.navigateTo({ 444 wx.navigateTo({
467 - url: '/packageA/pages/search/search_result/search_result?title=' + title + '&category_id2=' + category_id2 445 + url: '/packageA/pages/search/search_result/search_result?title=' + title + "&index=" + index + '&pid=' + pid
468 }) 446 })
469 -  
470 - // let index = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0  
471 - // let pid = this.data.nav_arr[this.data.nav_index].id  
472 - // wx.navigateTo({  
473 - // url: '/packageA/pages/search/search_result/search_result?title=' + title + "&index=" + index + '&pid=' + pid  
474 - // })  
475 } 447 }
476 448
477 }, 449 },
@@ -495,13 +467,12 @@ this.getgoodlist() @@ -495,13 +467,12 @@ this.getgoodlist()
495 wx.navigateTo({ 467 wx.navigateTo({
496 url: '/packageA/pages/register/register', 468 url: '/packageA/pages/register/register',
497 }) 469 })
498 - } else if (res.cancel) {  
499 - } 470 + } else if (res.cancel) {}
500 } 471 }
501 }) 472 })
502 } else { 473 } else {
503 - let login_new=wx.getStorageSync('login');  
504 - if(login_new==0){ 474 + let login_new = wx.getStorageSync('login');
  475 + if (login_new == 0) {
505 wx.showModal({ 476 wx.showModal({
506 title: '提示', 477 title: '提示',
507 content: '您还不是会员', 478 content: '您还不是会员',
@@ -510,8 +481,7 @@ this.getgoodlist() @@ -510,8 +481,7 @@ this.getgoodlist()
510 wx.navigateTo({ 481 wx.navigateTo({
511 url: '/packageA/pages/login/login', 482 url: '/packageA/pages/login/login',
512 }) 483 })
513 - } else if (res.cancel) {  
514 - } 484 + } else if (res.cancel) {}
515 } 485 }
516 }) 486 })
517 487
@@ -522,9 +492,9 @@ this.getgoodlist() @@ -522,9 +492,9 @@ this.getgoodlist()
522 url: '/packageA/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src 492 url: '/packageA/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
523 }) 493 })
524 } else { 494 } else {
525 - // wx.navigateTo({  
526 - // url: '/packageA/pages/shop_detail/shop_detail?id=' + id  
527 - // }) 495 + wx.navigateTo({
  496 + url: '/packageA/pages/shop_detail/shop_detail?id=' + id
  497 + })
528 } 498 }
529 } 499 }
530 500
@@ -536,129 +506,67 @@ this.getgoodlist() @@ -536,129 +506,67 @@ this.getgoodlist()
536 // 排序 506 // 排序
537 reorder(e) { 507 reorder(e) {
538 let that = this 508 let that = this
  509 + let index = Number(e.currentTarget.dataset.index)
  510 + if (index == 1) {
  511 + if (that.data.price == "price") {
539 that.setData({ 512 that.setData({
540 - page:1,  
541 - shop_arr:[] 513 + price: 'price desc'
542 }) 514 })
543 - let index = Number(e.currentTarget.dataset.index); 515 + } else {
544 that.setData({ 516 that.setData({
545 - c_index:index,  
546 - sort:index 517 + price: 'price'
547 }) 518 })
548 - if(index==1){  
549 - this.setData({  
550 - pricesheng:!this.data.pricesheng  
551 - })  
552 - if(this.data.pricesheng==true){  
553 - this.setData({  
554 - sort:1 519 + }
  520 + } else if (index == 2) {
  521 + if (that.data.paynum == "paynum") {
  522 + that.setData({
  523 + paynum: 'paynum desc'
555 }) 524 })
556 - }else{  
557 - this.setData({  
558 - sort:2 525 + } else {
  526 + that.setData({
  527 + paynum: 'paynum'
559 }) 528 })
560 } 529 }
561 } 530 }
562 - if(this.data.index==2){  
563 - this.setData({  
564 - xiaoliang:!this.data.xiaoliang  
565 - })  
566 - if(this.data.xiaoliang==true){  
567 this.setData({ 531 this.setData({
568 - sort:3  
569 - })  
570 - }else{  
571 - this.setData({  
572 - sort:4 532 + c_index: e.currentTarget.dataset.index,
  533 + page: 1,
  534 + page_type: false
573 }) 535 })
574 - }  
575 - }  
576 - that.getgoodlist()  
577 -  
578 - // let that = this  
579 - // let index = Number(e.currentTarget.dataset.index)  
580 - // if (index == 1) {  
581 - // if (that.data.price == "price") {  
582 - // that.setData({  
583 - // price: 'price desc'  
584 - // })  
585 - // } else {  
586 - // that.setData({  
587 - // price: 'price'  
588 - // })  
589 - // }  
590 - // } else if (index == 2) {  
591 - // if (that.data.paynum == "paynum") {  
592 - // that.setData({  
593 - // paynum: 'paynum desc'  
594 - // })  
595 - // } else {  
596 - // that.setData({  
597 - // paynum: 'paynum'  
598 - // })  
599 - // }  
600 - // }  
601 - // this.setData({  
602 - // c_index: e.currentTarget.dataset.index,  
603 - // page: 1,  
604 - // page_type: false  
605 - // })  
606 - // //调用排序接口  
607 - // this.good_list(this.data.pid, e.currentTarget.dataset.index) 536 + //调用排序接口
  537 + this.good_list(this.data.pid, e.currentTarget.dataset.index)
608 }, 538 },
609 -// 选择一级分类 539 +
610 select_nav(e) { 540 select_nav(e) {
611 let index = Number(e.currentTarget.dataset.index) 541 let index = Number(e.currentTarget.dataset.index)
612 let id = e.currentTarget.dataset.id; 542 let id = e.currentTarget.dataset.id;
613 - let newclass_arr=this.data.nav_arr[index].child  
614 this.setData({ 543 this.setData({
615 - category_id1:id,  
616 - class_arr:newclass_arr,  
617 - nav_index:index  
618 - })  
619 - },  
620 - // 获取商品列表  
621 - getgoodlist(){  
622 - let that=this;  
623 - let url = '/goods/get_goods'  
624 - let param={  
625 - category_id1:this.data.category_id1,  
626 - sort:this.data.sort,  
627 - keyword:this.data.keyword,  
628 - page:this.data.page,  
629 - pageNum:10  
630 - }  
631 - app.postk(url, param).then((res) => {  
632 - if(that.data.page>1){  
633 - if(res.data.length==0){  
634 - wx.showToast({  
635 - title:'没有更多了~',  
636 - icon:'none'  
637 - 544 + pid: id
638 }) 545 })
639 - }else{ 546 +
640 this.setData({ 547 this.setData({
641 - shop_arr:that.data.shop_arr.concat(res.data) 548 + scrollTop: 0
642 }) 549 })
643 - }  
644 - }else{ 550 + if (index == this.data.nav_index) {
  551 + return
  552 + } else {
645 this.setData({ 553 this.setData({
646 - shop_arr:that.data.shop_arr.concat(res.data) 554 + nav_index: index,
  555 + page: 1,
  556 + page_type: false,
  557 + c_index: 0, //筛选分类下标
  558 + price: 'price desc', //价格排序方式
  559 + paynum: 'paynum desc' //销量排序方式
647 }) 560 })
  561 + this.get_info(id, 2)
648 } 562 }
649 -  
650 -  
651 - console.log(that.data.shop_arr,'轮播图')  
652 - })  
653 }, 563 },
654 -  
655 // 轮播图 564 // 轮播图
656 get_banner() { 565 get_banner() {
657 - let url = '/sundry/get_slide'  
658 - app.postk(url, {}).then((res) => {  
659 - console.log(res,'轮播图') 566 + let url = app.interface.banner
  567 + app.post(url, {}).then((res) => {
660 this.setData({ 568 this.setData({
661 - imgurl: res.data 569 + imgurl: res.msg
662 }) 570 })
663 }) 571 })
664 }, 572 },
@@ -676,45 +584,45 @@ this.getgoodlist() @@ -676,45 +584,45 @@ this.getgoodlist()
676 }) 584 })
677 }, 585 },
678 //获取页面信息 586 //获取页面信息
679 - // get_info(pid, type) { //type 1为小标题 2为小标题下的小分类  
680 - // wx.showLoading({  
681 - // title: '加载中'  
682 - // })  
683 - // let that = this  
684 - // let url = app.interface.index  
685 - // let params = {  
686 - // pid: pid  
687 - // }  
688 - // app.post(url, params).then((res) => {  
689 - // console.log('88776654', res)  
690 - // wx.hideLoading()  
691 - // if (type == 1) { 587 + get_info(pid, type) { //type 1为小标题 2为小标题下的小分类
  588 + wx.showLoading({
  589 + title: '加载中'
  590 + })
  591 + let that = this
  592 + let url = app.interface.index
  593 + let params = {
  594 + pid: pid
  595 + }
  596 + app.post(url, params).then((res) => {
  597 + console.log('88776654', res)
  598 + wx.hideLoading()
  599 + if (type == 1) {
  600 + let obj = {
  601 + name: '首页',
  602 + id: ''
  603 + }
  604 + res.msg.unshift(obj)
  605 + that.setData({
  606 + nav_arr: res.msg
  607 + })
  608 + that.get_info(res.msg[0].id, 2)
  609 + } else if (type == 2) {
  610 + console.log('666', res)
692 // let obj = { 611 // let obj = {
693 - // name: '首页', 612 + // name: '全部',
694 // id: '' 613 // id: ''
695 // } 614 // }
696 // res.msg.unshift(obj) 615 // res.msg.unshift(obj)
697 - // that.setData({  
698 - // nav_arr: res.data  
699 - // })  
700 - // that.get_info(res.msg[0].id, 2)  
701 - // } else if (type == 2) {  
702 - // console.log('666', res)  
703 - // // let obj = {  
704 - // // name: '全部',  
705 - // // id: ''  
706 - // // }  
707 - // // res.msg.unshift(obj)  
708 - // that.setData({  
709 - // class_arr: res.data,  
710 - // cid: ''  
711 - // })  
712 - // that.good_list(pid, that.data.c_index)  
713 - // }  
714 - // }).catch((er) => {  
715 - // wx.hideLoading()  
716 - // })  
717 - // }, 616 + that.setData({
  617 + class_arr: res.msg,
  618 + cid: ''
  619 + })
  620 + that.good_list(pid, that.data.c_index)
  621 + }
  622 + }).catch((er) => {
  623 + wx.hideLoading()
  624 + })
  625 + },
718 //获取商品列表 626 //获取商品列表
719 good_list(pid, c_index) { 627 good_list(pid, c_index) {
720 wx.showLoading({ 628 wx.showLoading({
@@ -768,7 +676,7 @@ this.getgoodlist() @@ -768,7 +676,7 @@ this.getgoodlist()
768 if (res.msg > 0) { 676 if (res.msg > 0) {
769 wx.showTabBarRedDot({ 677 wx.showTabBarRedDot({
770 index: 2, 678 index: 2,
771 - success: function(red) { 679 + success: function (red) {
772 wx.setTabBarBadge({ 680 wx.setTabBarBadge({
773 index: 2, 681 index: 2,
774 text: res.msg.toString(), 682 text: res.msg.toString(),
@@ -798,7 +706,7 @@ this.getgoodlist() @@ -798,7 +706,7 @@ this.getgoodlist()
798 // }) 706 // })
799 707
800 let newlist = []; 708 let newlist = [];
801 - r.msg.forEach(function(value, index, array) { 709 + r.msg.forEach(function (value, index, array) {
802 console.log(newlist) 710 console.log(newlist)
803 if (value.status == 1) { 711 if (value.status == 1) {
804 newlist.push(value) 712 newlist.push(value)
@@ -809,7 +717,7 @@ this.getgoodlist() @@ -809,7 +717,7 @@ this.getgoodlist()
809 if (newlist.length != 0) { 717 if (newlist.length != 0) {
810 wx.showTabBarRedDot({ 718 wx.showTabBarRedDot({
811 index: 1, 719 index: 1,
812 - success: function(red) { 720 + success: function (red) {
813 721
814 wx.setTabBarBadge({ 722 wx.setTabBarBadge({
815 index: 1, 723 index: 1,
@@ -827,34 +735,37 @@ this.getgoodlist() @@ -827,34 +735,37 @@ this.getgoodlist()
827 /** 735 /**
828 * 生命周期函数--监听页面初次渲染完成 736 * 生命周期函数--监听页面初次渲染完成
829 */ 737 */
830 - onReady: function() { 738 + onReady: function () {
831 739
832 }, 740 },
833 741
834 /** 742 /**
835 * 生命周期函数--监听页面显示 743 * 生命周期函数--监听页面显示
836 */ 744 */
837 - onShow: function() { 745 + onShow: function () {
  746 +
838 this.setData({ 747 this.setData({
839 - logok:app.globalData.baseUrlimg+"assets/img/cb2ad36a391388f19f5f912fa021f8f.png" 748 + logok: app.globalData.baseUrlimg + "assets/img/cb2ad36a391388f19f5f912fa021f8f.png"
840 }) 749 })
  750 + console.log(this.data.logok)
  751 + // this.logok=app.globalData.baseUrlimg+"assets/img/cb2ad36a391388f19f5f912fa021f8f.png''
841 this.get_banner() 752 this.get_banner()
842 console.log(app.globalData.index) 753 console.log(app.globalData.index)
843 - if(app.globalData.index==0){  
844 - app.globalData.index=undefined  
845 - let token=wx.getStorageSync('token');  
846 - console.log('woshitoe',token)  
847 - if(token!=""){ 754 + if (app.globalData.index == 0) {
  755 + app.globalData.index = undefined
  756 + let token = wx.getStorageSync('token');
  757 + console.log('woshitoe', token)
  758 + if (token != "") {
848 this.getInfoFun() 759 this.getInfoFun()
849 } 760 }
850 this.get_notice() 761 this.get_notice()
851 this.get_shopnum() 762 this.get_shopnum()
852 this.getmessagelist(); 763 this.getmessagelist();
853 - console.log('998867',this.data.pid)  
854 - if(this.data.pid){  
855 - // this.get_info(this.data.pid, 2);  
856 - }else{  
857 - // this.get_info(0, 1); 764 + console.log('998867', this.data.pid)
  765 + if (this.data.pid) {
  766 + this.get_info(this.data.pid, 2);
  767 + } else {
  768 + this.get_info(0, 1);
858 } 769 }
859 770
860 //控制显示隐藏 771 //控制显示隐藏
@@ -868,70 +779,63 @@ this.getgoodlist() @@ -868,70 +779,63 @@ this.getgoodlist()
868 /** 779 /**
869 * 生命周期函数--监听页面隐藏 780 * 生命周期函数--监听页面隐藏
870 */ 781 */
871 - onHide: function() { 782 + onHide: function () {
872 783
873 }, 784 },
874 785
875 /** 786 /**
876 * 生命周期函数--监听页面卸载 787 * 生命周期函数--监听页面卸载
877 */ 788 */
878 - onUnload: function() { 789 + onUnload: function () {
879 790
880 }, 791 },
881 792
882 /** 793 /**
883 * 页面相关事件处理函数--监听用户下拉动作 794 * 页面相关事件处理函数--监听用户下拉动作
884 */ 795 */
885 - onPullDownRefresh: function() { 796 + onPullDownRefresh: function () {
886 797
887 }, 798 },
888 - loadMore(e){  
889 - let newpage=this.data.page;  
890 - newpage++;  
891 - this.setData({  
892 - page:newpage 799 + loadMore(e) {
  800 + console.log(e)
  801 + let that = this
  802 + if (that.data.page_type) {
  803 + wx.showToast({
  804 + title: '暂无更多数据',
  805 + icon: 'none',
  806 + duration: 1000
893 }) 807 })
894 - this.getgoodlist()  
895 - // console.log(e)  
896 - // let that = this  
897 - // if (that.data.page_type) {  
898 - // wx.showToast({  
899 - // title: '暂无更多数据',  
900 - // icon: 'none',  
901 - // duration: 1000  
902 - // })  
903 - // return  
904 - // }  
905 - // that.setData({  
906 - // page: that.data.page + 1  
907 - // })  
908 - // that.good_list(that.data.pid, that.data.c_index) 808 + return
  809 + }
  810 + that.setData({
  811 + page: that.data.page + 1
  812 + })
  813 + that.good_list(that.data.pid, that.data.c_index)
909 }, 814 },
910 /** 815 /**
911 * 页面上拉触底事件的处理函数 816 * 页面上拉触底事件的处理函数
912 */ 817 */
913 - onReachBottom: function() {  
914 -  
915 - // console.log(43898438493)  
916 - // let that = this  
917 - // if (that.data.page_type) {  
918 - // wx.showToast({  
919 - // title: '暂无更多数据',  
920 - // icon: 'none',  
921 - // duration: 1000  
922 - // })  
923 - // return  
924 - // }  
925 - // that.setData({  
926 - // page: that.data.page + 1  
927 - // })  
928 - // that.good_list(that.data.pid, that.data.c_index) 818 + onReachBottom: function () {
  819 + console.log(43898438493)
  820 + let that = this
  821 + if (that.data.page_type) {
  822 + wx.showToast({
  823 + title: '暂无更多数据',
  824 + icon: 'none',
  825 + duration: 1000
  826 + })
  827 + return
  828 + }
  829 + that.setData({
  830 + page: that.data.page + 1
  831 + })
  832 + that.good_list(that.data.pid, that.data.c_index)
929 }, 833 },
930 834
931 /** 835 /**
932 * 用户点击右上角分享 836 * 用户点击右上角分享
933 */ 837 */
934 - onShareAppMessage: function() { 838 + onShareAppMessage: function () {
935 839
936 } 840 }
937 }) 841 })
1 { 1 {
2 - "navigationBarTitleText": "首页", 2 + "navigationBarTitleText": "",
3 "usingComponents": { 3 "usingComponents": {
4 "concat": "/packageA/Components/concat/concat", 4 "concat": "/packageA/Components/concat/concat",
5 "Model_item": "/packageA/Components/Model_item/Model_item", 5 "Model_item": "/packageA/Components/Model_item/Model_item",
@@ -52,10 +52,10 @@ Page({ @@ -52,10 +52,10 @@ Page({
52 pageNum: 10, 52 pageNum: 10,
53 53
54 } 54 }
55 - app.post(url, data, "POST").then((r) => { 55 + app.postk(url, data, "POST").then((r) => {
56 console.log(r) 56 console.log(r)
57 that.setData({ 57 that.setData({
58 - messagelist: that.data.messagelist.concat(r.msg) 58 + messagelist: that.data.messagelist.concat(r.data)
59 }) 59 })
60 60
61 let newlist = []; 61 let newlist = [];
@@ -71,7 +71,6 @@ Page({ @@ -71,7 +71,6 @@ Page({
71 wx.showTabBarRedDot({ 71 wx.showTabBarRedDot({
72 index: 1, 72 index: 1,
73 success: function(red) { 73 success: function(red) {
74 -  
75 wx.setTabBarBadge({ 74 wx.setTabBarBadge({
76 index: 1, 75 index: 1,
77 text: newlist.length.toString(), 76 text: newlist.length.toString(),
@@ -99,7 +98,7 @@ Page({ @@ -99,7 +98,7 @@ Page({
99 ordertail(e) { 98 ordertail(e) {
100 let id = e.currentTarget.dataset.id; 99 let id = e.currentTarget.dataset.id;
101 wx.navigateTo({ 100 wx.navigateTo({
102 - url: '/pages/messagedetail/messagedetail?id=' + id, 101 + url: '/packageA/pages/messagedetail/messagedetail?id=' + id,
103 }) 102 })
104 }, 103 },
105 104
1 <block wx:if="{{token==''}}"> 1 <block wx:if="{{token==''}}">
2 - <navigator class="no_login" catchtap="go_login" url="/pages/register/register" hover-class="none">请先登录</navigator> 2 + <navigator class="no_login" catchtap="go_login" url="/packageA/pages/register/register" hover-class="none">请先登录</navigator>
3 </block> 3 </block>
4 4
5 <block wx:elif="{{login_new==''}}"> 5 <block wx:elif="{{login_new==''}}">
6 - <navigator class="no_login" catchtap="go_login" url="/pages/login/login" hover-class="none">请先绑定会员</navigator> 6 + <navigator class="no_login" catchtap="go_login" url="/packageA/pages/login/login" hover-class="none">请先绑定会员</navigator>
7 </block> 7 </block>
8 8
9 <block wx:else> 9 <block wx:else>
@@ -9,12 +9,7 @@ Page({ @@ -9,12 +9,7 @@ Page({
9 page: 1, 9 page: 1,
10 c_index: 0, //筛选分类下标 10 c_index: 0, //筛选分类下标
11 price: 'price desc', //价格排序方式 11 price: 'price desc', //价格排序方式
12 - paynum: 'paynum desc' ,//销量排序方式  
13 - category_id2:'',  
14 - shop_arr:[],  
15 - keyword:'',  
16 - sort:''  
17 - 12 + paynum: 'paynum desc' //销量排序方式
18 }, 13 },
19 14
20 15
@@ -139,67 +134,30 @@ Page({ @@ -139,67 +134,30 @@ Page({
139 wx.setNavigationBarTitle({ 134 wx.setNavigationBarTitle({
140 title: options.title ? options.title : '搜索' 135 title: options.title ? options.title : '搜索'
141 }) 136 })
  137 + if (options.index){
142 this.setData({ 138 this.setData({
143 - category_id2:options.category_id2  
144 - })  
145 - this.getgoodlist()  
146 - // if (options.index){  
147 - // this.setData({  
148 - // nav_index: Number(options.index),  
149 - // nav_type: true,  
150 - // pid: options.pid  
151 - // })  
152 - // this.get_info(options.pid)  
153 - // } else {  
154 - // if (options.name){  
155 - // this.setData({  
156 - // cid: options.name,  
157 - // search_type: true  
158 - // })  
159 - // this.good_list(options.name, 0)  
160 - // } else {  
161 - // this.setData({  
162 - // cid: options.pid  
163 - // })  
164 - // this.good_list(options.pid, 0)  
165 - // }  
166 -  
167 - // }  
168 -  
169 -  
170 - },  
171 - getgoodlist(){  
172 - let that=this;  
173 - let url = '/goods/get_goods'  
174 - let param={  
175 - category_id2:this.data.category_id2,  
176 - sort:this.data.sort,  
177 - keyword:this.data.keyword,  
178 - page:this.data.page,  
179 - pageNum:10  
180 - }  
181 - app.postk(url, param).then((res) => {  
182 - if(that.data.page>1){  
183 - if(res.data.length==0){  
184 - wx.showToast({  
185 - title:'没有更多了~',  
186 - icon:'none'  
187 - 139 + nav_index: Number(options.index),
  140 + nav_type: true,
  141 + pid: options.pid
188 }) 142 })
189 - }else{ 143 + this.get_info(options.pid)
  144 + } else {
  145 + if (options.name){
190 this.setData({ 146 this.setData({
191 - shop_arr:that.data.shop_arr.concat(res.data) 147 + cid: options.name,
  148 + search_type: true
192 }) 149 })
193 - }  
194 - }else{ 150 + this.good_list(options.name, 0)
  151 + } else {
195 this.setData({ 152 this.setData({
196 - shop_arr:that.data.shop_arr.concat(res.data) 153 + cid: options.pid
197 }) 154 })
  155 + this.good_list(options.pid, 0)
  156 + }
  157 +
198 } 158 }
199 159
200 160
201 - console.log(that.data.shop_arr,'轮播图')  
202 - })  
203 }, 161 },
204 162
205 /** 163 /**
@@ -11,6 +11,7 @@ Page({ @@ -11,6 +11,7 @@ Page({
11 all_num: 0, //总数量 11 all_num: 0, //总数量
12 token:'', 12 token:'',
13 login_new:'', 13 login_new:'',
  14 + selected:2,
14 listarr:[{ 15 listarr:[{
15         pagePath: "/packageA/pages/index/index", 16         pagePath: "/packageA/pages/index/index",
16         text: "商品", 17         text: "商品",
@@ -212,7 +213,7 @@ submit(){ @@ -212,7 +213,7 @@ submit(){
212 } 213 }
213 } 214 }
214 wx.navigateTo({ 215 wx.navigateTo({
215 - url: '/pages/order/order?type=4' + '&info=' + JSON.stringify(info) 216 + url: '/packageA/pages/order/order?type=4' + '&info=' + JSON.stringify(info)
216 }) 217 })
217 }, 218 },
218 219
1 <block wx:if="{{no_login}}"> 1 <block wx:if="{{no_login}}">
2 - <navigator class="no_login" catchtap="go_login" url="/pages/register/register" hover-class="none">请先登录</navigator> 2 + <navigator class="no_login" catchtap="go_login" url="/packageA/pages/register/register" hover-class="none">请先登录</navigator>
3 </block> 3 </block>
4 4
5 <block wx:elif="{{login_new==''}}"> 5 <block wx:elif="{{login_new==''}}">
6 - <navigator class="no_login" catchtap="go_login" url="/pages/login/login" hover-class="none">请先绑定会员</navigator> 6 + <navigator class="no_login" catchtap="go_login" url="/packageA/pages/login/login" hover-class="none">请先绑定会员</navigator>
7 </block> 7 </block>
8 8
9 9