瀏覽代碼

报价管理

yuanchengman 2 年之前
父節點
當前提交
2cbbaca04d
共有 2 個文件被更改,包括 356 次插入99 次删除
  1. 355 98
      src/views/modules/cus/quoted-price.vue
  2. 1 1
      src/views/modules/cus/quoted.vue

+ 355 - 98
src/views/modules/cus/quoted-price.vue

@@ -95,7 +95,11 @@
       <div>
         <div class="title">BOM物料明细报价</div>
         <el-row>
-          <el-table :data="dataForm.quotedPriceProductList" border style="width: 100%">
+          <el-table
+            :data="dataForm.quotedPriceProductList"
+            border
+            style="width: 100%"
+          >
             <el-table-column
               label="序号"
               type="index"
@@ -184,9 +188,9 @@
             >
             </el-table-column>
             <!-- 初次报价 -->
-            <div v-if="type === 'first'">
+            <div v-if="type === 'first' || type === 'second'">
               <el-table-column
-                prop="notes"
+                prop=""
                 header-align="center"
                 align="center"
                 min-width="160px"
@@ -194,11 +198,19 @@
                 label="原材料费"
               >
                 <template slot-scope="scope">
-                  <el-input-number size="mini" :precision=2 :controls=false placeholder="请输入" v-model="scope.row.materialPrice" @change="inputNumChangeHandle"></el-input-number>
+                  <el-input-number
+                    :disabled="type === 'second'"
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.materialPrice"
+                    @change="inputNumChangeHandle"
+                  ></el-input-number>
                 </template>
               </el-table-column>
               <el-table-column
-                prop="notes"
+                prop=""
                 header-align="center"
                 align="center"
                 min-width="160px"
@@ -206,11 +218,19 @@
                 label="生产加工费"
               >
                 <template slot-scope="scope">
-                  <el-input-number size="mini" :precision=2 :controls=false placeholder="请输入" v-model="scope.row.processPrice" @change="inputNumChangeHandle"></el-input-number>
+                  <el-input-number
+                    :disabled="type === 'second'"
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.processPrice"
+                    @change="inputNumChangeHandle"
+                  ></el-input-number>
                 </template>
               </el-table-column>
               <el-table-column
-                prop="notes"
+                prop=""
                 header-align="center"
                 align="center"
                 min-width="160px"
@@ -218,48 +238,202 @@
                 label="热表处理费"
               >
                 <template slot-scope="scope">
-                  <el-input-number size="mini" :precision=2 :controls=false placeholder="请输入" v-model="scope.row.handlePrice" @change="inputNumChangeHandle"></el-input-number>
+                  <el-input-number
+                    :disabled="type === 'second'"
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.handlePrice"
+                    @change="inputNumChangeHandle"
+                  ></el-input-number>
+                </template>
+              </el-table-column>
+            </div>
+            <!-- 精准报价 -->
+            <div v-if="type === 'second'">
+              <el-table-column
+                prop=""
+                header-align="center"
+                align="center"
+                min-width="160px"
+                fixed="right"
+                label="精准原材料费"
+              >
+                <template slot-scope="scope">
+                  <el-input-number
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.precisionMaterialPrice"
+                    @change="inputNumChangeHandleSecond"
+                  ></el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop=""
+                header-align="center"
+                align="center"
+                min-width="160px"
+                fixed="right"
+                label="精准生产加工费"
+              >
+                <template slot-scope="scope">
+                  <el-input-number
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.precisionProcessPrice"
+                    @change="inputNumChangeHandleSecond"
+                  ></el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop=""
+                header-align="center"
+                align="center"
+                min-width="160px"
+                fixed="right"
+                label="精准热表处理费"
+              >
+                <template slot-scope="scope">
+                  <el-input-number
+                    size="mini"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    v-model="scope.row.precisionHandlePrice"
+                    @change="inputNumChangeHandleSecond"
+                  ></el-input-number>
                 </template>
               </el-table-column>
             </div>
           </el-table>
         </el-row>
