chenrui il y a 2 ans
Parent
commit
96c8d3c10d

+ 18 - 9
src/views/supplierManagement/costSetting/list.vue

@@ -93,12 +93,19 @@
               v-if="record.auditState=='WAIT'&&$hasPermissions('B_costSetAudit')"
               @click="handleAudit([record.supplierProductSn])"
             >审核</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-warning"
+              v-if="record.auditState=='WAIT'&&$hasPermissions('B_costSetting')"
+              @click="handleCostSet(record,editFlag = true)"
+            >编辑</a-button>
             <a-button
               size="small"
               type="link"
               class="button-warning"
               v-if="record.auditState!='WAIT'&&$hasPermissions('B_costSetting')"
-              @click="handleCostSet(record)"
+              @click="handleCostSet(record,false)"
             >设置成本</a-button>
           </div>
         </template>
@@ -108,7 +115,7 @@
     <!-- 新增 -->
     <addProductModal :openModal="newProduct" @close="newProduct=false" @ok="handleProductsOk" />
     <!-- 设置成本价 -->
-    <SettingCost ref="settingCost" :openModal="openSetModal" @ok="$refs.table.refresh()" @close="openSetModal=false"></SettingCost>
+    <SettingCost ref="settingCost" :edit="editFlag" :openModal="openSetModal" @ok="$refs.table.refresh()" @close="openSetModal=false"></SettingCost>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="handleGuideOk" />
   </a-card>
@@ -125,7 +132,7 @@ import ImportGuideModal from './importGuideModal.vue'
 import SettingCost from './settingCost.vue'
 import { supplierProductList, supplierProductExportDetail, supplierProductUpdateAuditState, supplierProductNewBatchInsert } from '@/api/supplier'
 export default {
-  name: 'costSettingList',
+  name: 'CostSettingList',
   mixins: [commonMixin],
   components: { STable, VSelect, ProductBrand, ProductType, addProductModal, SettingCost, ImportGuideModal },
   data () {
@@ -143,7 +150,7 @@ export default {
           productBrandSn: undefined, //  产品品牌
           productTypeSn1: '', //  产品一级分类
           productTypeSn2: '', //  产品二级分类
-          productTypeSn3: '' ,//  产品三级分类
+          productTypeSn3: '' //  产品三级分类
         },
         auditState: undefined
       },
@@ -169,7 +176,8 @@ export default {
       },
       rowSelectionInfo: null,
       newProduct: false,
-      openSetModal: false
+      openSetModal: false,
+      editFlag: false
     }
   },
   computed: {
@@ -243,7 +251,7 @@ export default {
     },
     // 批量导入
     handleBatchImport () {
-      this.openGuideModal=true
+      this.openGuideModal = true
     },
     // 批量审核
     handleBatchAudit () {
@@ -275,13 +283,13 @@ export default {
         }
       })
     },
-    auditOrder(sn,val){
+    auditOrder (sn, val) {
       this.spinning = true
       supplierProductUpdateAuditState({
         auditState: val,
         supplierProductSnList: sn
       }).then(res => {
-        if(res.status == 200){
+        if (res.status == 200) {
           this.$refs.table.refresh(true)
           this.$refs.table.clearSelected()
           this.$message.info(res.message)
@@ -290,8 +298,9 @@ export default {
       })
     },
     // 成本设置
-    handleCostSet (row) {
+    handleCostSet (row, flag) {
       this.openSetModal = true
+      this.editFlag = !!flag
       this.$refs.settingCost.setData(row)
     },
     pageInit () {

+ 8 - 4
src/views/supplierManagement/costSetting/settingCost.vue

@@ -67,6 +67,10 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    edit: {
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -96,7 +100,7 @@ export default {
     setData (row) {
       this.form.supplierSn = row.supplierSn
       this.form.supplierProductSn = row.supplierProductSn
-      this.form.modifyCost = ''
+      this.form.modifyCost = this.edit ? row.cost : ''
       this.cost = row.cost
       this.productName = row.product.name
       this.productCode = row.product.code
@@ -107,7 +111,7 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
-          if(params.modifyCost==0){
+          if (params.modifyCost == 0) {
             this.$message.warning('成本价不能是0!')
             return false
           }
@@ -132,8 +136,8 @@ export default {
       this.productName = ''
       this.productCode = ''
       this.form.modifyCost = ''
-      this.form.supplierSn= ''
-      this.form.supplierProductSn= ''
+      this.form.supplierSn = ''
+      this.form.supplierProductSn = ''
       this.$refs.ruleForm.resetFields()
     }
   },