<style>
        @import "../../assets/css/newTravelManager.css";
.page_MyCustomer ._mc_addbox {
  height: 52px;
  width: 100%;
  margin-top: 20px;
}
.page_MyCustomer ._mc_addbox > li {
  float: left;
  width: 116px;
  font-size: 14px;
  height: 52px;
  color: #666;
  text-align: center;
  line-height: 52px;
  background: #e9e9e9;
  cursor: pointer;
}
.page_MyCustomer ._mc_addbox > li.active {
  background: #fff;
  color: #333;
}
.page_MyCustomer ._mc_addbox .divActive {
  margin: -3px auto;
  width: 26px;
  height: 3px;
  background: #e95252;
}
.page_MyCustomer ._mc_edit {
  overflow: auto;
  display: none;
  position: fixed;
  z-index: 50;
  bottom: 0;
  left: 50px;
  border-top: 3px solid #38425d;
  background-color: #f9f9f9;
  padding: 10px;
  width: calc(100% - 50px);
  min-width: 1146px;
}
.page_MyCustomer .edHeight {
  display: block;
  height: 191px;
}
.page_MyCustomer ._mc_list {
  overflow-x: auto;
  background: #fff;
  padding-top: 20px;
  padding-left: 15px;
}
.page_MyCustomer ._scrollbar::-webkit-scrollbar {
  width: 4px;
  height: 8px;
}
.page_MyCustomer ._scrollbar::-webkit-scrollbar-thumb {
  border-radius: 4px;
  -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  background: #c9c9c9;
}
.page_MyCustomer ._scrollbar::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: #ededed;
}
.page_MyCustomer ._mc_edit ._tit {
  padding-left: 10px;
  border-left: 3px solid #e95252;
  font-size: 16px;
  font-family: "PingFangSc-Fine";
  color: #000000;
}
.page_MyCustomer ._mc_edit ._info_box ul._form li {
  float: left;
}
.page_MyCustomer ._check_list {
  padding-left: 120px;
  margin-bottom: 20px;
}
.page_MyCustomer ._check_box .el-form-item {
  margin-bottom: 0;
}
.page_MyCustomer ._info_box .el-form-item__label {
  font-size: 12px;
  color: #666;
}
._remark textarea {
  resize: none;
  width: 646px;
  height: 100px;
}
.page_MyCustomer .avatar {
  width: 148px;
  height: 148px;
  display: block;
}
.page_MyCustomerSearch {
  width: 100%;
  min-height: auto;
  overflow: hidden;
  padding: 0 0 20px 0;
}
.page_MyCustomerSearch li {
  float: left;
  font-size: 12px;
  color: #666;
  margin: 20px 0 0px 0;
}
.page_MyCustomerSearch li > span {
  display: inline-block;
}
.page_MyCustomerSearch li span > em {
  display: inline-block;
  min-width: 60px;
  text-align: right;
  font-style: normal;
  margin: 0 12px 0 0;
}
.page_MyCustomerSearch li:last-child {
  float: right;
}
.VisaProductTable {
  width: 100%;
  font-size: 14px;
  color: #333;
}
.VisaProductTable tr th {
  background: #e6e6e6;
  height: 30px;
  font-size: 12px;
  text-align: left;
  text-indent: 25px;
}
.VisaProductTable tr {
  background: #fff;
  text-align: left;
}
.VisaProductTable tr td {
  height: 60px;
  padding-left: 25px;
  border: 1px solid #cccccc;
  font-size: 14px;
  color: #333;
}
.VisaProductTable tr td > img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  float: left;
  margin-right: 5px;
}
.VisaProductTable tr td .tuanqian {
  vertical-align: middle;
  font-weight: 400;
  display: table-cell;
  text-align: center;
  width: 44px;
  font-size: 12px;
  height: 19px;
  color: #ffffff;
  background: #2aaef2;
}
.VisaProductTable tr td .geqian {
  vertical-align: middle;
  font-weight: 400;
  display: table-cell;
  text-align: center;
  width: 44px;
  font-size: 12px;
  height: 19px;
  color: #ffffff;
  background: #ff9000;
}
.page_MyCustomer ._edHeight {
  height: 340px;
}
.dateClass {
  width: 171px !important;
}
.surplusNum {
  color: #e95252 !important;
}
.peopleNum {
  height: 15px;
  font-size: 16px;
  font-weight: 400;
  color: rgba(51, 51, 51, 1);
  line-height: 24px;
}
.orderNum {
  cursor: pointer;
  text-decoration: underline;
  width: 18px;
  height: 16px;
  font-size: 16px;
  font-weight: 400;
  color: rgba(51, 51, 51, 1);
  line-height: 24px;
}
.VisaProductTable tr td .createName {
  vertical-align: middle;
  display: table-cell;
  text-align: left;
  padding-left: 3px;
  height: 21px;
}
.groupTourOrderIcon button {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}
.groupTourOrderIcon .el-button--primary {
  padding: 5px;
  margin: 0;
  font-size: 14px !important;
}
</style>
<template>
  <div class="page_MyCustomer">
    <div class="query-box" style="border:none">
      <ul>
        <li>
          <span>
            <em>{{$t('scen.sc_cp')}}</em>
            <el-select
              class="w210"
              v-model="msg.BranchId"
              filterable
              :placeholder="$t('pub.pleaseSel')"
            >
              <el-option
                v-for="item in companyList"
                :label="item.BName"
                :value="item.Id"
                :key="item.Id"
              ></el-option>
            </el-select>
          </span>
        </li>
        <li>
          <span>
            <em>{{$t('objFill.v101.Rest.chanping')}} ID</em>
            <el-input class="w210" v-model="msg.ProductID" :placeholder="$t('pub.pleaseImport')"></el-input>
          </span>
        </li>
        <li>
          <span>
            <em>{{$t('hotel.product_name')}}</em>
            <el-input class="w210" v-model="msg.ProductName" :placeholder="$t('pub.pleaseImport')"></el-input>
          </span>
        </li>
        <li>
          <span>
            <em>{{$t('active.cl_addPp')}}</em>
            <el-select v-model="msg.EmId">
              <el-option :label="$t('pub.unlimitedSel')" value="-1" key="-1"></el-option>
              <el-option
                v-for="item in EmployeeList"
                :label="item.EmName"
                :value="item.EmployeeId"
                :key="item.EmployeeId"
              ></el-option>
            </el-select>
          </span>
        </li>
        <li>
          <span>
            <em>{{$t('admin.admin_status')}}</em>
          </span>
          <el-select v-model="msg.VisaStatus">
            <el-option :label="$t('pub.unlimitedSel')" value="-1" key="-1"></el-option>
            <el-option :label="$t('Operation.Op_shangjia')" value="1" key="1"></el-option>
            <el-option :label="$t('Operation.Op_xiajia')" value="2" key="2"></el-option>
          </el-select>
        </li>
        <li>
          <span>
            <em>{{$t('objFill.v101.Rest.jiageyxriqi')}}</em>
            <el-date-picker
              v-model="msg.StartTime"
              class="w135"
              value-format="yyyy-MM-dd"
              type="date"
            ></el-date-picker>-
            <el-date-picker
              v-model="msg.EndTime"
              class="w135"
              value-format="yyyy-MM-dd"
              type="date"
            ></el-date-picker>
          </span>
        </li>
        <li style="display: flex;align-items: center;">
          <span style="display: flex;align-items: center;">
            <em>{{$t("Operation.Op_salesPlat")}}</em>
            <el-select v-model="msg.ckedplat" multiple
            @change="checkDialog"
            clearable
            collapse-tags>
              <el-option
                v-for="sales in $tripUtils.TeamStatesList.salsPlat"
                :key="sales.Id"
                :label="sales.Name"
                :value="sales.Id"
                :disabled="
                  (sales.Id == '2' || sales.Id == '5') && SaleB2COrWeChatStatus
                    ? true
                    : false
                ">
              </el-option>
            </el-select>
            <!-- <span style="display: flex;align-items: center;">
              <el-checkbox v-model="msg.checkDialogAll" @change="checkAllDialog" style="margin-right: 20px">
            {{ $t("system.table_chekAll") }}</el-checkbox>
          <template v-if="CurrentUserInfo.RB_Group_Id == 2">
            <el-checkbox-group v-model="msg.ckedplat" @change="checkDialog">
              <el-checkbox v-for="sales in $tripUtils.TeamStatesList.salsPlat" :label="sales.Id" :key="sales.Name"
                :disabled="
                  (sales.Id == '2' || sales.Id == '5') && SaleB2COrWeChatStatus
                    ? true
                    : false
                ">
                {{ sales.Name }}</el-checkbox>
            </el-checkbox-group>
          </template>
          <template v-else>
            <el-checkbox-group v-model="msg.ckedplat" @change="checkDialog">
              <el-checkbox v-for="sales in $tripUtils.TeamStatesList.salsPlat" :label="sales.Id" :key="sales.Name">
                {{ sales.Name }}</el-checkbox>
            </el-checkbox-group>
          </template>
            </span> -->
          </span>
        </li>
        <li>
          <button class="hollowFixedBtn" @click="getList()">{{$t('pub.searchBtn')}}</button>
          <!-- <button class="normalBtn" v-show="!buttonshow" @click="cancelEdit(),addShow=true" v-if="msg.isFinacial==1">{{$t('fnc.tianjia')}}</button> -->
          <button class="normalBtn" @click="AddVisaProduct" v-if="msg.isFinacial==1">{{$t('fnc.tianjia')}}</button>

        </li>
      </ul>
    </div>
    <el-table
          ref="multipleTable"
          :data="dataList"
          tooltip-effect="dark"
          style="width: 100%"
         >
          <el-table-column :label="$t('sm.company')" prop="BranchName" width="200">
            <template slot-scope="scope">
              <p>{{ scope.row.BranchName }}</p>
              <div class="TC_TravelSalePlat clearfix" style="margin: 0;">
                <span class="TC_neibu"
                      :class="{TCneibu: plat == 3, TCb2b: plat == 1,TCb2c: plat == 2, AppPlat: plat == 4, otherPlat: plat == 5,}"
                      v-for="plat in scope.row.SalePlatList" :key="plat.subCode">{{ $tripUtils.getPlatName(plat) }}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column :label="$t('hotel.product_name')" prop="Name"></el-table-column>
          <el-table-column :label="$t('visa.v_visaType')" prop="">
            <template slot-scope="scope">
              <span v-if="scope.row.VisaType==1" class="geqian">{{$t('visa.v_gvisa')}}</span>
              <span v-else class="tuanqian">{{$t('visa.v_tvisa')}}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('objFill.v101.Rest.jiageyxriqi')" prop="" width="200">
            <template slot-scope="scope">
              <p>
                {{$t('OrderList.end')}}:<span class="fbold">{{scope.row.SendVisaDate}}</span>
              </p>
              <p>
              {{$t('OrderList.star')}}:<span class="fbold">{{scope.row.EffectiveStartDate}}</span>
              </p>
            </template>
          </el-table-column>
          <el-table-column :label="$t('objFill.chengbenjia')" prop="">
            <template slot-scope="scope">
              <span class="totalPrice fbold" style="color: #47BF8C;">¥{{moneyFormat(scope.row.CostPrice)}}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('Operation.Op_tradePrice')" prop="">
            <template slot-scope="scope">
              <span class="totalPrice fbold" style="color: #f90;">¥{{moneyFormat(scope.row.VisaPrice)}}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('Operation.Op_directPrice')" prop="">
            <template slot-scope="scope">
              <span class="totalPrice fbold" style="color: #f90;">¥{{moneyFormat(scope.row.VisaB2CPrice)}}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('admin.admin_status')" prop="">
            <template slot-scope="scope">
              <i v-if="scope.row.VisaStatus==1" class="iconfont icon-shangjia" style="color:#4BCA81;"></i>
              <i v-else class="iconfont icon-xiajia" style="color:#4BCA81;"></i>
              {{scope.row.VisaStatus==1?$t('Operation.Op_shangjia'):$t('Operation.Op_xiajia')}}
            </template>
          </el-table-column>
          <el-table-column :label="$t('objFill.v101.FinancialModule.dindanshu')" prop="">
            <template slot-scope="scope">
              <span class="orderNum" @click="goUrl(scope.row)">{{scope.row.OrderNum}}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="总人数(剩余人数)" prop="">
            <template slot-scope="scope">
              <span class="peopleNum">{{scope.row.PeopleNum}}(<span class="surplusNum">{{scope.row.SurplusNum}}</span>)</span>
            </template>
          </el-table-column> -->
          <el-table-column :label="$t('objFill.v101.Rest.chuanjianzhe')" prop="">
            <template slot-scope="scope">
              <!-- <img v-if="!scope.row.CreatePhoto" src="../../assets/img/litheader.png">
              <img v-if="scope.row.CreatePhoto" :onerror="defaultImg" :src="scope.row.CreatePhoto"> -->
              <span class="createName">{{scope.row.CreateName}}</span>
              <span v-if="scope.row.CreateName!=scope.row.UpdateName" class="createName"><br/>{{$t('salesModule.CommissionNum')}}:{{scope.row.UpdateName}}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('salesModule.AdvPic')" prop="">
            <template slot-scope="scope">
              <p v-for="(item2, index2) in scope.row.AdvertisingFileList" :key="index2">
                <span
                  style="cursor:pointer;text-decoration: underline;"
                  @click="downloadFile(item2)"
                >{{item2.Name}}</span>
                <i
                  class="iconfont icon-Close"
                  style="font-size:12px;cursor:pointer;"
                  @click="delUnpload(scope.row.Id,item2,'广告图',1)"
                ></i>
              </p>
              <el-upload
                :http-request="UploadAttachment"
                :data="scope.row"
                ref="upload"
                :multiple="false"
                :show-file-list="false"
                action
              >
                <span style="color:#00C6FF;cursor:pointer;" @click="saveitem(scope.row.Id,1)">{{$t('objFill.v101.Rest.shangcggtu')}}</span>
              </el-upload>
            </template>
          </el-table-column>
          <el-table-column :label="$t('visa.v_shenqingbiao')" prop="">
            <template slot-scope="scope">
              <p v-for="(item2, index2) in scope.row.ApplyForCounterfoilList" :key="index2+100">
                <span
                  style="cursor:pointer;text-decoration: underline;"
                  @click="downloadFile(item2)"
                >{{item2.Name}}</span>
                <i
                  class="iconfont icon-Close"
                  style="font-size:12px;cursor:pointer;"
                  @click="delUnpload(scope.row.Id,item2,'申请表',2)"
                ></i>
              </p>
              <el-upload
                :http-request="UploadAttachment"
                :data="scope.row"
                ref="upload"
                :multiple="false"
                :show-file-list="false"
                action
              >
                <span style="color:#00C6FF;cursor:pointer;" @click="saveitem(scope.row.Id,2)">{{$t('objFill.v101.Rest.shangcsqiinb')}}</span>
              </el-upload>
            </template>
          </el-table-column>
          <el-table-column :label="$t('system.table_operation')">
            <template slot-scope="scope">
              <el-button-group>
                <!-- <el-tooltip
                  class="item"
                  effect="dark"
                  :content="$t('pub.updateMsg')"
                  placement="top-start"
                  v-if="scope.row.SendVisaStatus==1&&msg.isFinacial==1"
                >
                  <el-button v-show="!buttonshow"
                    type="primary"
                    style="background:#409EFF; border-color:#409EFF"
                    icon="iconfont icon-img_bianji_small"
                    @click="getDetail(scope.row)"
                  ></el-button>
                </el-tooltip> -->
                <div style="display:inline-block">
                    <el-tooltip
                      class="item"
                      effect="dark"
                        :content="$t('pub.updateMsg')"
                        placement="top-start"
                        v-if="scope.row.SendVisaStatus==1&&msg.isFinacial==1"
                      >
                        <el-button
                          type="primary"
                          style="background:#409EFF; border-color:#409EFF"
                          icon="iconfont icon-img_bianji_small"
                          @click="EditVisaProduct(scope.row)"
                        ></el-button>
                      </el-tooltip>
                      <el-tooltip
                        class="item"
                        effect="dark"
                        :content="$t('salesModule.CheckDetails')"
                        placement="top-start"
                        v-else
                      >
                        <el-button
                          style="background:#E95252; border-color:#E95252;color:#fff"
                          icon="iconfont icon-chakan"
                          @click="ChaKan(scope.row)"
                        ></el-button>
                      </el-tooltip>
                </div>

                <el-tooltip effect="dark" :content="$t('objFill.v101.Rest.chakbmdan')" placement="top-start" v-if="msg.isFinacial==1">
                  <el-button
                    type="primary"
                    style="background:#25C1C3; border-color:#25C1C3"
                    @click="goUrl(scope.row)"
                    icon="iconfont icon-img_cz"
                  ></el-button>
                </el-tooltip>
                <el-tooltip
                  effect="dark"
                  :content="$t('objFill.v101.Rest.qianzhenglb')"
                  placement="top-start"
                  v-if="scope.row.VisaManagementId>0"
                >
                  <el-button
                    type="primary"
                    @click="goUrlVisaList(scope.row)"
                    style="background:#47BF8C; border-color:#47BF8C"
                    icon="iconfont icon-biaoge"
                  ></el-button>
                </el-tooltip>
                <el-tooltip
                  v-if="scope.row.OrderNum>0&&msg.isFinacial==1"
                  effect="dark"
                  :content="$t('objFill.jiesuan')"
                  placement="top-start"
                >
                  <el-button
                    type="primary"
                    @click="goUrlJS(scope.row)"
                    style="background:#5EBB64; border-color:#5EBB64"
                    icon="iconfont icon-qian"
                  ></el-button>
                </el-tooltip>
                <el-tooltip
                  v-if="scope.row.VisaStatus==1&&msg.isFinacial==1"
                  effect="dark"
                  :content="$t('Operation.Op_xiajia')"
                  placement="top-start"
                >
                  <el-button
                    type="primary"
                    style="background:#F0A748; border-color:#F0A748"
                    icon="iconfont icon-xiajia1"
                    @click="updateVisaStatus(scope.row)"
                  ></el-button>
                </el-tooltip>
                <el-tooltip
                  v-if="scope.row.VisaStatus==2&&scope.row.SendVisaStatus==1&&msg.isFinacial==1"
                  effect="dark"
                  :content="$t('Operation.Op_shangjia')"
                  placement="top-start"
                >
                  <el-button
                    type="primary"
                    style="background:#F0A748; border-color:#F0A748"
                    icon="iconfont icon-shangjia1"
                    @click="updateVisaStatus(scope.row)"
                  ></el-button>
                </el-tooltip>
                <el-tooltip
                  effect="dark"
                  :content="$t('objFill.copy')"
                  placement="top-start"
                >
                  <el-button
                    type="primary"
                    style="background:#F0A748; border-color:#F0A748"
                    icon="el-icon-document-copy"
                    @click="EditVisaProduct(scope.row,'copy')"
                  ></el-button>
                </el-tooltip>
                <el-popover v-if="scope.row.SendVisaStatus==1&&msg.isFinacial==1" style="padding: 0" width="300" trigger="click">
                  <div style="display: flex;flex-direction: column;">
                    <div style="margin-bottom: 10px;display: flex;justify-content: space-between;">
                      <em>{{$t("Operation.Op_salesPlat")}}</em>
                      <el-checkbox v-model="scope.row.checkDialogAll" @change="(val)=>{getcheckAllDialog(val,scope.$index)}" style="margin-right: 20px">
                      {{ $t("system.table_chekAll") }}</el-checkbox>
                    </div>
                    <div style="display: flex;align-items: center;">
                      <el-checkbox-group v-model="scope.row.ckedplat" @change="(value)=>{getcheckDialog(value,scope.$index)}">
                          <el-checkbox v-for="sales in $tripUtils.TeamStatesList.salsPlat" :label="sales.Id" :key="sales.Name">
                            {{ sales.Name }}</el-checkbox>
                        </el-checkbox-group>
                    </div>
                    <el-button
                      :disabled="!scope.row.ckedplat.length"
                      :loading="PlatformLoading"
                      type="primary" size="small" style="margin-top: 10px"
                      @click="setPlatform(scope.row,'copy')"
                    >{{ $t('pub.saveBtn') }}</el-button>
                  </div>
                  <el-tooltip  slot="reference"
                    effect="dark"
                    :content="$t('fnc.pingtai')"
                    placement="top-start"
                  >
                    <el-button
                      type="primary"
                      style="background:#F0A748; border-color:#F0A748"
                      icon="el-icon-data-board"
                    ></el-button>
                  </el-tooltip>
                </el-popover>
              </el-button-group>
             
              
            </template>
          </el-table-column>
    </el-table>

    <el-pagination
      background
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      layout="total,prev, pager, next, jumper"
      :page-size="this.msg.pageSize"
      :total="total"
    ></el-pagination>

    <div class="_mc_edit _scrollbar" :class="addShow==true?'edHeight':''">
      <p class="_tit">
        {{$t('objFill.v101.Rest.qianzhnegcp')}}
        <span class="fr">
          <button class="hollowFixedBtn" type="button" @click="cancelEdit()">{{$t('pub.cancelBtn')}}</button>
          <button type="button" class="normalBtn" @click="saveVisa()">{{$t('pub.saveBtn')}}</button>
        </span>
      </p>
      <el-form
        class="_info_box clearfix"
        :model="addMsg"
        :rules="rules"
        ref="addMsg"
        label-width="120px"
      >
        <el-row :gutter="20">
          <el-col :span="5">
            <el-form-item :label="$t('hotel.product_name')" prop="Name">
              <el-input v-model="addMsg.Name" :placeholder="$t('pub.pleaseImport')" class="dateClass"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('system.query_type')" prop="VisaType">
              <el-select v-model="addMsg.VisaType" @change="getVisaManagementList">
                <!-- <el-option :label="$t('pub.unlimitedSel')" value='-1' key='-1'></el-option> -->
                <el-option :label="$t('visa.v_gvisa')" value="1" key="1"></el-option>
                <el-option :label="$t('visa.v_tvisa')" value="2" key="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="4">
						 <el-form-item :label="$t('admin.admin_personNumber')" prop="PeopleNum">
                            <el-input   @keyup.native="checkInteger(addMsg,'PeopleNum')"  v-model="addMsg.PeopleNum" :placeholder="$t('pub.pleaseImport')" maxlength="20"></el-input>
                        </el-form-item>
          </el-col>-->
          <el-col :span="5">
            <el-form-item :label="$t('objFill.chengbenjia')" prop="CostPrice">
              <el-input v-model="addMsg.CostPrice" :placeholder="$t('pub.pleaseImport')" maxlength="20"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('objFill.v101.Rest.qianzhenggj')" prop="VisaManagementId">
              <el-select v-model="addMsg.VisaManagementId" class="dateClass">
                <el-option
                  v-for="item in VisaManagementList"
                  :label="item.Name"
                  :value="item.Id"
                  :key="item.Id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="5">
            <el-form-item :label="$t('Operation.Op_tradePrice')" prop="VisaPrice">
              <el-input v-model="addMsg.VisaPrice" :placeholder="$t('pub.pleaseImport')" maxlength="20"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('Operation.Op_directPrice')" prop="VisaB2CPrice">
              <el-input v-model="addMsg.VisaB2CPrice" :placeholder="$t('pub.pleaseImport')" maxlength="20"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('salesModule.TCmoney')" prop="CommissionPrice">
              <el-input v-model="addMsg.CommissionPrice" :placeholder="$t('pub.pleaseImport')"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('objFill.v101.Rest.jiageyxriqi')" prop="SendVisaDate">
              <el-date-picker
                v-model="addMsg.SendVisaDate"
                class="dateClass"
                value-format="yyyy-MM-dd"
                type="date"
                :placeholder="$t('pub.pleaseSel')"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      uploadTCID: 0,
      defaultImg:
        'this.src="' + require("../../assets/img/litheader.png") + '"',
      companyList: [],
      msg: {
        pageIndex: 1,
        pageSize: 12,
        ProductName: "",
        StartTime: "",
        EndTime: "",
        EmId: "-1",
        ProductID: 0,
        VisaStatus: "-1",
        isFinacial: 1,
        BranchId: "-1",
        SalePlat: '',
        ckedplat: [],
        //弹出框全选
        checkDialogAll: false,
      },
      addMsg: {
        Id: 0,
        Name: "",
        VisaType: "",
        SendVisaDate: "",
        VisaPrice: "",
        PeopleNum: "0",
        CostPrice: "",
        CommissionPrice: "",
        VisaManagementId: "",
        VisaB2CPrice: ""
      },
      rules: {
        Name: [{ required: true, message: this.$t('objFill.v101.busManagement.qingshurcpmc'), trigger: "blur" }],
        customerName: [
          { required: true, message: this.$t('rule.EnterCusName'), trigger: "blur" }
        ],
        VisaPrice: [
          { required: true, message: this.$t('objFill.v101.Rest.qingsrtyjia'), trigger: "blur" },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: this.$t('objFill.v101.Rest.qingsrtyjia')
          }
        ],
        VisaB2CPrice: [
          { required: true, message: this.$t('objFill.v101.Rest.qingsrzkjia'), trigger: "blur" },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: this.$t('objFill.v101.Rest.qingsrzkjia')
          }
        ],
        CostPrice: [
          { required: true, message: this.$t('objFill.qingshurucbj'), trigger: "blur" },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: this.$t('objFill.qingshurucbj')
          }
        ],
        VisaType: [
          { required: true, message: this.$t('system.ph_type'), trigger: "change" }
        ],
        PeopleNum: [{ required: true, message: this.$t('rule.EnterPnum'), trigger: "blur" }],
        CommissionPrice: [
          { required: true, message: this.$t('objFill.v101.Rest.qingshurtcje'), trigger: "blur" },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: this.$t('objFill.v101.Rest.qingshurtcje')
          }
        ],
        SendVisaDate: [
          { required: true, message: this.$t('objFill.v101.Rest.qingsrjgyxq'), trigger: "blur" }
        ]
      },
      dataList: [],
      EmployeeList: [],
      loading: true,
      total: 0,
      addShow: false,
      currentPage: 1,
      VisaManagementList: [],
      // buttonshow:false,
      Type:0,
      CurrentUserInfo:{},
      SaleB2COrWeChatStatus: true, //上架B2C或者微信小程序
      PlatformLoading: false,
    };
  },
  created(){
    // let locationName = window.location.hostname;
    // if (locationName.indexOf('viitto') !== -1 || locationName.indexOf('www') !== -1){
    //   this.buttonshow=true;
    // }
    let userInfo = this.getLocalStorage();
    // 团提成权限
    let ActionMenuCode = userInfo.ActionMenuCode;
      if (ActionMenuCode.indexOf("SaleB2COrWeChat") != -1) {
        this.SaleB2COrWeChatStatus = false;
      }
    this.CurrentUserInfo = userInfo;

  },
  methods: {
    setPlatform(item){
      let msg = {
        Pid: item.Id,
        SalePlat: item.ckedplat.join(","),
      };
      this.PlatformLoading = true
      this.apipost(
        "dmc_post_visa_SetVisaProductSalePlat",
        msg,
        res => {
          this.PlatformLoading = false
          if (res.data.resultCode == 1) {
            this.Success(res.data.message);
            this.getList();
          }else{
            this.Error(res.data.message);
          }
        },
        err => {
          this.PlatformLoading = false
          this.Error(err.message);
        }
      );
    },
    //全选弹出框
    getcheckAllDialog(val,index) {
      this.dataList[index].ckedplat = [];
      if (val) {
        this.$tripUtils.TeamStatesList.salsPlat.forEach((x) => {
          this.dataList[index].ckedplat.push(x.Id);
        });
      }
    },
    getcheckDialog(value) {
      let checkedCount = value.length;
      this.dataList[index].checkDialogAll =
        checkedCount === this.$tripUtils.TeamStatesList.salsPlat.length;
    },
     //全选弹出框
     checkAllDialog(val) {
      this.msg.ckedplat = [];
      if (val) {
        this.$tripUtils.TeamStatesList.salsPlat.forEach((x) => {
          this.msg.ckedplat.push(x.Id);
        });
      }
    },
    checkDialog(value) {
      let checkedCount = value.length;
      this.msg.checkDialogAll =
        checkedCount === this.$tripUtils.TeamStatesList.salsPlat.length;
    },
    // 只能查看,不能修改
    ChaKan(item){
      this.$router.push({
          name: "ModifyVisaProduct",
          query: {
            Id:item.Id,
            blank: "y",
            save:false,
            tab: "配置签证产品"
          }
        });
    },
    // 修改/复制签证产品
    EditVisaProduct(item,type){
      if(type&&type=='copy'){
        return this.$router.push({
          name: "ModifyVisaProduct",
          query: {
            Id:item.Id,
            copy: 1,
            blank: "y",
            tab: "配置签证产品",
            copy:true
          }
        });
      }
      this.$router.push({
        name: "ModifyVisaProduct",
        query: {
          Id:item.Id,
          blank: "y",
          tab: "配置签证产品"
        }
      });
    },
    // 添加签证产品
    AddVisaProduct(){
      this.$router.push({
        name: "ModifyVisaProduct",
        query: {
          blank: "y",
          tab: "配置签证产品"
        }
      });
    },
    saveitem(tcid,Type) {
      this.uploadTCID = tcid;
      this.Type=Type;
    },
    //上传
    UploadAttachment(file) {
      let newArr = [];
      newArr.push(file.file);
      let path = "/Upload/Temporary/";
      this.UploadSelfFileT(path, newArr, x => {
        this.apipost(
          "dmc_get_visa_UploadVisaAdvertisingImage",
          {
            Path: this.domainManager().ViittoFileUrl + x.data.FilePath,
            FileName: file.file.name,
            Status: 1,
            VId: this.uploadTCID,
            Type:this.Type,
          },
          res => {
            if (res.data.resultCode === 1) {
              this.$message.success(this.$t('tips.scchenggong'));
              this.getList();
            } else {
              this.$message.error(this.$t('objFill.v101.Rest.shangchuansb'));
            }
          }
        );
      });
    },
    delUnpload: function(tcid, item,str,Type) {
      this.$confirm( `${this.$t('objFill.v101.Rest.shifouscgai')}${str}?`, this.$t('tips.tips'), {
        confirmButtonText: this.$t('pub.sureBtn'),
        cancelButtonText: this.$t('pub.cancelBtn'),
        type: "warning"
      }).then(() => {
        this.apipost(
          "dmc_get_visa_UploadVisaAdvertisingImage",
          {
            Path: item.FullUrl,
            FileName: item.Name,
            Status: 2,
            VId: tcid,
            Type:Type,
          },
          res => {
            if (res.data.resultCode === 1) {
              this.$message.Success(this.$t('tips.shanchuchenggong'));
              this.getList();
            } else {
              this.$message.error( this.$t('tips.shanchushibai'));
            }
          }
        );
      });
    },
    downloadFile: function(item) {
      let reg = /^http(s)?:\/\/(.*?)\//;
      this.downloadFileRename(item.FullUrl.replace(reg, ""), item.Name);
    },
    getCompanyList() {
      let userInfo = this.getLocalStorage();
      let RB_Group_id = userInfo.RB_Group_id;
      let msg = {
        Status: 0,
        is_show: 0,
        RB_Group_Id: RB_Group_id
      };
      this.apipost(
        "admin_get_BranchGetList",
        msg,
        res => {
          if (res.data.resultCode == 1) {
            this.companyList = [
              {
                Id: "-1",
                BName: this.$t('pub.unlimitedSel')
              }
            ];
            res.data.data.forEach(x => {
              var obj = {
                Id: "",
                BName: ""
              };
              obj.Id = x.Id.toString();
              obj.BName = x.BName;
              this.companyList.push(obj);
            });
          }
        },
        err => {}
      );
    },
    getVisaManagementList() {
      //  获取签证管理
      this.VisaManagementList = [];
      this.addMsg.VisaManagementId = "";
      this.apipost(
        "dmc_get_visa_GetVisaManagementList",
        { Status: -1, BranchId: -1, SignStatus: this.addMsg.VisaType },
        res => {
          if (res.data.resultCode == 1) {
            this.VisaManagementList = res.data.data;
          } else {
            this.$message.error(res.data.message);
          }
        },
        err => {}
      );
    },
    goUrl(obj) {
      this.$router.push({
        name: "VisaProductOrder",
        query: {
          id: obj.Id,
          name: obj.Name,
          sendDate: obj.SendVisaDate,
          isShow: 0,
          EmId: "-1",
          blank: "y",
          tab: "详情"
        }
      });
    },
    goUrlVisaList(obj) {
      this.$router.push({
        name: "visaList2",
        query: { id: obj.Id, blank: "y", tab: "签证列表" }
      });
    },
    goUrlJS(obj) {
      this.$router.push({
        name: "saleOrderSettlement",
        query: {
          id: obj.Id,
          branchId: obj.RB_Branch_Id,
          blank: "y",
          tab: "结算列表"
        }
      });
    },
    getList() {
      this.msg.SalePlat =  this.msg.ckedplat.length>0?this.msg.ckedplat.join(','):'';
      // 获取列表数据
      this.apipost(
        "dmc_get_visa_GetVisaProductList",
        this.msg,
        res => {
          if (res.data.resultCode == 0) {
            this.loading = false;
            this.dataList = [];
          } else {
            let arrList = function(arr) {
             arr.forEach(x=>{
               x.ckedplat = []
               x.checkDialogAll = false
               x.SalePlat = ''
             }) 
            }
            arrList(res.data.data.pageData)
            this.dataList = res.data.data.pageData;
            this.dataList.forEach(x=>{
              if(x.SalePlatList.length>0){
                x.ckedplat = x.SalePlatList
                if(x.SalePlatList.length==this.$tripUtils.TeamStatesList.salsPlat.length){
                  x.checkDialogAll = true
                } 
                if(x.SalePlatList.length>0){
                  x.SalePlat = x.SalePlatList.join(',')
                }
              }
            })
            this.total = res.data.data.count;
            this.loading = false;
          }
        },
        err => {}
      );
    },
    getDetail(obj) {
      this.addMsg.Id = obj.Id;
      this.apipost(
        "dmc_get_visa_GetVisaProductInfo",
        { Pid: obj.Id },
        res => {
          if (res.data.resultCode == 1) {
            this.addMsg.VisaType = res.data.data.VisaType.toString();
            this.getVisaManagementList();
            this.addMsg.VisaManagementId = res.data.data.VisaManagementId;
            this.addMsg.Name = res.data.data.Name;

            this.addMsg.SendVisaDate = res.data.data.SendVisaDate;
            if (res.data.data.CostPrice) {
              this.addMsg.CostPrice = res.data.data.CostPrice.toString();
            } else {
              this.addMsg.CostPrice = "";
            }
            this.addMsg.VisaPrice = res.data.data.VisaPrice.toString();
            this.addMsg.VisaB2CPrice = res.data.data.VisaB2CPrice.toString();
            // this.addMsg.PeopleNum=res.data.data.PeopleNum.toString()
            this.addMsg.CommissionPrice = res.data.data.CommissionPrice.toString();
            this.addShow = true;
          } else {
          }
        },
        err => {}
      );
    },
    updateVisaStatus(obj) {
      this.addMsg.Id = obj.Id;
      this.apipost(
        "dmc_post_visa_SetVisaProductStatus",
        { Pid: obj.Id },
        res => {
          if (res.data.resultCode == 1) {
            this.addShow = false;
            this.getList();
            this.$message.success(res.data.message);
          } else {
            this.$message.error(res.data.message);
          }
        },
        err => {}
      );
    },
    getEmployeeList() {
      // 获取人
      this.apipost(
        "admin_get_GetEmployeeByUserDepartmentId",
        {},
        res => {
          if (res.data.resultCode == 1) {
            this.EmployeeList = res.data.data;
          } else {
            this.$message.error(res.data.message);
          }
        },
        err => {}
      );
    },
    saveVisa() {
      // 保存
      this.$refs["addMsg"].validate(valid => {
        if (valid) {
          this.addMsg.VisaManagementId == ""
            ? "0"
            : this.addMsg.VisaManagementId;
          this.apipost(
            "dmc_post_visa_SetVisaProduct",
            this.addMsg,
            res => {
              if (res.data.resultCode == 1) {
                this.addMsg = {
                  Id: 0,
                  Name: "",
                  VisaType: "",
                  SendVisaDate: "",
                  VisaPrice: "",
                  PeopleNum: "0",
                  CostPrice: "",
                  CommissionPrice: ""
                };
                this.$message.success(res.data.message);
                this.addShow = false;
                this.getList();
              } else {
                this.$message.error(res.data.message);
              }
            },
            err => {}
          );
        } else {
          return false;
        }
      });
    },
    cancelEdit() {
      // 取消新增
      this.addShow = false;
      this.addMsg = {
        Id: 0,
        Name: "",
        VisaType: "",
        SendVisaDate: "",
        VisaPrice: "",
        PeopleNum: "0",
        CostPrice: "",
        CommissionPrice: "",
        VisaManagementId: ""
      };
      this.resetForm("addMsg");
    },
    resetForm(formName) {
      // 重置表单
      this.$refs[formName].resetFields();
    },
    handleCurrentChange(val) {
      this.msg.pageIndex = val;
      this.getList();
    }
  },
  mounted() {
    this.userId = this.getLocalStorage().EmployeeId;
    this.msg.BranchId = this.getLocalStorage().RB_Branch_id.toString();
    this.msg.ProductID = this.$route.query.VisaID;
    this.msg.isFinacial =
      this.$route.query.isFinacial != undefined
        ? this.$route.query.isFinacial
        : 1;
    this.getList();
    this.getCompanyList();
    this.getEmployeeList();
  }
};
</script>