Browse Source

添加复制商品

lex 11 months ago
parent
commit
2288dfe697

+ 11 - 0
src/views/businessManager/shopManager/api.js

@@ -0,0 +1,11 @@
+import request2 from "@/utils/request2";
+let api = "/api-web";
+
+// 复制
+export function api_goodsCopyGoods(data) {
+  return request2({
+    url: api + "/goods/copyGoods",
+    method: "post",
+    data
+  });
+}

+ 15 - 4
src/views/businessManager/shopManager/shopList.vue

@@ -457,12 +457,12 @@
                 >查看</el-button
               >
 
-              <!-- <el-button
-                v-if="permission('/shopOperation/copyShop')"
+              <el-button
+                v-if="permission('goods/copyGoods')"
                 @click="onShopOperation('copy', scope.row)"
                 type="text"
                 >复制</el-button
-              > -->
+              >
               <!-- <el-button v-if="scope.row.status == 0"
                          v-permission="'goods/del'"
                          @click="onDelete(scope.row)"
@@ -808,7 +808,18 @@ export default {
     handleError(err, file, fileList) {
       load.endLoading();
     },
-    onShopOperation(type, row) {
+    async onShopOperation(type, row) {
+      if (type === "copy") {
+        // api-web/goods/copyGoods?goodsId=106
+        try {
+          await api_goodsCopyGoods({
+            goodsId: row.id
+          });
+
+          this.getList();
+        } catch {}
+        return;
+      }
       //修改
       this.addType = type;
       this.addDisabled = type == "look" ? true : false;