| | |
| | | activeIndex: -1, |
| | | activeParam: [], |
| | | tagCodes: [], |
| | | |
| | | isLoading:false, |
| | | cateList: [], |
| | | secondCateList: [], |
| | | datalist: [], |
| | |
| | | this.getList() |
| | | }, |
| | | getList() { |
| | | var that =this |
| | | const { catalogCode, tagCodes, pageNum, pageSize, sortType, query } = this.data |
| | | getZhongTaiProductPage({ |
| | | catalogCode, pageNum, pageSize, sortType, query, tagCodes |
| | |
| | | datalist: [...this.data.datalist, ...res.data.records], |
| | | total: res.data.total |
| | | }) |
| | | }).finally(()=>{ |
| | | that.setData({isLoading:false}) |
| | | }) |
| | | }, |
| | | scrolltolower() { |
| | |
| | | this.getList() |
| | | }, |
| | | cateClick(e) { |
| | | var {isLoading} = this.data |
| | | if(isLoading){ |
| | | return |
| | | } |
| | | this.setData({isLoading:true}) |
| | | const catalogCode = e.currentTarget.dataset.code |
| | | this.setData({ catalogCode, tagCodes: [] }) |
| | | this.setData({ pageNum: 1, datalist: [], total: 0 }) |
| | |
| | | const index = tagCodes.indexOf(code) |
| | | console.log('code', code) |
| | | console.log('tagCodes', tagCodes) |
| | | console.log(secondCateList) |
| | | if (index === -1) { |
| | | // 同param里code重复 |
| | | if (activeParam && activeParam.length > 0) { |
| | | activeParam.forEach(item => { |
| | | const indexTemp = tagCodes.indexOf(item.labelValueCode) |
| | | if (indexTemp > -1) { |
| | | tagCodes.splice(indexTemp, 1) |
| | | } |
| | | }) |
| | | } |
| | | tagCodes.push(code) |
| | | secondCateList[activeIndex].paramIndex = paramIndex |
| | | secondCateList[activeIndex].paramName = activeParam[paramIndex].labelValueName |
| | | // if (activeParam && activeParam.length > 0) { |
| | | // activeParam.forEach(item => { |
| | | // const indexTemp = tagCodes.indexOf(item.labelValueCode) |
| | | // if (indexTemp > -1) { |
| | | // tagCodes.splice(indexTemp, 1) |
| | | // } |
| | | // }) |
| | | // } |
| | | //tagCodes.push(code) |
| | | secondCateList[activeIndex].tempParamIndex = paramIndex |
| | | secondCateList[activeIndex].tempParamCode = code |
| | | secondCateList[activeIndex].tempParamName = activeParam[paramIndex].labelValueName |
| | | } else { |
| | | tagCodes.splice(index, 1) |
| | | secondCateList[activeIndex].paramIndex = -1 |
| | | secondCateList[activeIndex].paramName = '' |
| | | // tagCodes.splice(index, 1) |
| | | secondCateList[activeIndex].tempParamIndex = -1 |
| | | secondCateList[activeIndex].tempParamCode = '' |
| | | secondCateList[activeIndex].tempParamName = '' |
| | | } |
| | | this.setData({ tagCodes, secondCateList }) |
| | | this.setData({secondCateList }) |
| | | }, |
| | | changeShowParams(e) { |
| | | const { secondCateList } = this.data |
| | |
| | | }, |
| | | cancelParam() { |
| | | const { secondCateList } = this.data |
| | | secondCateList.forEach(item => { |
| | | item.paramIndex = -1 |
| | | item.paramName = item.paramName || '' |
| | | secondCateList.forEach(item => { |
| | | item.tempParamIndex = item.paramIndex |
| | | item.tempParamName = item.paramName |
| | | item.tempParamCode = item.paramCode |
| | | }) |
| | | this.setData({ tagCodes: [], activeParam: [], secondCateList, activeIndex: -1 }) |
| | | // this.setData({ tagCodes: [], activeParam: [], secondCateList, activeIndex: -1 }) |
| | | this.setData({ activeParam: [],activeIndex: -1 ,secondCateList}) |
| | | }, |
| | | subParam() { |
| | | this.setData({ activeParam: [] }) |
| | | this.setData({ pageNum: 1, activeIndex: -1, datalist: [], total: 0 }) |
| | | const { secondCateList } = this.data |
| | | var codes = [] |
| | | secondCateList.forEach(item => { |
| | | item.paramIndex = item.tempParamIndex |
| | | item.paramName = item.tempParamName |
| | | item.paramCode = item.tempParamCode |
| | | if( item.paramIndex>-1 && item.tempParamCode){ |
| | | codes.push( item.tempParamCode) |
| | | } |
| | | }) |
| | | this.setData({tagCodes:codes}) |
| | | this.setData({ pageNum: 1, activeParam: [] ,activeIndex: -1, datalist: [], total: 0 }) |
| | | this.getList() |
| | | }, |
| | | } |
| | |
| | | <view class="main_right"> |
| | | <view class="query_wrap"> |
| | | <view data-index="{{index}}" wx:for="{{ secondCateList }}" class="item" bindtap="changeShowParams"> |
| | | <view class="name">{{ item.paramName || item.labelName }}</view> |
| | | <view class="name">{{ item.tempParamName || item.labelName }}</view> |
| | | <van-icon name="{{ index == activeIndex ? 'arrow-up' : 'arrow-down' }}" /> |
| | | </view> |
| | | </view> |
| | | <view wx:if="{{ activeParam.length > 0 }}" class="query_form"> |
| | | <view class="list"> |
| | | <view data-index="{{index}}" data-code="{{ item.labelValueCode }}" bindtap="tagClick" wx:for="{{ activeParam }}" class="item {{ secondCateList[activeIndex].paramIndex === index ? 'active' : '' }}">{{ item.labelValueName }}</view> |
| | | <view data-index="{{index}}" data-code="{{ item.labelValueCode }}" bindtap="tagClick" wx:for="{{ activeParam }}" class="item {{ secondCateList[activeIndex].tempParamIndex === index ? 'active' : '' }}">{{ item.labelValueName }}</view> |
| | | </view> |
| | | <view class="btns"> |
| | | <view class="btn" bindtap="cancelParam">取消</view> |
| | |
| | | const { cateList } = this.data |
| | | cateList.forEach(item => { |
| | | item.paramIndex = -1 |
| | | item.paramName = item.paramName || '' |
| | | item.paramName = '' |
| | | }) |
| | | this.setData({ tagCodes: [],activeParam: [],cateList,activeIndex: -1 }) |
| | | this.setData({ tagCodes: [],datalist:[],pageNum:1, activeParam: [],cateList,activeIndex: -1 }) |
| | | this.getList() |
| | | }, |
| | | bindblur() { |
| | | this.setData({ pageNum: 1,dataList: [],total: 0}) |
| | |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: space-around; |
| | | |
| | | .item { |
| | | width: 324rpx; |
| | | margin-bottom: 32rpx; |
| | | |
| | | margin-bottom: 32rpx; |
| | | .img_wrap { |
| | | width: 100%; |
| | | height: 182rpx; |
| | |
| | | flex-wrap: wrap; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .main_content .goods_list .item { |
| | | width: 324rpx; |
| | | margin-bottom: 32rpx; |
| | |
| | | "resolved": "https://registry.npmmirror.com/mp-html/-/mp-html-2.5.0.tgz", |
| | | "integrity": "sha512-uvBH5tIaDIlj8qaxsvNXU3RKX0jvXOo3J6FAi/notUv/ds6j79UUTE82aDkxxUk0eLUU0CiCqMrR7WWnytk30Q==" |
| | | }, |
| | | "spa-custom-hooks": { |
| | | "version": "1.4.2", |
| | | "resolved": "https://registry.npmmirror.com/spa-custom-hooks/-/spa-custom-hooks-1.4.2.tgz", |
| | | "integrity": "sha512-wxMcbcgkM6TWCtm86Njd9K06I/iPr9CVWKCPJq7Q51eeNKdeSMcU9jsTRI+SVIfgNikc6//JCS4pwoyHRAdbCw==" |
| | | }, |
| | | "vant-weapp": { |
| | | "version": "0.5.29", |
| | | "resolved": "https://registry.npmmirror.com/vant-weapp/-/vant-weapp-0.5.29.tgz", |
| | |
| | | margin-bottom: 16rpx; |
| | | } |
| | | .desc { |
| | | |
| | | font-size: 26rpx; |
| | | color: #555555; |
| | | margin-bottom: 26rpx; |
| | | } |
| | | |
| | | .text { |
| | | .text { |
| | | line-height: 48rpx; |
| | | font-size: 26rpx; |
| | | color: #555555; |
| | | margin-bottom: 40rpx; |
| | |
| | | height: 32rpx; |
| | | margin-bottom: 24rpx; |
| | | |
| | | .label { |
| | | width: 120rpx; |
| | | .label { |
| | | width: auto; |
| | | font-size: 24rpx; |
| | | color: #666666; |
| | | } |
| | |
| | | margin-bottom: 26rpx; |
| | | } |
| | | .main_content .text { |
| | | line-height: 48rpx; |
| | | font-size: 26rpx; |
| | | color: #555555; |
| | | margin-bottom: 40rpx; |
| | |
| | | margin-bottom: 24rpx; |
| | | } |
| | | .detail .line .label { |
| | | width: 120rpx; |
| | | width: auto; |
| | | font-size: 24rpx; |
| | | color: #666666; |
| | | } |
| | |
| | | data: { |
| | | menuButtonInfo: {}, |
| | | catalogCode: "product_intro", |
| | | activeCate: '', |
| | | |
| | | activeCate: '', |
| | | height: 0, |
| | | top: 0, |
| | | isLoading:false |
| | | }, |
| | | onLoad(options) { |
| | | let menuButtonInfo = wx.getMenuButtonBoundingClientRect(); |
| | |
| | | cateList: [], |
| | | secondCateList: [], |
| | | datalist: [], |
| | | isLoading:false, |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | |
| | | this.setData({ pageNum: 1,datalist: [],total: 0}) |
| | | this.getList() |
| | | }, |
| | | getList() { |
| | | getList() { |
| | | const { catalogCode,tagCodes, pageNum, pageSize, sortType, query } = this.data |
| | | getZhongTaiProductPage({ |
| | | catalogCode,pageNum,pageSize,sortType,query,tagCodes |
| | |
| | | datalist: [...this.data.datalist, ...res.data.records], |
| | | total: res.data.total |
| | | }) |
| | | }).finally(()=>{ |
| | | this.setData({isLoading:false}) |
| | | }) |
| | | }, |
| | | scrolltolower() { |
| | |
| | | } |
| | | }, |
| | | cateClick(e) { |
| | | var {isLoading} = this.data |
| | | if(isLoading){ |
| | | return |
| | | } |
| | | this.setData({isLoading:true}) |
| | | const catalogCode = e.currentTarget.dataset.code |
| | | this.setData({ catalogCode, tagCodes: [] }) |
| | | this.setData({ pageNum: 1,datalist: [],total: 0}) |
| | |
| | | const { secondCateList, tagCodes, activeParam, activeIndex } = this.data |
| | | const index = tagCodes.indexOf(code) |
| | | if(index === -1){ |
| | | // 同param里code重复 |
| | | if(activeParam && activeParam.length > 0){ |
| | | activeParam.forEach(item => { |
| | | const indexTemp = tagCodes.indexOf(item.labelValueCode) |
| | | if(indexTemp > -1){ |
| | | tagCodes.splice(indexTemp, 1) |
| | | } |
| | | }) |
| | | } |
| | | tagCodes.push(code) |
| | | secondCateList[activeIndex].paramIndex = paramIndex |
| | | secondCateList[activeIndex].paramName = activeParam[paramIndex].labelValueName |
| | | }else{ |
| | | tagCodes.splice(index, 1) |
| | | secondCateList[activeIndex].paramIndex = -1 |
| | | secondCateList[activeIndex].paramName = '' |
| | | // 同param里code重复 |
| | | // if (activeParam && activeParam.length > 0) { |
| | | // activeParam.forEach(item => { |
| | | // const indexTemp = tagCodes.indexOf(item.labelValueCode) |
| | | // if (indexTemp > -1) { |
| | | // tagCodes.splice(indexTemp, 1) |
| | | // } |
| | | // }) |
| | | // } |
| | | //tagCodes.push(code) |
| | | secondCateList[activeIndex].tempParamIndex = paramIndex |
| | | secondCateList[activeIndex].tempParamCode = code |
| | | secondCateList[activeIndex].tempParamName = activeParam[paramIndex].labelValueName |
| | | } else { |
| | | // tagCodes.splice(index, 1) |
| | | secondCateList[activeIndex].tempParamIndex = -1 |
| | | secondCateList[activeIndex].tempParamCode = '' |
| | | secondCateList[activeIndex].tempParamName = '' |
| | | } |
| | | this.setData({ tagCodes, secondCateList }) |
| | | }, |
| | |
| | | }, |
| | | cancelParam() { |
| | | const { secondCateList } = this.data |
| | | secondCateList.forEach(item => { |
| | | item.paramIndex = -1 |
| | | item.paramName = item.paramName || '' |
| | | secondCateList.forEach(item => { |
| | | item.tempParamIndex = item.paramIndex |
| | | item.tempParamName = item.paramName |
| | | item.tempParamCode = item.paramCode |
| | | }) |
| | | this.setData({ tagCodes: [],activeParam: [],secondCateList,activeIndex: -1 }) |
| | | // this.setData({ tagCodes: [], activeParam: [], secondCateList, activeIndex: -1 }) |
| | | this.setData({ activeParam: [],activeIndex: -1 ,secondCateList}) |
| | | }, |
| | | subParam() { |
| | | this.setData({ activeParam: [] }) |
| | | this.setData({ pageNum: 1,activeIndex: -1, datalist: [],total: 0}) |
| | | const { secondCateList } = this.data |
| | | var codes = [] |
| | | secondCateList.forEach(item => { |
| | | item.paramIndex = item.tempParamIndex |
| | | item.paramName = item.tempParamName |
| | | item.paramCode = item.tempParamCode |
| | | if( item.paramIndex>-1 && item.tempParamCode){ |
| | | codes.push( item.tempParamCode) |
| | | } |
| | | }) |
| | | this.setData({tagCodes:codes}) |
| | | this.setData({ pageNum: 1, activeParam: [] ,activeIndex: -1, datalist: [], total: 0 }) |
| | | this.getList() |
| | | }, |
| | | } |
| | |
| | | <view class="main_right"> |
| | | <view class="query_wrap"> |
| | | <view data-index="{{index}}" wx:for="{{ secondCateList }}" class="item" bindtap="changeShowParams"> |
| | | <view class="name">{{ item.paramName || item.labelName }}</view> |
| | | <view class="name">{{ item.tempParamName || item.labelName }}</view> |
| | | <van-icon name="{{ index == activeIndex ? 'arrow-up' : 'arrow-down' }}" /> |
| | | </view> |
| | | </view> |
| | | <view wx:if="{{ activeParam.length > 0 }}" class="query_form"> |
| | | <view class="list"> |
| | | <view data-index="{{index}}" data-code="{{ item.labelValueCode }}" bindtap="tagClick" wx:for="{{ activeParam }}" class="item {{ secondCateList[activeIndex].paramIndex === index ? 'active' : '' }}">{{ item.labelValueName }}</view> |
| | | <view data-index="{{index}}" data-code="{{ item.labelValueCode }}" bindtap="tagClick" wx:for="{{ activeParam }}" class="item {{ secondCateList[activeIndex].tempParamIndex === index ? 'active' : '' }}">{{ item.labelValueName }}</view> |
| | | </view> |
| | | <view class="btns"> |
| | | <view class="btn" bindtap="cancelParam">取消</view> |
| | |
| | | -webkit-box-orient: vertical; |
| | | -webkit-line-clamp: 1; |
| | | overflow: hidden; |
| | | |
| | | } |
| | | .main_content .main_right .goods_list .item .info { |
| | | display: flex; |
| | |
| | | margin-bottom: 26rpx; |
| | | } |
| | | |
| | | .text { |
| | | .text { |
| | | line-height: 48rpx; |
| | | font-size: 26rpx; |
| | | color: #555555; |
| | | margin-bottom: 40rpx; |
| | |
| | | margin-bottom: 24rpx; |
| | | |
| | | .label { |
| | | width: 120rpx; |
| | | width: auto; |
| | | font-size: 24rpx; |
| | | color: #666666; |
| | | } |
| | |
| | | color: #555555; |
| | | margin-bottom: 26rpx; |
| | | } |
| | | .main_content .text { |
| | | .main_content .text { |
| | | line-height: 48rpx; |
| | | font-size: 26rpx; |
| | | color: #555555; |
| | | margin-bottom: 40rpx; |
| | |
| | | margin-bottom: 24rpx; |
| | | } |
| | | .detail .line .label { |
| | | width: 120rpx; |
| | | width: auto; |
| | | font-size: 24rpx; |
| | | color: #666666; |
| | | } |