-        <div v-if="type === 'first'" style="margin: 25px 0 0 0">
-          <el-row>
-            <el-col :span="8" :offset="16">
-              <el-form-item label="小计">
-                <el-input-number v-model="dataForm.materialCost" disabled :precision=2 :controls=false></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.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" @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-number  v-model="dataForm.ratePrice" @change="inputNumChangeHandle" :precision=0 :controls=false></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.totalPrice" disabled :precision=2 :controls=false></el-input-number>
-              </el-form-item>
-            </el-col>
-          </el-row>
+
+        <div v-if="type === 'first' || type === 'second'">
+          <div class="title">初次报价</div>
+          <div class="template_price">
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="模具费" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.mouldPrice"
+                    @change="inputNumChangeHandle"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                    :disabled="type === 'second'"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="管理费(%)" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.managePrice"
+                    @change="inputNumChangeHandle"
+                    :precision="0"
+                    :controls="false"
+                    placeholder="请输入"
+                    :disabled="type === 'second'"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="税率(%)" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.ratePrice"
+                    @change="inputNumChangeHandle"
+                    :precision="0"
+                    :controls="false"
+                    :disabled="type === 'second'"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="小计" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.materialCost"
+                    disabled
+                    :precision="2"
+                    :controls="false"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6" :offset="18">
+                <el-form-item label="合计" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.totalPrice"
+                    disabled
+                    :precision="2"
+                    :controls="false"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
+        </div>
+
+        <div v-if="type === 'second'">
+          <div class="title">精准报价</div>
+          <div class="template_price">
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="模具费" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.precisionMouldPrice"
+                    @change="inputNumChangeHandleSecond"
+                    :precision="2"
+                    :controls="false"
+                    placeholder="请输入"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="管理费(%)" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.precisionManagePrice"
+                    @change="inputNumChangeHandleSecond"
+                    :precision="0"
+                    :controls="false"
+                    placeholder="请输入"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="税率(%)" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.precisionRatePrice"
+                    @change="inputNumChangeHandleSecond"
+                    :precision="0"
+                    :controls="false"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="小计" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.materialCostSecond"
+                    disabled
+                    :precision="2"
+                    :controls="false"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6" :offset="18">
+                <el-form-item label="合计" label-width="100px">
+                  <el-input-number
+                    v-model="dataForm.totalPriceSecond"
+                    disabled
+                    :precision="2"
+                    :controls="false"
+                  ></el-input-number>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
         </div>
       </div>
       <div>
@@ -364,39 +538,8 @@
               label="备注"
             >
             </el-table-column>
-            <el-table-column
-              fixed="right"
-              header-align="center"
-              align="center"
-              width="100"
-              label="操作"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  type="text"
-                  size="small"
-                  @click="updateWorderHandle(scope.row)"
-                  >编辑</el-button
-                >
-                <el-button
-                  style="color: red"
-                  type="text"
-                  size="small"
-                  @click="removeWorkInfoItem(scope.$index)"
-                  >删除</el-button
-                >
-              </template>
-            </el-table-column>
           </el-table>
         </el-row>
