Browse Source

Merge branch 'fine_music_score' into jenkins

lex 1 year ago
parent
commit
2bea34dafc
2 changed files with 71 additions and 7 deletions
  1. 15 4
      src/views/pms/product/index.vue
  2. 56 3
      src/views/pms/purchaseList/index.vue

+ 15 - 4
src/views/pms/product/index.vue

@@ -305,8 +305,8 @@
       >
         <el-table-column label="SKU编号" align="center">
           <template slot-scope="scope">
-            <!-- <el-input v-model="scope.row.skuCode"></el-input> -->
-            {{ scope.row.skuCode  }}
+            <el-input v-model="scope.row.skuCode"></el-input>
+            <!-- {{ scope.row.skuCode  }} -->
           </template>
         </el-table-column>
         <el-table-column
@@ -321,7 +321,9 @@
         </el-table-column>
         <el-table-column label="销售价格" align="center">
           <template slot-scope="scope">
-            <el-input v-model="scope.row.price"></el-input>
+            <!-- <el-input v-model="scope.row.price"></el-input> -->
+            <el-input-number :controls="false" class="number-input" v-model="scope.row.price" :min="0" :max="999999" :precision="2"
+            type="number"></el-input-number>
           </template>
         </el-table-column>
         <el-table-column label="内部库存" align="center">
@@ -336,7 +338,9 @@
         </el-table-column>
         <el-table-column label="库存预警值" width="100" align="center">
           <template slot-scope="scope">
-            <el-input v-model="scope.row.lowStock"></el-input>
+            <!-- <el-input v-model="scope.row.lowStock"></el-input> -->
+            <el-input-number :controls="false" class="number-input" v-model="scope.row.lowStock" :min="0" :max="999999" :precision="0"
+            type="number"></el-input-number>
           </template>
         </el-table-column>
       </el-table>
@@ -812,6 +816,13 @@ export default {
   width: 203px !important;
 }
 
+.number-input {
+  input {
+    text-align: left;
+  }
+
+  width: 100%;
+}
 .table-btn-group {
   .el-button {
     margin: 5px 3px;

+ 56 - 3
src/views/pms/purchaseList/index.vue

@@ -134,6 +134,11 @@
             <p>{{ scope.row.createTime }}</p>
           </template>
         </el-table-column>
+        <el-table-column label="操作" align="center">
+          <template slot-scope="scope">
+            <el-button type="text" @click="onUpdate(scope.row)" :disabled="scope.row.internalSaleStock != 0 ||scope.row.taxSaleStock != 0">修改</el-button>
+          </template>
+        </el-table-column>
       </el-table>
     </div>
     <div class="pagination-container">
@@ -150,7 +155,7 @@
       </el-pagination>
     </div>
     <el-dialog
-      title="新增入库"
+      :title="type == 'create' ? '新增入库' : '修改入库'"
       :visible.sync="dialogVisible"
       width="40%"
     >
@@ -189,7 +194,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleClose">取 消</el-button>
-        <el-button type="primary" @click="handleConfirm('productAttrCatForm')"
+        <el-button type="primary" :disabled="loading" v-loading="loading" @click="handleConfirm('productAttrCatForm')"
           >确 定</el-button
         >
       </span>
@@ -218,6 +223,7 @@ export default {
   name: "productList",
   data() {
     return {
+      type: 'create',
       dialogVisible: false,
       editSkuInfo: {
         productId: null,
@@ -234,6 +240,7 @@ export default {
         price: [{ required: true, message: '请输入采购价', trigger: 'blur' }],
         productSkuId: [{ required: true, message: '请选择Sku', trigger: 'change, blur' }],
       },
+      loading: false,
       stockList: [],
       productId: null,
       listQuery: Object.assign({}, defaultListQuery),
@@ -270,15 +277,18 @@ export default {
               ...this.editSkuInfo,
               productId: this.productId,
             }
+            this.loading = true
             getProductSkuStockRecordCreate(obj).then(response=>{
                 this.$message({
-                  message: '添加成功',
+                  message: this.type == 'create' ? '添加成功' : '修改成功',
                   type: 'success',
                   duration:1000
                 });
                 this.dialogVisible = false;
                 this.handleClose()
                 this.getList();
+              }).catch(() => {
+                this.loading = false
               });
           } else {
             console.log('error submit!!');
@@ -287,6 +297,7 @@ export default {
         });
       },
       handleClose(){
+        this.dialogVisible = false;
         if (!this.dialogVisible && this.$refs.productAttrCatForm) {
           this.$refs.productAttrCatForm.clearValidate()
         }
@@ -295,7 +306,48 @@ export default {
       this.listQuery.pageNum = 1;
       this.getList();
     },
+    onUpdate(row) {
+      this.type = 'update'
+      this.loading = false
+      this.editSkuInfo = {
+        productId: row.productId,
+        productSkuId: row.productSkuId,
+        selectProductSn: row.selectProductSn,
+        internalStock: row.internalStock,
+        taxStock: row.taxStock,
+        price: row.price
+      }
+       fetchSkuStockList(this.productId).then((response) => {
+        try {
+          // debugger
+        const tempResult = response.data || [];
+        tempResult.forEach((product) => {
+          const spData = product.spData ? JSON.parse(product.spData) : [{ key: '默认' }]
+          let spText  = ''
+          spData.forEach((sp) => {
+            spText += sp.key + (sp.value ? ':' + sp.value: '')
+          })
+          product.spText = spText
+        })
+
+        this.stockList = tempResult;
+        this.dialogVisible = true;
+        } catch(e) {
+          console.log(e)
+        }
+      });
+    },
     handleAddProduct() {
+      this.type = 'create'
+      this.loading = false
+      this.editSkuInfo = {
+        productId: null,
+        productSkuId: null,
+        selectProductSn: null,
+        internalStock: null,
+        taxStock: null,
+        price: null
+      }
       fetchSkuStockList(this.productId).then((response) => {
         try {
           // debugger
@@ -341,6 +393,7 @@ export default {
     handleResetSearch() {
       this.selectProductCateValue = [];
       this.listQuery = Object.assign({}, defaultListQuery);
+      this.handleSearchList()
     },
   },
 };