diff --git a/app.js b/app.js index 604c9fe..9d5f501 100644 --- a/app.js +++ b/app.js @@ -5,131 +5,34 @@ var api = require("./api/api.js") //公共方法和变量 App({ - editTabBar: function (taht,stoid,url) { - var that=this; - var th = taht - //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。 - var custum_data=this.globalData.custum_data; - var isIpx=this.globalData.isIpx; - var is_read=this.globalData.is_read; - //var curPageArr = getCurrentPages(); //获取加载的页面 - //var curPage = curPageArr[curPageArr.length - 1]; //获取当前页面的对象 - var curPage=th; - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - if(is_read){ - if(custum_data){ - that.set_custom_nav(custum_data,isIpx,pagePath,url,curPage); - }else{ - var tabBar = { - 'iscustom':2, - 'url':url, - 'active':pagePath, - 'isIpx':isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - } - curPage.setData({ - tabBar:tabBar, - isIpx:isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - }) - } - - }else{ - var isIpx = false; - wx.getSystemInfo({ - success: (res) => { - // console.log(res) - let modelmes = res.model; //手机品牌 - if (modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 - isIpx = true - } - //缓存住,下次就不调用接口了 - that.globalData.isIpx=isIpx; - getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, { - }).then(res => { - this.globalData.is_read=true; - var e = res; - if(e.data.code != -1){ - that.globalData.custum_data=e.data.data; - - var itemList = that.globalData.custum_data.data; - itemList = JSON.parse(itemList) - - if(!itemList[0].weappurl){ - that.globalData.custum_data=null; - var tabBar = { - 'iscustom':2, - 'url':url, - 'active':pagePath, - 'isIpx':isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - } - curPage.setData({ - tabBar:tabBar, - isIpx:isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - }) - }else{ - that.set_custom_nav(e.data.data,isIpx,pagePath,url,curPage); - } - - }else{ - var tabBar = { - 'iscustom':2, - 'url':url, - 'active':pagePath, - 'isIpx':isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - } - curPage.setData({ - tabBar:tabBar, - isIpx:isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - }) - } - - }) - }, - }) - } - - - }, - set_custom_nav(data,isIpx,pagePath,url,curPage){ - //缓存住,下次就不调用接口了 - var itemList = data.data; - itemList = JSON.parse(itemList) - //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。 - for (var i = 0; i < itemList.length; i++) { - itemList[i].active = false; - if (itemList[i].weappurl == pagePath) { - itemList[i].active = true; //根据页面地址设置当前页面状态 - } - } - - //如果当服务端返回的值有数据就渲染数据到页面 - var tabBar = { - 'iscustom':1, - 'url':url, - 'active':pagePath, - 'list':itemList, - 'backgroundColor': data.bkcolor, - 'selectedColor' : data.fontcolor_sele, - 'color':data.fontcolor, - 'length':itemList.length, - 'isIpx':isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - } - curPage.setData({ - tabBar:tabBar, - isIpx:isIpx, - cartGoodsNum:this.globalData.cartGoodsNum - }) - }, + def_list:[ + { + "weappurl": "pages/index/index/index", + "nav_name": "首页", + "src": t.imghost+"/miniapp/images/bar/index.png", + "src_sele": t.imghost+"/miniapp/images/bar/index_on.png", + }, + { + "weappurl": "pages/goods/categoryList/categoryList", + "nav_name": "分类", + "src": t.imghost+"/miniapp/images/bar/fl.png", + "src_sele": t.imghost+"/miniapp/images/bar/fl_on.png" + }, + { + "weappurl": "pages/cart/cart/cart", + "nav_name": "购物车", + "src": t.imghost+"/miniapp/images/bar/car.png", + "src_sele": t.imghost+"/miniapp/images/bar/car_on.png" + }, + { + "weappurl": "pages/user/index/index", + "nav_name": "我的", + "src": t.imghost+"/miniapp/images/bar/user.png", + "src_sele": t.imghost+"/miniapp/images/bar/user_on.png" + } + ], + globalData: { cartGoodsNum:0, //购物车总数量 isTabBar :false, @@ -168,6 +71,7 @@ App({ auth: o, request: a, onLaunch: function() { + wx.hideTabBar(); this.initExt(); var t = this.globalData.setting; //console.log(t) @@ -208,7 +112,6 @@ App({ console.log(t); t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; - }, //首页的第一次登录 @@ -433,13 +336,9 @@ App({ "/pages/cart/cart/cart","/pages/user/index/index"]; if(arr_tabbar.indexOf(url)!=-1){ if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; - if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; - if (getCurrentPages().length > 9) { - wx.redirectTo({url: url,}) //跳到tabbar页 - }else{ - wx.navigateTo({url: url,}) //跳到tabbar页 - } - + if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; + wx.switchTab({url: url,}) //跳到tabbar页 + }else{ if (getCurrentPages().length > 9) { wx.redirectTo({url: url,}) //跳到非tabbar页 @@ -527,6 +426,7 @@ App({ requestCardNum: function(th) { if(!this.globalData.user_id) return false; this.request.get("/api/weshop/cart/page", { + isShoeLoading:false, data: { store_id: this.globalData.setting.stoid, user_id: this.globalData.user_id, @@ -540,14 +440,13 @@ App({ num += e.data.data.pageData[i].goods_num; } } - - + getApp().globalData.cartGoodsNum=num; /*--- wx.setTabBarBadge({ //tabbar右上角添加文本 index: 2, ////tabbar下标 text: '' + num //显示的内容 });--*/ - th.setData({['tabBar.cartGoodsNum']:num}); + th.getTabBar().setData({cartGoodsNum:num}); } }); }, @@ -606,7 +505,39 @@ App({ str = str.replace(reg, ''); } return str; - } + }, + + getPageIndex:function(curPage){ + + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + + var index=0; + + if(this.globalData.custum_data){ + var itemList = this.globalData.custum_data.data; + itemList = JSON.parse(itemList); + for(var i in itemList){ + var item=itemList[i] + if(pagePath.indexOf(item.weappurl)!=-1){ + index=i;break; + } + } + + }else{ + var itemList=this.def_list; + for(var i in itemList){ + var item=itemList[i] + if(pagePath.indexOf(item.weappurl)!=-1){ + index=i;break; + } + } + } + return index; + + } }); diff --git a/app.json b/app.json index c777f73..8287332 100644 --- a/app.json +++ b/app.json @@ -101,7 +101,6 @@ ] }], - "permission": { "scope.userLocation": { "desc": "获取你的位置信息" @@ -115,6 +114,48 @@ "backgroundColor": "#ffffff", "enablePullDownRefresh": true }, + + "tabBar": { + "custom":true, + "color": "#6e6d6b", + "selectedColor": "#f23030", + "borderStyle": "white", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index/index", + "text": "首页", + "iconPath": "packageA/images/bar/index.png", + "selectedIconPath": "packageA/images/bar/index_on.png" + }, + { + "pagePath": "pages/goods/categoryList/categoryList", + "text": "分类", + "iconPath": "packageA/images/bar/fl.png", + "selectedIconPath": "packageA/images/bar/fl_on.png" + }, + { + "pagePath": "pages/cart/cart/cart", + "text": "购物车", + "iconPath": "packageA/images/bar/car.png", + "selectedIconPath": "packageA/images/bar/car_on.png" + }, + { + "pagePath": "pages/user/index/index", + "text": "我的", + "iconPath": "packageA/images/bar/user.png", + "selectedIconPath": "packageA/images/bar/user_on.png" + } + ] + }, + "debug": false, - "sitemapLocation": "sitemap.json" + "sitemapLocation": "sitemap.json", + "usingComponents": { + "customtabbar":"custom-tab-bar/index" + } + + + + } \ No newline at end of file diff --git a/app.wxss b/app.wxss index 6f4643d..447ec7f 100644 --- a/app.wxss +++ b/app.wxss @@ -36,6 +36,13 @@ button { white-space: nowrap; text-overflow: ellipsis; } +.ellipsis-1x { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; +} .ellipsis-2 { overflow: hidden; text-overflow: ellipsis; @@ -155,6 +162,7 @@ justify-content:flex-start; align-items:center; } .flex{display: flex} + .ai-center{ align-items: center; } @@ -400,4 +408,9 @@ background: #ffe3e2; .fs60{ font-size:60rpx;} .flex-wrap{ flex-wrap:wrap; +} + + +.lh1 { + line-height: 1; } \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index b5f9507..b73299f 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -41,34 +41,63 @@ Component({ goodscount: null, firist_type_data: null, firist_type_curr: 0, + is_nav:0, + nav_list:null, + title_index:0, + swiper_hei:0, }, - ready: function () { - - }, - - + ready: function () {}, + lifetimes: { - attached: function() { + attached: function() { + + //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 + var nav_item=this.data.object; + var nav_list= this.data.object.nav_list; + //最新的版本才有nav_list + if(nav_list){ + nav_item=nav_list[0]; + //要算一下商品goodsid + for(var ij in nav_list){ + var item=nav_list[ij]; + var idlist=""; + //如果商品有手动选择的时候 + if(item.data && item.data.length>0){ + for(var im in item.data){ + idlist+= item.data[im]+","; + } + } + if(idlist) idlist=ut.sub_last(idlist); + nav_list[ij].idlist=idlist; + } + this.setData({nav_list:nav_list,is_nav:parseInt(this.data.object.is_nav)}); + } + // 在组件实例进入页面节点树时执行 - this.data.classstyle_id = this.data.object.classstyle; + this.data.classstyle_id = nav_item.classstyle; this.data.goodscount = this.data.object.goodscount; - this.data.wgroup = this.data.object.wgroup; - - this.setData({ - classstyle_id: this.data.object.classstyle - }) - if (this.data.object.goodsclass == 1) { + this.data.wgroup =nav_item.wgroup; + + var hei=280; + if(this.data.object.goodstit) hei+=80; + if(this.data.object.goodsprice) hei+=80; + if(this.data.object.goodsnum) hei+=80; + + this.setData({swiper_hei:hei}); + + if (nav_item.goodsclass == 1) { this.data.is_recommend = 1 } - if (this.data.object.goodsclass == 2) { + if (nav_item.goodsclass == 2) { this.data.is_hot = 1 } - if (this.data.object.goodsclass == 3) { + if (nav_item.goodsclass == 3) { this.data.is_new = 1 } + this.data.requestData = new Array(); - this.data.g_id = this.data.object.data; + this.data.g_id = nav_item.data; var arr = []; for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { @@ -111,7 +140,6 @@ Component({ var os=getApp().globalData.setting; classstyle_id = classstyle_id + ""; switch (classstyle_id) { - //---手动选择商品--- case "1": var str=""; @@ -120,8 +148,9 @@ Component({ } str=str.substring(0, str.length - 1); app.request.get("/api/weshop/goods/getgoodslistOrdby?store_id=" + os.stoid + "&goodsidlist=" + str, { + isShowLoading:false, success: function(res) { - console.log("121212"); + if(res.data.code==0 && res.data.data){ var rData = th.data.requestData; if (rData == null) rData=[]; @@ -137,7 +166,18 @@ Component({ } rData = rData.concat(new_arr); th.data.requestData = rData; - th.setData({ goods_array: rData }); + + if(th.data.object.column==5){ + var arr = new Array(); + //--三个三个一组--- + for(var i=0;i< rData.length;i+=3){ + arr.push(rData.slice(i,i+3)); + } + th.setData({ goods_array: arr }); + }else{ + th.setData({ goods_array: rData }); + } + //---控制有没有加载更多的按钮--- if (th.data.firist_type_curr == th.data.firist_type_data.length) {th.setData({ goods_btn: [] }); } else th.setData({ goods_btn: res.data}); @@ -169,60 +209,8 @@ Component({ total: res.data.data.total }) th.data.currentPage++; - var now=ut.gettimestamp(); - - goods.forEach(async function (val, ind) { - var item = {}; - var prom_id = null; - console.log(val.goodsid); - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { - //商品地址 - //var goods = res.data.data; - - item.goods_name = val.goods_name; - item.goods_img = th.data.imghost + val.original_img; - item.market_price = val.market_price; - item.shop_price = val.shop_price; - item.sales_sum = val.sales_sum; - item.goods_id = val.goods_id; - - item.cardprice1 = val.cardprice1; - item.cardprice2 = val.cardprice2; - item.cardprice3 = val.cardprice3; - - prom_id = val.prom_id; - - var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 - - var url = ""; - if (prom_type == 6) { - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - } else if (prom_type == 1) { - url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; - } - if(url!="") { - await app.request.promiseGet(url, {}).then(res => { - var prom = null - if (res && res.data) prom=res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time { - //商品地址 - var goods = res.data.data; - - item.goods_name = val.goods_name; - item.goods_img = th.data.imghost + val.original_img; - item.market_price = val.market_price; - item.shop_price = val.shop_price; - item.sales_sum = val.sales_sum; - item.goods_id = val.goods_id; - - item.cardprice1 = val.cardprice1; - item.cardprice2 = val.cardprice2; - item.cardprice3 = val.cardprice3; - - prom_id = val.prom_id; - - var prom_type = res.data.data.prom_type; //0普通商品 1秒杀 6拼单 - - var url = ""; - if (prom_type == 6) { - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - } else if (prom_type == 1) { - url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; - } - - if(url!=null){ - await app.request.promiseGet(url, {}).then(res => { - var prom =null; - if(res && res.data) res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time { + + item.goods_name = val.goods_name; + item.goods_img = th.data.imghost + val.original_img; + item.market_price = val.market_price; + item.shop_price = val.shop_price; + item.sales_sum = val.sales_sum; + item.goods_id = val.goods_id; + + item.cardprice1 = val.cardprice1; + item.cardprice2 = val.cardprice2; + item.cardprice3 = val.cardprice3; + + prom_id = val.prom_id; + + var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 + + var url = ""; + if (prom_type == 6) { + url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; + } else if (prom_type == 1) { + url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; + } + + if(url!=null){ + await getApp().request.promiseGet(url, {}).then(res => { + var prom =null; + if(res && res.data) res.data.data; + if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time + + + + + + {{item.title}} + + + + - + {{filter.toFix(item[card_field],2)}} - {{card_name}} + + + {{card_name}} + @@ -98,7 +111,10 @@ {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - {{g_filter.get_card_price(item,card_list,1)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + @@ -130,7 +146,7 @@ 销量:{{item.sales_sum}}件 - + @@ -142,7 +158,7 @@ - + @@ -186,7 +202,10 @@ {{filter.toFix(item[card_field],2)}} - {{card_name}} + + + {{card_name}} + @@ -235,7 +254,10 @@ {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - {{g_filter.get_card_price(item,card_list,1)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + @@ -264,6 +286,7 @@ 销量:{{item.sales_sum}}件 + @@ -280,7 +303,7 @@ - + @@ -322,7 +345,10 @@ {{filter.toFix(item[card_field],2)}} - {{card_name}} + + + {{card_name}} + @@ -371,7 +397,10 @@ {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - {{g_filter.get_card_price(item,card_list,1)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + @@ -400,6 +429,7 @@ 销量:{{item.sales_sum}}件 + @@ -410,7 +440,7 @@ - + @@ -453,7 +483,10 @@ {{filter.toFix(item[card_field],2)}} - {{card_name}} + + + {{card_name}} + @@ -502,7 +535,8 @@ {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - {{g_filter.get_card_price(item,card_list,1)}} + + {{g_filter.get_card_price(item,card_list,1)}} @@ -538,7 +572,8 @@ - + + - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{aitem.goods_name}} + + + ¥{{aitem.prom_price}} + ¥{{aitem.market_price}} + + + + + + + + + + + + {{filter.toFix(aitem[card_field],2)}} + + + {{card_name}} + + + + + + + + {{aitem.market_price}} + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + + + {{aitem.market_price}} + + + + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + {{aitem.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(aitem,card_list,0),2)}} + + + {{g_filter.get_card_price(aitem,card_list,1)}} + + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + + + {{aitem.market_price}} + + + + + + + ¥{{aitem.shop_price}} + ¥{{aitem.market_price}} + + + + 销量:{{aitem.sales_sum}}件 + + + + + + + + + \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxss b/components/diy_goodsGroup/diy_goodsGroup.wxss index aeb3a85..4a098b8 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxss +++ b/components/diy_goodsGroup/diy_goodsGroup.wxss @@ -6,9 +6,9 @@ .zs_goods { width: 700rpx; - border: 1rpx #ddd solid; margin-bottom: 10rpx; margin: 0 auto; + overflow:hidden } .s1_gk_a1 { @@ -37,7 +37,7 @@ .zs_center { width: 100%; - min-height: 200rpx; + /* min-height: 200rpx; */ font-size: 28rpx; color: #333; text-align: left; @@ -258,16 +258,16 @@ .zs_goods_wai_ban { display: flex; /* padding-left: 2rpx; */ - margin-bottom: 12rpx; + /* margin-bottom: 12rpx; */ width: 48%; float: left; background: #fff; margin-left: 1%; - border:1rpx solid rgb(214, 214, 214); - border-radius: 25rpx; margin-top: 10rpx; } + + .zs_goods_2l { width: 94%; min-height: 300rpx; @@ -284,6 +284,7 @@ .button-wrapper button { /*width: 94%;*/ border: none; + margin-top: 10rpx; } .zs_t_img_2l { @@ -294,7 +295,6 @@ .zs_center_2l { width: 100%; - min-height: 200rpx; font-size: 28rpx; color: #333; text-align: left; @@ -390,6 +390,7 @@ float: left; margin-bottom: 8rpx; background-color: white; + overflow: hidden; } .zs_goods_san { @@ -397,11 +398,11 @@ } .zs_goods_3l { - width: 236rpx; - min-height: 300rpx; - border: 2rpx #ddd solid; + width: 228rpx; + /* min-height: 300rpx; */ margin: 0 auto; padding: 2rpx; + overflow: hidden; } .zs_top_3l { @@ -418,7 +419,6 @@ .zs_center_3l { width: 100%; - min-height: 200rpx; font-size: 28rpx; color: #333; text-align: left; @@ -571,4 +571,241 @@ white-space: nowrap; } +.ai-center{align-items: center;} + +.gr_title_list{ width:95%; margin-left:2.5%} +.gr_title_item{ padding:0 10rpx;flex-shrink: 0;flex-grow: 1; text-align: center;} + + +.border_zhijiao{ + border:1rpx solid rgb(214, 214, 214); +} +.border_yuanjiao{ + border:1rpx solid rgb(214, 214, 214); + border-radius: 25rpx; +} +.top { + background-color: white; + height: 70rpx; + line-height: 70rpx; + color: #000; + border-bottom: 2rpx solid #eee; + padding:0rpx 20rpx; + display: flex; + justify-content: space-between; + font-size: 32rpx; +} + +.s_it { + width: 100%; + display: flex; + background-color: white; +} + +.s_prom { + width: 100%; + background-color: white; +} + +swiper { + display: block; +} + +.right_k { + width: 30rpx; +} +.right_k image{ + width: 30rpx; + height: 30rpx; +} + .t_left { + width: 10rpx; + height: 38rpx; + background: #c4182e; + margin-right: 10rpx; +} + + +.sp { + width: 100%; + background-color: white; + padding: 18rpx; + display: flex; +} + +.sp .sp_top { + height: 220rpx; + min-width: 30%; +} + +.sp .sp_top .s_img { + width: 210rpx; + height: 100%; +} + +.sp .sp_top .s_img image { + width: 210rpx; + height: 100%; + position: relative; +} + +.sp .sp_top .s_top_kill { + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + left: 6rpx; + padding: 4rpx 10rpx; + border-radius: 10rpx; + z-index: 999; + position: relative; + top: -6rpx; + width: 210rpx; + color: #fff; + text-align: center; +} + +.po { + position: absolute; +} + +.sp .sp_top .s_foot_kill { + font-size: 20rpx; + position: relative; + top: -90rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.sp_wz { + width: 210rpx; +} + +.sp_wz .sp_wzi { + font-size: 30rpx; + border-bottom: 2rpx solid #dcdcdc; + width: 100%; + text-align: left; + padding: 4rpx 0; + overflow: hidden; + height: 48rpx; + text-overflow: ellipsis; + white-space: nowrap; + line-height: 48rpx; +} + +.sp_wz .sp_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + margin-right: 10rpx; +} + +.sp_wz .sp_jgx { + color: #adadad; + text-decoration: line-through; + font-size: 24rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; +} + +.one { + margin-left: 14rpx; +} + +.sp .sp_top .s_top1_kill { + position: absolute; + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + left: 265rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; +} + +.sp .sp_top .s_top2_kill { + position: absolute; + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + right: 146rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; +} + +.sp .sp_top .s_foot1_kill { + font-size: 20rpx; + position: absolute; + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.po1 { + position: absolute; +} + +.sp .sp_top .s_foot2_kill { + font-size: 20rpx; + position: absolute; + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.t_red{ color:red;} + +.sp .sp_top .s_img image.zs_t3_3l{ + width: 56rpx; + height: 56rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; +} +.sp .sp_top .s_img image.zs_t1_3l{ +width: 56rpx; +height: 56rpx; +position: absolute; +left: 0rpx; +top: 10rpx; +} + +.sp .sp_top .s_img image.zs_t2_3l{ + width: 56rpx; + height: 56rpx; + position: absolute; + right: 0rpx; + top: 10rpx; + +} +.sp .sp_top .s_img image.zs_t4_3l{ + width: 56rpx; + height: 56rpx; + position: absolute; + right: 0rpx; + bottom: 10rpx; +} \ No newline at end of file diff --git a/components/diy_goodsGroup/g_filter.wxs b/components/diy_goodsGroup/g_filter.wxs index 8bba9f3..6b5e379 100644 --- a/components/diy_goodsGroup/g_filter.wxs +++ b/components/diy_goodsGroup/g_filter.wxs @@ -8,11 +8,23 @@ var get_class = function(column,position) { if(column==3){ return "zs_t"+position+"_3l"; } //----列表的情况----- if(column==4 ){ return "zs_t1_x"+position; } - + //--滑动的情况 + if(column==5){ return "zs_t"+position+"_3l"; } } var g_filters = { + //判断边框类型 + get_border_type:function(type){ + if(!type) type=0; + var type=parseInt(type); + switch(type){ + case 0: return "border_zhijiao"; + case 1: return "border_yuanjiao"; + } + return ""; + } + //-- 判断是不是有等级价 -- is_has_rank:function(rank_switch,item){ if(!rank_switch) return false; @@ -74,6 +86,8 @@ var g_filters = { if(min_name.length>4 ) min_name=min_name.substring(0, 4); return min_name; }, + + } @@ -81,4 +95,5 @@ module.exports = { get_class: get_class, is_has_rank:g_filters.is_has_rank, get_card_price:g_filters.get_card_price, + get_border_type:g_filters.get_border_type, } diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 90ea97d..fffb4dc 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -34,6 +34,7 @@ Component({ init: function () { var th = this; getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + isShowLoading:false, success: function (e) { getApp().globalData.userInfo = e.data.data; getApp().getConfig2(function (e) { @@ -93,6 +94,7 @@ Component({ if (that.data.is_no_more == 0) return false; var curPage = that.data.curPage; getApp().request.get('/api/weshop/goods/page?page', { + isShowLoading:false, data: { is_mainshow: 1, isonsale: 1, diff --git a/components/goods_list/goods_list.wxml b/components/goods_list/goods_list.wxml index eb5ed88..85c9718 100644 --- a/components/goods_list/goods_list.wxml +++ b/components/goods_list/goods_list.wxml @@ -40,9 +40,9 @@ {{filter.toFix(item[card_field],2)}} - + - {{card_name}} + {{card_name}} @@ -86,14 +86,16 @@ {{item.market_price}} - + - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - {{g_filter.get_card_price(item,card_list,1)}} - + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + diff --git a/components/goods_list/goods_list.wxss b/components/goods_list/goods_list.wxss index 0c7f8dc..31d0361 100644 --- a/components/goods_list/goods_list.wxss +++ b/components/goods_list/goods_list.wxss @@ -3,6 +3,10 @@ margin-bottom: 40rpx; } +.ai-center{ + align-items: center; +} + .ib { display: inline-block; } @@ -37,6 +41,20 @@ align-items: center; } +.ellipsis-1 { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +/* .ellipsis-1x { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; +} */ + .xc-wc { color: #d60021; } @@ -167,29 +185,34 @@ } .card_bg { - display: flex; + box-sizing: border-box; padding: 2rpx 10rpx; - height: 25rpx; - align-items: center; + height: 28rpx; border-radius: 26rpx; - font-size: 19rpx; - line-height: 25rpx; - max-width: 110rpx; + font-size: 18rpx; + line-height: 28rpx; + max-width: 210rpx; background: #333; color: #fff; - justify-content: center; margin-left: 8rpx; } .card_bg image { width: 19rpx; height: 19rpx; - margin-right: 1rpx; + margin-right: 8rpx; } -.card_bg .card_name { +/* .card_bg .card_name { max-width: 76rpx; width: auto; overflow: hidden; white-space: nowrap; +} */ + +.card_name { + position: relative; + top: -4rpx; } + + diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js new file mode 100644 index 0000000..fb3c7d6 --- /dev/null +++ b/custom-tab-bar/index.js @@ -0,0 +1,75 @@ +var app = getApp(), os = app.globalData.setting; + +Component({ + data:{ + fontcolor:'#6e6d6b', + fontcolor_sele:'#f23030', + backgroundColor:'#ffffff', + active:-1, + list:app.def_list, + cartGoodsNum:0, + }, + + + lifetimes: { + attached: function() { + + //购物车显示商品金额 + this.setData({cartGoodsNum:getApp().globalData.cartGoodsNum}); + var th=this; + + var is_read=getApp().globalData.is_read; + var custum_data=getApp().globalData.custum_data; + if(is_read){ + if(custum_data){ + this.set_list(custum_data); + } + }else{ + var stoid=os.stoid + getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, { + }).then(res => { + getApp().globalData.is_read=true; + var e = res; + if(e.data.code != -1){ + var itemList = e.data.data.data; + itemList = JSON.parse(itemList) + //如果是有定义自定义导航的小程序链接 + if(itemList[0].weappurl && itemList[0].weappurl!=""){ + getApp().globalData.custum_data=e.data.data; + var custum_data=e.data.data; + th.set_list(custum_data); + } + + } + + }) + } + }, + }, + + + methods: { + //设置自定义页面的列表 + set_list:function(data){ + var itemList = data.data; + itemList = JSON.parse(itemList); + this.setData({ + list:itemList, + backgroundColor: data.bkcolor, + fontcolor_sele: data.fontcolor_sele, + fontcolor:data.fontcolor, + }) + + }, + + nav_goto:function(e){ + var url=e.currentTarget.dataset.url; + if(!url) return false; + if(url[0]!='/') url='/'+url; + wx.switchTab({url:url,}) + } + + } + + +}) \ No newline at end of file diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/custom-tab-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml new file mode 100644 index 0000000..fceecd7 --- /dev/null +++ b/custom-tab-bar/index.wxml @@ -0,0 +1,22 @@ + + + + + {{cartGoodsNum}} + + + + + {{item.nav_name}} + + + + + + + + + + + \ No newline at end of file diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss new file mode 100644 index 0000000..934d857 --- /dev/null +++ b/custom-tab-bar/index.wxss @@ -0,0 +1,13 @@ +.main_bar{ + width:100%; border-top: 1rpx solid #ebebeb; position: fixed; bottom: 0; left: 0; z-index: 10000; +} +.tabbar_item{ + position:relative;height:100%;float:left;text-align:center;padding:5px 0; +} +.tab_img{display: flex; justify-content: center;align-items: center} +.nav_imgage{ + height: 56rpx; width: 56rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%; +} +.cart_num{ + top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx; +} \ No newline at end of file diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 6569fa0..1a41adc 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -54,14 +54,21 @@ Page({ }, onShow: function() { + + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + var index=getApp().getPageIndex(this); + this.getTabBar().setData({ + active: index //数字是当前页面在tabbar的索引 + }) + + getApp().requestCardNum(this); + } + var th = this; //调用底部导航 - t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); + //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); this.getCardList(); - //--强行等待,让购物车的数量能够正确的线上 - setTimeout(function () { - if(getApp().globalData.user_id) getApp().requestCardNum(th); - },500) + //--获取是否又秒杀活动-- getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { @@ -1300,7 +1307,13 @@ Page({ var prom_id=e.currentTarget.dataset.prom_id; var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; getApp().goto(url); - } - - + }, + + //导航跳转 + nav_goto:function(e){ + var url=e.currentTarget.dataset.url; + if(!url || url=='') return; + if(url[0]!='/') url='/'+url; + getApp().goto(url); + } }); \ No newline at end of file diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 1a68131..cde5553 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -1,6 +1,6 @@ - + diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index df130da..f1978fe 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -463,6 +463,8 @@ Page({ ob.buynum=num; ob.weight=data.gift_weight; //商品的重量 ob.exp_sum_type=data.gift_exp_sum_type; //商品的物流计算方式 + ob.uniform_exp_sum=data.uniform_exp_sum //统一运费的金额 + th.setData({buy_now_gift_goods:ob}); } } @@ -690,6 +692,8 @@ Page({ item_map.gift_storecount = get_data.gift_storecount; item_map.gift_weight = get_data.goodsinfo.weight; item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; + item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; + } item_map.s_libao = get_data.libao; item_map.s_lb_num = get_data.lb_num; @@ -2739,7 +2743,6 @@ Page({ var check=this.check_good(arr,goods_id); return !check; }, - //立即购买获取优惠活动的内容 buy_now_prom_goods:function (prom_id,arr,func) { var price=arr.shop_price*arr.goods_num; @@ -2780,6 +2783,7 @@ Page({ arr.gift_original_img = get_data.goodsinfo.original_img; arr.gift_weight = get_data.goodsinfo.weight; arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; + arr.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; arr.gift_limit_num = get_data.limit_num; arr.gift_storecount = get_data.gift_storecount; } diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 1e0becd..9f55db1 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -31,8 +31,6 @@ Page({ default_color:null, }, onLoad: function(options) { - - var th = this; th.setData({ isBuy: options.isBuy, @@ -43,6 +41,7 @@ Page({ th.close(); }, onShow: function() { + //--先判断会员状态-- var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { @@ -383,9 +382,9 @@ Page({ pagePath+="?isBuy="+this.data.isBuy; if(this.data.isBuy==0){ - pagePath+="&lbId="+this.data.getGiftID; - }else{ pagePath+="&orderSn="+this.data.orderSn; + }else{ + pagePath+="&lbId="+this.data.getGiftID; } return { diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 22a2279..d38a490 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -66,6 +66,8 @@ Page({ is_show_class:false,//是否添加新样式 status_show:0, currentTab: 0, //预设当前项的值 + + load:0, }, @@ -171,15 +173,26 @@ Page({ } }); }, - onShow:function(){ + + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + var index=getApp().getPageIndex(this); + this.getTabBar().setData({ + active: index //数字是当前页面在tabbar的索引 + }); + getApp().requestCardNum(this); + } + + var that=this; //调用底部导航 - t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); + //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); //this.requestFirstCategoris(); setTimeout(function () { - if (getApp().globalData.user_id) getApp().requestCardNum(that); + //if (getApp().globalData.user_id) getApp().requestCardNum(that); },500) + + if(this.data.load) return false; getApp().getConfig2(function (e) { @@ -256,6 +269,8 @@ Page({ }else if(that.data.is_show_pp && that.data.select_classify_on == 220){ that.setData({ status_show: 2 }); } + + that.data.load=1; }) }, @@ -507,39 +522,47 @@ Page({ var arr=new Array(); var dda = e.data.data.pageData; s.setData({brand_list:dda}); - for (var i = 0; i < dda.length; i++) { - //console.log(dda[i].logo) - if(dda[i].logo && dda[i].logo.indexOf("http")<0){ - dda[i].logo = oo.imghost+dda[i].logo; - } - if (arr.length>0){ - var find = 0; - //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 - for (var k = 0; k < arr.length;k++){ - if(dda[i].zm == arr[k].zm){ find=k+1; break;} - } - if (find == 0) { - var item = { zm: dda[i].zm, array: new Array() } - item.array.push(dda[i]); - arr.push(item); - } else{ - arr[find - 1].array.push(dda[i]); - } - }else{ - var item = { zm: dda[i].zm, array: new Array() } - item.array.push(dda[i]); - arr.push(item); - } - } - //进行排序 - arr.sort(compare("zm")); - for(var i=0;i< arr.length;i++){ - for(var j=0;j0){ + var find = 0; + //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 + for (var k = 0; k < arr.length;k++){ + if(dda[i].zm == arr[k].zm){ find=k+1; break;} + } + if (find == 0) { + var item = { zm: dda[i].zm, array: new Array() } + item.array.push(dda[i]); + arr.push(item); + } else{ + arr[find - 1].array.push(dda[i]); + } + }else{ + var item = { zm: dda[i].zm, array: new Array() } + item.array.push(dda[i]); + arr.push(item); + } + } + if(parseInt(s.data.is_used_share)==0){ + arr.sort(compare("zm")); + }else{ + var ob={array:dda}; + arr.push(ob); + } + + + s.setData({ groups: arr }); //console.log(s.data.groups) } @@ -981,6 +1004,14 @@ Page({ var ob = { "card_list": new_arr, "name_map": card_name_map }; func(ob); }) - } + }, + + //导航跳转 + nav_goto:function(e){ + var url=e.currentTarget.dataset.url; + if(!url || url=='') return; + if(url[0]!='/') url='/'+url; + getApp().goto(url); + } }); \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index 75b89b8..bc36e0b 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -1,5 +1,5 @@ - -