<template> <div> <div class="query-box" style="border-bottom: none;"> <ul> <li> <template v-if="IsOperation != 1"> <input v-if="IsEditDinner==1" type="button" class="fr normalBtn mb30" :value="$t('pub.saveBtn')" @click="saveList(1)" :disabled="IsDisabled" /> <input v-if="IsEditDinner==0" type="button" class="fr normalBtn mb30" :value="$t('ground.baocuncaogao')" @click="saveList(0)" :disabled="IsDisabled" /> </template> <template v-else> <span style="color:red;font-size:14px;">{{$t('ground.yizhidbnxg')}}!</span> <input v-if="EditBtn" type="button" class="fr normalBtn mb30" :value="$t('pub.saveBtn')" @click="saveList(1)" /> </template> </li> </ul> </div> <div style="width: 100%; overflow-x: auto;padding-bottom: 10px; " class="ownScrollbarStyle"> <table border="0" cellspacing="1" cellpadding="0" class="bookDinnerStatisticsTalbe" v-loading="loading"> <tr> <th> {{$t('salesModule.CompanyNum')}} </th> <th colspan="17" style="text-align:left;"> <p class="link" @click="goUrlT('productQuery',TCNUM,'产品查询')">{{TCNUM}}</p> </th> </tr> <tr> <th width="100">{{$t('restaurant.res_etTime')}}</th> <th width="200">{{$t('restaurant.res_resName')}}</th> <th width="150">{{$t('ground.xiugaict')}}</th> <th width="80">{{$t('ground.leibie')}}</th> <th width="200" style="display:none;">{{$t('ground.cayinlexing')}}</th> <th width="70">{{$t('ground.zongrenshu')}}</th> <th width="70">{{$t('ground.yongcanren')}}<br />{{$t('advmanager.v_type')}}</th> <th width="70">{{$t('commonPickUp.Pick_Ding')}}<br />{{$t('admin.admin_personNumber')}}</th> <th width="90">{{$t('Operation.Op_price')}}</th> <th width="90">{{$t('ground.mianrenshu')}}</th> <th width="80">{{$t('ground.jinexiaoji')}}</th> <th width="90">{{$t('hotel.hotel_commission')}}</th> <th width="100">{{$t('fnc.a_zongjine')}}</th> <th width="210">{{$t('ground.fkfsdcfsdth')}}</th> <th width="170">{{$t('pub.pubRemark')}}</th> </tr> <template v-for="(item,index) in list"> <template v-for="(subItem,subIndex) in item.DiningSummaryList"> <tr v-for="(childItem,childIndex) in subItem.DiningPriceList"> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> {{item.UseTimeStr}} </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> <table class="dinnerTable"> <tr> <td colspan="2"> <span style="padding-left:5px;" class="link" @click="goUrlR('restaurantList',subItem.DiningID,'餐厅列表')">{{subItem.DiningName}} <br/> {{$t('ground.zhenshimingcheng')}}: {{subItem.DiningRealName}} </span> </td> </tr> <tr> <td width="40"> {{$t('hotel.table_tel')}}: </td> <td style="text-align:left;"> {{subItem.Tel}} </td> </tr> <tr> <td width="40"> {{$t('hotel.table_address')}}: </td> <td style="text-align:left;"> {{subItem.Address}} </td> </tr> </table> </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> <el-select style="display:none;" class='w160 sel' v-model='subItem.NewDiningID' filterable :placeholder="$t('pub.pleaseSel')" @visible-change='getDingList(item)' @change='sendValue(subItem,item)'> <el-option v-for='itemHotel in item.DinnerList' :label='itemHotel.RealName' :value='itemHotel.ID' :key='itemHotel.ID'></el-option> </el-select> <span style="color:green">{{subItem.NewDiningRealName}}</span><br/> <el-popover placement="right" width="540" trigger="click" v-model="subItem.isShowPop"> <comCheckDinner :ref="'comCheckDinner'+index+subIndex+''" :UseDate="item.UseTimeStr" v-on:childDinner="childDinnerList" :Country="1252"> </comCheckDinner> <el-button size="small" type="danger" :data-index="'comCheckDinner'+index+subIndex+''" slot="reference" style="cursor:pointer;" @click="getChildDinner(index,subIndex),subItem.isShowPop=true"> {{$t('ground.cantingxuanz')}} </el-button> </el-popover> </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> {{subItem.UseDinnerTypeStr}} </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan" style="display:none;"> {{subItem.MealName}} </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> {{subItem.UseAccount}} </td> <td> {{personStrToWord(childItem.PeopleType)}} </td> <td> {{childItem.PeopleNum}} </td> <td> <span class="spanlink" v-if='childItem.PeoplePrice==0' @click="goUrl('RestaurantPackage',subItem,'套餐查询')">{{$t('leader.leader_Set')}}</span> <template v-else> <el-input class='w50 tcenter' @input='calculationPrice(subItem)' v-model='childItem.PeoplePrice' @keyup.native="checkInteger(childItem,'PeoplePrice')"></el-input> </template> </td> <td> <el-input class='w50 tcenter' @input='calculationPrice(subItem)' maxlength='2' v-model='childItem.Discount' @keyup.native="checkInteger(childItem,'Discount')"></el-input> </td> <td> {{(childItem.PeopleNum-childItem.Discount)*childItem.PeoplePrice}} </td> <td> <!--返佣--> <el-input class='w50 tcenter' @input='calculationPrice(subItem)' v-model='childItem.DiscountPrice' @keyup.native="checkInteger(childItem,'DiscountPrice')"></el-input>% </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> {{subItem.TotalPrice}} <template v-if="subItem.NewTotalPrice"> <br /><span style="color:red;">{{subItem.NewTotalPrice}}</span> </template> </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> <table class="dinnerTable"> <tr> <td width="70" style="text-align:right;">{{$t('hotel.hotel_Currency')}}:</td> <td> <el-select v-model="subItem.CurrencyId" :placeholder="$t('pub.pleaseSel')" class='w135 sel' @change="calculationPrice(subItem)"> <el-option :label="$t('pub.unlimitedSel')" :value='0'></el-option> <el-option v-for="(item,index) in allCurrencyList" :key="index" :label="item.Name" :value="item.ID"> </el-option> </el-select> </td> </tr> <tr> <td width="60" style="text-align:right;"> {{$t('fnc.fkfangshi')}}: </td> <td style="text-align:left;"> <el-select class='w135 sel' v-model='subItem.PayStyle' :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('pub.pleaseSel')" :value='0'></el-option> <el-option :label='$t("ground.xianfu")' :value='1' v-if="subItem.PayStyleExt==1"></el-option> <el-option :label='$t("ground.qiandan")' :value='2' v-if="subItem.PayStyleExt==2"></el-option> <el-option :label='$t("ground.shiwudk")' :value='3' v-if="subItem.PayStyleExt==3"></el-option> <el-option :label='$t("ground.yufu")' :value='4' v-if="subItem.PayStyleExt==4"></el-option> <el-option :label='$t("ground.yufukuandk")' :value='5' v-if="subItem.PayStyleExt==5"></el-option> <el-option :label='$t("ground.lingduidydf")' :value='10'></el-option> <el-option :label='$t("ground.gongsihetzf")' :value='6'></el-option> <el-option :label='$t("ground.shuaka")' :value='11'></el-option> </el-select> </td> </tr> <tr> <td width="60" style="text-align:right;"> {{$t('ground.dingcanfangs')}}: </td> <td style="text-align:left;"> <el-select v-model='subItem.DiningReserveType' class='w135 sel' :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('pub.pleaseSel')" value='0'></el-option> <el-option :label='$t("ground.gongsiyuding")' value='1'></el-option> <el-option :label='$t("ground.daoyouyuding")' value='2'></el-option> </el-select> </td> </tr> <tr v-show="subItem.PayStyle==6"> <td width="60" style="text-align:right;"> {{$t('ground.fukuanth')}}: </td> <td style="text-align:left;"> <el-input class='w135' v-model='subItem.PayTypeTCNUM' type="text"></el-input> </td> </tr> <tr> <td width="60" style="text-align:right;"> {{$t('ground.dingtuanhao')}}: </td> <td style="text-align:left;"> <el-input class='w135 tcenter' v-model='subItem.ReserveNo'></el-input> </td> </tr> </table> </td> <td v-if="childIndex==0" :rowspan="subItem.RowSpan"> <table class="dinnerTable"> <tr> <td width="80" style="text-align:right;">{{$t('pub.pubRemark')}}:</td> <td> <el-input type='textarea' rows="2" class='w120' v-model='subItem.Remarks'></el-input> </td> </tr> <tr> <td width="80" style="text-align:right;"> {{$t('ground.canpeibz')}}: </td> <td style="text-align:left;"> <el-input type='textarea' rows="2" class='w120' v-model='subItem.DinnerRemark'></el-input> </td> </tr> </table> </td> </tr> </template> </template> </table> </div> </div> </template> <script> import comCheckDinner from "../commonPage/comCheckDinner.vue"; export default { data() { return { EditBtn:false,//房餐景点修改权限 IsEditDinner: 0, //1有权限操作餐配 defaultSelectValue: 0, list: [], roomList: [], TCNUM: "", flightTotal: 0, GuestNum: 0, loading: false, IsOperation: '', //是否禁用按钮 IsDisabled: false, allCurrencyList: [], findex: 0, childIndex: 0, }; }, components: { comCheckDinner, }, methods: { getChildDinner(index, subIndex) { this.findex = index; this.childIndex = subIndex; let str = `comCheckDinner${index}${subIndex}` this.$refs[str][0].getCheckDinner(); }, //选中赋值 childDinnerList(obj) { var oldData = this.list[this.findex].DiningSummaryList[this.childIndex]; oldData.Address = obj.Address; oldData.Tel = obj.Tel; oldData.PayStyle = obj.PayStyle; oldData.PayStyleExt = obj.PayStyle; oldData.NewDiningID = obj.ID; oldData.NewDiningName = obj.Name; oldData.NewDiningRealName=obj.RealName; this.list.forEach(x => { x.DiningSummaryList.forEach(y => { y.isShowPop = false; }) }); }, //页面跳转[大写] goUrlR(path, obj, title) { this.$router.push({ name: path, query: { ID: obj, blank: 'y', tab: title } }); }, //页面跳转[小写] goUrlT(path, obj, title) { this.$router.push({ name: path, query: { id: obj, blank: 'y', tab: title } }); }, goUrl(path, obj, name) { this.$router.push({ path: path, query: { id: obj.DiningID, blank: "y", tab: name } }); }, personStrToWord(str) { if (str == 1) return '大人' if (str == 2) return '中人' if (str == 3) return '小人' }, getList() { this.loading = true; this.apipost( "dmcstatistics_get_GetDinnerStaticsDetail_SWT", { TCIDs: this.$route.query.id }, res => { this.loading = false; if (res.data.resultCode == 1) { var resultArray = res.data.data.DiningList; this.IsOperation = res.data.data.IsOperation; resultArray.forEach(item => { item.DinnerList = []; item.DiningSummaryList.forEach(x => { x.isShowPop = false; x.DiningReserveType = x.DiningReserveType.toString(); this.calculationPrice(x); var str = x.NewDiningName; if (x.RealName) { str = x.RealName; } item.DinnerList.push({ RealName: str, ID: x.NewDiningID }) if (x.ReserveNo == '' || x.ReserveNo == null) { x.ReserveNo = this.$route.query.NewCombinationNum;; } }) }); this.list=resultArray; } else { this.Error(res.data.message); } }, err => {} ); }, calculationPrice(obj) { let totalPrice = 0; //获取当前选中的对象 let currentObj = {}; if (obj.CurrencyId != 0) { currentObj = this.allCurrencyList.find(item => { return item.ID === obj.CurrencyId; //筛选出匹配数据 }); } //日元 let jpaObj = this.allCurrencyList.find(item => { return item.ID === 17; //筛选出匹配数据 }); obj.DiningPriceList.forEach((item, index) => { var tempPrice = 0; var coefficient = 1; totalPrice += item.PeoplePrice * (item.PeopleNum - item.Discount) * (coefficient - item.DiscountPrice / 100); totalPrice += tempPrice; }) obj.TotalPrice = totalPrice.toFixed(2); if (currentObj && currentObj.ID > 0) { //人民币 if (currentObj.ID == 1) { obj.NewTotalPrice = currentObj.Name + ":" + (totalPrice * jpaObj.PayRate).toFixed(2); } //日元 else if (currentObj.ID == 3) { obj.NewTotalPrice = ""; } else { if (currentObj.CurrentRate > 1) { obj.NewTotalPrice = currentObj.Name + ":" + ((totalPrice * jpaObj.PayRate) / currentObj.CurrentRate) .toFixed(2); } else { obj.NewTotalPrice = currentObj.Name + ":" + ((totalPrice * jpaObj.PayRate) * currentObj.CurrentRate) .toFixed(2); } } } else { obj.NewTotalPrice = ""; } this.$forceUpdate(); }, saveList(type) { this.IsDisabled = true; if (type == 0) { this.list.forEach(item => { item.DiningSummaryList.forEach(insideItem => { insideItem.OrderState = 0; }) }) } if (type == 1) { this.list.forEach(item => { item.DiningSummaryList.forEach(insideItem => { insideItem.OrderState = 1; }) }) } this.list.forEach(item => { item.DiningSummaryList.forEach(insideItem => { if (insideItem.DiningPriceList) { insideItem.DiningPriceList.forEach(subItem => { if (!subItem.Discount) { subItem.Discount = 0; } if (!subItem.DiscountPrice) { subItem.DiscountPrice = 0; } }); } }) }) this.apipost('dmcstatistics_get_SetDiningOrder', this.list, res => { if (res.data.resultCode == 1) { this.$message.success(res.data.message); this.getList(); this.IsDisabled = false; } else { this.IsDisabled = false; this.$message.error(res.data.message); } }, err => {}) }, //获取餐厅下拉 getDingList(item) { let msg = { QCity: item.DiningSummaryList[0].QCity } this.apipost('dining_post_GetLineDinnerList', msg, res => { if (res.data.resultCode == 1) { item.DinnerList = res.data.data; this.$forceUpdate(); } else { this.Error(res.data.message) } }, err => {}) }, //重置电话地址 sendValue(subItem, item) { item.DinnerList.forEach(x => { if (subItem.NewDiningID == x.ID) { subItem.Address = x.Address; subItem.Tel = x.Tel; subItem.PayStyle = x.PayStyle; subItem.PayStyleExt = x.PayStyle; } }) }, GetAuth() { this.apipost('dmcstatistics_get_GetGetDmcTotalTablePageAuth', {}, res => { if (res.data.resultCode == 1) { this.IsEditDinner = res.data.data.IsEditDinner; } else { this.$message.error(res.data.message); } }, err => {}) }, CheckAuth() { var actionCode = this.$AuthCode.EditRoomDinnerTIcket; this.CheckUserAuth(actionCode, res => { if (res.data.resultCode == 1 && res.data.data == 1) { this.EditBtn = true; } }); }, }, mounted() { this.CheckAuth(); this.GetAuth(); this.TCNUM = this.$route.query.TCNUM; this.GuestNum = this.$route.query.GuestNum; this.getList(); this.apipost("financeinfo_post_GetList", {}, res => { if (res.data.resultCode === 1) { this.allCurrencyList = res.data.data; } }, err => {}); } }; </script> <style> .bookDinnerStatisticsTalbe { border-collapse: collapse; background: #fff; text-align: center; } .bookDinnerStatisticsTalbe tr th { background: #eee; height: 40px; font-size: 12px; color: #333; border: 1px solid #d1d1d1; } .bookDinnerStatisticsTalbe tr td { font-size: 12px; height: 25px; line-height: 25px; border: 1px solid #d1d1d1; } .bookDinnerStatisticsTalbe tr td input { height: 20px !important; padding: 0; text-align: center; } .bookDinnerStatisticsTalbe tr td .sel input { height: 34px !important; } .bookDinnerStatisticsTalbe tr td .link:hover { text-decoration: underline; cursor: pointer; } .bookDinnerStatisticsTalbe tr td .spanlink:hover { text-decoration: underline; cursor: pointer; } .bookDinnerStatisticsTalbe .dinnerTable { border: none; } .bookDinnerStatisticsTalbe .dinnerTable tr td { border: none; } </style>