xubinxcode 3 år sedan
förälder
incheckning
7b65e5800e
3 ändrade filer med 373 tillägg och 226 borttagningar
  1. +57
    -24
      src/components/HelloWorld.vue
  2. +181
    -111
      src/components/hotel.vue
  3. +135
    -91
      src/components/hotelother.vue

+ 57
- 24
src/components/HelloWorld.vue Visa fil

@@ -81,7 +81,8 @@
<el-row type="flex" justify="end" v-if="type=='add'">
<i class="el-icon-close" @click="delSinHotel(index)"></i>
</el-row>
<hotel :userOpt="userOpt" :supplier_idList="supplier_idList" :dataObj="item" :hotelListOpt="hotelListOpt"
<hotel :ref="'formhotel'+index" :userOpt="userOpt" :supplier_idList="supplier_idList" :dataObj="item"
:hotelListOpt="hotelListOpt"
:saleCount="saleCount"
:type="type"></hotel>
</el-card>
@@ -96,7 +97,8 @@
<el-row type="flex" justify="end" v-if="type=='add'">
<i class="el-icon-close" @click="delSinHotelOther(index)"></i>
</el-row>
<hotelother :userOpt="userOpt" :supplier_idList="supplier_idList" :dataObj="item" :cf_itemOpt="cf_itemOpt"
<hotelother :ref="'formhotelother'+index" :userOpt="userOpt" :supplier_idList="supplier_idList"
:dataObj="item" :cf_itemOpt="cf_itemOpt"
:saleCount="saleCount"
:type="type"></hotelother>
</el-card>
@@ -178,7 +180,7 @@
cost: '',
count: '',
customer_comments: '',
supplier_id: 0
supplier_id: null
}]
},
hotelList: [],
@@ -204,7 +206,7 @@
cost: '',
count: '',
customer_comments: '',
supplier_id: 0
supplier_id: null
}]
},
hotelotherList: [],
@@ -243,19 +245,42 @@
console.log('submit!');
this.$refs['form'].validate((valid) => {
if (valid) {
let data = {}
let subOrderList = [...this.hotelList, ...this.hotelotherList]
data = Object.assign({}, this.orderMain, {'subOrderList': subOrderList})
axios.post("/hotel.php/order_main/save", data).then((res) => {
this.$alert('新增成功', '提示', {
confirmButtonText: '确定',
callback: action => {
Fast.api.close()
let flagArr = []
for (let i in this.hotelList) {
console.log(this.$refs['formhotel' + i])
this.$refs['formhotel' + i][0].$refs['form'].validate((valid) => {
if (valid) {
flagArr.push('true')
} else {
flagArr.push('false')
}
});
}).catch((err) => {
console.log(err)
})
})
}
for (let i in this.hotelotherList) {
this.$refs['formhotelother' + i][0].$refs['form'].validate((valid) => {
if (valid) {
flagArr.push('true')
} else {
flagArr.push('false')
}
})
}
if (flagArr.indexOf('false') < 0) {
let data = {}
let subOrderList = [...this.hotelList, ...this.hotelotherList]
data = Object.assign({}, this.orderMain, {'subOrderList': subOrderList})
axios.post("/hotel.php/order_main/save", data).then((res) => {
this.$alert('新增成功', '提示', {
confirmButtonText: '确定',
callback: action => {
Fast.api.close()
}
});
}).catch((err) => {
console.log(err)
})
}

} else {
console.log('error submit!!');
return false;
@@ -267,16 +292,24 @@
save() {
this.editSingle = false;
let data = this.orderMain
axios.post("/hotel.php/order_main/save", data).then((res) => {
if (res.data.flag) {
this.$refs['form'].validate((valid) => {
if (valid) {
axios.post("/hotel.php/order_main/save", data).then((res) => {
if (res.data.flag) {

}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
} else {
console.log('error submit!!');
return false;
}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
});

},
cancel() {
this.editSingle = false;


+ 181
- 111
src/components/hotel.vue Visa fil

@@ -18,11 +18,11 @@
</div>
</el-row>
</template>
<el-form ref="form" :model="dataObj" label-width="100px" :disabled="disable">
<el-form ref="form" :model="dataObj" :rules="rules" label-width="100px" :disabled="disable">

<el-row style="margin-top: 25px;">
<el-col :span="10">
<el-form-item label="酒店名称">
<el-form-item label="酒店名称" prop="hotel_id">

<el-select style="width: 100%" v-model="dataObj.hotel_id" filterable placeholder="请选择"
@change="selectChange">
@@ -36,7 +36,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="房型名称">
<el-form-item label="房型名称" prop="room_id">
<el-select style="width: 100%" v-model="dataObj.room_id" filterable placeholder="请选择"
@change="roomselectChange">
<el-option
@@ -49,7 +49,7 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="价格方案">
<el-form-item label="价格方案" prop="plan_id">
<el-select style="width: 100%" v-model="dataObj.plan_id" filterable placeholder="请选择"
@change="priceselectChange">
<el-option
@@ -64,7 +64,7 @@
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="入离日期">
<el-form-item label="入离日期" prop="purchasePriceList">
<el-date-picker
v-model="date"
type="daterange"
@@ -76,12 +76,12 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label-width="100px" label="出游人姓名">
<el-form-item label-width="100px" label="出游人姓名" prop="customer_name">
<el-input v-model="dataObj.customer_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="确认号">
<el-form-item label="确认号" prop="confirm_no">
<el-input v-model="dataObj.confirm_no"></el-input>
</el-form-item>
</el-col>
@@ -104,36 +104,42 @@
prop="price"
label="售卖价">
<template slot-scope="scope">
<el-input-number size="small" v-model="scope.row.price"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.cost"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.count"></el-input-number>
<el-form-item prop="count">
<el-input-number size="small" :min="0" v-model="scope.row.count"
@change="changeNum"></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="supplier_id"
label="供应商">
<template slot-scope="scope">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-form-item prop="supplier_id">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id"
filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column
@@ -147,12 +153,12 @@
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label-width="100px" label="对方订单号">
<el-form-item label-width="100px" label="对方订单号" prop="trade_order_number">
<el-input v-model="dataObj.trade_order_number"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资源状态">
<el-form-item label="资源状态" prop="confirm_status">
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;">
<el-radio-button :label="1" name="未发单">未发单</el-radio-button>
<el-radio-button :label="2" name="已发单">已发单</el-radio-button>
@@ -165,7 +171,7 @@
<el-row>
<el-col :span="12">
<el-form-item label-width="100px" label="床型说明">
<el-input readonly v-model="dataObjTemp.room_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.room_memo"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -182,7 +188,7 @@
</el-col>
<el-col :span="12">
<el-form-item label-width="100px" label="价格方案说明">
<el-input readonly type="textarea" v-model="dataObjTemp.plan_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.plan_memo"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -191,10 +197,10 @@
</el-collapse>

<template v-else>
<el-form ref="form" :model="dataObj" label-width="100px" :disabled="disable">
<el-form ref="form" :model="dataObj" :rules="rules" label-width="100px" :disabled="disable">
<el-row style="margin-top: 25px;">
<el-col :span="10">
<el-form-item label="酒店名称">
<el-form-item label="酒店名称" prop="hotel_id">

<el-select style="width: 100%" v-model="dataObj.hotel_id" filterable placeholder="请选择"
@change="selectChange">
@@ -208,7 +214,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="房型名称">
<el-form-item label="房型名称" prop="room_id">
<el-select style="width: 100%" v-model="dataObj.room_id" filterable placeholder="请选择"
@change="roomselectChange">
<el-option
@@ -221,7 +227,7 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="价格方案">
<el-form-item label="价格方案" prop="plan_id">
<el-select style="width: 100%" v-model="dataObj.plan_id" filterable placeholder="请选择"
@change="priceselectChange">
<el-option
@@ -236,7 +242,7 @@
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="入离日期">
<el-form-item label="入离日期" prop="purchasePriceList">
<el-date-picker
v-model="date"
type="daterange"
@@ -249,12 +255,12 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label-width="100px" label="出游人姓名">
<el-form-item label-width="100px" label="出游人姓名" prop="customer_name">
<el-input v-model="dataObj.customer_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="确认号">
<el-form-item label="确认号" prop="confirm_no">
<el-input v-model="dataObj.confirm_no"></el-input>
</el-form-item>
</el-col>
@@ -277,36 +283,41 @@
prop="price"
label="售卖价">
<template slot-scope="scope">
<el-input-number size="small" v-model="scope.row.price"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.cost"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.count" @change="changeNum"></el-input-number>
<el-form-item prop="count">
<el-input-number size="small" :min="0" v-model="scope.row.count"
@change="changeNum"></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="supplier_id"
label="供应商">
<template slot-scope="scope">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-form-item prop="supplier_id">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column
@@ -320,12 +331,12 @@
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label-width="100px" label="对方订单号">
<el-form-item label-width="100px" label="对方订单号" prop="trade_order_number">
<el-input v-model="dataObj.trade_order_number"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资源状态">
<el-form-item label="资源状态" prop="confirm_status">
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;">
<el-radio-button :label="1" name="未发单">未发单</el-radio-button>
<el-radio-button :label="2" name="已发单">已发单</el-radio-button>
@@ -338,7 +349,7 @@
<el-row>
<el-col :span="12">
<el-form-item label-width="100px" label="床型说明">
<el-input readonly v-model="dataObjTemp.room_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.room_memo"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -355,7 +366,7 @@
</el-col>
<el-col :span="12">
<el-form-item label-width="100px" label="价格方案说明">
<el-input readonly type="textarea" v-model="dataObjTemp.plan_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.plan_memo"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -381,11 +392,41 @@
data() {
return {
dataObjTemp: this.$lo.cloneDeep(this.dataObj),
init: true,
opened: '1',
roomListOpt: [],
date: [],
roomPlan: [],
day: []
day: [],
rules: {
hotel_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
room_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
plan_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
customer_name: [
{required: true, message: '请输入', trigger: 'blur'},
],
trade_order_number: [
{required: true, message: '请输入', trigger: 'blur'},
],
confirm_status: [
{required: true, message: '请输入', trigger: 'blur'},
],
count: [
{required: true, message: '请输入', trigger: 'blur'},
],
supplier_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
purchasePriceList: [
{type: 'array', required: true, message: '请选择', trigger: 'change'},
]
},
}
},
computed: {
@@ -400,52 +441,47 @@
},
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: '',
customer_comments: '',
supplier_id: ''
})
if (val && val.length > 0) {
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: '',
customer_comments: '',
supplier_id: ''
})
}
this.dataObj.purchasePriceList = purchasePriceList;
this.$set(this.dataObj, 'purchasePriceList', purchasePriceList)
}
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)
})
}
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)
this.dataObj.supplier_id = value;
}
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'supplier_id', value)
})
// this.$set(this.dataObj, 'supplier_id', value)
this.dataObj.supplier_id = value;
},
changeNote(value) {
if (this.type == 'add') {
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'customer_comments', value)
})
this.dataObj.customer_comments = value;
// this.$set(this.dataObj, 'customer_comments', value)
}
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'customer_comments', value)
})
this.dataObj.customer_comments = value;
// this.$set(this.dataObj, 'customer_comments', value)
},
arraySpanMethod({row, column, rowIndex, columnIndex}) {
// console.log({row, column, rowIndex, columnIndex})
@@ -538,15 +574,21 @@
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)
return new Promise(resolve => {
axios.get("/hotel.php/cf_room_info/getRoomList?hotelId=" + item).then((res) => {
console.log(res)
this.roomListOpt = res.data.list
if (!this.init) {
this.dataObj.room_id = '';
this.$set(this.dataObj, 'room_id', '')
}
resolve()
// this.roomListOpt = [{"id": 1, "name": "111"}]
}).catch((err) => {
console.log(err)
})
})

},
roomselectChange(item) {
let obj = this.roomListOpt.find((items) => {
@@ -555,15 +597,19 @@
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)
return new Promise(resolve => {
axios.get("/hotel.php/cf_room_plan/getList?room_id=" + item).then((res) => {
console.log(res)
this.roomPlan = res.data.list //取酒店价格方案
if (!this.init) {
this.dataObj.plan_id = '';
this.$set(this.dataObj, 'plan_id', '')
}
resolve()
}).catch((err) => {
console.log(err)
})
})

},
priceselectChange(item) {
console.log(this.roomPlan)
@@ -579,28 +625,52 @@
// this.$set(this.dataObj, 'editType', 'edit');
},
save() {
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => {
console.log(res.data)
if (res.data.flag) {
this.dataObjTemp.editType = 'view';
this.$refs['form'].validate((valid) => {
if (valid) {
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => {
console.log(res.data)
if (res.data.flag) {
this.dataObjTemp.editType = 'view';
}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
} else {
console.log('error submit!!');
return false;
}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
});

},
cancel() {
this.dataObjTemp.editType = 'view';
this.$set(this.dataObj, 'editType', 'view');
this.$set(this, 'dataObj', this.dataObj);
this.$set(this, 'dataObj', this.dataObjTemp);
this.$refs['form'].clearValidate()
}
},
mounted() {
if (process.env.NODE_ENV !== 'production') {
axios.defaults.baseURL = '/api' //关键代码
}


if (this.dataObj.hotel_id && this.dataObj.hotel_id && this.dataObj.hotel_id) {
// let hotel_id = this.dataObj.hotel_id
// let room_id = this.dataObj.room_id
// let plan_id = this.dataObj.plan_id
this.selectChange(this.dataObj.hotel_id).then(() => {
this.roomselectChange(this.dataObj.room_id).then(() => {
// this.dataObj.hotel_id = hotel_id
// this.dataObj.room_id = room_id
// this.dataObj.plan_id = plan_id
this.init = false;
})
})
}
}
}
</script>


+ 135
- 91
src/components/hotelother.vue Visa fil

@@ -18,11 +18,11 @@
</div>
</el-row>
</template>
<el-form ref="form" :model="dataObj" label-width="100px" :disabled="disable">
<el-form ref="form" :model="dataObj" :rules="rules" label-width="100px" :disabled="disable">

<el-row style="margin-top: 25px;">
<el-col :span="10">
<el-form-item label="附加项目名称">
<el-form-item label-width="120px" label="附加项目名称" prop="item_id">
<el-select style="width: 100%" v-model="dataObj.item_id" filterable placeholder="请选择"
@change="changeItem">
<el-option
@@ -36,18 +36,18 @@
</el-col>
<el-col :span="8">
<el-form-item label="附加项目类型">
<el-input readonly v-model="dataObjTemp.item_type_name"></el-input>
<el-input disabled v-model="dataObjTemp.item_type_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计价单位">
<el-input readonly v-model="dataObjTemp.item_unit"></el-input>
<el-input disabled v-model="dataObjTemp.item_unit"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="使用日期">
<el-form-item label="使用日期" prop="purchasePriceList">
<el-col :span="11">
<el-date-picker type="date" placeholder="选择日期" v-model="check_in_date"
style="width: 100%;"></el-date-picker>
@@ -55,12 +55,12 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label-width="100px" label="出游人姓名">
<el-form-item label-width="100px" label="出游人姓名" prop="customer_name">
<el-input v-model="dataObj.customer_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="确认号">
<el-form-item label="确认号" prop="confirm_no">
<el-input v-model="dataObj.confirm_no"></el-input>
</el-form-item>
</el-col>
@@ -83,36 +83,42 @@
prop="price"
label="售卖价">
<template slot-scope="scope">
<el-input-number size="small" v-model="scope.row.price"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.cost"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.count"></el-input-number>
<el-form-item prop="count">
<el-input-number size="small" :min="0" v-model="scope.row.count"
@change="changeNum"></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="supplier_id"
label="供应商">
<template slot-scope="scope">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-form-item prop="supplier_id">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id"
filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column
@@ -126,12 +132,12 @@
</el-form-item>
<el-row>
<el-col :span="6">
<el-form-item label-width="100px" label="对方订单号">
<el-form-item label-width="100px" label="对方订单号" prop="trade_order_number">
<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="资源负责人">
<el-form-item label-width="120px" label="采购资源负责人" prop="purchase_user_id">
<el-select style="width: 100%" v-model="dataObj.purchase_user_id" filterable placeholder="请选择">
<el-option
v-for="item in userOpt"
@@ -143,7 +149,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资源状态">
<el-form-item label="资源状态" prop="confirm_status">
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;">
<el-radio-button :label="1" name="未发单">未发单</el-radio-button>
<el-radio-button :label="2" name="已发单">已发单</el-radio-button>
@@ -156,7 +162,7 @@
<el-row>
<el-col :span="24">
<el-form-item label-width="100px" label="附加项目说明">
<el-input readonly type="textarea" v-model="dataObjTemp.item_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.item_memo"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -164,10 +170,10 @@
</el-collapse-item>
</el-collapse>
<template v-else>
<el-form ref="form" :model="dataObj" label-width="100px" :disabled="disable">
<el-form ref="form" :model="dataObj" :rules="rules" label-width="100px" :disabled="disable">
<el-row style="margin-top: 25px;">
<el-col :span="10">
<el-form-item label="附加项目名称">
<el-form-item label-width="120px" label="附加项目名称" prop="item_id">
<el-select style="width: 100%" v-model="dataObj.item_id" filterable placeholder="请选择"
@change="changeItem">
<el-option
@@ -181,29 +187,29 @@
</el-col>
<el-col :span="8">
<el-form-item label="附加项目类型">
<el-input readonly v-model="dataObjTemp.item_type_name"></el-input>
<el-input disabled v-model="dataObjTemp.item_type_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计价单位">
<el-input readonly v-model="dataObjTemp.item_unit"></el-input>
<el-input disabled v-model="dataObjTemp.item_unit"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="使用日期">
<el-form-item label="使用日期" prop="purchasePriceList">
<el-date-picker type="date" placeholder="选择日期" v-model="check_in_date"
style="width: 100%;"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label-width="100px" label="出游人姓名">
<el-form-item label-width="100px" label="出游人姓名" prop="customer_name">
<el-input v-model="dataObj.customer_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="确认号">
<el-form-item label="确认号" prop="confirm_no">
<el-input v-model="dataObj.confirm_no"></el-input>
</el-form-item>
</el-col>
@@ -226,36 +232,41 @@
prop="price"
label="售卖价">
<template slot-scope="scope">
<el-input-number size="small" v-model="scope.row.price"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.cost"></el-input-number>
<el-input-number size="small" :min="0" 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 size="small" v-model="scope.row.count" @change="changeNum"></el-input-number>
<el-form-item prop="count">
<el-input-number size="small" :min="0" v-model="scope.row.count"
@change="changeNum"></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="supplier_id"
label="供应商">
<template slot-scope="scope">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-form-item prop="supplier_id">
<el-select style="width: 100%" v-model="scope.row.supplier_id" @change="changesupplier_id" filterable
placeholder="请选择">
<el-option
v-for="item in supplier_idList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column
@@ -269,12 +280,12 @@
</el-form-item>
<el-row>
<el-col :span="6">
<el-form-item label-width="100px" label="对方订单号">
<el-form-item label-width="100px" label="对方订单号" prop="trade_order_number">
<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="资源负责人">
<el-form-item label-width="120px" label="采购资源负责人" prop="purchase_user_id">
<el-select style="width: 100%" v-model="dataObj.purchase_user_id" filterable placeholder="请选择">
<el-option
v-for="item in userOpt"
@@ -286,7 +297,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资源状态">
<el-form-item label="资源状态" prop="confirm_status">
<el-radio-group v-model="dataObj.confirm_status" size="small" style="min-width: 270px;">
<el-radio-button :label="1" name="未发单">未发单</el-radio-button>
<el-radio-button :label="2" name="已发单">已发单</el-radio-button>
@@ -299,7 +310,7 @@
<el-row>
<el-col :span="24">
<el-form-item label-width="100px" label="附加项目说明">
<el-input readonly type="textarea" v-model="dataObjTemp.item_memo"></el-input>
<el-input disabled type="textarea" v-model="dataObjTemp.item_memo"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -326,7 +337,36 @@
dataObjTemp: this.$lo.cloneDeep(this.dataObj),
opened: '1',
check_in_date: '',
day: []
day: [],
rules: {
item_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
customer_name: [
{required: true, message: '请输入', trigger: 'blur'},
],
confirm_no: [
{required: true, message: '请输入', trigger: 'blur'},
],
trade_order_number: [
{required: true, message: '请输入', trigger: 'blur'},
],
purchase_user_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
confirm_status: [
{required: true, message: '请输入', trigger: 'blur'},
],
count: [
{required: true, message: '请输入', trigger: 'blur'},
],
supplier_id: [
{required: true, message: '请输入', trigger: 'blur'},
],
purchasePriceList: [
{type: 'array', required: true, message: '请输入', trigger: 'change'},
]
},
}
},
computed: {
@@ -340,20 +380,22 @@
this.dataObjTemp = this.$lo.cloneDeep(this.dataObj)
},
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: '',
customer_comments: '',
supplier_id: ''
})
this.dataObj.purchasePriceList = purchasePriceList;
this.$set(this.dataObj, 'purchasePriceList', purchasePriceList)
if (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: '',
customer_comments: '',
supplier_id: ''
})
this.dataObj.purchasePriceList = purchasePriceList;
this.$set(this.dataObj, 'purchasePriceList', purchasePriceList)
}
}
},
methods: {
@@ -366,29 +408,23 @@
this.dataObjTemp = Object.assign(this.dataObjTemp, data);
},
changeNum(value) {
if (this.type == 'add') {
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'count', value)
})
}
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.dataObj.supplier_id = value
// this.$set(this.dataObj, 'supplier_id', value)
}
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'supplier_id', value)
})
this.dataObj.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.dataObj.customer_comments = value
// this.$set(this.dataObj, 'customer_comments', value)
}
this.dataObj.purchasePriceList.forEach((item) => {
this.$set(item, 'customer_comments', value)
})
this.dataObj.customer_comments = value
// this.$set(this.dataObj, 'customer_comments', value)
},
arraySpanMethod({row, column, rowIndex, columnIndex}) {
// console.log({row, column, rowIndex, columnIndex})
@@ -476,22 +512,30 @@
this.dataObjTemp.editType = 'edit';
},
save() {
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => {
console.log(res)
if (res.data.flag) {
this.dataObjTemp.editType = 'view';
this.$refs['form'].validate((valid) => {
if (valid) {
axios.post("/hotel.php/order_main/subOrderSave", this.dataObj).then((res) => {
console.log(res)
if (res.data.flag) {
this.dataObjTemp.editType = 'view';
}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
} else {
console.log('error submit!!');
return false;
}
this.$alert(res.data.msg, '提示', {
confirmButtonText: '确定',
});
}).catch((err) => {
console.log(err)
})
});
},
cancel() {
this.dataObjTemp.editType = 'view';
this.$set(this.dataObj, 'editType', 'view');
this.$set(this, 'dataObj', this.dataObj);
this.$set(this, 'dataObj', this.dataObjTemp);
this.$refs['form'].clearValidate()
}
},
mounted() {


Laddar…
Avbryt
Spara