| | |
| | | // pages/bookServices/assort/index.js |
| | | import { getPublicImage } from '../../../assets/js/middleGround/tool' |
| | | import { getPublicImage } from "../../../assets/js/middleGround/tool"; |
| | | const app = getApp(); |
| | | Page({ |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | placeholderstyle: 'font-size:28rpx', |
| | | barHeight: "", |
| | | navBarHeight: "", |
| | | placeholderstyle: "font-size:28rpx", |
| | | assortList: [], |
| | | assortCheck: { |
| | | name: '', |
| | | code: '', |
| | | name: "", |
| | | code: "", |
| | | }, |
| | | startList: [], |
| | | |
| | | startCheck: { |
| | | id: '', |
| | | code: '' |
| | | id: "", |
| | | code: "", |
| | | }, |
| | | bookList: [], |
| | | loading: false, |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = |
| | | (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | this.setData({ |
| | | barHeight: systInfo.statusBarHeight, |
| | | navBarHeight: navBarHeight, |
| | | }); |
| | | this.getAssortList(); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { }, |
| | | onReady() {}, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | if (typeof this.getTabBar === "function" && this.getTabBar()) { |
| | | this.getTabBar().setData({ |
| | | active: 1, |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { }, |
| | | onHide() {}, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { }, |
| | | onUnload() {}, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { }, |
| | | onPullDownRefresh() {}, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { }, |
| | | onReachBottom() {}, |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { }, |
| | | onShareAppMessage() {}, |
| | | |
| | | // 获取侧边栏列表 |
| | | getAssortList() { |
| | | this.setData({ |
| | | loading: true |
| | | }) |
| | | loading: true, |
| | | }); |
| | | const query = { |
| | | path: '*', |
| | | path: "*", |
| | | filterList: [ |
| | | { |
| | | value: 'Normal', |
| | | field: 'state', |
| | | value: "Normal", |
| | | field: "state", |
| | | }, |
| | | ], |
| | | queryType: '\\', |
| | | queryType: "\\", |
| | | searchList: [], |
| | | size: '30', |
| | | start: '0', |
| | | size: "30", |
| | | start: "0", |
| | | storeRefCode: app.config.goodsStore, |
| | | sort: { type: 'Asc', field: 'LinkOrder' }, |
| | | sort: { type: "Asc", field: "LinkOrder" }, |
| | | }; |
| | | app.MG.store.getStoreChannelList(query).then((res) => { |
| | | const list = res.datas.filter((item) => item.refCode != 'jsek_homepageBookService'); |
| | | const list = res.datas.filter( |
| | | (item) => item.refCode != "jsek_homepageBookService" |
| | | ); |
| | | this.setData({ |
| | | assortList: list, |
| | | loading: false |
| | | loading: false, |
| | | }); |
| | | this.setData({ |
| | | assortCheck: { |
| | |
| | | path, |
| | | filterList: [ |
| | | { |
| | | value: 'Normal', |
| | | field: 'state' |
| | | } |
| | | value: "Normal", |
| | | field: "state", |
| | | }, |
| | | ], |
| | | queryType: '\\', |
| | | queryType: "\\", |
| | | searchList: [], |
| | | size: '30', |
| | | start: '0', |
| | | size: "30", |
| | | start: "0", |
| | | storeRefCode: app.config.goodsStore, |
| | | sort: { type: 'Asc', field: 'LinkOrder' }, |
| | | sort: { type: "Asc", field: "LinkOrder" }, |
| | | }; |
| | | app.MG.store.getStoreChannelList(query).then(async (res) => { |
| | | // 获取二级分类 |
| | | for (let index = 0; index < res.datas.length; index++) { |
| | | const item = res.datas[index]; |
| | | item.icon ? item.icon = getPublicImage(item.icon, 58, 72) : item.icon = item.icon |
| | | item.icon |
| | | ? (item.icon = getPublicImage(item.icon, 500)) |
| | | : (item.icon = item.icon); |
| | | item.children = await this.getSecondList(item); |
| | | } |
| | | console.log(res.datas); |
| | |
| | | this.setData({ |
| | | startList: res.datas, |
| | | listLoding: false, |
| | | 'startCheck.id': res.datas[0].id, |
| | | 'startCheck..code': '' |
| | | "startCheck.id": res.datas[0].id, |
| | | "startCheck..code": "", |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | path, |
| | | filterList: [ |
| | | { |
| | | value: 'Normal', |
| | | field: 'state' |
| | | } |
| | | value: "Normal", |
| | | field: "state", |
| | | }, |
| | | ], |
| | | queryType: '\\', |
| | | coverSize: { |
| | | width: 500, |
| | | }, |
| | | queryType: "\\", |
| | | searchList: [], |
| | | size: '30', |
| | | start: '0', |
| | | size: "30", |
| | | start: "0", |
| | | storeRefCode: app.config.goodsStore, |
| | | sort: { type: 'Asc', field: 'LinkOrder' }, |
| | | sort: { type: "Asc", field: "LinkOrder" }, |
| | | }; |
| | | await app.MG.store.getStoreChannelList(query).then((res) => { |
| | | for (let index = 0; index < res.datas.length; index++) { |
| | | const element = res.datas[index]; |
| | | if (element.icon) |
| | | element.icon = getPublicImage(element.icon, 58, 72) |
| | | |
| | | if (element.icon) element.icon = getPublicImage(element.icon, 500); |
| | | } |
| | | datas = res.datas; |
| | | }); |
| | |
| | | tabClick(e) { |
| | | const data = e.currentTarget.dataset.tabdata; |
| | | this.setData({ |
| | | 'startCheck.id': data.id, |
| | | 'startCheck.code': data.refCode, |
| | | "startCheck.id": data.id, |
| | | "startCheck.code": data.refCode, |
| | | }); |
| | | console.log(data); |
| | | }, |
| | | // 跳转列表页 |
| | | goPageList(e) { |
| | | const tab = e.currentTarget.dataset.tabdata |
| | | const stair = e.currentTarget.dataset.stair |
| | | const tab = e.currentTarget.dataset.tabdata; |
| | | const stair = e.currentTarget.dataset.stair; |
| | | this.setData({ |
| | | 'startCheck.id': tab.id, |
| | | 'startCheck.code': tab.refCode |
| | | }) |
| | | "startCheck.id": tab.id, |
| | | "startCheck.code": tab.refCode, |
| | | }); |
| | | if (stair) { |
| | | const secondCode = `${stair.pathLinks[0].linkPath}\\${stair.id}`; |
| | | wx.navigateTo({ |
| | |
| | | url: `/packageBookService/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}`, |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | navToSearchPage(e) { |
| | | wx.navigateTo({ |