Commit 39b95ac8 by 张立顺

功能开发完成

1 parent da9808ee
......@@ -9,18 +9,6 @@ Component({
type: Object,
value: {}
}
// keys: {
// type: Array,
// value: ['year', 'sales']
// },
// tickCount: {
// type: Number,
// value: 4
// },
// color: {
// type: String,
// value: '#3975C6'
// }
},
observers: {
'chartData.data': function (data) {
......@@ -35,16 +23,28 @@ Component({
ec: {
// lazyLoad: false
lazyLoad: true
}
},
allList: false
},
attached() {
let { chartData } = this.data
console.log(chartData, 'chartDataattached')
chartData && chartData.data && this.onInitChart()
},
/**
* 组件的方法列表
*/
methods: {
showAll() {
this.setData({
allList: !this.data.allList
})
},
onInitChart() {
this.ecComponent &&
this.ecComponent.init((canvas, width, height, dpr) => {
// console.log(this.ecComponent, this.selectComponent('#mychart-dom-bar'), 'this.ecComponent')
let ecComponent = this.ecComponent || this.selectComponent('#mychart-dom-bar')
ecComponent &&
ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
......
......@@ -223,4 +223,8 @@
width: 100%;
height: 100%;
}
.rotate {
transform: rotate(180deg);
}
}
\ No newline at end of file
......@@ -10,9 +10,9 @@
<view class="invalidFlowContainer">
<view class="header">
<view class="title">无效流量</view>
<view class="label">共{{chartData.customerList.lenght}}条客户信息经由跟进人处理为战败客户</view>
<view class="label">共{{chartData.customerListAll.length}}条客户信息经由跟进人处理为战败客户</view>
</view>
<view class="customer" wx:for="{{ chartData.customerList }}" wx:key="index">
<view class="customer" wx:for="{{ allList? chartData.customerListAll:chartData.customerList }}" wx:key="index">
<view class="header">
<view class="name">{{item.customer.customerName}}</view>
<view class="date">{{item.orderTime}}</view>
......@@ -28,8 +28,8 @@
<view class="result">{{item.customer.refusalReason}}</view>
</view>
</view>
<view class="arrow">
<image class="img" src="../../images/arrowIcon.png"></image>
<view class="arrow" bind:tap="showAll" wx:if="{{chartData.customerListAll.length>2}}">
<image class="img {{ allList?'rotate':'' }}" src="../../images/arrowIcon.png"></image>
</view>
</view>
</view>
\ No newline at end of file
......@@ -10,8 +10,8 @@ Component({
value: 0
},
chartData: {
type: Array,
value: []
type: Object,
value: {}
}
// keys: {
// type: Array,
......@@ -29,7 +29,7 @@ Component({
observers: {
chartData: function (data) {
console.log(data, '----------------')
data && data.length && this.initData(data)
data.diagramList && data.diagramList.length && this.initData()
}
},
/**
......@@ -47,8 +47,9 @@ Component({
*/
methods: {
onInitChart() {
this.ecComponent &&
this.ecComponent.init((canvas, width, height, dpr) => {
let ecComponent = this.ecComponent || this.selectComponent('#mychart-dom-bar')
ecComponent &&
ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
......@@ -60,14 +61,14 @@ Component({
},
setOption(chart) {
let { chartData: diagramList, tabIndex } = this.data
let { chartData, tabIndex } = this.data
const abscissaDataList = [],
orderMoneyTotalList = [],
upgradeAveragePriceList = [],
upgradeRateList = []
diagramList.forEach(element => {
chartData.diagramList.forEach(element => {
abscissaDataList.push(element.abscissaData)
// console.log(element.orderMoneyTotal, 'orderMoneyTotal')
orderMoneyTotalList.push(tabIndex == 0 ? element.orderMoneyTotal : element.outputValue)
......@@ -103,7 +104,7 @@ Component({
}
],
legend: {
data: ['营业额', '客单价', '转化率'],
data: ['营业额', tabIndex ? '权益客单价' : '客单价', '转化率'],
top: 'bottom'
},
xAxis: [
......@@ -128,7 +129,7 @@ Component({
},
{
type: 'value',
name: '客单价',
name: tabIndex ? '权益客单价' : '客单价',
position: 'right',
offset: 1000,
axisLabel: {
......@@ -153,7 +154,7 @@ Component({
data: orderMoneyTotalList
},
{
name: '客单价',
name: tabIndex ? '权益客单价' : '客单价',
type: 'bar',
yAxisIndex: 0,
data: upgradeAveragePriceList
......
<view class="container">
<view class="title">
趋势分析
<view class="title-tip" v-show="firstOrderDate">业务开展时间:{{ firstOrderDate }}</view>
</view>
<!-- <view class="" id="bar"></view> -->
<view class="ec-canvas">
<ec-canvas class=" echart-box" id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}" force-use-old-canvas="true"></ec-canvas>
</view>
</view>
<view class="container">
<view class="title">
趋势分析
<view class="title-tip" v-show="firstOrderDate">业务开展时间:{{ chartData.firstOrderDate }}</view>
</view>
<!-- <view class="" id="bar"></view> -->
<view class="ec-canvas">
<ec-canvas class="echart-box" id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}" force-use-old-canvas="true"></ec-canvas>
</view>
</view>
\ No newline at end of file
......@@ -5,9 +5,9 @@
<view class="revenue">
<view class="title">
营收概要
<view wx:if="{{ phone && outputObj }}" class="title-tip">当月产值目标:{{
<!-- <view wx:if="{{ phone && outputObj }}" class="title-tip">当月产值目标:{{
outputObj.targetOutputValue || 0 }}元
完成进度{{ outputObj.currentProgress || 0 }}%</view>
完成进度{{ outputObj.currentProgress || 0 }}%</view> -->
</view>
<view class="content">
<view wx:for="{{ tabIndex? revenueFormData.equityList: revenueFormData.membraneList }}" wx:key="index" class="flex row">
......@@ -41,10 +41,16 @@
</view>
</view>
<echart chartData="{{ chartData }}" tickCount="{{ opts.tickCount }}" keys="{{ opts.keys }}" tabIndex="{{ tabIndex }}"></echart>
<echart-pie chartData="{{ chartDataPie }}" customerList="{{ customerList }}" tickCount="{{ opts.tickCount }}" keys="{{ opts.keys }}"></echart-pie>
<!-- v-if="diagnosticResults && sceneId != 1" -->
<view class="resultContainer">
<echart-pie
wx:if="{{ !tabIndex }}"
chartData="{{ chartDataPie }}"
customerList="{{ customerList }}"
tickCount="{{ opts.tickCount }}"
keys="{{ opts.keys }}"
></echart-pie>
<!-- wx:if="{{ chartData.diagnosticResults && !tabIndx }}" -->
<view class="resultContainer" wx:if="{{ chartData.diagnosticResults & !tabIndex }}">
<view class="title">诊断结果</view>
<view class="content">诊断结果诊断结果诊断结果{{ diagnosticResults }}</view>
<view class="content">{{ chartData.diagnosticResults }}</view>
</view>
</view>
\ No newline at end of file
......@@ -63,15 +63,29 @@ var revenueToClass = function (item,revenueData,name) {
return val > 0 ? 'up' : 'down'
}
}
// var optionalChaining = function (obj,) {
// var rest = Array.prototype.slice.call(arguments, 1);
// var tmp = obj
// for (var key in rest) {
// var name = rest[key];
// tmp = tmp !== null && tmp !== undefined ? tmp[name] : undefined;
// }
// return tmp !== null && tmp !== undefined ? tmp : "";
// }
var dateFormatSlash = function (date) {
// 验证日期格式
if (!date) return;
console.log(date);
// var regex = /^\d{4}-\d{2}-\d{2}$/; 不支持正则表达式
// if (typeof date !== 'string' || !regex.test(date)) {
// console.log('Invalid date format. Expected format: "YYYY-MM-DD"');
// return
// }
// 解构赋值提取年、月和日
var parts = date.split('-');
var year = parts[0];
var month = parts[1];
var day = parts[2] || '';
// 构建日期字符串
if (day) {
return year + '/' + month + '/' + day; // 带有日的格式:YY/MM/DD
} else {
return year + '/' + month; // 只有年月的格式:YY/MM
}
}
/*
* 导出
......@@ -80,6 +94,6 @@ module.exports = {
setPrice: setPrice,
filterItemName:filterItemName,
revenueToClass:revenueToClass,
// $$:optionalChaining,
dateFormatSlash:dateFormatSlash,
money_three_for_two_thousands: threeNumForTwo.money_three_for_two_thousands //暴露接口调用
}
......@@ -24,30 +24,115 @@ Page({
width: '30%'
}
],
chartDataPie:{
data:[]
lineChart: {},
chartDataPie: {
data: []
},
tabIndx: 1,
tabIndx: 0,
// 众筹
scrollLeft: 0,
activityActive: 0,
isShowData: false,
allType: false,
whiteArrow: false,
scenceList: []
},
handleMonthNow() {
// this.dateObj.nowMonth = true
this.initTime()
this.getAnalysisTendency()
// this.selectConfirm(this.merchantInfo)
},
getLastDay(year, month) {
var new_year = year //取当前的年份
var new_month = month++ //取下一个月的第一天,方便计算(最后一天不固定)
if (month > 12) {
new_month -= 12 //月份减
new_year++ //年份增
}
var new_date = new Date(new_year, new_month, 1) //取当年当月中的第一天
return new Date(new_date.getTime() - 1000 * 60 * 60 * 24).getDate() //获取当月最后一天日期
},
// 获取选中天数
rangeSelect(e) {
console.log(e)
// let { date } = e.detail
let { date, type } = e.detail
let { dateObj } = this.data
// 按月份
dateObj = Object.assign(dateObj, date)
// return
if (type) {
let [year, month] = date.end.split('-')
let day = this.getLastDay(year, month)
dateObj.beginDateStr = date.start + '-01'
dateObj.endDateStr = date.end + '-' + day
dateObj.pointUnit = 2
dateObj.type = 'month'
// }
} else {
// 按日期
dateObj.beginDateStr = date.start
dateObj.endDateStr = date.end
dateObj.pointUnit = 1
dateObj.type = 'day'
}
dateObj.nowMonth = false
this.dateObj = dateObj
this.setData({
dateObj
// currentPage: 1
})
this.getAnalysisTendency()
},
// 切换日历
tapCalendar() {
this.setData({
whiteArrow: !this.data.whiteArrow
})
},
initTime() {
// 获取当前日期
const currentDate = new Date()
let today = currentDate.format('yyyy-MM-dd')
let NewYearDay = currentDate.format('yyyy')
let firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).format('yyyy-MM-dd')
// console.log(NewYearDay)
this.setData({
dateObj: {
beginDateStr: firstDayOfMonth,
endDateStr: today,
today: today,
pointUnit: 1, // 1日,2月,默认日
type: 'today',
label: NewYearDay,
nowMonth: true
}
})
},
initData() {
let { tabIndx } = this.data
tabIndx == 1 ? this.crowdfunding() : this.getAnalysisTendency(tabIndx)
console.log(tabIndx, 'tabIndx');
},
getAnalysisTendency(tabIndx) {
console.log(tabIndx, 'tabIndx')
},
changeStatus() {
this.setData({
allType: !this.data.allType
})
this.getAnalysisTendency()
},
getAnalysisTendency() {
// console.log(tabIndx, 'tabIndx')
let { allType, tabIndx, dateObj, merchantInfo } = this.data
let params = {
shopMerchantIdList: [44211227],
shopMerchantIdList: [merchantInfo.merchantId || 44211227],
isSuper: false,
phone: '',
dataDimension: tabIndx,
startDate: '2023-08-01',
endDate: '2023-08-22'
allType,
dataDimension: tabIndx == 0 ? 0 : 1,
startDate: dateObj.beginDateStr,
endDate: dateObj.endDateStr
}
// debugger
// 默认是精品升级 取后面接口
......@@ -73,9 +158,11 @@ Page({
apiNameTendency(params).then(res => {
console.log(res, 'analysisTendency')
this.setData({
firstOrderDate: res?.firstOrderDate,
diagnosticResults: res.diagnosticResults || '',
diagramList: res.diagramList || []
lineChart: {
firstOrderDate: res?.firstOrderDate,
diagnosticResults: res.diagnosticResults || '',
diagramList: res.diagramList || []
}
})
})
// 精品升级请求流量接口数据
......@@ -104,7 +191,8 @@ Page({
})
this.setData({
// analysisNotUpgradePage: res,
['chartDataPie.customerList']: res.list
['chartDataPie.customerList']: res.list.slice(0, 2),
['chartDataPie.customerListAll']: res.list
})
})
},
......@@ -113,6 +201,7 @@ Page({
this.setData({
tabIndx: detail
})
this.initData()
},
// 众筹-start
crowdfunding() {
......@@ -123,7 +212,7 @@ Page({
},
async getMockInfo(userInfo) {
let res = await getMockData() || { serviceMerchatList: [] }
let res = (await getMockData()) || { serviceMerchatList: [] }
this.setData({
mockObj: res,
isShowService: res.serviceMerchatList.includes(userInfo.merchantId + '')
......@@ -203,11 +292,12 @@ Page({
sceneCode: sceneCode || ''
}
outputApi.findProByScene(params).then(res => {
res && res[0]?.productList?.forEach(item => {
if (productCodes.includes(item.productCode)) {
item.openFlag = 1
}
})
res &&
res[0]?.productList?.forEach(item => {
if (productCodes.includes(item.productCode)) {
item.openFlag = 1
}
})
var res = this.dealOpenActivity(res)
this.setData({
scenceList: res
......@@ -367,8 +457,11 @@ Page({
// 众筹-end
onRoute() {
this.getAnalysisTendency(this.data.tabIndx)
console.log('onRoute')
this.initTime()
// this.getAnalysisTendency(this.data.tabIndx)
wx.$router.getData(obj => {
console.log(obj, 'obj')
this.setData({
merchantInfo: obj
})
......
......@@ -3,7 +3,8 @@
"usingComponents": {
"tab": "../../components/Tab/Tab",
"output-echart": "../../components/outputEchart/outputEchart",
"output-crowdfund": "../../components/outputCrowdfund/outputCrowdfund"
"output-crowdfund": "../../components/outputCrowdfund/outputCrowdfund",
"CalendarMonth": "/components/CalendarMonth/CalendarMonth"
},
"navigationStyle": "custom"
}
\ No newline at end of file
}
......@@ -75,7 +75,85 @@
.searchBar {
height: 88rpx;
// line-height: 88rpx;
background-color: #fff;
padding: 0 32rpx;
display: flex;
justify-content: space-between;
.calendarMonthCon {
margin-left: auto;
display: flex;
align-items: center;
}
.checkCon {
display: flex;
align-items: center;
.checkoutBox {
box-sizing: border-box;
width: 24rpx;
height: 24rpx;
border: 2rpx solid #5A6066;
border-radius: 4rpx;
}
.checkBox {
margin-right: 8rpx;
width: 24rpx;
height: 24rpx;
}
}
.monthNow {
width: 96rpx;
height: 52rpx;
background: #F7F7F7;
border-radius: 8rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 24rpx;
color: #333333;
line-height: 52rpx;
text-align: center;
margin-left: auto;
margin-right: 20rpx;
&.active {
color: #3582EE;
background: #ebf2fd;
}
}
.dateNum {
box-sizing: border-box;
display: flex;
align-items: center;
white-space: nowrap;
height: 52rpx;
padding: 8rpx 24rpx;
border-radius: 8rpx;
font-weight: 500;
font-size: 24rpx;
color: #3582ee;
background-color: rgb(234, 242, 253);
.arrow {
width: 40rpx;
height: 40rpx;
.arrowIcon {
width: 100%;
height: 100%;
}
}
}
.dateNum.custom {
color: #333333;
background: #F7F7F7;
}
}
.conCom {
......
<!--packagesList/packageOutput/pages/openNewBusiness/openNewBusiness.wxml-->
<!-- <text>packagesList/packageOutput/pages/openNewBusiness/openNewBusiness.wxml</text> -->
<wxs src="../../index.wxs" module="filter" />
<view class="layout">
<view class="titleBox">
<view class="imgBox" bind:tap="back">
......@@ -9,37 +10,91 @@
</view>
<tab tab="{{ tabList }}" itemWidth="{{ '30%' }}" index="{{ tabIndx }}" bindclick="changeTabIndx" class="tabContainer" />
<view class="searchBar">
<!-- 众筹 -->
<scroll-view wx:if="{{tabIndx == 1}}" scroll-x="{{true}}" enable-flex class="activity-box" scroll-with-animation scroll-left="{{scrollLeft}}">
<view class="flex">
<view class="activity-item {{ activityActive == index ? 'active' : ''}} {{item.openFlag == 1 ? 'open' : 'no-open'}}" wx:for="{{scenceList[0].productList}}" wx:key="index" bindtap="handleActChange" data-idx="{{index}}">
{{item.productName}}
</view>
</view>
</scroll-view>
</view>
<view class="checkCon" wx:if="{{ tabIndx == 0 }}">
<view class="checkoutBox checkBox" bind:tap="changeStatus" wx:if="{{ !allType }}"></view>
<image class="checkBox" bind:tap="changeStatus" wx:if="{{ allType }}" src="../../images/checkoutIcon.png"></image>
查看全部品类
</view>
<view class="calendarMonthCon">
<view class="monthNow {{ dateObj.nowMonth ? 'active' : '' }}" bind:tap="handleMonthNow">本月</view>
<CalendarMonth
allowSameDay
shortcut
bind:select="rangeSelect"
bind:tapCalendar="tapCalendar"
rangeAll
dateType="range"
calenderColor="#3582EE"
vertical
minDate="2020-10-01"
maxDate="{{ dateObj.today }}"
isComponents
isChangeType="{{ false }}"
forceFullSucreen="{{ bottomLift>0?true:false }}"
dayType="{{ 0 }}"
>
<view class="item dateNum {{ dateObj.nowMonth ? 'custom' : '' }}">
<view wx:if="{{ dateObj.type == 'today' }}">自定义</view>
<view wx:elif="{{ dateObj.nowMonth }}">{{ dateObj.today }}</view>
<view wx:else>{{filter.dateFormatSlash(dateObj.beginDateStr)}}-{{filter.dateFormatSlash(dateObj.endDateStr)}}</view>
<view class="arrow {{ whiteArrow ? 'move' : '' }}">
<image class="arrowIcon" src="../../images/blackArrowIcon.png" />
</view>
</view>
</CalendarMonth>
</view>
<!-- 众筹 -->
<scroll-view
wx:if="{{ tabIndx == 1 }}"
scroll-x="{{ true }}"
enable-flex
class="activity-box"
scroll-with-animation
scroll-left="{{ scrollLeft }}"
>
<view class="flex">
<view
class="activity-item {{ activityActive == index ? 'active' : ''}} {{item.openFlag == 1 ? 'open' : 'no-open' }}"
wx:for="{{ scenceList[0].productList }}"
wx:key="index"
bindtap="handleActChange"
data-idx="{{ index }}"
>{{item.productName}}</view>
</view>
</scroll-view>
</view>
<view class="conCom">
<view wx:if="{{tabIndx == 1}}" class="activity-content">
<output-crowdfund wx:if="{{isShowData}}" orderObj="{{activityList[activityActive].outputData}}" bind:handleZhanReport="handleZhanReport" bind:posterTrack="posterTrack" hasReport="{{!isMock.SC004}}" />
<view wx:else class="content-empty">
<image class="img-empty" src="{{IMGURL}}output/sun-empty-transparent.png?v={{img_version}}" />
</view>
<view wx:if="{{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-share">活动进行中,分享母链海报开展活动</view>
</view>
</view>
</view>
<view wx:if="{{ tabIndx == 1 }}" class="activity-content">
<output-crowdfund
wx:if="{{ isShowData }}"
orderObj="{{ activityList[activityActive].outputData }}"
bind:handleZhanReport="handleZhanReport"
bind:posterTrack="posterTrack"
hasReport="{{ !isMock.SC004 }}"
/>
<view wx:else class="content-empty">
<image class="img-empty" src="{{ IMGURL}}output/sun-empty-transparent.png?v={{img_version }}" />
</view>
<view
wx:if="{{ 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-share">活动进行中,分享母链海报开展活动</view>
</view>
</view>
</view>
<output-echart
wx:else
wx:else
class="container"
revenueData="{{ revenueData }}"
chartData="{{ diagramList }}"
chartData="{{ lineChart }}"
chartDataPie="{{ chartDataPie }}"
tabIndex="{{ tabIndx }}"
customerList="{{ customerList }}"
></output-echart>
</view>
<!-- <output-echart></output-echart>
<!-- <output-echart></output-echart>
<output-crowdfund></output-crowdfund> -->
</view>
\ 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!