Bläddra i källkod

修改机票部分代码

yuanrf 1 år sedan
förälder
incheckning
6041005927
2 ändrade filer med 153 tillägg och 60 borttagningar
  1. 11 4
      src/components/OP/AirTicketRes.vue
  2. 142 56
      src/components/OP/OpAirTicketRes.vue

+ 11 - 4
src/components/OP/AirTicketRes.vue

@@ -46,11 +46,11 @@
                     </el-table-column>
                     <el-table-column prop="cTypeName" label="舱位类型" width="100">
                     </el-table-column>
-                    <el-table-column prop="flightDescription" label="航班简述" width="500">
+                    <el-table-column prop="flightDescription" label="航班简述" width="600">
                     </el-table-column>
                     <el-table-column prop="clientNameStr" label="客人名单" width="280">
                     </el-table-column>
-                    <el-table-column prop="clientNum" label="客人人数" width="100">
+                    <el-table-column prop="clientNum" label="客人人数">
                     </el-table-column>
                     <el-table-column prop="prePrice,preCurrencyStr" label="机票单价" width="120" sortable>
                         <template slot-scope="scope">
@@ -70,9 +70,10 @@
                             <span v-else>自动审核通过</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="操作">
+                    <el-table-column label="操作" :width="'80px'">
                         <template slot-scope="scope">
                             <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
+                            <div style="height: 8px;"></div>
                             <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
                         </template>
                     </el-table-column>
