yuanchengman 1 vuosi sitten
vanhempi
commit
b3a340c9e3
2 muutettua tiedostoa jossa 59 lisäystä ja 30 poistoa
  1. 56 27
      src/views/modules/cus/quoted-price.vue
  2. 3 3
      src/views/modules/cus/quoted.vue

+ 56 - 27
src/views/modules/cus/quoted-price.vue

@@ -189,7 +189,7 @@
                 prop="notes"
                 header-align="center"
                 align="center"
-                min-width="120px"
+                min-width="160px"
                 fixed="right"
                 label="原材料费"
               >
@@ -201,7 +201,7 @@
                 prop="notes"
                 header-align="center"
                 align="center"
-                min-width="120px"
+                min-width="160px"
                 fixed="right"
                 label="生产加工费"
               >
@@ -213,7 +213,7 @@
                 prop="notes"
                 header-align="center"
                 align="center"
-                min-width="120px"
+                min-width="160px"
                 fixed="right"
                 label="热表处理费"
               >
@@ -235,21 +235,21 @@
           <el-row>
             <el-col :span="8" :offset="16">
               <el-form-item label="模具费">
-                <el-input-number v-model="dataForm.mouldPrice" :precision=2 :controls=false placeholder="请输入"></el-input-number>
+                <el-input-number v-model="dataForm.mouldPrice" @change="inputNumChangeHandle" :precision=2 :controls=false placeholder="请输入"></el-input-number>
               </el-form-item>
             </el-col>
              </el-row>
           <el-row>
             <el-col :span="8" :offset="16">
-              <el-form-item label="管理费">
-                <el-input-number v-model="dataForm.managePrice" :precision=2 :controls=false placeholder="请输入"></el-input-number>
+              <el-form-item label="管理费(%)">
+                <el-input-number v-model="dataForm.managePrice" @change="inputNumChangeHandle" :precision=0 :controls=false placeholder="请输入"></el-input-number>
               </el-form-item>
             </el-col>
              </el-row>
           <el-row>
             <el-col :span="8" :offset="16">
-              <el-form-item label="税率">
-                <el-input  v-model="dataForm.ratePrice"><i slot="suffix">%</i></el-input>
+              <el-form-item label="税率(%)">
+                <el-input-number  v-model="dataForm.ratePrice" @change="inputNumChangeHandle" :precision=0 :controls=false></el-input-number>
               </el-form-item>
             </el-col>
           </el-row>
