diff --git a/package-lock.json b/package-lock.json
index 5845af5..3e4c523 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5400,8 +5400,7 @@
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.camelcase": {
"version": "4.3.0",
diff --git a/package.json b/package.json
index a7cfe4c..375a0f9 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"dependencies": {
"axios": "^0.23.0",
"element-ui": "^2.15.6",
+ "lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"vue": "^2.5.2"
},
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
index 99318da..1070878 100644
--- a/src/components/HelloWorld.vue
+++ b/src/components/HelloWorld.vue
@@ -13,7 +13,8 @@
-
+
-
+
@@ -70,7 +71,7 @@
-
+
@@ -91,7 +92,8 @@
},
data() {
return {
- type: window.type,
+ type: window.id ? 'edit' : 'add',
+ saleCount: 1,
orderMain: {
commissioner: '订单专员',
channel_id: '订单渠道',
@@ -109,14 +111,14 @@
customer_name: '出游人姓名',
confirm_no: '123456',
trade_order_number: '123456',
- confirm_status: '未发单',
+ confirm_status: '1',
room_memo: '床型说明',
res_person: '资源负责人',
plan_memo: '价格方案说明',
total_price: '总金额',
total_cost: '成本价',
profit: '利润',
- tableData: [{
+ purchasePriceList: [{
run_date: '请选择日期',
price: '',
cost: '',
@@ -130,17 +132,17 @@
item_type: '附加项目类型',
item_name: '附加项目名称',
item_unit: '计价单位',
- use_date: '',
+ check_in_date: '',
customer_name: '出游人姓名',
confirm_no: '123456',
trade_order_number: '123456',
res_person: '资源负责人',
- confirm_status: '未发单',
+ confirm_status: '1',
item_memo: '附加项目说明',
total_price: '总金额',
total_cost: '成本价',
profit: '利润',
- tableData: [{
+ purchasePriceList: [{
run_date: '请选择日期',
price: '',
cost: '',
@@ -155,6 +157,11 @@
}
},
methods: {
+ selectChange(val) {
+ this.saleCount = this.channelListOpt.filter((item) => item.id == val)//佣金比例
+ this.saleCount = Number(this.saleCount.commission_rate) || 1//佣金比例
+ console.log(this.saleCount)
+ },
addHotel() {
this.hotelList.push(JSON.parse(JSON.stringify(this.hotelListObj)))
},
@@ -170,11 +177,10 @@
onSubmit() {
console.log('submit!');
// axios.post("/hotel.php/order_main/newAdd?id=1", {}).then((res) => {
- axios.post("/hotel.php/order_main/newAdd?id=1", {
- orderMain: this.orderMain, //基础数据
- hotel: this.hotelList, //酒店
- item: this.hotelotherList //酒店附加数据
- }).then((res) => {
+ let data = {}
+ let subOrderList = [...this.hotelList, ...this.hotelotherList]
+ data = Object.assign({}, this.orderMain, {'subOrderList': subOrderList})
+ axios.post("/hotel.php/order_main/newAdd?id=1", data).then((res) => {
console.log(res)
}).catch((err) => {
console.log(err)
@@ -194,9 +200,38 @@
axios.get("/hotel.php/cf_channel_info/getList").then((res) => {
console.log(res)
this.channelListOpt = res.data.list
+ // this.channelListOpt = [{"id": 1, "name": "测试飞猪"}, {"id": 2, "name": "【昊瀚】飞猪日历房"}, {
+ // "id": 3,
+ // "name": "【昊瀚】飞猪套餐"
+ // }, {"id": 4, "name": "【水汪清】携程"}, {"id": 5, "name": "【昊瀚】美团大众"}, {"id": 6, "name": "【守则固】携程"}, {
+ // "id": 7,
+ // "name": "【守则固】同程艺龙"
+ // }, {"id": 8, "name": "【守则固】途牛"}, {"id": 9, "name": "【水汪清】去哪儿"}, {
+ // "id": 10,
+ // "name": "【昊瀚】小红书"
+ // }, {"id": 11, "name": "【冲抵】唯途"}, {"id": 12, "name": "【昊瀚】淘1站"}, {"id": 13, "name": "【昊瀚】线下"}, {
+ // "id": 14,
+ // "name": "【水汪清】浪客行"
+ // }, {"id": 15, "name": "【毛木宁】日历房"}, {"id": 16, "name": "【毛木宁】套餐"}]
}).catch((err) => {
console.log(err)
})
+ console.log(this.type)
+ if (this.type != 'add') {
+ axios.post("/hotel.php/order_main/getShowInfo", {id: window.id}).then((res) => {
+ console.log(res)
+ if (res.flag) {
+ let orderMain = this.$lo.cloneDeep(res.data)
+ delete orderMain.subOrderList
+ this.orderMain = orderMain
+ this.hotelList = res.data.subOrderList.filter((item) => item.hotel_id)
+ this.hotelotherList = res.data.subOrderList.filter((item) => item.item_id)
+ }
+ // this.channelListOpt = res.data.list
+ }).catch((err) => {
+ console.log(err)
+ })
+ }
}
}
diff --git a/src/components/hotel.vue b/src/components/hotel.vue
index 359f77c..4a6748d 100644
--- a/src/components/hotel.vue
+++ b/src/components/hotel.vue
@@ -76,7 +76,7 @@
-
+
@@ -219,7 +219,7 @@
-
+
@@ -312,11 +312,29 @@
export default {
name: "hotel",
- props: {dataObj: Object, hotelListOpt: Array},
+ props: {type: String, saleCount: Number, dataObj: Object, hotelListOpt: Array},
data() {
- return {type: window.type, roomListOpt: [], date: [], day: []}
+ return {confirm_status: '未发单', roomListOpt: [], date: [], day: []}
},
watch: {
+ 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])
@@ -324,9 +342,9 @@
let date1 = new Date(val[0]);
let date2 = new Date(val[1]);
let day = this.getAllDateCN(date1, date2)
- let tableData = [];
+ let purchasePriceList = [];
for (let item of day) {
- tableData.push({
+ purchasePriceList.push({
run_date: item,
price: '',
cost: '',
@@ -335,29 +353,29 @@
provider: ''
})
}
- this.dataObj.tableData = tableData;
- this.$set(this.dataObj, 'tableData', tableData)
+ this.dataObj.purchasePriceList = purchasePriceList;
+ this.$set(this.dataObj, 'purchasePriceList', purchasePriceList)
}
},
methods: {
changeNum(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'count', value)
})
}
},
changeProvider(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'provider', value)
})
}
},
changeNote(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'note', value)
})
}
@@ -365,11 +383,11 @@
arraySpanMethod({row, column, rowIndex, columnIndex}) {
// console.log({row, column, rowIndex, columnIndex})
if (columnIndex === 3) {
- return [this.dataObj.tableData.length, 1];
+ return [this.dataObj.purchasePriceList.length, 1];
} else if (columnIndex === 4) {
- return [this.dataObj.tableData.length, 1];
+ return [this.dataObj.purchasePriceList.length, 1];
} else if (columnIndex === 5) {
- return [this.dataObj.tableData.length, 1];
+ return [this.dataObj.purchasePriceList.length, 1];
} else {
return [1, 1];
}
@@ -404,7 +422,7 @@
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]));
+ 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);
diff --git a/src/components/hotelother.vue b/src/components/hotelother.vue
index 4699130..8a28118 100644
--- a/src/components/hotelother.vue
+++ b/src/components/hotelother.vue
@@ -1,142 +1,23 @@
-
-
-
-
-
-
- {{'附加项目'}}
-
-
-
-
-
- 修改
- 保存
- 取消
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ {{'附加项目'}}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ 修改
+ 保存
+ 取消
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataObj.res_person}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataObj.item_memo}}
-
-
-
-
-
-
+
@@ -158,7 +39,7 @@
-
@@ -176,11 +57,10 @@
-
+
-
+
-
+
@@ -238,7 +118,7 @@
-
+
@@ -254,8 +134,128 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{dataObj.res_person}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{dataObj.item_memo}}
+
+
+
+
+
@@ -264,51 +264,64 @@
export default {
name: "hotelother",
- props: {dataObj: Object},
+ props: {type: String, saleCount: Number, dataObj: Object},
data() {
- return {type: window.type,date: [], day: []}
+ return {confirm_status: '未发单', check_in_date: '', day: []}
},
watch: {
- 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 tableData = [];
- for (let item of day) {
- tableData.push({
- run_date: item,
- price: '',
- cost: '',
- count: '',
- note: '',
- provider: ''
- })
+ confirm_status(val) {
+ let type = '';
+ switch (val) {
+ case "未发单":
+ type = '1'
+ break;
+ case "已发单":
+ type = '2'
+ break;
+ case "已确认":
+ type = '3'
+ break;
+ case "已取消":
+ type = '4'
+ break;
}
- this.dataObj.tableData = tableData;
- this.$set(this.dataObj, 'tableData', tableData)
+ this.$set(this.dataObj, "confirm_status", type)
+ },
+ check_in_date(val) {
+ let time = this.getAllDateCN(val)
+ console.log(time)
+ this.$set(this.dataObj, "check_in_date", time)
+ let purchasePriceList = [];
+ purchasePriceList.push({
+ run_date: time,
+ price: '',
+ cost: '',
+ count: '',
+ note: '',
+ provider: ''
+ })
+ this.dataObj.purchasePriceList = purchasePriceList;
+ this.$set(this.dataObj, 'purchasePriceList', purchasePriceList)
}
},
methods: {
changeNum(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'count', value)
})
}
},
changeProvider(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'provider', value)
})
}
},
changeNote(value) {
if (this.type == 'add') {
- this.dataObj.tableData.forEach((item) => {
+ this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'note', value)
})
}
@@ -316,26 +329,21 @@
arraySpanMethod({row, column, rowIndex, columnIndex}) {
// console.log({row, column, rowIndex, columnIndex})
if (columnIndex === 3) {
- return [this.dataObj.tableData.length, 1];
+ return [this.dataObj.purchasePriceList.length, 1];
} else if (columnIndex === 4) {
- return [this.dataObj.tableData.length, 1];
+ return [this.dataObj.purchasePriceList.length, 1];
} else if (columnIndex === 5) {
- return [this.dataObj.tableData.length, 1];
+ 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
- }
+ getAllDateCN(Time) {
+ let date_all = ''
+ let year = Time.getFullYear()
+ let month = Time.getMonth() + 1
+ let day = Time.getDate()
+ date_all = year + '-' + month + '-' + day
return date_all
},
getSummaries(param) {
@@ -354,7 +362,7 @@
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]));
+ 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);
diff --git a/src/main.js b/src/main.js
index a89d907..87df4d5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,6 +2,7 @@
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
+import lo from 'lodash'
import {
// Pagination,
// Dialog,
@@ -166,7 +167,7 @@ Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
Vue.config.productionTip = false
-
+Vue.prototype.$lo = lo
/* eslint-disable no-new */
new Vue({
el: '#app',