Browse Source

电梯信息录入 合计计算总价

chenj 5 days ago
parent
commit
15393519e4

+ 4 - 21
ruoyi-ui-vue2/src/views/contract/edit.vue

@@ -776,12 +776,12 @@ export default {
   },
 
   async created() {
+    this.loading = true;
     this.permissionChar = this.$store.state.user.permissionChar
     this.language = this.$i18n.locale;
+    this.contractId = this.$route.params.contractId ;
     //初始化点击button的类型
     this.initType();
-    this.contractId = this.$route.params.contractId ;
-    this.loading = true;
     //从数据库取出货币单位
     this.getDictsFun()
 
@@ -791,11 +791,10 @@ export default {
       //获取代理商List
       await this.getAgentListByOwner();
       //不是新增
-      if (this.type != 'add') {
+      if (this.type !== 'add') {
         //判断是否存在履历id historyId
         //非新增并且只是查询
-        console.log("this.type===============>",this.type)
-        if (this.type == 'history') {
+        if (this.type === 'history') {
           await this.getHistoryForm();
         } else {
           //编辑或者变更
@@ -1190,24 +1189,9 @@ export default {
     },
     /** 查询客户所有人列表 */
     getAllOwnerList() {
-      // getAllOwnerList({onlySalesRole: false}).then(res => {
-      //   this.ownerList = res.data;
-      // })
-      // //获取业务员
-      // getAuthRole(this.form.salesman?this.form.salesman:this.$store.state.user.userInfo.userId).then(response => {
-      //   const newUser = response.user;
-      //
-      //   // 检查 ownerList 中是否已经存在相同的 user
-      //   const exists = this.ownerList.some(owner => owner.userId === newUser.userId); // 假设 userId 是唯一标识
-      //
-      //   if (!exists) {
-      //     this.ownerList.push(newUser); // 只有在不存在时才添加
-      //   }
-      // })
       getNickNameList().then(res => {
         this.ownerList = res.data;
       })
-
     },
     //设备一览提交
     equipmentSubmitForm(){
@@ -1468,7 +1452,6 @@ export default {
       this.$nextTick(() => {
         this.$set(rowAmount,column,value)
         this.$set(rowAmount,'additionalCost',this.sumPrice1(rowAmount))
-        // this.$set(rowAmount,'liftAmount',this.sumPrice(rowAmount))
       })
     },
     additionalCostSubmitForm(){

+ 12 - 15
ruoyi-ui-vue2/src/views/contract/index.vue

@@ -56,7 +56,7 @@
         <Column :label="$t('contract.endCustomers')" prop="endCustomersName" show-search :searchParams="queryParams"/>
 
         <!--币种10-->
-        <Column  :label="$t('contract.currencyId')"  prop="currencyId" searchType="select" :searchDict="dict.type.currency_type" />
+        <Column  :label="$t('contract.currencyId')"  prop="currencyId" searchType="select" :searchDict="dict.type.currency_type" :searchParams="queryParams" />
 
         <!--金额31-->
         <Column :label="$t('lift.amountOfMoney')" :searchParams="queryParams"  prop="amount"  align="right" >
@@ -135,7 +135,7 @@ import {
 } from "@/api/contract/contract";
 import {getAllAreaList} from "@/api/user/area";
 import {curAgent} from "@/api/business/crm/lead";
-import {getAllOwnerList, getAuthRole} from "@/api/system/user";
+import {getAllOwnerList, getAuthRole, getNickNameList} from "@/api/system/user";
 import {audit} from "@/api/system/flow";
 import {rollback} from "@/api/audit/flow";
 import {parseTime} from "@/utils/ruoyi";
@@ -296,7 +296,7 @@ export default {
     };
   },
   created() {
-    console.log("this.$route.query=========>",this.$route.query)
+    this.$set(this.queryParams,'contractNo',this.$route.query.businessNo)
     this.getArea();
     this.curCountry()
     this.getAreaList()
@@ -323,13 +323,9 @@ export default {
     },
     /** 查询客户所有人列表 */
     getAllOwnerList() {
-      getAllOwnerList({onlySalesRole: false}).then(res => {
+      getNickNameList().then(res => {
         this.ownerList = res.data;
       })
-      //将超级管理员的账号添加
-      getAuthRole(1).then(response => {
-        this.ownerList.push(response.user)
-      })
     },
     //获取代理商
     async curAgent() {
@@ -366,8 +362,10 @@ export default {
 
       try {
         const response = await listContractBo(params);
-        this.contractList = response.rows;
-        this.queryParams.total = response.total;
+        if(response && response.code === 200){
+          this.contractList = response.rows;
+          this.queryParams.total = response.total;
+        }
       } finally {
         this.loading = false;
       }
@@ -380,7 +378,7 @@ export default {
       this.queryParams.pageNum = 1;
       this.getList();
     },
-    /** 重置按钮操作 todo:待补充*/
+    /** 重置按钮操作 */
     resetQuery() {
       this.$set(this.queryParams, 'paymentRatio', null)
       this.$set(this.queryParams, 'contractNo', null)
@@ -489,10 +487,9 @@ export default {
       response.data.forEach(item=>{
         this.curCountryOps.push({
           label: item.countryName,
-          value: parseInt(item.countryId)
+          value: item.countryId
         })
       })
-      console.log("this.curCountryOps==============>",this.curCountryOps)
     },
     //查看合同
     handleView(row){
@@ -568,10 +565,10 @@ export default {
         businessObj: bargainObj
       }
       const response = await rollback(auditForm)
-      if(response && response.code == 200){
+      if(response && response.code === 200){
         //合同状态变为已取消
         updateContract({id:row.id,approveStatus:'3'}).then(res=>{
-          if(res && res.code == 200){
+          if(res && res.code === 200){
             this.$message.success("合同取消成功")
             this.getList()
           }

+ 44 - 19
ruoyi-ui-vue2/src/views/contract/lift/index.vue

@@ -342,7 +342,7 @@
           <!--单价18-->
           <Column  :label="$t('lift.unitPrice')"  prop="unitPrice"   align="right" v-if="checkPermi(['user:contract:lift:unitPriceEdit'])">
             <template v-slot="scope">
-              <MoneyInput :inputValue="scope.row.unitPrice" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'unitPrice')" ></MoneyInput>
+              <MoneyInput :inputValue="scope.row.unitPrice" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'unitPrice',true)" ></MoneyInput>
             </template>
           </Column >
           <!--报价折扣19-->
@@ -415,13 +415,13 @@
           <!--评审运费40 可修改-->
           <Column  :label="$t('lift.reviewShippingCosts')"  prop="reviewShippingCosts" align="right" v-if="checkPermi(['user:contract:lift:reviewShippingCostsEdit'])">
             <template v-slot="scope">
-              <MoneyInput :inputValue="scope.row.reviewShippingCosts" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'reviewShippingCosts')" ></MoneyInput>
+              <MoneyInput :inputValue="scope.row.reviewShippingCosts" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'reviewShippingCosts',true)" ></MoneyInput>
             </template>
           </Column >
           <!--评审佣金41 可修改-->
           <Column :label="$t('lift.reviewCommission')"  prop="reviewCommission" align="right" v-if="checkPermi(['user:contract:lift:reviewCommissionEdit'])">
             <template v-slot="scope">
-              <MoneyInput :inputValue="scope.row.reviewCommission" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'reviewCommission')" ></MoneyInput>
+              <MoneyInput :inputValue="scope.row.reviewCommission" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'reviewCommission',true)" ></MoneyInput>
             </template>
           </Column >
 
@@ -450,14 +450,14 @@
           <!--预计内陆运费48 可修改-->
           <Column :label="$t('lift.planInlandFreightCost')" align="right" v-if="checkPermi(['user:contract:lift:planInlandFreightCost'])" prop="planInlandFreightCost" >
             <template v-slot="scope">
-              <MoneyInput :inputValue="scope.row.planInlandFreightCost" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'planInlandFreightCost')" ></MoneyInput>
+              <MoneyInput :inputValue="scope.row.planInlandFreightCost" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'planInlandFreightCost',true)" ></MoneyInput>
             </template>
           </Column>
 
           <!--预计海运费49 可修改-->
           <Column :label="$t('lift.planOceanFreight')"  align="right" v-if="checkPermi(['user:contract:lift:planOceanFreight'])" prop="planOceanFreight" >
             <template v-slot="scope">
-              <MoneyInput :inputValue="scope.row.planOceanFreight" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'planOceanFreight')" ></MoneyInput>
+              <MoneyInput :inputValue="scope.row.planOceanFreight" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'planOceanFreight',true)" ></MoneyInput>
             </template>
           </Column>
 
@@ -476,8 +476,8 @@
 
           <!--其他费用52 不可修改-->
           <Column :label="$t('lift.otherFees')"  prop="otherCost"  v-if="checkPermi(['user:contract:lift:otherCost'])">
-            <template #default="{ row }">
-              <span>{{ toDecimal2(numFormat(row.otherCost)) }}</span>
+            <template v-slot="scope">
+              <MoneyInput :inputValue="scope.row.otherCost" :zeroLength="2" @change="item=>valueChanged(item,scope.row,'otherCost',true)" ></MoneyInput>
             </template>
           </Column>
           <!--附加费用53 不可修改-->
@@ -576,7 +576,7 @@ import MoreBtn from "@/components/MoreBtn/index.vue";
 import {addLiftBatch, listAllById, listLift, selectProductionOrderNo, updateOrderNoBo} from "@/api/contract/lift";
 import {getAreaList} from "@/api/business/crm/account";
 import {curAgent} from "@/api/business/crm/lead";
-import {getAllOwnerList, getAuthRole} from "@/api/system/user";
+import {getAllOwnerList, getAuthRole, getNickNameList} from "@/api/system/user";
 import MoneyInput from "@/components/element/form/items/moneyInput.vue";
 import DatePicker from "@/components/element/form/items/DatePicker.vue";
 import DictColumn from "@/components/element/table/DictColumn.vue";
@@ -590,6 +590,7 @@ import {addSn, listSn} from "@/api/contract/liftSn";
 import InputNumberColumn from "@/components/element/table/InputNumberColumn.vue";
 import InputNumber from "@/components/element/form/items/InputNumber.vue";
 import {getAllNationNeedLanguageList} from "@/api/user/country";
+import {delcommafy} from "@/utils/money";
 
 export default {
   name: "Lift",
@@ -758,13 +759,9 @@ export default {
     checkPermi,
     /** 查询客户所有人列表 */
     getAllOwnerList() {
-      getAllOwnerList({onlySalesRole: false}).then(res => {
+      getNickNameList().then(res => {
         this.ownerList = res.data;
       })
-      // //将超级管理员的账号添加
-      // getAuthRole(1).then(response => {
-      //   this.ownerList.push(response.user)
-      // })
     },
     //获取代理商
     async curAgent() {
@@ -955,18 +952,46 @@ export default {
       this.$set(this.queryParams, 'rate4SigningContracts', null)
       this.$set(this.queryParams, 'rate4Shipment', null)
       this.$set(this.queryParams, 'elevatorCode', null)
-
-
-
-
       this.handleQuery();
     },
-    valueChanged(value, rowAmount,column) {
+    valueChanged(value, rowAmount,column,sumFlag) {
       this.$nextTick(() => {
         this.$set(rowAmount,column,value)
-        // this.$set(rowAmount,'additionalCost',this.sumPrice(rowAmount))
+        if(sumFlag != null){
+          console.log("有效果")
+          this.$set(rowAmount,'additionalCost',this.sumPrice1(rowAmount))
+        }
       })
     },
+    sumPrice1(row){
+      if(isNaN(row.unitPrice)){
+        row.unitPrice = 0.00
+      }
+      if(isNaN(row.planInlandFreightCost)){
+        row.planInlandFreightCost = 0.00
+      }
+      if(isNaN(row.planOceanFreight)){
+        row.planOceanFreight = 0.00
+      }
+      if(isNaN(row.reviewShippingCosts)){
+        row.reviewShippingCosts = 0.00
+      }
+      if(isNaN(row.reviewCommission)){
+        row.reviewCommission = 0.00
+      }
+      if(isNaN(row.otherCost)){
+        row.otherCost = 0.00
+      }
+      let amount = (Number(delcommafy(row.planInlandFreightCost)) +
+        Number(delcommafy(row.planOceanFreight)) +
+        Number(delcommafy(row.reviewShippingCosts)) +
+        Number(delcommafy(row.reviewCommission))+
+        Number(delcommafy(row.otherCost))).toFixed(2) || 0.00
+      row.additionalCost = amount
+      console.log("amount============================》",amount)
+      row.liftAmount = (Number(delcommafy(amount))+Number(delcommafy(row.unitPrice))).toFixed(2)
+      return amount
+    },
 
 
     // 多选框选中数据