wk
2024-10-23 77428b4780dcd121a173503b9063774d8d205332
subPages/addTo-freightForwarder-purchasePermit/addTo-freightForwarder-purchasePermit.vue
@@ -28,9 +28,15 @@
                  @confirm="treeChooseValue" />
            </u-form-item>
            <u-form-item labelWidth="20%"
               label="购买总量"
               label="购买总量(KG)"
               ref="item1" prop="buyTotal1">
               <u--input v-model="buyTotal1"
                  :customStyle="{ border: '1px solid #dddddd' }"></u--input>
            </u-form-item>
            <u-form-item labelWidth="20%"
               label="购买总量(吨)"
               ref="item1" prop="buyTotal">
               <u--input v-model="form.buyTotal"
               <u--input v-model="form.buyTotal" disabled
                  :customStyle="{ border: '1px solid #dddddd' }"></u--input>
            </u-form-item>
            <u-form-item labelWidth="25%"
@@ -71,15 +77,38 @@
         qianTree
      },
      onLoad(params) {
         this.role = params.role;
         if (params.fleetId) {
            this.fleetId = params.fleetId;
         if(params.data){
            this.form=Object.assign({},this.form,JSON.parse(decodeURIComponent(params.data)))
            this.productName=this.form.productName
            this.range=[this.form.startDate,this.form.endDate]
            if (this.fileList1.length == 0 && this.form.buyFilePath) {
               this.fileList1.push({
                  url: `${BaseUrl}${this.form.buyFilePath}`
               });
            }
         }
      },
      watch:{
         form(newval,oldval){
            if(!newval||newval==''){
               this.form.buyTotal=null
            }else{
               this.buyTotal1=(newval.buyTotal*1000).toFixed(2)
            }
         },
         buyTotal1(newval,oldval){
            if(!newval||newval==''){
               this.form.buyTotal=null
            }else{
               this.form.buyTotal=(newval/1000).toFixed(2)
            }
         },
      },
      data() {
         return {
            buyTotal1:0,
            form:{
               buyTotal:"",
               buyTotal:0,
               cardNumber:"",
               customerId,
               productId:"",
@@ -99,6 +128,7 @@
                     trigger: ['blur', 'change']
                  },
                  buyTotal: [{
                        type: 'number',
                        required: true,
                        message: '请输入购买总量',
                        // blur和change事件触发检验
@@ -134,19 +164,35 @@
                  duration: 2000
               });
            } else {
               this.$reqPost('addBuycard', this.form, 'json').then(result => {
                  if (result.code == 0) {
                     this.$u.toast('提交成功');
                     let timer = setTimeout(() => {
                        uni.navigateBack({
                           delta: 1
                        });
                        uni.$emit('needRefresh')
                     }, 500);
                  } else {
                     this.$u.toast(result.msg ? result.msg : '提交失败');
                  }
               });
               if(this.form.id){
                  this.$reqPut('putBuycard',{ ...this.form,status:0,}, 'json').then(result => {
                     if (result.code == 0) {
                        this.$u.toast('提交成功');
                        let timer = setTimeout(() => {
                           uni.navigateBack({
                              delta: 1
                           });
                           uni.$emit('needRefresh')
                        }, 500);
                     } else {
                        this.$u.toast(result.msg ? result.msg : '提交失败');
                     }
                  })
               }else{
                  this.$reqPost('addBuycard', this.form, 'json').then(result => {
                     if (result.code == 0) {
                        this.$u.toast('提交成功');
                        let timer = setTimeout(() => {
                           uni.navigateBack({
                              delta: 1
                           });
                           uni.$emit('needRefresh')
                        }, 500);
                     } else {
                        this.$u.toast(result.msg ? result.msg : '提交失败');
                     }
                  });
               }
            }
            })
         },
@@ -265,4 +311,8 @@
         margin: 0 auto;
      }
   }
   ::v-deep.tki-tree .tki-tree-mask .tki-tree-cnt{
      position: fixed;
      top: 50vh;
   }
</style>