Commit b0a92bf4 by chenwq

场景值组件,看产值-我的客户;产值计算;开通业务

1 parent 6ece6502
// pages/tab/output/components/sceneBox/sceneBox.js // pages/tab/output/components/sceneBox/sceneBox.js
import { IMG_URL } from '~/utils/constantData' import { IMG_URL } from '~/utils/constantData'
import { scenceList } from '~/pages/tab/index/constant/data'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -12,6 +13,10 @@ Component({ ...@@ -12,6 +13,10 @@ Component({
type: Number, type: Number,
value: -1 value: -1
}, },
sceneCodeActive: {
type: String,
value: ''
},
hasOpenIcon: { hasOpenIcon: {
type: Boolean, type: Boolean,
value: true value: true
...@@ -20,9 +25,14 @@ Component({ ...@@ -20,9 +25,14 @@ Component({
type: Boolean, type: Boolean,
value: true value: true
}, },
formData: { sceneInfo: {
type: Object, type: Object,
value: () => {} value: () => {},
observer(n) {
if(n.hasOwnProperty('sceneList')) {
this.findIsOpen()
}
}
}, },
scenePriceList: { scenePriceList: {
type: Array, type: Array,
...@@ -36,33 +46,51 @@ Component({ ...@@ -36,33 +46,51 @@ Component({
data: { data: {
IMGURL: IMG_URL, IMGURL: IMG_URL,
openedIcon: `${IMG_URL}/output/openedIcon.png`, openedIcon: `${IMG_URL}/output/openedIcon.png`,
custSceneList: [ scenceList
{ // custSceneList: [
title: '新车洽谈场景', // {
subTitle: '1.0新车权益升级' // title: '新车洽谈场景',
}, // subTitle: '1.0新车权益升级'
{ // },
title: '新车交付场景', // {
subTitle: '1.1新车精品升级' // title: '新车交付场景',
// subTitle: '1.1新车精品升级'
// },
// {
// title: '0-6个月',
// subTitle: '1.2次新车膨胀金活动'
// },
// {
// title: '6个月以上',
// subTitle: '1.3售后直播众筹活动'
// }
// ]
}, },
{
title: '0-6个月', lifetimes: {
subTitle: '1.2次新车膨胀金活动' attached() {
}, // console.log(this.data.sceneInfo, 'sceneInfo--')
{ // console.log(this.data.scenceList, 'scenceList--')
title: '6个月以上',
subTitle: '1.3售后直播众筹活动'
} }
]
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
findIsOpen() {
let list = JSON.parse(JSON.stringify(this.data.scenceList))
list.forEach(item => {
let obj = this.data.sceneInfo?.sceneList.find(k => k.sceneCode == item.sceneCode) || {}
item.isOpen = obj.flag || false
})
this.setData({
scenceList: list
})
},
handleClick(e) { handleClick(e) {
let { idx } = e.currentTarget.dataset let { idx, scenecode } = e.currentTarget.dataset
this.triggerEvent('handleSceneChange', { sceneIdx: idx }) this.triggerEvent('handleSceneChange', { sceneIdx: idx, sceneCode: scenecode })
} }
} }
}) })
<!-- pages/tab/output/components/sceneBox/sceneBox.wxml --> <!-- pages/tab/output/components/sceneBox/sceneBox.wxml -->
<wxs src="/pages/tab/output/index.wxs" module="filter" /> <wxs src="/pages/tab/output/index.wxs" module="filter" />
<view class="flex scene"> <view class="flex scene">
<view class="scene-item {{ (formData['scene' + (index + 1)] && hasOpenIcon) ? 'open' : ''}} {{ (sceneActive != -1 && sceneActive == index + 1) ? 'active' : ''}}" wx:for="{{custSceneList}}" wx:key="index" bindtap="handleClick" data-idx="{{index + 1}}"> <view class="scene-item {{ (item.isOpen && hasOpenIcon) ? 'open' : ''}} {{sceneCodeActive && (sceneCodeActive == item.sceneCode) ? 'active' : ''}}" wx:for="{{scenceList}}" wx:key="index" bindtap="handleClick" data-idx="{{index + 1}}" data-scenecode="{{item.sceneCode}}">
<view wx:if="{{hasOpenIcon && formData['scene' + (index + 1)]}}" class="open-icon"> <view wx:if="{{hasOpenIcon && item.isOpen}}" class="open-icon">
<image src="{{openedIcon}}" webp></image> <image src="{{openedIcon}}" webp></image>
</view> </view>
<image webp wx:if="{{formData['scene' + (index + 1)]}}" class="scene-img" src="{{IMGURL}}output/caracticon0{{index + 1}}.png?v={{img_version}}"></image> <image webp wx:if="{{item.isOpen}}" class="scene-img" src="{{IMGURL}}output/caracticon0{{item.sceneid + 1}}.png?v={{img_version}}"></image>
<view wx:else class="no-open-img"> <view wx:else class="no-open-img">
<image webp wx:if="{{hasLockIcon}}" class="lock-img" src="{{IMGURL}}output/carlock0{{index + 1}}.png?v={{img_version}}"></image> <image webp wx:if="{{hasLockIcon}}" class="lock-img" src="{{IMGURL}}output/carlock0{{item.sceneid + 1}}.png?v={{img_version}}"></image>
<image webp wx:else="" class="scene-img" src="{{IMGURL}}output/icon-car0{{index + 1}}.png?v={{img_version}}"></image> <image webp wx:else="" class="scene-img" src="{{IMGURL}}output/icon-car0{{item.sceneid + 1}}.png?v={{img_version}}"></image>
</view> </view>
<view class="scene-title {{formData['scene' + (index + 1)] ? '' : 'on-open'}}"> <view class="scene-title {{item.isOpen ? '' : 'on-open'}}">
{{item.title}} {{item.name}}
</view> </view>
<view>{{item.subTitle}}</view> <!-- <view>{{item.subTitle}}</view> -->
<view class="total-price" wx:if="{{scenePriceList.length}}"> <view class="total-price" wx:if="{{scenePriceList.length}}">
¥ {{filter.money_three_for_two_thousands(scenePriceList[index].total || 0.00)}} ¥ {{filter.money_three_for_two_thousands(scenePriceList[index].total || 0.00)}}
</view> </view>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
.scene-title { .scene-title {
font-size: 24rpx; font-size: 24rpx;
height: 44rpx; /* height: 44rpx; */
line-height: 44rpx; line-height: 44rpx;
margin: 10rpx 0 4rpx; margin: 10rpx 0 4rpx;
font-weight: 600; font-weight: 600;
......
...@@ -10,23 +10,38 @@ Page({ ...@@ -10,23 +10,38 @@ Page({
merchantInfo: {}, merchantInfo: {},
sceneCodeList: [], sceneCodeList: [],
// 场景业务 // 场景业务
formData: { sceneInfo: {
scene1: true, sceneList: [{
scene2: true, sceneCode: 'SC001',
scene3: true, flag: true
scene4: true }, {
sceneCode: 'SC002',
flag: true
}, {
sceneCode: 'SC003',
flag: true
}, {
sceneCode: 'SC004',
flag: true
}]
}, },
sceneActive: 1, sceneActive: 1,
sceneCodeActive: 'SC001',
// 活动内容 // 活动内容
activityList: [], activityList: [],
sceneActivityObj: { sceneActivityObj: {
scene0: [],
scene1: [], scene1: [],
scene2: [], scene2: [],
scene3: [], scene3: []
scene4: []
} }
}, },
// 查找当前高亮场景的idx
findSceneIdx(sceneCode = this.data.sceneCodeActive) {
return this.data.sceneCodeList.findIndex(item => item == sceneCode)
},
getSceneProStatus(sceneCode) { getSceneProStatus(sceneCode) {
var params = { var params = {
serviceMerchantId: this.data.merchantInfo.pMerchantId, serviceMerchantId: this.data.merchantInfo.pMerchantId,
...@@ -36,7 +51,7 @@ Page({ ...@@ -36,7 +51,7 @@ Page({
outputApi.getSceneProStatus(params).then(res => { outputApi.getSceneProStatus(params).then(res => {
var proList = res.find(item => item.sceneCode == sceneCode) var proList = res.find(item => item.sceneCode == sceneCode)
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: proList.productList ['sceneActivityObj.scene' + this.findSceneIdx()]: proList.productList
}) })
this.setCurActivity() this.setCurActivity()
}) })
...@@ -44,12 +59,13 @@ Page({ ...@@ -44,12 +59,13 @@ Page({
// 场景切换 // 场景切换
handleSceneChange(e) { handleSceneChange(e) {
var idx = e.detail.sceneIdx // var idx = e.detail.sceneIdx
var sceneCode = e.detail.sceneCode
this.setData({ this.setData({
sceneActive: idx sceneCodeActive: sceneCode,
}) })
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) { if (!this.data.sceneActivityObj['scene' + this.findSceneIdx()].length) {
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()])
return true return true
} }
this.setCurActivity() this.setCurActivity()
...@@ -58,7 +74,7 @@ Page({ ...@@ -58,7 +74,7 @@ Page({
setCurActivity() { setCurActivity() {
this.setData({ this.setData({
activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + this.data.sceneActive])) activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + this.findSceneIdx()]))
}) })
}, },
...@@ -92,7 +108,7 @@ Page({ ...@@ -92,7 +108,7 @@ Page({
serviceMerchantName: this.data.merchantInfo.pMerchantName, serviceMerchantName: this.data.merchantInfo.pMerchantName,
merchantId: this.data.merchantInfo.merchantId, merchantId: this.data.merchantInfo.merchantId,
merchantName: this.data.merchantInfo.merchantName, merchantName: this.data.merchantInfo.merchantName,
sceneCode: this.data.sceneCodeList[this.data.sceneActive - 1], sceneCode: this.data.sceneCodeList[this.findSceneIdx()],
productCodes: this.data.activityList.filter(item => item.checked == true).map(item => item.productCode), productCodes: this.data.activityList.filter(item => item.checked == true).map(item => item.productCode),
clueId: this.data.clueId clueId: this.data.clueId
} }
...@@ -120,11 +136,12 @@ Page({ ...@@ -120,11 +136,12 @@ Page({
wx.$router.getData(obj => { wx.$router.getData(obj => {
this.setData({ this.setData({
merchantInfo: obj.merchantInfo, merchantInfo: obj.merchantInfo,
sceneActive: obj.sceneActive, // sceneActive: obj.sceneActive,
sceneCodeList: obj.sceneCodeList || ['SC001', 'SC002', 'SC003', 'SC004'], sceneCodeList: obj.sceneCodeList || ['SC002', 'SC003', 'SC004', 'SC001'],
sceneCodeActive: obj.sceneCodeActive,
clueId: obj.clueId clueId: obj.clueId
}) })
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()])
}) })
}, },
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
<!-- 场景活动 --> <!-- 场景活动 -->
<view class="box"> <view class="box">
<view class="box-title">业务场景</view> <view class="box-title">业务场景</view>
<scene-box formData="{{formData}}" scenePriceList="{{scenePriceList}}" sceneActive="{{sceneActive}}" hasOpenIcon="{{false}}" bindhandleSceneChange="handleSceneChange"></scene-box> <scene-box sceneInfo="{{sceneInfo}}" scenePriceList="{{scenePriceList}}" sceneCodeActive="{{sceneCodeActive}}" hasOpenIcon="{{false}}" bindhandleSceneChange="handleSceneChange"></scene-box>
</view> </view>
<!-- 活动 --> <!-- 活动 -->
<view class="box"> <view class="box">
<view class="box-title">产品/活动<text class="title-tip">(可多选)</text></view> <view class="box-title">产品/活动<text class="title-tip">(可多选)</text></view>
<view class="activity-box" wx:if="{{sceneActive != 1}}"> <view class="activity-box" wx:if="{{sceneCodeActive != 'SC001'}}">
<view wx:for="{{activityList}}" wx:key="index" class="activity-item"> <view wx:for="{{activityList}}" wx:key="index" class="activity-item">
<!-- productStatus:0未申请;1申请中;2已开通;3:已结束 --> <!-- productStatus:0未申请;1申请中;2已开通;3:已结束 -->
<view wx:if="{{item.openFlag != 0 && item.productStatus == 2}}"> <view wx:if="{{item.openFlag != 0 && item.productStatus == 2}}">
<glsx-image wx:if="{{sceneActive == 4}}" src="output/mark-active.webp" class="icon-mark"></glsx-image> <glsx-image wx:if="{{sceneCodeActive == 'SC004'}}" src="output/mark-active.webp" class="icon-mark"></glsx-image>
<glsx-image wx:if="{{sceneActive == 2 || sceneActive == 3}}" src="output/mark-open.webp" class="icon-mark"></glsx-image> <glsx-image wx:if="{{sceneCodeActive == 'SC002' || sceneCodeActive == 'SC003'}}" src="output/mark-open.webp" class="icon-mark"></glsx-image>
</view> </view>
<view wx:if="{{item.openFlag == 0}}" class="text-hide {{ item.checked ? 'active' : '' }}" bindtap="handleActClick" data-idx="{{index}}">{{item.productName}}</view> <view wx:if="{{item.openFlag == 0}}" class="text-hide {{ item.checked ? 'active' : '' }}" bindtap="handleActClick" data-idx="{{index}}">{{item.productName}}</view>
<view class="text-hide item-disabled" wx:else>{{item.productName}}</view> <view class="text-hide item-disabled" wx:else>{{item.productName}}</view>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</view> </view>
</view> </view>
<view class="isFullSucreen btn"> <view class="isFullSucreen btn">
<view wx:if="{{sceneActive != 1}}" class="btn-blue" bindtap="handleConfirm">申请开通</view> <view wx:if="{{sceneCodeActive != 'SC001'}}" class="btn-blue" bindtap="handleConfirm">申请开通</view>
<view wx:else class="btn-disabled">申请开通</view> <view wx:else class="btn-disabled">申请开通</view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -2,21 +2,25 @@ ...@@ -2,21 +2,25 @@
import outputApi from '~/api/outputApi/index' import outputApi from '~/api/outputApi/index'
import { IMG_URL } from '~/utils/constantData' import { IMG_URL } from '~/utils/constantData'
import { getNowMonth } from '~/utils/format' import { getNowMonth } from '~/utils/format'
const defaultSceneCode = 'SC004'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMGURL: IMG_URL, IMGURL: IMG_URL,
sceneCodeList: ['SC001', 'SC002', 'SC003', 'SC004'], sceneCodeList: ['SC002', 'SC003', 'SC004', 'SC001'],
merchantInfo: {}, merchantInfo: {},
sceneObj: { sceneInfo: {},
scene1: null, sceneData: {},
scene2: null, // sceneObj: {
scene3: null, // scene1: null,
scene4: null // scene2: null,
}, // scene3: null,
sceneActive: 4, // scene4: null
// },
sceneCodeActive: defaultSceneCode,
// sceneActive: 3,
scenePriceList: [ scenePriceList: [
{ {
total: 0.0 total: 0.0
...@@ -36,16 +40,16 @@ Page({ ...@@ -36,16 +40,16 @@ Page({
activityActive: 0, activityActive: 0,
activityList: [], activityList: [],
sceneActivityObj: { sceneActivityObj: {
scene0: [],
scene1: [], scene1: [],
scene2: [], scene2: [],
scene3: [], scene3: []
scene4: []
}, },
// 产值 // 产值
searchForm: { searchForm: {
scene2Idx: 0, sceneSC002: 0,
scene3Idx: 0, sceneSC003: 0,
scene4Idx: 0 sceneSC004: 0
}, },
baseData: { baseData: {
timeList: ['全部', '本月', '本日'], timeList: ['全部', '本月', '本日'],
...@@ -55,16 +59,16 @@ Page({ ...@@ -55,16 +59,16 @@ Page({
// 场景切换 // 场景切换
handleSceneChange(e) { handleSceneChange(e) {
var idx = e.detail.sceneIdx var sceneCode = e.detail.sceneCode
this.setData({ this.setData({
sceneActive: idx, sceneCodeActive: sceneCode,
activityActive: 0 activityActive: 0
}) })
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) { if (!this.data.sceneActivityObj['scene' + this.findSceneIdx()].length) {
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()])
return true return true
} }
if ([2, 3].includes(this.data.sceneActive)) { if (['SC002', 'SC003'].includes(this.data.sceneCodeActive)) {
this.getCustomerDetail(false, false) this.getCustomerDetail(false, false)
} else { } else {
this.setCurActivity() this.setCurActivity()
...@@ -79,16 +83,17 @@ Page({ ...@@ -79,16 +83,17 @@ Page({
// productStatus:0未申请;1申请中;2已开通;3:已结束 // productStatus:0未申请;1申请中;2已开通;3:已结束
isShowData: [2, 3].includes(+this.data.activityList[idx].productStatus) isShowData: [2, 3].includes(+this.data.activityList[idx].productStatus)
}) })
if ([2, 3].includes(this.data.sceneActive)) { if (['SC002', 'SC003'].includes(this.data.sceneCodeActive)) {
this.getCustomerDetail(false, false) this.getCustomerDetail(false, false)
} }
}, },
setCurActivity() { setCurActivity() {
console.log('setCurActivity---')
this.setData({ this.setData({
activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + this.data.sceneActive])), activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + this.findSceneIdx()])),
// productStatus:0未申请;1申请中;2已开通;3:已结束 // productStatus:0未申请;1申请中;2已开通;3:已结束
isShowData: [2, 3].includes(+this.data.sceneActivityObj['scene' + this.data.sceneActive][this.data.activityActive].productStatus) isShowData: [2, 3].includes(+this.data.sceneActivityObj['scene' + this.findSceneIdx()][this.data.activityActive].productStatus)
}) })
// activityActive为0时,触发置顶(左) // activityActive为0时,触发置顶(左)
if (this.data.activityActive == 0) { if (this.data.activityActive == 0) {
...@@ -101,12 +106,12 @@ Page({ ...@@ -101,12 +106,12 @@ Page({
// 搜索条件切换 // 搜索条件切换
handleSearch() { handleSearch() {
wx.showActionSheet({ wx.showActionSheet({
itemList: this.data.sceneActive != 4 ? this.data.baseData.timeList : this.data.baseData.actStatusList, itemList: this.data.sceneCodeActive != 'SC004' ? this.data.baseData.timeList : this.data.baseData.actStatusList,
success: res => { success: res => {
this.setData({ this.setData({
['searchForm.scene' + this.data.sceneActive + 'Idx']: res.tapIndex ['searchForm.scene' + this.data.sceneCodeActive]: res.tapIndex
}) })
this.data.sceneActive != 4 ? this.getCustomerDetail(false, false) : this.getActivityRevenue() this.data.sceneCodeActive != 'SC004' ? this.getCustomerDetail(false, false) : this.getActivityRevenue()
} }
}) })
}, },
...@@ -115,8 +120,8 @@ Page({ ...@@ -115,8 +120,8 @@ Page({
// console.log(this.data.activityList[this.data.activityActive]) // console.log(this.data.activityList[this.data.activityActive])
var params = { var params = {
merchantInfo: this.data.merchantInfo, merchantInfo: this.data.merchantInfo,
sceneActive: this.data.sceneActive sceneCodeActive: this.data.sceneCodeActive,
// sceneCodeList: this.data.sceneCodeList sceneCodeList: this.data.sceneCodeList
} }
wx.$router.go('packagesList.openBusiness', params) wx.$router.go('packagesList.openBusiness', params)
}, },
...@@ -137,16 +142,20 @@ Page({ ...@@ -137,16 +142,20 @@ Page({
// 定位已开通的场景,默认定位至场景4 // 定位已开通的场景,默认定位至场景4
findOpenScene() { findOpenScene() {
let sceneActive = 4 let sceneCodeActive = defaultSceneCode
const list = Object.values(this.data.sceneObj) const list = []
this.data.sceneCodeList.forEach(item => {
let sceneIsOpen = this.data.sceneData.find(k => k.sceneCode == item)?.sceneIsOpen
list.push(sceneIsOpen)
})
// 全场景都没开通或场景4开通,则默认定位至场景4 // 全场景都没开通或场景4开通,则默认定位至场景4
if (list[3] || !list.some(item => item == true)) { if (list[this.findSceneIdx(defaultSceneCode)] || !list.some(item => item == true)) {
return true return true
} }
// 开通1.1和1.2场景:默认定位至1.1场景,否则定位至已开通的场景 // 开通sc002和sc003场景:默认定位至sc002场景,否则定位至已开通的场景
sceneActive = list[1] ? 2 : 3 sceneCodeActive = list[this.findSceneIdx('SC002')] ? 'SC002' : 'SC003'
this.setData({ this.setData({
sceneActive: sceneActive sceneCodeActive: sceneCodeActive
}) })
}, },
...@@ -157,28 +166,41 @@ Page({ ...@@ -157,28 +166,41 @@ Page({
sceneCode: sceneCode sceneCode: sceneCode
} }
outputApi.getSceneProStatus(params).then(res => { outputApi.getSceneProStatus(params).then(res => {
console.log(res, 'res-------')
console.log(this.data.sceneInfo, 'sceneInfo---')
var data = this.dealOpenActivity(res) var data = this.dealOpenActivity(res)
var sceneObj = {} // var sceneObj = {}
var sceneActivityObj = {}
// sceneStatus:0未开通 1已开通 // sceneStatus:0未开通 1已开通
res.forEach((item, idx) => { res.forEach((item, index) => {
sceneObj['scene' + (idx + 1)] = item.sceneStatus == 1 let idx = this.findSceneIdx(item.sceneCode)
if (idx != -1) {
this.data.sceneInfo.sceneList[idx].flag = item.sceneStatus == 1
item.sceneIsOpen = item.sceneStatus == 1
sceneActivityObj['scene' + idx] = data[index].productList
}
}) })
this.setData({ this.setData({
sceneObj: sceneObj, sceneData: res,
['sceneActivityObj.scene1']: data[0].productList, sceneInfo: this.data.sceneInfo,
['sceneActivityObj.scene2']: data[1].productList, sceneActivityObj: sceneActivityObj
['sceneActivityObj.scene3']: data[2].productList, // ['sceneActivityObj.scene0']: data[0].productList,
['sceneActivityObj.scene4']: data[3].productList // ['sceneActivityObj.scene1']: data[1].productList,
}) // ['sceneActivityObj.scene2']: data[2].productList,
// ['sceneActivityObj.scene3']: data[3].productList
})
console.log(sceneActivityObj, 'sceneActivityObj----')
// 首次进入,默认定位至SC004场景;需要调获取SC002和SC003场景的接口,以计算这两个场景的总额
if (isFirst) { if (isFirst) {
this.findOpenScene() this.findOpenScene()
if (![2, 3].includes(+this.data.sceneActive)) { if (!['SC002', 'SC003'].includes(this.data.sceneCodeActive)) {
this.getCustomerDetail(isFirst) this.getCustomerDetail(isFirst)
} }
} }
if ([2, 3].includes(+this.data.sceneActive)) { console.log(this.data.sceneCodeActive == defaultSceneCode)
if (['SC002', 'SC003'].includes(this.data.sceneCodeActive)) {
this.getCustomerDetail() this.getCustomerDetail()
} else if (this.data.sceneActive == 4) { } else if (this.data.sceneCodeActive == defaultSceneCode) {
this.getActivityRevenue() this.getActivityRevenue()
} else { } else {
this.setCurActivity() this.setCurActivity()
...@@ -213,7 +235,7 @@ Page({ ...@@ -213,7 +235,7 @@ Page({
dealSearchTime() { dealSearchTime() {
var params = {} var params = {}
switch (this.data.searchForm['scene' + this.data.sceneActive + 'Idx']) { switch (this.data.searchForm['scene' + this.data.sceneCodeActive]) {
// 本月 // 本月
case 1: case 1:
params = this.data.dataObj.monthTime params = this.data.dataObj.monthTime
...@@ -226,17 +248,17 @@ Page({ ...@@ -226,17 +248,17 @@ Page({
return params return params
}, },
/** 1.1和1.2场景产品数据处理 /** sc002和sc003场景产品数据处理
* 调同一个接口,返回两个服务下面的全部产品的数据 * 调同一个接口,返回两个场景下面的全部产品的数据
*/ */
getCustomerDetail(isFirst = false, isChangeOtherTotal = true) { getCustomerDetail(isFirst = false, isChangeOtherTotal = true) {
var params = this.dealSearchTime() var params = this.dealSearchTime()
outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => { outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => {
var actList = this.data.sceneActivityObj['scene' + (isFirst ? 2 : this.data.sceneActive)] var actList = this.data.sceneActivityObj['scene' + (isFirst ? this.findSceneIdx('SC002') : this.findSceneIdx())]
var actCodeList = actList.map(item => item.productCode) var actCodeList = actList.map(item => item.productCode)
var curTotal = 0 var curTotal = 0
var otherTotal = 0 var otherTotal = 0
var otherScene = isFirst ? 2 : this.data.sceneActive == 2 ? 3 : 2 var otherSceneIdx = isFirst ? this.findSceneIdx('SC002') : this.data.sceneCodeActive == 'SC002' ? this.findSceneIdx('SC003') : this.findSceneIdx('SC002')
res.forEach(item => { res.forEach(item => {
var idx = actCodeList.findIndex(i => i == item.productCode) var idx = actCodeList.findIndex(i => i == item.productCode)
if (idx != -1) { if (idx != -1) {
...@@ -257,16 +279,16 @@ Page({ ...@@ -257,16 +279,16 @@ Page({
}) })
if (!isFirst) { if (!isFirst) {
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList ['sceneActivityObj.scene' + this.findSceneIdx()]: actList
}) })
} }
// 总金额 // 总金额
this.setData({ this.setData({
['scenePriceList[' + (isFirst ? 1 : this.data.sceneActive - 1) + '].total']: curTotal.toFixed(2) ['scenePriceList[' + (isFirst ? this.findSceneIdx('SC002') : this.findSceneIdx()) + '].total']: curTotal.toFixed(2)
}) })
if (isChangeOtherTotal) { if (isChangeOtherTotal) {
this.setData({ this.setData({
['scenePriceList[' + (isFirst ? 2 : otherScene - 1) + '].total']: otherTotal.toFixed(2) ['scenePriceList[' + (isFirst ? this.findSceneIdx('SC003') : otherSceneIdx) + '].total']: otherTotal.toFixed(2)
}) })
} }
!isFirst && this.setCurActivity() !isFirst && this.setCurActivity()
...@@ -275,7 +297,7 @@ Page({ ...@@ -275,7 +297,7 @@ Page({
dealSearchStatus() { dealSearchStatus() {
var params = {} var params = {}
switch (this.data.searchForm['scene' + this.data.sceneActive + 'Idx']) { switch (this.data.searchForm['scene' + this.data.sceneCodeActive]) {
case 0: case 0:
params.activityStatuList = [1, 2, 3] params.activityStatuList = [1, 2, 3]
break break
...@@ -303,7 +325,7 @@ Page({ ...@@ -303,7 +325,7 @@ Page({
.getActivityRevenue({ merchantId: this.data.merchantInfo.merchantId, ...params }) .getActivityRevenue({ merchantId: this.data.merchantInfo.merchantId, ...params })
.then(res => { .then(res => {
// console.log(this.data.sceneActivityObj, '++++++') // console.log(this.data.sceneActivityObj, '++++++')
var actList = this.data.sceneActivityObj['scene' + (isFirst ? 4 : this.data.sceneActive)] var actList = this.data.sceneActivityObj['scene' + (isFirst ? this.findSceneIdx('SC004') : this.findSceneIdx())]
var total = 0 var total = 0
res.forEach(item => { res.forEach(item => {
total = total + item.totalAmount total = total + item.totalAmount
...@@ -372,11 +394,11 @@ Page({ ...@@ -372,11 +394,11 @@ Page({
}) })
if (!isFirst) { if (!isFirst) {
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList ['sceneActivityObj.scene' + this.findSceneIdx()]: actList
}) })
this.setCurActivity() this.setCurActivity()
} }
if (this.data.sceneActive == 4 && activitingIdx != -1) { if (this.data.sceneCodeActive == 'SC004' && activitingIdx != -1) {
var params = { var params = {
currentTarget: { currentTarget: {
dataset: { dataset: {
...@@ -387,7 +409,7 @@ Page({ ...@@ -387,7 +409,7 @@ Page({
this.handleActChange(params) this.handleActChange(params)
} }
this.setData({ this.setData({
['scenePriceList[3].total']: total.toFixed(2) ['scenePriceList[' + this.findSceneIdx('SC004') + '].total']: total.toFixed(2)
}) })
}) })
.finally(() => { .finally(() => {
...@@ -433,20 +455,20 @@ Page({ ...@@ -433,20 +455,20 @@ Page({
activityId activityId
}) })
wx.$eventbus.emit('clientRefresh') wx.$eventbus.emit('clientRefresh')
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()])
}, },
// 母链分享 // 母链分享
posterTrack() { posterTrack() {
wx.$eventbus.emit('clientRefresh') wx.$eventbus.emit('clientRefresh')
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()])
}, },
// 战报 // 战报
handleZhanReport(e) { handleZhanReport(e) {
const { idx, posterItem } = e.detail const { idx, posterItem } = e.detail
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive + '[' + this.data.activityActive + '].outputData.activityList[' + idx + '].reportDate']: posterItem.date ['sceneActivityObj.scene' + this.findSceneIdx() + '[' + this.data.activityActive + '].outputData.activityList[' + idx + '].reportDate']: posterItem.date
}) })
this.setCurActivity() this.setCurActivity()
}, },
...@@ -457,20 +479,28 @@ Page({ ...@@ -457,20 +479,28 @@ Page({
onLoad(options) { onLoad(options) {
this.initTime() this.initTime()
wx.$router.getData(obj => { wx.$router.getData(obj => {
// var scene = {} var list = []
// Object.keys(this.data.sceneObj).forEach(item => { this.data.sceneCodeList.forEach(item => {
// scene[item] = obj[item] let temp = obj.sceneList.find(k => k.sceneCode == item) || {}
// }) list.push(temp)
})
this.setData({ this.setData({
merchantInfo: obj, merchantInfo: obj,
// sceneObj: scene, sceneInfo: {
sceneCodeList: obj.sceneCodeList sceneList: list
}
// sceneCodeList: obj.sceneCodeList
}) })
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1], true) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()], true)
}) })
}, },
// 查找当前高亮场景的idx
findSceneIdx(sceneCode = this.data.sceneCodeActive) {
return this.data.sceneCodeList.findIndex(item => item == sceneCode)
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -487,12 +517,12 @@ Page({ ...@@ -487,12 +517,12 @@ Page({
this.initTime() this.initTime()
this.setData({ this.setData({
activityActive: 0, activityActive: 0,
sceneActive: 4 sceneCodeActive: defaultSceneCode,
}) })
wx.$api.showToast({ wx.$api.showToast({
title: '刷新成功', title: '刷新成功',
icon: 'success' icon: 'success'
}) })
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1], true) this.getSceneProStatus(this.data.sceneCodeList[this.findSceneIdx()], true)
} }
}) })
<!-- packageOutput/pages/summary/summary.wxml --> <!-- packageOutput/pages/summary/summary.wxml -->
<view class="summary"> <view class="summary">
<view class="layout {{ (sceneActive != 1 && isShowData) ? 'bg-grey' : 'bg-white'}}"> <view class="layout {{ (sceneCodeActive != 'SC001' && isShowData) ? 'bg-grey' : 'bg-white'}}">
<view class="{{ (sceneActive != 1 && isShowData) ? 'bg-white' : 'p-rl-20'}}"> <view class="{{ (sceneCodeActive != 'SC001' && isShowData) ? 'bg-white' : 'p-rl-20'}}">
<view class="{{ (sceneActive != 1 && isShowData) ? 'm-rl-20' : ''}}"> <view class="{{ (sceneCodeActive != 'SC001' && isShowData) ? 'm-rl-20' : ''}}">
<view class="title bg-white"> <view class="title bg-white">
选产品/活动 选产品/活动
<view class="title-open" bindtap="handleJump"> <view class="title-open" bindtap="handleJump">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</view> </view>
</view> </view>
<view class="scene-box bg-white"> <view class="scene-box bg-white">
<scene-box formData="{{sceneObj}}" scenePriceList="{{scenePriceList}}" sceneActive="{{sceneActive}}" bindhandleSceneChange="handleSceneChange" /> <scene-box sceneInfo="{{sceneInfo}}" scenePriceList="{{scenePriceList}}" sceneCodeActive="{{sceneCodeActive}}" bindhandleSceneChange="handleSceneChange" />
</view> </view>
</view> </view>
</view> </view>
...@@ -26,41 +26,41 @@ ...@@ -26,41 +26,41 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 活动内容 --> <!-- 活动内容 -->
<view class="activity-content {{ (sceneActive != 1 && isShowData) ? '' : 'p-rl-20'}}"> <view class="activity-content {{ (sceneCodeActive != 'SC001' && isShowData) ? '' : 'p-rl-20'}}">
<view wx:if="{{isShowData && sceneActive != 1}}"> <view wx:if="{{isShowData && sceneCodeActive != 'SC001'}}">
<view class="activity-title title bg-white p-l-20 no-border"> <view class="activity-title title bg-white p-l-20 no-border">
<view>看产值</view> <view>看产值</view>
<view class="select" bindtap="handleSearch"> <view class="select" bindtap="handleSearch">
<view wx:if="{{sceneActive == 2 || sceneActive == 3}}" class="select-txt"> <view wx:if="{{sceneCodeActive == 'SC002' || sceneCodeActive == 'SC003'}}" class="select-txt">
{{baseData.timeList[sceneActive == 2 ? searchForm.scene2Idx : searchForm.scene3Idx]}} {{baseData.timeList[sceneCodeActive == 'SC002' ? searchForm.sceneSC002 : searchForm.sceneSC003]}}
</view> </view>
<view wx:if="{{sceneActive == 4}}" class="select-txt"> <view wx:if="{{sceneCodeActive == 'SC004'}}" class="select-txt">
{{baseData.actStatusList[searchForm.scene4Idx]}} {{baseData.actStatusList[searchForm.sceneSC004]}}
</view> </view>
<image class="icon-arrow" src="{{IMGURL}}output/arrow.png?v={{img_version}}" /> <image class="icon-arrow" src="{{IMGURL}}output/arrow.png?v={{img_version}}" />
</view> </view>
</view> </view>
<output-transform wx:if="{{sceneActive == 2 || sceneActive == 3}}" formData="{{activityList[activityActive].orderTotal}}" /> <output-transform wx:if="{{sceneCodeActive == 'SC002' || sceneCodeActive == 'SC003'}}" formData="{{activityList[activityActive].orderTotal}}" />
<output-crowdfund wx:if="{{sceneActive == 4}}" orderObj="{{activityList[activityActive].outputData}}" bind:handleZhanReport="handleZhanReport" bind:posterTrack="posterTrack"/> <output-crowdfund wx:if="{{sceneCodeActive == 'SC004'}}" orderObj="{{activityList[activityActive].outputData}}" bind:handleZhanReport="handleZhanReport" bind:posterTrack="posterTrack"/>
</view> </view>
<view wx:else class="content-empty bg-white"> <view wx:else class="content-empty bg-white">
<image class="img-empty" src="{{IMGURL}}output/sum-empty.png?v={{img_version}}" /> <image class="img-empty" src="{{IMGURL}}output/sum-empty.png?v={{img_version}}" />
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{sceneActive != 1 && activityList.length}}"> <view wx:if="{{sceneCodeActive != 'SC001' && activityList.length}}">
<view class="isFullSucreen btn-box" wx:if="{{ !isShowData && !merchantInfo.isSuper}}"> <view class="isFullSucreen btn-box" wx:if="{{ !isShowData && !merchantInfo.isSuper}}">
<view class="btn"> <view class="btn">
<view class="btn-blue" bindtap="handleJump">点击开通</view> <view class="btn-blue" bindtap="handleJump">点击开通</view>
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{sceneActive == 1}}" class="isFullSucreen btn-box"> <view wx:if="{{sceneCodeActive == 'SC001'}}" class="isFullSucreen btn-box">
<view class="btn"> <view class="btn">
<view class="btn-disabled">点击开通</view> <view class="btn-disabled">点击开通</view>
</view> </view>
</view> </view>
<view wx:if="{{sceneActive == 4 && activityList.length && isShowData && activityList[activityActive].outputData.shareBtnIdx && activityList[activityActive].outputData.shareBtnIdx != -1}}" class="isFullSucreen btn-box shadow" bindtap="handleBtnShare"> <view wx:if="{{sceneCodeActive == 'SC004' && activityList.length && isShowData && activityList[activityActive].outputData.shareBtnIdx && activityList[activityActive].outputData.shareBtnIdx != -1}}" class="isFullSucreen btn-box shadow" bindtap="handleBtnShare">
<view class="btn"> <view class="btn">
<view class="btn-share">活动进行中,分享母链海报开展活动</view> <view class="btn-share">活动进行中,分享母链海报开展活动</view>
</view> </view>
......
...@@ -149,11 +149,12 @@ Component({ ...@@ -149,11 +149,12 @@ Component({
var params = { var params = {
merchantId: currentItem.merchantId, merchantId: currentItem.merchantId,
merchantName: currentItem.merchantName, merchantName: currentItem.merchantName,
scene1: currentItem.scene1, // scene1: currentItem.scene1,
scene2: currentItem.scene2, // scene2: currentItem.scene2,
scene3: currentItem.scene3, // scene3: currentItem.scene3,
scene4: currentItem.scene4, // scene4: currentItem.scene4,
sceneCodeList: currentItem.sceneList.map(item => item.sceneCode), sceneList: currentItem.sceneList,
// sceneCodeList: currentItem.sceneList.map(item => item.sceneCode),
pMerchantId: this.data.pMerchantId, pMerchantId: this.data.pMerchantId,
pMerchantName: this.data.pMerchantInfo.subLoginUser.merchantName, pMerchantName: this.data.pMerchantInfo.subLoginUser.merchantName,
isSuper: this.data.pMerchantInfo.isSuper isSuper: this.data.pMerchantInfo.isSuper
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</view> </view>
<!-- 场景内容 --> <!-- 场景内容 -->
<view class="box-content"> <view class="box-content">
<scene-box formData="{{item}}" hasLockIcon="{{false}}" /> <scene-box sceneInfo="{{item}}" hasLockIcon="{{false}}" />
<!-- 通知 --> <!-- 通知 -->
<view class="box-bottom"> <view class="box-bottom">
<view wx:if="{{item.msgList.length}}" class="flex"> <view wx:if="{{item.msgList.length}}" class="flex">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!