|
@@ -109,7 +109,7 @@
|
|
|
<view class="todo-list"><self-ucharts :series="checkPoint"></self-ucharts></view>
|
|
|
</view>
|
|
|
<view class="piece">
|
|
|
- <view class="title">
|
|
|
+ <view class="title" v-if="shopSellData">
|
|
|
<view class="left"><text class="future">产品销售数量走势</text></view>
|
|
|
<view class="right">
|
|
|
<view class="today-icon"></view>
|
|
@@ -120,9 +120,46 @@
|
|
|
</view>
|
|
|
<view class="todo-list"><self-ucharts :datas="shopSellData" type="line"></self-ucharts></view>
|
|
|
</view>
|
|
|
+ <view class="piece">
|
|
|
+ <view class="title" v-if="shopMoney">
|
|
|
+ <view class="left"><text class="future">产品销售金额走势</text></view>
|
|
|
+ <view class="right">
|
|
|
+ <view class="today-icon"></view>
|
|
|
+ <text class="title">今日</text>
|
|
|
+ <view class="yesterday-icon"></view>
|
|
|
+ <text class="title">昨日</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="todo-list"><self-ucharts :datas="shopMoney" type="line"></self-ucharts></view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="sale_box" v-else>
|
|
|
+ <view class="box">
|
|
|
+ <view class="todo-list">
|
|
|
+ <view class="item">
|
|
|
+ <view class="title">今日新增用户</view>
|
|
|
+ <view class="num">{{ todayNewUser }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="something">
|
|
|
+ <view class="piece">
|
|
|
+ <view class="title">
|
|
|
+ <view class="left"><text class="future">新增用户走势</text></view>
|
|
|
+ </view>
|
|
|
+ <view class="todo-list"><self-ucharts :datas="brandNewUser" type="line"></self-ucharts></view>
|
|
|
+ </view>
|
|
|
+ <view v-if="ageProportion && ageProportion.length > 0" class="piece">
|
|
|
+ <view class="title">用户年龄占比</view>
|
|
|
+ <view class="todo-list"><self-ucharts :series="ageProportion"></self-ucharts></view>
|
|
|
+ </view>
|
|
|
+ <view v-if="genderProportion && genderProportion.length > 0" class="piece">
|
|
|
+ <view class="title">用户男女占比</view>
|
|
|
+ <view class="todo-list"><self-ucharts :series="genderProportion"></self-ucharts></view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="user_box" v-else></view>
|
|
|
|
|
|
<rf-loading v-if="loading"></rf-loading>
|
|
|
<tabBar :currentIndex="typeNum"></tabBar>
|
|
@@ -145,6 +182,7 @@ export default {
|
|
|
ticketsSalesAmount: null,
|
|
|
checkPoint: null,
|
|
|
shopSellData: null,
|
|
|
+ shopMoney: null,
|
|
|
typeNum: null,
|
|
|
shopID: 0,
|
|
|
index: 0,
|
|
@@ -153,12 +191,21 @@ export default {
|
|
|
shopArray: [{ name: '全部', id: 0 }],
|
|
|
loading: true,
|
|
|
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
- endDate: moment(new Date()).format('YYYY-MM-DD')
|
|
|
+ endDate: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
+ todayNewUser: 0,
|
|
|
+ brandNewUser: null,
|
|
|
+ ageProportion: null,
|
|
|
+ genderProportion: null
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
this.loadData()
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ activeBtn (n, o) {
|
|
|
+ this.loadData()
|
|
|
+ }
|
|
|
+ },
|
|
|
filters: {
|
|
|
getMax (datas) {
|
|
|
if (Array.isArray(datas) && datas.length > 0) {
|
|
@@ -179,11 +226,61 @@ export default {
|
|
|
methods: {
|
|
|
loadData () {
|
|
|
// 加载数据
|
|
|
- if (this.shopID === 0) {
|
|
|
+ if (this.activeBtn === 0 && this.shopID === 0) {
|
|
|
this.loadDataForNoShop()
|
|
|
- } else {
|
|
|
+ } else if (this.activeBtn === 0) {
|
|
|
this.loadDataByShop()
|
|
|
+ } else {
|
|
|
+ this.loadUserAnalyse()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadUserAnalyse () {
|
|
|
+ // 用户分析
|
|
|
+ const data = {
|
|
|
+ filterType: 'day',
|
|
|
+ startDate: this.startDate,
|
|
|
+ endDate: this.endDate
|
|
|
}
|
|
|
+ // 今日新增用户
|
|
|
+ const nowDate = moment(new Date()).format('YYYY-MM-DD')
|
|
|
+ this.$http.post('dataAnalyse/brandNewUser', { startDate: nowDate, endDate: nowDate }).then(res => {
|
|
|
+ if (res.code === 200 && res.msg === 'OK') {
|
|
|
+ this.todayNewUser = res.data[0].value
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 新增趋势用户
|
|
|
+ this.$http.post('dataAnalyse/brandNewUser', data).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ const brandNewUser = {
|
|
|
+ xdata: [],
|
|
|
+ jrdata: [],
|
|
|
+ zrdata: []
|
|
|
+ }
|
|
|
+ res.data.forEach(ele => {
|
|
|
+ brandNewUser.xdata.push(ele.name.substr(8))
|
|
|
+ brandNewUser.jrdata.push(ele.value)
|
|
|
+ })
|
|
|
+ this.brandNewUser = JSON.parse(JSON.stringify(brandNewUser))
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 年龄分布
|
|
|
+ this.$http.post('dataAnalyse/ageProportion', {}).then(res => {
|
|
|
+ if (res.code === 200 && res.msg === 'OK') {
|
|
|
+ const ageProportion = ['0-14', '15-18', '18-30', '30-55', '55以上']
|
|
|
+ this.ageProportion = ageProportion.map((item, i) => {
|
|
|
+ return { name: item, data: res.data[i] }
|
|
|
+ })
|
|
|
+ console.log(this.ageProportion)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 男女比例分布
|
|
|
+ this.$http.post('dataAnalyse/genderProportion', {}).then(res => {
|
|
|
+ if (res.code === 200 && res.msg === 'OK') {
|
|
|
+ this.genderProportion = JSON.parse(JSON.stringify(res.data).replaceAll('value', 'data'))
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
loadDataForNoShop () {
|
|
|
// 加 载无 需店铺id数据
|
|
@@ -212,7 +309,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
// 产品销售数量
|
|
|
- this.$http.get('/homePage/getData2', { date: moment().format('YYYY-MM-DD HH:mm:ss') }).then(res => {
|
|
|
+ this.$http.get('/homePage/getData2', { date: moment().format('YYYY-MM-DD') }).then(res => {
|
|
|
if (res.data) {
|
|
|
const shopSellData = {
|
|
|
xdata: [],
|
|
@@ -225,7 +322,22 @@ export default {
|
|
|
shopSellData.zrdata.push(ele.zr)
|
|
|
})
|
|
|
this.shopSellData = JSON.parse(JSON.stringify(shopSellData))
|
|
|
- console.log(this.shopSellData)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 产品销售金额走势
|
|
|
+ this.$http.get('/homePage/getData3', { date: moment().format('YYYY-MM-DD') }).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ const shopMoney = {
|
|
|
+ xdata: [],
|
|
|
+ jrdata: [],
|
|
|
+ zrdata: []
|
|
|
+ }
|
|
|
+ res.data.forEach(ele => {
|
|
|
+ shopMoney.xdata.push(ele.time)
|
|
|
+ shopMoney.jrdata.push(ele.jr)
|
|
|
+ shopMoney.zrdata.push(ele.zr)
|
|
|
+ })
|
|
|
+ this.shopMoney = JSON.parse(JSON.stringify(shopMoney))
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -237,18 +349,17 @@ export default {
|
|
|
startDate: this.startDate,
|
|
|
endDate: this.endDate
|
|
|
}
|
|
|
+
|
|
|
// 预订量比例
|
|
|
this.$http.post('dataAnalyse/ticketsBooking', data).then(res => {
|
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
|
this.ticketsBooking = JSON.parse(JSON.stringify(res.data).replaceAll('value', 'data'))
|
|
|
- console.log(this.ticketsBooking)
|
|
|
}
|
|
|
})
|
|
|
// 销售金额比例
|
|
|
this.$http.post('dataAnalyse/ticketsSalesAmount', data).then(res => {
|
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
|
this.ticketsSalesAmount = JSON.parse(JSON.stringify(res.data).replaceAll('value', 'data'))
|
|
|
- console.log(this.ticketsSalesAmount)
|
|
|
}
|
|
|
})
|
|
|
// 核销量比例
|
|
@@ -262,6 +373,7 @@ export default {
|
|
|
bindPickerChange (e) {
|
|
|
this.index = e.detail.value
|
|
|
this.shopID = this.shopArray[this.index].id
|
|
|
+ this.loadData()
|
|
|
},
|
|
|
// 获取店铺列表
|
|
|
async getShopList () {
|