Commit fc26aa84 by chenwq

看产值-联调

1 parent e96cf622
......@@ -145,12 +145,13 @@ Page({
pIdx: -1,
idx: -1
}
let { userInfo } = wx.$storage.get()
if (this.data.mockObj?.crowdObj) {
let pList = this.data.mockObj.crowdObj.map(item => item.pMerchantId)
for (let i = 0; i < this.data.mockObj.crowdObj.length; i++) {
let item = this.data.mockObj.crowdObj[i]
let cList = item.merchantList.map(k => k.merhantId)
if (cList.includes((id || this.data.merchantInfo.merchantId) + '') && pList.includes((pId || this.data.merchantInfo.pMerchantId) + '')) {
if (cList.includes((id || this.data.merchantInfo.merchantId) + '') && pList.includes((pId || userInfo.subLoginUser.merchantId) + '')) {
res = {
flag: true,
pIdx: i,
......@@ -165,7 +166,8 @@ Page({
// 处理SC004的mock数据
mockDealCrowd(data) {
var obj = this.judgeCrowd(this.data.merchantInfo.pMerchantId, data.merchantId)
let { userInfo } = wx.$storage.get()
var obj = this.judgeCrowd(userInfo.subLoginUser.merchantId, data.merchantId)
if (!obj.flag) {
return data
}
......
// pages/tab/outputValue/components/merchant/merchant.js
import { IMG_URL } from '~/utils/constantData'
// import outputApi from '~/api/outputApi/index'
import outputValueApi from '~/api/outputValueApi/index'
Component({
/**
......@@ -40,6 +39,8 @@ Component({
startYearMonth: '',
endYearMonth: ''
},
isEnd: false,
loading: true,
// totalObj: {
// scene1Total: '72536',
// scene0Total: '76400',
......@@ -191,26 +192,18 @@ Component({
// }]
// }]
},
// lifetimes: {
// attached() {
// this.getMerchantList()
// }
// },
/**
* 组件的方法列表
*/
methods: {
// search() {
// console.log(this.data.searchForm, 'searchForm---')
// let { sceneType } = this.data.searchForm
// let { allMerchantList, otherMerchantList } = this.data
// this.setData({
// merchantList: !sceneType ? allMerchantList : otherMerchantList
// })
// },
merchantRefresh(isReset = false) {
// wx.showLoading()
if (isReset) {
this.setData({
['pageCof.startYearMonth']: '',
['pageCof.endYearMonth']: ''
})
}
this.getTotal()
this.getMerchantList(isReset)
},
......@@ -225,32 +218,44 @@ Component({
})
})
},
getMore() {
this.getMerchantList()
},
// month作为分页参数
dealMonth(isReset = false, monthInterval = 2) {
dealMonth(isReset = false, monthInterval = 1) {
let { startTime, endTime } = this.data.searchForm
let { startYearMonth, endYearMonth } = this.data.pageCof
// 起始为空
if (!startTime && !endTime) {
// 获取当前日期
var _currentDate = new Date()
// 获取前n个月的日期
var _endMonthDate = new Date()
_endMonthDate.setMonth(_currentDate.getMonth() - monthInterval)
var _startMonthDate = new Date()
_startMonthDate.setMonth(isReset ? _currentDate.getMonth() - monthInterval : _endMonthDate.getMonth() - monthInterval)
endYearMonth = isReset ? _currentDate.format('yyyy-MM') : _endMonthDate.format('yyyy-MM')
startYearMonth = _startMonthDate.format('yyyy-MM')
// 获取当前日期
let _currentDate = new Date()
// 获取前n个月的日期
let _endMonthDate = new Date()
let searchStart = ''
// 翻页
if (startYearMonth && endYearMonth) {
_currentDate = new Date(startYearMonth)
_endMonthDate = new Date(startYearMonth)
} else if (startTime && endTime) {
_currentDate = new Date(endTime)
_endMonthDate = new Date(endTime)
searchStart = new Date(startTime)
}
_endMonthDate.setMonth(_currentDate.getMonth() - monthInterval)
let _startMonthDate = new Date(isReset ? _currentDate : _endMonthDate)
_startMonthDate.setMonth(_startMonthDate.getMonth() - monthInterval)
endYearMonth = isReset ? _currentDate.format('yyyy-MM') : _endMonthDate.format('yyyy-MM')
startYearMonth = searchStart > _startMonthDate ? new Date(searchStart).format('yyyy-MM') : _startMonthDate.format('yyyy-MM')
this.setData({
['pageCof.startYearMonth']: startYearMonth,
['pageCof.endYearMonth']: endYearMonth
['pageCof.endYearMonth']: endYearMonth,
isEnd: new Date(new Date(startTime)).format('yyyy-MM') == startYearMonth
})
},
getMerchantList(isReset = false) {
let { userInfo } = wx.$storage.get()
let { searchForm, merchantList } = this.data
this.setData({
serviceName: userInfo.subLoginUser.merchantName
serviceName: userInfo.subLoginUser.merchantName,
loading: true
})
this.dealMonth(isReset)
let params = {
......@@ -259,18 +264,24 @@ Component({
sceneType: searchForm.sceneType,
...this.data.pageCof
}
console.log(params)
wx.$api.showLoading('加载中...')
const paiName = searchForm.sceneType ? 'getQuerySceneList' : 'getAllSceneList'
outputValueApi[paiName](params).then(res => {
console.log(res, 'res---')
this.setData({
merchantList: isReset ? (res || []) : merchantList.push(res || [])
merchantList: isReset ? (res || []) : merchantList.concat(res || [])
})
if (isReset) {
this.setData({
busiScrollTop: 0
})
}
}).finally(() => {
wx.hideLoading()
this.setData({
triggered: false,
loading: false
})
})
}
}
......
......@@ -15,6 +15,19 @@
.merchant-content {
// margin: 0 16rpx;
margin-bottom: 44rpx;
}
.btn {
width: 256rpx;
height: 80rpx;
line-height: 80rpx;
border: 1.6rpx solid #DDDDDD;
border-radius: 12rpx;
font-size: 24rpx;
color: #5A6066;
text-align: center;
margin: 0 auto 44rpx;
}
.end-txt {
......
<!--pages/tab/outputValue/components/merchant/merchant.wxml-->
<view class="merchantCon">
<scroll-view class="merchant" id="scroller" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="handleSearch" lower-threshold='50' scroll-top="{{busiScrollTop}}">
<scroll-view class="merchant" id="scroller" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="merchantRefresh" lower-threshold='50' scroll-top="{{busiScrollTop}}">
<!-- 全部 - 服务商总产值 -->
<service-total wx:if="{{!searchForm.sceneType}}" serviceName="{{serviceName}}" totalObj="{{totalObj}}"></service-total>
<service-total wx:if="{{!searchForm.sceneType && merchantList.length}}" serviceName="{{serviceName}}" totalObj="{{totalObj}}"></service-total>
<view wx:for="{{merchantList}}" wx:key="index" class="merchant-content">
<!-- 全部 -->
<merchant-all wx:if="{{!searchForm.sceneType}}" curInfo="{{item}}"></merchant-all>
<!-- 指定场景:太阳膜,售后众筹,会员权益/升级 -->
<merchant-scene wx:else searchForm="{{searchForm}}" curInfo="{{item}}"></merchant-scene>
</view>
<view wx:if="{{!merchantList.length}}" class="end-txt">
<nothing-tips tips="暂无数据~" bgColor="{{'#FFFFFF'}}" bg="{{bgUrl}}" />
</view>
<view wx:else class="end-txt">
<view>到底啦~</view>
<view wx:if="{{!loading}}">
<view wx:if="{{!merchantList.length}}" class="end-txt">
<nothing-tips tips="暂无数据~" bgColor="{{'#FFFFFF'}}" bg="{{bgUrl}}" />
</view>
<view class="btn" wx:elif="{{!isEnd}}" bindtap="getMore">加载更多</view>
<view wx:else class="end-txt">
<view>到底啦~</view>
</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
......@@ -8,7 +8,11 @@ Component({
curInfo: {
type: Object,
value: () => { },
observer(n) { }
observer(n) {
if(n) {
this.dealYearMonth()
}
}
},
searchForm: {
type: Object,
......@@ -38,14 +42,23 @@ Component({
sceneTopList: constant.membranesTopList,
sceneFormList: constant.membranesFormList,
sceneObj: {},
compareList: [],
switchChecked: false
date: {
year: '',
month: ''
}
},
/**
* 组件的方法列表
*/
methods: {
dealYearMonth() {
let { yearMonth } = this.data.curInfo
this.setData({
['date.year']: new Date(yearMonth || '').getFullYear(),
['date.month']: new Date(yearMonth || '').getMonth() + 1,
})
},
dealData() {
let { searchForm, sceneToInfo } = this.data
let sceneObj = sceneToInfo.find(item => item.type == (searchForm.sceneType || 1))
......@@ -54,6 +67,11 @@ Component({
sceneTopList: constant[(sceneObj.name || 'membranes') + 'TopList'],
sceneFormList: constant[(sceneObj.name || 'membranes') + 'FormList']
})
}
},
jump(e) {
let { info } = e.currentTarget.dataset
console.log(info)
wx.$router.go('packagesList.newSummary', info)
},
}
})
......@@ -130,6 +130,14 @@
background-image: linear-gradient(179deg, #FAFAFA 0%, #FFFFFF 50%);
}
.list:hover {
background: #00000005;
}
.title-box-first:hover {
background-image: none;
}
.title-box {
position: relative;
padding: 26rpx 24rpx;
......
......@@ -7,7 +7,7 @@
<text class="num-red">¥{{filter.money_three_for_two_thousands(curInfo.curMonthTotalData.bizTotal || 0)}}</text>
</view>
<view>
<text class="num-month">8</text><text class="month">月</text><text class="year">2023年</text>
<text class="num-month">{{date.month}}</text><text class="month">月</text><text class="year">{{date.year}}年</text>
</view>
<view class="top-num-box">
<view>
......@@ -31,7 +31,7 @@
</view>
<!-- 门店列表 -->
<view class="contanier">
<view wx:for="{{curInfo.merchantDataList}}" wx:key="index" class="list">
<view wx:for="{{curInfo.merchantDataList}}" wx:key="index" class="list" bindtap="jump" data-info="{{item}}">
<view class="title-box flex-between {{index == 0 ? 'title-box-first' : ''}}">
<view class="title-block">
<view class="title-name text-hide">{{item.merchantName}}</view>
......
......@@ -23,7 +23,11 @@ Component({
data: {
sceneFormList: constant.sceneFormList,
compareList: [],
switchChecked: false
switchChecked: false,
date: {
year: '',
month: ''
}
},
/**
......@@ -31,7 +35,11 @@ Component({
*/
methods: {
dealYearMonth() {
let { merchantDataList } = this.data.curInfo
let { yearMonth } = this.data.curInfo
this.setData({
['date.year']: new Date(yearMonth || '').getFullYear(),
['date.month']: new Date(yearMonth || '').getMonth() + 1,
})
},
dealCompare() {
let { merchantDataList } = this.data.curInfo
......@@ -49,9 +57,8 @@ Component({
this.setData({
compareList: list
})
console.log(this.data.compareList, 'compareList---')
},
handleClick(e) {
jump(e) {
let { info } = e.currentTarget.dataset
console.log(info)
wx.$router.go('packagesList.newSummary', info)
......
......@@ -6,7 +6,7 @@
<switch style="zoom:.6; margin-left: 8rpx;" color="#3666FE" checked="{{switchChecked}}" bindchange="switchChange" />
</view>
<view>
<text class="num-month">8</text><text class="month">月</text><text class="year">2023年</text>
<text class="num-month">{{date.month}}</text><text class="month">月</text><text class="year">{{date.year}}年</text>
</view>
<view class="top-num-box">
<view>
......@@ -23,7 +23,7 @@
</view>
<!-- 门店列表 -->
<view class="contanier">
<view wx:for="{{curInfo.merchantDataList}}" wx:key="index" class="list" bindtap="handleClick" data-info="{{item}}">
<view wx:for="{{curInfo.merchantDataList}}" wx:key="index" class="list" bindtap="jump" data-info="{{item}}">
<view class="title-box flex-between {{index == 0 ? 'title-box-first' : ''}}">
<view class="title-block">
<view class="title-name text-hide">{{item.merchantName}}</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!