hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<template>
  <div class="finance-del">
    <v-header
      title="预约处理"
    ></v-header>
 
    <el-form :inline="true"  class="demo-form-inline">
      <el-form-item label="关键字"  >
        <el-input style="width:400px" size="small" v-model="bar.keyWord" placeholder="请输入预约登记主题、预约人、用户昵称进行关键词查找"></el-input>
      </el-form-item>
      <el-form-item label="状态">
        <el-checkbox-group v-model="bar.status">
          <el-checkbox-button v-for="type in statusList" :label="type.value" :key="type.value">{{type.label}}</el-checkbox-button>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="预约主题">
        <el-select v-model="bar.reserveId" placeholder="请选择">
          <el-option
            v-for="item in themeList"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <div class="block">
          <span class="demonstration">预约时间</span>
          <el-date-picker
            v-model="bar.time"
            type="daterange"
            range-separator="至"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" @click="onSearch">查询</el-button>
        <el-button @click="Reset" size="small">重置</el-button>
      </el-form-item>
    </el-form>
 
    <div class="add">
      <button class="m_btn bgc_primary" @click="exports()">导出</button>
      <button class="m_btn bgc_primary" @click="gohandle()">批量处理</button>
      <button class="m_btn bgc_primary" plain @click="cancelY()">取消预约</button>
    </div>
 
    <div
      class="Tips"
      v-show="Change"
    >
      <i
        style="color: #409EFF"
        class="el-icon-info"
      ></i>
      <div class="Tips-cont">已选择<span>{{ids.length}}</span>项</div>
      <el-button
        type="text"
        @click="cancel"
      >取消</el-button>
    </div>
 
    <div class="tab">
      <v-tool-table
        :trs="trs"
        :tds="tds"
        first
        firstWidth="50px"
      >
        <template v-slot:first-th>
          <div>
            <el-checkbox @change="cheAll" v-model="alls"></el-checkbox>
          </div>
        </template>
        <template v-slot:first-td="item">
          <div>
            <el-checkbox @change="change" v-model="item.scope.che"></el-checkbox>
          </div>
        </template>
        <template v-slot:data="{scope}">
          {{scope.reserveTime.substring(0,10)}}
        </template>
        <template v-slot:status="{scope}">
          <div class="table_flex">
            <span v-if="scope.status == '1'">待处理</span>
            <span v-if="scope.status == '2'">预约成功</span>
            <span v-if="scope.status == '3'">预约失败</span>
            <span v-if="scope.status == '4'">已取消</span>
          </div>
        </template>
        <template v-slot:btn="{scope}">
          <div class="table_flex">
            <!-- <span @click="exports(scope.id)">导出</span> -->
            <span @click="seeDetails(scope.id)">查看</span>
            <!-- <span v-if="scope.status == '1'" @click="gohandle(scope.id)">去处理</span> -->
            <span v-if="scope.status == '2'" @click="cancelY(scope.id)">取消预约</span>
          </div>
        </template>
      </v-tool-table>
    </div>
    <!-- 分页 -->
    <div class="page">
      <el-pagination
        :current-page="paginationParams.currentPage"
        :page-size="paginationParams.pageSize"
        :page-sizes="[5, 10, 20, 50, 100]"
        background
        layout="total,prev,pager,next,sizes,jumper"
        :total="paginationParams.total"
        @size-change="onPageSizeChange"
        @current-change="onPaginationChange">
      </el-pagination>
    </div>
        <!-- 新增弹窗 -->
    <handleModel v-model="isShow" @change="isShow = false" :checkIds="ids" @success="onEditSuccess" />
  </div>
