<template>
  <el-dialog custom-class='PingFangSC' title="订单改价提醒"
  :visible.sync="outerVisibleNot" center
      :before-close="closeChangeMachie" width="1100px">
      <div v-if="ChangeThePriceObj.ChangeThePriceData.length>0"
        style="margin-bottom: 25px;">
        <p style="color: red;font-size: 16px;">
          改价提示:
          <span>一共有 <span class="c059FF6 fz16"
            style="padding: 0 10px;cursor: pointer;font-weight: bold;display: inline-block;"
            @click="ckChangePrice({},1)">
            {{msg.total2}}
          </span>
             条账未平数据,快去
             <span class="c059FF6 fz16"
             style="margin-left: 10px;margin-right: 10px;cursor: pointer;font-weight: bold;" @click="ckChangePrice({},1)">申请改价</span>
             吧
            </span>
        </p>
        <p style="font-size: 18px;font-weight: bold;background: #d1d1d1;padding: 5px 10px;margin-top: 5px;">订单改价列表

        </p>
        <el-table
      border
      ref="multipleTable"
      :data="ChangeThePriceObj.ChangeThePriceData"
      style="width: 100%"
      :default-sort="{ prop: 'null', order: 'null' }"
      :sort-by="[
        'Money',
        'Income',
        'PreferTipAmount',
        'PlatformTax',
        'Refund',
        'CostMoney',
        'OrderProfit',
        'DueInMoney'
      ]"
    >
      <el-table-column
        width="200"
        prop="CreateTimeStr"
        label="订单Id"
        show-overflow-tooltip
        fixed="left"
      >
        <template slot-scope="scope">
          <div>
            <p
              class="cursor-pointer c059FF6 fz18 row-c"
              @click="goDetails(scope.row)"
            >
              <el-tag style="margin-right: 5px;" size="mini">{{
                scope.row.OrderTypeName
              }}</el-tag>
              <span>{{ scope.row.OrderId }}</span>
            </p>
            <p>{{ scope.row.CreateTimeStr }}</p>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        prop="CreateTimeStr"
        :label="$t('visa.v_tuanhao')"
        show-overflow-tooltip
        fixed="left"
      >
        <template slot-scope="scope">
          <div>
            <p
              class=" fz14"
              :class="{ 'cursor-pointer c059FF6': scope.row.OrderType == 2 }"
              @click="scope.row.OrderType == 2 ? goTuanDetails(scope.row) : ''"
            >
              {{ scope.row.TCNUM }}
            </p>
            <p>出发日期:{{ scope.row.StartDate }}</p>
            <p v-if="scope.row.OrderType == 2 && scope.row.Status >= 0">
              {{
                scope.row.Status == 1
                  ? "未结团"
                  : scope.row.Status == 2
                  ? "已结团    "
                  : scope.row.Status == 5
                  ? "待结团审核"
                  : ""
              }}{{ scope.row.Status == 2 ? scope.row.OutGroupAuditDate : "" }}
            </p>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="客人" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>
            {{ scope.row.GuestName }}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="SaleName" label="销售"> </el-table-column>
      <el-table-column prop="LureEmpName" label="引流"> </el-table-column>
      <el-table-column label="商品名称" show-overflow-tooltip>
        <template slot-scope="scope">
          <div
            style="max-width: 100px;overflow: hidden;text-overflow: ellipsis"
          >
            {{ scope.row.Name }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="商品详情" show-overflow-tooltip>
        <template slot-scope="scope">
          <div
            style="max-width: 100px;overflow: hidden;text-overflow: ellipsis"
          >
            {{ scope.row.Description }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        sortable
        prop="Money"
        label="总金额"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ scope.row.Money }}&ensp;({{ scope.row.CurrencyName }})
        </template>
      </el-table-column>

      <el-table-column sortable prop="Income" label="实收"> </el-table-column>
      <el-table-column
        sortable
        prop="PlatformTax"
        label="手续费"
        min-width="100"
      >
      </el-table-column>
      <el-table-column sortable prop="Refund" label="退款"> </el-table-column>
      <!-- <el-table-column sortable prop="CostMoney" label="成本" >
    </el-table-column> -->
      <el-table-column sortable prop="DueInMoney" label="待收">
        <template slot-scope="scope">
          <span :class="{ red: scope.row.DueInMoney > 0 }">{{
            scope.row.DueInMoney
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        sortable
        prop="OrderProfit"
        label="预期利润"
        min-width="110"
      >
        <template slot-scope="scope">
          <span :class="{ red: scope.row.OrderProfit > 0 }">{{
            scope.row.OrderProfit
          }}</span>
        </template>
      </el-table-column>
      <el-table-column sortable prop="DiscountsMoney" label="优惠">
      </el-table-column>
      <el-table-column
        prop="Money"
        label="申请金额"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span> {{ scope.row.ApplyForMoney }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="ApplyForReason"
        label="申请理由"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ scope.row.ApplyForReason }}
        </template>
      </el-table-column>
      <el-table-column
        prop="ApplyForState"
        label="改价状态"
        show-overflow-tooltip
        min-width="110"
      >
        <template slot-scope="scope">
          <span
            >
            <template v-if="scope.row.OrderChangePriceId==0">
              待申请
            </template>
            <template v-if="scope.row.ApplyForState==1">
              待主管审核
            </template>
            <template v-else-if="scope.row.ApplyForState==2">
              主管审核通过
            </template>
            <template v-else-if="scope.row.ApplyForState==3">
              审核通过
            </template>
            <template v-else-if="scope.row.ApplyForState==4">
              拒绝
            </template>
          </span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('system.table_operation')">
      show-overflow-tooltip
        fixed="right">
        <template slot-scope="scope">
          <p
              class="c059FF6 fz14"
              style="cursor: pointer;font-weight: bold;"
              @click="ckChangePrice(scope.row,1)"
            >
              申请改价
            </p>
        </template>
        </el-table-column>
    </el-table>
      </div>
      <div v-if="ChangeThePriceObj.ExamineThePriceData.length>0">
        <p style="color: red;font-size: 16px;">
          审核提示:
          <span>一共有 <span class="c059FF6 fz16"
            style="padding: 0 10px;cursor: pointer;font-weight: bold;display: inline-block;"
            @click="ckChangePrice({},2)">
            {{msg.total}}
          </span>
             条改价申请待审核,快去
             <span class="c059FF6 fz16"
             style="margin-left: 10px;margin-right: 10px;cursor: pointer;font-weight: bold;" @click="ckChangePrice({},2)">审核</span>
             吧
            </span>
        </p>
        <p style="font-size: 18px;font-weight: bold;background: #d1d1d1;padding: 5px 10px;margin-top: 5px;">审核改价列表

        </p>
        <el-table
      border
      ref="multipleTable"
      :data="ChangeThePriceObj.ExamineThePriceData"
      style="width: 100%"
      :default-sort="{ prop: 'null', order: 'null' }"
      :sort-by="[
        'Money',
        'Income',
        'PreferTipAmount',
        'PlatformTax',
        'Refund',
        'CostMoney',
        'OrderProfit',
        'DueInMoney'
      ]"
    >
      <el-table-column
        width="200"
        prop="CreateTimeStr"
        label="订单Id"
        show-overflow-tooltip
        fixed="left"
      >
        <template slot-scope="scope">
          <div>
            <p
              class="cursor-pointer c059FF6 fz18 row-c"
              @click="goDetails(scope.row)"
            >
              <el-tag style="margin-right: 5px;" size="mini">{{
                scope.row.OrderTypeName
              }}</el-tag>
              <span>{{ scope.row.OrderId }}</span>
            </p>
            <p>{{ scope.row.CreateTimeStr }}</p>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        prop="CreateTimeStr"
        :label="$t('visa.v_tuanhao')"
        show-overflow-tooltip
        fixed="left"
      >
        <template slot-scope="scope">
          <div>
            <p
              class=" fz14"
              :class="{ 'cursor-pointer c059FF6': scope.row.OrderType == 2 }"
              @click="scope.row.OrderType == 2 ? goTuanDetails(scope.row) : ''"
            >
              {{ scope.row.TCNUM }}
            </p>
            <p>出发日期:{{ scope.row.StartDate }}</p>
            <p v-if="scope.row.OrderType == 2 && scope.row.Status >= 0">
              {{
                scope.row.Status == 1
                  ? "未结团"
                  : scope.row.Status == 2
                  ? "已结团    "
                  : scope.row.Status == 5
                  ? "待结团审核"
                  : ""
              }}{{ scope.row.Status == 2 ? scope.row.OutGroupAuditDate : "" }}
            </p>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="客人" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>
            {{ scope.row.GuestName }}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="SaleName" label="销售"> </el-table-column>
      <el-table-column prop="LureEmpName" label="引流"> </el-table-column>
      <el-table-column label="商品名称" show-overflow-tooltip>
        <template slot-scope="scope">
          <div
            style="max-width: 100px;overflow: hidden;text-overflow: ellipsis"
          >
            {{ scope.row.Name }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="商品详情" show-overflow-tooltip>
        <template slot-scope="scope">
          <div
            style="max-width: 100px;overflow: hidden;text-overflow: ellipsis"
          >
            {{ scope.row.Description }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        sortable
        prop="Money"
        label="总金额"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ scope.row.Money }}&ensp;({{ scope.row.CurrencyName }})
        </template>
      </el-table-column>

      <el-table-column sortable prop="Income" label="实收"> </el-table-column>
      <el-table-column
        sortable
        prop="PlatformTax"
        label="手续费"
        min-width="100"
      >
      </el-table-column>
      <el-table-column sortable prop="Refund" label="退款"> </el-table-column>
      <!-- <el-table-column sortable prop="CostMoney" label="成本" >
    </el-table-column> -->
      <el-table-column sortable prop="DueInMoney" label="待收">
        <template slot-scope="scope">
          <span :class="{ red: scope.row.DueInMoney > 0 }">{{
            scope.row.DueInMoney
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        sortable
        prop="OrderProfit"
        label="预期利润"
        min-width="110"
      >
        <template slot-scope="scope">
          <span :class="{ red: scope.row.OrderProfit > 0 }">{{
            scope.row.OrderProfit
          }}</span>
        </template>
      </el-table-column>
      <el-table-column sortable prop="DiscountsMoney" label="优惠">
      </el-table-column>
      <el-table-column
        prop="Money"
        label="申请金额"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span> {{ scope.row.ApplyForMoney }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="ApplyForReason"
        label="申请理由"
        min-width="100"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ scope.row.ApplyForReason }}
        </template>
      </el-table-column>
      <el-table-column
        prop="ApplyForState"
        label="改价状态"
        show-overflow-tooltip
        min-width="110"
      >
        <template slot-scope="scope">
          <span
            ><template v-if="scope.row.ApplyForState==1">
              待{{scope.row.ApplyType=="2"?"OP":"主管"}}审核
            </template>
            <template v-else-if="scope.row.ApplyForState==2">
              {{scope.row.ApplyType=="2"?"OP":"主管"}}审核通过
            </template>
            <template v-else-if="scope.row.ApplyForState==3">
              审核通过
            </template>
            <template v-else-if="scope.row.ApplyForState==4">
              拒绝
            </template>
          </span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('system.table_operation')">
      show-overflow-tooltip
        fixed="right">
        <template slot-scope="scope">
          <p
              class="c059FF6 fz14"
              style="cursor: pointer;font-weight: bold;"
              @click="ckChangePrice(scope.row,2)"
            >
              审核
            </p>
        </template>
        </el-table-column>
    </el-table>
      </div>
      <!--
      <el-pagination background
      v-if="ChangeThePriceObj.ExamineThePriceData.length>0"
      @current-change="handleCurrentChange"
      layout="total,prev, pager, next, jumper" :page-size="msg.pageSize" :total="msg.total">
      </el-pagination> -->
      <!-- <div v-if="ChangeThePriceData.length==0" style="padding: 40px 0;text-align: center;">
        暂无数据
      </div> -->
  </el-dialog>
</template>

<script>
  export default {
    props:["ChangeThePriceObj","msg"],
    data() {
      return {
        outerVisibleNot: true
      }
    },
    watch: {

    },
    methods: {
      goDetails(row){

      },
      ckChangePrice(row,type){
        this.closeChangeMachie()
        let obj
        if(row.OrderId){
          obj = {
            OrderId: row.OrderId,
            OrderType: row.OrderType,
            DepartSTime: row.StartDate,
            DepartETime: row.StartDate,
            blank: "y"
          }
        }else{
          obj = {
            blank: "y"
          }
        }
        this.$router.push({
            name: type==1?'erpChangePricehOrder':'erpExaminePricehOrder',
            query: obj
          });
      },
      closeChangeMachie(done) {
        this.$emit('ChangeThePriceVisible')
      },
      handleCurrentChange(val) {
          this.$emit('GetList',val)
      },
    }
  }
</script>