Commit 61fa6b74 by chenwq

联调

1 parent c34da649
...@@ -123,5 +123,21 @@ class outputApi { ...@@ -123,5 +123,21 @@ class outputApi {
...data ...data
}) })
} }
/** 业务经营汇总列表查询 */
getBusiStatistics(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.business.assistant.merchants.statistics',
...data
})
}
/** 获取服务商下所有4S店 */
getMerchantList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.merchantList',
...data
})
}
} }
export default outputApi export default outputApi
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { scenceList } from '~/pages/tab/index/constant/data' import { scenceList } from '~/pages/tab/index/constant/data'
const busiOptSceneCode = ['-1', 'SC002', 'SC004', 'SC001'] const busiOptSceneCode = ['-1', 'SC002', 'SC004', 'SC001']
import outputApi from '~/api/outputApi/index' import outputApi from '~/api/outputApi/index'
import { getNowMonth } from '~/utils/format'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -41,6 +42,7 @@ Component({ ...@@ -41,6 +42,7 @@ Component({
lifetimes: { lifetimes: {
attached() { attached() {
this.initTime()
this.dealBusiList() this.dealBusiList()
this.getProList('SC004') this.getProList('SC004')
} }
...@@ -50,18 +52,18 @@ Component({ ...@@ -50,18 +52,18 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
resetAllSearch() { // resetAllSearch() {
this.setData({ // this.setData({
formData: { // formData: {
busiIdx: 0, // busiIdx: 0,
// 全部,精品升级,会员权益 // // 全部,精品升级,会员权益
timeIdx: 0, // timeIdx: 0,
// 售后众筹 // // 售后众筹
proIdx: 0, // proIdx: 0,
statusIdx: 0 // statusIdx: 0
} // }
}) // })
}, // },
resetBusiSearch() { resetBusiSearch() {
this.setData({ this.setData({
...@@ -110,6 +112,7 @@ Component({ ...@@ -110,6 +112,7 @@ Component({
this.setData({ this.setData({
[attr]: val [attr]: val
}) })
this.triggerEvent('tabChange', { tabActive: val })
}, },
handleClickTab(e) { handleClickTab(e) {
...@@ -117,15 +120,18 @@ Component({ ...@@ -117,15 +120,18 @@ Component({
// 切换tab // 切换tab
if (tabActive != 'business') { if (tabActive != 'business') {
this.handleSet(e) this.handleSet(e)
// this.handleSearch()
return true return true
} }
// 筛选 // 筛选
wx.showActionSheet({ wx.showActionSheet({
itemList: busiList.map(item => item.name), itemList: busiList.map(item => item.name),
success: res => { success: res => {
this.resetBusiSearch()
this.setData({ this.setData({
['formData.busiIdx']: res.tapIndex ['formData.busiIdx']: res.tapIndex
}) })
this.handleBusiSearch()
} }
}) })
}, },
...@@ -138,6 +144,7 @@ Component({ ...@@ -138,6 +144,7 @@ Component({
this.setData({ this.setData({
['formData.timeIdx']: res.tapIndex ['formData.timeIdx']: res.tapIndex
}) })
this.handleBusiSearch()
} }
}) })
}, },
...@@ -164,6 +171,97 @@ Component({ ...@@ -164,6 +171,97 @@ Component({
['formData.statusIdx']: statusIdx, ['formData.statusIdx']: statusIdx,
isCrowdPopupShow: !this.data.isCrowdPopupShow isCrowdPopupShow: !this.data.isCrowdPopupShow
}) })
this.handleBusiSearch()
},
// 格式化时间
initTime() {
let date = new Date()
let today = date.getDate()
let month = getNowMonth()
const todayTime = {
startTime: `${month}-${today} 00:00:00`,
endTime: `${month}-${today} 23:59:59`
}
const monthTime = {
startTime: `${month}-01 00:00:00`,
endTime: `${month}-${today} 23:59:59`
}
const defaultTime = {
startTime: '',
endTime: `${month}-${today} 23:59:59`
}
this.setData({
dataObj: {
todayTime,
monthTime,
defaultTime
}
})
},
dealSearchTime() {
let { dataObj, formData } = this.data
var params = {}
switch (formData.timeIdx) {
// 本月
case 1:
params = dataObj.monthTime
break
// 本日
case 2:
params = dataObj.todayTime
break
}
return params
},
dealSearchStatus() {
let { formData } = this.data
var activityStatuList = []
switch (formData.statusIdx) {
case 0:
activityStatuList = [1, 2, 3]
break
// 申请中
case 1:
activityStatuList = [1]
break
// 活动中
case 2:
activityStatuList = [2]
break
// 已结束
case 3:
activityStatuList = [3]
break
}
return activityStatuList
},
dealSearchCrowd() {
let params = {}
let { formData, baseData: { proList } } = this.data
if (formData.busiIdx == 2) {
params.categoryList = proList[formData?.proIdx || 0].productCode
params.activityStatusList = this.dealSearchStatus()
}
console.log(params)
return params
},
dealParams() {
let { formData } = this.data
let params = {
type: formData.busiIdx || '',
...this.dealSearchTime(),
...this.dealSearchCrowd()
}
return params
},
handleBusiSearch() {
this.triggerEvent('busiSearch')
} }
} }
}) })
...@@ -26,7 +26,9 @@ Component({ ...@@ -26,7 +26,9 @@ Component({
pageSize: 10 pageSize: 10
}, },
totalPages: -1, totalPages: -1,
list: [] list: [],
tabActive: 'store',
merchantList: []
}, },
lifetimes: { lifetimes: {
attached() { attached() {
...@@ -34,6 +36,7 @@ Component({ ...@@ -34,6 +36,7 @@ Component({
this.clientRefresh() this.clientRefresh()
}) })
this.getPMerchantInfo() this.getPMerchantInfo()
this.getBusinessData()
this.getClientApi() this.getClientApi()
} }
}, },
...@@ -43,6 +46,46 @@ Component({ ...@@ -43,6 +46,46 @@ Component({
*/ */
methods: { methods: {
// tab切换 // tab切换
handleTabChange(e) {
let { tabActive } = e.detail
this.setData({
tabActive
})
},
getBusinessData() {
this.getMerchantList()
},
// 获取服务商下的所有4s店
getMerchantList() {
let { userInfo } = wx.$storage.get()
let params = {
merchantId: userInfo.merchantId
}
outputApi.getMerchantList(params).then(res => {
this.setData({
merchantList: res
})
this.getBusiStatistics()
})
},
// 业务经营
handleBusiSearch(e) {
this.getBusiStatistics(true)
},
getBusiStatistics(isReset = false) {
let totalTabModule = this.selectComponent('#totalTab')
let busiSearchData = totalTabModule.dealParams()
let { merchantList } = this.data
let params = {
...busiSearchData,
merchantIds: merchantList.map(item => item.merchantId)
}
console.log(params, 'params--')
outputApi.getBusiStatistics(params).then(res => {
console.log(res, '汇总----')
})
},
// 门店经营汇总-start // 门店经营汇总-start
getPMerchantInfo() { getPMerchantInfo() {
......
<!-- pages/tab/output/components/client/client.wxml --> <!-- pages/tab/output/components/client/client.wxml -->
<wxs src="../../index.wxs" module="filter" /> <wxs src="../../index.wxs" module="filter" />
<total-tab></total-tab> <total-tab id="totalTab" bindbusiSearch="handleBusiSearch" bindtabChange="handleTabChange"></total-tab>
<scroll-view class="client" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindscrolltolower="onReachBottom" bindrefresherrefresh="onBindRefresh" lower-threshold='50' scroll-top="{{scrollTop}}"> <scroll-view wx:if="{{tabActive == 'store'}}" class="client" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindscrolltolower="onReachBottom" bindrefresherrefresh="onBindRefresh" lower-threshold='50' scroll-top="{{scrollTop}}">
<view class="client-box"> <view class="client-box">
<view class="profit-box flex-between"> <view class="profit-box flex-between">
<text>总收益</text> <text>总收益</text>
...@@ -53,4 +53,5 @@ ...@@ -53,4 +53,5 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<scroll-view wx:if="{{tabActive == 'business'}}" class="client" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindscrolltolower="onReachBottom" bindrefresherrefresh="onBindRefresh" lower-threshold='50' scroll-top="{{scrollTop}}"></scroll-view>
<crowdfund-poster item="{{posterItem}}" id="poster" scrollImg="{{false}}" bindlongtouch="longtouch" /> <crowdfund-poster item="{{posterItem}}" id="poster" scrollImg="{{false}}" bindlongtouch="longtouch" />
\ No newline at end of file \ No newline at end of file
...@@ -59,7 +59,7 @@ Page({ ...@@ -59,7 +59,7 @@ Page({
}, },
setUserInfo() { setUserInfo() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
console.log(userInfo) // console.log(userInfo)
this.setData({ this.setData({
userInfo, userInfo,
isSuper: userInfo.isSuper isSuper: userInfo.isSuper
...@@ -80,9 +80,10 @@ Page({ ...@@ -80,9 +80,10 @@ Page({
this.setUserInfo() this.setUserInfo()
let clientModule = this.selectComponent('#client') let clientModule = this.selectComponent('#client')
let merchantModule = this.selectComponent('#merchant') let merchantModule = this.selectComponent('#merchant')
// console.log('clientModule', clientModule) console.log('clientModule', clientModule)
// console.log() // console.log()
clientModule.getClientApi && clientModule.clientRefresh() clientModule.getClientApi && clientModule.clientRefresh()
clientModule.getBusinessData && clientModule.getBusinessData()
merchantModule.init && merchantModule.init() merchantModule.init && merchantModule.init()
} }
let { isSuper, userInfo } = this.data let { isSuper, userInfo } = this.data
...@@ -91,9 +92,9 @@ Page({ ...@@ -91,9 +92,9 @@ Page({
if (isSuper) { if (isSuper) {
USERAPI.adminSelectLogin() USERAPI.adminSelectLogin()
.then(result => { .then(result => {
console.log(result) // console.log(result)
let { merchantList: merchantRange } = result let { merchantList: merchantRange } = result
console.log(merchantRange) // console.log(merchantRange)
let subIndex = -1 let subIndex = -1
merchantRange.forEach((item, index) => { merchantRange.forEach((item, index) => {
item.show = true item.show = true
...@@ -125,6 +126,7 @@ Page({ ...@@ -125,6 +126,7 @@ Page({
if (page == 'client' && refresh) { if (page == 'client' && refresh) {
let clientModule = this.selectComponent('#client') let clientModule = this.selectComponent('#client')
clientModule.getClientApi && clientModule.clientRefresh() clientModule.getClientApi && clientModule.clientRefresh()
clientModule.getBusinessData && clientModule.getBusinessData()
} }
}, },
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!