Преглед на файлове

孙一石 上架下架问题

sys5923812@126.com преди 5 часа
родител
ревизия
75b4114001
променени са 1 файла, в които са добавени 204 реда и са изтрити 126 реда
  1. 204 126
      src/views/data/partner/index.vue

+ 204 - 126
src/views/data/partner/index.vue

@@ -29,7 +29,7 @@
       <el-form-item label="合作方" prop="gamePlatformMapping">
         <el-select v-model="queryParams.partnerName" placeholder="请选择合作方" filterable clearable>
           <el-option v-for="dict in dict.type.notice_partner" :key="dict.value" :label="dict.label"
-                     :value="dict.value" />
+                     :value="dict.value"/>
         </el-select>
       </el-form-item>
       <!-- <el-form-item label="店铺名称" prop="shopId">
@@ -64,24 +64,24 @@
       </el-form-item>
       <el-form-item label="商品名称" prop="goodsName">
         <el-input v-model="queryParams.goodsName" style="width: 200px;" placeholder="请输入商品名称" clearable
-                  @keyup.enter.native="handleQuery" />
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="商品编号" prop="goodsId">
         <el-input v-model="queryParams.goodsId" style="width: 200px;" placeholder="请输入商品编号" clearable
-                  @keyup.enter.native="handleQuery" />
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="游戏账号" prop="gameAccount">
         <el-input v-model="queryParams.gameAccount" style="width: 200px;" placeholder="请输入游戏账号" clearable
-                  @keyup.enter.native="handleQuery" />
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
 
 
-
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
 
         <el-button style="margin-left: 20px;" icon="el-icon-refresh" size="mini"
-                   @click="resetQuery">重置</el-button>
+                   @click="resetQuery">重置
+        </el-button>
       </el-form-item>
     </el-form>
 
@@ -94,18 +94,22 @@
       </el-select>
       <span v-if="ceshi">
 				<text>通知上架</text>
-				<el-radio v-model="radio" label="500">500</el-radio>
-				<el-radio v-model="radio" label="1000">1000</el-radio>
-				<el-radio v-model="radio" label="2000">2000</el-radio>
-				<el-radio v-model="radio" label="3000">3000</el-radio>
-				<el-radio v-model="radio" label="5000">5000</el-radio>
-				<el-button @click="startUp()">开始</el-button>
+				<!--<el-radio v-model="radio" label="500">500</el-radio>-->
+				<!--<el-radio v-model="radio" label="1000">1000</el-radio>-->
+				<!--<el-radio v-model="radio" label="2000">2000</el-radio>-->
+				<!--<el-radio v-model="radio" label="3000">3000</el-radio>-->
+				<!--<el-radio v-model="radio" label="5000">5000</el-radio>-->
+				<!--<el-button @click="startUp()">开始</el-button>-->
+        <el-button @click="startUp()" v-show="!isBegin">开始</el-button>
 			</span>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+                @pagination="getList"/>
 
-    <el-table :data="tableData" :row-class-name="tableRowClassName" border style="width: 100%">
-
+    <el-table :data="tableData" :row-class-name="tableRowClassName" border style="width: 100%"
+              @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
       <el-table-column prop="gameName" label="游戏名称">
       </el-table-column>
       <el-table-column prop="goodsId" label="商品编号">
@@ -122,7 +126,7 @@
       </el-table-column>
       <el-table-column label="合作方" align="center" prop="partnerName">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.notice_partner" :value="scope.row.partnerName" />
+          <dict-tag :options="dict.type.notice_partner" :value="scope.row.partnerName"/>
         </template>
       </el-table-column>
       <el-table-column prop="publishStatus" label="上架状态">
@@ -179,7 +183,7 @@
       </el-table-column>
     </el-table>
     <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-                @pagination="getList" />
+                @pagination="getList"/>
     <!-- 修改状态信息 -->
     <el-dialog v-if="open" :title="title" :visible.sync="open" append-to-body width="1000px">
       <div style="padding: 10px;overflow: auto">
@@ -197,32 +201,32 @@
             </el-col>
             <el-col :span="12">
               <el-form-item label="游戏账号" prop="accountId">
