Browse Source

商品复制功能

yjwang 3 days ago
parent
commit
c0cbe7cd6c
2 changed files with 36 additions and 1 deletions
  1. 8 0
      src/api/hisStore/storeProduct.js
  2. 28 1
      src/views/hisStore/storeProduct/index.vue

+ 8 - 0
src/api/hisStore/storeProduct.js

@@ -146,3 +146,11 @@ export function getAuthInfo(productId) {
     method: 'get'
   })
 }
+
+export function copyProduct(data) {
+  return request({
+    url: '/store/store/storeProduct/copyProduct',
+    method: 'post',
+    data: data
+  })
+}

+ 28 - 1
src/views/hisStore/storeProduct/index.vue

@@ -428,6 +428,14 @@
             v-hasPermi="['store:storeProduct:remove']"
           >删除
           </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-document-copy"
+            @click="productCopy(scope.row)"
+            v-hasPermi="['his:storeProduct:copyProduct']"
+          >一键复制
+          </el-button>
 <!--          <el-button-->
 <!--            size="mini"-->
 <!--            type="text"-->
@@ -1187,7 +1195,7 @@ import {
   importTemplate,
   batchModify,
   sync580,
-  updateIsShow, exportDrugProduct,getAuthInfo
+  updateIsShow, exportDrugProduct,getAuthInfo,copyProduct
 } from "@/api/hisStore/storeProduct";
 import {getAllStoreProductCategory} from "@/api/hisStore/storeProductCategory";
 import {getAllStoreProductRule} from "@/api/hisStore/storeProductRule";
@@ -2388,6 +2396,25 @@ export default {
           done();
         })
         .catch(_ => {});
+    },
+    /**
+     * 复制商品
+     * **/
+    productCopy(row){
+      this.$confirm('确认是否复制当前《'+row.productName+'》商品!', '复制商品', {
+        confirmButtonText: '确 认',
+        cancelButtonText: '取 消',
+        type: 'warning'
+      }).then(() => {
+        copyProduct(row).then(response => {
+            if(response.code === 200){
+              this.$message.success("操作成功!")
+              this.getList();
+            }
+        })
+      }).catch(() => {
+
+      });
     }
   }
 };