付延余
2022-12-19 8fc8838a441ae3d3b1616f4fc003b16292978b54
pages/new-application-form-data/new-application-form-data.vue
@@ -1,93 +1,112 @@
<template>
  <!-- 新增申请表单 -->
  <view class="new-application-form-data">
    <!-- page-mete的page-style属性相当于HTML的body属性 -->
    <!-- <page-meta :page-style="spanStyle"></page-meta> -->
    <!-- 表单 -->
   <!-- 新增申请表单 -->
   <view class="new-application-form-data">
      <!-- page-mete的page-style属性相当于HTML的body属性 -->
      <!-- <page-meta :page-style="spanStyle"></page-meta> -->
      <!-- 表单 -->
    <combination-title class="newApplicationTitle" title="新增"></combination-title>
    <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
    <!-- <u-notify :message="accountMsg" :show="trueMsg" :type="accountMsgType"></u-notify> -->
    <!-- <u-alert :title="accountMsg" :type="accountMsgType" :description="accountMsgType"></u-alert> -->
    <view class="formDataContaniner">
      <u--form labelPosition="left" :model="newFormData" :rules="rules" ref="formRef">
        <u-form-item @click="selectCustomer" labelWidth="20%" label="结算客户" prop="customerName" borderBottom
                     ref="customerNameRef">
          <u--input disabled disabledColor="#ffffff" v-model="newFormData.customerName" border="none"></u--input>
        </u-form-item>
        <u-form-item @click="selectContract" labelWidth="20%" label="合同编号" prop="contractNum" borderBottom
                     ref="contractNumRef">
          <u--input disabled disabledColor="#ffffff" v-model="newFormData.contractNum" border="none"></u--input>
        </u-form-item>
        <u-form-item labelWidth="20%" label="合同名称" borderBottom ref="contractNameRef">
          <u--input disabled disabledColor="#ffffff" v-model="newFormData.contractName" border="none"></u--input>
        </u-form-item>
        <u-form-item @click="showPayType = true" prop="payType" labelWidth="20%" label="付款方式" borderBottom
                     ref="payTypeRef">
          <u--input v-model="selectValue" disabled disabledColor="#ffffff" placeholder="请选择付款方式"
                    border="none"></u--input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item @click="timeShow = true" prop="startDate" labelWidth="20%" label="日期" borderBottom
                     ref="timeDataRef">
          <u--input v-model="timeDataStr" border="none" disabled disabledColor="#ffffff"
                    placeholder="请选择范围日期"></u--input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item labelWidth="20%" label="编号" borderBottom>
          <u--input border="none" disabled disabledColor="#ffffff" value="自动生成" placeholder="请输入编号"></u--input>
        </u-form-item>
      </u--form>
    </view>
      <combination-title class="newApplicationTitle" title="新增"></combination-title>
      <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
      <!-- <u-notify :message="accountMsg" :show="trueMsg" :type="accountMsgType"></u-notify> -->
      <!-- <u-alert :title="accountMsg" :type="accountMsgType" :description="accountMsgType"></u-alert> -->
      <view class="formDataContaniner">
         <u--form labelPosition="left" :model="newFormData" :rules="rules" ref="formRef">
            <u-form-item @click="selectLedger" labelWidth="20%" label="账套" borderBottom>
               <u--input disabled disabledColor="#ffffff" v-model="ledgerName" border="none"></u--input>
            </u-form-item>
            <u-form-item @click="selectCustomer" labelWidth="20%" label="结算客户" prop="customerName" borderBottom ref="customerNameRef">
               <u--input disabled disabledColor="#ffffff" v-model="newFormData.customerName" border="none"></u--input>
            </u-form-item>
            <u-form-item @click="selectContract" labelWidth="20%" label="合同编号" prop="contractNum" borderBottom ref="contractNumRef">
               <u--input disabled disabledColor="#ffffff" v-model="newFormData.contractNum" border="none"></u--input>
            </u-form-item>
            <u-form-item labelWidth="20%" label="合同名称" borderBottom ref="contractNameRef">
               <u--input disabled disabledColor="#ffffff" v-model="newFormData.contractName" border="none"></u--input>
            </u-form-item>
            <u-form-item @click="showPayType = true" prop="payType" labelWidth="20%" label="付款方式" borderBottom ref="payTypeRef">
               <u--input v-model="selectValue" disabled disabledColor="#ffffff" placeholder="请选择付款方式" border="none"></u--input>
               <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item @click="timeShow = true" prop="startDate" labelWidth="20%" label="日期" borderBottom ref="timeDataRef">
               <u--input v-model="timeDataStr" border="none" disabled disabledColor="#ffffff" placeholder="请选择范围日期"></u--input>
               <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item labelWidth="20%" label="编号" borderBottom>
               <u--input border="none" disabled disabledColor="#ffffff" value="自动生成" placeholder="请输入编号"></u--input>
            </u-form-item>
         </u--form>
      </view>
    <!-- 申请日历、范围时间 -->
    <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110"
                :maxDate="maxDate"></u-calendar>
    <!-- 申请付款方式弹出菜单 -->
    <u-action-sheet :show="showPayType" :actions="actions" title="请选择付款方式" @close="showPayType = false"
                    @select="sexSelect"></u-action-sheet>
      <!-- 选择账套 -->
      <u-picker
         @change="selectLedgerChange"
         @confirm="selectLedgerConfirm"
         @cancel="selectLedgerCancel"
         @close="selectLedgerClose"
         :show="selectLedgerShow"
         :columns="ledgerList"
         keyName="name"
         :closeOnClickOverlay="true"
      ></u-picker>
    <!-- 选择客户弹框 -->
    <!--  @touchmove.stop.prevent="moveHandleCustomer":防止图层穿透 -->
    <view class="selectCustomerPopup">
      <u-popup :show="selectCustomerShow" @close="selectCustomerClose" @open="selectCustomerOpen" mode="bottom"
               round="22">
        <scroll-view scroll-y="true" style="height:100%;">
          <combination-title class="selectCustomerTitle" title="选择客户"></combination-title>
          <view class="selectCustomerContainer">
            <view class="searchContainer">
              <u--form labelPosition="left" :model="searchCustomerForm" ref="selectformRef">
                <u-form-item @click="selectCustomerCompShow = true;hideKeyboard() " labelWidth="12%" label="单位"
                             borderBottom ref="compRef">
                  <u--input v-model="searchCustomerForm.compName" disabled disabledColor="#ffffff" placeholder="点击选择单位"
                            border="none"></u--input>
                  <!--                           <u-icon slot="right" name="close-circle-fill" @click="searchCustomerForm.compName = ''"></u-icon>-->
                </u-form-item>
                <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="timeDataRef">
                  <u--input v-model="selectCustomerData.customerFullName" border="none" placeholder="输入客户名称"></u--input>
                  <u-icon slot="right" name="close-circle-fill"
                          @click="selectCustomerData.customerFullName = ''"></u-icon>
                </u-form-item>
                <u-form-item @click="selectLevelShow = true;hideKeyboard()" labelWidth="20%" label="客户级别" borderBottom>
                  <u--input border="none" v-model="searchCustomerForm.levelText" disabled disabledColor="#ffffff"
                            placeholder="点击选择级别"></u--input>
                  <!--                           <u-icon slot="right" name="close-circle-fill" @click="searchCustomerForm.levelText = ''"></u-icon>-->
                </u-form-item>
              </u--form>
            </view>
            <view class="searchCustomerBtn">
              <u-button text="搜索" type="primary" @click="selectCustomer()"></u-button>
              <u-button text="清空" @click="selectCustomerResetFields"></u-button>
            </view>
            <!-- 客户列表 -->
            <view class="searchResultList">
              <u-cell-group :right-icon="false">
                <u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
                  <view slot="value" class="u-slot-value">
                    <button
                        type="default"
                        size="mini"
                        style="background: #007aff;
      <!-- 申请日历、范围时间 -->
      <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110" ></u-calendar>
      <!-- 申请付款方式弹出菜单 -->
      <u-action-sheet :show="showPayType" :actions="actions" title="请选择付款方式" @close="showPayType = false" @select="sexSelect"></u-action-sheet>
      <!-- 选择客户弹框 -->
      <!--  @touchmove.stop.prevent="moveHandleCustomer":防止图层穿透 -->
      <view class="selectCustomerPopup">
         <u-popup :show="selectCustomerShow" @close="selectCustomerClose" @open="selectCustomerOpen" mode="bottom" round="22">
            <scroll-view scroll-y="true" style="height:100%;">
               <combination-title class="selectCustomerTitle" title="选择客户"></combination-title>
               <view class="selectCustomerContainer">
                  <view class="searchContainer">
                     <u--form labelPosition="left" :model="searchCustomerForm" ref="selectformRef">
                        <u-form-item
                           @click="
                              selectCustomerCompShow = true;
                              hideKeyboard();
                           "
                           labelWidth="12%"
                           label="单位"
                           borderBottom
                           ref="compRef"
                        >
                           <u--input v-model="searchCustomerForm.compName" disabled disabledColor="#ffffff" placeholder="点击选择单位" border="none"></u--input>
                           <!--                           <u-icon slot="right" name="close-circle-fill" @click="searchCustomerForm.compName = ''"></u-icon>-->
                        </u-form-item>
                        <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="timeDataRef">
                           <u--input v-model="selectCustomerData.customerFullName" border="none" placeholder="输入客户名称"></u--input>
                           <u-icon slot="right" name="close-circle-fill" @click="selectCustomerData.customerFullName = ''"></u-icon>
                        </u-form-item>
                        <u-form-item
                           @click="
                              selectLevelShow = true;
                              hideKeyboard();
                           "
                           labelWidth="20%"
                           label="客户级别"
                           borderBottom
                        >
                           <u--input border="none" v-model="searchCustomerForm.levelText" disabled disabledColor="#ffffff" placeholder="点击选择级别"></u--input>
                           <!--                           <u-icon slot="right" name="close-circle-fill" @click="searchCustomerForm.levelText = ''"></u-icon>-->
                        </u-form-item>
                     </u--form>
                  </view>
                  <view class="searchCustomerBtn">
                     <u-button text="搜索" type="primary" @click="selectCustomer()"></u-button>
                     <u-button text="清空" @click="selectCustomerResetFields"></u-button>
                  </view>
                  <!-- 客户列表 -->
                  <view class="searchResultList">
                     <u-cell-group :right-icon="false">
                        <u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
                           <view slot="value" class="u-slot-value">
                              <button
                                 type="default"
                                 size="mini"
                                 style="background: #007aff;
                                 color: #ffffff;
                                 margin: auto 0;
                                 height: 20px;