</template>
<script>
import handleModel from "./components/handleModel.vue"
export default {
  props: [],
  components: {handleModel},
  data() {
    return {
      bar: {
        keyWord:'',
        status:[],
        time:'',
        reserveId:''
      },
      os: {},
      themeList:[],
      statusList:[
         {
          label:"待处理",
          value:1,
        },
         {
          label:"预约成功",
          value:2,
        },
        {
          label:"预约失败",
          value:3,
        },
         {
          label:"已取消",
          value:4
        },
      ],
      trs: [
        { text: "序号", val: "index" },
        { text: "用户昵称", val: "nickName" },
        { text: "预约主题", val: "title"},
        { text: "预约人", val: "name" },
        { text: "联系电话", val: "phone" ,width:"100px"},
        { text: "预约日期", val: "btn" ,slot:"data"},
        { text: "预约时间", val: "reserveTime" },
        { text: "预约内容", val: "content" },
        { text: "处理人", val: "remark" }, 
        { text: "社区备注", val: "actRemark" },
        { text: "提交时间", val: "createAt"  },
        { text: "状态", val: "btn" ,slot:"status"  },
        { text: "操作", val: "btn",slot:"btn" },
      ],
      tds: [],
      /** 分页参数 */
      paginationParams: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      search: {},
      Overview:{},
      Change:false,
      ids:[], //选中的id集合
      alls: false, //全选状态
      isShow:false,
    };
  },
 
  mounted() {
    this.theme();
    this.init();
  },
 
  methods: {
    /** pageSize 改变时会触发 */
    onPageSizeChange (pageSize) {
      this.paginationParams.pageSize = pageSize;
      this.init();
    },
    /** 分页 */
    onPaginationChange (page) {
      this.paginationParams.currentPage = page;
      this.init();
    },
 
    seeDetails(id) {
      this.$router.push("/act_appointviewDetails/" + id);
    },
 
    onEditSuccess() {
      this.init();
    },
 
    onSearch(v) {
      this.paginationParams.currentPage = 1;
      this.init();
    },
 
    Reset() {
      this.bar.keyWord = '',
      this.bar.status = [],
      this.bar.time = '',
      this.bar.reserveId = ''
    },
 
    theme() {
      this.$api.get("reserve/list", {}, e => {
        this.themeList = e.map(d=> {
          return {
            label:d.title,
            value:d.id
          }
        })
      });
    },
 
    init() {
      let params = {
        keyWord:this.bar.keyWord,
        status:this.bar.status,
        type:1,
        advertType:0,
        startTime:this.bar.time[0] || '',
        endTime:this.bar.time[1] || '',
        reserveId:this.bar.reserveId,
        ids:[],
        pageNum: this.paginationParams.currentPage,
        pageSize: this.paginationParams.pageSize,
      }
      this.$api.post("reserve/make/handle/page", params, (e) => {
        this.paginationParams.total = e.total;
        // this.pageds.r++;
 
        e.records.map((item,index) => {     
          item.index = (this.paginationParams.currentPage-1) * this.paginationParams.pageSize + index + 1  
        })
        this.tds = (e.records || []).map((v) => {
           this.$set(v, 'che', false)
          return v;
        });
      });
    },
 
    //导出
    exports(v) {
      if(!this.ids.length) {
        demo.toast("请勾选需要导出的内容");
        return  
      }
      let t = this
      let params = {
        keyWord:this.bar.keyWord,
        status:this.bar.status,
        type:1,
        advertType:0,
        startTime:this.bar.time[0] || '',
        endTime:this.bar.time[1] || '',
        pageNum: this.paginationParams.currentPage,
        pageSize: this.paginationParams.pageSize,
        reserveId:'',
        ids:t.ids
 
      }
      this.$api.post("reserve/make/handle/export", params, (e) => {
        window.location.href = e;
      });
    },
 
    cancelY() {
      if(!this.ids.length) {
        demo.toast("请勾选需要取消预约的内容");
        return  
      }
       this.$prompt('取消原因', '确认取消该预约吗?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(({ value }) => {
            let t = this
            let params = {
              remark:value,
              ids:t.ids
            }
            this.$api.post("reserve/make/cancel", params, (e) => {
              this.init();
              demo.toast("取消预约成功")
            });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消输入'
          });       
        });
    
 
 
    },
 
    gohandle(v) {
      if(!this.ids.length) {
        demo.toast("请勾选需要处理的内容");
        return  
      }
      this.isShow = true;
    },
 
    cheAll () {
      this.Change = !this.Change
      //全选
      this.tds.map(item => {
        item.che = this.alls
      })
      this.change()
    },
 
    change () {
      //单个选择
      this.ids = []
      this.tds.map(item => {
        if (item.che) {
          this.ids.push(item.id)
        } else {
          this.alls = false
        }
      })
    },
 
    cancel() {
      //取消
      this.Change = false;
      this.alls = false
      this.tds.map(item=>{
        item.che = false
      })
    },
 
  },
};
</script>
<style scoped lang="less">
.page {
  padding: 20px 0;
  text-align: center;
}
.finance-del {
  overflow: scroll;
}
.add {
text-align: right;
}
.Tips {
  margin: 10px 0;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  background: #e6f7ff;
  border: #bae7ff 1px solid;
  border-radius: 6px;
  height: 40px;
  padding: 0 20px;
}
.Tips-cont {
  padding: 0 10px;
  font-size: 16px;
  color: #606266;
}
.Tips-cont > span {
  padding: 0 4px;
  color: #409eff;
  font-weight: 600;
}
.bgc_primary {
  margin-bottom: 15px;
}
</style>