@@ -51,16 +51,27 @@ | |||
<el-button type="primary" @click="addHotel">添加酒店</el-button> | |||
</el-row> | |||
</el-form-item> | |||
<template v-for="item in hotelList"> | |||
<hotel :dataObj="item" :hotelListOpt="hotelListOpt"></hotel> | |||
<template v-for="(item,index) in hotelList"> | |||
<el-card class="card" shadow="hover" :key="index"> | |||
<el-row type="flex" justify="end" v-if="type=='add'"> | |||
<i class="el-icon-close" @click="delSinHotel(index)"></i> | |||
</el-row> | |||
<hotel :dataObj="item" :hotelListOpt="hotelListOpt"></hotel> | |||
</el-card> | |||
</template> | |||
<el-form-item> | |||
<el-row type="flex"> | |||
<el-row type="flex" style="margin-top: 20px"> | |||
<el-button type="primary" @click="addHotelOther">添加附加项目</el-button> | |||
</el-row> | |||
</el-form-item> | |||
<template v-for="item in hotelotherList"> | |||
<hotelother :dataObj="item"></hotelother> | |||
<template v-for="(item,index) in hotelotherList"> | |||
<el-card class="card" shadow="hover" :key="index"> | |||
<el-row type="flex" justify="end" v-if="type=='add'"> | |||
<i class="el-icon-close" @click="delSinHotelOther(index)"></i> | |||
</el-row> | |||
<hotelother :dataObj="item"></hotelother> | |||
</el-card> | |||
</template> | |||
<el-form-item> | |||
<el-button type="primary" @click="onSubmit">提交订单</el-button> | |||
@@ -79,7 +90,9 @@ | |||
hotelother | |||
}, | |||
data() { | |||
window.type = 'edit' | |||
return { | |||
type: window.type, | |||
orderMain: { | |||
commissioner: '订单专员', | |||
channel_id: '订单渠道', | |||
@@ -105,10 +118,10 @@ | |||
total_cost: '成本价', | |||
profit: '利润', | |||
tableData: [{ | |||
date: '请选择日期', | |||
salePrice: '', | |||
countPrice: '', | |||
amount: '', | |||
run_date: '请选择日期', | |||
price: '', | |||
cost: '', | |||
count: '', | |||
note: '', | |||
provider: 0 | |||
}] | |||
@@ -129,10 +142,10 @@ | |||
total_cost: '成本价', | |||
profit: '利润', | |||
tableData: [{ | |||
date: '请选择日期', | |||
salePrice: '', | |||
countPrice: '', | |||
amount: '', | |||
run_date: '请选择日期', | |||
price: '', | |||
cost: '', | |||
count: '', | |||
note: '', | |||
provider: 0 | |||
}] | |||
@@ -144,10 +157,16 @@ | |||
}, | |||
methods: { | |||
addHotel() { | |||
this.hotelList.push(this.hotelListObj) | |||
this.hotelList.push(JSON.parse(JSON.stringify(this.hotelListObj))) | |||
}, | |||
addHotelOther() { | |||
this.hotelotherList.push(this.hotelotherListObj) | |||
this.hotelotherList.push(JSON.parse(JSON.stringify(this.hotelotherListObj))) | |||
}, | |||
delSinHotel(index) { | |||
this.hotelList.splice(index,1) | |||
}, | |||
delSinHotelOther(index) { | |||
this.hotelotherList.splice(index,1) | |||
}, | |||
onSubmit() { | |||
console.log('submit!'); | |||
@@ -1,42 +1,55 @@ | |||
<template> | |||
<el-card class="card" shadow="hover"> | |||
<el-form ref="form" :model="dataObj" label-width="100px"> | |||
<el-collapse> | |||
<el-collapse v-if="type=='edit'"> | |||
<el-collapse-item> | |||
<template slot="title"> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="8"> | |||
<el-form-item label="酒店名称"> | |||
<el-select v-model="dataObj.hotel_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in hotelListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-row style="width:100%;margin-top:10px;margin-bottom:10px;padding-right: 20px;" type="flex" | |||
justify="space-between" align="middle"> | |||
<el-col :span="2"> | |||
{{'酒店'}} | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="房型名称"> | |||
<el-select v-model="dataObj.room_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in roomListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-col :span="2" push="3"> | |||
<el-button>增补采购单</el-button> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="价格方案"> | |||
<el-input v-model="dataObj.plan_id"></el-input> | |||
</el-form-item> | |||
<el-button>修改</el-button> | |||
<el-button>保存</el-button> | |||
<el-button>取消</el-button> | |||
</el-col> | |||
</el-row> | |||
</template> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="8"> | |||
<el-form-item label="酒店名称"> | |||
<el-select v-model="dataObj.hotel_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in hotelListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="房型名称"> | |||
<el-select v-model="dataObj.room_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in roomListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="价格方案"> | |||
<el-input v-model="dataObj.plan_id"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="10"> | |||
<el-form-item label="入离日期"> | |||
@@ -70,42 +83,51 @@ | |||
show-summary | |||
style="width: 100%; margin-top: 20px"> | |||
<el-table-column | |||
prop="date" | |||
prop="run_date" | |||
label="日期" | |||
width="180"> | |||
</el-table-column> | |||
<el-table-column | |||
prop="salePrice" | |||
prop="price" | |||
label="售卖价"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.salePrice"></el-input> | |||
<el-input-number v-model="scope.row.price"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="countPrice" | |||
prop="cost" | |||
label="成本价"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.countPrice"></el-input> | |||
<el-input-number v-model="scope.row.cost"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="amount" | |||
prop="count" | |||
label="数量"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.count"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="provider" | |||
label="供应商"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.provider"></el-input> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="note" | |||
label="备注"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.note"></el-input> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
</el-form-item> | |||
<el-row> | |||
<el-col :span="12"> | |||
<el-form-item label-width="100px" label="对方订单号"> | |||
<el-input v-model="dataObj.trade_order_number"></el-input> | |||
<el-input-number size="small" v-model="dataObj.trade_order_number"></el-input-number> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="12"> | |||
@@ -138,8 +160,149 @@ | |||
</el-row> | |||
</el-collapse-item> | |||
</el-collapse> | |||
<template v-else> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="8"> | |||
<el-form-item label="酒店名称"> | |||
<el-select v-model="dataObj.hotel_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in hotelListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="房型名称"> | |||
<el-select v-model="dataObj.room_id" filterable placeholder="请选择" @change="selectChange"> | |||
<el-option | |||
v-for="item in roomListOpt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="价格方案"> | |||
<el-input v-model="dataObj.plan_id"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="10"> | |||
<el-form-item label="入离日期"> | |||
<el-date-picker | |||
v-model="run_date" | |||
type="daterange" | |||
value-format="yyyy-MM-dd HH:mm:ss" | |||
range-separator="-" | |||
start-placeholder="入住日期" | |||
end-placeholder="离店日期"> | |||
</el-date-picker> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label-width="100px" label="出游人姓名"> | |||
<el-input v-model="dataObj.customer_name"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="6"> | |||
<el-form-item label="确认号"> | |||
<el-input v-model="dataObj.confirm_no"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-form-item> | |||
<el-table | |||
:data="dataObj.tableData" | |||
border | |||
height="500" | |||
:summary-method="getSummaries" | |||
show-summary | |||
style="width: 100%; margin-top: 20px"> | |||
<el-table-column | |||
prop="run_date" | |||
label="日期" | |||
width="180"> | |||
</el-table-column> | |||
<el-table-column | |||
prop="price" | |||
label="售卖价"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.price"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="cost" | |||
label="成本价"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.cost"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="count" | |||
label="数量"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.count"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="provider" | |||
label="供应商"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.provider"></el-input> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="note" | |||
label="备注"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.note"></el-input> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
</el-form-item> | |||
<el-row> | |||
<el-col :span="12"> | |||
<el-form-item label-width="100px" label="对方订单号"> | |||
<el-input-number size="small" v-model="dataObj.trade_order_number"></el-input-number> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="12"> | |||
<el-form-item label="资源状态"> | |||
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;"> | |||
<el-radio-button label="未发单" name="未发单"></el-radio-button> | |||
<el-radio-button label="已发单" name="已发单"></el-radio-button> | |||
<el-radio-button label="已确认" name="已确认"></el-radio-button> | |||
<el-radio-button label="已取消" name="已取消"></el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="12"> | |||
<el-form-item label-width="100px" label="床型说明"> | |||
<span>{{dataObj.room_memo}}</span> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="12"> | |||
<el-form-item label-width="100px" label="资源负责人"> | |||
<span>{{dataObj.res_person}}</span> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="12"> | |||
<el-form-item label-width="100px" label="价格方案说明"> | |||
<span>{{dataObj.priceIntro}}</span> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
</template> | |||
</el-form> | |||
</el-card> | |||
</template> | |||
@@ -150,7 +313,7 @@ | |||
name: "hotel", | |||
props: {dataObj: Object, hotelListOpt: Array}, | |||
data() { | |||
return {roomListOpt: [], date: [], day: []} | |||
return {type: window.type, roomListOpt: [], date: [], day: []} | |||
}, | |||
watch: { | |||
date(val) { | |||
@@ -163,12 +326,12 @@ | |||
let tableData = []; | |||
for (let item of day) { | |||
tableData.push({ | |||
date: item, | |||
salePrice: '', | |||
countPrice: '', | |||
amount: 5, | |||
note: 5, | |||
provider: 'q' | |||
run_date: item, | |||
price: '', | |||
cost: '', | |||
count: '', | |||
note: '', | |||
provider: '' | |||
}) | |||
} | |||
this.dataObj.tableData = tableData; | |||
@@ -192,6 +355,7 @@ | |||
}, | |||
getSummaries(param) { | |||
const {columns, data} = param; | |||
console.log(param) | |||
const sums = []; | |||
columns.forEach((column, index) => { | |||
if (index === 0) { | |||
@@ -202,7 +366,27 @@ | |||
sums[index] = '利润'; | |||
return; | |||
} | |||
const values = data.map(item => Number(item[column.property])); | |||
if (index === 5) { | |||
return; | |||
} | |||
if (index === 4) { | |||
let sum = data.map(item => (Number(item[columns[1].property]) * 1 - Number(item[columns[2].property])) * Number(item[columns[3].property])); | |||
if (!sum.every(value => isNaN(value))) { | |||
sums[index] = sum.reduce((prev, curr) => { | |||
const value = Number(curr); | |||
if (!isNaN(value)) { | |||
return prev + curr; | |||
} else { | |||
return prev; | |||
} | |||
}, 0); | |||
sums[index] += ' 元'; | |||
} else { | |||
sums[index] = 'N/A'; | |||
} | |||
return; | |||
} | |||
const values = data.map(item => Number(item[column.property]) * Number(item[columns[3].property])); | |||
if (!values.every(value => isNaN(value))) { | |||
sums[index] = values.reduce((prev, curr) => { | |||
const value = Number(curr); | |||
@@ -1,27 +1,40 @@ | |||
<template> | |||
<el-card class="card" shadow="hover"> | |||
<el-form ref="form" :model="dataObj" label-width="100px"> | |||
<el-collapse> | |||
<el-collapse v-if="type=='edit'"> | |||
<el-collapse-item> | |||
<template slot="title"> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="8"> | |||
<el-form-item label="附加项目类型"> | |||
<el-input v-model="dataObj.item_type"></el-input> | |||
</el-form-item> | |||
<el-row style="width:100%;margin-top:10px;margin-bottom:10px;padding-right: 20px;" type="flex" | |||
justify="space-between" align="middle"> | |||
<el-col :span="2"> | |||
{{'附加项目'}} | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="附加项目名称"> | |||
<el-input v-model="dataObj.item_name"></el-input> | |||
</el-form-item> | |||
<el-col :span="2" push="3"> | |||
<el-button>增补采购单</el-button> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="计价单位"> | |||
<el-input v-model="dataObj.item_unit"></el-input> | |||
</el-form-item> | |||
<el-button>修改</el-button> | |||
<el-button>保存</el-button> | |||
<el-button>取消</el-button> | |||
</el-col> | |||
</el-row> | |||
</template> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="8"> | |||
<el-form-item label="附加项目类型"> | |||
<el-input v-model="dataObj.item_type"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="附加项目名称"> | |||
<el-input v-model="dataObj.item_name"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label="计价单位"> | |||
<el-input v-model="dataObj.item_unit"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="10"> | |||
<el-form-item label="使用日期"> | |||
@@ -51,35 +64,44 @@ | |||
show-summary | |||
style="width: 100%; margin-top: 20px"> | |||
<el-table-column | |||
prop="date" | |||
prop="run_date" | |||
label="日期" | |||
width="180"> | |||
</el-table-column> | |||
<el-table-column | |||
prop="salePrice" | |||
prop="price" | |||
label="售卖价"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.salePrice"></el-input> | |||
<el-input-number v-model="scope.row.price"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="countPrice" | |||
prop="cost" | |||
label="成本价"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.countPrice"></el-input> | |||
<el-input-number v-model="scope.row.cost"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="amount" | |||
prop="count" | |||
label="数量"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.count"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="provider" | |||
label="供应商"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.provider"></el-input> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="note" | |||
label="备注"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.note"></el-input> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
</el-form-item> | |||
@@ -96,12 +118,12 @@ | |||
</el-col> | |||
<el-col :span="12"> | |||
<el-form-item label="资源状态"> | |||
<el-button-group v-model="dataObj.confirm_status"> | |||
<el-button type="primary">未发单</el-button> | |||
<el-button type="">已发单</el-button> | |||
<el-button type="">已确认</el-button> | |||
<el-button type="">已取消</el-button> | |||
</el-button-group> | |||
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;"> | |||
<el-radio-button label="未发单" name="未发单"></el-radio-button> | |||
<el-radio-button label="已发单" name="已发单"></el-radio-button> | |||
<el-radio-button label="已确认" name="已确认"></el-radio-button> | |||
<el-radio-button label="已取消" name="已取消"></el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
@@ -114,8 +136,108 @@ | |||
</el-row> | |||
</el-collapse-item> | |||
</el-collapse> | |||
<template v-else> | |||
<el-row style="margin-top: 25px;padding-right: 20px;"> | |||
<el-col :span="10"> | |||
<el-form-item label="使用日期"> | |||
<el-col :span="11"> | |||
<el-date-picker type="date" placeholder="选择日期" v-model="dataObj.use_date" | |||
style="width: 100%;"></el-date-picker> | |||
</el-col> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="8"> | |||
<el-form-item label-width="100px" label="出游人姓名"> | |||
<el-input v-model="dataObj.customer_name"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="6"> | |||
<el-form-item label="确认号"> | |||
<el-input v-model="dataObj.confirm_no"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-form-item> | |||
<el-table | |||
:data="dataObj.tableData" | |||
border | |||
height="500" | |||
:summary-method="getSummaries" | |||
show-summary | |||
style="width: 100%; margin-top: 20px"> | |||
<el-table-column | |||
prop="run_date" | |||
label="日期" | |||
width="180"> | |||
</el-table-column> | |||
<el-table-column | |||
prop="price" | |||
label="售卖价"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.price"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="cost" | |||
label="成本价"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.cost"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="count" | |||
label="数量"> | |||
<template slot-scope="scope"> | |||
<el-input-number v-model="scope.row.count"></el-input-number> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="provider" | |||
label="供应商"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.provider"></el-input> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="note" | |||
label="备注"> | |||
<template slot-scope="scope"> | |||
<el-input v-model="scope.row.note"></el-input> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
</el-form-item> | |||
<el-row> | |||
<el-col :span="6"> | |||
<el-form-item label-width="100px" label="对方订单号"> | |||
<el-input v-model="dataObj.trade_order_number"></el-input> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="6"> | |||
<el-form-item label-width="100px" label="资源负责人"> | |||
<span>{{dataObj.res_person}}</span> | |||
</el-form-item> | |||
</el-col> | |||
<el-col :span="12"> | |||
<el-form-item label="资源状态"> | |||
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;"> | |||
<el-radio-button label="未发单" name="未发单"></el-radio-button> | |||
<el-radio-button label="已发单" name="已发单"></el-radio-button> | |||
<el-radio-button label="已确认" name="已确认"></el-radio-button> | |||
<el-radio-button label="已取消" name="已取消"></el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-row> | |||
<el-col :span="24"> | |||
<el-form-item label-width="100px" label="附加项目说明"> | |||
<span>{{dataObj.item_memo}}</span> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
</template> | |||
</el-form> | |||
</el-card> | |||
</template> | |||
@@ -126,7 +248,7 @@ | |||
name: "hotelother", | |||
props: {dataObj: Object}, | |||
data() { | |||
return {date: [], day: []} | |||
return {type: window.type,date: [], day: []} | |||
}, | |||
watch: { | |||
date(val) { | |||
@@ -139,14 +261,15 @@ | |||
let tableData = []; | |||
for (let item of day) { | |||
tableData.push({ | |||
date: item, | |||
salePrice: '', | |||
countPrice: '', | |||
amount: '', | |||
run_date: item, | |||
price: '', | |||
cost: '', | |||
count: '', | |||
note: '', | |||
provider: '' | |||
}) | |||
} | |||
this.dataObj.tableData = tableData; | |||
this.$set(this.dataObj, 'tableData', tableData) | |||
} | |||
}, | |||
@@ -154,7 +277,7 @@ | |||
getAllDateCN(startTime, endTime) { | |||
var date_all = [] | |||
var i = 0 | |||
while ((endTime.getTime() - startTime.getTime()) >= 0) { | |||
while ((endTime.getTime() - startTime.getTime()) > 0) { | |||
var year = startTime.getFullYear() | |||
var month = startTime.getMonth() + 1 | |||
var day = startTime.getDate() | |||
@@ -176,7 +299,27 @@ | |||
sums[index] = '利润'; | |||
return; | |||
} | |||
const values = data.map(item => Number(item[column.property])); | |||
if (index === 5) { | |||
return; | |||
} | |||
if (index === 4) { | |||
let sum = data.map(item => (Number(item[columns[1].property]) * 1 - Number(item[columns[2].property])) * Number(item[columns[3].property])); | |||
if (!sum.every(value => isNaN(value))) { | |||
sums[index] = sum.reduce((prev, curr) => { | |||
const value = Number(curr); | |||
if (!isNaN(value)) { | |||
return prev + curr; | |||
} else { | |||
return prev; | |||
} | |||
}, 0); | |||
sums[index] += ' 元'; | |||
} else { | |||
sums[index] = 'N/A'; | |||
} | |||
return; | |||
} | |||
const values = data.map(item => Number(item[column.property]) * Number(item[columns[3].property])); | |||
if (!values.every(value => isNaN(value))) { | |||
sums[index] = values.reduce((prev, curr) => { | |||
const value = Number(curr); | |||
@@ -14,7 +14,7 @@ import { | |||
// MenuItem, | |||
// MenuItemGroup, | |||
Input, | |||
// InputNumber, | |||
InputNumber, | |||
// Radio, | |||
RadioGroup, | |||
RadioButton, | |||
@@ -93,7 +93,7 @@ import { | |||
// Vue.use(MenuItem); | |||
// Vue.use(MenuItemGroup); | |||
Vue.use(Input); | |||
// Vue.use(InputNumber); | |||
Vue.use(InputNumber); | |||
// Vue.use(Radio); | |||
Vue.use(RadioGroup); | |||
Vue.use(RadioButton); | |||