@@ -131,7 +132,13 @@ export default {
                 if (res.data.code == 200) {
                     that.AirTicketResSelectData = res.data.data.groupName;
                     if (that.AirTicketResSelectData.length != 0) {
-                        that.DiId = that.AirTicketResSelectData[0].id;
+                        debugger;
+                        var diid = that.$route.query.DiId;
+                        if (diid) {
+                            that.DiId = parseInt(diid);
+                        } else {
+                            that.DiId = that.AirTicketResSelectData[0].id;
+                        }
                         that.AirTicketResList()
                     }
 

+ 142 - 56
src/components/OP/OpAirTicketRes.vue

@@ -70,18 +70,22 @@
                             </el-select>
                         </el-form-item>
                     </div>
-                    <div style="width: 25%;">
-                        <el-form-item label="机票单价:" prop="prePrice" label-width="160px">
-                            <el-input placeholder="机票单价" v-model="airTicketResOpData.prePrice" style="width: 58%;"
-                                @input="peiceinput">
-                            </el-input>
-                            <el-select v-model="airTicketResOpData.preCurrency" style="width: 35%;"
-                                @change="currencyChange">
-                                <el-option key="48" label="CNY" :value="48"></el-option>
-                                <el-option key="49" label="USD" :value="49"></el-option>
-                                <el-option key="51" label="EUR" :value="51"></el-option>
-                            </el-select>
-                        </el-form-item>
+                    <div style="width: 25%;display: flex;">
+                        <div style="width: 72%;">
+                            <el-form-item label="机票单价:" prop="prePrice" label-width="160px">
+                                <el-input placeholder="机票单价" v-model="airTicketResOpData.prePrice" @input="peiceinput">
+                                </el-input>
+                            </el-form-item>
+                        </div>
+                        <div style="width: 28%;">
+                            <el-form-item prop="preCurrency" label-width="5px">
+                                <el-select v-model="airTicketResOpData.preCurrency" @change="currencyChange"
+                                    placeholder="币种">
+                                    <el-option v-for="item in rateList" :key="item.currencyId" :label="item.currencyCode"
+                                        :value="item.currencyId"></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </div>
                     </div>
                     <div style="width: 25%;">
                         <el-form-item label="机票总价:" prop="price" label-width="160px">
@@ -89,9 +93,8 @@
                                 :disabled="true">
                             </el-input>
                             <el-select v-model="airTicketResOpData.currency" style="width: 40%;" :disabled="true">
-                                <el-option key="48" label="CNY" :value="48"></el-option>
-                                <el-option key="49" label="USD" :value="49"></el-option>
-                                <el-option key="51" label="EUR" :value="51"></el-option>
+                                <el-option v-for="item in rateList" :key="item.currencyId" :label="item.currencyCode"
+                                    :value="item.currencyId"></el-option>
                             </el-select>
                         </el-form-item>
                     </div>
@@ -154,8 +157,7 @@
                         <el-form-item label="此舱位客人名称:" prop="clientName" label-width="160px">
                             <el-select v-model="airTicketResOpData.clientName" placeholder="此舱位客人名称" multiple clearable
                                 filterable @change="clientNamechange">
-                                <el-option v-for="item in clientNameId" :key="item.id"
-                                    :label="item.pinyin + '(' + item.name + ')'" :value="item.id">
+                                <el-option v-for="item in fliterClient" :key="item.id" :label="item.name" :value="item.id">
                                 </el-option>
                             </el-select>
                         </el-form-item>
@@ -266,9 +268,8 @@
                                 :disabled="true">
                             </el-input>
                             <el-select v-model="cardPaymentOpData.paymentCurrency" style="width: 45%;" :disabled="true">
-                                <el-option key="48" label="CNY" :value="48"></el-option>
-                                <el-option key="49" label="USD" :value="49"></el-option>
-                                <el-option key="51" label="EUR" :value="51"></el-option>
+                                <el-option v-for="item in rateList" :key="item.currencyId" :label="item.currencyCode"
+                                    :value="item.currencyId"></el-option>
                             </el-select>
                         </el-form-item>
                     </div>
@@ -390,9 +391,7 @@
                 <el-form-item>
                     <div style="margin-left: 60%;">
                         <el-button type="primary" @click="addBtn">保存</el-button>
-                        <router-link to='/home/AirTicketRes'>
-                            <el-button>取消</el-button>
-                        </router-link>
+                        <el-button @click="back()">取消</el-button>
                     </div>
                 </el-form-item>
             </el-form>
@@ -422,11 +421,14 @@ export default {
                     { required: true, message: '请输入城市', trigger: ['blur', 'change'] },
                 ],
                 clientName: [
-                    { type: "array", required: true, message: '请选择责任人', trigger: ['blur', ['blur', 'change']] }
+                    { type: "array", required: true, message: '请选择责任人', trigger: ['blur', 'change'] }
                 ],
                 flightsDescription: [
                     { required: true, message: '请严格遵守格式,正确填写', trigger: ['blur', 'change'] },
                 ],
+                preCurrency: [
+                    { required: true, message: '请选择币种', trigger: ['blur', 'change'] }
+                ]
             },
             cardPaymentRules: {
                 payDId: [
@@ -468,9 +470,9 @@ export default {
                 diId: 0,
                 cType: 460,
                 prePrice: 0,
-                preCurrency: 48,
+                preCurrency: '',
                 price: 0,
-                currency: 48,
+                currency: '',
                 clientNum: 0,
                 clientName: [],
                 isCheckIn: 0,
@@ -498,7 +500,7 @@ export default {
                 bankNo: '',
                 cardholderName: 'Zhang Hailin',
                 payMoney: 0,
-                paymentCurrency: 48,
+                paymentCurrency: '',
                 companyBankNo: '',
                 otherBankName: '',
                 otherSideNo: '',
@@ -513,6 +515,7 @@ export default {
                 remark: ''
             },
             IsAuditGM: 0,
+            rateList: [],
         }
     },
     methods: {
@@ -522,8 +525,9 @@ export default {
             this.cardPaymentOpData.payMoney = parseFloat(parseFloat(this.airTicketResOpData.prePrice) * parseFloat(this.airTicketResOpData.clientNum)).toFixed(2)
             this.cardPaymentOpData.payThenMoney = this.cardPaymentOpData.payMoney
             this.airTicketResOpData.price = parseFloat(parseFloat(this.airTicketResOpData.prePrice) * parseFloat(this.airTicketResOpData.clientNum)).toFixed(2)
+            console.log('airTicketResOpData.clientName', this.airTicketResOpData.clientName);
         },
-        //团组下拉框
+        //团组下拉框(下拉列表加载)
         AirTicketResSelect() {
             var url = "/api/Groups/AirTicketResSelect"
             var that = this
@@ -538,21 +542,24 @@ export default {
                 }
             }).then(function (res) {
                 if (res.data.code == 200) {
-                    that.AirTicketResSelectData = res.data.data.groupName;
+
+                    that.AirTicketResSelectData = res.data.data.groupName; //团组下拉列表
                     that.ticketClass = res.data.data.ticketClass;//舱位下拉框
                     that.payment = res.data.data.payment;//支付方式下拉框
                     that.cardType = res.data.data.cardType;//卡类型下拉框
                     that.airTicketAgents = res.data.data.airTicketAgents//合作方资料下拉框
-                    that.DiIdSelect = parseInt(that.DiId)
-                    that.QueryTankType();
+                    that.DiIdSelect = parseInt(that.DiId); //选中团组
+                    //that.QueryTankType();
                 }
 
             })
         },
+        //团组切换
         AirTicketResChange() {
             this.AirTicketResList();
+            this.QueryClient();
         },
-
+        //团组基础信息以及成本信息
         AirTicketResList() {
             var url = "/api/Groups/AirTicketResList"
             var that = this
@@ -565,7 +572,7 @@ export default {
                 data: {
                     userId: that.userId,
                     portType: 1,
-                    diId: that.DiIdSelect
+                    diId: this.DiIdSelect ? this.DiIdSelect : this.DiId
                 }
             }).then(function (res) {
                 if (res.data.code == 200) {
@@ -576,6 +583,7 @@ export default {
             })
 
         },
+        //(弃用 仓类型加载客户名单)
         QueryTankType() {
             var url = "/api/Groups/tankType"
             var that = this
@@ -597,7 +605,7 @@ export default {
             })
         },
         tankTypeChange() {
-            this.QueryTankType();
+            //this.QueryTankType();
         },
         //点击保存事件
         addBtn() {
@@ -640,7 +648,7 @@ export default {
                 Promise.all(resultArr).then(values => {
 
 
-                    that.airTicketResOpData.diId = parseInt(that.DiId);
+                    that.airTicketResOpData.diId = parseInt(that.DiIdSelect);
                     that.airTicketResOpData.createUserId = that.userId;
                     var clientNameStr = ''
                     that.airTicketResOpData.clientName.forEach(function (item) {
@@ -648,7 +656,7 @@ export default {
                     });
                     that.airTicketResOpData.clientName = clientNameStr.substring(0, clientNameStr.length - 1)
                     that.cardPaymentOpData.createUserId = that.userId;
-                    that.cardPaymentOpData.diId = parseInt(that.DiId);
+                    that.cardPaymentOpData.diId = parseInt(that.DiIdSelect);
                     if (that.cardPaymentOpData.ctdId == '') {
                         that.cardPaymentOpData.ctdId = 0;
                     }
@@ -671,32 +679,29 @@ export default {
                                 type: 'success'
                             });
                             that.loading = true;
-                            var ss = that.airTicketResOpData.clientName.split(',')
-                            that.airTicketResOpData.clientName = [];
-                            ss.forEach(function (item) {
-                                that.airTicketResOpData.clientName.push(parseInt(item))
-                            });
+                            console.log('that.airTicketResOpData.clientName', that.airTicketResOpData.clientName)
                             setTimeout(() => {
-                                that.$router.push('/home/AirTicketRes')
-                            }, 3000);
+                                that.back();
+                            }, 1000);
                         } else {
+                            that.$message.error(res.data.msg);
+                        }
+                    }).catch(function (error) { // 此时必填完成,做保存后的业务操作
+                        console.log(error)
+
+                    }).finally(() => {
+                        if (that.airTicketResOpData.clientName.indexOf(',') != -1) {
                             var ss = that.airTicketResOpData.clientName.split(',')
                             that.airTicketResOpData.clientName = [];
                             ss.forEach(function (item) {
                                 that.airTicketResOpData.clientName.push(parseInt(item))
                             });
-                            that.$message.error(res.data.msg);
                         }
-                    }).catch(function (error) {
-                        console.log(error)
-                    })// 此时必填完成,做保存后的业务操作
+                        console.log('run finally code');
+                    })
 