@@ -95,433 +114,383 @@
                                 width: 43px;
                                 font-size: 10px;
                                 padding: 0;"
                        @click="selectCustomerOkClick(item)"
                    >
                      选择
                    </button>
                  </view>
                </u-cell>
              </u-cell-group>
            </view>
            <view class="loadmoreClass">
              <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="status" @loadmore="loadingCustomer"
                          fontSize="20" height="30px"/>
            </view>
            <!-- 选择用户菜单项 -->
            <view class="selectCustomerCompSheet">
              <u-action-sheet
                  :show="selectCustomerCompShow"
                  :actions="selectCustomerActions"
                  title="请选择单位"
                  @close="selectCustomerCompShow = false"
                  @select="selectCustomerSelect"
              ></u-action-sheet>
            </view>
                                 @click="selectCustomerOkClick(item)"
                              >
                                 选择
                              </button>
                           </view>
                        </u-cell>
                     </u-cell-group>
                  </view>
                  <view class="loadmoreClass">
                     <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="status" @loadmore="loadingCustomer" fontSize="20" height="30px" />
                  </view>
                  <!-- 选择用户菜单项 -->
                  <view class="selectCustomerCompSheet">
                     <u-action-sheet
                        :show="selectCustomerCompShow"
                        :actions="selectCustomerActions"
                        title="请选择单位"
                        @close="selectCustomerCompShow = false"
                        @select="selectCustomerSelect"
                     ></u-action-sheet>
                  </view>
            <!-- 级别菜单项 -->
            <view class="selectLevelSheet">
              <u-action-sheet :show="selectLevelShow" :actions="levelList" title="请选择级别"
                              @close="selectLevelShow = false" @select="selectLevelSelect"></u-action-sheet>
            </view>
          </view>
        </scroll-view>
      </u-popup>
    </view>
                  <!-- 级别菜单项 -->
                  <view class="selectLevelSheet">
                     <u-action-sheet :show="selectLevelShow" :actions="levelList" title="请选择级别" @close="selectLevelShow = false" @select="selectLevelSelect"></u-action-sheet>
                  </view>
               </view>
            </scroll-view>
         </u-popup>
      </view>
    <!-- 选择合同 -->
    <!-- @touchmove.stop.prevent="moveHandleContract" -->
    <view class="selectCustomerPopup">
      <u-popup :show="selectContractShow" @close="selectContractClose" @open="selectContractOpen" mode="bottom"
               round="22">
        <scroll-view scroll-y="true" style="height:100%;">
          <combination-title class="selectCustomerTitle" title="选择合同"></combination-title>
          <view class="selectCustomerContainer">
            <view class="searchContainer">
              <u--form labelPosition="left" :model="searchContractForm" ref="selectformRef">
                <u-form-item labelWidth="18%" label="合同编号" borderBottom ref="compRef">
                  <u--input v-model="searchContractForm.num" placeholder="请输入合同编号" border="none"></u--input>
                  <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.num != ''"
                          @click="searchContractForm.num = ''"></u-icon>
                </u-form-item>
                <u-form-item labelWidth="18%" label="客户名称" borderBottom ref="compRef">
                  <u--input v-model="searchContractForm.customerName" placeholder="请输入客户名称" border="none"></u--input>
                  <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.customerName != ''"
                          @click="searchContractForm.customerName = ''"></u-icon>
                </u-form-item>
                <u-form-item labelWidth="18%" label="合同类型" borderBottom ref="compRef"
                             @click="searchContractFormTypeFocus">
                  <u--input v-model="searchContractForm.type" disabled disabledColor="#ffffff" placeholder="请输入合同类型"
                            border="none"></u--input>
                  <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.type != ''" @click="searchContractForm.type = ''"></u-icon>-->
                </u-form-item>
                <u-form-item labelWidth="18%" label="签订日期" borderBottom ref="compRef"
                             @click="selectContractStartTimeShow = true">
                  <u--input v-model="searchContractForm.startDate" disabled disabledColor="#ffffff"
                            placeholder="点击选择签订日期" border="none"></u--input>
                  <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.startDate != ''" @click="searchContractForm.startDate = ''"></u-icon>-->
                </u-form-item>
                <u-form-item labelWidth="18%" label="结束日期" borderBottom ref="compRef"
                             @click="selectContractEndTimeShow = true">
                  <u--input v-model="searchContractForm.endDate" disabled disabledColor="#ffffff" placeholder="点击选择结束日期"
                            border="none"></u--input>
                  <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.endDate != ''" @click="searchContractForm.endDate = ''"></u-icon>-->
                </u-form-item>
              </u--form>
            </view>
            <view class="searchCustomerBtn">
              <u-button text="搜索" type="primary" @click="selectContractOpen()"></u-button>
              <u-button text="清空" @click="selectContractResetFields"></u-button>
            </view>
            <!-- 合同列表 -->
            <view class="tableContract">
              <view class="tableBody">
                <uni-table border emptyText="暂无更多数据">
                  <uni-tr>
                    <uni-th width="100" align="center">组织结构</uni-th>
                    <uni-th width="250" align="center">客户名称</uni-th>
                    <uni-th width="180" align="center">煤种名称</uni-th>
                    <uni-th width="220" align="center">合同编号</uni-th>
                    <uni-th width="90" align="center">合同类型</uni-th>
                    <uni-th width="130" align="center">签订日期</uni-th>
                    <uni-th width="130" align="center">终止日期</uni-th>
                    <uni-th width="100" align="center">合同总量</uni-th>
                    <uni-th width="100" align="center">合同金额</uni-th>
                    <uni-th width="70" align="center">状态</uni-th>
                  </uni-tr>
                  <uni-tr v-for="(item, index) in contractData" :key="index">
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.compName }}</view>
                    </uni-td>
                    <uni-td align="left">
                      <view class="contractTableTd">{{ item.customerName }}</view>
              </uni-td>
                    <uni-td align="center">
                      <view class="contractTableTd">{{ item.coalNames }}</view>
                    </uni-td>
                    <uni-td align="left">
                      <view :style="tdStyle">{{ item.num }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.type }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.startDate }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.endDate }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.countExecutive }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.executive }}</view>
                    </uni-td>
                    <uni-td align="center">
                      <view :style="tdStyle">{{ item.status }}</view>
                    </uni-td>
                  </uni-tr>
                </uni-table>
              </view>
      <!-- 选择合同 -->
      <!-- @touchmove.stop.prevent="moveHandleContract" -->
      <view class="selectCustomerPopup">
         <u-popup :show="selectContractShow" @close="selectContractClose" @open="selectContractOpen" mode="bottom" round="22">
            <scroll-view scroll-y="true" style="height:100%;">
               <combination-title class="selectCustomerTitle" title="选择合同"></combination-title>
               <view class="selectCustomerContainer">
                  <view class="searchContainer">
                     <u--form labelPosition="left" :model="searchContractForm" ref="selectformRef">
                        <u-form-item labelWidth="20%" label="合同编号" borderBottom ref="compRef">
                           <u--input v-model="searchContractForm.num" placeholder="请输入合同编号" border="none"></u--input>
                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.num != ''" @click="searchContractForm.num = ''"></u-icon>
                        </u-form-item>
                        <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="compRef">
                           <u--input v-model="searchContractForm.customerName" placeholder="请输入客户名称" border="none"></u--input>
                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.customerName != ''" @click="searchContractForm.customerName = ''"></u-icon>
                        </u-form-item>
                        <u-form-item labelWidth="20%" label="合同类型" borderBottom ref="compRef" @click="searchContractFormTypeFocus">
                           <u--input v-model="searchContractForm.type" disabled disabledColor="#ffffff" placeholder="请输入合同类型" border="none"></u--input>
                           <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.type != ''" @click="searchContractForm.type = ''"></u-icon>-->
                        </u-form-item>
                        <u-form-item labelWidth="20%" label="签订日期" borderBottom ref="compRef" @click="selectContractStartTimeShow = true">
                           <u--input v-model="searchContractForm.startDate" disabled disabledColor="#ffffff" placeholder="点击选择签订日期" border="none"></u--input>
                           <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.startDate != ''" @click="searchContractForm.startDate = ''"></u-icon>-->
                        </u-form-item>
                        <u-form-item labelWidth="20%" label="结束日期" borderBottom ref="compRef" @click="selectContractEndTimeShow = true">
                           <u--input v-model="searchContractForm.endDate" disabled disabledColor="#ffffff" placeholder="点击选择结束日期" border="none"></u--input>
                           <!--                           <u-icon slot="right" name="close-circle-fill" v-show="searchContractForm.endDate != ''" @click="searchContractForm.endDate = ''"></u-icon>-->
                        </u-form-item>
                     </u--form>
                  </view>
                  <view class="searchCustomerBtn">
                     <u-button text="搜索" type="primary" @click="selectContractOpen()"></u-button>
                     <u-button text="清空" @click="selectContractResetFields"></u-button>
                  </view>
                  <!-- 合同列表 -->
                  <!-- 滚动通知 -->
                  <view class="tapStyle">
                    <u-notice-bar :text="noticeText" fontSize="24"></u-notice-bar>
                  </view>
                  <view class="tableContract">
                     <view class="tableBody">
                        <uni-table border emptyText="暂无更多数据">
                           <uni-tr>
                              <uni-th width="130" align="center">煤种名称</uni-th>
                              <uni-th width="250" align="center">客户名称</uni-th>
                              <uni-th width="230" align="center">合同编号</uni-th>
                              <uni-th width="100" align="center">合同类型</uni-th>
                              <uni-th width="130" align="center">签订日期</uni-th>
                              <uni-th width="130" align="center">终止日期</uni-th>
                              <uni-th width="100" align="center">合同总量</uni-th>
                              <uni-th width="120" align="center">合同金额</uni-th>
                              <uni-th width="70" align="center">状态</uni-th>
                              <uni-th width="130" align="center">组织结构</uni-th>
                           </uni-tr>
                           <uni-tr v-for="(item, index) in contractData" :key="index">
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.coalNames }}</view>
                              </uni-td>
                              <uni-td align="left">
                                 <view class="contractTableTd">{{ item.customerName }}</view>
                              </uni-td>
                              <uni-td align="left">
                                 <view :style="tdStyle">{{ item.num }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.type }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.startDate }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.endDate }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.countExecutive }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.executive }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.status }}</view>
                              </uni-td>
                              <uni-td align="center">
                                 <view :style="tdStyle">{{ item.compName }}</view>
                              </uni-td>
                           </uni-tr>
                        </uni-table>
                     </view>
              <view class="TableUtilBtn">
                <uni-table border emptyText="暂无更多数据">
                  <uni-tr>
                    <uni-th align="center">操作</uni-th>
                  </uni-tr>
                  <uni-tr v-for="(item, index) in contractData" :key="index">
                    <uni-td align="center">
                      <!-- 选择合同 -->
                      <view class="TableUtilBtnContainer">
                        <u-button type="primary" @click="selectContractClick(item)" icon="checkbox-mark"
                                  size="mini"></u-button>
                      </view>
                    </uni-td>
                  </uni-tr>
                </uni-table>
              </view>
            </view>
            <!-- 合同加载更多 -->
            <view class="loadmoreClass">
              <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="statusContractLoading" @loadmore="loadingContract"
                          fontSize="20" height="30px"/>
            </view>
            <!-- 合同类型选择器 -->
            <view class="selectContractTypePicker">
              <u-picker
                  :closeOnClickOverlay="true"
                  @close="selectContractTypeClose"
                  @cancel="selectContractTypeShow = false"
                  @confirm="selectContractTypeConfirm"
                  :show="selectContractTypeShow"
                  :columns="selectContractTypeData"
              ></u-picker>
            </view>
            <!-- 时间选择器 -->
            <view class="selectContractStartTime">
              <u-calendar
                  :show="selectContractStartTimeShow"
                  @close="selectContractStartTimeClose"
                  :mode="selectContractTimeMode"
                  @confirm="selectContractStartTimeConfirm"
              ></u-calendar>
            </view>
            <view class="selectContractEndTime">
              <u-calendar :show="selectContractEndTimeShow" @close="selectContractEndTimeClose"
                          :mode="selectContractTimeMode" @confirm="selectContractEndTimeConfirm"></u-calendar>
            </view>
          </view>
        </scroll-view>
      </u-popup>
    </view>
                     <view class="TableUtilBtn">
                        <uni-table border emptyText="暂无更多数据">
                           <uni-tr><uni-th align="center">操作</uni-th></uni-tr>
                           <uni-tr v-for="(item, index) in contractData" :key="index">
                              <uni-td align="center">
                                 <!-- 选择合同 -->
                                 <view class="TableUtilBtnContainer"><u-button type="primary" @click="selectContractClick(item)" icon="checkbox-mark" size="mini"></u-button></view>
                              </uni-td>
                           </uni-tr>
                        </uni-table>
                     </view>
                  </view>
                  <!-- 合同加载更多 -->
                  <view class="loadmoreClass">
                     <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="statusContractLoading" @loadmore="loadingContract" fontSize="20" height="30px" />
                  </view>
                  <!-- 合同类型选择器 -->
                  <view class="selectContractTypePicker">
                     <u-picker
                        :closeOnClickOverlay="true"
                        @close="selectContractTypeClose"
                        @cancel="selectContractTypeShow = false"
                        @confirm="selectContractTypeConfirm"
                        :show="selectContractTypeShow"
                        :columns="selectContractTypeData"
                     ></u-picker>
                  </view>
                  <!-- 时间选择器 -->
                  <view class="selectContractStartTime">
                     <u-calendar
                        :show="selectContractStartTimeShow"
                        @close="selectContractStartTimeClose"
                        :mode="selectContractTimeMode"
                        @confirm="selectContractStartTimeConfirm"
                     ></u-calendar>
                  </view>
                  <view class="selectContractEndTime">
                     <u-calendar :show="selectContractEndTimeShow" @close="selectContractEndTimeClose" :mode="selectContractTimeMode" @confirm="selectContractEndTimeConfirm"></u-calendar>
                  </view>
               </view>
            </scroll-view>
         </u-popup>
      </view>
    <!-- 添加合同子项 -->
    <view class="addContractContainer">
      <u-popup :show="addContractShow" @close="addContractClose" @open="addContractOpen" mode="bottom" round="22">
        <scroll-view scroll-y="true" style="height:100%;">
          <combination-title class="addContractFormTitle" title="添加订单"></combination-title>
          <!-- 添加用户表单 -->
          <view class="addContractForm">
            <u--form labelPosition="left" :model="addContractFormdata" :rules="addContractRules" ref="form1">
              <view class="formUpCard">
                <u-form-item label="矿厂" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractFormdata.filedName" disabled disabledColor="#ffffff"
                            border="none"></u--input>
                </u-form-item>
                <u-form-item @click="coalFiledSelectShow = true" label="煤厂" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractFormdata.compName" disabled disabledColor="#ffffff"></u--input>
                </u-form-item>
                <u-form-item label="收货人" labelWidth="20%" ref="item1" @click="addContractConsignee">
                  <u--input v-model="addContractFormdata.customerName" disabled disabledColor="#ffffff"></u--input>
                </u-form-item>
                <u-form-item @click="addContractCoalShow = true" label="品种" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractFormdata.coalName" disabled disabledColor="#ffffff"></u--input>
                </u-form-item>
                <template>
                  <!--    价格卡片 -->
                  <view class="priceList" v-if="showPrice && favouredpolicyListcomputed">
                    <view class="currentPriceContainer">
                      <u-divider text="当前价格"></u-divider>
                      <view class="currentPriceBox">
                        <u--form :model="currentCoal" labelPosition="left">
                          <u-form-item label="煤种" labelWidth="35%">
                            <u--input v-model="currentCoal.coalName" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                          <u-form-item :label="currentCoal.type == 1 ? '钢厂长协' : '基准价'" labelWidth="35%">
                            <u--input v-model="currentCoal.steelMillPrice" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                          <u-form-item :label="currentCoal.type == 1 ? '焦化长协' : '电厂基准'" labelWidth="35%">
                            <u--input v-model="currentCoal.cokingPrice" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                          <u-form-item :label="currentCoal.type == 1 ? '非长协' : '区域外电厂价'" labelWidth="35%">
                            <u--input v-model="currentCoal.noImportantPrice" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                          <u-form-item label="挂牌价" labelWidth="35%">
                            <u--input v-model="currentCoal.quotePrice" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                        </u--form>
                      </view>
                    </view>
                    <view class="selectPriceContainer">
                      <u-divider text="选择价格"></u-divider>
                      <view class="selectPricebox">
                        <u--form labelPosition="left">
                          <u-form-item label="煤种" labelWidth="35%">
                            <u--input v-model="currentCoal.coalName" disabled disabledColor="#ffffff"
                                      border="none"></u--input>
                          </u-form-item>
                          <u-radio-group v-model="addContractFormdata.priceMode" placement="column"
                                         @change="groupChange">
                            <view class="selectPriceboxItem">
                              <u-form-item :label="currentCoal.type == 1 ? '钢厂长协' : '基准价'" labelWidth="35%">
                                <u--input v-model="afterPrice.steelMillPrice" disabled disabledColor="#ffffff"
                                          border="none"></u--input>
                              </u-form-item>
                              <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="0"
                                       @change="changePriceMode"></u-radio>
                            </view>
                            <view class="selectPriceboxItem">
                              <u-form-item :label="currentCoal.type == 1 ? '焦化长协' : '电厂基准'" labelWidth="35%">
                                <u--input v-model="afterPrice.cokingPrice" disabled disabledColor="#ffffff"
                                          border="none"></u--input>
                              </u-form-item>
                              <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="1"
                                       @change="changePriceMode"></u-radio>
                            </view>
                            <view class="selectPriceboxItem">
                              <u-form-item :label="currentCoal.type == 1 ? '非长协' : '区域外电厂价'" labelWidth="35%">
                                <u--input v-model="afterPrice.noImportantPrice" disabled disabledColor="#ffffff"
                                          border="none"></u--input>
                              </u-form-item>
                              <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="2"
                                       @change="changePriceMode"></u-radio>
                            </view>
                            <view class="selectPriceboxItem">
                              <u-form-item label="挂牌价" labelWidth="35%">
                                <u--input v-model="afterPrice.quotePrice" disabled disabledColor="#ffffff"
                                          border="none"></u--input>
                              </u-form-item>
                              <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="3"
                                       @change="changePriceMode"></u-radio>
                            </view>
                          </u-radio-group>
                        </u--form>
                      </view>
                    </view>
                    <view class="selectFavouredPolicy">
                      <u-divider text="选择优惠政策"></u-divider>
                      <view class="selectFavouredPolicyBox">
                        <uni-table ref="priceTableRef" :loading="loading" border stripe type="selection"
                                   emptyText="暂无更多数据" @selection-change="selectionChange">
                          <uni-tr>
                            <uni-th width="150" align="center">优惠方式</uni-th>
                            <uni-th width="60" align="center">符号</uni-th>
                            <uni-th width="60" align="center">值</uni-th>
                            <uni-th width="60" align="center">价格优惠</uni-th>
                          </uni-tr>
                          <uni-tr v-for="(item, index) in favouredpolicyList" :key="index">
                            <uni-td>{{ item.type }}</uni-td>
                            <uni-td align="center">{{ operator[item.method].label }}</uni-td>
                            <uni-td align="center">{{ item.val }}</uni-td>
                            <uni-td align="center">{{ item.price }}</uni-td>
                          </uni-tr>
                        </uni-table>
                      </view>
                    </view>
                  </view>
                </template>
                <u-form-item @click="addContractTransportShow = true" label="运输" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractTransport" disabled disabledColor="#ffffff"></u--input>
                </u-form-item>
              </view>
              <view class="formDownCard">
                <u-form-item label="单价" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractFormdata.price" disabled disabledColor="#ffffff"
                            border="none"></u--input>
                </u-form-item>
                <u-form-item label="订单金额" labelWidth="20%" ref="item1">
                  <u--input :disabled="addContractFormdata.trainType == 2" v-show="currentRowComputed"
                            v-model="addContractFormdata.amount"></u--input>
                </u-form-item>
                <u-form-item label="订单数量" labelWidth="20%" ref="item1">
                  <u--input :disabled="addContractFormdata.trainType == 1" @input="jisuanAmount"
                            v-model="addContractFormdata.quant"></u--input>
                </u-form-item>
              </view>
      <!-- 添加合同子项 -->
      <view class="addContractContainer">
         <u-popup :show="addContractShow" @close="addContractClose" @open="addContractOpen" mode="bottom" round="22">
            <scroll-view scroll-y="true" style="height:100%;">
               <combination-title class="addContractFormTitle" title="添加订单"></combination-title>
               <!-- 添加用户表单 -->
               <view class="addContractForm">
                  <u--form labelPosition="left" :model="addContractFormdata" :rules="addContractRules" ref="form1">
                     <view class="formUpCard">
                        <u-form-item label="矿厂" labelWidth="20%" ref="item1">
                           <u--input v-model="addContractFormdata.filedName" disabled disabledColor="#ffffff" border="none"></u--input>
                        </u-form-item>
                        <u-form-item @click="coalFiledSelectShow = true" label="煤厂" labelWidth="20%" ref="item1">
                           <u--input v-model="addContractFormdata.compName" disabled disabledColor="#ffffff"></u--input>
                        </u-form-item>
                        <u-form-item label="收货人" labelWidth="20%" ref="item1" @click="addContractConsignee">
                           <u--input v-model="addContractFormdata.customerName" disabled disabledColor="#ffffff"></u--input>
                        </u-form-item>
                        <u-form-item @click="addContractCoalShow = true" label="品种" labelWidth="20%" ref="item1">
                           <u--input v-model="addContractFormdata.coalName" disabled disabledColor="#ffffff"></u--input>
                        </u-form-item>
                        <template>
                           <!--    价格卡片 -->
                           <view class="priceList" v-if="showPrice && favouredpolicyListcomputed">
                              <view class="currentPriceContainer">
                                 <u-divider text="当前价格"></u-divider>
                                 <view class="currentPriceBox">
                                    <u--form :model="currentCoal" labelPosition="left">
                                       <u-form-item label="煤种" labelWidth="35%">
                                          <u--input v-model="currentCoal.coalName" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                       <u-form-item :label="currentCoal.type == 1 ? '钢厂长协' : '基准价'" labelWidth="35%">
                                          <u--input v-model="currentCoal.steelMillPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                       <u-form-item :label="currentCoal.type == 1 ? '焦化长协' : '电厂基准'" labelWidth="35%">
                                          <u--input v-model="currentCoal.cokingPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                       <u-form-item :label="currentCoal.type == 1 ? '非长协' : '区域外电厂价'" labelWidth="35%">
                                          <u--input v-model="currentCoal.noImportantPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                       <u-form-item label="挂牌价" labelWidth="35%">
                                          <u--input v-model="currentCoal.quotePrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                    </u--form>
                                 </view>
                              </view>
                              <view class="selectPriceContainer">
                                 <u-divider text="选择价格"></u-divider>
                                 <view class="selectPricebox">
                                    <u--form labelPosition="left">
                                       <u-form-item label="煤种" labelWidth="35%">
                                          <u--input v-model="currentCoal.coalName" disabled disabledColor="#ffffff" border="none"></u--input>
                                       </u-form-item>
                                       <u-radio-group v-model="addContractFormdata.priceMode" placement="column" @change="groupChange">
                                          <view class="selectPriceboxItem">
                                             <u-form-item :label="currentCoal.type == 1 ? '钢厂长协' : '基准价'" labelWidth="35%">
                                                <u--input v-model="afterPrice.steelMillPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                             </u-form-item>
                                             <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="0" @change="changePriceMode"></u-radio>
                                          </view>
                                          <view class="selectPriceboxItem">
                                             <u-form-item :label="currentCoal.type == 1 ? '焦化长协' : '电厂基准'" labelWidth="35%">
                                                <u--input v-model="afterPrice.cokingPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                             </u-form-item>
                                             <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="1" @change="changePriceMode"></u-radio>
                                          </view>
                                          <view class="selectPriceboxItem">
                                             <u-form-item :label="currentCoal.type == 1 ? '非长协' : '区域外电厂价'" labelWidth="35%">
                                                <u--input v-model="afterPrice.noImportantPrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                             </u-form-item>
                                             <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="2" @change="changePriceMode"></u-radio>
                                          </view>
                                          <view class="selectPriceboxItem">
                                             <u-form-item label="挂牌价" labelWidth="35%">
                                                <u--input v-model="afterPrice.quotePrice" disabled disabledColor="#ffffff" border="none"></u--input>
                                             </u-form-item>
                                             <u-radio shape="square" size="30" :customStyle="{ marginBottom: '8px' }" name="3" @change="changePriceMode"></u-radio>
                                          </view>
                                       </u-radio-group>
                                    </u--form>
                                 </view>
                              </view>
                              <view class="selectFavouredPolicy">
                                 <u-divider text="选择优惠政策"></u-divider>
                                 <view class="selectFavouredPolicyBox">
                                    <uni-table ref="priceTableRef" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
                                       <uni-tr>
                                          <uni-th width="150" align="center">优惠方式</uni-th>
                                          <uni-th width="60" align="center">符号</uni-th>
                                          <uni-th width="60" align="center">值</uni-th>
                                          <uni-th width="60" align="center">价格优惠</uni-th>
                                       </uni-tr>
                                       <uni-tr v-for="(item, index) in favouredpolicyList" :key="index">
                                          <uni-td>{{ item.type }}</uni-td>
                                          <uni-td align="center">{{ operator[item.method].label }}</uni-td>
                                          <uni-td align="center">{{ item.val }}</uni-td>
                                          <uni-td align="center">{{ item.price }}</uni-td>
                                       </uni-tr>
                                    </uni-table>
                                 </view>
                              </view>
                           </view>
                        </template>
                        <u-form-item @click="addContractTransportShow = true" label="运输" labelWidth="20%" ref="item1">
                           <u--input v-model="addContractTransport" disabled disabledColor="#ffffff"></u--input>
                        </u-form-item>
                     </view>
                     <view class="formDownCard">
                        <u-form-item label="单价" labelWidth="20%" ref="item1">
                           <u--input v-model="addContractFormdata.price" disabled disabledColor="#ffffff" border="none"></u--input>
                        </u-form-item>
                        <u-form-item label="订单金额" labelWidth="20%" ref="item1">
                           <u--input :disabled="addContractFormdata.trainType == 2" v-show="currentRowComputed" v-model="addContractFormdata.amount"></u--input>
                        </u-form-item>
                        <u-form-item label="订单数量" labelWidth="20%" ref="item1">
                           <u--input :disabled="addContractFormdata.trainType == 1" @input="jisuanAmount" v-model="addContractFormdata.quant"></u--input>
                        </u-form-item>
                     </view>
              <!-- <u-form-item label="发站" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.fromStation" border="none"></u--input></u-form-item>
                     <!-- <u-form-item label="发站" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.fromStation" border="none"></u--input></u-form-item>
              <u-form-item label="到站" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.toStation" border="none"></u--input></u-form-item>
              <u-form-item label="运费" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.cost1" border="none"></u--input></u-form-item>
              <u-form-item label="抑尘费" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.cost2" border="none"></u--input></u-form-item> -->
            </u--form>
                  </u--form>
            <view class="addContractConfirm">
              <u-button :text="editApplicationIndex != null ? '添加修改':'添加'" type="primary"
                        @click="addContractSanConfirm"></u-button>
            </view>
          </view>
                  <view class="addContractConfirm"><u-button :text="editApplicationIndex != null ? '添加修改' : '添加'" type="primary" @click="addContractSanConfirm"></u-button></view>
               </view>
          <!-- 选择煤厂 -->
          <view class="coalFiledSelectPopup">
            <u-popup :show="coalFiledSelectShow" @close="coalFiledSelectClose" @open="coalFiledSelectOpen" mode="bottom"
                     round="22">
              <scroll-view scroll-y="true" style="height:100%;">
                <combination-title class="selectCustomerTitle" title="选择煤厂"></combination-title>
                <view class="coalFiledSelectSearch"></view>
                <view class="coalFiledTable">
                  <view class="tableBody">
                    <uni-table border emptyText="暂无更多数据">
                      <uni-tr>
                        <uni-th width="120" align="center">煤厂名称</uni-th>
                        <uni-th width="120" align="center">煤厂编号</uni-th>
                        <uni-th width="120" align="center">所属矿</uni-th>
                        <uni-th width="120" align="center">备注</uni-th>
                      </uni-tr>
                      <uni-tr v-for="(item, index) in coalfiledData" :key="index">
                        <uni-td align="center">
                          <view :style="tdStyle">{{ item.name }}</view>
                        </uni-td>
                        <uni-td align="center">
                          <view :style="tdStyle">{{ item.num }}</view>
                        </uni-td>
                        <uni-td align="center">
                          <view :style="tdStyle">{{ item.compName }}</view>
                        </uni-td>
                        <uni-td align="left">
                          <view :style="tdStyle">{{ item.remark == null ? '' : item.remark }}</view>
                        </uni-td>
                      </uni-tr>
                    </uni-table>
                  </view>
               <!-- 选择煤厂 -->
               <view class="coalFiledSelectPopup">
                  <u-popup :show="coalFiledSelectShow" @close="coalFiledSelectClose" @open="coalFiledSelectOpen" mode="bottom" round="22">
                     <scroll-view scroll-y="true" style="height:100%;">
                        <combination-title class="selectCustomerTitle" title="选择煤厂"></combination-title>
                        <view class="coalFiledSelectSearch"></view>
                        <view class="coalFiledTable">
                           <view class="tableBody">
                              <uni-table border emptyText="暂无更多数据">
                                 <uni-tr>
                                    <uni-th width="120" align="center">煤厂名称</uni-th>
                                    <uni-th width="120" align="center">煤厂编号</uni-th>
                                    <uni-th width="120" align="center">所属矿</uni-th>
                                    <uni-th width="120" align="center">备注</uni-th>
                                 </uni-tr>
                                 <uni-tr v-for="(item, index) in coalfiledData" :key="index">
                                    <uni-td align="center">
                                       <view :style="tdStyle">{{ item.name }}</view>
                                    </uni-td>
                                    <uni-td align="center">
                                       <view :style="tdStyle">{{ item.num }}</view>
                                    </uni-td>
                                    <uni-td align="center">
                                       <view :style="tdStyle">{{ item.compName }}</view>
                                    </uni-td>
                                    <uni-td align="left">
                                       <view :style="tdStyle">{{ item.remark == null ? '' : item.remark }}</view>
                                    </uni-td>
                                 </uni-tr>
                              </uni-table>
                           </view>
                  <view class="TableUtilBtn">
                    <uni-table border emptyText="暂无更多数据">
                      <uni-tr>
                        <uni-th align="center">操作</uni-th>
                      </uni-tr>
                      <uni-tr v-for="(item, index) in coalfiledData" :key="index">
                        <uni-td align="center">
                          <!-- 选择合同 -->
                          <view class="TableUtilBtnContainer">
                            <u-button type="primary" @click="coalFiledSelectClick(item)" icon="checkbox-mark"
                                      size="mini"></u-button>
                          </view>
                        </uni-td>
                      </uni-tr>
                    </uni-table>
                  </view>
                </view>
              </scroll-view>
            </u-popup>
          </view>
                           <view class="TableUtilBtn">
                              <uni-table border emptyText="暂无更多数据">
                                 <uni-tr><uni-th align="center">操作</uni-th></uni-tr>
                                 <uni-tr v-for="(item, index) in coalfiledData" :key="index">
                                    <uni-td align="center">
                                       <!-- 选择合同 -->
                                       <view class="TableUtilBtnContainer"><u-button type="primary" @click="coalFiledSelectClick(item)" icon="checkbox-mark" size="mini"></u-button></view>
                                    </uni-td>
                                 </uni-tr>
                              </uni-table>
                           </view>
                        </view>
                     </scroll-view>
                  </u-popup>
               </view>
          <!-- 选择收货人 -->
          <view class="selectCustomerPopup">
            <u-popup :show="addContractConsigneeShow" @close="addContractConsigneeClose"
                     @open="addContractConsigneeOpen" mode="bottom" round="22">
              <scroll-view scroll-y="true" style="height:100%;">
                <combination-title class="selectCustomerTitle" title="选择收货人"></combination-title>
                <view class="selectCustomerContainer">
                  <view class="searchContainer">
                    <u--form labelPosition="left" :model="searchCustomerForm" ref="selectformRef">
                      <u-form-item labelWidth="12%" label="单位" borderBottom ref="compRef">
                        <u--input @focus="selectCustomerCompShow = true" v-model="searchCustomerForm.compName"
                                  placeholder="点击选择单位" border="none"></u--input>
                        <u-icon slot="right" name="close-circle-fill" v-if="searchCustomerForm.compName != ''"
                                @click="searchCustomerForm.compName = ''"></u-icon>
                      </u-form-item>
                      <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="timeDataRef">
                        <u--input v-model="selectCustomerData.customerFullName" border="none"
                                  placeholder="输入客户名称"></u--input>
                        <u-icon slot="right" name="close-circle-fill" v-if="selectCustomerData.customerFullName != ''"
                                @click="selectCustomerData.customerName = ''"></u-icon>
                      </u-form-item>
                      <u-form-item labelWidth="20%" label="客户级别" borderBottom>
                        <u--input @focus="selectLevelShow = true" border="none" v-model="searchCustomerForm.levelText"
                                  placeholder="点击选择级别"></u--input>
                        <u-icon slot="right" name="close-circle-fill" v-if="searchCustomerForm.levelText != ''"
                                @click="searchCustomerForm.levelText = ''"></u-icon>
                      </u-form-item>
                    </u--form>
                  </view>
                  <view class="searchCustomerBtn">
                    <u-button text="搜索" type="primary" @click="selectCustomer()"></u-button>
                    <u-button text="清空" @click="selectCustomerResetFields"></u-button>
                  </view>
                  <!-- 客户列表 -->
                  <view class="searchResultList">
                    <u-cell-group :right-icon="false">
                      <u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
                        <view slot="value" class="u-slot-value">
                          <button
                              class="mini-btn"
                              type="default"
                              size="mini"
                              style="background: #007aff;
               <!-- 选择收货人 -->
               <view class="selectCustomerPopup">
                  <u-popup :show="addContractConsigneeShow" @close="addContractConsigneeClose" @open="addContractConsigneeOpen" mode="bottom" round="22">
                     <scroll-view scroll-y="true" style="height:100%;">
                        <combination-title class="selectCustomerTitle" title="选择收货人"></combination-title>
                        <view class="selectCustomerContainer">
                           <view class="searchContainer">
                              <u--form labelPosition="left" :model="searchCustomerForm" ref="selectformRef">
                                 <u-form-item labelWidth="12%" label="单位" borderBottom ref="compRef">
                                    <u--input @focus="selectCustomerCompShow = true" v-model="searchCustomerForm.compName" placeholder="点击选择单位" border="none"></u--input>
                                    <u-icon slot="right" name="close-circle-fill" v-if="searchCustomerForm.compName != ''" @click="searchCustomerForm.compName = ''"></u-icon>
                                 </u-form-item>
                                 <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="timeDataRef">
                                    <u--input v-model="selectCustomerData.customerFullName" border="none" placeholder="输入客户名称"></u--input>
                                    <u-icon slot="right" name="close-circle-fill" v-if="selectCustomerData.customerFullName != ''" @click="selectCustomerData.customerName = ''"></u-icon>
                                 </u-form-item>
                                 <u-form-item labelWidth="20%" label="客户级别" borderBottom>
                                    <u--input @focus="selectLevelShow = true" border="none" v-model="searchCustomerForm.levelText" placeholder="点击选择级别"></u--input>
                                    <u-icon slot="right" name="close-circle-fill" v-if="searchCustomerForm.levelText != ''" @click="searchCustomerForm.levelText = ''"></u-icon>
                                 </u-form-item>
                              </u--form>
                           </view>
                           <view class="searchCustomerBtn">
                              <u-button text="搜索" type="primary" @click="selectCustomer()"></u-button>
                              <u-button text="清空" @click="selectCustomerResetFields"></u-button>
                           </view>
                           <!-- 客户列表 -->
                           <view class="searchResultList">
                              <u-cell-group :right-icon="false">
                                 <u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
                                    <view slot="value" class="u-slot-value">
                                       <button
                                          class="mini-btn"
                                          type="default"
                                          size="mini"
                                          style="background: #007aff;
                                          color: #ffffff;
                                          margin: auto 0;
                                          height: 20px;
