MrShi
2024-11-19 56edbd80963acea41d9b9737bb9264f57a6e4ae2
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
<template>
    <GlobalWindow
        :title="title"
        width="100%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <div class="desc">
            <div class="desc_item">
                <div class="desc_item_label">
                    <div class="desc_item_label_left">
                        <span>投保人:{{ model.shopName}}</span>
                      <span v-if="model.status === 0">保单状态:<span  :class="'change-status'+model.status" >待签署</span></span>
                      <span v-if="model.status === 1">保单状态:<span  :class="'change-status'+model.status" >待审核</span></span>
                      <span v-if="model.status === 2">保单状态:<span  :class="'change-status'+model.status" >已生效</span></span>
                      <span v-if="model.status === 7">保单状态:<span  :class="'change-status'+model.status" >待出单</span></span>
                      <span v-if="model.status === 9">保单状态:<span  :class="'change-status'+model.status" >批改申请中</span></span>
                      <span v-if="model.status === 3 || model.status === 4">保单状态:<span  :class="'change-status'+model.status" >退回申请</span></span>
                      <span v-if="model.status === 5 || model.status === 8">保单状态:<span  :class="'change-status'+model.status" >已退回</span></span>
                      <span v-if=" model.status === 6">保单状态:<span  :class="'change-status'+model.status" >已关闭</span></span>
                        <span>提交时间:{{ model.createDate }}</span>
                    </div>
                  <div class="desc_item_label_right">
                        <template v-if="2">
                            <el-button type="primary"  @click="$refs.ApplyChangeDetails.open('加减保详单',model,0)">导出详单</el-button>
                            <el-button v-if="[1,2].includes(model.status)" type="primary" @click="viewApplyFile">查看申请单</el-button>
                            <el-button v-if="[0].includes(model.status)" type="primary" :disabled="loading" :loading="loading" @click="getSignLink(0)">签署申请单</el-button>
                            <el-button v-if="[2].includes(model.status)" type="primary" @click="viewPidan">查看批单</el-button>
                            <el-button v-if=" [1].includes(model.status) && userInfo.type === 0" type="primary" @click="$refs.OperaUnionChangeCheckWindow.open('上传批单',model,3)">上传批单</el-button>
                            <el-button  v-if="[0,1].includes(model.status)" type="danger" @click="$refs.OperaUnionChangeCheckWindow.open('退回申请',model,1)">退回申请</el-button>
                        </template>
                        <template  v-if="0">
                          <template  v-if="0">
                            <el-button type="primary"  @click="$refs.ApplyChangeDetails.open('更换派遣单位详单',model,0)">导出详单</el-button>
                            <el-button v-if="[1,2].includes(model.status)" type="primary" @click="viewApplyFile">查看申请单</el-button>
                            <el-button v-if="[0].includes(model.status)" type="primary" :disabled="loading" :loading="loading" @click="getSignLink(0)">签署申请单</el-button>
                            <el-button v-if="[2].includes(model.status)" type="primary" @click="viewPidan">查看批单</el-button>
                          </template>
                        </template>
                  </div>
                </div>
                <div class="desc_item_from">
                    <el-table
                        :data="tableData"
                        border
                        style="width: 100%">
                        <el-table-column
                            prop="code"
                            align="center"
                            label="批单号">
                        </el-table-column>
                        <el-table-column
                            align="center"
                            label="保单号">
                            <template slot-scope="{row}">
                                <el-button type="text" @click="$refs.detailsEntrustedInsurance.open('投保详情', { id: row.unionApplyId })">{{row.applyCode}}</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="solutionsName"
                            label="保险方案"
                            align="center"
                            width="180">
                        </el-table-column>
                        <el-table-column
                            prop="startTime"
                            align="center"
                            label="保险生效起期">
                        </el-table-column>
                        <el-table-column
                            prop="endTime"
                            align="center"
                            label="保险生效止期">
                        </el-table-column>
                      <el-table-column
                          prop="applyStartTime"
                          align="center"
                          :label="getUnionChangTimeTitle(1,model)">
                      </el-table-column>
                      <el-table-column
                          prop="delValidTime"
                          align="center"
                          :label="getUnionChangTimeTitle(0,model)">
                      </el-table-column>
                        <el-table-column
                            prop="addNum"
                            align="center"
                            label="加保人数">
                        </el-table-column>
                        <el-table-column
                            prop="delNum"
                            align="center"
                            label="减保人数">
                        </el-table-column>
                        <el-table-column
                            prop="fee"
                            align="center"
                            label="费用变更(元)">
                        </el-table-column>
                    </el-table>
                </div>
                <div class="desc_item_cate">
                    <el-tabs v-model="activeName" @tab-click="handleClick">
                        <el-tab-pane label="加保记录" name="0"></el-tab-pane>
                        <el-tab-pane label="减保记录" name="1"></el-tab-pane>
                    </el-tabs>
                </div>
                <div class="desc_item_from">
                    <el-table
                        :data="list"
                        border
                        style="width: 100%">
                        <el-table-column label="序号">
                            <template slot-scope="scope">
                                <span>{{scope.$index + 1}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="memberName"
                            label="员工姓名">
                        </el-table-column>
                        <el-table-column
                            label="性别">
                            <template slot-scope="{row}">
                                <span v-if="row.sex === 0">男</span>
                              <span  v-if="row.sex === 1">女</span>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="memberIdcardNo"
                            label="身份证号">
                        </el-table-column>
                      <el-table-column
                          prop="companyName"
                          label="被保险人">
                      </el-table-column>
                        <el-table-column
                            v-if="hasDispatchUnit !== 1"
                            prop="duName"
                            label="派遣单位">
                        </el-table-column>
                        <el-table-column
                            prop="workTypeName"
                            label="所属工种">
                        </el-table-column>
                        <el-table-column
                            prop="startTime"
                            label="保险生效起期">
                        </el-table-column>
                        <el-table-column
                            prop="endTime"
                            label="保险生效止期">
                        </el-table-column>
                        <el-table-column
                            prop="fee"
                            label="费用变更(元)">
                        </el-table-column>
                        <el-table-column
                            prop="remark"
                            label="备注">
                        </el-table-column>
                    </el-table>
                    <div class="desc_item_from_page">
                        <el-pagination
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="total">
                        </el-pagination>
                    </div>
                </div>
                <div class="desc_item_review" v-if="model.applyLogList">
                    <div class="desc_item_review_label">操作记录</div>
                  <el-timeline :reverse="reverse">
                    <el-timeline-item
                        v-for="(activity, index) in model.applyLogList"
                        :key="index">
                      <div style="display: flex; flex-direction: column;">
                                <span style="font-size: 16px; font-weight: 400; color: black;">
                                    {{activity.title}}
                                    <span style="font-size: 16px; font-weight: 400; color: black; margin-left: 10px;" >
                                        {{activity.content}}
                                    </span>
                                </span>
                        <span style="margin-top: 5px; font-size: 12px; font-weight: 400; color: #999999;">
                                    操作员-{{activity.creatorName}}({{activity.creatorType==1? activity.companyName: (activity.creatorType==2? activity.companyName: "平台端") }}){{activity.createDate}}
                                </span>
                      </div>
                    </el-timeline-item>
                  </el-timeline>
                </div>
            </div>
        </div>
        <UnionChangeDetails ref="ApplyChangeDetails" @success="successEvent" />
        <OperaUnionChangeCheckWindow ref="OperaUnionChangeCheckWindow" @success="successEvent" />
        <!--    企业申请退回    -->
<!--        <applyReturn ref="applyReturn" @success="successEvent" />-->
        <add_subtract_return ref="add_subtract_return" @success="successEvent" />
        <!--    新增投保    -->
        <OperaInsuranceApply ref="OperaInsuranceApply" @success="successEvent" />
        <!--    加减保申请    -->
        <reinsurance ref="reinsurance" @success="successEvent" />
        <!--    更换派遣单位申请    -->
        <factoryChange ref="factoryChange" @success="successEvent" />
        <!--    投保详情    -->
        <insuranceApplyDetails ref="insuranceApplyDetails" @success="successEvent" />
        <!-- 详情 -->
        <OperaPdfViewerWindow ref="OperaPdfViewerWindow" />
        <detailsEntrustedInsurance ref="detailsEntrustedInsurance" />
      <!-- 修改手机号 -->
      <el-dialog
          :title="signTitle"
          :visible.sync="visiblePhone"
          width="800px"
          :modal="false"
          :show-close="false"
          :close-on-click-modal="false"
          center>
        <el-form :model="form" ref="form" :rules="rules">
          <el-form-item label="手机号" prop="phone">
            <el-input v-model="form.phone" placeholder="请输入" disabled v-trim/>
          </el-form-item>
          <el-form-item label="验证码" prop="code">
            <div style="width: 100%; display: flex; align-items: center;">
              <el-input v-model="form.code" placeholder="请输入" v-trim/>
              <el-button type="primary" style="margin-left: 15px;" @click="send" v-if="num === 0">发送验证码</el-button>
              <el-button type="primary" style="margin-left: 15px;" v-else>{{num}}s</el-button>
            </div>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
                <el-button type="primary" :loading="signing" @click="goSignDo()">确  定</el-button>
                <el-button @click="visiblePhone=false">取 消</el-button>
            </span>
      </el-dialog>
      <el-dialog
          title="查看批单"
          :visible.sync="visibleFile"
          width="700px"
          :modal="false"
          :show-close="true"
          :close-on-click-modal="false"
          append-to-body
          center>
          <el-table
              :data="model.pidanFileList"
              border
              style="width: 100%">
              <el-table-column
                  prop="name"
                  label="名称">
              </el-table-column>
              <el-table-column
                  width="90"
                  label="操作">
                  <template slot-scope="{ row }">
                      <el-button type="primary" @click="seePidan(row.name, row.fileurlFull)">查看</el-button>
                  </template>
              </el-table-column>
          </el-table>
<!--        <div class="desc_item_from" v-for="(item, index) in pidanFileData" :key="index"  style="margin-bottom: 15px">-->
<!--          <span v-if="index ==0">{{item.name}}:</span>-->
<!--          <span v-if="index >0">被保险人({{item.name}})保险单:</span>-->
<!--          <a  style="cursor: pointer;color: #2E68EC" v-if="item.file && item.file.fileurl && index ==0" @click="openFile(item.file.fileurlFull,item.name)">在线预览</a>-->
<!--          <a   style="cursor: pointer;color: #2E68EC" v-if="item.file && item.file.fileurl && index !=0 " @click="openFile(item.file.fileurlFull,'被保险人('+item.name+')保险单')">在线预览</a>-->
<!--          <span v-if="!item.file || !item.file.fileurl">未上传</span>-->
<!--        </div>-->
        <span slot="footer" class="dialog-footer">
                <el-button @click="visibleFile=false">关 闭</el-button>
            </span>
      </el-dialog>
      <template v-slot:footer>
        <el-button @click="visible=false">返回</el-button>
      </template>
    </GlobalWindow>
 
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import UnionChangeDetails from '@/components/business/UnionChangeDetails'
import OperaUnionChangeCheckWindow from '@/components/business/OperaUnionChangeCheckWindow'
import reinsurance from '@/components/enterprise/reinsurance'
import factoryChange from '@/components/enterprise/factoryChange'
import add_subtract_return from '@/components/enterprise/add_subtract_return'
import {
  applyChagneDetailPage
} from '@/api/business/insuranceApply'
import {
  getById,
    getSignLink
} from '@/api/business/unionChange'
import {applyChangeOpt, listAll as applyList} from '@/api/business/applyChange'
import detailsEntrustedInsurance from '@/components/business/detailsEntrustedInsurance'
 
import {sendSms} from "@/api/business/smsEmail";
import OperaInsuranceApply from '@/components/enterprise/OperaInsuranceApplyAddWindow'
import { mapState } from 'vuex'
 
import OperaPdfViewerWindow from '@/components/business/OperaPdfViewerWindow'
export default {
  name: 'OperaUnionChangeDetailWindow',
  extends: BaseOpera,
  components: {
      GlobalWindow,
    UnionChangeDetails,
    OperaUnionChangeCheckWindow,
      add_subtract_return,
    OperaPdfViewerWindow,
      OperaInsuranceApply,
      reinsurance,
      factoryChange,
      detailsEntrustedInsurance,
      insuranceApplyDetails: () => import ('@/components/business/OperaInsuranceApplyWindow')
  },
  data () {
    return {
      // 表单数据
      modelId:null,
      num: 0,
      timer: null,
      signing:false,
      signTitle: '手机号验证',
      pidanFileData:[],
      model: {},
      visiblePhone: false,
      visibleFile:false,
      hasDispatchUnit: null,
      form: {
          businessId: null,
          phone: this.$store.state.userInfo.company? this.$store.state.userInfo.company.phone:null,
          id: null,
          editDate: '',
          code:null
      },
      // 验证规则
      rules: {
      },
      formInline: {
          applyStatus: '',
          duId: '',
          workTypeId: '',
          memberName: '',
          types: ''
      },
      reverse: false,
      radio: 0,
      activities: [],
      tableData: [],
        list: [],
      activeName: '0',
        total: 0,
      currentPage: 1,
        loading: false
    }
  },
  created () {
      this.config({
          api: '/business/insuranceApply',
          'field.id': 'id'
      })
  },
    computed: {
      ...mapState(['userInfo'])
    },
  methods: {
     open(title,target){
        this.visible = true;
        this.title = title
        this.modelId = target.id
       this.model={}
       this.form.businessId = target.id
       this.num=0
       this.signing=false
       this.visiblePhone=false
       this.visibleFile=false
       this. pidanFileData=[]
       this.timer=null
        this.getDetail()
        this.getList()
     },
    seePidan(name, url) {
       this.$refs.OperaPdfViewerWindow.open(name, url)
    },
    send () {
      sendSms({
        phone: this.form.phone
      }).then(res => {
        this.num = 60
        this.setTime()
      })
    },
    openFile (url,title) {
      setTimeout(() => {
 
        this.$refs.OperaPdfViewerWindow.open(title || '在线预览',url)
        // window.open(url)
      }, 500)
    },
    setTime () {
      this.timer = setInterval(() => {
        if (this.num === 0) {
          clearInterval(this.timer)
          this.timer = null
          return
        }
        this.num = this.num - 1
      }, 1000)
    },
    getSignLink (flag) {
        this.signTitle = '签署申请单'
        this.form.type = flag
        this.loading = true
        getSignLink(this.form).then(res => {
            this.loading = false
            window.open(res)
        }).catch(err => {
            this.loading = false
            this.$tip.apiFailed(err)
        })
      // this.visiblePhone = true
      // this.$nextTick(() => {
      //   this.$refs.form.resetFields()
      // });
    },
    goSignDo(){
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        this.signing = true
        if(this.form.type===0){
          getSignLink(this.form).then(res => {
            setTimeout(() => {
              this.visiblePhone=false
              this.signing=false
              window.open(res)
            }, 500)
          }).catch(err => {
            this.signing=false
            this.$tip.apiFailed(err)
          })
        }
      })
    },
      resetting() {
            this.search()
      },
      closeOrder() {
          this.$confirm('确认关闭此订单吗?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
          }).then(() => {
              applyChangeOpt({
                  optType: 6,
                  applyId: this.model.id
              }).then(res => {
                  this.getDetail()
              }).catch(e => {
                  this.$message.error(e)
              })
          }).catch(() => {
 
          });
      },
      search() {
          this.currentPage = 1
          this.getList()
      },
      getList() {
           applyChagneDetailPage({
               capacity: 10,
               page: this.currentPage,
               model: {
                   unionChangeId: this.modelId,
                   types:[ this.activeName]
               }
           }).then(res => {
               this.list = res.records
               this.total = res.total
           })
      },
      handleClick(e) {
        this.activeName = e.index
        this.resetting()
      },
    viewApplyFile(){
       if(this.model.applyFile && this.model.applyFile.fileurlFull){
         this.$refs.OperaPdfViewerWindow.open('查看申请单',this.model.applyFile.fileurlFull)
        // window.open(this.model.applyFile.fileurlFull)
       }
    },
    viewPidan(){
      this.visibleFile=true
    },
    handleSizeChange(val){
        console.log(val)
    },
    handleCurrentChange(val){
        console.log(val)
        this.page = val
        this.getList()
    },
    onSubmit(){
 
    },
    getDetail(){
      this.pidanFileData=[]
      getById(this.modelId).then(res => {
        this.model = res
        this.tableData = new Array()
        this.tableData.push(res)
        this.pidanFileData.push({ name: '商户保险单', file: this.model.pidanFile })
        this.getApplyList()
      }).catch(err => {
      })
    },
    getApplyList () {
      applyList({ unionChangeId: this.model.id, getFiles: 1 }).then(res => {
        this.model.applyList = res
        this.hasDispatchUnit = res[0].hasDispatchUnit
        if (res && res.length > 0) {
          res.forEach(item => {
            if (item.pidanFile) {
              this.pidanFileData.push({ name: item.companyName, file: item.pidanFile })
            } else {
              this.pidanFileData.push({ name: item.companyName, file: null })
            }
          })
        }
      }).catch(err => {
      })
    },
    successEvent(){
       // this.visible=false
      this.getDetail()
      this.$emit('success')
    }
  }
}
</script>
<style>
 