-                }).catch(_ => {
-                    var ss = this.airTicketResOpData.clientName.split(',')
-                    this.airTicketResOpData.clientName = [];
-                    ss.forEach(function (item) {
-                        that.airTicketResOpData.clientName.push(parseInt(item))
-                    });
+                }).catch(err => {
+                    console.log("err", err.message);
                     this.$message.error('请完善信息在保存!');
                     return false;
                 })
@@ -914,7 +919,7 @@ export default {
                         return 0;
                     }
                 }
-                debugger
+
                 dateTime = dateTime.sort(compare);
                 that.airTicketResOpData.flightsTime = dateTime[0].time
                 that.airTicketResOpData.flightsDate = dateTime[0].date
@@ -975,6 +980,59 @@ export default {
             }
 
         },
+        //加载团组客户名单
+        QueryClient() {
+            var url = "/api/Groups/QueryClientInfoByDIID"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    diid: this.DiIdSelect ? this.DiIdSelect : this.DiId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    //客户名单
+                    console.log(res.data.data);
+                    that.clientNameId = res.data.data;
+                }
+            })
+        },
+        back() {
+            this.$router.push({
+                path: "/home/AirTicketRes",
+                query: {
+                    DiId: this.DiIdSelect ? this.DiIdSelect : this.DiId,
+                }
+            })
+        },
+        QueryRate() {
+            var url = "/api/Business/PostGroupTeamRateByDiIdAndCTableId"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    "portType": 1,
+                    "diId": this.DiIdSelect ? this.DiIdSelect : this.DiId,
+                    "cTable": 85
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    //汇率
+                    console.log("汇率--", res.data.data);
+                    that.rateList = res.data.data.teamRates;
+                }
+            })
+
+
+        }
 
     },
 
@@ -985,16 +1043,44 @@ export default {
 
         this.id = this.$route.query.id
         this.DiId = this.$route.query.DiId
-        this.AirTicketResSelect()
+        this.QueryRate(); //团组机票汇率
+        this.AirTicketResSelect(); //加载所有下拉框
+        this.QueryClient(); //加载客户名单
+        this.AirTicketResList();//加载团组基础信息以及成本信息
         var that = this
         if (that.DiId != undefined && that.id != undefined) {
             that.status = 2;
             that.isShow = true
-            that.AirTicketResById();
+            that.AirTicketResById(); //加载单条数据信息
         } else {
             that.isShow = false
             that.status = 1;
         }
+    },
+    computed: {
+        //客户名单属性
+        fliterClient() {
+            var arr = [];
+            if (this.clientNameId.length < 1) {
+                return [];
+            }
+
+            this.clientNameId.forEach(element => {
+
+                var item = "";
+                if (element.pinyin) {
+                    item += element.pinyin;
+                }
+                if (element.firstName && element.lastName) {
+                    item += "(" + element.lastName + element.firstName + ")";
+                }
+
+                if (item) {
+                    arr.push({ id: element.id, name: item });
+                }
+            });
+            return arr;
+        }
     }
 }
 </script>