Commit fc26aa84 by chenwq

看产值-联调

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