@@ -529,71 +498,69 @@
                                          width: 43px;
                                          font-size: 10px;
                                          padding: 0;"
                              @click="addContractConsigneeConfirm(item)"
                          >
                            选择
                          </button>
                        </view>
                      </u-cell>
                    </u-cell-group>
                  </view>
                  <view class="loadmoreClass">
                    <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="status" @loadmore="loadingCustomer"
                                fontSize="20" height="30px"/>
                  </view>
                  <!-- 选择用户菜单项 -->
                  <view class="selectCustomerCompSheet">
                    <u-action-sheet
                        :show="selectCustomerCompShow"
                        :actions="selectCustomerActions"
                        title="请选择单位"
                        @close="selectCustomerCompShow = false"
                        @select="selectCustomerSelect"
                    ></u-action-sheet>
                  </view>
                  <!-- 级别菜单项 -->
                  <view class="selectLevelSheet">
                    <u-action-sheet :show="selectLevelShow" :actions="levelList" title="请选择级别"
                                    @close="selectLevelShow = false" @select="selectLevelSelect"></u-action-sheet>
                  </view>
                </view>
              </scroll-view>
            </u-popup>
          </view>
                                          @click="addContractConsigneeConfirm(item)"
                                       >
                                          选择
                                       </button>
                                    </view>
                                 </u-cell>
                              </u-cell-group>
                           </view>
                           <view class="loadmoreClass">
                              <u-loadmore loadmoreText="点击加载更多" nomoreText="无更多数据!!!" :status="status" @loadmore="loadingCustomer" fontSize="20" height="30px" />
                           </view>
                           <!-- 选择用户菜单项 -->
                           <view class="selectCustomerCompSheet">
                              <u-action-sheet
                                 :show="selectCustomerCompShow"
                                 :actions="selectCustomerActions"
                                 title="请选择单位"
                                 @close="selectCustomerCompShow = false"
                                 @select="selectCustomerSelect"
                              ></u-action-sheet>
                           </view>
                           <!-- 级别菜单项 -->
                           <view class="selectLevelSheet">
                              <u-action-sheet :show="selectLevelShow" :actions="levelList" title="请选择级别" @close="selectLevelShow = false" @select="selectLevelSelect"></u-action-sheet>
                           </view>
                        </view>
                     </scroll-view>
                  </u-popup>
               </view>
          <!-- 品种选择器 -->
          <view class="addContractCoalPicker">
            <u-picker
                :show="addContractCoalShow"
                :columns="addContractCoalData"
                @close="addContractCoalClose"
                @cancel="addContractCoalShow = false"
                @confirm="addContractCoalConfirm"
                :closeOnClickOverlay="true"
                keyName="label"
            ></u-picker>
          </view>
               <!-- 品种选择器 -->
               <view class="addContractCoalPicker">
                  <u-picker
                     :show="addContractCoalShow"
                     :columns="addContractCoalData"
                     @close="addContractCoalClose"
                     @cancel="addContractCoalShow = false"
                     @confirm="addContractCoalConfirm"
                     :closeOnClickOverlay="true"
                     keyName="label"
                  ></u-picker>
               </view>
          <!-- 运输选择器 -->
          <view class="addContractCoalPicker">
            <u-picker
                :show="addContractTransportShow"
                :columns="addContractTransportData"
                @close="addContractTransportClose"
                @cancel="addContractTransportShow = false"
                @confirm="addContractTransportConfirm"
                :closeOnClickOverlay="true"
                keyName="label"
            ></u-picker>
          </view>
        </scroll-view>
      </u-popup>
    </view>
               <!-- 运输选择器 -->
               <view class="addContractCoalPicker">
                  <u-picker
                     :show="addContractTransportShow"
                     :columns="addContractTransportData"
                     @close="addContractTransportClose"
                     @cancel="addContractTransportShow = false"
                     @confirm="addContractTransportConfirm"
                     :closeOnClickOverlay="true"
                     keyName="label"
                  ></u-picker>
               </view>
            </scroll-view>
         </u-popup>
      </view>
    <!-- 申请表格 -->
      <!-- 申请表格 -->
    <view class="newApplicationTable">
      <!-- <uni-table border stripe emptyText="暂无更多数据">
      <view class="newApplicationTable">
         <!-- <uni-table border stripe emptyText="暂无更多数据">
        <uni-tr v-for="(item, index) in 12" :key="index">
          <uni-th align="center">字段标题</uni-th>
          <uni-td>
