|
|
@@ -164,7 +164,7 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label-width="100px" label="床型说明"> |
|
|
|
<span>{{ dataObj.room_memo }}</span> |
|
|
|
<el-input readonly v-model="dataObjTemp.room_memo"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@@ -181,7 +181,7 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label-width="100px" label="价格方案说明"> |
|
|
|
<span>{{ dataObj.plan_mome }}</span> |
|
|
|
<el-input readonly type="textarea" v-model="dataObjTemp.plan_memo"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@@ -337,7 +337,7 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label-width="100px" label="床型说明"> |
|
|
|
<span>{{ dataObj.room_memo }}</span> |
|
|
|
<el-input readonly v-model="dataObjTemp.room_memo"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@@ -354,7 +354,7 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label-width="100px" label="价格方案说明"> |
|
|
|
<span>{{ dataObj.plan_mome }}</span> |
|
|
|
<el-input readonly type="textarea" v-model="dataObjTemp.plan_memo"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@@ -365,270 +365,269 @@ |
|
|
|
|
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import axios from "axios" |
|
|
|
import axios from "axios" |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "hotel", |
|
|
|
props: { |
|
|
|
supplier_idList: Array, |
|
|
|
userOpt: Array, |
|
|
|
type: String, |
|
|
|
saleCount: Number, |
|
|
|
dataObj: Object, |
|
|
|
hotelListOpt: Array |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
dataObjTemp: this.$lo.cloneDeep(this.dataObj), |
|
|
|
confirm_status: '未发单', |
|
|
|
roomListOpt: [], |
|
|
|
date: [], |
|
|
|
roomPlan: [], |
|
|
|
day: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
disable() { |
|
|
|
return this.dataObjTemp.editType != 'add' |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
dataObj(val) { |
|
|
|
console.log('change') |
|
|
|
this.dataObjTemp = this.$lo.cloneDeep(this.dataObj) |
|
|
|
}, |
|
|
|
confirm_status(val) { |
|
|
|
let type = ''; |
|
|
|
switch (val) { |
|
|
|
case "未发单": |
|
|
|
type = '1' |
|
|
|
break; |
|
|
|
case "已发单": |
|
|
|
type = '2' |
|
|
|
break; |
|
|
|
case "已确认": |
|
|
|
type = '3' |
|
|
|
break; |
|
|
|
case "已取消": |
|
|
|
type = '4' |
|
|
|
break; |
|
|
|
} |
|
|
|
this.$set(this.dataObj, "confirm_status", type) |
|
|
|
}, |
|
|
|
date(val) { |
|
|
|
console.log(val) |
|
|
|
this.$set(this.dataObj, "check_in_date", val[0]) |
|
|
|
this.$set(this.dataObj, "check_out_date", val[1]) |
|
|
|
let date1 = new Date(val[0]); |
|
|
|
let date2 = new Date(val[1]); |
|
|
|
let day = this.getAllDateCN(date1, date2) |
|
|
|
let purchasePriceList = []; |
|
|
|
for (let item of day) { |
|
|
|
purchasePriceList.push({ |
|
|
|
run_date: item, |
|
|
|
price: '', |
|
|
|
cost: '', |
|
|
|
count: '', |
|
|
|
note: '', |
|
|
|
supplier_id: '' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.dataObj.purchasePriceList = purchasePriceList; |
|
|
|
this.$set(this.dataObj, 'purchasePriceList', purchasePriceList) |
|
|
|
export default { |
|
|
|
name: "hotel", |
|
|
|
props: { |
|
|
|
supplier_idList: Array, |
|
|
|
userOpt: Array, |
|
|
|
type: String, |
|
|
|
saleCount: Number, |
|
|
|
dataObj: Object, |
|
|
|
hotelListOpt: Array |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
dataObjTemp: this.$lo.cloneDeep(this.dataObj), |
|
|
|
confirm_status: '未发单', |
|
|
|
roomListOpt: [], |
|
|
|
date: [], |
|
|
|
roomPlan: [], |
|
|
|
day: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
disable() { |
|
|
|
return this.dataObjTemp.editType != 'add' |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
dataObj(val) { |
|
|
|
console.log('change') |
|
|
|
this.dataObjTemp = this.$lo.cloneDeep(this.dataObj) |
|
|
|
}, |
|
|
|
confirm_status(val) { |
|
|
|
let type = ''; |
|
|
|
switch (val) { |
|
|
|
case "未发单": |
|
|
|
type = '1' |
|
|
|
break; |
|
|
|
case "已发单": |
|
|
|
type = '2' |
|
|
|
break; |
|
|
|
case "已确认": |
|
|
|
type = '3' |
|
|
|
break; |
|
|
|
case "已取消": |
|
|
|
type = '4' |
|
|
|
break; |
|
|
|
} |
|
|
|
this.$set(this.dataObj, "confirm_status", type) |
|
|
|
}, |
|
|
|
date(val) { |
|
|
|
console.log(val) |
|
|
|
this.$set(this.dataObj, "check_in_date", val[0]) |
|
|
|
this.$set(this.dataObj, "check_out_date", val[1]) |
|
|
|
let date1 = new Date(val[0]); |
|
|
|
let date2 = new Date(val[1]); |
|
|
|
let day = this.getAllDateCN(date1, date2) |
|
|
|
let purchasePriceList = []; |
|
|
|
for (let item of day) { |
|
|
|
purchasePriceList.push({ |
|
|
|
run_date: item, |
|
|
|
price: '', |
|
|
|
cost: '', |
|
|
|
count: '', |
|
|
|
note: '', |
|
|
|
supplier_id: '' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.dataObj.purchasePriceList = purchasePriceList; |
|
|
|
this.$set(this.dataObj, 'purchasePriceList', purchasePriceList) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
changeNum(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'count', value) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
changesupplier_id(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'supplier_id', value) |
|
|
|
}) |
|
|
|
this.$set(this.dataObj, 'supplier_id', value) |
|
|
|
} |
|
|
|
}, |
|
|
|
changeNote(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'customer_comments', value) |
|
|
|
}) |
|
|
|
this.$set(this.dataObj, 'customer_comments', value) |
|
|
|
} |
|
|
|
}, |
|
|
|
arraySpanMethod({row, column, rowIndex, columnIndex}) { |
|
|
|
// console.log({row, column, rowIndex, columnIndex}) |
|
|
|
if (columnIndex === 3) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else if (columnIndex === 4) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else if (columnIndex === 5) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else { |
|
|
|
return [1, 1]; |
|
|
|
} |
|
|
|
}, |
|
|
|
getAllDateCN(startTime, endTime) { |
|
|
|
var date_all = [] |
|
|
|
var i = 0 |
|
|
|
while ((endTime.getTime() - startTime.getTime()) > 0) { |
|
|
|
var year = startTime.getFullYear() |
|
|
|
var month = startTime.getMonth() + 1 |
|
|
|
var day = startTime.getDate() |
|
|
|
date_all[i] = year + '-' + month + '-' + day |
|
|
|
startTime.setDate(startTime.getDate() + 1) |
|
|
|
i += 1 |
|
|
|
} |
|
|
|
return date_all |
|
|
|
}, |
|
|
|
getSummaries(param) { |
|
|
|
const {columns, data} = param; |
|
|
|
// console.log(param) |
|
|
|
const sums = []; |
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
sums[index] = '总价'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 3) { |
|
|
|
sums[index] = '利润'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 5) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 4) { |
|
|
|
let sum = data.map(item => (Number(item[columns[1].property]) * this.saleCount - 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); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + curr; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
if (index == 1) { |
|
|
|
this.dataObj.total_price = sums[index]; |
|
|
|
this.$set(this.dataObj, 'total_price', sums[index]); |
|
|
|
} |
|
|
|
if (index == 2) { |
|
|
|
this.dataObj.total_cost = sums[index]; |
|
|
|
this.$set(this.dataObj, 'total_cost', sums[index]); |
|
|
|
} |
|
|
|
if (index == 4) { |
|
|
|
this.dataObj.profit = sums[index]; |
|
|
|
this.$set(this.dataObj, 'profit', sums[index]); |
|
|
|
} |
|
|
|
sums[index] += ' 元'; |
|
|
|
} else { |
|
|
|
sums[index] = 'N/A'; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
changeNum(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'count', value) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
changesupplier_id(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'supplier_id', value) |
|
|
|
}) |
|
|
|
this.$set(this.dataObj, 'supplier_id', value) |
|
|
|
} |
|
|
|
}, |
|
|
|
changeNote(value) { |
|
|
|
if (this.type == 'add') { |
|
|
|
this.dataObj.purchasePriceList.forEach((item) => { |
|
|
|
this.$set(item, 'customer_comments', value) |
|
|
|
}) |
|
|
|
this.$set(this.dataObj, 'customer_comments', value) |
|
|
|
} |
|
|
|
}, |
|
|
|
arraySpanMethod({row, column, rowIndex, columnIndex}) { |
|
|
|
// console.log({row, column, rowIndex, columnIndex}) |
|
|
|
if (columnIndex === 3) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else if (columnIndex === 4) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else if (columnIndex === 5) { |
|
|
|
return [this.dataObj.purchasePriceList.length, 1]; |
|
|
|
} else { |
|
|
|
return [1, 1]; |
|
|
|
} |
|
|
|
}, |
|
|
|
getAllDateCN(startTime, endTime) { |
|
|
|
var date_all = [] |
|
|
|
var i = 0 |
|
|
|
while ((endTime.getTime() - startTime.getTime()) > 0) { |
|
|
|
var year = startTime.getFullYear() |
|
|
|
var month = startTime.getMonth() + 1 |
|
|
|
var day = startTime.getDate() |
|
|
|
date_all[i] = year + '-' + month + '-' + day |
|
|
|
startTime.setDate(startTime.getDate() + 1) |
|
|
|
i += 1 |
|
|
|
} |
|
|
|
return date_all |
|
|
|
}, |
|
|
|
getSummaries(param) { |
|
|
|
const {columns, data} = param; |
|
|
|
// console.log(param) |
|
|
|
const sums = []; |
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
sums[index] = '总价'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 3) { |
|
|
|
sums[index] = '利润'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 5) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (index === 4) { |
|
|
|
let sum = data.map(item => (Number(item[columns[1].property]) * this.saleCount - 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); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + curr; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
if (index == 1) { |
|
|
|
this.dataObj.total_price = sums[index]; |
|
|
|
this.$set(this.dataObj, 'total_price', sums[index]); |
|
|
|
} |
|
|
|
if (index == 2) { |
|
|
|
this.dataObj.total_cost = sums[index]; |
|
|
|
this.$set(this.dataObj, 'total_cost', sums[index]); |
|
|
|
} |
|
|
|
if (index == 4) { |
|
|
|
this.dataObj.profit = sums[index]; |
|
|
|
this.$set(this.dataObj, 'profit', sums[index]); |
|
|
|
} |
|
|
|
sums[index] += ' 元'; |
|
|
|
} else { |
|
|
|
sums[index] = 'N/A'; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return sums; |
|
|
|
}, |
|
|
|
selectChange(item) { |
|
|
|
console.log(item) |
|
|
|
axios.get("/hotel.php/cf_room_info/getRoomList?hotelId=" + item).then((res) => { |
|
|
|
console.log(res) |
|
|
|
this.roomListOpt = res.data.list |
|
|
|
this.dataObj.room_id = ''; |
|
|
|
this.$set(this.dataObj, 'room_id', '') |
|
|
|
// this.roomListOpt = [{"id": 1, "name": "111"}] |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
roomselectChange(item) { |
|
|
|
let obj = this.roomListOpt.find((items) => { |
|
|
|
return items.id = item |
|
|
|
}) |
|
|
|
console.log(obj) |
|
|
|
this.dataObj.room_memo = obj.room_memo; |
|
|
|
this.$set(this.dataObj, 'room_memo', obj.room_memo) |
|
|
|
axios.get("/hotel.php/cf_room_plan/getList?room_id=" + item).then((res) => { |
|
|
|
console.log(res) |
|
|
|
this.roomPlan = res.data.list //取酒店价格方案 |
|
|
|
// this.roomPlan = [{"id": 1, "name": "111"}] |
|
|
|
this.dataObj.plan_id = ''; |
|
|
|
this.$set(this.dataObj, 'plan_id', '') |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
return sums; |
|
|
|
}, |
|
|
|
selectChange(item) { |
|
|
|
console.log(item) |
|
|
|
this.roomListOpt = [] |
|
|
|
axios.get("/hotel.php/cf_room_info/getRoomList?hotelId=" + item).then((res) => { |
|
|
|
console.log(res) |
|
|
|
this.roomListOpt = res.data.list |
|
|
|
this.dataObj.room_id = ''; |
|
|
|
this.$set(this.dataObj, 'room_id', '') |
|
|
|
// this.roomListOpt = [{"id": 1, "name": "111"}] |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
roomselectChange(item) { |
|
|
|
let obj = this.roomListOpt.find((items) => { |
|
|
|
return items.id == item |
|
|
|
}) |
|
|
|
console.log(obj) |
|
|
|
this.dataObjTemp.room_memo = obj.room_memo; |
|
|
|
this.roomPlan = [] |
|
|
|
axios.get("/hotel.php/cf_room_plan/getList?room_id=" + item).then((res) => { |
|
|
|
console.log(res) |
|
|
|
this.roomPlan = res.data.list //取酒店价格方案 |
|
|
|
this.dataObj.plan_id = ''; |
|
|
|
this.$set(this.dataObj, 'plan_id', '') |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
priceselectChange(item) { |
|
|
|
console.log(item) |
|
|
|
let obj = this.roomPlan.find((items) => { |
|
|
|
return items.id = item |
|
|
|
}) |
|
|
|
this.dataObj.purchase_user_id = obj.purchase_user_id; |
|
|
|
this.dataObj.plan_mome = obj.plan_mome; |
|
|
|
this.$set(this.dataObj, 'purchase_user_id', obj.purchase_user_id) |
|
|
|
this.$set(this.dataObj, 'plan_mome', obj.plan_mome) |
|
|
|
}, |
|
|
|
edit() { |
|
|
|
this.dataObjTemp.editType = 'edit'; |
|
|
|
}, |
|
|
|
save() { |
|
|
|
this.dataObjTemp.editType = 'view'; |
|
|
|
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => { |
|
|
|
console.log(res) |
|
|
|
if (res.flag) { |
|
|
|
this.$alert('提示', res.msg, { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
} |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
cancel() { |
|
|
|
this.$set(this.dataObj, 'editType', 'view'); |
|
|
|
this.$set(this, 'dataObj', this.dataObj); |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if (process.env.NODE_ENV !== 'production') { |
|
|
|
axios.defaults.baseURL = '/api' //关键代码 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
priceselectChange(item) { |
|
|
|
console.log(this.roomPlan) |
|
|
|
let obj = this.$lo.cloneDeep(this.roomPlan.find((items) => { |
|
|
|
return items.id == item |
|
|
|
})) |
|
|
|
this.dataObjTemp.plan_memo = obj.plan_memo; |
|
|
|
this.dataObj.purchase_user_id = obj.purchase_user_id; |
|
|
|
this.$set(this.dataObj, 'purchase_user_id', obj.purchase_user_id) |
|
|
|
}, |
|
|
|
edit() { |
|
|
|
this.dataObjTemp.editType = 'edit'; |
|
|
|
}, |
|
|
|
save() { |
|
|
|
this.dataObjTemp.editType = 'view'; |
|
|
|
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => { |
|
|
|
console.log(res) |
|
|
|
if (res.flag) { |
|
|
|
this.$alert('提示', res.msg, { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
} |
|
|
|
}).catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
cancel() { |
|
|
|
this.$set(this.dataObj, 'editType', 'view'); |
|
|
|
this.$set(this, 'dataObj', this.dataObj); |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if (process.env.NODE_ENV !== 'production') { |
|
|
|
axios.defaults.baseURL = '/api' //关键代码 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
.card { |
|
|
|
margin: 20px; |
|
|
|
.card { |
|
|
|
margin: 20px; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.card /deep/ .el-collapse-item__header { |
|
|
|
height: auto; |
|
|
|
} |
|
|
|
.card /deep/ .el-collapse-item__header { |
|
|
|
height: auto; |
|
|
|
} |
|
|
|
|
|
|
|
.left { |
|
|
|
text-align: left; |
|
|
|
} |
|
|
|
.left { |
|
|
|
text-align: left; |
|
|
|
} |
|
|
|
</style> |