-                <el-input v-model="form.accountId" placeholder="请输入游戏账号" />
+                <el-input v-model="form.accountId" placeholder="请输入游戏账号"/>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="身份证号" prop="idNo">
-                <el-input v-model="form.idNo" placeholder="请输入身份证号" />
+                <el-input v-model="form.idNo" placeholder="请输入身份证号"/>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="姓名" prop="name">
-                <el-input v-model="form.name" placeholder="请输入姓名" />
+                <el-input v-model="form.name" placeholder="请输入姓名"/>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="手机号" prop="mobile">
-                <el-input v-model="form.mobile" placeholder="请输入手机号" />
+                <el-input v-model="form.mobile" placeholder="请输入手机号"/>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="微信号" prop="wxNo">
-                <el-input v-model="form.wxNo" placeholder="请输入微信号" />
+                <el-input v-model="form.wxNo" placeholder="请输入微信号"/>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="备注" prop="remark">
-                <el-input v-model="form.remark" placeholder="请输入备注" />
+                <el-input v-model="form.remark" placeholder="请输入备注"/>
               </el-form-item>
             </el-col>
 
@@ -244,23 +248,25 @@
     listpartner,
     updatepartnerlist,
     getInitGoodsManager,
-    notice,
-  } from "@/api/data/partnerlist";
+    notice
+  } from '@/api/data/partnerlist'
   import {
     queryTBusShop,
     getTBusShopInfo
-  } from "@/api/data/goodsPayment";
+  } from '@/api/data/goodsPayment'
+
   export default {
     dicts: ['notice_partner'],
 
     data() {
       return {
+        isBegin : false,
         radio: '1000',
         disabled: true,
         block: false,
         gameList: [],
-        dsqType:'',
-        optionsStaus:[{
+        dsqType: '',
+        optionsStaus: [{
           value: 'S',
           label: '上架'
         }, {
@@ -310,10 +316,10 @@
         // 总条数
         total: 0,
         // 弹出层标题
-        title: "",
+        title: '',
         // 显示搜索条件
         showSearch: true,
-        ceshi:false,
+        ceshi: false,
         // 是否显示弹出层
         open: false,
         // 查询参数
@@ -336,7 +342,7 @@
           updateStatus: null,
           goodsName: null,
           gameName: null,
-          partnerName: null,
+          partnerName: null
         },
         queryForm: {
           publishStatus: null,
@@ -344,7 +350,7 @@
           updateStatus: null,
           goodsName: null,
           gameName: null,
-          partnerName: null,
+          partnerName: null
         },
         // 表单校验
         rules: {
@@ -377,49 +383,77 @@
             required: true,
             message: '请输入游戏账号',
             trigger: 'change'
-          }],
+          }]
 
         },
         currentIndex: 0,
-      };
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true
+      }
     },
     created() {
-      this.getList();
-      this.initGoodsManager();
+      this.getList()
+      this.initGoodsManager()
     },
     methods: {
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.id)
+        this.single = selection.length != 1
+        this.multiple = !selection.length
+      },
       startUp() {
-        if (this.currentIndex < this.tableData.length) {
-          const currentRes = this.tableData[this.currentIndex];
-          if(this.dsqType=="S"){
-            this.handleSave(currentRes);
-          }else if(this.dsqType=="G"){
-            this.handleUpdata(currentRes);
-          }else if(this.dsqType=="X"){
-            this.handleDelete(currentRes);
-          }
-
-          // 每次处理完一个元素后,更新索引并设置下一次处理的定时器
-          this.currentIndex++;
-          setTimeout(() => {
-            this.startUp();
-          }, Number(this.radio));
-        } else {
-          // 当数组所有元素都处理完后,重置索引,以便后续重新开始处理(如果需要)
-          this.currentIndex = 0;
-          this.startUp();
+        let that = this
+        this.isBegin = true
+        this.$modal.msgSuccess("开始处理数据,共选择:" + this.ids.length + "条数据!");
+        if (this.dsqType == 'S') {
+          this.handleSave(this.ids)
+        } else if (this.dsqType == 'G') {
+          this.handleUpdata(this.ids)
+        } else if (this.dsqType == 'X') {
+          this.handleDelete(this.ids)
         }
+        window.setInterval(function() {
+          this.isBegin = false
+          that.handleQuery()
+        }, 1000)
       },
+
+
+      // startUp() {
+      //   if (this.currentIndex < this.tableData.length) {
+      //     const currentRes = this.tableData[this.currentIndex]
+      //     if (this.dsqType == 'S') {
+      //       this.handleSave(currentRes)
+      //     } else if (this.dsqType == 'G') {
+      //       this.handleUpdata(currentRes)
+      //     } else if (this.dsqType == 'X') {
+      //       this.handleDelete(currentRes)
+      //     }
+      //
+      //     // 每次处理完一个元素后,更新索引并设置下一次处理的定时器
+      //     this.currentIndex++
+      //     setTimeout(() => {
+      //       this.startUp()
+      //     }, Number(this.radio))
+      //   } else {
+      //     // 当数组所有元素都处理完后,重置索引,以便后续重新开始处理(如果需要)
+      //     this.currentIndex = 0
+      //     this.startUp()
+      //   }
+      // },
       tableRowClassName({
                           row,
                           rowIndex
                         }) {
         if (rowIndex === 1 || Number.isInteger((rowIndex - 1) / 4)) {
-          return 'warning-row';
+          return 'warning-row'
         } else if (rowIndex === 3 || Number.isInteger((rowIndex - 3) / 4)) {
-          return 'success-row';
+          return 'success-row'
         }
-        return '';
+        return ''
       },
       // 游戏类型
       initGoodsManager() {
@@ -433,64 +467,64 @@
         getInitGoodsManager().then(res => {
           this.pictureServerPath = res.pictureServerPath
           this.gameList = res.gameList
-        });
+        })
         queryTBusShop().then(response => {
           response.data.forEach((item) => {
             this.deptOptions.push({
               label: item.name,
-              value: item.id,
-            });
-          });
-        });
-        return this.deptOptions;
+              value: item.id
+            })
+          })
+        })
+        return this.deptOptions
       },
 
       /** 查询黑号信息列表 */
       getList() {
-        this.loading = true;
+        this.loading = true
         listpartner(this.queryParams).then(response => {
           // console.log(response)
-          this.tableData = response.rows;
+          this.tableData = response.rows
           this.total = response.total
-          this.loading = false;
-        });
+          this.loading = false
+        })
       },
       //搜索按钮使用
       getList1() {
-        this.loading = true;
+        this.loading = true
         listpartner(this.queryParams).then(response => {
           // console.log(response)
-          this.disabled = false;
-          this.block = true;
-          this.tableData = response.rows;
+          this.disabled = false
+          this.block = true
+          this.tableData = response.rows
           this.total = response.total
-          this.loading = false;
-        });
+          this.loading = false
+        })
       },
 
       /** 搜索按钮操作 */
       handleQuery() {
-        this.disabled = true;
-        this.block = false;
-        this.queryParams.pageNum = 1;
-        this.getList();
+        this.disabled = true
+        this.block = false
+        this.queryParams.pageNum = 1
+        this.getList()
       },
       handleQuery1() {
-        this.queryParams.pageNum = 1;
-        this.getList();
+        this.queryParams.pageNum = 1
+        this.getList()
       },
       handleQuery2() {
-        this.disabled = true;
-        this.block = false;
-        this.queryParams.pageNum = 1;
-        this.getList1();
+        this.disabled = true
+        this.block = false
+        this.queryParams.pageNum = 1
+        this.getList1()
       },
       /** 重置按钮操作 */
       resetQuery() {
-        this.block = false;
-        this.disabled = true;
-        this.resetForm("queryForm");
-        this.handleQuery1();
+        this.block = false
+        this.disabled = true
+        this.resetForm('queryForm')
+        this.handleQuery1()
       },
       // 多选框选中数据
       handleSelectionChange(selection) {
@@ -499,85 +533,128 @@
         this.single = selection.length !== 1
         this.multiple = !selection.length
       },