@@ -611,87 +578,82 @@
          </uni-td>
        </uni-tr>
      </uni-table> -->
      <view class="balanceNo" v-if="accountDetails.balanceTotal < 0">
        <text style="color:red;">客户账户当前处于欠款状态</text>
      </view>
         <view class="balanceNo" v-if="accountDetails.balanceTotal < 0"><text style="color:red;">客户账户当前处于欠款状态</text></view>
      <view class="messageCustomerBalance" v-if="accountDetails.balanceTotal >= 0">
        <text style="color: #FFA500;">客户账户现汇余额:{{
            accountDetails.balance == null || undefined ? 0 : accountDetails.balance.toFixed(2)
          }},承兑余额:{{ accountDetails.balance2 == null || undefined ? 0 : accountDetails.balance2 }}
        </text>
      </view>
      <u-swipe-action>
        <u-swipe-action-item @click="deleteContractCardClick" :options="options1"
                             v-for="(item, index) in newFormData.contractOrders" :key="index">
          <view class="cardList">
            <view class="cardListIcon" @click="editApplicationClick(index)">
              <u-icon name="edit-pen" color="#2979ff" size="35"></u-icon>
            </view>
            <view class="cardList-container">
              <view class="cardList_item">
                收货人:
                <text>{{ item.customerName }}</text>
              </view>
              <view class="cardList_item">
                <view class="">
                  矿厂:
                  <text>{{ item.filedName }}</text>
                </view>
                <view class="">
                  煤厂:
                  <text>{{ item.compName }}</text>
                </view>
              </view>
         <view class="messageCustomerBalance" v-if="accountDetails.balanceTotal >= 0">
            <text style="color: #FFA500;">
               客户账户现汇余额:{{ accountDetails.balance == null || undefined ? 0 : accountDetails.balance.toFixed(2) }},承兑余额:{{
                  accountDetails.balance2 == null || undefined ? 0 : accountDetails.balance2
               }}
            </text>
         </view>
         <u-swipe-action>
            <u-swipe-action-item @click="deleteContractCardClick" :options="options1" v-for="(item, index) in newFormData.contractOrders" :key="index">
               <view class="cardList">
                  <view class="cardListIcon" @click="editApplicationClick(index)"><u-icon name="edit-pen" color="#2979ff" size="35"></u-icon></view>
                  <view class="cardList-container">
                     <view class="cardList_item">
                        收货人:
                        <text>{{ item.customerName }}</text>
                     </view>
                     <view class="cardList_item">
                        <view class="">
                           矿厂:
                           <text>{{ item.filedName }}</text>
                        </view>
                        <view class="">
                           煤厂:
                           <text>{{ item.compName }}</text>
                        </view>
                     </view>
              <view class="cardList_item">
                <view class="">
                  品种:
                  <text>{{ item.coalName }}</text>
                </view>
                <view class="">
                  运输:
                  <text>{{ item.trainType == 1 ? '路运' : '地销' }}</text>
                </view>
              </view>
              <view class="cardList_item">
                <view class="">
                  单价:
                  <text>{{ item.price }}</text>
                </view>
                <view class="">
                  订单金额:
                  <text>{{ item.amount }}</text>
                </view>
                <!-- <view class="">
                     <view class="cardList_item">
                        <view class="">
                           品种:
                           <text>{{ item.coalName }}</text>
                        </view>
                        <view class="">
                           运输:
                           <text>{{ item.trainType == 1 ? '路运' : '地销' }}</text>
                        </view>
                     </view>
                     <view class="cardList_item">
                        <view class="">
                           单价:
                           <text>{{ item.price }}</text>
                        </view>
                        <view class="">
                           订单金额:
                           <text>{{ item.amount }}</text>
                        </view>
                        <!-- <view class="">
                      订单数量:<text>218.899</text>
                    </view> -->
              </view>
            </view>
          </view>
        </u-swipe-action-item>
      </u-swipe-action>
                     </view>
                  </view>
               </view>
            </u-swipe-action-item>
         </u-swipe-action>
      <view class="addCard" @click="addContractClick">
        <view class="addCard-icon">
          <u-icon name="plus" size="100"></u-icon>
        </view>
      </view>
    </view>
         <view class="addCard" @click="addContractClick">
            <view class="addCard-icon"><u-icon name="plus" size="100"></u-icon></view>
         </view>
      </view>
    <view class="new-application-button">
      <u-button text="取消" :plain="true" type="primary" @click="backPage"></u-button>
      <u-button text="确定" type="primary" @click="newApplicationFormDataClick"></u-button>
    </view>
      <view class="new-application-button">
         <u-button text="取消" :plain="true" type="primary" @click="backPage"></u-button>
         <u-button text="确定" type="primary" @click="newApplicationFormDataClick"></u-button>
      </view>
    <!-- 菜单栏 -->
    <popup-menu @menuShow="menushow" ref="menuRef"></popup-menu>
  </view>
      <!-- 菜单栏 -->
      <popup-menu @menuShow="menushow" ref="menuRef"></popup-menu>
   </view>
</template>
<script>
import combinationTitle from '@/components/common/combined-title/combined-title.vue';
import popupMenu from '@/components/common/popup-menu/popup-menu.vue';
import { callWithErrorHandling } from 'vue';
// 最大显示的日期
const d = new Date();
@@ -700,1520 +662,1476 @@
month = month < 10 ? `0${month}` : month;
const date = d.getDate();
export default {
  data() {
    return {
      // accountMsgType: 'error',
      tdStyle: 'max-height: 30px;overflow: auto;',
      spanStyle: 'overflow:auto',
      newFormData: {
        amount: null,
        coalId: '',
        coalName: '',
        contractId: 169,
        contractName: '',
        contractNum: '',
        contractOrders: [],
        customerAddressId: '',
        customerId: 236,
        customerName: '',
        endDate: '',
        executiveQuant: null,
        id: null,
        number: '',
        payType: '',
        price: null,
        quant: null,
        remark: '',
        startDate: '',
        type: ''
      },
      accountDetails: {},
      // 时间
      timeDataStr: '',
      menuShow: false,
      // 表单
      selectCustomerShow: false, // 选择用户弹框
      showPayType: false, // 付款方式弹框
      payData: [],
      actions: [],
      selectValue: '',
      rules: {
        customerName: [
          {
            required: true,
            message: '请选择结算客户',
            trigger: ['blur', 'change']
          }
        ],
        contractNum: [
          {
            required: true,
            message: '请选择合同编号',
            trigger: ['blur', 'change']
          }
        ],
        payType: [
          {
            required: true,
            message: '请选择付款方式',
            trigger: ['blur', 'change']
          }
        ],
        startDate: [
          {
            required: true,
            message: '请选择时间',
            trigger: ['blur', 'change']
          }
        ]
      },
      // 时间
      timeShow: false,
      mode: 'range',
      maxDate: `${year}-${month}-${date + 70}`,
      // 选择客户
      selectCustomerData: {
        compIds: '',
        customerFullName: '',
        level: '',
        current: 1,
        size: 10
      },
      status: 'loadmore',
      customerDataAllNum: 0, //客户列表总条数
      account: null, //客户账户信息
      // 搜索字段
      selectCompsData: [],
      selectCustomerLevel: [],
      searchCustomerForm: {
        compName: '',
        levelText: ''
      },
      customerData: [],
      // 选择单位
      selectCustomerCompShow: false,
      selectCustomerActions: [],
      // 级别
      selectLevelShow: false,
      levelList: [{name: '一星级', value: 'A'}, {name: '二星级', value: 'B'}, {name: '三星级', value: 'C'}, {
        name: '四星级',
        value: 'D'
      }, {name: '五星级', value: 'E'}],
      // 选择合同
      selectContractShow: false,
      searchContractForm: {
        current: 1,
        size: 50,
        num: '',
        startDate: '',
        endDate: '',
        result: 2,
        type: '',
        customerName: ''
      },
      statusContractLoading: 'loadmore',
      contractDataAllNum:0, // 合同总数
      contractData: [],
      contractNumList: [],
      // 类型
      selectContractTypeShow: false,
      selectContractTypeData: [[]],
      // 时间
      selectContractTimeMode: 'single',
      selectContractStartTimeShow: false,
      selectContractEndTimeShow: false,
      // 添加合同
      addContractShow: false,
      // 添加合同表单
      addContractRules: {},
      addContractFormdata: {
        // amount: null,
        // coalId: null,
        // coalName: '',
        // compId: null,
        // compName: '',
        // cost1: '',
        // cost2: '',
        // customerId: null,
        // customerName: '',
        // edit: true,
        // favouredpolicyIds: '',
        // filedId: null,
        // filedName: '',
        // fromStation: '',
        // modifyId: null,
        // modifyInfoId: null,
        // customerAddressId: null,
        // price: null,
        // priceMode: '0',
        // quant: '',
        // toStation: '',
        // trainType: 1,
        // type: ''
      },
      contractDetails: [], // 选择的合同详情
      // 选择煤厂
      coalFiledSelectShow: false,
      coalfiledData: [],
      coalfiledParams: {current: 1, size: 10},
      selectCoalFiledData: {},
      // 选择收货人
      addContractConsigneeShow: false,
      // 品种选择器
      addContractCoalShow: false,
      addContractCoalData: [[]],
      // 运输类型
   data() {
      return {
         noticeText:'左右滑动表格可查看更多详情',
         // 账套选择器
         selectLedgerShow: false,
         ledgerList: [],
         ledgerName: '',
         // accountMsgType: 'error',
         tdStyle: 'max-height: 30px;overflow: auto;',
         spanStyle: 'overflow:auto',
         newFormData: {
            amount: null,
            coalId: '',
            coalName: '',
            contractId: 169,
            contractName: '',
            contractNum: '',
            contractOrders: [],
            customerAddressId: '',
            customerId: 236,
            customerName: '',
            endDate: '',
            executiveQuant: null,
            id: null,
            number: '',
            payType: '',
            price: null,
            quant: null,
            remark: '',
            startDate: '',
            type: '',
            ledgerId: null
            // ledgerName:''
         },
         accountDetails: {},
         // 时间
         timeDataStr: '',
         menuShow: false,
         // 表单
         selectCustomerShow: false, // 选择用户弹框
         showPayType: false, // 付款方式弹框
         payData: [],
         actions: [],
         selectValue: '',
         rules: {
            customerName: [
               {
                  required: true,
                  message: '请选择结算客户',
                  trigger: ['blur', 'change']
               }
            ],
            contractNum: [
               {
                  required: true,
                  message: '请选择合同编号',
                  trigger: ['blur', 'change']
               }
            ],
            payType: [
               {
                  required: true,
                  message: '请选择付款方式',
                  trigger: ['blur', 'change']
               }
            ],
            startDate: [
               {
                  required: true,
                  message: '请选择时间',
                  trigger: ['blur', 'change']
               }
            ]
         },
         // 时间
         timeShow: false,
         mode: 'range',
         // 选择客户
         selectCustomerData: {
            compIds: '',
            customerFullName: '',
            level: '',
            current: 1,
            size: 10
         },
         status: 'loadmore',
         customerDataAllNum: 0, //客户列表总条数
         account: null, //客户账户信息
         // 搜索字段
         selectCompsData: [],
         selectCustomerLevel: [],
         searchCustomerForm: {
            compName: '',
            levelText: ''
         },
         customerData: [],
         // 选择单位
         selectCustomerCompShow: false,
         selectCustomerActions: [],
         // 级别
         selectLevelShow: false,
         levelList: [
            { name: '一星级', value: 'A' },
            { name: '二星级', value: 'B' },
            { name: '三星级', value: 'C' },
            {
               name: '四星级',
               value: 'D'
            },
            { name: '五星级', value: 'E' }
         ],
         // 选择合同
         selectContractShow: false,
         searchContractForm: {
            current: 1,
            size: 50,
            num: '',
            startDate: '',
            endDate: '',
            result: 2,
            type: '',
            customerName: ''
         },
         statusContractLoading: 'loadmore',
         contractDataAllNum: 0, // 合同总数
         contractData: [],
         contractNumList: [],
         // 类型
         selectContractTypeShow: false,
         selectContractTypeData: [[]],
         // 时间
         selectContractTimeMode: 'single',
         selectContractStartTimeShow: false,
         selectContractEndTimeShow: false,
         // 添加合同
         addContractShow: false,
         // 添加合同表单
         addContractRules: {},
         addContractFormdata: {},
         contractDetails: [], // 选择的合同详情
         // 选择煤厂
         coalFiledSelectShow: false,
         coalfiledData: [],
         coalfiledParams: { current: 1, size: 10 },
         selectCoalFiledData: {},
         // 选择收货人
         addContractConsigneeShow: false,
         // 品种选择器
         addContractCoalShow: false,
         addContractCoalData: [[]],
         // 运输类型
      // 优惠
      favouredpolicyListAll: [], //优惠政策列表所有的
      favouredpolicyList: [], // 优惠政策列表
      multipleSelection: [], //选中的优惠政策
      // 单选框
      addContractTransport: '地销',
      // 品种价格表格
      loading: false,
      // 价格请求参数
      getNewPriceData: {
        // compId: 133,
        // compName: '邢台矿',
        // customerAddressName: '邢台国泰发电有限责任公司',
        // customerAddressId: 236,
        // coalId: 45,
        // coalName: '',
        // trainType: 1,
        // fromStation: '小康庄',
        // toStation: '小康庄',
        // quant: '',
        // price: '',
        // amount: '',
        // priceMode: null,
        // filedName: '邢台矿主煤场',
        // filedId: 4,
        // type: '',
        // cost1: '',
        // cost2: '',
        // edit: true
      },
      dust: null, // 抑尘费
      trainfreight: {}, //路运运费
      // 运输类型
      addContractTransportShow: false,
      addContractTransportData: [[{label: '地销', value: 1}, {label: '路运', value: 2}]],
      currentCoal: {
        coalName: '',
        cokingPrice: null,
        modifyId: null,
        modifyInfoId: null,
        noImportantPrice: null,
        quotePrice: null,
        steelMillPrice: null,
        type: null
      },
      // 滑动单元格
      options1: [
        {
          text: '删除'
        }
      ],
      editApplicationIndex: null
    };
  },
  onShow() {
    if (this.menuShow == true) {
      this.$refs.menuRef.menuClick();
    }
    this.init();
  },
  // 点击导航栏菜单后
  onNavigationBarButtonTap(e) {
    // console.log(e);
    this.$refs.menuRef.menuClick();
  },
  computed: {
    afterPrice() {
      let temp = Object.assign({}, this.currentCoal);
      let favouredpolicyIds = '';
      if (this.favouredpolicyList.length > 0) {
        this.multipleSelection.forEach(e => {
          if (favouredpolicyIds.length > 0) {
            favouredpolicyIds += ',';
          }
          favouredpolicyIds += e.id;
          temp.steelMillPrice -= e.price;
          temp.cokingPrice -= e.price;
          temp.noImportantPrice -= e.price;
          temp.quotePrice -= e.price;
        });
        if (this.multipleSelection.length > 0) {
          this.addContractFormdata.favouredpolicyIds = favouredpolicyIds;
        }
      }
         // 优惠
         favouredpolicyListAll: [], //优惠政策列表所有的
         favouredpolicyList: [], // 优惠政策列表
         multipleSelection: [], //选中的优惠政策
         // 单选框
         addContractTransport: '地销',
         // 品种价格表格
         loading: false,
         // 价格请求参数
         getNewPriceData: {},
         dust: null, // 抑尘费
         trainfreight: {}, //路运运费
         // 运输类型
         addContractTransportShow: false,
         addContractTransportData: [[{ label: '地销', value: 1 }, { label: '路运', value: 2 }]],
         currentCoal: {
            coalName: '',
            cokingPrice: null,
            modifyId: null,
            modifyInfoId: null,
            noImportantPrice: null,
            quotePrice: null,
            steelMillPrice: null,
            type: null
         },
         // 滑动单元格
         options1: [
            {
               text: '删除'
            }
         ],
         editApplicationIndex: null
      };
   },
   onShow() {
      if (this.menuShow == true) {
         this.$refs.menuRef.menuClick();
      }
      this.init();
   },
   // 点击导航栏菜单后
   onNavigationBarButtonTap(e) {
      // console.log(e);
      this.$refs.menuRef.menuClick();
   },
   computed: {
      afterPrice() {
         let temp = Object.assign({}, this.currentCoal);
         let favouredpolicyIds = '';
         if (this.favouredpolicyList.length > 0) {
            this.multipleSelection.forEach(e => {
               if (favouredpolicyIds.length > 0) {
                  favouredpolicyIds += ',';
               }
               favouredpolicyIds += e.id;
               temp.steelMillPrice -= e.price;
               temp.cokingPrice -= e.price;
               temp.noImportantPrice -= e.price;
               temp.quotePrice -= e.price;
            });
            if (this.multipleSelection.length > 0) {
               this.addContractFormdata.favouredpolicyIds = favouredpolicyIds;
            }
         }
         return temp;
      },
      showPrice() {
         if (this.addContractFormdata) {
            let row = this.addContractFormdata;
            if (row.compId && row.customerAddressId && row.coalId) {
               // console.log('看见价格', this.showPrice);
               // this.rowClik(this.currentRow);
               return true;
            }
         }
         return false;
      },
      //优惠政策
      favouredpolicyListcomputed() {
         let list = [];
         this.favouredpolicyListAll.forEach(e => {
            //支付方式
            if (e.type.indexOf('B') != -1 && e.coalIds) {
               if (e.coalIds.indexOf(this.addContractFormdata.coalId) != -1) {
                  list.push(e);
               }
            }
            //运距
            if (this.addContractFormdata.trainType == 2) {
               if (e.type.indexOf('A') != -1) {
                  list.push(e); //根据发站到站获取运距
               }
            }
         });
         this.favouredpolicyList = list;
         return true;
      },
      async currentRowComputed() {
         this.changePriceMode(this.addContractFormdata.priceMode); //变价格用的
         //变订单量
         if (this.addContractFormdata.price > 0 && (this.addContractFormdata.amount > 0 || this.addContractFormdata.quant > 0)) {
            let price = this.addContractFormdata.price;
            if (this.addContractFormdata.trainType == 1) {
               let q = this.addContractFormdata.amount / price;
               this.addContractFormdata.quant = q.toFixed(2);
               this.addContractFormdata.cost1 = null; //运费
               this.addContractFormdata.cost2 = null; //抑尘费
            } else if (this.addContractFormdata.trainType == 2) {
               //如果路运价格增加,抑尘费和运费
               let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //路运运费
               price += cost1Price;
               price += this.dust;
               this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //运费
               this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //抑尘费
      return temp;
    },
    showPrice() {
      if (this.addContractFormdata) {
        let row = this.addContractFormdata;
        if (row.compId && row.customerAddressId && row.coalId) {
          // console.log('看见价格', this.showPrice);
          // this.rowClik(this.currentRow);
          return true;
        }
      }
      return false;
    },
    //优惠政策
    favouredpolicyListcomputed() {
      let list = [];
      this.favouredpolicyListAll.forEach(e => {
        //支付方式
        if (e.type.indexOf('B') != -1 && e.coalIds) {
          if (e.coalIds.indexOf(this.addContractFormdata.coalId) != -1) {
            list.push(e);
          }
        }
        //运距
        if (this.addContractFormdata.trainType == 2) {
          if (e.type.indexOf('A') != -1) {
            //根据发站到站获取运距
            list.push(e);
          }
        }
      });
      this.favouredpolicyList = list;
               let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2);
               console.log(amount);
               this.addContractFormdata.amount = amount.toFixed(2);
               // console.log('运费,抑尘费:', this.addContractFormdata.cost1, this.addContractFormdata.cost2);
            }
         } else {
            this.addContractFormdata.quant = null;
         }
         return true;
      }
   },
   watch: {
      // 立即处理 进入页面就触发 // immediate: true,
      // 深度监听 属性的变化// deep: true
      // 选择客户查询条件
      'searchCustomerForm.compName'(newV, oldV) {
         if (newV == '') {
            this.selectCustomerData.compIds = '';
         }
      },
      'searchCustomerForm.levelText'(newV, oldV) {
         if (newV == '') {
            this.selectCustomerData.level = '';
         }
      }
   },
   components: {
      popupMenu,
      combinationTitle
   },
   methods: {
      async jisuanAmount() {
         if (this.addContractFormdata.trainType == 2) {
            let price = this.addContractFormdata.price;
            //如果路运价格增加抑尘费和运费
            let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //路运运费
            price += cost1Price;
            price += this.dust;
            this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //运费
            this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //抑尘费
            let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2);
            console.log(amount);
            this.addContractFormdata.amount = amount.toFixed(2);
         }
      },
      init() {
         this.getLedgerList();
         this.jcfavouredpolicyitem();
         this.coalfiled();
         this.coalprice();
         this.operato();
         this.pay_type();
         this.others_params();
         this.fetchCompTree();
         this.getFavouredPolicyItem();
         this.$reqGet('contract_type').then(res => {
            console.log('合同类型', res);
            res.data.forEach(item => {
               this.selectContractTypeData[0].push(item.value);
            });
         });
      },
      /**
       * 获取分类账套
       */
      getLedgerList() {
         this.$reqGet('zhaccountledger', { compId: uni.getStorageSync('userInfo').compId }).then(res => {
            this.ledgerList.push(res.data.records);
            console.log('账套列表', this.ledgerList);
            if (res.data.records) {
               this.newFormData.ledgerId = res.data.records[0].id;
               // this.newFormData.ledgerName = res.data.records[0].name;
               this.ledgerName = res.data.records[0].name;
            }
         });
      },
      selectLedger() {
         this.selectLedgerShow = true;
      },
      selectLedgerChange(index) {
         console.log('账套选择器', index);
         this.ledgerName = index.value[0].name;
         this.newFormData.ledgerId = index.value[0].id;
         // this.newFormData.ledgerName = index.value[0].name;
         if (this.newFormData.customerName || this.newFormData.contractNum || this.newFormData.contractName) {
            this.newFormData.customerName = '';
            this.newFormData.contractNum = '';
            this.newFormData.contractName = '';
         }
      },
      selectLedgerConfirm(index) {
         console.log('选择账套点击确定', index);
         this.selectLedgerShow = false;
      },
      selectLedgerCancel() {
         this.selectLedgerShow = false;
      },
      selectLedgerClose() {
         this.selectLedgerShow = false;
      },
      // 选择客户
      selectCustomer() {
         this.selectLevelShow = false;
         this.selectCustomerCompShow = false;
         uni.showLoading({
            title: '加载中...'
         });
         this.selectCustomerShow = true;
         this.selectCustomerData.current = 1;
         this.$reqGet('customer', this.selectCustomerData).then(res => {
            uni.hideLoading();
            if (res.code == 0) {
               this.customerData = res.data.records;
               this.customerDataAllNum = res.data.total;
            }
         });
      },
      // 客户选择弹框打开了
      selectCustomerOpen() {
         // this.spanStyle = 'overflow:hidden'; //当蒙层弹起时,固定界面禁止滚动,当蒙层关闭时,允许滚动
      },
      selectCustomerClose() {
         // this.spanStyle = 'overflow:auto'; // 让html的body可滑动
         this.selectCustomerShow = false;
      },
      // 获取单位树
      fetchCompTree() {
         this.selectCustomerActions = [];
         this.$reqGet('fetchCompTree').then(res => {
            if (res.code == 0) {
               let a = { name: '', id: '' };
               a.name = res.data[0].name;
               a.id = res.data[0].id;
               this.selectCustomerActions.push(a);
               res.data[0].children.forEach(item => {
                  let a = { name: '', id: '' };
                  a.name = item.name;
                  a.id = item.id;
                  this.selectCustomerActions.push(a);
               });
            }
         });
      },
      // 客户选择框单位选择菜单
      selectCustomerSelect(v) {
         uni.hideKeyboard();
         this.selectCustomerData.compIds = v.id;
         this.searchCustomerForm.compName = v.name;
      },
      // 级别
      selectLevelSelect(v) {
         uni.hideKeyboard();
         this.selectCustomerData.level = v.value;
         this.searchCustomerForm.levelText = v.name;
      },
      // 付款类型
      sexSelect(v) {
         uni.hideKeyboard();
         this.selectValue = v.name;
         this.newFormData.payType = v.value;
         // this.newFormData.payType = e.name;
         // this.$refs.form1.validateField('userInfo.sex');
      },
      // 清空选择客户表单
      selectCustomerResetFields() {
         this.$refs.selectformRef.resetFields(); // 不起效果
         this.selectCustomerData.customerFullName = '';
         this.searchCustomerForm.compName = '';
         this.searchCustomerForm.levelText = '';
         this.selectCustomer();
      },
      selectCustomerOkClick(v) {
         console.log('外层客户选择', v);
         this.newFormData.customerName = v.customerName;
         this.newFormData.customerId = v.id;
         this.$reqGet('getAccount', { customerId: v.id, ledgerId: this.newFormData.ledgerId }).then(res => {
            console.log('客户选择账户', res);
            this.accountDetails = res.data;
            this.searchContractForm.customerName = res.data.customerName;
            this.reqContract();
            this.$nextTick(() => {
               console.log('zhezhezhe');
               this.contractData.forEach(item => {
                  this.contractNumList.push(item.num);
               });
               console.log('合同号码列表', this.contractNumList);
               // 检查换客户后对应的合同
               if (this.contractNumList.indexOf(this.newFormData.contractNum) > -1) {
                  this.newFormData.contractNum = '';
                  this.newFormData.contractName = '';
               }
            });
         });
         this.$nextTick(() => {
            this.selectCustomerShow = false;
         });
      },
      loadingCustomer() {
         console.log('加载更多事件');
         if (this.selectCustomerData.current >= this.customerDataAllNum / 10) return;
         this.status = 'loading';
         this.selectCustomerData.current = ++this.selectCustomerData.current;
         this.$reqGet('customer', this.selectCustomerData).then(res => {
            if (this.selectCustomerData.current >= this.customerDataAllNum / 10) {
               this.status = 'nomore';
               this.$u.toast('没有更多数据了!');
            }
            uni.hideLoading();
            if (res.code == 0) {
               this.customerDataAllNum = res.data.total;
               this.customerData = this.customerData.concat(res.data.records);
               this.status = 'loadmore';
               console.log(this.selectCustomerData);
            }
         });
      },
      // 时间
      confirmTime(v) {
         this.timeShow = false;
         console.log('时间', v);
         v.forEach(e => {
            this.newFormData.startDate = v[0];
            this.newFormData.endDate = v[v.length - 1];
            this.timeDataStr = v[0] + ' 至 ' + v[v.length - 1];
         });
      },
      return true;
    },
    async currentRowComputed() {
      console.log('currentRowComputed');
      //变价格用的
      this.changePriceMode(this.addContractFormdata.priceMode);
      // 选择合同
      selectContract() {
         if (this.newFormData.customerName != '') {
            if (this.newFormData.contractOrders != []) {
               uni.showToast({
                  title: '添加订单后,不能修改合同!',
                  icon: 'none',
                  duration: 2000
               });
            }
            this.selectContractShow = true;
         } else {
            this.$refs.formRef
               .validate()
               .then(res => {
                  uni.$u.toast('校验成功');
               })
               .catch(err => {
                  uni.$u.toast('请选择结算客户');
               });
         }
      },
      // 选择合同类型输入框获取焦点触发
      searchContractFormTypeFocus() {
         // 类型弹出框
         this.selectContractTypeShow = true;
      },
      // 选择合同弹框
      selectContractOpen() {
         uni.showLoading({
            title: '加载中...'
         });
         console.log('合同弹框open');
         this.$reqGet('contract_status').then(res => {
            console.log('状态', res);
         });
         this.reqContract();
      },
      // 合同请求
      reqContract() {
         this.searchContractForm.current = 1;
         this.$reqGet('contract', this.searchContractForm).then(res => {
            uni.hideLoading();
            if (res.code == 0) {
               console.log('合同', res);
               this.contractData = res.data.records;
               this.contractDataAllNum = res.data.total;
            }
         });
      },
      // 合同加载更多
      loadingContract() {
         uni.showLoading({
            title: '加载中...'
         });
         console.log('合同加载更多事件', this.statusContractLoading);
         if (this.searchContractForm.current >= this.contractDataAllNum / 50) return;
         this.statusContractLoading = 'loading';
         this.searchContractForm.current = ++this.searchContractForm.current;
         this.$reqGet('contract', this.searchContractForm).then(res => {
            if (this.searchContractForm.current >= this.contractDataAllNum / 50) {
               this.statusContractLoading = 'nomore';
               this.$u.toast('没有更多数据了!');
            }
            uni.hideLoading();
            if (res.code == 0) {
               this.contractDataAllNum = res.data.total;
               this.contractData = this.contractData.concat(res.data.records);
               this.statusContractLoading = 'loadmore';
               console.log(this.searchContractForm);
            }
         });
      },
      selectContractClose() {
         this.selectContractShow = false;
      },
      // 合同类型选择器
      selectContractTypeConfirm(v) {
         this.searchContractForm.type = v.value[0];
         this.selectContractTypeShow = false;
         console.log('选择器确定后的值', v, this.searchContractForm.type);
      },
      selectContractTypeClose(v) {
         // 初始化合同类型选择器
         this.selectContractTypeData[0] = [];
      //变订单量
      if (this.addContractFormdata.price > 0 && (this.addContractFormdata.amount > 0 || this.addContractFormdata.quant > 0)) {
        let price = this.addContractFormdata.price;
        if (this.addContractFormdata.trainType == 1) {
          let q = this.addContractFormdata.amount / price;
          this.addContractFormdata.quant = q.toFixed(2);
          this.addContractFormdata.cost1 = null; //运费
          this.addContractFormdata.cost2 = null; //抑尘费
        } else if (this.addContractFormdata.trainType == 2) {
          //如果路运价格增加抑尘费和运费
          let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //路运运费
          price += cost1Price;
          price += this.dust;
          this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //运费
          this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //抑尘费
          let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2);
          console.log(amount);
          this.addContractFormdata.amount = amount.toFixed(2);
          // console.log('运费,抑尘费:', this.addContractFormdata.cost1, this.addContractFormdata.cost2);
        }
      } else {
        this.addContractFormdata.quant = null;
      }
      return true;
    }
    // accountMsg() {
    //    this.accountMsgType = 'error';
    //    if (this.accountDetails) {
    //       if (this.accountDetails.balanceType == '贷') {
    //          return '客户账户余额当前处于欠款状态!';
    //       } else {
    //          let amount = 0;
    //          this.newFormData.contractOrders.forEach(e => {
    //             amount += Number(e.amount);
    //          });
    //          if (this.newFormData.payType == '0') {
    //             if (this.accountDetails.balance < amount) {
    //                return '客户账户现汇余额不足,现汇余额:' + this.accountDetails.balance;
    //             }
    //          } else {
    //             if (this.accountDetails.balance2 < amount) {
    //                return '客户账户承兑余额不足,承兑余额:' + this.accountDetails.balance2;
    //             }
    //          }
    //       }
    //       this.accountMsgType = 'warning';
    //       return '客户账户现汇余额:' + this.accountDetails.balance + ',承兑余额:' + (this.accountDetails.balance2 ? this.accountDetails.balance2 : 0);
    //    }
    //    return null;
    // }
  },
  watch: {
    // 立即处理 进入页面就触发 // immediate: true,
    // 深度监听 属性的变化// deep: true
    // 选择客户查询条件
    'searchCustomerForm.compName'(newV, oldV) {
      if (newV == '') {
        this.selectCustomerData.compIds = '';
      }
    },
    'searchCustomerForm.levelText'(newV, oldV) {
      if (newV == '') {
        this.selectCustomerData.level = '';
      }
    }
  },
  components: {
    popupMenu,
    combinationTitle
  },
  methods: {
    async jisuanAmount() {
      if (this.addContractFormdata.trainType == 2) {
        let price = this.addContractFormdata.price;
        //如果路运价格增加抑尘费和运费
        let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //路运运费
        price += cost1Price;
        price += this.dust;
        this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //运费
        this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //抑尘费
        let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2);
        console.log(amount);
        this.addContractFormdata.amount = amount.toFixed(2);
      }
    },
    init() {
      this.jcfavouredpolicyitem();
      this.coalfiled();
      this.coalprice();
      this.operato();
      this.pay_type();
      this.others_params();
      this.fetchCompTree();
      this.getFavouredPolicyItem();
      this.$reqGet('contract_type').then(res => {
        console.log('合同类型', res);
        res.data.forEach(item => {
          this.selectContractTypeData[0].push(item.value);
        });
      });
    },
    // 选择客户
    selectCustomer() {
      this.selectLevelShow = false;
      this.selectCustomerCompShow = false;
      uni.showLoading({
        title: '加载中...'
      });
      this.selectCustomerShow = true;
      this.selectCustomerData.current = 1;
      this.$reqGet('customer', this.selectCustomerData).then(res => {
        console.log('客户呵呵哈哈哈或', res);
        uni.hideLoading();
        if (res.code == 0) {
          this.customerData = res.data.records;
          this.customerDataAllNum = res.data.total;
        }
      });
    },
    // 客户选择弹框打开了
    selectCustomerOpen() {
      // this.spanStyle = 'overflow:hidden'; //当蒙层弹起时,固定界面禁止滚动,当蒙层关闭时,允许滚动
    },
    selectCustomerClose() {
      // this.spanStyle = 'overflow:auto'; // 让html的body可滑动
      this.selectCustomerShow = false;
    },
    // 获取单位树
    fetchCompTree() {
      this.selectCustomerActions = [];
      this.$reqGet('fetchCompTree').then(res => {
        if (res.code == 0) {
          let a = {name: '', id: ''};
          a.name = res.data[0].name;
          a.id = res.data[0].id;
          this.selectCustomerActions.push(a);
          res.data[0].children.forEach(item => {
            let a = {name: '', id: ''};
            a.name = item.name;
            a.id = item.id;
            this.selectCustomerActions.push(a);
          });
        }
      });
    },
    // 客户选择框单位选择菜单
    selectCustomerSelect(v) {
      uni.hideKeyboard();
      this.selectCustomerData.compIds = v.id;
      this.searchCustomerForm.compName = v.name;
    },
    // 级别
    selectLevelSelect(v) {
      uni.hideKeyboard();
      this.selectCustomerData.level = v.value;
      this.searchCustomerForm.levelText = v.name;
    },
    // 付款类型
    sexSelect(v) {
      uni.hideKeyboard();
      this.selectValue = v.name;
      this.newFormData.payType = v.value;
      // this.newFormData.payType = e.name;
      // this.$refs.form1.validateField('userInfo.sex');
    },
    // 清空选择客户表单
    selectCustomerResetFields() {
      this.$refs.selectformRef.resetFields(); // 不起效果
      this.selectCustomerData.customerFullName = '';
      this.searchCustomerForm.compName = '';
      this.searchCustomerForm.levelText = '';
      this.selectCustomer();
    },
    selectCustomerOkClick(v) {
      console.log('外层客户选择', v);
      this.newFormData.customerName = v.customerName;
      this.newFormData.customerId = v.id;
      this.$reqGet('getAccount', {customerId: v.id}).then(res => {
        console.log('客户选择账户', res);
        this.accountDetails = res.data;
        this.searchContractForm.customerName = res.data.customerName;
        this.reqContract();
        this.$nextTick(() => {
          this.contractData.forEach(item => {
            this.contractNumList.push(item.num);
          });
          console.log('合同号码列表', this.contractNumList);
          // 检查换客户后对应的合同
          if (this.contractNumList.indexOf(this.newFormData.contractNum) > -1) {
            this.newFormData.contractNum = '';
            this.newFormData.contractName = '';
          }
        });
      });
      this.$nextTick(() => {
        this.selectCustomerShow = false;
      });
    },
    loadingCustomer() {
      console.log('加载更多事件');
      if (this.selectCustomerData.current >= this.customerDataAllNum / 10) return;
      this.status = 'loading';
      this.selectCustomerData.current = ++this.selectCustomerData.current;
      this.$reqGet('customer', this.selectCustomerData).then(res => {
        if (this.selectCustomerData.current >= this.customerDataAllNum / 10) {
          this.status = 'nomore';
          this.$u.toast('没有更多数据了!');
        }
        uni.hideLoading();
        if (res.code == 0) {
          this.customerDataAllNum = res.data.total;
          this.customerData = this.customerData.concat(res.data.records);
          this.status = 'loadmore';
          console.log(this.selectCustomerData);
        }
      });
    },
    // 时间
    confirmTime(v) {
      this.timeShow = false;
      v.forEach(e => {
        this.newFormData.startDate = v[0];
        this.newFormData.endDate = v[v.lenght - 1];
        this.timeDataStr = v[0] + ' 至 ' + v[v.length - 1];
      });
    },
    // 选择合同
    selectContract() {
      if (this.newFormData.customerName != '') {
        if (this.newFormData.contractOrders != []) {
          uni.showToast({
            title: '添加订单后,不能修改合同!',
            icon: 'error',
            duration: 2000
          });
        }
        this.selectContractShow = true;
      } else {
        this.$refs.formRef
            .validate()
            .then(res => {
              uni.$u.toast('校验成功');
            })
            .catch(err => {
              uni.$u.toast('请选择结算客户');
            });
      }
    },
    // 选择合同类型输入框获取焦点触发
    searchContractFormTypeFocus() {
      // 类型弹出框
      this.selectContractTypeShow = true;
      // 弹出框类型请求
      // this.$nextTick(() => {
      // });
    },
    // 选择合同弹框
    selectContractOpen() {
      uni.showLoading({
        title: '加载中...'
      });
      console.log('合同弹框open');
      this.$reqGet('contract_status').then(res => {
        console.log('状态', res);
      });
      this.reqContract();
    },
    // 合同请求
    reqContract() {
      this.searchContractForm.current = 1;
      this.$reqGet('contract', this.searchContractForm).then(res => {
        uni.hideLoading();
        if (res.code == 0) {
          console.log('合同', res);
          this.contractData = res.data.records;
          this.contractDataAllNum = res.data.total;
        }
      });
    },
    // 合同加载更多
    loadingContract(){
      uni.showLoading({
        title: '加载中...'
      });
      console.log('合同加载更多事件',this.statusContractLoading);
      if (this.searchContractForm.current >= this.contractDataAllNum / 50) return;
      this.statusContractLoading = 'loading';
      this.searchContractForm.current = ++this.searchContractForm.current;
      this.$reqGet('contract', this.searchContractForm).then(res => {
        if (this.searchContractForm.current >= this.contractDataAllNum / 50) {
          this.statusContractLoading = 'nomore';
          this.$u.toast('没有更多数据了!');
        }
        uni.hideLoading();
        if (res.code == 0) {
          this.contractDataAllNum = res.data.total;
          this.contractData = this.contractData.concat(res.data.records);
          this.statusContractLoading = 'loadmore';
          console.log(this.searchContractForm);
        }
      });
    },
    selectContractClose() {
      this.selectContractShow = false;
    },
    // 合同类型选择器
    selectContractTypeConfirm(v) {
      this.searchContractForm.type = v.value[0];
      this.selectContractTypeShow = false;
      console.log('选择器确定后的值', v, this.searchContractForm.type);
    },
    selectContractTypeClose(v) {
      // 初始化合同类型选择器
      this.selectContractTypeData[0] = [];
      this.selectContractTypeShow = false;
      if (v) {
        this.searchContractForm.type = v.value[0];
      }
    },
    // 合同时间选择器
    selectContractStartTimeConfirm(e) {
      this.selectContractStartTimeShow = false;
      this.searchContractForm.startDate = e[0];
    },
    selectContractStartTimeClose() {
      this.selectContractStartTimeShow = false;
    },
    selectContractEndTimeConfirm(e) {
      this.selectContractEndTimeShow = false;
      this.searchContractForm.endDate = e[0];
    },
    selectContractEndTimeClose() {
      this.selectContractEndTimeShow = false;
    },
    // 重置表单所有字段
    selectContractResetFields() {
      this.searchContractForm.num = '';
      this.searchContractForm.startDate = '';
      this.searchContractForm.endDate = '';
      this.searchContractForm.customerName = '';
      this.searchContractForm.type = '';
    },
    selectContractClick(e) {
      console.log('选择合同', e);
      this.newFormData.contractName = e.contractName;
      this.newFormData.contractNum = e.num;
      this.newFormData.contractId = e.id;
         this.selectContractTypeShow = false;
         if (v) {
            this.searchContractForm.type = v.value[0];
         }
      },
      // 合同时间选择器
      selectContractStartTimeConfirm(e) {
         this.selectContractStartTimeShow = false;
         this.searchContractForm.startDate = e[0];
      },
      selectContractStartTimeClose() {
         this.selectContractStartTimeShow = false;
      },
      selectContractEndTimeConfirm(e) {
         this.selectContractEndTimeShow = false;
         this.searchContractForm.endDate = e[0];
      },
      selectContractEndTimeClose() {
         this.selectContractEndTimeShow = false;
      },
      // 重置表单所有字段
      selectContractResetFields() {
         this.searchContractForm.num = '';
         this.searchContractForm.startDate = '';
         this.searchContractForm.endDate = '';
         this.searchContractForm.customerName = '';
         this.searchContractForm.type = '';
      },
      selectContractClick(e) {
         console.log('选择合同', e);
         this.newFormData.contractName = e.contractName;
         this.newFormData.contractNum = e.num;
         this.newFormData.contractId = e.id;
         this.newFormData.type = e.type;
      this.selectContractShow = false;
         this.selectContractShow = false;
      // 价格参数赋值
      this.getNewPriceData.type = e.type;
      // 选定合同详情
      uni.showLoading({
        title: '加载中...'
      })
      this.$reqGet('getByContractId', {}, e.id).then(res => {
        uni.hideLoading();
        this.contractDetails = res.data
        this.contractDetails.forEach(item => {
          let a = [{label: '', id: ''}];
          a[0].label = item.coalName;
          a[0].id = item.coalId;
          if (this.addContractCoalData[0]) {
            this.addContractCoalData = [];
          }
          this.addContractCoalData.push(a);
        });
      }).catch(err => {
        console.log(err);
      })
         // 价格参数赋值
         this.getNewPriceData.type = e.type;
         // 选定合同详情
         uni.showLoading({
            title: '加载中...'
         });
         this.$reqGet('getByContractId', {}, e.id)
            .then(res => {
               uni.hideLoading();
               this.contractDetails = res.data;
               this.contractDetails.forEach(item => {
                  let a = [{ label: '', id: '' }];
                  a[0].label = item.coalName;
                  a[0].id = item.coalId;
                  if (this.addContractCoalData[0]) {
                     this.addContractCoalData = [];
                  }
                  this.addContractCoalData.push(a);
               });
            })
            .catch(err => {
               console.log(err);
            });
      // 添加煤种选项
         // 添加煤种选项
      },
      // 添加合同按钮
      addContractClick() {
         // 打印true或false
         this.$refs.formRef
            .validate()
            .then(res => {
               if (this.accountDetails.balanceType == '贷') {
                  uni.showToast({
                     title: '客户账户余额当前处于欠款状态!',
                     icon: 'none',
                     duration: 2000
                  });
               } else {
                  if (this.accountDetails.balance == 0 || (null && this.accountDetails.balance2 == 0) || null) {
                     uni.showToast({
                        title: '账户余额不足!',
                        icon: 'error',
                        duration: 2000
                     });
                  } else {
                     console.log('添加合同按钮点击', res);
                     this.addContractShow = true;
                     this.addContractFormdata = {
                        amount: null,
                        coalId: null,
                        coalName: '',
                        compId: null,
                        compName: '',
                        cost1: '',
                        cost2: '',
                        customerId: null,
                        customerName: '',
                        edit: true,
                        favouredpolicyIds: '',
                        filedId: null,
                        filedName: '',
                        fromStation: '',
                        modifyId: null,
                        modifyInfoId: null,
                        customerAddressId: null,
                        price: null,
                        priceMode: '0',
                        quant: '',
                        toStation: '',
                        trainType: 1,
                        type: ''
                     };
                     this.multipleSelection = [];
                     console.log('新建发运申请订单', this.addContractFormdata);
                  }
               }
            })
            .catch(err => {
               uni.$u.toast('效验失败');
            });
      },
      // 添加合同弹出框
      addContractClose() {
         this.addContractShow = false;
         this.addContractFormdata = {};
         this.editApplicationIndex = null;
      },
      addContractOpen() {
         console.log('添加订单打开');
      },
      // 选择煤厂
      coalFiledSelectOpen(e) {
         console.log('coalfiledSelect: ', e);
      },
      coalFiledSelectClose() {
         this.coalFiledSelectShow = false;
      },
      // 选择的煤厂
      coalFiledSelectClick(e) {
         console.log('选择的煤厂', e);
         this.addContractFormdata.compName = e.compName;
         this.addContractFormdata.filedName = e.name;
         this.addContractFormdata.compId = e.compId;
         this.addContractFormdata.filedId = e.id;
         this.addContractFormdata.fromStation = e.toStation;
    },
    // 添加合同按钮
    addContractClick() {
      // 打印true或false
      this.$refs.formRef
          .validate()
          .then(res => {
            if (this.accountDetails.balanceType == '贷') {
              uni.showToast({
                title: '客户账户余额当前处于欠款状态!',
                icon: 'error',
                duration: 2000
              });
            } else {
              if (this.accountDetails.balance == 0 || (null && this.accountDetails.balance2 == 0) || null) {
                uni.showToast({
                  title: '账户余额不足!',
                  icon: 'error',
                  duration: 2000
                });
              } else {
                console.log('添加合同按钮点击', res);
                this.addContractShow = true;
                this.addContractFormdata = {
                  amount: null,
                  coalId: null,
                  coalName: '',
                  compId: null,
                  compName: '',
                  cost1: '',
                  cost2: '',
                  customerId: null,
                  customerName: '',
                  edit: true,
                  favouredpolicyIds: '',
                  filedId: null,
                  filedName: '',
                  fromStation: '',
                  modifyId: null,
                  modifyInfoId: null,
                  customerAddressId: null,
                  price: null,
                  priceMode: '0',
                  quant: '',
                  toStation: '',
                  trainType: 1,
                  type: ''
                };
                this.multipleSelection = [];
                console.log('新建发运申请订单', this.addContractFormdata);
              }
            }
          })
          .catch(err => {
            uni.$u.toast('效验失败');
          });
    },
    // 添加合同弹出框
    addContractClose() {
      this.addContractShow = false;
      this.addContractFormdata = {};
      this.editApplicationIndex = null;
    },
    addContractOpen() {
      console.log('添加订单打开');
    },
    // 选择煤厂
    coalFiledSelectOpen(e) {
      console.log('coalfiledSelect: ', e);
    },
    coalFiledSelectClose() {
      this.coalFiledSelectShow = false;
    },
    // 选择的煤厂
    coalFiledSelectClick(e) {
      console.log('选择的煤厂', e);
      this.addContractFormdata.compName = e.compName;
      this.addContractFormdata.filedName = e.name;
      this.addContractFormdata.compId = e.compId;
      this.addContractFormdata.filedId = e.id;
      this.addContractFormdata.fromStation = e.toStation;
         this.selectCoalFiledData = e;
      this.selectCoalFiledData = e;
         // 获取价格参数
         this.getNewPriceData.compId = e.compId;
         this.getNewPriceData.compName = e.compName;
         this.getNewPriceData.filedId = e.id;
         this.getNewPriceData.filedName = e.name;
      // 获取价格参数
      this.getNewPriceData.compId = e.compId;
      this.getNewPriceData.compName = e.compName;
      this.getNewPriceData.filedId = e.id;
      this.getNewPriceData.filedName = e.name;
         this.coalFiledSelectShow = false;
      },
      // 收货人
      addContractConsigneeClose() {
         this.addContractConsigneeShow = false;
      },
      // 添加合同子项收货人打开
      addContractConsigneeOpen() {},
      addContractConsignee() {
         this.addContractConsigneeShow = true;
      },
      addContractConsigneeConfirm(v) {
         this.addContractFormdata.toStation = v.toStation;
         this.addContractFormdata.customerName = v.customerName;
         this.addContractFormdata.customerId = v.id;
         // 赋值给取价格请求参数
         this.getNewPriceData.customerAddressName = v.customerFullName;
         this.getNewPriceData.customerAddressId = v.id;
         this.getNewPriceData.toStation = v.toStation;
      this.coalFiledSelectShow = false;
    },
    // 收货人
    addContractConsigneeClose() {
      this.addContractConsigneeShow = false;
    },
    // 添加合同子项收货人打开
    addContractConsigneeOpen() {
    },
    addContractConsignee() {
      this.addContractConsigneeShow = true;
    },
    addContractConsigneeConfirm(v) {
      console.log('收货人', v);
      this.addContractFormdata.toStation = v.toStation;
      this.addContractFormdata.customerName = v.customerName;
      this.addContractFormdata.customerId = v.id;
      this.$reqGet('getAccount', {customerId: v.id}).then(res => {
        console.log('获取收货人账号', res);
        // this.accountDetails = res.data;
        // this.newFormData.customerName = res.data.customerName;
        // this.newFormData.customerId = res.data.id;
        // this.searchContractForm.customerName = res.data.customerName;
      });
      this.$nextTick(() => {
        this.addContractConsigneeShow = false;
      });
         this.addContractFormdata.toStation = v.toStation;
         this.addContractFormdata.customerAddressId = v.id;
         this.addContractConsigneeShow = false;
      },
      // 品种选择器
      addContractCoalConfirm(e) {
         console.log('品种选择器', e);
      // 赋值给取价格请求参数
      this.getNewPriceData.customerAddressName = v.customerFullName;
      this.getNewPriceData.customerAddressId = v.id;
      this.getNewPriceData.toStation = v.toStation;
         this.addContractCoalShow = false; // 关闭选择器
         this.addContractFormdata.coalId = e.value[0].id;
         this.addContractFormdata.coalName = e.value[0].label;
         // 煤种价格请求(煤厂=>价格参数)
         this.getNewPriceData.coalId = e.value[0].id;
         this.getNewPriceData.coalName = e.value[0].label;
      this.addContractFormdata.toStation = v.toStation;
      this.addContractFormdata.customerAddressId = v.id;
         // this.selectCoalFiledData.compId = e.compId;
         // this.selectCoalFiledData.compName = e.compName;
         // this.selectCoalFiledData.toStation = e.fromStation;
         this.$reqGet('getNewPrice', this.getNewPriceData).then(res => {
            if (res.code == 0) {
               let data = res.data;
               if (data) {
                  this.currentCoal.coalName = data.coalName;
                  this.currentCoal.cokingPrice = data.cokingPrice; //焦化价格
                  this.currentCoal.noImportantPrice = data.noImportantPrice; //不重要价格
                  this.currentCoal.quotePrice = data.quotePrice; // 挂牌价格
                  this.currentCoal.steelMillPrice = data.steelMillPrice; // 钢厂价格
                  this.currentCoal.modifyId = data.modifyId; //修改id
                  this.currentCoal.modifyInfoId = data.id;
    },
    // 品种选择器
    addContractCoalConfirm(e) {
      console.log('品种选择器', e);
      this.addContractCoalShow = false; // 关闭选择器
      this.addContractFormdata.coalId = e.value[0].id;
      this.addContractFormdata.coalName = e.value[0].label;
      // 煤种价格请求(煤厂=>价格参数)
      this.getNewPriceData.coalId = e.value[0].id;
      this.getNewPriceData.coalName = e.value[0].label;
      // this.selectCoalFiledData.compId = e.compId;
      // this.selectCoalFiledData.compName = e.compName;
      // this.selectCoalFiledData.toStation = e.fromStation;
      this.$reqGet('getNewPrice', this.getNewPriceData).then(res => {
        if (res.code == 0) {
          let data = res.data;
          if (data) {
            this.currentCoal.coalName = data.coalName;
            this.currentCoal.cokingPrice = data.cokingPrice; //焦化价格
            this.currentCoal.noImportantPrice = data.noImportantPrice; //不重要价格
            this.currentCoal.quotePrice = data.quotePrice; // 挂牌价格
            this.currentCoal.steelMillPrice = data.steelMillPrice; // 钢厂价格
            this.currentCoal.modifyId = data.modifyId; //修改id
            this.currentCoal.modifyInfoId = data.id;
            this.addContractFormdata.price = data.steelMillPrice;
            // if (data.coalPath && data.coalPath.indexOf('动力煤') > -1) {
            //    this.currentCoal.type = 0;
            // } else {
            //    this.currentCoal.type = 1;
            // }
            this.addContractFormdata.modifyId = data.modifyId;
            // this.addContractFormdata.id = data.id;
          } else {
            uni.$u.toast('煤种价格未设置');
          }
        }
      });
    },
    addContractCoalClose() {
      this.addContractCoalShow = false;
    },
    // 煤品种价格
    groupChange(e) {
      console.log('单选框小组', e);
    },
    changePriceMode(e) {
      if (!this.currentCoal) return;
      this.addContractFormdata.priceMode = e;
      switch (this.addContractFormdata.priceMode) {
        case '0':
          this.addContractFormdata.price = this.afterPrice.steelMillPrice;
          break;
        case '1':
          this.addContractFormdata.price = this.afterPrice.cokingPrice;
          break;
        case '2':
          this.addContractFormdata.price = this.afterPrice.noImportantPrice;
          break;
        case '3':
          this.addContractFormdata.price = this.afterPrice.quotePrice;
          break;
      }
    },
    // 优惠选择
    selectionChange(e) {
      this.multipleSelection = [];
      this.favouredpolicyList.forEach((item, i) => {
        if (e.detail.index.indexOf(i) != -1) {
          this.multipleSelection.push(item);
        }
      });
    },
    // 运输选择器
    addContractTransportConfirm(e) {
      this.addContractTransportShow = false;
      this.addContractFormdata.trainType = e.value[0].value;
      switch (this.addContractFormdata.trainType) {
        case 1:
          this.addContractTransport = '地销';
          break;
        case 2:
          this.addContractTransport = '路运';
          break;
      }
    },
    addContractTransportClose() {
      this.addContractTransportShow = false;
    },
    // 获取运费
    async getFreight(from, to, customerId) {
      let key = from + to + customerId;
      let price = this.trainfreight[key];
      price = await this.$reqGet('trainFreightFind', {from, to, customerId}).then(res => {
        let resPrice = 10; //默认价格为10
        if (res.data) {
          resPrice = res.data.price;
        }
        return resPrice;
      });
      return price;
    },
    addContractSanConfirm() {
      if (this.addContractFormdata.compId && this.addContractFormdata.customerId && this.addContractFormdata.filedId) {
        if (this.editApplicationIndex != null) {
          this.newFormData.contractOrders[this.editApplicationIndex] = this.addContractFormdata;
        } else {
               this.addContractFormdata.type = this.newFormData.type
          this.newFormData.contractOrders.push(this.addContractFormdata);
          console.log('添加子订单', this.addContractFormdata);
        }
        this.addContractShow = false;// 关闭弹出框
        console.log('this.newFormData.contractOrders当前关闭后', this.newFormData.contractOrders)
      } else {
        uni.$u.toast('请规范输入所有信息');
      }
    },
    // 初始数据请求
    operato() {
      this.$reqGet('operator').then(res => {
        // console.log('operator', res);
        this.operator = res.data;
      });
    },
    pay_type() {
      this.actions = [];
      this.$reqGet('pay_type').then(res => {
        // console.log('paytype', res);
        this.payData = res.data;
        res.data.forEach(e => {
          let a = {name: '', value: ''};
          a.name = e.label;
          a.value = e.value;
          this.actions.push(a);
        });
      });
      // console.log(this.actions);
    },
    // 抑尘费
    others_params() {
      this.$reqGet('others_params').then(res => {
        console.log('others_params', res);
        res.data.forEach(e => {
          if (e.label == 'dust') {
            this.dust = parseFloat(e.value);
          }
        });
      });
    },
    coalprice() {
      this.$reqGet('coalprice', {current: 1, size: 1000}).then(res => {
        // console.log('coalprice', res);
      });
    },
    // 级别距优惠
    jcfavouredpolicyitem() {
      this.$reqGet('jcfavouredpolicyitem', {current: 1, size: 1000, status: 0}).then(res => {
        console.log('级别距优惠', res);
        // this.favouredpolicyListAll = res.data.records;
      });
    },
    // 获取所有的优惠政策
    getFavouredPolicyItem() {
      this.$reqGet('getFavouredPolicyItem', {current: 1, size: 1000, status: 0}).then(res => {
        console.log('所有优惠政策', res.data.records);
        this.favouredpolicyListAll = res.data.records;
      });
    },
    // 煤场
    coalfiled() {
      this.$reqGet('coalfiled', this.coalfiledParams).then(res => {
        this.coalfiledData = res.data.records;
      });
    },
    // 时间
    timeClose() {
      this.timeShow = false;
    },
    menushow(e) {
      this.menuShow = e;
    },
    // 选择客户
    // moveHandleCustomer() {
    //    return true;
    // },
    // moveHandleContract(){
    //    return true;
    // },
    // 新建发运申请
    newApplicationFormDataClick() {
      this.$refs.formRef
          .validate()
          .then(res => {
            let amount = 0;
            this.newFormData.contractOrders.forEach(e => {
              amount += Number(e.amount);
            });
            if (this.newFormData.payType == '0') {
              if (this.newFormData.contractOrders.length <= 0) {
                this.$u.toast('请添加订单子项!');
                return false;
              } else if (this.accountDetails.balance < amount) {
                let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance;
                uni.showToast({
                  title: '客户账户现汇余额不足,现汇余额:' + msg,
                  icon: 'error',
                  duration: 2000
                });
              } else {
                console.log('提交整体', this.newFormData);
                this.xswaybill();
              }
            } else {
              if (this.newFormData.contractOrders.length <= 0) {
                this.$u.toast('请添加订单子项!');
                return false;
              } else if (this.accountDetails.balance2 < amount) {
                let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2;
                uni.showToast({
                  title: '客户账户承兑余额不足,承兑余额:' + msg,
                  icon: 'error',
                  duration: 2000
                });
              } else {
                console.log('提交整体', this.newFormData);
                this.xswaybill();
              }
            }
          })
          .catch(err => {
            uni.$u.toast('校验失败');
          });
    },
    // 删除订单卡片
    deleteContractCardClick(e) {
      console.log('删除订单卡片', e);
      this.newFormData.contractOrders.splice(e, 1);
    },
    editApplicationClick(index) {
      this.editApplicationIndex = index;
      this.addContractFormdata = this.newFormData.contractOrders[index];
      this.addContractShow = true;
    },
    xswaybill() {
      console.log('新建发运申请', this.newFormData);
      uni.showLoading({
        title: '加载中...'
      });
      this.$reqPost('xswaybill', this.newFormData).then(res => {
        uni.hideLoading();
        console.log('新建发运申请', res);
        if (res.code == 0) {
          // uni.showToast({
          //    title: '添加成功!',
          //    icon: 'success',
          //    duration: 1000
          // });
          this.$u.toast('添加成功,即将返回申请页!!!')
          setTimeout(() => {
            uni.navigateBack({
              // url: '/pages/my-application/my-application'
              delta: 2
            });
          }, 2000)
        }
      });
    },
    backPage() {
      uni.navigateBack({
        delta: 1
      });
    }
  }
                  this.addContractFormdata.price = data.steelMillPrice;
                  // if (data.coalPath && data.coalPath.indexOf('动力煤') > -1) {
                  //    this.currentCoal.type = 0;
                  // } else {
                  //    this.currentCoal.type = 1;
                  // }
                  this.addContractFormdata.modifyId = data.modifyId;
                  // this.addContractFormdata.id = data.id;
               } else {
                  uni.$u.toast('煤种价格未设置');
               }
            }
         });
      },
      addContractCoalClose() {
         this.addContractCoalShow = false;
      },
      // 煤品种价格
      groupChange(e) {
         console.log('单选框小组', e);
      },
      changePriceMode(e) {
         if (!this.currentCoal) return;
         this.addContractFormdata.priceMode = e;
         switch (this.addContractFormdata.priceMode) {
            case '0':
               this.addContractFormdata.price = this.afterPrice.steelMillPrice;
               break;
            case '1':
               this.addContractFormdata.price = this.afterPrice.cokingPrice;
               break;
            case '2':
               this.addContractFormdata.price = this.afterPrice.noImportantPrice;
               break;
            case '3':
               this.addContractFormdata.price = this.afterPrice.quotePrice;
               break;
         }
      },
      // 优惠选择
      selectionChange(e) {
         this.multipleSelection = [];
         this.favouredpolicyList.forEach((item, i) => {
            if (e.detail.index.indexOf(i) != -1) {
               this.multipleSelection.push(item);
            }
         });
      },
      // 运输选择器
      addContractTransportConfirm(e) {
         this.addContractTransportShow = false;
         this.addContractFormdata.trainType = e.value[0].value;
         switch (this.addContractFormdata.trainType) {
            case 1:
               this.addContractTransport = '地销';
               break;
            case 2:
               this.addContractTransport = '路运';
               break;
         }
      },
      addContractTransportClose() {
         this.addContractTransportShow = false;
      },
      // 获取运费
      async getFreight(from, to, customerId) {
         let key = from + to + customerId;
         let price = this.trainfreight[key];
         price = await this.$reqGet('trainFreightFind', { from, to, customerId }).then(res => {
            let resPrice = 10; //默认价格为10
            if (res.data) {
               resPrice = res.data.price;
            }
            return resPrice;
         });
         return price;
      },
      addContractSanConfirm() {
         if (this.addContractFormdata.compId && this.addContractFormdata.customerId && this.addContractFormdata.filedId) {
            if (this.editApplicationIndex != null) {
               this.newFormData.contractOrders[this.editApplicationIndex] = this.addContractFormdata;
            } else {
               this.addContractFormdata.type = this.newFormData.type;
               this.newFormData.contractOrders.push(this.addContractFormdata);
               console.log('添加子订单', this.addContractFormdata);
            }
            this.addContractShow = false; // 关闭弹出框
            console.log('this.newFormData.contractOrders当前关闭后', this.newFormData.contractOrders);
         } else {
            uni.$u.toast('请规范输入所有信息');
         }
      },
      // 初始数据请求
      operato() {
         this.$reqGet('operator').then(res => {
            // console.log('operator', res);
            this.operator = res.data;
         });
      },
      pay_type() {
         this.actions = [];
         this.$reqGet('pay_type').then(res => {
            // console.log('paytype', res);
            this.payData = res.data;
            res.data.forEach(e => {
               let a = { name: '', value: '' };
               a.name = e.label;
               a.value = e.value;
               this.actions.push(a);
            });
         });
         // console.log(this.actions);
      },
      // 抑尘费
      others_params() {
         this.$reqGet('others_params').then(res => {
            console.log('others_params', res);
            res.data.forEach(e => {
               if (e.label == 'dust') {
                  this.dust = parseFloat(e.value);
               }
            });
         });
      },
      coalprice() {
         this.$reqGet('coalprice', { current: 1, size: 1000 }).then(res => {
            // console.log('coalprice', res);
         });
      },
      // 级别距优惠
      jcfavouredpolicyitem() {
         this.$reqGet('jcfavouredpolicyitem', { current: 1, size: 1000, status: 0 }).then(res => {
            console.log('级别距优惠', res);
            // this.favouredpolicyListAll = res.data.records;
         });
      },
      // 获取所有的优惠政策
      getFavouredPolicyItem() {
         this.$reqGet('getFavouredPolicyItem', { current: 1, size: 1000, status: 0 }).then(res => {
            console.log('所有优惠政策', res.data.records);
            this.favouredpolicyListAll = res.data.records;
         });
      },
      // 煤场
      coalfiled() {
         this.$reqGet('coalfiled', this.coalfiledParams).then(res => {
            this.coalfiledData = res.data.records;
         });
      },
      // 时间
      timeClose() {
         this.timeShow = false;
      },
      menushow(e) {
         this.menuShow = e;
      },
      // 选择客户
      // moveHandleCustomer() {
      //    return true;
      // },
      // moveHandleContract(){
      //    return true;
      // },
      // 新建发运申请
      newApplicationFormDataClick() {
         this.$refs.formRef
            .validate()
            .then(res => {
               let amount = 0;
               this.newFormData.contractOrders.forEach(e => {
                  amount += Number(e.amount);
               });
               if (this.newFormData.payType == '0') {
                  if (this.newFormData.contractOrders.length <= 0) {
                     this.$u.toast('请添加订单子项!');
                     return false;
                  } else if (this.accountDetails.balance < amount) {
                     let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance;
                     uni.showToast({
                        title: '客户账户现汇余额不足,现汇余额:' + msg,
                        icon: 'none',
                        duration: 2000
                     });
                  } else {
                     console.log('提交整体', this.newFormData);
                     this.xswaybill();
                  }
               } else {
                  if (this.newFormData.contractOrders.length <= 0) {
                     this.$u.toast('请添加订单子项!');
                     return false;
                  } else if (this.accountDetails.balance2 < amount) {
                     let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2;
                     uni.showToast({
                        title: '客户账户承兑余额不足,承兑余额:' + msg,
                        icon: 'none',
                        duration: 2000
                     });
                  } else {
                     console.log('提交整体', this.newFormData);
                     this.xswaybill();
                  }
               }
            })
            .catch(err => {
               uni.$u.toast('校验失败');
            });
      },
      // 删除订单卡片
      deleteContractCardClick(e) {
         console.log('删除订单卡片', e);
         this.newFormData.contractOrders.splice(e, 1);
      },
      editApplicationClick(index) {
         this.editApplicationIndex = index;
         this.addContractFormdata = this.newFormData.contractOrders[index];
         this.addContractShow = true;
      },
      xswaybill() {
         console.log('新建发运申请', this.newFormData);
         uni.showLoading({
            title: '加载中...'
         });
         this.$reqPost('xswaybill', this.newFormData).then(res => {
            uni.hideLoading();
            console.log('新建发运申请', res);
            if (res.code == 0) {
               this.$u.toast('添加成功,即将返回申请页!!!');
               setTimeout(() => {
                  uni.navigateBack({
                     // url: '/pages/my-application/my-application'
                     delta: 2
                  });
               }, 1500);
            }
         });
      },
      backPage() {
         uni.navigateBack({
            delta: 1
         });
      }
   }
};
</script>
<style lang="scss" scoped>
@include tableMainStyle();
::v-deep.new-application-form-data {
  width: 100%;
  padding-bottom: vww(40);
  // 标题
  .newApplicationTitle {
    margin-bottom: 0;
  }
   width: 100%;
   padding-bottom: vww(40);
   // 标题
   .newApplicationTitle {
      margin-bottom: 0;
   }
  // 表单
  .formDataContaniner {
    .u-form {
      width: 91%;
      margin: 0 auto 0;
   // 表单
   .formDataContaniner {
      .u-form {
         width: 91%;
         margin: 0 auto 0;
      .u-form-item {
        .u-form-item__body {
          .u-form-item__body__left {
            .u-form-item__body__left__content {
              .u-form-item__body__left__content__label {
              }
            }
          }
         .u-form-item {
            .u-form-item__body {
               .u-form-item__body__left {
                  .u-form-item__body__left__content {
                     .u-form-item__body__left__content__label {
                     }
                  }
               }
          .u-form-item__body__right {
            .u-form-item__body__right__content {
              .u-form-item__body__right__content__slot {
              }
            }
          }
        }
      }
    }
  }
               .u-form-item__body__right {
                  .u-form-item__body__right__content {
                     .u-form-item__body__right__content__slot {
                     }
                  }
               }
            }
         }
      }
   }
  // 选择客户弹框
  .selectCustomerPopup {
    .u-popup {
      .u-transition {
        height: 95%;
   // 选择客户弹框
   .selectCustomerPopup {
      .u-popup {
         .u-transition {
            height: 95%;
        .u-popup__content {
          overflow: scroll !important;
            .u-popup__content {
               overflow: scroll !important;
          .selectCustomerTitle {
            margin-bottom: 0;
          }
               .selectCustomerTitle {
                  margin-bottom: 0;
               }
          .selectCustomerContainer {
            padding: 0 4%;
            // .loadmoreClass{
            //    .u-loadmore{
            //       .u-loadmore__content{
            //          .u-loadmore__content__text{
            //          }
            //       }
            //    }
            // }
            .searchContainer {
              .u-input {
                width: 90%;
              }
            }
               .selectCustomerContainer {
                  padding: 0 4%;
                  // .loadmoreClass{
                  //    .u-loadmore{
                  //       .u-loadmore__content{
                  //          .u-loadmore__content__text{
                  //          }
                  //       }
                  //    }
                  // }
                  .searchContainer {
                     .u-input {
                        width: 90%;
                     }
                  }
            .searchCustomerBtn {
              margin-top: vww(10);
              display: flex;
                  .searchCustomerBtn {
                     margin-top: vww(10);
                     display: flex;
              .u-button {
                width: 30%;
              }
            }
                     .u-button {
                        width: 30%;
                     }
                  }
            // 数据列表
            .searchResultList {
              margin-top: vww(16);
            }
                  // 数据列表
                  .searchResultList {
                     margin-top: vww(16);
                  }
                  // 滚动通知
                  .tapStyle{
                     margin-top: vww(30);
                  }
            // 合同表格
            .tableContract {
              margin-top: vww(30);
              display: flex;
              justify-content: center;
                  // 合同表格
                  .tableContract {
                     display: flex;
                     justify-content: center;
              .uni-table-scroll {
                min-width: 0 !important;
                     .uni-table-scroll {
                        min-width: 0 !important;
                .uni-table {
                  .uni-table-tr {
                    padding: 0;
                    font-size: vww(13);
                        .uni-table {
                           .uni-table-tr {
                              padding: 0;
                              font-size: vww(13);
                    .uni-table-th {
                      width: vww(100);
                      height: vww(32);
                      line-height: vww(20);
                      padding: vww(5) vww(10);
                      color: #111111;
                      font-weight: 400;
                      background: #f5f5f5;
                    }
                              .uni-table-th {
                                 width: vww(100);
                                 height: vww(32);
                                 line-height: vww(20);
                                 padding: vww(5) vww(10);
                                 color: #111111;
                                 font-weight: 400;
                                 background: #f5f5f5;
                              }
                    .uni-table-td {
                      line-height: vww(20);
                      padding: vww(5) vww(10);
                      color: #111111;
                    }
                  }
                }
              }
                              .uni-table-td {
                                 line-height: vww(20);
                                 padding: vww(5) vww(10);
                                 color: #111111;
                              }
                           }
                        }
                     }
              .tableBody {
                width: 80%;
                .contractTableTd{
                  width:vww(200);
                  white-space: nowrap;
                  text-overflow: ellipsis;
                  overflow: hidden;
                }
              }
                     .tableBody {
                        width: 80%;
                        .contractTableTd {
                           width: vww(200);
                           white-space: nowrap;
                           text-overflow: ellipsis;
                           overflow: hidden;
                        }
                     }
              .TableUtilBtn {
                width: 20%;
                overflow: hidden;
                     .TableUtilBtn {
                        width: 20%;
                        overflow: hidden;
                .uni-table {
                  min-width: 0 !important;
                }
                        .uni-table {
                           min-width: 0 !important;
                        }
                .TableUtilBtnContainer {
                  .u-button {
                    width: vww(20);
                  }
                }
              }
            }
                        .TableUtilBtnContainer {
                           .u-button {
                              width: vww(20);
                           }
                        }
                     }
                  }
            // 合同类型选择器
            .selectContractTypePicker {
              .u-popup {
                .u-transition {
                  height: auto;
                }
              }
            }
                  // 合同类型选择器
                  .selectContractTypePicker {
                     .u-popup {
                        .u-transition {
                           height: auto;
                        }
                     }
                  }
            .selectCustomerCompSheet {
              .u-popup {
                .u-transition {
                  height: auto;
                }
              }
            }
                  .selectCustomerCompSheet {
                     .u-popup {
                        .u-transition {
                           height: auto;
                        }
                     }
                  }
            .selectLevelSheet {
              .u-popup {
                .u-transition {
                  height: auto;
                }
              }
            }
                  .selectLevelSheet {
                     .u-popup {
                        .u-transition {
                           height: auto;
                        }
                     }
                  }
            // 时间选择器
            .selectContractStartTime {
              .u-popup {
                .u-transition {
                  height: auto;
                }
              }
            }
                  // 时间选择器
                  .selectContractStartTime {
                     .u-popup {
                        .u-transition {
                           height: auto;
                        }
                     }
                  }
            .selectContractEndTime {
              .u-popup {
                .u-transition {
                  height: auto;
                }
              }
            }
          }
        }
      }
    }
  }
                  .selectContractEndTime {
                     .u-popup {
                        .u-transition {
                           height: auto;
                        }
                     }
                  }
               }
            }
         }
      }
   }
  // 煤厂
  .addContractContainer {
    .u-popup {
      .u-transition {
        height: 95%;
   // 煤厂
   .addContractContainer {
      .u-popup {
         .u-transition {
            height: 95%;
        .u-popup__content {
          overflow: scroll !important;
            .u-popup__content {
               overflow: scroll !important;
          .addContractFormTitle {
            margin-bottom: 0;
          }
               .addContractFormTitle {
                  margin-bottom: 0;
               }
          // 搜索
          .coalFiledSelectSearch {
          }
               // 搜索
               .coalFiledSelectSearch {
               }
          // 选择煤种
          .coalFiledSelectPopup {
            .u-popup {
              .u-transition {
                height: 80%;
               // 选择煤种
               .coalFiledSelectPopup {
                  .u-popup {
                     .u-transition {
                        height: 80%;
                .u-popup__content {
                  overflow: scroll !important;
                  // 表格
                  .coalFiledTable {
                    width: 92%;
                    display: flex;
                    justify-content: center;
                    margin: 0 auto;
                        .u-popup__content {
                           overflow: scroll !important;
                           // 表格
                           .coalFiledTable {
                              width: 92%;
                              display: flex;
                              justify-content: center;
                              margin: 0 auto;
                    .uni-table-scroll {
                      min-width: 0 !important;
                              .uni-table-scroll {
                                 min-width: 0 !important;
                      .uni-table {
                        .uni-table-tr {
                          padding: 0;
                          font-size: vww(13);
                                 .uni-table {
                                    .uni-table-tr {
                                       padding: 0;
                                       font-size: vww(13);
                          .uni-table-th {
                            width: vww(100);
                            height: vww(32);
                            line-height: vww(20);
                            padding: vww(5) vww(10);
                            color: #111111;
                            font-weight: 400;
                            background: #f5f5f5;
                          }
                                       .uni-table-th {
                                          width: vww(100);
                                          height: vww(32);
                                          line-height: vww(20);
                                          padding: vww(5) vww(10);
                                          color: #111111;
                                          font-weight: 400;
                                          background: #f5f5f5;
                                       }
                          .uni-table-td {
                            line-height: vww(20);
                            padding: vww(5) vww(10);
                            color: #111111;
                          }
                        }
                      }
                    }
                                       .uni-table-td {
                                          line-height: vww(20);
                                          padding: vww(5) vww(10);
                                          color: #111111;
                                       }
                                    }
                                 }
                              }
                    .tableBody {
                      width: 80%;
                    }
                              .tableBody {
                                 width: 80%;
                              }
                    .TableUtilBtn {
                      width: 20%;
                      overflow: hidden;
                              .TableUtilBtn {
                                 width: 20%;
                                 overflow: hidden;
                      .uni-table {
                        min-width: 0 !important;
                      }
                                 .uni-table {
                                    min-width: 0 !important;
                                 }
                      .TableUtilBtnContainer {
                        .u-button {
                          width: vww(20);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
                                 .TableUtilBtnContainer {
                                    .u-button {
                                       width: vww(20);
                                    }
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
  // 添加合同
  .addContractContainer {
    .u-popup {
      .u-transition {
        height: 95%;
   // 添加合同
   .addContractContainer {
      .u-popup {
         .u-transition {
            height: 95%;
        .u-popup__content {
          // background-color: rgb(247, 247, 247);
          overflow: scroll !important;
            .u-popup__content {
               // background-color: rgb(247, 247, 247);
               overflow: scroll !important;
          .addContractForm {
            width: 92%;
            margin: 0 auto;
               .addContractForm {
                  width: 92%;
                  margin: 0 auto;
            // 表单
            // .u-form{
            //    .u-form-item{
            //       .u-form-item__body{
            //          .u-form-item__body__right{
            //             .u-form-item__body__right__content__slot{
            //                .u-input{
            //                   border:1px solid #dddddd;
            //                   .u-input__content{
                  // 表单
                  // .u-form{
                  //    .u-form-item{
                  //       .u-form-item__body{
                  //          .u-form-item__body__right{
                  //             .u-form-item__body__right__content__slot{
                  //                .u-input{
                  //                   border:1px solid #dddddd;
                  //                   .u-input__content{
            //                   }
            //                }
            //             }
            //          }
            //       }
            //    }
            // }
                  //                   }
                  //                }
                  //             }
                  //          }
                  //       }
                  //    }
                  // }
            .formUpCard {
              margin-top: vww(10);
              padding: vww(10);
              border-radius: vww(4);
              box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
              background-color: #ffffff;
              // 价格卡片
              .priceList {
                min-height: vww(20);
                border-radius: vww(4);
                padding: vww(10) 0;
                box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
                // margin-top:vww(10);
                background-color: #ffffff;
                  .formUpCard {
                     margin-top: vww(10);
                     padding: vww(10);
                     border-radius: vww(4);
                     box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
                     background-color: #ffffff;
                     // 价格卡片
                     .priceList {
                        min-height: vww(20);
                        border-radius: vww(4);
                        padding: vww(10) 0;
                        box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
                        // margin-top:vww(10);
                        background-color: #ffffff;
                .currentPriceContainer {
                  .currentPriceBox {
                    width: 92%;
                    margin: 0 auto;
                  }
                }
                        .currentPriceContainer {
                           .currentPriceBox {
                              width: 92%;
                              margin: 0 auto;
                           }
                        }
                .selectPriceContainer {
                  .selectPricebox {
                    width: 92%;
                    margin: 0 auto;
                        .selectPriceContainer {
                           .selectPricebox {
                              width: 92%;
                              margin: 0 auto;
                    .selectPriceboxItem {
                      display: flex;
                      justify-content: space-between;
                    }
                  }
                }
              }
            }
                              .selectPriceboxItem {
                                 display: flex;
                                 justify-content: space-between;
                              }
                           }
                        }
                     }
                  }
            .formDownCard {
              border-radius: vww(4);
              padding: vww(10);
              box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
              margin-top: vww(10);
              background-color: #ffffff;
            }
                  .formDownCard {
                     border-radius: vww(4);
                     padding: vww(10);
                     box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
                     margin-top: vww(10);
                     background-color: #ffffff;
                  }
            .addContractConfirm {
              margin-top: vww(30);
            }
          }
                  .addContractConfirm {
                     margin-top: vww(30);
                  }
               }
          // 品种选择器
          .addContractCoalPicker {
            .u-popup {
              .u-transition {
                height: auto;
              }
            }
          }
        }
      }
    }
  }
               // 品种选择器
               .addContractCoalPicker {
                  .u-popup {
                     .u-transition {
                        height: auto;
                     }
                  }
               }
            }
         }
      }
   }
  // 表格
  .newApplicationTable {
    margin: vww(40) auto;
    width: 100%;
    padding: vww(0) vww(10) vww(60) vww(10);
    box-sizing: border-box;
   // 表格
   .newApplicationTable {
      margin: vww(40) auto;
      width: 100%;
      padding: vww(0) vww(10) vww(60) vww(10);
      box-sizing: border-box;
    .u-swipe-action {
      .u-swipe-action-item {
        box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
        margin-top: vww(10);
      .u-swipe-action {
         .u-swipe-action-item {
            box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
            margin-top: vww(10);
        .u-swipe-action-item__right {
          .u-swipe-action-item__right__button {
            .u-swipe-action-item__right__button__wrapper {
              background-color: #ee336b !important;
            }
          }
        }
      }
    }
            .u-swipe-action-item__right {
               .u-swipe-action-item__right__button {
                  .u-swipe-action-item__right__button__wrapper {
                     background-color: #ee336b !important;
                  }
               }
            }
         }
      }
    .cardList {
      height: vww(130);
      border-radius: vww(4);
      padding: vww(10);
      position: relative;
      .cardList {
         height: vww(130);
         border-radius: vww(4);
         padding: vww(10);
         position: relative;
      .cardListIcon {
        position: absolute;
        right: vww(20);
        top: vww(20);
      }
         .cardListIcon {
            position: absolute;
            right: vww(20);
            top: vww(20);
         }
      .cardList-container {
        .cardList_item {
          margin-top: vww(12);
          font-size: 14px;
          display: flex;
         .cardList-container {
            .cardList_item {
               margin-top: vww(12);
               font-size: 14px;
               display: flex;
          view {
            width: 50%;
               view {
                  width: 50%;
            &:nth-child(2) {
              margin-left: vww(20);
            }
          }
        }
      }
    }
                  &:nth-child(2) {
                     margin-left: vww(20);
                  }
               }
            }
         }
      }
    .addCard {
      width: 100%;
      height: vww(130);
      margin-top: vww(10);
      border-radius: vww(4);
      display: flex;
      justify-content: center;
      align-items: center;
      box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
    }
  }
      .addCard {
         width: 100%;
         height: vww(130);
         margin-top: vww(10);
         border-radius: vww(4);
         display: flex;
         justify-content: center;
         align-items: center;
         box-shadow: 0 2px 16px #e5e5e5, 0 0 1px #e5e5e5, 0 0 1px #e5e5e5;
      }
   }
  // button
  .new-application-button {
    display: flex;
   // button
   .new-application-button {
      display: flex;
    .u-button {
      width: vww(120);
      height: vww(40);
    }
  }
      .u-button {
         width: vww(120);
         height: vww(40);
      }
   }
}
</style>