zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
<template>
  <div class="apply-info">
    <CommTable
      :title="title"
      :pageInfo="pageInfo"
      :total="total"
      @doAction="doAction"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :list="records"
      :header="tableHeader"
    ></CommTable>
 
    <el-dialog
      :visible.sync="isShowDialog"
      custom-class="comm-dialog"
      :modal-append-to-body="false"
      width="850px"
    >
      <ContractMailUpdate
        :info="tempRecord"
        @close="isShowDialog = false"
        :isShow="isShowDialog"
        :tempRecord="tempRecord"
        @succ="updateSucc"
      ></ContractMailUpdate>
    </el-dialog>
    <Dialog
      v-model="isShowSucc"
      icon="succ"
      iconText="提交成功"
      :close="false"
      :buttons="[{text: '确定', type: 'primary'}]"
      @handleClick="sureSucc"
    ></Dialog>
  </div>
</template>
<script>
// 历史邮寄信息/电子邮件信息
import CommTable from '@/components/CommTable'
import ContractMailUpdate from '@/components/ContractMailUpdate'
import Dialog from '@/components/Dialog'
import mailLoanHistoryList from '@/controller/mailLoanHistoryList'
import downloadAttachmentFile from '@/controller/downloadAttachmentFile'
 
const recordButtons = [
  {
    text: '修改',
    prop: 'updateButton'
  },
  {
    text: '复制收件人信息',
    prop: 'copyButton'
  },
  {
    text: '下载附件',
    prop: 'downLoadButton'
  }
]
 
export default {
  components: {
    CommTable,
    Dialog,
    ContractMailUpdate
  },
  props: {
    // 1:历史电子邮件信息, 2:历史邮寄信息
    typeId: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      isShowSucc: false,
      isShowDialog: false,
      tableHeader: [],
      model: null,
      downloadModel: null,
      pageInfo: {
        currentPage: 1,
        pageSize: 10
      },
      total: 0,
      records: [],
      tempRecord: {}
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      const { typeId, $route } = this
      const { query } = $route
      this.query = query
      const model = mailLoanHistoryList(typeId)
      this.tableHeader = model.getTableList()
      model.computedItem = item => {
        return {
          ...item,
          action: {
            buttons: recordButtons.filter(
              button => Number(item[button.prop]) === 1
            )
          }
        }
      }
 
      this.model = model
      this.downloadModel = downloadAttachmentFile()
      this.getList()
    },
 
    async getList() {
      const { model, query, pageInfo, typeId } = this
      const { applySerialNo, objectNo } = query
      const res = await model.request({
        applySerialNo,
        deliveryWay: typeId,
        objectNo,
        ...pageInfo
      })
      const { list = [], total } = res
      this.records = list
      this.total = parseInt(total)
    },
 
    // 表格按钮事件处理
    doAction(item, record) {
      const { prop } = item
      this.tempRecord = { ...record }
 
      // 修改
      if (prop === 'updateButton') {
        this.isShowDialog = true
      }
 
      // 复制收件人信息
      if (prop === 'copyButton') {
        // 复制收件人信息格式:【收件人名称+空格+收件人电话+空格+收件人省+收件人市+收件人区+收件人街道楼房号】,
        this.toCopy()
      }
 
      // 下载附件
      if (prop === 'downLoadButton') {
        this.download()
      }
    },
 
    toCopy() {
      const { tempRecord } = this
      const keys = ['recipient', 'phone', 'adress']
      const str = keys.reduce(
        (pre, curr) => `${pre ? pre + ' ' : ''}${tempRecord[curr]}`,
        ''
      )
      this.$copyText(str)
    },
 
    // 下载附件
    async download() {
      const { tempRecord, downloadModel } = this
      const { mailingNo } = tempRecord
      await downloadModel.request({
        sendId: mailingNo
      })
    },
 
    toEdit(info = {}) {
      const { tempRecord, transCode, codeNo } = this
      const {
        applySerialno = '',
        // serialNo = '',
        phaseNo = '',
        transCode: tempTransCode,
        withholdStatus = '',
        loanSerialNo = '',
        // objectType = 'TransferRefundFlow',
        customerId = '',
        imageObjectNo = '',
        imageObjectType = ''
      } = tempRecord
 
      const baseQuery = {
        applySerialno,
        serialNo: loanSerialNo,
        transCode: tempTransCode || transCode,
        codeNo,
        phaseNo,
        loanSerialno: loanSerialNo,
        objectType: imageObjectType,
        customerId,
        withholdStatus,
        objectNo: imageObjectNo
      }
 
      // 详情 按钮操作为打开新详情窗口
      this.$openWindow('/comm/apply', {
        pageId: 41,
        ...baseQuery,
        ...info
      })
    },
 
    updateSucc() {
      this.isShowDialog = false
      this.isShowSucc = true
    },
 
    sureSucc() {
      this.isShowSucc = false
      this.resetList()
    },
 
    resetList() {
      this.pageInfo.currentPage = 1
      this.getList()
    },
 
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val
      this.getList()
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val
      this.getList()
    }
  },
  computed: {
    title() {
      const { typeId } = this
      return typeId === 1 ? '历史电子邮件信息' : '历史邮寄信息'
    }
  },
  watch: {
    $route() {
      const { serialNo } = this.$route.query
      if (serialNo) {
        this.init()
      }
    }
  }
}
</script>
<style lang="postcss" scoped>
.apply-info {
}
</style>