jufubao-admin-library 1.1.222 → 1.1.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,6 +30,65 @@
|
|
|
30
30
|
></xd-pagination>
|
|
31
31
|
</div>
|
|
32
32
|
</el-card>
|
|
33
|
+
<xd-dialog
|
|
34
|
+
v-if="showNoticeSetting"
|
|
35
|
+
title=""
|
|
36
|
+
:show.sync="showNoticeSetting"
|
|
37
|
+
width="500px"
|
|
38
|
+
>
|
|
39
|
+
<xd-base-dynamic-field
|
|
40
|
+
:key="randomKey"
|
|
41
|
+
v-if="setFormList !== null"
|
|
42
|
+
ref="setForm"
|
|
43
|
+
v-model="setFormParams"
|
|
44
|
+
:list="setFormList"
|
|
45
|
+
size="medium"
|
|
46
|
+
@success="handleSuccess"
|
|
47
|
+
@onApiSuccessUrl="handleApiSuccessUrl"
|
|
48
|
+
@onGetParamsAndHeader="handlePrivateGetParamsAndHeader"
|
|
49
|
+
>
|
|
50
|
+
<template slot="set" slot-scope="scope">
|
|
51
|
+
<el-form
|
|
52
|
+
:label-width="scope.width"
|
|
53
|
+
:model="customForm"
|
|
54
|
+
:rules="customRules"
|
|
55
|
+
ref="customForm"
|
|
56
|
+
@submit.native.prevent
|
|
57
|
+
>
|
|
58
|
+
<el-form-item prop="frequency_type" label="通知频次:" required>
|
|
59
|
+
<el-select v-model="customForm.frequency_type" placeholder="请选择" style="margin-bottom: 5px;">
|
|
60
|
+
<el-option
|
|
61
|
+
v-for="item in optionsData['frequency_type_list']"
|
|
62
|
+
:key="item.value"
|
|
63
|
+
:label="item.label"
|
|
64
|
+
:value="item.value">
|
|
65
|
+
</el-option>
|
|
66
|
+
</el-select>
|
|
67
|
+
<el-select multiple v-if="customForm.frequency_type&&customForm.frequency_type==='week'" v-model="customForm.frequency_val" style="margin-bottom: 5px;" placeholder="请选择">
|
|
68
|
+
<el-option
|
|
69
|
+
v-for="item in weekData"
|
|
70
|
+
:key="item.value"
|
|
71
|
+
:label="item.label"
|
|
72
|
+
:value="item.value">
|
|
73
|
+
</el-option>
|
|
74
|
+
</el-select>
|
|
75
|
+
<el-select multiple v-model="customForm.frequency_time_val" style="margin-bottom: 5px;" placeholder="请选择">
|
|
76
|
+
<el-option
|
|
77
|
+
v-for="item in frequencyTimeData"
|
|
78
|
+
:key="item.value"
|
|
79
|
+
:label="item.label"
|
|
80
|
+
:value="item.value">
|
|
81
|
+
</el-option>
|
|
82
|
+
</el-select>
|
|
83
|
+
</el-form-item>
|
|
84
|
+
</el-form>
|
|
85
|
+
</template>
|
|
86
|
+
</xd-base-dynamic-field>
|
|
87
|
+
<div slot="btn">
|
|
88
|
+
<el-button type="default" @click="showNoticeSetting=false">取消</el-button>
|
|
89
|
+
<el-button type="primary" @click="handleNoticeSetting">确定</el-button>
|
|
90
|
+
</div>
|
|
91
|
+
</xd-dialog>
|
|
33
92
|
</div>
|
|
34
93
|
</template>
|
|
35
94
|
|
|
@@ -38,6 +97,8 @@
|
|
|
38
97
|
import XdSearch from "@/components/XdSearch";
|
|
39
98
|
import XdPagination from "@/components/XdPagination.vue";
|
|
40
99
|
import XdTable from "@/components/XdTable";
|
|
100
|
+
import XdDialog from "@/components/XdDialog.vue";
|
|
101
|
+
import XdBaseDynamicField from "@/components/XdBaseDynamicField";
|
|
41
102
|
import { mapActions } from "vuex";
|
|
42
103
|
import { getOptions } from "@/utils/options";
|
|
43
104
|
import { baseJsDateToTime } from "@/utils/xd.base.js";
|
|
@@ -47,26 +108,86 @@ import roleTRecord from "@/constant/modules/tradeRecord.js";
|
|
|
47
108
|
export default {
|
|
48
109
|
name: "listOpenapi",
|
|
49
110
|
components: {
|
|
50
|
-
XdPagination,
|
|
51
|
-
XdSearch,
|
|
111
|
+
XdPagination,
|
|
112
|
+
XdSearch,
|
|
52
113
|
XdTable,
|
|
114
|
+
XdDialog,
|
|
115
|
+
XdBaseDynamicField,
|
|
53
116
|
},
|
|
54
117
|
data() {
|
|
55
118
|
return {
|
|
56
119
|
//分页参数
|
|
57
|
-
page_token: 1,
|
|
58
|
-
hasNextPage: true,
|
|
59
|
-
page_size: 20,
|
|
60
|
-
searchForm: [],
|
|
61
|
-
searchParams: null,
|
|
120
|
+
page_token: 1,
|
|
121
|
+
hasNextPage: true,
|
|
122
|
+
page_size: 20,
|
|
123
|
+
searchForm: [],
|
|
124
|
+
searchParams: null,
|
|
62
125
|
totalData: {},
|
|
63
126
|
total: 0,
|
|
64
127
|
categoryList: [],
|
|
65
128
|
|
|
66
129
|
//列表对象
|
|
67
130
|
tables: [],
|
|
131
|
+
//余额通知设置
|
|
132
|
+
showNoticeSetting: false,
|
|
133
|
+
editRow: null,
|
|
134
|
+
randomKey: 'randomKey',
|
|
135
|
+
setFormList: [],
|
|
136
|
+
setFormParams: null,
|
|
137
|
+
optionsData: [],
|
|
138
|
+
frequencyTimeData: [
|
|
139
|
+
{label:'00:00',value:'00:00'},{label:'01:00',value:'01:00'},{label:'02:00',value:'02:00'},{label:'03:00',value:'03:00'},{label:'04:00',value:'04:00'},{label:'05:00',value:'05:00'},{label:'06:00',value:'06:00'},{label:'07:00',value:'07:00'},{label:'08:00',value:'08:00'},
|
|
140
|
+
{label:'09:00',value:'09:00'},{label:'10:00',value:'10:00'},{label:'11:00',value:'11:00'},{label:'12:00',value:'12:00'},{label:'13:00',value:'13:00'},{label:'14:00',value:'14:00'},{label:'15:00',value:'15:00'},{label:'16:00',value:'16:00'},
|
|
141
|
+
{label:'17:00',value:'17:00'},{label:'18:00',value:'18:00'},{label:'19:00',value:'19:00'},{label:'20:00',value:'20:00'},{label:'21:00',value:'21:00'},{label:'22:00',value:'22:00'},{label:'23:00',value:'23:00'}
|
|
142
|
+
],
|
|
143
|
+
customForm: {
|
|
144
|
+
frequency_type: '',
|
|
145
|
+
frequency_val: [],
|
|
146
|
+
frequency_time_val: [],
|
|
147
|
+
},
|
|
148
|
+
customRules: {},
|
|
149
|
+
weekData: [],
|
|
150
|
+
wallet_type: '',
|
|
151
|
+
owner_id: '',
|
|
68
152
|
};
|
|
69
153
|
},
|
|
154
|
+
watch: {
|
|
155
|
+
showNoticeSetting: {
|
|
156
|
+
handler(n, o) {
|
|
157
|
+
if (!n) {
|
|
158
|
+
this.customForm = {
|
|
159
|
+
frequency_type: '',
|
|
160
|
+
frequency_val: [],
|
|
161
|
+
frequency_time_val: [],
|
|
162
|
+
};
|
|
163
|
+
this.setFormParams = null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
'setFormParams.notify_mode': {
|
|
168
|
+
handler(n, o) {
|
|
169
|
+
if (n && n !== o) {
|
|
170
|
+
this.initFormList(this.setFormParams);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
deep: true,
|
|
174
|
+
immediate: true,
|
|
175
|
+
},
|
|
176
|
+
'customForm.frequency_val': {
|
|
177
|
+
handler(n, o) {
|
|
178
|
+
if (n && JSON.stringify(n) !== JSON.stringify(o)) {
|
|
179
|
+
this.customForm.frequency_val.sort();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
'customForm.frequency_time_val': {
|
|
184
|
+
handler(n, o) {
|
|
185
|
+
if (n && JSON.stringify(n) !== JSON.stringify(o)) {
|
|
186
|
+
this.customForm.frequency_time_val.sort();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
},
|
|
70
191
|
computed: {
|
|
71
192
|
headers() {
|
|
72
193
|
return [
|
|
@@ -111,17 +232,30 @@ export default {
|
|
|
111
232
|
label: "操作",
|
|
112
233
|
values: [
|
|
113
234
|
{ ui: "text-button", name: "对账", type: "text", event: "detail" },
|
|
114
|
-
|
|
235
|
+
{
|
|
236
|
+
ui: "text-button",
|
|
237
|
+
name: "余额通知",
|
|
238
|
+
type: "text",
|
|
239
|
+
event: "notice",
|
|
240
|
+
},
|
|
241
|
+
].filter((item) => item),
|
|
115
242
|
},
|
|
116
243
|
].filter((item) => item);
|
|
117
244
|
},
|
|
118
245
|
},
|
|
119
246
|
created() {
|
|
120
247
|
this.initSearchForm();
|
|
248
|
+
getOptions({
|
|
249
|
+
server: 'finance-partner',
|
|
250
|
+
fn: 'wallet/notify-config',
|
|
251
|
+
path: 'p1',
|
|
252
|
+
}).then(res => {
|
|
253
|
+
this.optionsData = res.data;
|
|
254
|
+
this.weekData = res.data['frequency_val_week_list'];
|
|
255
|
+
});
|
|
121
256
|
},
|
|
122
257
|
methods: {
|
|
123
|
-
...mapActions("wallet", ["listOpenApiWallet"]),
|
|
124
|
-
//相除
|
|
258
|
+
...mapActions("wallet", ["listOpenApiWallet", "channelAmountNotice", "notifyConfigGet", "notifyConfigSet"]),
|
|
125
259
|
divide(price) {
|
|
126
260
|
return this.$xdHelper.divisionFloatNumber(price, 100);
|
|
127
261
|
},
|
|
@@ -153,7 +287,6 @@ export default {
|
|
|
153
287
|
* @description 获取数据列表
|
|
154
288
|
*/
|
|
155
289
|
getList() {
|
|
156
|
-
//请求数据
|
|
157
290
|
let params = {
|
|
158
291
|
...this.searchParams,
|
|
159
292
|
page_token: this.page_token,
|
|
@@ -198,8 +331,144 @@ export default {
|
|
|
198
331
|
open_user_name: row.open_user_name,
|
|
199
332
|
},
|
|
200
333
|
});
|
|
334
|
+
} else if (value.event === "notice") {
|
|
335
|
+
this.wallet_type = row.wallet_type;
|
|
336
|
+
this.owner_id = row.open_user_id;
|
|
337
|
+
this.editRow = row;
|
|
338
|
+
// 获取已有配置并回显
|
|
339
|
+
this.notifyConfigGet({owner_id: row.open_user_id, event: "opt"}).then(res => {
|
|
340
|
+
let confResult = res.data.config_result;
|
|
341
|
+
if (res.data.config_result.frequency_val) {
|
|
342
|
+
res.data.config_result.frequency_val = JSON.parse(res.data.config_result.frequency_val);
|
|
343
|
+
}
|
|
344
|
+
if (res.data.config_result.frequency_time_val) {
|
|
345
|
+
res.data.config_result.frequency_time_val = JSON.parse(res.data.config_result.frequency_time_val);
|
|
346
|
+
}
|
|
347
|
+
this.customForm = {
|
|
348
|
+
frequency_type: res.data.config_result['frequency_type'] || '',
|
|
349
|
+
frequency_val: res.data.config_result['frequency_val'] || [],
|
|
350
|
+
frequency_time_val: res.data.config_result['frequency_time_val'] || [],
|
|
351
|
+
};
|
|
352
|
+
let params = {
|
|
353
|
+
...res.data.config_result,
|
|
354
|
+
remind_threshold_amount: confResult.remind_threshold_amount
|
|
355
|
+
? this.divide(confResult.remind_threshold_amount)
|
|
356
|
+
: '',
|
|
357
|
+
};
|
|
358
|
+
this.initFormList(params);
|
|
359
|
+
this.showNoticeSetting = true;
|
|
360
|
+
}).catch(() => {
|
|
361
|
+
// 如果获取配置失败,使用默认值
|
|
362
|
+
let params = {
|
|
363
|
+
notify_mode: 'default',
|
|
364
|
+
remind_threshold_amount: row.remind_threshold_amount
|
|
365
|
+
? this.divide(row.remind_threshold_amount)
|
|
366
|
+
: '',
|
|
367
|
+
};
|
|
368
|
+
this.initFormList(params);
|
|
369
|
+
this.showNoticeSetting = true;
|
|
370
|
+
});
|
|
201
371
|
}
|
|
202
372
|
},
|
|
373
|
+
initFormList(params) {
|
|
374
|
+
let formList = [
|
|
375
|
+
{
|
|
376
|
+
label: '通知设置:',
|
|
377
|
+
ele: 'xd-radio',
|
|
378
|
+
valueKey: 'notify_mode',
|
|
379
|
+
value: params.notify_mode || 'default',
|
|
380
|
+
list: this.optionsData['notify_mode_list'],
|
|
381
|
+
rules: [
|
|
382
|
+
{ required: true, message: '请选择通知设置', trigger: 'change' },
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
label: '提醒阈值:',
|
|
387
|
+
ele: 'xd-input-unit',
|
|
388
|
+
valueKey: 'remind_threshold_amount',
|
|
389
|
+
value: params.remind_threshold_amount || '5000',
|
|
390
|
+
setting: {
|
|
391
|
+
unit: '元', pos: 'append',
|
|
392
|
+
before: "余额不足",
|
|
393
|
+
tips:"时触发通知"
|
|
394
|
+
},
|
|
395
|
+
rules: [
|
|
396
|
+
{ required: true, message: '请输入阈值', trigger: 'blur' },
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
params.notify_mode === 'default' && {
|
|
400
|
+
label: '通知频次:',
|
|
401
|
+
ele: 'el-html',
|
|
402
|
+
value: this.optionsData['default_time_tip']
|
|
403
|
+
},
|
|
404
|
+
params.notify_mode === 'custom' && {
|
|
405
|
+
label: '通知频次:',
|
|
406
|
+
ele: 'slot',
|
|
407
|
+
slot: 'set'
|
|
408
|
+
},
|
|
409
|
+
].filter(i => i);
|
|
410
|
+
this.setFormList = formList;
|
|
411
|
+
this.randomKey = Date.now();
|
|
412
|
+
},
|
|
413
|
+
handleNoticeSetting() {
|
|
414
|
+
this.$refs.setForm.submit().then(() => {
|
|
415
|
+
if (this.setFormParams.notify_mode === 'custom') {
|
|
416
|
+
if (!this.customForm.frequency_type) {
|
|
417
|
+
this.$message({
|
|
418
|
+
type: 'error',
|
|
419
|
+
message: '通知频次不能为空',
|
|
420
|
+
});
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (this.customForm.frequency_type === 'day') {
|
|
424
|
+
if (!this.customForm.frequency_type || this.customForm.frequency_time_val.length === 0) {
|
|
425
|
+
this.$message({
|
|
426
|
+
type: 'error',
|
|
427
|
+
message: '请填写完整通知频次信息'
|
|
428
|
+
});
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
} else if (this.customForm.frequency_type === 'week') {
|
|
432
|
+
if (!this.customForm.frequency_type || this.customForm.frequency_val.length === 0 || this.customForm.frequency_time_val.length === 0) {
|
|
433
|
+
this.$message({
|
|
434
|
+
type: 'error',
|
|
435
|
+
message: '请填写完整通知频次信息'
|
|
436
|
+
});
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
let copySetFormParams = this.$xdHelper.cloneDeep(this.setFormParams);
|
|
442
|
+
let copyCustomForm = this.$xdHelper.cloneDeep(this.customForm);
|
|
443
|
+
if (copySetFormParams.notify_mode === 'default') {
|
|
444
|
+
delete copyCustomForm['frequency_type'];
|
|
445
|
+
delete copyCustomForm['frequency_val'];
|
|
446
|
+
delete copyCustomForm['frequency_time_val'];
|
|
447
|
+
}
|
|
448
|
+
if (copyCustomForm.frequency_type === 'day') {
|
|
449
|
+
copyCustomForm.frequency_val = [];
|
|
450
|
+
}
|
|
451
|
+
if (copyCustomForm.frequency_time_val) {
|
|
452
|
+
copyCustomForm.frequency_time_val = JSON.stringify(this.customForm.frequency_time_val);
|
|
453
|
+
}
|
|
454
|
+
if (copyCustomForm.frequency_val) {
|
|
455
|
+
copyCustomForm.frequency_val = JSON.stringify(this.customForm.frequency_val);
|
|
456
|
+
}
|
|
457
|
+
// 先设置通知频次配置(阈值需要转换为分)
|
|
458
|
+
const configResult = { ...copySetFormParams, ...copyCustomForm, owner_id: this.editRow.open_user_id };
|
|
459
|
+
if (configResult.remind_threshold_amount) {
|
|
460
|
+
configResult.remind_threshold_amount = this.$xdHelper.multiplyFloatNumber(configResult.remind_threshold_amount, 100);
|
|
461
|
+
}
|
|
462
|
+
this.notifyConfigSet({ owner_id: this.editRow.open_user_id, event: "opt", config_result: configResult }).then(() => {
|
|
463
|
+
this.$message({
|
|
464
|
+
type: 'success',
|
|
465
|
+
message: '设置成功'
|
|
466
|
+
});
|
|
467
|
+
this.showNoticeSetting = false;
|
|
468
|
+
this.getList();
|
|
469
|
+
}).catch(() => {});
|
|
470
|
+
}).catch(() => {});
|
|
471
|
+
},
|
|
203
472
|
/**
|
|
204
473
|
* @description 初始化搜索模块
|
|
205
474
|
*/
|
|
@@ -250,7 +519,7 @@ export default {
|
|
|
250
519
|
handlePagination(page) {
|
|
251
520
|
this.page_token = page;
|
|
252
521
|
this.getList();
|
|
253
|
-
},
|
|
522
|
+
},
|
|
254
523
|
},
|
|
255
524
|
};
|
|
256
525
|
</script>
|