DESKTOP-O04BTUJ\muzen пре 3 година
родитељ
комит
4a43677e50
1 измењених фајлова са 32 додато и 21 уклоњено
  1. 32 21
      src/views/service/qqmusic/index.vue

+ 32 - 21
src/views/service/qqmusic/index.vue

@@ -58,12 +58,13 @@
       <el-form v-if="title === '批量推送短信'">
         <el-form-item label="服务时长:" label-width="100px" style="width: 300px">
           <el-select v-model="dialogForm.serviceTime" placeholder="请选择服务时长">
-            <el-option v-for="item in dict.type.serve_time_list" :key="item.value" :label="item.label"
+            <el-option v-for="item in timeOptions" :key="item.value" :label="item.label"
               :value="item.value" />
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-table :data="dialogData" ref="dialogData" @selection-change="selectionChange" height="497">
+          <el-table :data="dialogData" ref="dialogData" :row-key="rowKey" @selection-change="selectionChange"
+            height="497">
             <el-table-column type="selection" align="center" />
             <el-table-column label="购买套餐" prop="name" align="center" />
             <el-table-column label="收货地址" prop="receiveAddress" align="center" />
@@ -145,7 +146,9 @@ export default {
       // 弹窗详情
       dialogDetail: {},
       // 发送表单
-      dialogForm: {},
+      dialogForm: {
+        serviceTime: ''
+      },
       // 批次分页
       batchForm: {
         pageNum: 1,
@@ -236,18 +239,22 @@ export default {
 
     // 批量推送短信
     getUpload(e) {
-      if (e.file !== '') {
-        this.dialogVisible = true
-        this.title = '批量推送短信'
-        importData({
-          batchId: e.file
-        }).then(res => {
-          if (res.code === 0) {
-            this.dialogData = res.data
+      importData({
+        batchId: e.file
+      }).then(res => {
+        if (res.code === 0) {
+          this.dialogVisible = true
+          this.title = '批量推送短信'
+          this.dialogData = res.data
+          this.$nextTick(() => {
             this.$refs.dialogData.toggleAllSelection()
-          }
-        })
-      }
+          })
+        }
+      })
+    },
+
+    rowKey(row) {
+      return row.id
     },
 
     // 多选 
@@ -289,13 +296,17 @@ export default {
 
     // 发送
     getSend() {
-      send(this.dialogForm).then(res => {
-        if (res.code === 0) {
-          this.$message.success('发送成功!')
-          this.dialogVisible = false
-          this.getList()
-        }
-      })
+      if (this.dialogForm.serviceTime !== '') {
+        send(this.dialogForm).then(res => {
+          if (res.code === 0) {
+            this.$message.success('发送成功!')
+            this.dialogVisible = false
+            this.getList()
+          }
+        })
+      } else {
+        this.$message.error('请选择服务时长!')
+      }
     },
 
     // 强制过期