@@ -469,16 +469,17 @@ export default {
   watch: {},
   computed: {},
   created () {
-    this.getCoCode()
-    this.getProductList()
+
   },
   mounted () {},
   activated () {},
   methods: {
-    init (id, type) {
+    async init (id, type) {
       this.id = id || 0
       this.type = type
       this.setTitle(type)
+      await this.getCoCode()
+      await this.getProductList()
       if (this.id) {
         this.getDetail(this.id)
       }
@@ -498,10 +499,14 @@ export default {
       getDetail(priceId).then(({ data }) => {
         if (data && data.code === '200') {
           this.dataForm = data.data
-          if (!this.dataForm.quotedPriceProductList) {
-            if (this.dataForm.productId) {
-              this.productIdChangeHandle(this.dataForm.productId)
-            }
+          if (this.dataForm.managePrice) {
+            this.dataForm.managePrice = this.dataForm.managePrice * 100
+          }
+          if (this.dataForm.ratePrice) {
+            this.dataForm.ratePrice = this.dataForm.ratePrice * 100
+          }
+          if (this.dataForm.productId) {
+            this.productIdChangeHandle(this.dataForm.productId)
           }
         }
       })
@@ -540,14 +545,34 @@ export default {
       if (val) {
         getProductAllDetail(val).then(({ data }) => {
           if (data && data.code === '200') {
-            this.dataForm.quotedPriceProductList = []
             this.productList = data.data
-            this.productList.forEach((item) => {
-              this.dataForm.quotedPriceProductList.push({
-                productId: item.productId
+            if (this.dataForm.quotedPriceProductList == null || this.dataForm.quotedPriceProductList.length === 0) {
+              this.productList.forEach((item) => {
+                this.dataForm.quotedPriceProductList.push({
+                  productId: item.productId
+                })
+                item.id = this.dataForm.quotedPriceProductList.find(t => t.productId === item.productId).id
               })
-              item.id = this.dataForm.quotedPriceProductList.find(t => t.productId === item.productId).id
-            })
+            } else {
+              this.dataForm.quotedPriceProductList.forEach(item => {
+                let tempItem = this.productList.find(t => t.productId === item.productId)
+                if (tempItem) {
+                  item.productName = tempItem.productName
+                  item.productSpec = tempItem.productSpec
+                  item.mapNumber = tempItem.mapNumber
+                  item.materials = tempItem.materials
+                  item.cnt = tempItem.cnt
+                  item.unit = tempItem.unit
+                  item.size = tempItem.size
+                  item.developedSize = tempItem.developedSize
+                  item.surfaceTreatment = tempItem.surfaceTreatment
+                  item.notes = tempItem.notes
+                }
+              })
+            }
+
+            // 触发自动计算
+            this.inputNumChangeHandle()
           }
         })
       } else {
@@ -595,7 +620,7 @@ export default {
       this.dataForm.materialCost = tempMaterialCost
 
       // 计算总价
-      this.dataForm.totalPrice = 0
+      this.dataForm.totalPrice = (tempMaterialCost + this.dataForm.mouldPrice) * (1 + this.dataForm.managePrice / 100) * (1 + this.dataForm.ratePrice / 100)
     },
     dataFormSubmit () {
       if (this.type === 'first') {
@@ -609,12 +634,12 @@ export default {
           let param = {
             priceId: this.dataForm.priceId,
             remark: this.dataForm.remark,
-            managePrice: this.dataForm.managePrice,
+            managePrice: this.dataForm.managePrice / 100,
             mouldPrice: this.dataForm.mouldPrice,
-            ratePrice: this.dataForm.ratePrice,
+            ratePrice: this.dataForm.ratePrice / 100,
             materialCost: this.dataForm.materialCost,
             totalPrice: this.dataForm.totalPrice,
-            quotedPriceProductFirstParamsList: this.productList.map(item => {
+            quotedPriceProductFirstParamsList: this.dataForm.quotedPriceProductList.map(item => {
               let temp = {
                 id: item.id,
                 priceId: this.id,
@@ -626,7 +651,7 @@ export default {
               return temp
             })
           }
-          console.log(param)
+
           this.$http({
             url: this.$http.adornUrl(`/biz-service/quoted/updateFirst`),
             method: 'post',
@@ -653,8 +678,12 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 .title {
   padding: 10px 0;
 }
+
+/deep/ .my_input > .el-input__inner{
+  text-align: center;
+}
 </style>

+ 3 - 3
src/views/modules/cus/quoted.vue

@@ -256,7 +256,7 @@
               v-if="isAuth('quoted:two')"
               type="text"
               size="small"
-              @click="showDetail"
+              @click="priceHandle(scope.row.priceId,'second')"
               >通知报价</el-button
             >
             <el-button
@@ -300,8 +300,8 @@
         layout="total, sizes, prev, pager, next, jumper">
       </el-pagination>
     </template>
-    <quoted-add-or-update ref="addOrUpdate" v-if="addOrUpdateVisible" @onChose="onChose" />
-    <quoted-price ref="price" v-if="priceVisible" @onChose="onChose"/>
+    <quoted-add-or-update ref="addOrUpdate" v-if="addOrUpdateVisible" @onChose="onChose" @refreshDataList="queryData"/>
+    <quoted-price ref="price" v-if="priceVisible" @onChose="onChose" @refreshDataList="queryData"/>
   </div>
 </template>