Browse Source

init

master
xubinxcode 3 years ago
parent
commit
48ee6d4066
3 changed files with 181 additions and 101 deletions
  1. +118
    -87
      src/components/HelloWorld.vue
  2. +32
    -7
      src/components/hotel.vue
  3. +31
    -7
      src/components/hotelother.vue

+ 118
- 87
src/components/HelloWorld.vue View File

@@ -1,83 +1,100 @@
<template>
<el-form ref="form" :model="orderMain" label-width="100px">

<el-row>
<el-col :span="12">
<el-form-item label="订单专员">
<el-input v-model="orderMain.commissioner"></el-input>
</el-form-item>
</el-col>
<el-col :span="12"></el-col>
<div>
<el-collapse v-model="active">
<el-collapse-item name="1">
<template slot="title">
<el-row type="flex" justify="space-between" style="padding: 0 30px">
<el-button type="text">基本信息</el-button>
<el-button @click="editSingle=true" v-show="type=='view'&&!editSingle">修改</el-button>
<el-button v-show="editSingle" @click="save">保存</el-button>
<el-button v-show="editSingle" @click="cancel">取消</el-button>
</el-row>
</template>
<el-form label-width="100px" :disabled="disable">
<el-row>
<el-col :span="12">
<el-form-item label="订单专员">
<el-input v-model="orderMain.commissioner"></el-input>
</el-form-item>
</el-col>
<el-col :span="12"></el-col>

</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="订单渠道">
<el-select style="width: 100%" v-model="orderMain.channel_id" filterable placeholder="请选择"
@change="selectChange">
<el-option
v-for="item in channelListOpt"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="渠道订单编号">
<el-input v-model="orderMain.channel_order_no"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="订单渠道">
<el-select style="width: 100%" v-model="orderMain.channel_id" filterable placeholder="请选择"
@change="selectChange">
<el-option
v-for="item in channelListOpt"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="渠道订单编号">
<el-input v-model="orderMain.channel_order_no"></el-input>
</el-form-item>
</el-col>

</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户姓名">
<el-input v-model="orderMain.user_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户电话">
<el-input v-model="orderMain.user_phone"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户姓名">
<el-input v-model="orderMain.user_name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户电话">
<el-input v-model="orderMain.user_phone"></el-input>
</el-form-item>
</el-col>

</el-row>
<el-form-item label="备注">
<el-input type="textarea" v-model="orderMain.order_memo"></el-input>
</el-form-item>
<el-form-item>
<el-row type="flex">
<el-button type="primary" @click="addHotel">添加酒店</el-button>
</el-row>
</el-form-item>
<template v-for="(item,index) in hotelList">
<el-card class="card" shadow="hover" :key="'hotel'+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" :saleCount="saleCount" :type="type"></hotel>
</el-card>
</el-row>
<el-form-item label="备注">
<el-input type="textarea" v-model="orderMain.order_memo"></el-input>
</el-form-item>
</el-form>

</template>
<el-form-item>
<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,index) in hotelotherList">
<el-card class="card" shadow="hover" :key="'hotelother'+index">
<el-row type="flex" justify="end" v-if="type=='add'">
<i class="el-icon-close" @click="delSinHotelOther(index)"></i>
</el-collapse-item>
</el-collapse>
<el-form ref="form" :model="orderMain">
<el-form-item>
<el-row type="flex" style="margin-top: 20px">
<el-button type="primary" @click="addHotel">添加酒店</el-button>
</el-row>
</el-form-item>
<template v-for="(item,index) in hotelList">
<el-card class="card" shadow="hover" :key="'hotel'+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" :saleCount="saleCount" :type="type"></hotel>
</el-card>
</template>
<el-form-item>
<el-row type="flex" style="margin-top: 20px">
<el-button type="primary" @click="addHotelOther">添加附加项目</el-button>
</el-row>
<hotelother :dataObj="item" :saleCount="saleCount" :type="type"></hotelother>
</el-card>
</template>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交订单</el-button>
</el-form-item>
</el-form>
</el-form-item>
<template v-for="(item,index) in hotelotherList">
<el-card class="card" shadow="hover" :key="'hotelother'+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" :saleCount="saleCount" :type="type"></hotelother>
</el-card>
</template>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交订单</el-button>
</el-form-item>
</el-form>
</div>


