referralDialog.vue
6.85 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
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
<!-- 复核有效引荐数/查看有效引荐数 -->
<!-- 只有待复核的数据,才显示复核按钮,已复核和已失效,只显示查看按钮
-->
<template>
<baseDialog
:dialog-config="dialogConfig"
:is-show.sync="visible"
class="accountDailog"
:config="approveConfig"
@handleClick="handleClick"
>
<div class="reply-dialog" v-loading="loading">
<template v-if="detailInfo">
<detailComp
ref="detailComp"
:configData="configData"
:detailInfo="detailInfo"
labelWidth="190px"
:rules="rules"
></detailComp>
</template>
</div>
</baseDialog>
</template>
<script>
import {
effectiveReferralStoreAudit,
getEffectiveReferralStoreDetail
} from "@api/order"
import detailComp from "../../residentManage/salaryPerformance/components/detailComp.vue"
import { Util, deepClone, getStatusItem } from "@/common/util"
export default {
name: "approvalView",
components: {
detailComp
},
data() {
return {
detailInfo: {},
dialogConfig: {
title: "复核有效引荐数",
width: "540px"
},
loading: false,
isShow: true,
approveConfig: {
isShowFooter: false,
cancel_name: "取 消",
confirm_name: "确 定"
},
configData: [
{
childRef: "referralComp",
infoData: [
{
title: "门店名称",
key: "merchantName",
col: 24
},
{
title: "业务场景",
key: "sceneType",
col: 24,
formatter: (cellValue) => {
return getStatusItem(
this.baseData,
"businessTypeOpts",
cellValue,
"sceneType"
)
}
},
{
title: "车辆品牌",
key: "brandName",
col: 24
},
{
title: "系统交车数",
key: "totalDeliveryCount",
col: 24,
formatter: (val) => {
return val.totalDeliveryCount || val.totalDeliveryCount === 0
? val.totalDeliveryCount
: "-"
}
},
{
title: "区域有效引荐数",
key: "areaEffectiveCount",
col: 24,
formatter: (val) => {
return val.areaEffectiveCount || val.areaEffectiveCount === 0
? val.areaEffectiveCount
: "-"
}
},
{
title: "运营修正实际有效引荐数",
key: "reviewedEffectiveCount",
isEdit: true,
col: 24,
type: "input",
isDisabled: false
}
]
}
],
rules: {
// reviewedEffectiveCount: [
// { required: true, message: "请填写修正实际有效引荐数" },
// {
// validator: (rule, value, callback) => {
// const s = String(value == null ? "" : value).trim()
// if (!/^\d+$/.test(s)) {
// callback(new Error("仅支持输入整数"))
// return
// }
// const n = Number(s)
// if (n < 0 || n > 100000000) {
// callback(new Error("范围应为 0-100000000"))
// return
// }
// callback()
// },
// trigger: ["blur", "change"]
// }
// ]
},
baseData: {
businessTypeOpts: [
{
confId: 3,
confValue: "单延保"
},
{
confId: 2,
confValue: "广联权益"
},
{
confId: 1,
confValue: "轻改"
}
]
}
}
},
props: {
detailVisible: {
type: Boolean,
default: false
},
id: {
type: Number,
default: ""
}
},
computed: {
visible: {
get() {
return this.detailVisible
},
set(newVal) {
this.$emit("dialogClose", { flag: newVal, attrName: "detailVisible" })
}
}
},
watch: {
detailVisible: {
handler(val) {
this.getDetail()
},
immediate: true
}
},
created() {},
mounted() {},
methods: {
async getDetail() {
let result = await getEffectiveReferralStoreDetail({ id: this.id })
this.dialogConfig.title =
result.isReviewed == 0 ? "复核有效引荐数" : "查看有效引荐数"
this.approveConfig.isShowFooter = result.isReviewed == 0 ? true : false
// 申诉类型(1:考勤,2:平板录音)
this.configData[0].infoData[
this.findAttrIdx("infoData", "reviewedEffectiveCount")
].isDisabled = result.isReviewed == 0 ? false : true
this.detailInfo = result
},
formatterImg(val) {
if (!val) return []
let arr = val.split(",")
return arr
},
validateBeforeSave() {
if (!this.detailInfo.reviewedEffectiveCount) {
this.$message.error("请输入运营修正实际有效引荐数")
return false
}
const v = this.detailInfo.reviewedEffectiveCount
const s = String(v).trim()
if (!/^\d+$/.test(s)) {
this.$message.error("运营修正实际有效引荐数需为整数")
return false
}
if (
this.detailInfo.reviewedEffectiveCount < 0 ||
this.detailInfo.reviewedEffectiveCount > 100000000
) {
this.$message.error("范围应为 0-100000000")
return false
}
this.detailInfo.reviewedEffectiveCount = Number(s)
return true
},
async handleClick() {
if (!this.validateBeforeSave()) return
let params = {
id: this.detailInfo.id,
reviewedEffectiveCount: this.detailInfo.reviewedEffectiveCount
}
effectiveReferralStoreAudit(params)
.then((res) => {
if (res) {
this.$message.success("操作成功")
}
})
.finally((err) => {
this.visible = false
})
},
handleClose() {
console.log("handleClose")
},
findAttrIdx(formName, name) {
var index = this.configData[0][formName].findIndex((k) => k.key == name)
return index || 0
}
}
}
</script>
<style lang="scss" scoped>
@import "../../residentManage/salaryPerformance/components/detail.scss";
::v-deep .el-dialog__body {
padding: 12px 20px !important;
}
::v-deep .el-dialog__footer {
border-top: 1px solid #e5e5e5;
padding: 14px 20px !important;
.dialog-footer {
border-top: 0px solid #fff !important;
}
}
::v-deep .el-dialog__header {
padding: 16px 20px !important;
color: #333333;
font-size: 20px;
font-weight: bold;
}
</style>