wansfa 1 年之前
父节点
当前提交
351564e1cd
共有 2 个文件被更改,包括 96 次插入9 次删除
  1. 10 0
      src/api/store/storeProductPackage.js
  2. 86 9
      src/views/store/storeProductPackage/index.vue

+ 10 - 0
src/api/store/storeProductPackage.js

@@ -50,4 +50,14 @@ export function exportStoreProductPackage(query) {
     method: 'get',
     params: query
   })
+}
+
+
+// 批量修改商品组合套餐
+export function modifyStoreProductPackages(data) {
+  return request({
+    url: '/store/storeProductPackage/modifyMore',
+    method: 'post',
+    data: data
+  })
 }

+ 86 - 9
src/views/store/storeProductPackage/index.vue

@@ -50,8 +50,8 @@
           type="success"
           icon="el-icon-edit"
           size="mini"
-          :disabled="single"
-          @click="handleUpdate"
+          :disabled="multiple"
+          @click="handleUpdateMore"
           v-hasPermi="['store:storeProductPackage:edit']"
         >修改</el-button>
       </el-col>
@@ -65,6 +65,17 @@
           v-hasPermi="['store:storeProductPackage:remove']"
         >删除</el-button>
       </el-col>
+
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['store:storeProductPackage:export']"
+        >导出</el-button>
+      </el-col>
+
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -76,8 +87,7 @@
           <el-popover
             placement="right"
             title=""
-            trigger="hover"
-          >
+            trigger="hover">
             <img slot="reference" :src="scope.row.imgUrl" width="100">
             <img :src="scope.row.imgUrl" style="max-width: 150px;">
           </el-popover>
@@ -118,6 +128,7 @@
               <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
           </template>
       </el-table-column>
+
       <el-table-column label="操作" align="center" fixed="right" width="120px" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -137,6 +148,7 @@
         </template>
       </el-table-column>
     </el-table>
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -144,6 +156,22 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+
+    <el-dialog :title="title" :visible.sync="open1" width="580px" append-to-body>
+       <el-form ref="form1" :model="form1" :rules="rules" label-width="80px">
+         <el-form-item label="状态" prop="status">
+              <el-radio-group v-model="form1.status">
+                <el-radio :label="item.dictValue" v-for="item in statusOptions" >{{item.dictLabel}}</el-radio>
+              </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitForm1">确 定</el-button>
+          <el-button @click="cancel1">取 消</el-button>
+        </div>
+    </el-dialog>
+
+
     <!-- 添加或修改商品组合套餐对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
@@ -172,6 +200,7 @@
         <el-form-item label="套餐详情" prop="content">
           <Editor ref="myeditor"   :min-height="192" @on-text-change="updateText" />
         </el-form-item>
+
         <el-form-item label="套餐商品" prop="productList"  >
               <el-row  >
                 <el-col >
@@ -234,6 +263,7 @@
                 </el-col>
               </el-row>
         </el-form-item>
+        
         <el-form-item label="原价" prop="money">
           <el-input-number v-model="form.money" :precision="2"  :min="0.00" placeholder="请输入原价" />
         </el-form-item>
@@ -255,13 +285,14 @@
               <el-radio-group v-model="form.status">
                 <el-radio :label="item.dictValue" v-for="item in statusOptions" >{{item.dictLabel}}</el-radio>
               </el-radio-group>
-            </el-form-item>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
     <el-dialog :title="product.title" v-if="product.open"  :visible.sync="product.open" width="1000px" append-to-body>
         <product-attr-value-select  ref="product"  @selectProduct="selectProduct" />
     </el-dialog>
@@ -269,7 +300,7 @@
 </template>
 
 <script>
-import { listStoreProductPackage, getStoreProductPackage, delStoreProductPackage, addStoreProductPackage, updateStoreProductPackage, exportStoreProductPackage } from "@/api/store/storeProductPackage";
+import { listStoreProductPackage, getStoreProductPackage, delStoreProductPackage, addStoreProductPackage, updateStoreProductPackage, exportStoreProductPackage,modifyStoreProductPackages } from "@/api/store/storeProductPackage";
 import Editor from '@/components/Editor/wang';
 import productAttrValueSelect from "../components/productAttrValueSelect";
 import Material from '@/components/Material'
@@ -321,6 +352,8 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      // 是否显示批量修改弹出层
+      open1: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -338,6 +371,8 @@ export default {
       },
       // 表单参数
       form: {},
+       // 表单参数
+      form1: {},
       // 表单校验
       rules: {
         title: [
@@ -445,7 +480,6 @@ export default {
       this.loading = true;
       listStoreProductPackage(this.queryParams).then(response => {
         this.storeProductPackageList = response.rows;
-    
         this.total = response.total;
         this.loading = false;
       });
@@ -556,7 +590,7 @@ export default {
               if (response.code === 200) {
                 this.msgSuccess("修改成功");
                 this.open = false;
-                this.getList();
+                this.getList(); 
               }
             });
           } else {
@@ -597,7 +631,50 @@ export default {
         }).then(response => {
           this.download(response.msg);
         }).catch(function() {});
-    }
+    },
+    handleUpdateMore(row){
+        this.title = "批量修改套餐状态";
+        const packageIds = row.packageId || this.ids;
+        this.form1.packageIds=packageIds;
+        this.open1 = true;
+    },
+      // 取消按钮
+    cancel1() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset1() {
+      this.form1 = {
+        status:"1",
+        packageIds:[],
+      };
+      this.resetForm("form1");
+    },
+       /** 提交按钮 */
+    submitForm1() {
+
+       if(this.form1.status==null){
+          this.msgError("请选择套餐状态");
+          return;
+       }
+      this.$refs["form1"].validate(valid => {
+        if (valid) {
+            if (this.form1.packageIds != null) {
+                modifyStoreProductPackages(this.form1).then(response => {
+                    if (response.code === 200) {
+                      this.msgSuccess("操作成功");
+                      this.open1 = false;
+                      this.getList();
+                    }
+                });
+           } 
+         }
+      });
+
+    },
+
+
   }
 };