-        <el-row style="text-align: center; margin-top: 10px">
-          <el-button
-            type="primary"
-            icon="el-icon-plus"
-            @click="inBound"
-            disabled
-          ></el-button>
-        </el-row>
       </div>
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -443,6 +586,9 @@ export default {
       productSearchLoading: false,
       dataForm: {
         materialCost: 0,
+        materialCostSecond: 0,
+        totalPrice: 0,
+        totalPriceSecond: 0,
         quotedPriceProductList: [], // 报价物料清单
         workInfoList: []
       },
@@ -468,9 +614,7 @@ export default {
   },
   watch: {},
   computed: {},
-  created () {
-
-  },
+  created () {},
   mounted () {},
   activated () {},
   methods: {
@@ -498,13 +642,19 @@ export default {
     getDetail (priceId) {
       getDetail(priceId).then(({ data }) => {
         if (data && data.code === '200') {
-          this.dataForm = data.data
+          this.dataForm = {...data.data}
           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.precisionManagePrice) {
+            this.dataForm.precisionManagePrice = this.dataForm.precisionManagePrice * 100
+          }
+          if (this.dataForm.precisionRatePrice) {
+            this.dataForm.precisionRatePrice = this.dataForm.precisionRatePrice * 100
+          }
           if (this.dataForm.productId) {
             this.productIdChangeHandle(this.dataForm.productId)
           }
@@ -546,16 +696,23 @@ export default {
         getProductAllDetail(val).then(({ data }) => {
           if (data && data.code === '200') {
             this.productList = data.data
-            if (this.dataForm.quotedPriceProductList == null || this.dataForm.quotedPriceProductList.length === 0) {
+            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)
+              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
@@ -573,6 +730,7 @@ export default {
 
             // 触发自动计算
             this.inputNumChangeHandle()
+            this.inputNumChangeHandleSecond()
           }
         })
       } else {
@@ -614,17 +772,62 @@ export default {
     inputNumChangeHandle (currentValue, oldValue) {
       // 计算报价小计
       let tempMaterialCost = 0
-      this.dataForm.quotedPriceProductList.forEach(item => {
-        tempMaterialCost += item.handlePrice + item.materialPrice + item.processPrice
+      this.dataForm.quotedPriceProductList.forEach((item) => {
+        if (item.handlePrice) {
+          tempMaterialCost += item.handlePrice
+        }
+        if (item.materialPrice) {
+          tempMaterialCost += item.materialPrice
+        }
+        if (item.processPrice) {
+          tempMaterialCost += item.processPrice
+        }
       })
       this.dataForm.materialCost = tempMaterialCost
 
       // 计算总价
-      this.dataForm.totalPrice = (tempMaterialCost + this.dataForm.mouldPrice) * (1 + this.dataForm.managePrice / 100) * (1 + this.dataForm.ratePrice / 100)
+      this.dataForm.totalPrice =
+        (tempMaterialCost + this.dataForm.mouldPrice) *
+        (1 + this.dataForm.managePrice / 100) *
+        (1 + this.dataForm.ratePrice / 100)
+    },
+    inputNumChangeHandleSecond (currentValue, oldValue) {
+      // 计算报价小计
+      let tempMaterialCost = 0
+      this.dataForm.quotedPriceProductList.forEach((item) => {
+        if (item.precisionHandlePrice) {
+          tempMaterialCost += item.precisionHandlePrice
+        }
+        if (item.precisionMaterialPrice) {
+          tempMaterialCost += item.precisionMaterialPrice
+        }
+        if (item.precisionProcessPrice) {
+          tempMaterialCost += item.precisionProcessPrice
+        }
+      })
+      this.dataForm.materialCostSecond = tempMaterialCost
+
+      // 计算总价
+      if (!this.dataForm.precisionMouldPrice) {
+        this.dataForm.precisionMouldPrice = 0
+      }
+      if (!this.dataForm.precisionManagePrice) {
+        this.dataForm.precisionManagePrice = 0
+      }
+      if (!this.dataForm.precisionRatePrice) {
+        this.dataForm.precisionRatePrice = 0
+      }
+
+      this.dataForm.totalPriceSecond =
+        (tempMaterialCost + this.dataForm.precisionMouldPrice) *
+        (1 + this.dataForm.precisionManagePrice / 100) *
+        (1 + this.dataForm.precisionRatePrice / 100)
     },
     dataFormSubmit () {
       if (this.type === 'first') {
         this.first()
+      } else if (this.type === 'second') {
+        this.second()
       }
     },
     // 初次报价
@@ -639,17 +842,18 @@ export default {
             ratePrice: this.dataForm.ratePrice / 100,
             materialCost: this.dataForm.materialCost,
             totalPrice: this.dataForm.totalPrice,
-            quotedPriceProductFirstParamsList: this.dataForm.quotedPriceProductList.map(item => {
-              let temp = {
-                id: item.id,
-                priceId: this.id,
-                productId: item.productId,
-                materialPrice: item.materialPrice,
-                processPrice: item.processPrice,
-                handlePrice: item.handlePrice
-              }
-              return temp
-            })
+            quotedPriceProductFirstParamsList:
+              this.dataForm.quotedPriceProductList.map((item) => {
+                let temp = {
+                  id: item.id,
+                  priceId: this.id,
+                  productId: item.productId,
+                  materialPrice: item.materialPrice,
+                  processPrice: item.processPrice,
+                  handlePrice: item.handlePrice
+                }
+                return temp
+              })
           }
 
           this.$http({
@@ -673,6 +877,54 @@ export default {
           })
         }
       })
+    },
+    // 精准报价
+    second () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          let param = {
+            priceId: this.dataForm.priceId,
+            remark: this.dataForm.remark,
+            managePrice: this.dataForm.precisionManagePrice / 100,
+            mouldPrice: this.dataForm.precisionMouldPrice,
+            ratePrice: this.dataForm.precisionRatePrice / 100,
+            materialCost: this.dataForm.materialCostSecond,
+            totalPrice: this.dataForm.totalPriceSecond,
+            quotedPriceProductFirstParamsList:
+              this.dataForm.quotedPriceProductList.map((item) => {
+                let temp = {
+                  id: item.id,
+                  priceId: this.id,
+                  productId: item.productId,
+                  materialPrice: item.precisionMaterialPrice,
+                  processPrice: item.precisionProcessPrice,
+                  handlePrice: item.precisionHandlePrice
+                }
+                return temp
+              })
+          }
+
+          this.$http({
+            url: this.$http.adornUrl(`/biz-service/quoted/updateTwo`),
+            method: 'post',
+            data: this.$http.adornData({ ...param, orgId: this.orgId })
+          }).then(({ data }) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.onChose()
+                  this.$emit('refreshDataList')
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }
+      })
     }
   }
 }
@@ -683,7 +935,12 @@ export default {
   padding: 10px 0;
 }
 
-/deep/ .my_input > .el-input__inner{
+/deep/ .my_input > .el-input__inner {
   text-align: center;
 }
+
+.template_price {
+  padding: 10px 0 0 0;
+  border: 1px solid #ebeef5;
+}
 </style>

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

@@ -249,7 +249,7 @@
               v-if="isAuth('quoted:two')"
               type="text"
               size="small"
-              @click="showDetail"
+              @click="priceHandle(scope.row.priceId,'second')"
               >精准报价</el-button
             >
             <el-button