YY 2 yıl önce
ebeveyn
işleme
4e7ebaf894
1 değiştirilmiş dosya ile 46 ekleme ve 10 silme
  1. 46 10
      src/views/platActivi/act/parts/goods.vue

+ 46 - 10
src/views/platActivi/act/parts/goods.vue

@@ -21,10 +21,10 @@
               <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
             </el-col>
             <el-col :span="24" class="four" v-if="type != '3'">
-              <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @set="toSet"> </data-table>
+              <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @set="toSet" @edit="toEdit"> </data-table>
             </el-col>
             <el-col :span="24" class="four" v-if="type == '3'">
-              <data-table :fields="spFields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @set="toSet"> </data-table>
+              <data-table :fields="spFields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @set="toSet" @edit="toEdit"> </data-table>
             </el-col>
           </el-col>
           <el-col :span="24" v-if="type == '4'">
@@ -33,13 +33,14 @@
                 <el-col :span="24" class="thr">
                   <el-button type="primary" size="mini" @click="toAdd('basic')">新增</el-button>
                 </el-col>
-                <data-table :fields="fields" :opera="operas" @query="search" :data="list" :total="total" @del="toDel"> </data-table>
+                <data-table :fields="fields" :opera="operas" @query="search" :data="list" :total="total" @del="toDel" @edit="toEdit"> </data-table>
               </el-tab-pane>
               <el-tab-pane label="加价商品">
                 <el-col :span="24" class="thr">
                   <el-button type="primary" size="mini" @click="toAdd('plus')">新增</el-button>
                 </el-col>
-                <data-table :fields="plusFields" :opera="opera" @query="search" :data="plusList" :total="plusTotal" @del="toDel" @set="toSet"> </data-table>
+                <data-table :fields="plusFields" :opera="opera" @query="search" :data="plusList" :total="plusTotal" @del="toDel" @set="toSet" @edit="toEdit">
+                </data-table>
               </el-tab-pane>
             </el-tabs>
           </el-col>
@@ -47,6 +48,20 @@
         <goodsEdit v-if="view === 'info'" :ids="ids" :type="type" @toBack="toBack1"></goodsEdit>
       </el-col>
     </el-row>
+    <e-dialog :dialog="dialog" @toClose="toClose">
+      <template v-slot:info>
+        <el-form :model="form" ref="form" label-width="auto">
+          <el-form-item label="状态">
+            <el-select v-model="form.status" placeholder="请选择">
+              <el-option v-for="i in statusList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </el-select>
+          </el-form-item>
+          <el-col :span="24" class="btn">
+            <el-button type="primary" size="mini" @click="Submit()">提交</el-button>
+          </el-col>
+        </el-form>
+      </template>
+    </e-dialog>
   </div>
 </template>
 
@@ -70,6 +85,7 @@ export default {
       // 列表
       opera: [
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
+        { label: '修改状态', method: 'edit' },
         { label: '活动设置', method: 'set', display: (i) => i.platform_act_type != '5' && i.platform_act_type != '6' },
       ],
       operas: [{ label: '删除', method: 'del', confirm: true, type: 'danger' }],
@@ -104,6 +120,9 @@ export default {
       // 状态
       statusList: [],
       ids: '',
+      // 弹框
+      dialog: { title: '信息管理', show: false, type: '1' },
+      form: {},
     };
   },
   async created() {
@@ -137,12 +156,31 @@ export default {
       this.$set(this, `ids`, data._id);
       this.$set(this, `view`, 'info');
     },
+    toEdit({ data }) {
+      this.$set(this, `form`, data);
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    async Submit() {
+      let data = this.form;
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `修改成功` });
+        this.toClose();
+      }
+    },
+    // 关闭
+    toClose() {
+      this.searchForm = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+      this.search();
+    },
     // 新增
     toAdd(data) {
       let query = { id: this.id, type: this.type };
       if (this.type == '4') query.goods_type = data;
       this.$router.push({ path: './goods/goodsDetail', query: query });
     },
+
     // 删除
     async toDel({ data }) {
       let res = await this.delete(data._id);
@@ -151,15 +189,10 @@ export default {
         this.search();
       }
     },
-    // 重置
-    toClose() {
-      this.searchForm = {};
-      this.search();
-    },
     // 查询其他信息
     async searchOther() {
       let res;
-      // 审核状态
+      // 参加平台活动的商品状态
       res = await this.dictQuery({ code: 'platformAct_goods_status' });
       if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
     },
@@ -220,4 +253,7 @@ export default {
 .el-col {
   margin: 10px 0;
 }
+.btn {
+  text-align: center;
+}
 </style>