financeConfirmDialog.vue
6.19 KB
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
<!-- 财务确认弹窗 -->
<template>
<!-- <d2-dialog title="财务确认"
:is-visible.sync="financeConfirmVisible"
width="600px"
@confirmDialog="handleCashConfirm"
@closeDialog="handleCashClose"> -->
<baseDialog :dialog-config="dialogConfig"
:is-show.sync="visible"
class="accountDailog"
@handleClick="handleCashConfirm">
<!-- <span slot="sub-title">提现后不能撤回,确保资金安全,请谨慎操作!</span> -->
<el-form ref="formRef"
:model="cashForm"
:rules="cashRules"
label-width="120px">
<el-form-item label="财务管理员:"
prop="administrators">
<el-select v-model="cashForm.administrators"
filterable
style="width:310px">
<el-option v-for="(item,index) in baseData.administratorsList"
:key="index"
:label="item.name + ' ' + item.phone"
:value="item.phone" />
</el-select>
</el-form-item>
<el-form-item label="验证码:"
prop="smsCode"
class="pdt">
<el-input v-model="cashForm.smsCode"
placeholder="请输入验证码"
maxlength="6"
style="width: 200px" />
<el-button type="primary"
size="small"
@click="handleSend"
:disabled="isSend"
class="cash-btn">
{{ isSend ? sendMsg + '秒后,重试' : '获取验证码' }}
</el-button>
<p v-show="showtips">
已向尾号为{{ cashForm.administrators ? cashForm.administrators.slice(-4) : '' }}的手机号发送验证码,验证码30分钟内有效
</p>
</el-form-item>
<el-form-item label="备注:"
prop="remark"
class="pdt">
<el-input v-model="cashForm.remark"
type="textarea"
maxlength="50"
placeholder="请输入备注"
show-word-limit
:rows="4"
style="width: 310px" />
<p>
财务确认后,转账业务单据自动流转至银盛完成正式转账。
</p>
</el-form-item>
</el-form>
<!-- </d2-dialog> -->
</baseDialog>
</template>
<script>
import { createWithdraw } from '@api/account'
import { sendToSmsCodeApi } from '@/api/sys.base'
import { getWithdrawTreasurerList, transferAccountsRecordUpdateStatus, batchTreasurerConfirm } from '@api/transferAccountsManage'
export default {
name: 'FinanceConfirmDialog',
data() {
return {
dialogConfig: {
title: '财务确认',
width: '600px'
},
cashForm: {
administrators: '',
smsCode: '',
remark: ''
},
cashRules: {
administrators: [{ required: true, message: '请选择财务管理员', trigger: 'change' }],
smsCode: [{ required: true, message: '请输入验证码', trigger: 'change' }]
},
// 验证码
showtips: false,
isSend: false,
sendMsg: '获取验证码',
time: '',
// 基本数据
baseData: {
administratorsList: []
}
}
},
props: {
financeConfirmVisible: {
type: Boolean,
default: false
},
// cashForm: {
// type: Object,
// default: () => { }
// }
infoList: {
type: Array,
default: () => { }
}
},
// watch: {
// financeConfirmVisible(newVal, val) {
// newVal ? this.reset() : this.closeReset()
// }
// },
computed: {
visible: {
get() {
return this.financeConfirmVisible
},
set(newVal) {
this.$emit('dialogClose', { flag: newVal, attrName: 'financeConfirmVisible' })
}
}
},
mounted() {
this.getAdminList()
},
methods: {
// reset() {
// this.$refs.formRef && this.$refs.formRef.resetFields()
// },
// closeReset() {
// this.isSend = false
// this.showtips = false
// this.time && clearTimeout(this.time)
// },
getAdminList() {
getWithdrawTreasurerList({}).then(res => {
this.baseData.administratorsList = res
this.cashForm.administrators = res[0].phone
})
},
handleCashConfirm() {
this.$refs.formRef.validate(valid => {
if (valid) {
var params = {}
params.remark = this.cashForm.remark
params.smsCode = this.cashForm.smsCode
params.phone = this.cashForm.administrators
params.status = 3
if (this.infoList.length > 1) {
params.orderCodeList = this.infoList.map((item) => {
return item.orderCode
})
} else {
params.orderCode = this.infoList[0].orderCode
}
console.log(params)
const _api = this.infoList.length > 1 ? batchTreasurerConfirm : transferAccountsRecordUpdateStatus
_api(params).then(res => {
this.notice.okTips('操作成功')
this.visible = true
})
// createWithdraw({ totalAmount: (+this.cashForm.balance - 2), smsCode: this.cashForm.smsCode }).then(res => {
// this.notice.okTips()
// this.$emit('handleCashConfirm')
// })
}
})
},
// handleCashClose() {
// this.$emit('dialogClose', true)
// },
handleSend() {
if (!this.cashForm.administrators) {
this.notice.warningTips('请选择管理员')
return
}
sendToSmsCodeApi({ phone: this.cashForm.administrators }).then((res) => {
this.notice.okTips('已发送,30分钟内有效')
this.isSend = true
this.showtips = true
this.sendMsg = 60
this.msgDown()
})
},
msgDown() {
this.time = setTimeout(() => {
clearTimeout(this.time)
if (this.sendMsg > 1) {
--this.sendMsg
this.msgDown()
} else {
this.isSend = false
}
}, 1000)
}
}
}
</script>
<style scoped>
p {
margin: 0 0;
}
.cash-btn {
margin-left: 20px;
}
.pdt {
padding-top: 10px;
}
</style>