-      handleSave(e) {
+      handleSave(ids) {
         let query = {
-          id: e.id,
-          noticeType: "S"
-        };
+          // id: e.id,
+          noticeType: 'S',
+          ids : ids
+        }
         notice(query).then(res => {
           if (res.code == 200) {
-            this.$modal.msgSuccess("已通知上架");
-            this.getList();
+            this.$modal.msgSuccess('已通知上架')
+            this.getList()
           } else {
             alert(res.msg)
           }
         })
       },
-      handleUpdata(e) {
+      handleUpdata(ids) {
         let query = {
-          id: e.id,
-          noticeType: "U"
-        };
+          // id: e.id,
+          noticeType: 'U',
+          ids : ids
+        }
         notice(query).then(res => {
           if (res.code == 200) {
-            this.$modal.msgSuccess("已通知更新");
-            this.getList();
+            this.$modal.msgSuccess('已通知更新')
+            this.getList()
           } else {
             alert(res.msg)
           }
         })
       },
-      handleDelete(e) {
+      handleDelete(ids) {
         let query = {
-          id: e.id,
-          noticeType: "D"
-        };
+          // id: e.id,
+          noticeType: 'D',
+          ids : ids
+        }
         notice(query).then(res => {
           if (res.code == 200) {
-            this.$modal.msgSuccess("已通知下架");
-            this.getList();
+            this.$modal.msgSuccess('已通知下架')
+            this.getList()
           } else {
             alert(res.msg)
           }
         })
       },