</template>
<script>
@@ -92,8 +109,10 @@
},
data() {
return {
type: window.id ? 'edit' : 'add',
active: '1',
type: window.id ? 'view' : 'add',
saleCount: 1,
editSingle: false,
orderMain: {
commissioner: '订单专员',
channel_id: '订单渠道',
@@ -102,6 +121,7 @@
user_phone: "111111111111",
order_memo: "备注",
},
orderMainCopy: {},
hotelListObj: {
hotel_id: '酒店名称',
room_id: '房型名称',
@@ -156,6 +176,11 @@
channelListOpt: [],
}
},
computed: {
disable() {
return !(this.type == 'add' || this.editSingle)
}
},
methods: {
selectChange(val) {
this.saleCount = this.channelListOpt.filter((item) => item.id == val)//佣金比例
@@ -185,6 +210,24 @@
}).catch((err) => {
console.log(err)
})
},
save() {
this.editSingle = false;
let data = this.orderMain
axios.post("/hotel.php/order_main/save", data).then((res) => {
console.log(res)
if (res.flag) {
this.$alert('提示', res.msg, {
confirmButtonText: '确定',
});
}
}).catch((err) => {
console.log(err)
})
},
cancel() {
this.editSingle = false;
this.orderMain = this.orderMainCopy
}
},
mounted() {
@@ -200,19 +243,6 @@
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)
})
@@ -224,6 +254,7 @@
let orderMain = this.$lo.cloneDeep(res.data)
delete orderMain.subOrderList
this.orderMain = orderMain
this.orderMainCopy = this.$lo.cloneDeep(orderMain)
this.hotelList = res.data.subOrderList.filter((item) => item.hotel_id)
this.hotelotherList = res.data.subOrderList.filter((item) => item.item_id)
}


+ 32
- 7
src/components/hotel.vue View File

@@ -1,6 +1,6 @@
<template>
<el-form ref="form" :model="dataObj" label-width="100px">
<el-collapse v-if="type=='edit'">
<el-collapse v-if="type=='view'">
<el-collapse-item>
<template slot="title">
<el-row style="width:100%;margin-top:10px;margin-bottom:10px;padding-right: 20px;" type="flex"
@@ -12,9 +12,9 @@
<!-- <el-button>增补采购单</el-button>-->
<!-- </el-col>-->
<el-col :span="8">
<el-button>修改</el-button>
<el-button>保存</el-button>
<el-button>取消</el-button>
<el-button @click="editSingle=true" v-show="type=='view'&&!editSingle">修改</el-button>
<el-button v-show="editSingle" @click="save">保存</el-button>
<el-button v-show="editSingle" @click="cancel">取消</el-button>
</el-col>
</el-row>
</template>
@@ -314,9 +314,20 @@
name: "hotel",
props: {type: String, saleCount: Number, dataObj: Object, hotelListOpt: Array},
data() {
return {confirm_status: '未发单', roomListOpt: [], date: [], day: []}
return {
dataObjCopy: this.$lo.cloneDeep(this.dataObj),
confirm_status: '未发单',
roomListOpt: [],
date: [],
editSingle: false,
day: []
}
},
watch: {
dataObj(val) {
console.log('change')
this.dataObjCopy = this.$lo.cloneDeep(this.dataObj)
},
confirm_status(val) {
let type = '';
switch (val) {
@@ -477,8 +488,22 @@
console.log(err)
})
},
onSubmit() {
console.log('submit!');
save() {
this.editSingle = false;
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.editSingle = false;
this.$set(this, 'dataObj', this.orderMainCopy);
}
},
mounted() {


+ 31
- 7
src/components/hotelother.vue View File

@@ -1,6 +1,6 @@
<template>
<el-form ref="form" :model="dataObj" label-width="100px">
<el-collapse v-if="type=='edit'">
<el-collapse v-if="type=='view'">
<el-collapse-item>
<template slot="title">
<el-row style="width:100%;margin-top:10px;margin-bottom:10px;padding-right: 20px;" type="flex"
@@ -12,9 +12,9 @@
<!-- <el-button>增补采购单</el-button>-->
<!-- </el-col>-->
<el-col :span="8">
<el-button>修改</el-button>
<el-button>保存</el-button>
<el-button>取消</el-button>
<el-button @click="editSingle=true" v-show="type=='view'&&!editSingle">修改</el-button>
<el-button v-show="editSingle" @click="save">保存</el-button>
<el-button v-show="editSingle" @click="cancel">取消</el-button>
</el-col>
</el-row>
</template>
@@ -266,9 +266,19 @@
name: "hotelother",
props: {type: String, saleCount: Number, dataObj: Object},
data() {
return {confirm_status: '未发单', check_in_date: '', day: []}
return {
dataObjCopy: this.$lo.cloneDeep(this.dataObj),
confirm_status: '未发单',
check_in_date: '',
editSingle: false,
day: []
}
},
watch: {
dataObj(val) {
console.log('change')
this.dataObjCopy = this.$lo.cloneDeep(this.dataObj)
},
confirm_status(val) {
let type = '';
switch (val) {
@@ -408,8 +418,22 @@

return sums;
},
onSubmit() {
console.log('submit!');
save() {
this.editSingle = false;
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.editSingle = false;
this.$set(this, 'dataObj', this.orderMainCopy);
}
},
mounted() {


Loading…
Cancel
Save