Commit 12fa9e8d by 谢中龙

修改

parent 33c72a74
......@@ -4,7 +4,7 @@ const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const utilLink = require('../../utils/currentLinkRouter')
const envInfo = require('../../config/index').envInfo
let defaultImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
Component({
/**
* 组件的属性列表
......@@ -29,57 +29,54 @@ Component({
},
observers:{
categoryTabFixed(val){},
categoryTab(val){
console.log(this.data)
}
},
attached() {
const { categoryTab } = this.data
// const { categoryTab } = this.data;
let categoryTab = JSON.parse(JSON.stringify(this.data.categoryTab));
let currentTab = categoryTab && categoryTab.categorys || []
currentTab.forEach(item => {
// 存在 row 处理数据 8 商品 9 分类
let newRow = null
if (item.link) {
if (item.link.type == 2) {
// 父组件 更新
const urls = getCurrentPages()
const currentPath = urls[0]
const pageId = item.link.url
item.link.newPath = `/${currentPath.route}`
}
return
} else if (item.row) {
newRow = JSON.parse(item.row)
if (newRow.type == 8) {
newRow.newPath = '/pages/productDetail/productDetail'
} else if (newRow.type == 9) {
newRow.newPath = '/subPackage/page/pages/categoryPro/categoryPro'
}
item.row = newRow
if(typeof item.row === 'string'){
item.row = JSON.parse(item.row);
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
currentTab.forEach(item => {
let checkUrl = ''
if (item.link) {
checkUrl = item.link.newPath ? item.link.newPath : item.link.url
} else if (item.row) {
checkUrl = item.row.newPath ? item.row.newPath : item.row.url
}
wxService.NoLoginPage(checkUrl).then(res => {
if(checkUrl) item.needAuth = res.needAuth
this.setData({ categoryList: currentTab })
})
})
item.value = item.row ? item.row.url : '';
item.rowType = item.row ? item.row.type : 11;
item.actived = false;
});
if(currentTab.length != 0){
this.data.currentCategoryTabId = currentTab[0].value;
this.data.currentCategoryRowType = currentTab[0].rowType;
currentTab[0].actived = true;
}
this.setData({
currentCategoryTab : categoryTab,
});
//调用获取数据接口
this.data.pageNo = 1;
this.data.totalPage = 0;
this.data.proData = [];
this.getTagProducts();
},
/**
* 组件的初始数据
*/
data: {
// currentTab: 0,
currentTab: 99,
currentCategoryTabId : '',
currentCategoryRowType : 10,//默认10
linkType : '',
isAuthorization: false, // false 不显示 true 显示
categoryList: [],
proData : [{"productId":"713097736978829312","brandId":"1002","productName":"连体衣工装服九分裤套装阔腿两件套洋气男装一套搭配帅气痞帅春季","subtitle":"连体衣工装服九分裤套装阔腿两件套洋气男装一套搭配帅气痞帅春季","brandName":"舞象云","productCode":"N100000002","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"713097736987217920","brandId":"1002","productId":"713097736978829312","skuCode":"N100000002S","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10020e85e297-8406-4cb3-9928-9026b5f708ce.jpg","specValue":"619553340640202752###713097322363621376"},{"skuId":"713097736987217921","brandId":"1002","productId":"713097736978829312","skuCode":"N100000002M","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10022d68e624-3980-4e12-98e8-ed940dd574d3.jpg","specValue":"619553340640202752###713097343280484352"},{"skuId":"713097736987217922","brandId":"1002","productId":"713097736978829312","skuCode":"N100000002L","stock":0,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002c538ed30-0ab3-470f-8ea7-29dc34edb82b.jpg","specValue":"619553340640202752###713097370799443968","activityPrice":200,"activityId":"713766939025084416"},{"skuId":"713097736987217923","brandId":"1002","productId":"713097736978829312","skuCode":"N100000003S","stock":2,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10021b4b197d-cb59-4bab-8874-d44ad0e17fd3.jpg","specValue":"621298810911592448###713097322363621376","activityPrice":250,"activityId":"713766939025084416"},{"skuId":"713097736987217924","brandId":"1002","productId":"713097736978829312","skuCode":"N100000003M","stock":2999,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002181efa14-d8aa-41dc-8ce8-3d6a35e1a9a8.jpg","specValue":"621298810911592448###713097343280484352"},{"skuId":"713097736987217925","brandId":"1002","productId":"713097736978829312","skuCode":"N100000003L","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002a1e19aad-41ff-4a0b-8863-5d2aa4e76243.jpg","specValue":"621298810911592448###713097370799443968"},{"skuId":"713097736987217926","brandId":"1002","productId":"713097736978829312","skuCode":"N100000004S","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002039ac693-ba64-4a96-a45b-eec8301529f2.jpg","specValue":"713097244907409408###713097322363621376"},{"skuId":"713097736987217927","brandId":"1002","productId":"713097736978829312","skuCode":"N100000004M","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b506d83f-8886-412f-bf19-b4e957a874b5.jpg","specValue":"713097244907409408###713097343280484352"},{"skuId":"713097736987217928","brandId":"1002","productId":"713097736978829312","skuCode":"N100000004L","stock":3000,"salePrice":11800,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b506d83f-8886-412f-bf19-b4e957a874b5.jpg","specValue":"713097244907409408###713097370799443968"}],"minSalePrice":11800,"maxSalePrice":11800,"productType":1,"remark":"连体衣工装服九分裤套装阔腿两件套洋气男装一套搭配帅气痞帅春季","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b506d83f-8886-412f-bf19-b4e957a874b5.jpg","descHtml":"<p><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/10022db4c7ac-c9d7-43df-a201-0c3f22cf9d0f.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/1002f5118ed5-9026-4c6e-9520-0a5c139d5859.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/1002d707a521-ba22-4b93-b108-9018a6880882.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/100218c3a1a7-f5a1-44c3-aa02-75a4eddb7708.jpg\"></p>","stock":21001,"sort":100,"saleNum":3,"isFlashSale":true,"minActivityPrice":200,"activityResidueStock":0,"createTime":"2020-05-21 18:35:49","updateTime":"2020-05-23 16:08:48"},{"productId":"713096039405588480","brandId":"1002","productName":"夏季薄款冰丝九分裤男潮牌束脚修身小脚裤网红抖音潮流宽松裤子男","subtitle":"夏季薄款冰丝九分裤男潮牌束脚修身小脚裤网红抖音潮流宽松裤子男","brandName":"舞象云","productCode":"N1000001","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"713096039418171392","brandId":"1002","productId":"713096039405588480","skuCode":"N1000000001","stock":2000,"salePrice":100,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002a1d219a9-5570-40ad-a9f2-0d26bf5a6695.jpg","specValue":"619893244213596160###619553314006372352","activityPrice":100,"activityId":"714555275071328256"},{"skuId":"713096039418171393","brandId":"1002","productId":"713096039405588480","skuCode":"N1000000002","stock":2000,"salePrice":200,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/100201859271-3a5e-457f-8650-0dd970b52898.jpg","specValue":"619893244213596160###681942404550496256","activityPrice":200,"activityId":"714555275071328256"},{"skuId":"713096039418171394","brandId":"1002","productId":"713096039405588480","skuCode":"N1000000003","stock":2000,"salePrice":300,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10023b2554b8-78f2-407d-b7f3-0290608f65d7.jpg","specValue":"713095793946529792###619553314006372352","activityPrice":300,"activityId":"714555275071328256"},{"skuId":"713096039418171395","brandId":"1002","productId":"713096039405588480","skuCode":"N1000000004","stock":2000,"salePrice":400,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10020ee17287-187f-4c62-b7ff-70319321df60.jpg","specValue":"713095793946529792###681942404550496256","activityPrice":400,"activityId":"714555275071328256"}],"minSalePrice":5990,"maxSalePrice":5990,"productType":1,"remark":"夏季薄款冰丝九分裤男潮牌束脚修身小脚裤网红抖音潮流宽松裤子男","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10026663f868-1010-406d-b136-7b0971b80aef.jpg","descHtml":"<p><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/1002970101f4-9fd9-42a3-9703-ad955288f0c4.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/1002f18be110-a95f-4239-9b6d-4f6a745eab5d.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202005/20200521/1002b4fbfab6-e2ce-48a2-a163-cf29e6f2213a.jpg\"></p>","stock":8000,"sort":0,"saleNum":0,"isFlashSale":true,"minActivityPrice":100,"activityResidueStock":0,"createTime":"2020-05-21 18:29:04","updateTime":"2020-05-21 18:29:04"},{"productId":"692321154874216448","brandId":"1002","productName":"燃油三轮车【高速低速切换】","subtitle":"燃油三轮车【高速低速切换】","brandName":"舞象云","productCode":"SLC20200325","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"692321154882605056","brandId":"1002","productId":"692321154874216448","skuCode":"SLCRED1001","stock":999,"salePrice":344900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"619553297388408832###692320753231859712"},{"skuId":"692321154882605057","brandId":"1002","productId":"692321154874216448","skuCode":"SLCRED1002","stock":998,"salePrice":529900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"619553297388408832###692320794210078720"},{"skuId":"692321154882605058","brandId":"1002","productId":"692321154874216448","skuCode":"SLCYEL1001","stock":993,"salePrice":344900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"621298810911592448###692320753231859712"},{"skuId":"692321154882605059","brandId":"1002","productId":"692321154874216448","skuCode":"SLCYEL1002","stock":999,"salePrice":529900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"621298810911592448###692320794210078720"},{"skuId":"692321154882605060","brandId":"1002","productId":"692321154874216448","skuCode":"SLCGRE1001","stock":1000,"salePrice":344900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"619553340640202752###692320753231859712"},{"skuId":"692321154882605061","brandId":"1002","productId":"692321154874216448","skuCode":"SLCGRE1002","stock":997,"salePrice":529900,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","specValue":"619553340640202752###692320794210078720"}],"minSalePrice":344900,"maxSalePrice":529900,"productType":1,"remark":"燃油三轮车【高速低速切换】燃油三轮车【高速低速切换】燃油三轮车【高速低速切换】","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202003/20200325/1002eba3a4f8-7ce3-402e-8678-f93e3cb2f697.jpg","descHtml":"<p><img src=\"https://img3.bigaka.com/test/1002/202003/20200325/1002dcdf0a46-ae3f-409f-8860-ce9a7ae429f2.jpg\"><img src=\"https://img3.bigaka.com/test/1002/202003/20200325/1002f338322d-fd7b-4917-854a-37c5aa6585c6.jpg\"></p>","stock":5986,"sort":0,"saleNum":0,"isFlashSale":false,"activityResidueStock":0,"createTime":"2020-03-25 10:37:06","updateTime":"2020-03-25 10:37:06","markTagInfo":{"tagPicUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002a564efe1-d21c-4d93-81ad-0f1953327b64.png","tagType":2,"assignPrice":99990,"tagName":"左下角显示当前金额"}},{"productId":"684048655845691392","brandId":"1002","productName":"男鞋潮时尚流行","subtitle":"男鞋潮时尚流行","brandName":"舞象云","productCode":"nan100020101","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"685426180995944448","brandId":"1002","productId":"684048655845691392","skuCode":"b5252525","stock":98,"salePrice":58,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200302/10024c105cb4-d05a-4064-b291-9c8866c027cd.jpg","specValue":"619893244213596160###619553314006372352"},{"skuId":"685426180995944449","brandId":"1002","productId":"684048655845691392","skuCode":"h5252524","stock":78,"salePrice":58,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200302/10024c105cb4-d05a-4064-b291-9c8866c027cd.jpg","specValue":"619893244213596160###619553297388408832"}],"minSalePrice":58,"maxSalePrice":58,"productType":1,"remark":"中大奖哇卡进到你加圣诞节卡萨丁按时打算打算","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202003/20200302/10024c105cb4-d05a-4064-b291-9c8866c027cd.jpg","descHtml":"<p><img src=\"https://img3.bigaka.com/test/1002/202003/20200302/1002b6479915-093d-4f49-8c37-18411eb6502f.jpg\"></p><p><img src=\"https://img3.bigaka.com/test/1002/202003/20200302/10028eaa8531-3bab-410e-9151-dcece3b4a390.jpg\"></p>","stock":176,"sort":0,"saleNum":8,"isFlashSale":false,"activityResidueStock":0,"createTime":"2020-03-02 14:45:09","updateTime":"2020-05-08 19:17:03","markTagInfo":{"tagPicUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b092f1c2-3c92-4acd-9703-0cfa7f2792b2.png","tagType":1,"assignPrice":1880,"tagName":"固定样式营销标签"}},{"productId":"684047015461785600","brandId":"1002","productName":"测试商品鞋子","subtitle":"测试商品鞋子","brandName":"舞象云","productCode":"test100101012","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"688698094942162944","brandId":"1002","productId":"684047015461785600","skuCode":"b10010101","stock":9947,"salePrice":100,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200302/1002c503d764-c600-4efb-a02b-339ed03b7e9b.jpg","specValue":"619893244213596160###621369403400916992"},{"skuId":"688698094942162945","brandId":"1002","productId":"684047015461785600","skuCode":"h10010101","stock":9985,"salePrice":10,"picUrl":"https://img3.bigaka.com/test/1002/202003/20200302/1002c503d764-c600-4efb-a02b-339ed03b7e9b.jpg","specValue":"619893244213596160###621369454760300544"}],"minSalePrice":10,"maxSalePrice":100,"productType":1,"remark":"这是上陡坡【发到你的空间的阿萨德阿萨德阿萨德按时大大是","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202003/20200302/1002c503d764-c600-4efb-a02b-339ed03b7e9b.jpg","descHtml":"<p><img src=\"https://img3.bigaka.com/test/1002/202003/20200302/1002bc90892a-6339-4554-ab19-9aad3a4f4526.jpg\"></p><video class=\"ql-video\" controls=\"controls\" type=\"video/mp4\" src=\"https://img3.bigaka.com/test/1002/202003/20200315/100265c9b883-58c5-42e4-b97e-6c58b3b89de9.mp4\"></video><p><br></p><p><img src=\"https://img3.bigaka.com/test/1002/202003/20200302/1002b1f2d13b-d149-4977-81dd-bd1e12af4718.jpg\"></p>","stock":19932,"sort":0,"saleNum":53,"isFlashSale":false,"activityResidueStock":0,"createTime":"2020-03-02 14:38:37","updateTime":"2020-05-09 14:18:09","markTagInfo":{"tagPicUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b092f1c2-3c92-4acd-9703-0cfa7f2792b2.png","tagType":1,"assignPrice":1850,"tagName":"固定样式营销标签"}},{"productId":"647096699302580224","brandId":"1002","productName":"夫妻肺片","subtitle":"夫妻肺片","brandName":"舞象","productCode":"WXFQFP","productStatus":2,"productStatusDesc":"上架","productSku":[{"skuId":"684048047436599296","brandId":"1002","productId":"647096699302580224","skuCode":"w10000","stock":189,"salePrice":1,"picUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10023c0bd56b-b440-4eb1-92a4-6cefacbbaf4a.jpg","specValue":"1556091435012008"}],"minSalePrice":1,"maxSalePrice":1,"productType":1,"remark":"这个是备注","isLimit":0,"limitType":1,"indexUrl":"https://img3.bigaka.com/test/1002/202005/20200521/10023c0bd56b-b440-4eb1-92a4-6cefacbbaf4a.jpg","descHtml":"<p>夫妻肺片&nbsp;<span style=\"background-color: rgb(255, 255, 255); color: rgb(102, 102, 102);\">编辑</span>&nbsp;<a href=\"https://baike.baidu.com/planet/talk?lemmaId=120778\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"background-color: rgb(255, 255, 255); color: rgb(102, 102, 102);\">讨论</a></p><p><a href=\"https://baike.baidu.com/planet/talk?lemmaId=120778\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(255, 255, 255); background-color: rgb(243, 79, 29);\">64</a></p><p>夫妻肺片<em>(Sliced beef and ox organs in chili sauce)</em><span style=\"color: rgb(51, 102, 204);\">&nbsp;[1]</span><span style=\"color: rgb(19, 110, 194);\">&nbsp;</span>&nbsp;<em>,</em>是一道四川<a href=\"https://baike.baidu.com/item/%E6%88%90%E9%83%BD/128473\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">成都</a>名菜,由郭朝华、张田政夫妻创制而成。通常以牛头皮、<a href=\"https://baike.baidu.com/item/%E7%89%9B%E5%BF%83/7175624\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">牛心</a>、<a href=\"https://baike.baidu.com/item/%E7%89%9B%E8%88%8C/9754964\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">牛舌</a>、<a href=\"https://baike.baidu.com/item/%E7%89%9B%E8%82%9A/4101516\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">牛肚</a>、<a href=\"https://baike.baidu.com/item/%E7%89%9B%E8%82%89/1008026\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">牛肉</a>为主料,进行卤制,而后切片。再配以<a href=\"https://baike.baidu.com/item/%E8%BE%A3%E6%A4%92%E6%B2%B9/5328179\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">辣椒油</a>、<a href=\"https://baike.baidu.com/item/%E8%8A%B1%E6%A4%92%E9%9D%A2/7241289\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">花椒面</a>等辅料制成红油浇在上面。其制作精细,色泽美观,质嫩味鲜,麻辣浓香,非常适口。</p><p>2017年5月,美国《GQ》杂志发布了餐饮品赏大师BrettMartin最新出炉的“美国2017餐饮排行榜”,位于休斯敦的PepperTwins双椒川菜馆的招牌凉菜“夫妻肺片”荣登榜首,被评选为“年度开胃菜”(Appetizer of the Year)。这道菜的英文名被翻译成“史密斯夫妇”(Mr and Mrs Smith)。</p><p>2018年9月10日,“中国菜”正式发布,“夫妻肺片“被评为“中国菜”四川十大经典名菜。<span style=\"color: rgb(51, 102, 204);\">&nbsp;[2]</span></p><h2>菜品历史</h2><p><span style=\"background-color: rgb(255, 255, 255); color: rgb(136, 136, 136);\">编辑</span></p><p><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/0/4b90f603738da977e9ee9ac8be51f8198718e314?fr=lemma&amp;ct=single\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\"><img src=\"https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D220/sign=cb2984bdd3c451daf2f60be986ff52a5/4b90f603738da977e9ee9ac8be51f8198718e314.jpg\" alt=\"夫妻肺片\"></a></p><p><span style=\"color: rgb(85, 85, 85);\">夫妻肺片</span></p><p><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/0/0823dd54564e925809ac77479482d158cdbf4efb?fr=lemma&amp;ct=single\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\"><img src=\"https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D220/sign=e9080f767e094b36df921cef93cd7c00/0823dd54564e925809ac77479482d158cdbf4efb.jpg\"></a></p><p>相传,清朝末年,<a href=\"https://baike.baidu.com/item/%E6%88%90%E9%83%BD/128473\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">成都</a>街头巷尾有许多挑担、提篮叫卖凉拌肺片的小贩。用成本低廉的牛杂碎边角料,经清洗、卤煮后切片,佐以酱油、红油、辣椒、花椒面、芝麻面等拌食,风味别致,价廉物美,特别受到拉黄包车、脚夫和穷苦学生们的喜食。</p><p><br></p><p><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/21865004/3ac79f3df8dcd100c760f129788b4710b9122f3d?fr=lemma&amp;ct=cover\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\"><img src=\"https://gss1.bdstatic.com/-vo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D220/sign=8e1f88b7865494ee8322081b1df4e0e1/3ac79f3df8dcd100c760f129788b4710b9122f3d.jpg\" alt=\"夫妻肺片\"></a></p><p><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/21865004/3ac79f3df8dcd100c760f129788b4710b9122f3d?fr=lemma&amp;ct=cover\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">夫妻肺片</a><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/21865004/3ac79f3df8dcd100c760f129788b4710b9122f3d?fr=lemma&amp;ct=cover\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: gray;\">(6张)</a></p><p><br></p><p>20世纪30年代,成都人郭朝华和妻子一道以制售<a href=\"https://baike.baidu.com/item/%E5%87%89%E6%8B%8C\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">凉拌</a>肺片为业,他们夫妻俩亲自操作,走街串巷,提篮叫卖。由于选用牛肉铺的边角料做食材,价格便宜、味道好,颇受欢迎。人们就将这种凉拌牛杂称为“夫妻废片”。因为“废片”二字不好听,再加上食材中有牛肺片,便取‘废’的谐音‘肺’,改名为“夫妻肺片”。后来,他们发现<a href=\"https://baike.baidu.com/item/%E7%89%9B%E8%82%BA/10861040\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">牛肺</a>的口感不好,便取消了牛肺。</p><p>1933年,郭氏夫妇在成都半边桥附近(今<a href=\"https://baike.baidu.com/item/%E4%BA%BA%E6%B0%91%E5%85%AC%E5%9B%AD/8819436\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">人民公园</a>后门右侧)设店出售,店名正式取名为“夫妻肺片”,牌匾为金字黑底,由书法家<a href=\"https://baike.baidu.com/item/%E8%B5%B5%E8%95%B4%E7%8E%89\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">赵蕴玉</a>亲题。后几经变迁,该店迁至闹市街的提督西街,扩大了经营规模,增添了牛肉面等品种,食客不光是可以品尝肺片,还有面食充饥。</p><p>中华人民共和国成立后,在<a href=\"https://baike.baidu.com/item/%E5%85%AC%E7%A7%81%E5%90%88%E8%90%A5\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\">公私合营</a>时期,郭氏夫妇的夫妻肺片店和其他传统的餐饮名店一样,并入国营单位。后经几代人努力,夫妻肺片已成为闻名中外的熟食外卖店品。</p><p><a href=\"https://baike.baidu.com/pic/%E5%A4%AB%E5%A6%BB%E8%82%BA%E7%89%87/120778/0/0dd7912397dda144a22209a8bfb7d0a20cf48684?fr=lemma&amp;ct=single\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"color: rgb(19, 110, 194);\"><img src=\"https://gss3.bdstatic.com/7Po3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D220/sign=2fb2160904f79052eb1f403c3cf3d738/0dd7912397dda144a22209a8bfb7d0a20cf48684.jpg\"></a></p>","stock":189,"sort":0,"saleNum":102,"isFlashSale":false,"activityResidueStock":0,"createTime":"2019-11-21 15:31:16","updateTime":"2020-05-21 18:23:30","markTagInfo":{"tagPicUrl":"https://img3.bigaka.com/test/1002/202005/20200521/1002b092f1c2-3c92-4acd-9703-0cfa7f2792b2.png","tagType":1,"assignPrice":5600,"tagName":"固定样式营销标签"}}]
currentCategoryTab: {},
proData : [],
pageNo : 1,
pageSize : 10,
totalPage : 0,
},
/*组件所在页面的生命周期 */
pageLifetimes: {
......@@ -103,9 +100,173 @@ Component({
methods: {
//获取标签下的商品列表
getTagProducts(e){
console.log(4564)
console.log(e)
//表示父组件触到底部了
if(e == 'scrollBottom'){
if(this.data.pageNo < this.data.totalPage){
this.data.pageNo ++;
//判断关联的是标签还是后端分类
if(this.data.currentCategoryRowType == 10){
//标签
this.getTagProductList();
}
else{
//分类
this.getCategoryProducts();
}
}
else{
//没有更多数据了 需要通知父组件更新其他组件状态
this.triggerEvent('loadProductComplete', 'nomore');
}
}
else{
this.data.pageNo = 1;
this.data.totalPage = 0;
//判断关联的是标签还是后端分类
if(this.data.currentCategoryRowType == 10){
//标签
this.getTagProductList();
}
else{
//标签
this.getCategoryProducts();
}
}
},
//获取标签下的商品列表
getTagProductList(){
let pageNo = this.data.pageNo, pageSize = this.data.pageSize;
let url = `/sale/product/buyer/listPageByTagId?pageNo=${pageNo}&pageSize=${pageSize}`;
wxService.post(url,{
mallCategoryId : null,
categoryId : null,
tagId : this.data.currentCategoryTabId,
state : 1,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
this.data.totalPage = res.data.data.totalPages;
list.forEach(item => {
//营销标签类型 1固定样式 2左下角显示商品当前金额 3左下角显示指定数额
item.indexUrl = item.indexUrl ? item.indexUrl : defaultImg;
//处理商品身上的营销标签数据
item.hasPromotionTag = item.markTagInfo ? true : false;
let tagPrice = item.minSalePrice;
if(item.hasPromotionTag){
item.tagPic = item.markTagInfo.tagPicUrl;
if(item.markTagInfo.tagType == 2){
tagPrice = item.minSalePrice;
}
else{
tagPrice = item.markTagInfo.assignPrice;
}
item.tagType = item.markTagInfo.tagType;
}
//判断价格是否大于1000了
if(tagPrice/100 > 1000){
tagPrice = parseFloat(tagPrice/10/10).toFixed(1);
}
else{
tagPrice = parseFloat(tagPrice/10/10).toFixed(2);
}
item.tagPrice = tagPrice;
});
this.data.proData = this.data.proData.concat(list);
this.setData({
proData : this.data.proData
});
}
})
},
//获取后端分类下的商品列表
getCategoryProducts(){
let pageNo = this.data.pageNo, pageSize = this.data.pageSize;
let url = `/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`;
wxService.post(url, {
mallCategoryId : null,
categoryId : this.data.currentCategoryTabId,
tagId : null,
state : 1,
}).then(res => {
const { result, data } = res.data
if (result == 0 && data.content) {
wx.hideLoading()
let list = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
list.forEach(item => {
//营销标签类型 1固定样式 2左下角显示商品当前金额 3左下角显示指定数额
item.indexUrl = item.indexUrl ? item.indexUrl : defaultImg;
//处理商品身上的营销标签数据
item.hasPromotionTag = item.markTagInfo ? true : false;
let tagPrice = item.minSalePrice;
if(item.hasPromotionTag){
item.tagPic = item.markTagInfo.tagPicUrl;
if(item.markTagInfo.tagType == 2){
tagPrice = item.minSalePrice;
}
else{
tagPrice = item.markTagInfo.assignPrice;
}
item.tagType = item.markTagInfo.tagType;
}
//判断价格是否大于1000了
if(tagPrice/100 > 1000){
tagPrice = parseFloat(tagPrice/10/10).toFixed(1);
}
else{
tagPrice = parseFloat(tagPrice/10/10).toFixed(2);
}
item.tagPrice = tagPrice;
});
this.data.proData = this.data.proData.concat(list);
this.data.totalPage = data.totalPages;
this.setData({
proData: this.data.proData,
});
}
}).finally(() => {
wx.hideLoading()
})
},
//切换分类
onTapChangeCategory(e){
let index = e.currentTarget.dataset.index;
let item = e.currentTarget.dataset.item;
if(this.data.currentCategoryTabId == item.value){
return ;
}
wx.showLoading({
title: '加载中..',
})
this.data.currentCategoryTab.categorys.forEach(item => {
item.actived = false;
if(typeof item.row === 'string'){
item.row = JSON.parse(item.row);
item.rowType = item.row.type;
item.value = item.row.url;
}
});
this.data.currentCategoryTab.categorys[index].actived = true;
this.data.currentCategoryTabId = this.data.currentCategoryTab.categorys[index].value;
this.data.currentCategoryRowType = this.data.currentCategoryTab.categorys[index].rowType;
this.setData({
currentCategoryTab : this.data.currentCategoryTab
});
//调用获取数据接口
this.data.pageNo = 1;
this.data.totalPage = 0;
this.data.proData = [];
this.getTagProducts();
// 切换分类了,是否需要把之前显示的布局显示出来
this.triggerEvent('loadProductComplete', 'tabChange');
},
}
})
<!--component/tabSort/tabSort.wxml-->
<view class="category-tab-container clear-box">
<view class="category-tab {{categoryTabFixed ? 'fixed' : ''}}">
<view class="scroll-view_H">
<view class="category-tab-item active">鞋子</view>
<view class="category-tab-item">裤子</view>
<view class="category-tab-item">帽子</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab {{categoryTabFixed ? 'fixed' : ''}}" wx:if="{{currentCategoryTab.categorys.length > 1}}">
<view class="scroll-view_H" >
<view class="category-tab-item {{item.actived ? 'active' : ''}}"
wx:for="{{currentCategoryTab.categorys}}" wx:key="*this"
wx:for-index="idx" wx:for-item="item"
data-item="{{item}}" data-index="{{idx}}" bindtap="onTapChangeCategory">{{item.title}}</view>
</view>
</view>
<!-- 商品列表 -->
<view class="product-list" wx:if="{{proData.length}}">
<view class="product-list" wx:if="{{proData.length}}" style="padding-top: {{currentCategoryTab.categorys.length > 1 ? 0 : '1rpx'}};">
<product-list-style-one image-data="{{proData}}" />
</view>
</view>
......
......@@ -49,4 +49,5 @@
.category-tab-container .product-list{
background: #ffffff;
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd
......@@ -27,7 +27,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门
//2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const BRANCH_ID = 1002
const BRANCH_ID = 1001
const isMall = true
// const needMock = '' //
......
......@@ -35,6 +35,7 @@ wxService.page({
contactUsModal: false,
//显示广告
pageInfo : null,
categoryTabFixed : false,
},
/**
* 生命周期函数--监听页面加载
......@@ -63,8 +64,84 @@ wxService.page({
handlerDataOnPage = new utils.HandlerDataOnPage()
renderPage = require('../../utils/renderPage').getRenderPage()
handlerDataOnPage.init(this, 'pages')
this.initPage(this.data.pageId)
this.initPage(this.data.pageId);
setTimeout(() => {
this.getElementTop();
// categoryTab
},500);
},
// 页面滚动到底部
onReachBottom(){
if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts('scrollBottom');
}
},
//页面滚动
onPageScroll(e){
if(!this.scrollTop){
return ;
}
let scrollTop = e.scrollTop;
this.throttle(scoTop => {
if(scoTop > this.scrollTop){
this.data.categoryTabFixed = true;
}
else{
this.data.categoryTabFixed = false;
}
this.setData({
categoryTabFixed : this.data.categoryTabFixed
});
},null,0,scrollTop);
},
//节流器
throttle(fn, context, delay, text){
clearTimeout(fn.timeoutId)
fn.timeoutId = setTimeout(function () {
fn.call(context, text)
}, delay)
},
//获取元素到顶部的里
getElementTop(){
wx.createSelectorQuery().select('.categoryTab').boundingClientRect(res => {
if(res){
this.scrollTop = res.top;
this.categoryTabComponent = this.selectComponent('#categoryTab');
}
}).exec();
},
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
},
/**
* 监听子组件事件
* */
......@@ -255,6 +332,8 @@ wxService.page({
// wx.hideLoading()
})
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render
const renderData = render.next()
......@@ -286,6 +365,26 @@ wxService.page({
wx.hideLoading();
})
},
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/**
* 渲染数据(合并之前的数据)
* @param products 数组数据
......
......@@ -6,6 +6,7 @@
"pic-nav": "/component/picNav/picNav",
"bottom": "/component/bottom/bottom",
"tab-sort": "/component/tabSort/tabSort",
"category-tab": "/component/categoryTab/categoryTab",
"announcement": "/component/announcement/announcement",
"icon-swiper": "/component/iconSwiper/iconSwiper",
"bannerAd": "/component/bannerAd/bannerAd",
......
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}">
<view wx:if="{{pItem.type == 1 && pItem.pShow}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view>
<view class="" wx:if="{{pItem.type == 3}}">
<view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 4}}">
<view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/>
</view>
<view class="" wx:if="{{pItem.type == 7}}">
<view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 8}}">
<view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" />
</view>
<view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}"
categoryTab="{{pItem.categoryTab}}"
categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view>
</block>
</view>
<guide-page-modal show="{{guidePageModalShow}}" />
......
......@@ -93,14 +93,14 @@ wxService.page({
setTimeout(() => {
this.getElementTop();
// categoryTab
},300);
},500);
},
// 页面滚动到底部
onReachBottom(){
console.log(this.categoryTabComponent)
if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts(2);
this.categoryTabComponent.getTagProducts('scrollBottom');
}
},
......@@ -335,6 +335,7 @@ wxService.page({
this.initHomePage()
},
//初始化首页数据
initHomePage() {
wx.showLoading({
title: '加载中'
......@@ -380,6 +381,8 @@ wxService.page({
// wx.hideLoading()
})
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render
const renderData = render.next()
......@@ -417,6 +420,50 @@ wxService.page({
});
})
},
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
},
//handleParaphe
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/**
* 渲染数据(合并之前的数据)
* @param products 数组数据
......@@ -443,19 +490,6 @@ wxService.page({
})
},
// 获取plus购买信息
// getPlusPurchase() {
// wxService.get(`/sale/premium/query`).then(res => {
// if(!res) return false
// const { result, data } = res.data
// if (result == 0) {
// this.setData({
// skuVOList: data
// })
// }
// }).finally(() => {
// })
// },
/**
* 用户点击右上角分享
*/
......
......@@ -3,27 +3,27 @@
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="*this" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}">
<view wx:if="{{pItem.type == 1 && pItem.pShow }}">
<image-swiper
image-data="{{pItem.rotationchart.images}}"
bind:updatePage="updatePage"
bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}"/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}"
person-data="{{pItem.customer}}" integral-num="{{integralNum}}"
valueCardNum="{{valueCardNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view>
<view class="" wx:if="{{pItem.type == 3}}">
<view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav
pic-nav="{{pItem.navigation.images}}"
bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 4}}">
<view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
......@@ -31,15 +31,15 @@
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/>
</view>
<view class="" wx:if="{{pItem.type == 7}}">
<view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 8}}">
<view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" />
</view>
<view class="" wx:if="{{pItem.type == 9}}">
......@@ -47,12 +47,14 @@
currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 7}}">
<category-tab currHomePageId="{{currHomePageId}}" categoryTab="{{pItem.categoryType}}" categoryTabFixed="{{categoryTabFixed}}"
id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
<view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}"
categoryTab="{{pItem.categoryTab}}"
categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view>
</block>
</view>
<guide-page-modal show="{{guidePageModalShow}}" />
......
......@@ -7,6 +7,7 @@
"urlCheck": false,
"es6": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
......@@ -21,13 +22,12 @@
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"preloadBackgroundData": false
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"libVersion": "2.11.0",
"appid": "wxac09792264c49b5c",
"appid": "wxc3b64b09b1d3dfc2",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": {
"hidedInDevtools": []
......@@ -143,7 +143,7 @@
"id": 13,
"name": "subPage",
"pathName": "subPackage/page/pages/subPage/subPage",
"query": "pageId=73",
"query": "pageId=72",
"scene": null
},
{
......
......@@ -18,7 +18,7 @@ wxService.page({
form: {
mallCategoryId: '',
sortType:'',
order:''
order:'',
},
navTab:[
{
......@@ -153,7 +153,8 @@ wxService.page({
let url = `/sale/product/mallCategory/listPageProductByMallCategoryIdAndItsSons?pageNo=${pageNo}&pageSize=${pageSize}`;
if(this.data.pageFrom == 'category'){
url = `/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`
this.data.form.categoryId = this.data.form.mallCategoryId;
url = `/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`;
}
wxService.post(url, this.data.form).then(res => {
......@@ -230,26 +231,52 @@ wxService.page({
});
let pageNo = this.data.pageNo,
pageSize = this.data.pageSize;
wxService.post(`/sale/product/listPage?pageSize=${pageSize}&pageNo=${pageNo}`,{
productName: "",
showStockData: true,
categoryIds: [],
productTagIds : [this.data.tagId],
productStatus : 2,
showListUrls : true,
}).then(res => {
this.data.form.state = 1;
if(this.data.form.sortType == 'recommend'){
this.data.form.order = 'desc';
}
this.data.form.tagId = this.data.tagId;
this.data.form.categoryId = null;
this.data.form.mallCategoryId = null;
wxService.post(`/sale/product/buyer/listPageByTagId?pageSize=${pageSize}&pageNo=${pageNo}`,this.data.form).then(res => {
const { result, data } = res.data
if (result == 0 && data.content) {
wx.hideLoading();
this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
this.data.proData.forEach(item => {
item.indexUrl = item.indexUrl ? item.indexUrl : 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
//营销标签类型 1固定样式 2左下角显示商品当前金额 3左下角显示指定数额
item.indexUrl = item.indexUrl ? item.indexUrl : defaultImg;
//处理商品身上的营销标签数据
item.hasPromotionTag = item.markTagInfo ? true : false;
let tagPrice = item.minSalePrice;
if(item.hasPromotionTag){
item.tagPic = item.markTagInfo.tagPicUrl;
if(item.markTagInfo.tagType == 2){
tagPrice = item.minSalePrice;
}
else{
tagPrice = item.markTagInfo.assignPrice;
}
item.tagType = item.markTagInfo.tagType;
}
//判断价格是否大于1000了
if(tagPrice/100 > 1000){
tagPrice = parseFloat(tagPrice/10/10).toFixed(1);
}
else{
tagPrice = parseFloat(tagPrice/10/10).toFixed(2);
}
item.tagPrice = tagPrice;
});
this.setData({
proData: this.data.proData,
totalPages: data.totalPages,
totalElements: data.totalElements
})
});
}
if(refresh){
......
......@@ -35,6 +35,7 @@ wxService.page({
skuVOList:[],
//显示广告
pageInfo : null,
categoryTabFixed : false,
},
/**
* 生命周期函数--监听页面加载
......@@ -65,7 +66,11 @@ wxService.page({
pageId: this.data.pageId
});
this.initPage(this.data.pageId)
this.initPage(this.data.pageId);
setTimeout(() => {
this.getElementTop();
// categoryTab
},500);
}
else{
let pageId = shareId;
......@@ -82,6 +87,8 @@ wxService.page({
});
this.initPage(this.data.pageId);
}
//判断是否带m 触点
let memberId = options.memberId;
......@@ -96,8 +103,78 @@ wxService.page({
this.generatePointObject(tentacleInfo);
}
},
// 页面滚动到底部
onReachBottom(){
if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts('scrollBottom');
}
},
//页面滚动
onPageScroll(e){
if(!this.scrollTop){
return ;
}
let scrollTop = e.scrollTop;
this.throttle(scoTop => {
if(scoTop > this.scrollTop){
this.data.categoryTabFixed = true;
}
else{
this.data.categoryTabFixed = false;
}
this.setData({
categoryTabFixed : this.data.categoryTabFixed
});
},null,0,scrollTop);
},
//节流器
throttle(fn, context, delay, text){
clearTimeout(fn.timeoutId)
fn.timeoutId = setTimeout(function () {
fn.call(context, text)
}, delay)
},
//获取元素到顶部的里
getElementTop(){
wx.createSelectorQuery().select('.categoryTab').boundingClientRect(res => {
if(res){
this.scrollTop = res.top;
this.categoryTabComponent = this.selectComponent('#categoryTab');
}
}).exec();
},
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
},
/**
* 监听子组件事件
* */
......@@ -269,6 +346,8 @@ wxService.page({
// wx.hideLoading()
})
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render
const renderData = render.next()
......@@ -296,13 +375,29 @@ wxService.page({
paddingBottom: '0rpx'
})
}
}
}).finally(() => {
wx.hideLoading();
})
},
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/**
* 渲染数据(合并之前的数据)
* @param products 数组数据
......
......@@ -7,6 +7,7 @@
"bottom": "/component/bottom/bottom",
"go-guid": "/component/goGuid/goGuid",
"tab-sort": "/component/tabSort/tabSort",
"category-tab": "/component/categoryTab/categoryTab",
"announcement": "/component/announcement/announcement",
"icon-swiper": "/component/iconSwiper/iconSwiper",
"bannerAd": "/component/bannerAd/bannerAd",
......
......@@ -3,33 +3,42 @@
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<!-- {{pages}} -->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}">
<view wx:if="{{pItem.type == 1 && pItem.pShow}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view>
<view class="" wx:if="{{pItem.type == 3}}">
<view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 4}}">
<view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/>
</view>
<view class="" wx:if="{{pItem.type == 7}}">
<view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 8}}">
<view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" />
</view>
<view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view>
<!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}"
categoryTab="{{pItem.categoryTab}}"
categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view>
</block>
</view>
<guide-page-modal show="{{guidePageModalShow}}" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment