付延余
2022-08-03 910f2ef56d0d49a4ce24b2f33860dce4d739b1b4
pages/edit-my-application/edit-my-application.vue
@@ -27,7 +27,7 @@
        </u-form-item>
        <u-form-item @click="timeShow = true" labelWidth="20%" label="日期" borderBottom
                     ref="timeDataRef">
          <u--input v-model="timeDataStr" border="none" placeholder="请选择范围日期"></u--input>
          <u--input v-model="timeDataStr" disabled disabledColor="#ffffff" border="none" placeholder="请选择范围日期"></u--input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item labelWidth="20%" label="编号"  borderBottom>
@@ -268,7 +268,7 @@
                  <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>
@@ -383,7 +383,7 @@
                  </view>
                </template>
                <u-form-item @click="addContractTransportShow = true" label="运输" labelWidth="20%" ref="item1">
                  <u--input v-model="addContractTransport"></u--input>
                  <u--input v-model="addContractTransport" disabled disabledColor="#ffffff"></u--input>
                </u-form-item>
              </view>
              <view class="formDownCard">
@@ -482,10 +482,10 @@
                                @click="searchCustomerForm.compName = ''"></u-icon>
                      </u-form-item>
                      <u-form-item labelWidth="20%" label="客户名称" borderBottom ref="timeDataRef">
                        <u--input v-model="selectCustomerData.customerName" border="none"
                        <u--input v-model="selectCustomerData.customerFullName" border="none"
                                  placeholder="输入客户名称"></u--input>
                        <u-icon slot="right" name="close-circle-fill" v-show="selectCustomerData.customerName != ''"
                                @click="selectCustomerData.customerName = ''"></u-icon>
                        <u-icon slot="right" name="close-circle-fill" v-show="selectCustomerData.customerFullName != ''"
                                @click="selectCustomerData.customerFullName = ''"></u-icon>
                      </u-form-item>
                      <u-form-item labelWidth="20%" label="客户级别" borderBottom>
                        <u--input @focus="selectLevelShow = true" border="none" v-model="searchCustomerForm.levelText"
@@ -503,24 +503,24 @@
                  <view class="searchResultList">
                    <u-cell-group :right-icon="false">
                      <u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
                        <text slot="value" class="u-slot-value">
                        <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;
                                          line-height:20px;
                                          width: 43px;
                                          font-size: 10px;
                                          padding: 0;"
                                                        color: #ffffff;
                                                        margin: auto 0;
                                                        height: 20px;
                                                        line-height:20px;
                                                        width: 43px;
                                                        font-size: 10px;
                                                        padding: 0;"
                              @click="addContractConsigneeConfirm(item)"
                          >
                            选择
                          </button>
                        </text>
                        </view>
                      </u-cell>
                    </u-cell-group>
                  </view>
@@ -604,8 +604,8 @@
      <view class="messageCustomerBalance" v-if="accountDetails.balanceTotal >= 0">
        <text style="color: #FFA500;;">客户账户现汇余额:{{
            accountDetails.balanceTotal
          }},承兑余额:{{ accountDetails.balance2 == null ? 0 : customerChengdui }}
            accountDetails.balance == null ? 0 : accountDetails.balance
          }},承兑余额:{{ accountDetails.balance2 == null ? 0 : accountDetails.balance2 }}
        </text>
      </view>
      <u-swipe-action>
@@ -761,7 +761,7 @@
      // 选择客户
      selectCustomerData: {
        compIds: '',
        customerName: '',
        customerFullName: '',
        level: '',
        current: 1,
        size: 10
@@ -789,14 +789,14 @@
      // 选择合同
      // selectContractShow: false,
      // searchContractForm: {
      //    current: 1,
      //    size: 10,
      //    num: '',
      //    startDate: '',
      //    endDate: '',
      //    result: 2,
      //    type: '',
      //    customerName: ''
      //     current: 1,
      //     size: 10,
      //     num: '',
      //     startDate: '',
      //     endDate: '',
      //     result: 2,
      //     type: '',
      //     customerName: ''
      // },
      // contractData: [],
      // 类型
@@ -916,7 +916,6 @@
  },
  onLoad(options) {
    this.editApplicationTableId = JSON.parse(options.index);
  },
  onShow() {
    if (this.menuShow == true) {
@@ -989,23 +988,26 @@
      //变订单量
      if (this.addContractFormdata.id != null) {
            console.log('进入计算之前',this.addContractFormdata);
        if (this.addContractFormdata.price > 0 && (this.addContractFormdata.amount > 0 || this.addContractFormdata.quant > 0)) {
               // console.log('进入类型前计算');
          let price = this.addContractFormdata.price;
          if (this.addContractFormdata.trainType == 1) {
            let q = this.addContractFormdata.amount / price;
            this.addContractFormdata.quant = q.toFixed(2);
                  console.log('输入金额',this.addContractFormdata.quant);
            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 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);
            this.addContractFormdata.amount = amount.toFixed(2);
                     let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2);
                     this.addContractFormdata.amount = amount.toFixed(2);
          }
        }
      } else {
@@ -1014,29 +1016,29 @@
      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;
    //     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: {
@@ -1223,11 +1225,11 @@
    },
    // 客户选择弹框打开了
    // selectCustomerOpen() {
    //    // this.spanStyle = 'overflow:hidden'; //当蒙层弹起时,固定界面禁止滚动,当蒙层关闭时,允许滚动
    //     // this.spanStyle = 'overflow:hidden'; //当蒙层弹起时,固定界面禁止滚动,当蒙层关闭时,允许滚动
    // },
    // selectCustomerClose() {
    //    // this.spanStyle = 'overflow:auto'; // 让html的body可滑动
    //    // this.selectCustomerShow = false;
    //     // this.spanStyle = 'overflow:auto'; // 让html的body可滑动
    //     // this.selectCustomerShow = false;
    // },
    // 获取单位树
    fetchCompTree() {
@@ -1270,7 +1272,7 @@
    // 清空选择客户表单
    selectCustomerResetFields() {
      this.$refs.selectformRef.resetFields(); // 不起效果
      this.selectCustomerData.customerName = '';
      this.selectCustomerData.customerFullName = '';
      this.searchCustomerForm.compName = '';
      this.searchCustomerForm.levelText = '';
      this.selectCustomer();
@@ -1316,123 +1318,123 @@
    // 选择合同
    // 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('请选择结算客户');
    //          });
    //    }
    //     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(() => {
    //       this.$reqGet('contract_type').then(res => {
    //          res.data.forEach(item => {
    //             this.selectContractTypeData[0].push(item.value);
    //          });
    //       });
    //    });
    //     // 类型弹出框
    //     this.selectContractTypeShow = true;
    //     // 弹出框类型请求
    //     this.$nextTick(() => {
    //         this.$reqGet('contract_type').then(res => {
    //             res.data.forEach(item => {
    //                 this.selectContractTypeData[0].push(item.value);
    //             });
    //         });
    //     });
    // },
    // 选择合同弹框
    // selectContractOpen() {
    //    uni.showLoading({
    //       title: '加载中...'
    //    });
    //    this.$reqGet('contract_status').then(res => {
    //       // console.log('状态', res);
    //    });
    //    this.$reqGet('contract', this.searchContractForm).then(res => {
    //       uni.hideLoading();
    //       if (res.code == 0) {
    //          // console.log('合同', res);
    //          this.contractData = res.data.records;
    //       }
    //    });
    //     uni.showLoading({
    //         title: '加载中...'
    //     });
    //     this.$reqGet('contract_status').then(res => {
    //         // console.log('状态', res);
    //     });
    //     this.$reqGet('contract', this.searchContractForm).then(res => {
    //         uni.hideLoading();
    //         if (res.code == 0) {
    //             // console.log('合同', res);
    //             this.contractData = res.data.records;
    //         }
    //     });
    // },
    // selectContractClose() {
    //    this.selectContractShow = false;
    //     this.selectContractShow = false;
    // },
    // 合同类型选择器
    // selectContractTypeConfirm(v) {
    //    this.searchContractForm.type = v.value[0];
    //    this.selectContractTypeShow = false;
    //    console.log('选择器确定后的值', v, this.searchContractForm.type);
    //     this.searchContractForm.type = v.value[0];
    //     this.selectContractTypeShow = false;
    //     console.log('选择器确定后的值', v, this.searchContractForm.type);
    // },
    // selectContractTypeClose(v) {
    //    // 初始化合同类型选择器
    //    this.selectContractTypeData[0] = [];
    //     // 初始化合同类型选择器
    //     this.selectContractTypeData[0] = [];
    //    this.selectContractTypeShow = false;
    //    if (v) {
    //       this.searchContractForm.type = v.value[0];
    //    }
    //     this.selectContractTypeShow = false;
    //     if (v) {
    //         this.searchContractForm.type = v.value[0];
    //     }
    // },
    // 合同时间选择器
    // selectContractStartTimeConfirm(e) {
    //    this.selectContractStartTimeShow = false;
    //    this.searchContractForm.startDate = e[0];
    //     this.selectContractStartTimeShow = false;
    //     this.searchContractForm.startDate = e[0];
    // },
    // selectContractStartTimeClose() {
    //    this.selectContractStartTimeShow = false;
    //     this.selectContractStartTimeShow = false;
    // },
    // selectContractEndTimeConfirm(e) {
    //    this.selectContractEndTimeShow = false;
    //    this.searchContractForm.endDate = e[0];
    //     this.selectContractEndTimeShow = false;
    //     this.searchContractForm.endDate = e[0];
    // },
    // selectContractEndTimeClose() {
    //    this.selectContractEndTimeShow = false;
    //     this.selectContractEndTimeShow = false;
    // },
    // 重置表单所有字段
    // selectContractResetFields() {
    //    this.searchContractForm.num = '';
    //    this.searchContractForm.startDate = '';
    //    this.searchContractForm.endDate = '';
    //    this.searchContractForm.customerName = '';
    //    this.searchContractForm.type = '';
    //     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.selectContractShow = false;
    //     console.log('选择合同', e);
    //     this.newFormData.contractName = e.contractName;
    //     this.newFormData.contractNum = e.num;
    //     this.newFormData.contractId = e.id;
    //     this.selectContractShow = false;
    //    // 价格参数赋值
    //    this.getNewPriceData.type = e.type;
    //    // 选定合同详情
    //    uni
    //       .request({
    //          url: `/yunxiao/contractitem/getByContractId/${e.id}`,
    //          method: 'GET',
    //          header: {
    //             'TENANT-ID': 5,
    //             Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
    //             VERSION: 'zzl'
    //          }
    //       })
    //       .then(res => {
    //          this.contractDetails = res[1].data.data;
    //          console.log('合同详情', res, this.contractDetails);
    //       })
    //       .catch(err => {
    //          console.log(err);
    //       });
    //     // 价格参数赋值
    //     this.getNewPriceData.type = e.type;
    //     // 选定合同详情
    //     uni
    //         .request({
    //             url: `/yunxiao/contractitem/getByContractId/${e.id}`,
    //             method: 'GET',
    //             header: {
    //                 'TENANT-ID': 5,
    //                 Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
    //                 VERSION: 'zzl'
    //             }
    //         })
    //         .then(res => {
    //             this.contractDetails = res[1].data.data;
    //             console.log('合同详情', res, this.contractDetails);
    //         })
    //         .catch(err => {
    //             console.log(err);
    //         });
    // },
    // 添加订单按钮
    addContractClick() {
@@ -1704,7 +1706,7 @@
          this.$u.toast('添加成功');
        } else {
          // this.newFormData.contractOrders.map(i => {
          //    return this.newformData.contractOrders[]
          //     return this.newformData.contractOrders[]
          // })
          this.newFormData.contractOrders[this.applicationOrderIndex] = this.addContractFormdata;
          this.addContractShow = false; // 隐藏弹出框
@@ -1780,17 +1782,17 @@
    },
    // 选择客户
    // moveHandleCustomer() {
    //    return true;
    //     return true;
    // },
    // moveHandleContract(){
    //    return true;
    //     return true;
    // },
    // 新建发运申请
    newApplicationFormDataClick() {
      console.log('提交申请按钮');
      this.$refs.formRef
          .validate()
          .then(res => {
      // this.$refs.formRef
      //     .validate()
      //     .then(res => {
            let amount = 0;
            this.newFormData.contractOrders.forEach(e => {
              amount += Number(e.amount);
@@ -1801,11 +1803,7 @@
                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
                });
                        this.$u.toast('客户账户承兑余额不足,承兑余额:' + msg)
              } else {
                uni.showLoading({
                  title:'加载中...'
@@ -1819,11 +1817,7 @@
                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
                });
                        this.$u.toast('客户账户承兑余额不足,承兑余额:' + msg)
              } else {
                uni.showLoading({
                  title:'加载中...'
@@ -1832,15 +1826,15 @@
                // this.xswaybill();
              }
            }
          })
          .catch(err => {
            uni.$u.toast('校验失败');
          });
          // })
          // .catch(err => {
          //   uni.$u.toast('校验失败');
          // });
    },
    // 修改申请信息
    editShenQing() {
      uni.request({
        url: '/yunxiao/xswaybill',
        url: this.baseUrl + '/yunxiao/xswaybill',
        method: "PUT",
        data: this.newFormData,
        header: {
@@ -1878,10 +1872,10 @@
            duration: 2000
          });
          // this.$nextTick(() => {
          //    uni.navigateBack({
          //       // url: '/pages/my-application/my-application'
          //       delta: 2
          //    });
          //     uni.navigateBack({
          //         // url: '/pages/my-application/my-application'
          //         delta: 2
          //     });
          // });
        }
      });
@@ -1947,12 +1941,12 @@
          .selectCustomerContainer {
            padding: 0 4%;
            // .loadmoreClass{
            //    .u-loadmore{
            //       .u-loadmore__content{
            //          .u-loadmore__content__text{
            //          }
            //       }
            //    }
            //     .u-loadmore{
            //         .u-loadmore__content{
            //             .u-loadmore__content__text{
            //             }
            //         }
            //     }
            // }
            .searchContainer {
            }
@@ -2174,20 +2168,20 @@
            // 表单
            // .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-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 {