</style>
<style lang="scss" scoped>
    .form {
        width: 100%;
        display: flex;
        align-items: center;
        flex-direction: column;
        .form_span {
            width: 100%;
            display: flex;
            align-items: start;
            flex-direction: column;
            margin-bottom: 20px;
            span {
                font-size: 14px;
                &:nth-child(1) {
                    color: black;
                    margin-bottom: 5px;
                }
                &:nth-child(2) {
                    color: #8c939d;
                }
            }
        }
        .form_item {
            width: 100%;
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            &:last-child {
                margin: 0 !important;
            }
            .form_item_label {
                flex-shrink: 0;
                width: 170px;
                color: black;
                font-size: 14px;
                span {
                    color: red;
                    font-size: 14px;
                }
            }
            .form_item_val {
                flex: 1;
                /*height: 40px;*/
                margin-left: 20px;
                textarea {
                    width: 100%;
                    height: 70px;
                    border: 1px solid #cbcbcb;
                    padding: 10px;
                    outline: none;
                    box-sizing: border-box;
                }
                input {
                    width: 100%;
                    height: 40px;
                    outline: none;
                    border-radius: 5px;
                    border: 1px solid #cbcbcb;
                    padding: 0 20px;
                    box-sizing: border-box;
                }
            }
        }
    }
    .desc {
        width: 100%;
        .desc_item {
            width: 100%;
            display: flex;
            flex-direction: column;
            .desc_item_label {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 10px;
                .desc_item_label_left {
                    flex-shrink: 0;
                }
                span {
                    font-size: 14px;
                    color: black;
                    margin-right: 30px;
                }
            }
            .desc_item_from {
                width: 100%;
                margin-bottom: 10px;
                .desc_item_from_page {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: end;
                    margin-top: 10px;
                }
            }
            .desc_item_cate {
                width: 100%;
                margin-bottom: 10px;
            }
            .desc_item_search {
                width: 100%;
                margin-bottom: 20px;
            }
            .desc_item_review {
                width: 100%;
                .desc_item_review_label {
                    font-size: 20px;
                    color: black;
                    font-weight: bold;
                    margin-bottom: 15px;
                }
            }
        }
    }
</style>