-
+      // handleSave(e) {
+      //   let query = {
+      //     id: e.id,
+      //     noticeType: 'S'
+      //   }
+      //   notice(query).then(res => {
+      //     if (res.code == 200) {
+      //       this.$modal.msgSuccess('已通知上架')
+      //       this.getList()
+      //     } else {
+      //       alert(res.msg)
+      //     }
+      //   })
+      // },
+      // handleUpdata(e) {
+      //   let query = {
+      //     id: e.id,
+      //     noticeType: 'U'
+      //   }
+      //   notice(query).then(res => {
+      //     if (res.code == 200) {
+      //       this.$modal.msgSuccess('已通知更新')
+      //       this.getList()
+      //     } else {
+      //       alert(res.msg)
+      //     }
+      //   })
+      // },
+      // handleDelete(e) {
+      //   let query = {
+      //     id: e.id,
+      //     noticeType: 'D'
+      //   }
+      //   notice(query).then(res => {
+      //     if (res.code == 200) {
+      //       this.$modal.msgSuccess('已通知下架')
+      //       this.getList()
+      //     } else {
+      //       alert(res.msg)
+      //     }
+      //   })
+      // },
 
       /** 修改按钮操作 */
       handleUpdate(row) {
-        this.open = true;
-        this.reset();
+        this.open = true
+        this.reset()
         const id = row.id || this.ids
         getpartnerlist(id).then(response => {
-          this.form = response.data;
-          this.open = true;
-          this.title = "修改黑号信息";
-        });
+          this.form = response.data
+          this.open = true
+          this.title = '修改黑号信息'
+        })
       },
       /** 提交按钮 */
       submitForm() {
-        this.$refs["form"].validate(valid => {
+        this.$refs['form'].validate(valid => {
           if (valid) {
             if (this.form.id != null) {
               updatepartnerlist(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.open = false;
-                this.getList();
-              });
+                this.$modal.msgSuccess('修改成功')
+                this.open = false
+                this.getList()
+              })
             } else {
               addpartnerlist(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.open = false;
-                this.getList();
-              });
+                this.$modal.msgSuccess('新增成功')
+                this.open = false
+                this.getList()
+              })
             }
           }
-        });
-      },
-
+        })
+      }
 
     }
-  };
+  }
 </script>
 <style>
   .el-table .warning-row {
@@ -587,7 +664,8 @@
   .el-table .success-row {
     background: #f0f9eb;
   }
-  .start{
+
+  .start {
     margin: 20px 0;
   }
 </style>