<style>
  .comHotelOperation {
    margin-top: 10px;
  }

  .comHotelOperation tr td {
    text-align: left;
    width: 50%;
    padding: 5px 0;
  }

  .comHotelOperation .tdRight {
    text-align: right;
    width: 20%;
  }

  .comHotelOperation .tdLeft {
    text-align: left;
    padding-left: 5px;
    width: 30%;
  }

</style>

<template>
  <div>
    <div>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="singeRowTable">
        <tr v-if="showHotelObj.showPrice">
          <td>
            {{$t('salesModule.CompanyNum')}}
          </td>
          <td colspan="4" style="text-align:left;">
            <span style="padding-left:5px;">{{TCNUM}} ({{TCID}})</span>
          </td>
          <td>
            {{$t('salesModule.DJNum')}}
          </td>
          <td :colspan="showHotelObj.colspanLength" style="text-align:left;">
            <span style="padding-left:5px;">{{DMCNum}}</span>
          </td>
        </tr>
        <tr>
          <th width="120">{{$t('pub.date')}}</th>
          <th width="150">{{$t('restaurant.res_resName')}}</th>
          <th width="150">{{$t('objFill.v101.traveltrip.genghuanct')}}</th>
          <th width="150" v-if="showHotelObj.showPrice">{{$t('objFill.v101.traveltrip.yudingrscb')}}</th>
          <th width="100" v-if="showHotelObj.showZhan">{{$t('objFill.yuyuetime')}}</th>
          <th width="100" v-if="showHotelObj.showZhan">{{$t('admin.admin_czPerson')}}</th>
          <th width="120">{{$t('salesModule.DJstatus')}}</th>
          <th width="100" v-if="showHotelObj.showZhan">{{$t('salesModule.SureTime')}}</th>
        </tr>
        <template v-if=" DiningObj&& DiningObj.length>0">
          <tr v-for="(hotelSubItem,hotelSubIndex) in DiningObj" :key="`p_d_`+hotelSubIndex">
            <td>
              {{hotelSubItem.UseTime}}（{{getDayByDate(hotelSubItem.UseTime)}}）
            </td>
            <td style="text-align:left;padding-left:3px;">

              <template
                v-if="hotelSubItem.DinnerRealName!=hotelSubItem.NewDinnerRealName && hotelSubItem.NewDinnerRealName!=''">
                <span style="text-decoration:underline;color:#606266;cursor:pointer;"
                  @click="goDinnerDetails('restaurantInfoDetail',  hotelSubItem.OldDiningID ) ">
                  {{hotelSubItem.DinnerRealName}}</span>
              </template>
              <template v-else>
                <span style="color:#606266;text-decoration:underline;cursor:pointer;"
                  @click="goDinnerDetails('restaurantInfoDetail',  hotelSubItem.OldDiningID ) ">
                  {{hotelSubItem.DinnerRealName}}</span>
              </template>
            </td>
            <td style="text-align:left;padding-left:3px;color:red">
              <span style="color:#606266;text-decoration:underline;cursor:pointer;"
                @click="goDinnerDetails('restaurantInfoDetail',  hotelSubItem.NewDiningID ) ">
                {{hotelSubItem.DinnerRealName!=hotelSubItem.NewDinnerRealName?""+hotelSubItem.NewDinnerRealName:""}}
              </span>
            </td>
            <td style="text-align:left;padding-left:5px;">
              <template v-if="showHotelObj.showPrice&&hotelSubItem.PriceList&&hotelSubItem.PriceList.length>0">
                <span v-for="(priceSubItem,priceSubIndex) in hotelSubItem.PriceList" :key="`din`+priceSubIndex">
                  <template v-if="priceSubItem.UnitPrice>0&&priceSubItem.DiningNum>0">
                    <span style="display:block;">
                      <template v-if="priceSubItem.GuestType==1">{{$t('objFill.da')}}
                      </template>
                      <template v-if="priceSubItem.GuestType==2">{{$t('hotel.hotel_Inthe')}}
                      </template>
                      <template v-if="priceSubItem.GuestType==3">{{$t('objFill.xiao')}}
                      </template>
                      :{{priceSubItem.DiningNum}}&nbsp;&nbsp;{{$t('objFill.v101.traveltrip.canbiao')}}:{{priceSubItem.UnitPrice}}</span>
                  </template>
                </span>
              </template>
            </td>
            <td>
              {{hotelSubItem.DiningTypeName}} <br /> {{hotelSubItem.BookTime}}
            </td>
            <td>
              {{hotelSubItem.CreateByName}}
            </td>
            <td>
              <span>
                <template v-if="hotelSubItem.OrderState==1">
                  <a style="color:green">{{$t('pub.sureBtn')}}</a>
                </template>
                <template v-else-if="hotelSubItem.OrderState==-1">
                  <a style="color:red"></a>
                </template>
                <template v-else-if="hotelSubItem.OrderState==2">
                  <a style="color:red">{{$t('visa.v_zanding')}}</a>
                </template>
              </span>
            </td>
            <td>
              {{hotelSubItem.SureTime}}
            </td>
          </tr>
        </template>
      </table>
    </div>
  </div>
</template>

<script>
  export default {
    props: ["DiningObj", "showHotelObj", "TCID", "DMCNum", "TCNUM"],
    data() {
      return {
        loading: false,
      };
    },
    components: {
      //日志组件

    },
    methods: {

      goUrl(name, path, id, tcmun) {
        this.$router.push({
          name: path,
          query: {
            id: id,
            tcmun: tcmun,
            blank: "y",
            tab: name,
          },
        });
      },
      //根据日期返回星期几
      getDayByDate(dateString) {
        if (dateString) {
          var date;
          var dateArray = dateString.split("-");
          date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
          return "日一二三四五六".charAt(date.getDay());
        }
      },

      // 跳转餐厅详情页  restaurantInfoManage  ///#/restaurantInfoManage?id=4688&blank=y&cache=true 
      goDinnerDetails: function (path, id) {
        this.$router.push({
          name: path,
          query: {
            id: id,
            blank: "y",
            cache: true,
          },
        });
      },
    },
    mounted() {}
  };

</script>
