Commit a691b653 by 姜雷

Merge branch 'develop' into 'test'

Develop See merge request !31
parents e9291a62 c0f64b97
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
title: '', title: '',
selectedRoute: [], selectedRoute: [],
routerDone: false, routerDone: false,
isInnerPage: true, isInnerPage: false,
showFastLink: true, showFastLink: true,
showSelected: false, showSelected: false,
}; };
......
...@@ -12,3 +12,8 @@ export const fetchUserBaseInfoByPhone = entity => ...@@ -12,3 +12,8 @@ export const fetchUserBaseInfoByPhone = entity =>
url: path + '/dcxy/customerInfo/baseCustomer', url: path + '/dcxy/customerInfo/baseCustomer',
params: entity, params: entity,
}); });
export const fetchUserAccount = entity =>
fetch({
url: path + '/dcxy/customerInfo/queryAccount',
params: entity,
});
...@@ -61,6 +61,19 @@ ...@@ -61,6 +61,19 @@
</div> </div>
<div class="UserInfo-Content-Col">注册时间:{{$formatDate(customerBaseInfo.createAt,'yyyy-MM-dd')}}</div> <div class="UserInfo-Content-Col">注册时间:{{$formatDate(customerBaseInfo.createAt,'yyyy-MM-dd')}}</div>
<div class="UserInfo-Content-Col UserInfo-CampusName">{{customerBaseInfo.areaName}}</div> <div class="UserInfo-Content-Col UserInfo-CampusName">{{customerBaseInfo.areaName}}</div>
<div
class="UserInfo-Content-serviceBox"
v-if="showMoney"
>
<div
v-for="(item, index) in serviceList"
:key="index"
class="UserInfo-Content-serviceBox-item"
>
<div>{{getServiceName(item.serviceId)}}</div>
<div>{{item.money}}</div>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -71,10 +84,6 @@ import UserBaseInfoMixin from '../../mixins/user/userBaseInfo.js'; ...@@ -71,10 +84,6 @@ import UserBaseInfoMixin from '../../mixins/user/userBaseInfo.js';
import getUserInfoLabelMixin from '@/mixins/user/getUserInfoLabel.js'; import getUserInfoLabelMixin from '@/mixins/user/getUserInfoLabel.js';
export default { export default {
props: {
customerId: Number,
customerPhone: String,
},
mixins: [UserBaseInfoMixin, getUserInfoLabelMixin], mixins: [UserBaseInfoMixin, getUserInfoLabelMixin],
}; };
</script> </script>
...@@ -132,7 +141,7 @@ export default { ...@@ -132,7 +141,7 @@ export default {
} }
} }
.UserInfo-Content { .UserInfo-Content {
height: 90px; // height: 90px;
background-color: #fff; background-color: #fff;
padding: 10px; padding: 10px;
.UserInfo-Content-Col { .UserInfo-Content-Col {
...@@ -156,6 +165,13 @@ export default { ...@@ -156,6 +165,13 @@ export default {
line-height: 1; line-height: 1;
margin-top: 0px; margin-top: 0px;
} }
.UserInfo-Content-serviceBox {
line-height: 24px;
.UserInfo-Content-serviceBox-item {
display: flex;
justify-content: space-between;
}
}
} }
} }
@media screen and (min-width: $bigScreenWidth) { @media screen and (min-width: $bigScreenWidth) {
...@@ -187,7 +203,7 @@ export default { ...@@ -187,7 +203,7 @@ export default {
} }
} }
.UserInfo-Content { .UserInfo-Content {
height: 180px; // height: 180px;
padding: 20px; padding: 20px;
.UserInfo-Content-Col { .UserInfo-Content-Col {
line-height: 38px; line-height: 38px;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
class="left-part" class="left-part"
:customerId="customerId" :customerId="customerId"
:customerPhone="customerPhone" :customerPhone="customerPhone"
:showMoney="showMoney"
:visible="visible" :visible="visible"
/> />
<div class="right-part"> <div class="right-part">
...@@ -39,6 +40,10 @@ export default { ...@@ -39,6 +40,10 @@ export default {
default: true, default: true,
}, },
customerPhone: String, customerPhone: String,
showMoney: {
type: Boolean,
default: false,
},
}, },
}; };
</script> </script>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
@change="changeHandle" @change="changeHandle"
:multiple="multiple" :multiple="multiple"
> >
<el-option :value="-1">全选</el-option> <slot></slot>
<el-option <el-option
v-for="(item, index) in dashboardArea" v-for="(item, index) in dashboardArea"
:key="index" :key="index"
......
...@@ -72,6 +72,15 @@ export const operClassifyName4User = [ ...@@ -72,6 +72,15 @@ export const operClassifyName4User = [
{ label: '新增', value: '05' }, { label: '新增', value: '05' },
]; ];
export const serviceMap = [
{ label: '艾米', value: '0' },
{ label: '通用', value: '1' },
{ label: '洗衣', value: '2' },
{ label: '饮水', value: '3' },
{ label: '吹风', value: '4' },
{ label: '洗浴', value: '5' },
];
export default { export default {
selectTypeMapping, selectTypeMapping,
customerStateOptions, customerStateOptions,
......
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
:value="filters.choiceareaIds" :value="filters.choiceareaIds"
multiple multiple
@input="val => updateFilters({choiceareaIds: val})" @input="val => updateFilters({choiceareaIds: val})"
/> >
<el-option :value="-1">全选</el-option>
</dashboard-area-select>
</search-item> </search-item>
<el-radio-group <el-radio-group
class="Dashboard-Radio" class="Dashboard-Radio"
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
>搜索</el-button> >搜索</el-button>
</div> </div>
<CampusRankChart <CampusRankChart
:data="campusRankList" :data="campusRankListFillAreaname"
:changeCampusHandle="changeCampusHandle" :changeCampusHandle="changeCampusHandle"
:updateCampusName="updateCampusName" :updateCampusName="updateCampusName"
:showOtherNameHandle="showOtherNameHandle" :showOtherNameHandle="showOtherNameHandle"
...@@ -55,10 +57,12 @@ ...@@ -55,10 +57,12 @@
<script> <script>
import CampusRankChart from './CampusRankChart'; import CampusRankChart from './CampusRankChart';
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
import AreaDashboardMixin from '../../../components/input/AreaDashboard/mixin';
export default { export default {
name: 'CampusRank', name: 'CampusRank',
components: { CampusRankChart }, components: { CampusRankChart },
mixins: [AreaDashboardMixin],
computed: { computed: {
...mapGetters('Dashboard', [ ...mapGetters('Dashboard', [
'campusRankList', 'campusRankList',
...@@ -66,6 +70,19 @@ export default { ...@@ -66,6 +70,19 @@ export default {
'areaInfo', 'areaInfo',
'loading', 'loading',
]), ]),
campusRankListFillAreaname() {
return this.campusRankList.map(item => {
if (item.areaName) {
return item;
} else {
let areaName = this.getAreaName(item.areaId);
return {
...item,
areaName: areaName,
};
}
});
},
}, },
data() { data() {
return { showOther: false }; return { showOther: false };
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
id='CustomerRechargeChart' id='CustomerRechargeChart'
:style="`height: ${height}px;width: ${width?width+'px':'auto'}`" :style="`height: ${height}px;width: ${width?width+'px':'auto'}`"
></div> ></div>
<!-- <div id='CustomerRechangeSlider'></div> --> <div id='CustomerRechangeSlider'></div>
<CustomerRechangeSlider <!-- <CustomerRechangeSlider
class="CustomerRechangeSlider" class="CustomerRechangeSlider"
:data="data" :data="data"
:span="4" :span="4"
:onChange="wheelHandle" :onChange="wheelHandle"
/> /> -->
</div> </div>
</template> </template>
...@@ -20,7 +20,7 @@ import Slider from '@antv/g2-plugin-slider'; ...@@ -20,7 +20,7 @@ import Slider from '@antv/g2-plugin-slider';
import chartMixin from '../chartMixin'; import chartMixin from '../chartMixin';
import DataSet from '@antv/data-set'; import DataSet from '@antv/data-set';
import _ from 'lodash'; import _ from 'lodash';
import CustomerRechangeSlider from './slider'; // import CustomerRechangeSlider from './slider';
const Shape = G2.Shape; const Shape = G2.Shape;
const Util = G2.Util; const Util = G2.Util;
...@@ -75,7 +75,7 @@ Shape.registerShape('interval', 'right', { ...@@ -75,7 +75,7 @@ Shape.registerShape('interval', 'right', {
export default { export default {
name: 'CustomerRechargeChart', name: 'CustomerRechargeChart',
components: { CustomerRechangeSlider }, // components: { CustomerRechangeSlider },
mixins: [chartMixin], mixins: [chartMixin],
props: { props: {
rechargeCount: { rechargeCount: {
...@@ -101,32 +101,36 @@ export default { ...@@ -101,32 +101,36 @@ export default {
SelectedDataIndex: null, SelectedDataIndex: null,
}; };
}, },
computed: {
dataList() {
return this.data.map((item, index) => ({ ...item, index: index }));
},
},
methods: { methods: {
initData() { initData() {
this.ds = new DataSet({ this.ds = new DataSet({
state: { state: {
startRadio: 0, start: 0,
endRadio: 0.2, end: 3,
}, },
}); });
const dv = this.ds.createView().source(this.data); const dv = this.ds.createView().source(this.dataList);
this.dv = dv; this.dv = dv;
// dv.transform({
// type: 'map',
// callback(row, index) {
// // 加工数据后返回新的一行,默认返回行数据本身
// row.index = index;
// return row;
// },
// });
dv.transform({ dv.transform({
type: 'filter', type: 'filter',
callback: obj => { callback: obj => {
if ( const currentRadio = obj.index;
_.isNil(this.ds.state.startRadio) ||
_.isNil(this.ds.state.endRadio)
) {
return true;
}
const dataIndex = _.findIndex(this.data, {
areaName: obj.areaName,
});
const currentRadio = dataIndex / this.data.length;
return ( return (
currentRadio >= this.ds.state.startRadio && currentRadio >= this.ds.state.start &&
currentRadio <= this.ds.state.endRadio currentRadio <= this.ds.state.end
); );
}, },
}); });
...@@ -146,14 +150,11 @@ export default { ...@@ -146,14 +150,11 @@ export default {
alias: '充值人数', alias: '充值人数',
}, },
}); });
// this.chart.tooltip({
// offset: 250,
// });
this.chart.axis('areaName', { this.chart.axis('areaName', {
label: { label: {
offsetX: -80, offsetX: -80,
htmlTemplate(text, item, index) { htmlTemplate: (text, item, index) => {
return `<div class="CustomerRechargeChart-areaTitle">${text}</div>`; return `<div class="CustomerRechargeChart-areaTitle">${text}</div>`;
}, },
}, },
...@@ -168,13 +169,13 @@ export default { ...@@ -168,13 +169,13 @@ export default {
.position('areaName*rechargeMoney') .position('areaName*rechargeMoney')
.color('#4e82fb') .color('#4e82fb')
.shape('left') .shape('left')
.size(18); .size(15);
this.chart this.chart
.interval() .interval()
.position('areaName*rechargeMen') .position('areaName*rechargeMen')
.shape('right') .shape('right')
.color('#26c9a8') .color('#26c9a8')
.size(18); .size(15);
this.chart.legend(false); this.chart.legend(false);
...@@ -196,27 +197,29 @@ export default { ...@@ -196,27 +197,29 @@ export default {
this.chart.render(); this.chart.render();
// this.initSlider(); this.initSlider();
}, },
initSlider() { initSlider() {
const wrapDom = document.getElementById('CustomerRechargeChart'); const wrapDom = document.getElementById('CustomerRechargeChart');
let height = wrapDom.clientHeight; // let height = wrapDom.clientHeight;
// const arrLength = this.data.length; // const arrLength = this.data.length;
// let spanNum = 4 / arrLength; // let spanNum = 4 / arrLength;
this.sliderDom = document.getElementById('CustomerRechangeSlider'); this.sliderDom = document.getElementById('CustomerRechangeSlider');
this.sliderDom.style = `height:${this.height}px`;
this.sliderDom.style = `height:${height}px`;
this.slider = new Slider({ this.slider = new Slider({
container: this.sliderDom, // dom 容器 id 或者 dom 容器对象 container: this.sliderDom, // dom 容器 id 或者 dom 容器对象
width: 26, // slider 的宽度,默认为 'auto',即自适应宽度 width: 26, // slider 的宽度,默认为 'auto',即自适应宽度
height: height, // slider 的高度,默认为 '26px' height: this.height, // slider 的高度,默认为 '26px'
padding: [50, 0, 50, 0], padding: [20, 0, 20, 0],
xAxis: 'rechargeMen', // 背景图的横轴对应字段,同时为数据筛选的字段 xAxis: 'rechargeMen', // 背景图的横轴对应字段,同时为数据筛选的字段
yAxis: 'areaName', // 背景图的纵轴对应字段 yAxis: 'index', // 背景图的纵轴对应字段
startRadio: this.ds.state.startRadio, // 新增 start: 0,
endRadio: this.ds.state.endRadio, // 新增 end: 3,
data: this.data, // slider 的数据源 minSpan: 4,
maxSpan: 4,
data: this.dataList, // slider 的数据源
textStyle: { textStyle: {
display: 'none', display: 'none',
}, },
...@@ -225,44 +228,51 @@ export default { ...@@ -225,44 +228,51 @@ export default {
width: 26, width: 26,
height: 5, height: 5,
}, },
onChange: ({ startRadio, endRadio }) => { onChange: ({ startValue, endValue }) => {
this.ds.setState('startRadio', startRadio); this.ds.setState('start', startValue);
this.ds.setState('endRadio', endRadio); this.ds.setState('end', endValue);
}, // 更新数据状态量的回调函数 }, // 更新数据状态量的回调函数
}); });
this.slider.layout = 'vertical'; this.slider.layout = 'vertical';
this.slider.render(); // 渲染 this.slider.render(); // 渲染
}, },
updateSlider() { updateSlider() {
const wrapDom = document.getElementById('CustomerRechargeChart'); this.sliderDom.innerHTML = '';
let height = wrapDom.clientHeight;
let dom = this.sliderDom;
dom.innerHTML = '';
const arrLength = this.data.length; const arrLength = this.data.length;
console.log('2222', this.data.length - 1);
if (arrLength) { if (arrLength) {
// let spanNum = 4 / arrLength; // let spanNum = 4 / arrLength;
this.slider = new Slider({ this.slider = new Slider({
container: this.sliderDom, container: this.sliderDom,
width: 26, width: 26,
height: height, height: this.height,
padding: [50, 0, 50, 0], padding: [20, 0, 20, 0],
xAxis: 'value', xAxis: 'rechargeMen',
yAxis: 'areaName', yAxis: 'index',
startRadio: this.ds.state.startRadio, scales: {
endRadio: this.ds.state.endRadio, index: {
data: this.data, formatter: val => {
// minSpan: this.ds.state.endRadio, return parseInt(val, 10);
// maxSpan: this.ds.state.endRadio, },
},
},
start: this.data.length - 4,
end: this.data.length - -1,
minSpan: 4,
maxSpan: 4,
data: this.dataList,
handleStyle: { handleStyle: {
img: require('@/assets/images/dashboard/QXtfhORGlDuRvLXFzpsQ.png'), img: require('@/assets/images/dashboard/QXtfhORGlDuRvLXFzpsQ.png'),
width: 26, width: 26,
height: 5, height: 5,
}, },
onChange: ({ startRadio, endRadio }) => { onChange: ({ startValue, endValue }) => {
this.ds.setState('startRadio', startRadio); // console.log('update:', startValue, endValue);
this.ds.setState('endRadio', endRadio); this.ds.setState('start', startValue);
this.ds.setState('end', endValue);
}, },
}); });
this.slider.layout = 'vertical'; this.slider.layout = 'vertical';
...@@ -274,16 +284,16 @@ export default { ...@@ -274,16 +284,16 @@ export default {
const arrLength = this.data.length; const arrLength = this.data.length;
let spanNum = 4 / arrLength; let spanNum = 4 / arrLength;
this.ds.setState('startRadio', Math.abs(1 - spanNum)); this.ds.setState('start', this.data.length - 4);
this.ds.setState('endRadio', 1); this.ds.setState('end', this.data.length - 1);
this.dv.source(this.data); this.dv.source(this.dataList);
// let height = this.data.length * 50; // let height = this.data.length * 50;
// this.chart.changeHeight(height); // this.chart.changeHeight(height);
// this.updateSlider(); this.updateSlider();
this.updateData(); this.updateData();
} else { } else {
this.initData(); this.initData();
// this.initSlider(); this.initSlider();
} }
}, },
wheelHandle({ startRadio, endRadio }) { wheelHandle({ startRadio, endRadio }) {
......
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { fetchUserAccount } from '../../api/base/customer';
import { serviceMap } from '@/config';
export default { export default {
props: { props: {
visible: { type: Boolean, default: false }, visible: { type: Boolean, default: false },
customerId: Number, customerId: Number,
customerPhone: String, customerPhone: String,
showMoney: {
type: Boolean,
default: false,
},
},
data() {
return {
serviceList: [],
};
}, },
watch: { watch: {
visible(newVal) { visible(newVal) {
...@@ -12,6 +23,7 @@ export default { ...@@ -12,6 +23,7 @@ export default {
this.fetchUserBaseInfo({ this.fetchUserBaseInfo({
customerId: this.customerId, customerId: this.customerId,
}); });
this.getAllData();
} }
}, },
customerId(newId) { customerId(newId) {
...@@ -19,6 +31,7 @@ export default { ...@@ -19,6 +31,7 @@ export default {
this.fetchUserBaseInfo({ this.fetchUserBaseInfo({
customerId: this.customerId, customerId: this.customerId,
}); });
this.getAllData();
} }
}, },
customerPhone(newPhone) { customerPhone(newPhone) {
...@@ -26,6 +39,7 @@ export default { ...@@ -26,6 +39,7 @@ export default {
this.fetchUserBaseInfoByPhone({ this.fetchUserBaseInfoByPhone({
customerPhone: this.customerPhone, customerPhone: this.customerPhone,
}); });
this.getAllData();
} }
}, },
}, },
...@@ -34,11 +48,13 @@ export default { ...@@ -34,11 +48,13 @@ export default {
this.fetchUserBaseInfo({ this.fetchUserBaseInfo({
customerId: this.customerId, customerId: this.customerId,
}); });
this.getAllData();
} }
if (this.visible && !this.customerId && this.customerPhone) { if (this.visible && !this.customerId && this.customerPhone) {
this.fetchUserBaseInfoByPhone({ this.fetchUserBaseInfoByPhone({
customerPhone: this.customerPhone, customerPhone: this.customerPhone,
}); });
this.getAllData();
} }
}, },
computed: { computed: {
...@@ -46,5 +62,24 @@ export default { ...@@ -46,5 +62,24 @@ export default {
}, },
methods: { methods: {
...mapActions(['fetchUserBaseInfo', 'fetchUserBaseInfoByPhone']), ...mapActions(['fetchUserBaseInfo', 'fetchUserBaseInfoByPhone']),
getAllData() {
console.log('in getAllData', this.showMoney);
if (this.showMoney) {
fetchUserAccount({
customerId: this.customerId,
})
.then(res => {
this.serviceList = res.data;
})
.catch(err => {
console.error(err);
});
}
},
getServiceName(id) {
let item = serviceMap.find(item => item.value === id);
return item ? item.label : id;
},
}, },
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment