Commit 3e971ee7 authored by 张恒's avatar 张恒

Demo

parent f99cc40b
...@@ -20,13 +20,12 @@ export const getAllDatas = async function (cur_day, type,cur_page) { ...@@ -20,13 +20,12 @@ export const getAllDatas = async function (cur_day, type,cur_page) {
/** /**
* 后端接口数据处理 * 后端接口数据处理
* @param detailList * @param detailList
* @returns {Promise<void>} * @returns {*[]}
*/ */
export const resultProcess = function (detailList) { export const resultProcess = function (detailList) {
let lostAddDataList = new Array(); let lostAddDataList = [];
for (let key in detailList) { for (let data of detailList) {
let resData = detailList[key]; let lostAdd = adapterLostAdd(data)
let lostAdd = adapterLostAdd(resData)
lostAddDataList.push(lostAdd) lostAddDataList.push(lostAdd)
} }
return lostAddDataList return lostAddDataList
...@@ -40,7 +39,7 @@ export const resultProcess = function (detailList) { ...@@ -40,7 +39,7 @@ export const resultProcess = function (detailList) {
export const adapterLostAdd = function (data) { export const adapterLostAdd = function (data) {
let lostAddData = {}; let lostAddData = {};
lostAddData['title'] = data.entrust_agency_name; lostAddData['title'] = data.entrust_agency_name;
let lostAddDataCol = new Array(); let lostAddDataCol = [];
lostAddDataCol[0] = adapterLostAddCol("订单量(万吨) ", conver_amont(data.unit_weight), "red") lostAddDataCol[0] = adapterLostAddCol("订单量(万吨) ", conver_amont(data.unit_weight), "red")
lostAddDataCol[1] = adapterLostAddCol("订单件数", data.qty, "#eaa749") lostAddDataCol[1] = adapterLostAddCol("订单件数", data.qty, "#eaa749")
lostAddDataCol[2] = adapterLostAddCol("营业额(万元)", conver_amont(data.sell_settle_amount), "#49eb29") lostAddDataCol[2] = adapterLostAddCol("营业额(万元)", conver_amont(data.sell_settle_amount), "#49eb29")
...@@ -48,7 +47,7 @@ export const adapterLostAdd = function (data) { ...@@ -48,7 +47,7 @@ export const adapterLostAdd = function (data) {
return lostAddData; return lostAddData;
} }
export const adapterLostAddCol = function (key, val, styleColor) { export const adapterLostAddCol = function (key, val, styleColor) {
let lostAddDataCol = new Object(); let lostAddDataCol = {};
lostAddDataCol.key = key; lostAddDataCol.key = key;
lostAddDataCol.value = val; lostAddDataCol.value = val;
lostAddDataCol.valStyle = {"color": styleColor} lostAddDataCol.valStyle = {"color": styleColor}
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
import data from "./mockData/lost_add_customer.json"; import data from "./mockData/lost_add_customer.json";
import DisplayBoard from "../components/container/display-board.vue"; import DisplayBoard from "../components/container/display-board.vue";
import PagingList from "../components/card/paging-list.vue"; import PagingList from "../components/card/paging-list.vue";
import {getAllDatas} from "./js/lostAddCustomer" import {resultProcess} from "./js/lostAddCustomer"
import moment from 'moment' import moment from 'moment'
export default { export default {
...@@ -35,21 +35,32 @@ export default { ...@@ -35,21 +35,32 @@ export default {
return { return {
today: moment().format("yyyy-MM-DD"), today: moment().format("yyyy-MM-DD"),
curPageTitle: this.$route.query.code === 1 ? "新增客户(较去年)" : "流失客户(较去年)", curPageTitle: this.$route.query.code === 1 ? "新增客户(较去年)" : "流失客户(较去年)",
pageData :{}, pageData: {
pageSize:40, leftData: {},
curPage:1, rightData: {},
total: 0
},
pageSize: 40,
curPage: 1,
} }
}, },
methods: { methods: {
back() { back() {
this.$router.push({path: '/'}); this.$router.push({path: '/'});
}, },
async handleCurrentChange(currentPage){ handleCurrentChange(currentPage) {
this.pageData = await getAllDatas(this.today, this.$route.query.code,currentPage) this.curPage = currentPage;
this.getAllData();
},
getAllData() {
let index = (this.curPage - 1) * 40
this.pageData.leftData = resultProcess(data.slice(index, index + 20));
this.pageData.rightData = resultProcess(data.slice(index + 20, index + 40));
this.pageData.total = data.length;
} }
}, },
async mounted() { mounted() {
this.pageData = await getAllDatas(this.today, this.$route.query.code) this.getAllData();
}, },
} }
</script> </script>
......
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
currentWeek: null, currentWeek: null,
isRouterAlive: true, isRouterAlive: true,
countDownTimer: null, countDownTimer: null,
week: ['星期天','星期一','星期二','星期三','星期四','星期五'], week: ['星期天','星期一','星期二','星期三','星期四','星期五',"星期六"],
} }
}, },
methods: { methods: {
......
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