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

Demo

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