Commit af7492e5 by chenwq

sort-tab

1 parent 668898e3
...@@ -244,7 +244,6 @@ Component({ ...@@ -244,7 +244,6 @@ Component({
params.categoryList = [attrToNum[proList[formData?.proIdx].productCode]] params.categoryList = [attrToNum[proList[formData?.proIdx].productCode]]
params.activityStatusList = this.dealSearchStatus() params.activityStatusList = this.dealSearchStatus()
} }
console.log(params)
return params return params
}, },
......
...@@ -83,7 +83,7 @@ Component({ ...@@ -83,7 +83,7 @@ Component({
this.getBusiStatistics() this.getBusiStatistics()
}) })
}, },
// 业务经营 // 1、tab-业务经营;2、升降序
handleBusiSearch(e) { handleBusiSearch(e) {
this.getBusiStatistics(true) this.getBusiStatistics(true)
}, },
...@@ -121,18 +121,19 @@ Component({ ...@@ -121,18 +121,19 @@ Component({
getBusiStatistics(isReset = false) { getBusiStatistics(isReset = false) {
let totalTabModule = this.selectComponent('#totalTab') let totalTabModule = this.selectComponent('#totalTab')
let busiSearchData = totalTabModule.dealParams() let busiSearchData = totalTabModule.dealParams()
let sortTabModule = this.selectComponent('#sortTab')
let sortSearchData = sortTabModule.dealParams()
this.setData({ this.setData({
formData: JSON.parse(JSON.stringify(totalTabModule.data.formData)) formData: JSON.parse(JSON.stringify(totalTabModule.data.formData))
}) })
let { merchantList, formData } = this.data let { merchantList, formData } = this.data
let params = { let params = {
asc: 1,
orderBy: 1,
...busiSearchData, ...busiSearchData,
...sortSearchData,
// merchantIds: merchantList.map(item => item.merchantId) // merchantIds: merchantList.map(item => item.merchantId)
merchantIds: ['44211227', '44211547', '10011000', '44184606', '44209535'] merchantIds: ['44211227', '44211547', '10011000', '44184606', '44209535']
} }
// console.log(params, 'params--') console.log(params, 'params--')
outputApi.getBusiStatistics(params).then(res => { outputApi.getBusiStatistics(params).then(res => {
this.resetBusiData() this.resetBusiData()
// console.log(res, '汇总----') // console.log(res, '汇总----')
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<text>总收益</text> <text>总收益</text>
<text class="price-txt">¥{{filter.money_three_for_two_thousands(busiObj.totalAmount || 0.00)}}</text> <text class="price-txt">¥{{filter.money_three_for_two_thousands(busiObj.totalAmount || 0.00)}}</text>
</view> </view>
<sort-tab></sort-tab> <sort-tab id="sortTab" bindhandleSort="handleBusiSearch"></sort-tab>
</view> </view>
<!-- 售后众筹 --> <!-- 售后众筹 -->
<view wx:if="{{formData.sceneCode == 'SC004'}}"> <view wx:if="{{formData.sceneCode == 'SC004'}}">
......
...@@ -10,7 +10,7 @@ Component({ ...@@ -10,7 +10,7 @@ Component({
}, },
sceneCode: { sceneCode: {
type: String, type: String,
value: '-1' value: 'SC002'
} }
}, },
...@@ -18,9 +18,15 @@ Component({ ...@@ -18,9 +18,15 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
actIdx: '-1',
imgObj: {
'': 'default',
1: 'up',
2: 'down',
},
// 全部-1;精品升级SC002;会员权益/升级SC001 // 全部-1;精品升级SC002;会员权益/升级SC001
// asc:1-升序,2-降序 // asc:''-无, 1-升序,2-降序
obj: { formObj: {
'-1': [{ '-1': [{
label: '精品升级', label: '精品升级',
asc: '', asc: '',
...@@ -89,7 +95,7 @@ Component({ ...@@ -89,7 +95,7 @@ Component({
lifetimes: { lifetimes: {
attached() { attached() {
console.log(this.data.obj[this.data.sceneCode]) console.log(this.data.formObj[this.data.sceneCode])
} }
}, },
...@@ -97,6 +103,61 @@ Component({ ...@@ -97,6 +103,61 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
// 处理升降序排序参数
dealParams() {
let { actIdx, formObj, sceneCode } = this.data
let _params = {}
if (actIdx != -1) {
let _item = formObj[sceneCode][actIdx]
_params = {
orderBy: _item.value,
asc: _item.asc
}
}
return _params
},
resetAsc() {
let { actIdx, sceneCode } = this.data
if (actIdx == '-1') {
return true
}
// let _list = Object.keys(formObj)
// _list.forEach(item => {
// formObj[item].forEach(k => {
// k.asc = ''
// })
// })
this.setData({
[`formObj.${sceneCode}[${actIdx}].asc`]: ''
})
},
handleSort(e) {
let { idx } = e.currentTarget.dataset
let { formObj, sceneCode, actIdx } = this.data
if (idx != actIdx) {
this.resetAsc()
}
let _actIdx = idx
let _asc = ''
switch (formObj[sceneCode][idx]?.asc) {
case '1':
_asc = '2'
break
case '2':
_asc = ''
_actIdx = '-1'
break
case '':
_asc = '1'
break
}
this.setData({
[`formObj.${sceneCode}[${idx}].asc`]: _asc,
actIdx: _actIdx
})
this.triggerEvent('handleSort')
},
} }
}) })
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.sort-tab { .sort-tab {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
width: 100vw; width: auto;
height: 86rpx; height: 86rpx;
line-height: 86rpx; line-height: 86rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
...@@ -13,12 +13,25 @@ ...@@ -13,12 +13,25 @@
flex-shrink: 0; flex-shrink: 0;
} }
.flex {
display: flex;
}
.sort-scroll { .sort-scroll {
display: flex; display: flex;
width: calc(100% - 196rpx); width: calc(100% - 196rpx);
.item { .item {
display: inline-block; display: flex;
flex-shrink: 0;
justify-content: center;
align-items: center;
margin-right: 20rpx;
}
.icon {
width: 32rpx;
height: 32rpx;
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
<view class="sort-tab"> <view class="sort-tab">
<ciew class="title">{{title}}</ciew> <ciew class="title">{{title}}</ciew>
<scroll-view class="sort-scroll" scroll-x="true"> <scroll-view class="sort-scroll" scroll-x="true">
<view wx:for="{{obj[sceneCode]}}" wx:key="index" class="item"> <view class="flex">
<view>{{item.label}}</view> <view wx:for="{{formObj[sceneCode]}}" wx:key="index" class="item" bindtap="handleSort" data-idx="{{index}}">
<view>111</view> <view>{{item.label}}</view>
<glsx-image src="output/sort-{{imgObj[item.asc]}}.png" class="icon" />
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!