index.vue
32.1 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
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
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
<template>
<div>
<div class="scrm-sub-client-container">
<!-- <p class="pageTitle">客户管理</p> -->
<!-- :style="{ 'min-height': heightBox + 'px' }" -->
<div class="pageContent">
<GLCombiForm ref="combiForm" :rowNumber="1" :formObj="searchForm" :formData="clientManageFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<div class="leadList">
<div>
<span></span>
</div>
<!-- <GLButton size="small" @click="handleExport" fn="导出">导出</GLButton> -->
<el-button @click="handleDrawer" icon="el-icon-position">ChatGPT</el-button>
</div>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="clientManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchFormTable" :noDataImg="url" :pageConf="pageConf" :tableParams="tableParams">
<span slot="customerName" slot-scope="scope">
<GLFull :labelWidth="70" :identification="`node_${scope.scope.id}`">{{ scope.scope.customerName ? scope.scope.customerName : '--' }}</GLFull>
</span>
<!-- <span slot="customerSex" slot-scope="scope" >-->
<span slot="customerSex" slot-scope="scope">
<span>{{ ['-', '男', '女'][scope.scope.customerSex] }}</span>
</span>
<!-- 企微名称 -->
<div slot="nickNameList" slot-scope="scope" class="expandImg">
<div v-if="!scope.scope.nickNameList.length">--</div>
<div v-for="(list, idx) in scope.scope.nickNameList" :key="idx">
<div v-if="idx == 0">
<span>{{ list.nickName }}</span>
<span class="smallFontSize" :class="[list.type == 1 ? 'pure-green-text' : '', list.type == 2 ? 'pure-yello-text' : '']">@{{ list.corpName }}</span>
</div>
<span v-if="idx == 1">
<el-popover placement="right-start" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<div v-for="(i, index) in scope.scope.nickNameList" :key="index" style="padding-bottom: 3px !important">
<span>{{ i.nickName }}</span>
<span style="height: 20px; font-size: 12px; letter-spacing: 0; line-height: 20px; font-weight: 400; margin-left: 2px" :class="[i.type == 1 ? 'pure-green-text' : '', i.type == 2 ? 'pure-yello-text' : '']">@{{ i.corpName }}</span>
</div>
<img class="imgEll" src="@/assets/tagsManage/ellipsis.png" alt="" slot="reference" />
</el-popover>
</span>
</div>
</div>
<span slot="customerPhone" slot-scope="scope">
<span>{{ scope.scope.customerPhone == null ? '--' : scope.scope.customerPhone }}</span>
</span>
<span slot="addWay" slot-scope="scope">
<el-tooltip effect="dark" :content="toLabel(scope.scope.addWay)" placement="top">
<span style="display: inline-block; max-width: 120px; text-align: left">{{ toLabel(scope.scope.addWay) }}</span>
</el-tooltip>
</span>
<!-- subscribe -->
<span slot="subscribe" slot-scope="scope">
<span>{{ scope.scope.subscribe == '1' ? '是' : '否' }}</span>
</span>
<span slot="isLoginApplet" slot-scope="scope">
<span>{{ scope.scope.isLoginApplet == '1' ? '是' : '否' }}</span>
</span>
<span slot="isJoin" slot-scope="scope">
<span>{{ scope.scope.isJoin ? '是' : '否' }}</span>
</span>
<span slot="status" slot-scope="scope">
<span class="statusText">
<span :class="{ circleStatusGray: scope.scope.status === -1, circleStatusGreen: scope.scope.status == 0 }"></span>
<span>{{ statusText(scope.scope.status) }}</span>
</span>
</span>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="goDetail(scope.scope.oneId)">详情</el-button>
<!-- <GLButton @click="goDetail(scope.scope.oneId)" fn="客户详情" type="text">详情</GLButton> -->
</div>
</GLTable>
</div>
<el-drawer title="" :visible.sync="drawer" :with-header="false">
<el-form ref="orderform" :model="orderform" class="order-form">
<div class="order">
<el-form-item label="输入内容">
<el-input type="textarea" v-model="orderform.order" rows="3" :clearable="true" :placeholder="`例如:${placeholder}`"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" @click="handleResetOrder">重置</el-button>
<el-button type="primary" size="small" @click="handleOrder" :disabled="disabled" icon="el-icon-position">{{ disabled ? '解析中...' : '确定' }}</el-button>
</el-form-item>
</div>
<div class="result">
<el-form-item label="解析结果">
<template slot="label">
<span v-if="gptRequest">
<!-- <span v-if="chatLoading"> -->
正在处理
<i class="el-icon-loading"></i>
</span>
<span v-else>解析结果</span>
</template>
<el-input type="textarea" v-model="orderform.result" rows="4"></el-input>
</el-form-item>
</div>
</el-form>
</el-drawer>
</div>
</div>
</template>
<script>
import { getTableList, getDictionaryFun, getStaffList, syncCustomer, clientManageExportApi } from '@/api/modules/clientManage'
import url from '@/assets/clientDataOverview/nodata.png'
import * as dayjs from 'dayjs'
export default {
name: 'clientManage',
data() {
return {
// chatLoading: true,
isReload: true,
url: url,
sloading: false,
CLIENTSTATUS: this.$Constants.CLIENT_STATUS,
searchForm: {
addWay: '',
isJoin: null
},
searchFormTable: {},
clientManageFormList: [
// {
// type: 'input',
// inputType: 'text',
// // prop: 'customerPhone',
// name: 'customerPhone',
// label: '联系电话',
// placeholder: '联系电话'
// },
// {
// type: 'select',
// name: 'followStaff',
// // prop: 'followStaff',
// noFilter: false,
// optionLabel: 'label',
// optionId: 'value',
// label: '跟进员工',
// placeholder: '请输入跟进员工',
// optionList: []
// },
// {
// type: 'input',
// inputType: 'text',
// // prop: 'customerName',
// name: 'customerName',
// label: '客户名称',
// placeholder: '请输入客户名称'
// },
// {
// type: 'input',
// inputType: 'text',
// // prop: 'nickName',
// name: 'nickName',
// label: '企微名称',
// placeholder: '请输入企微名称'
// },
// {
// type: 'select',
// // prop: 'isJoin',
// name: 'isJoin',
// label: '是否已加企微',
// placeholder: '请选择',
// optionLabel: 'label',
// optionId: 'value',
// optionList: [
// {
// label: '全部',
// value: null
// },
// {
// label: '是',
// value: 1
// },
// {
// label: '否',
// value: 0
// }
// ]
// },
// {
// type: 'select',
// // prop: 'status',
// name: 'status',
// label: '当前状态',
// placeholder: '请选择当前状态',
// optionLabel: 'optionLabel',
// optionId: 'optionId',
// optionList: [
// {
// optionLabel: '全部',
// optionId: null
// },
// {
// optionLabel: '正常',
// optionId: 0
// },
// {
// optionLabel: '删除好友',
// optionId: -1
// }
// ]
// },
// {
// type: 'datePicker',
// // prop: 'daterange',
// name: 'daterange',
// label: '添加时间',
// valueFormat: 'yyyy-MM-dd',
// pickerOptions: {
// disabledDate(time) {
// return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
// }
// }
// },
// {
// type: 'select',
// // prop: 'addWay',
// name: 'addWay',
// label: '添加来源',
// optionLabel: 'label',
// optionId: 'value',
// placeholder: '请选择当前来源',
// optionList: [] //this.$Constants.SOURCE_OPTION
// },
{
type: 'select',
// prop: 'customerSex',
name: 'customerSex',
label: '性别',
optionLabel: 'label',
optionId: 'value',
placeholder: '请选择性别',
optionList: this.$Constants.GENDER_OPTION
},
{
type: 'datePicker',
name: 'purchaseCar',
label: '购车时间',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
},
// {
// type: 'input',
// inputType: 'text',
// name: 'carVin',
// label: '车架号'
// },
{
type: 'input',
inputType: 'text',
name: 'carNumber',
label: '车牌号'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
listName: 'data',
tableOption: false,
// mutiSelectName: 'employeeList',
// mutiSelectUniqueKey: 'id',
tableColumns: [
// {
// label: '客户ID',
// prop: 'oneId',
// width: 290,
// line: 1
// },
{
label: '客户名称',
prop: 'customerName',
addHtml: 'customerName',
width: 150,
line: 1
},
// {
// label: '企微名称',
// prop: 'nickNameList',
// addHtml: 'nickNameList',
// width: 190
// },
{
label: '联系电话',
prop: 'customerPhone',
addHtml: 'customerPhone',
width: 130
},
{
label: '性别',
prop: 'customerSex',
addHtml: 'customerSex',
width: 80
},
// {
// label: '跟进员工',
// prop: 'followStaff',
// // addHtml: 'followStaff',
// width: 320
// },
// {
// label: '是否加企微', //1. 加入,0.未加入
// prop: 'isJoin',
// addHtml: 'isJoin',
// width: 120
// },
// {
// label: '当前状态',
// prop: 'status',
// addHtml: 'status',
// width: 120
// },
// {
// label: '所属渠道',
// prop: 'sourceChannel',
// width: 140,
// line: 1
// },
// {
// label: '添加来源',
// prop: 'addWayName',
// width: 120
// },
// {
// label: '添加时间',
// prop: 'addTime',
// width: 170
// },
// {
// label: '车系',
// prop: 'audi',
// width: 250,
// line: 1
// },
// {
// label: '车架号',
// prop: 'carVin',
// line: 1
// },
{
label: '车牌号',
prop: 'carNumber',
width: 180,
line: 1
},
{
label: '购车日期',
prop: 'buyDate',
line: 1
},
{
label: '营销文案',
prop: 'content',
width: 600,
fixed: 'right'
},
{
label: '操作',
prop: 'optionBtns',
width: '66px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
getListApi: getTableList,
merchantModel: 1,
sourceList: [],
followstaffList: [],
queryFlag: 0,
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
flushTime: false,
orderform: { order: '', result: '' },
disabled: false,
placeholder: '为购车时间在5年内的陕西省的男性车主准备五一节主题的营销',
drawer: false,
gptRequest: false,
keys: {
subject: '',
festival: ''
}
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
}
if (location.host.includes('cgacar')) {
// cgacar
this.clientManageFormList.push(
{
type: 'select',
name: 'subscribe',
label: '关注公众号',
placeholder: '请选择',
optionLabel: 'label',
optionId: 'value',
optionList: [
{
label: '全部',
value: null
},
{
label: '是',
value: 1
},
{
label: '否',
value: 0
}
]
},
{
type: 'select',
name: 'isLoginApplet',
label: '登录小程序',
placeholder: '请选择',
optionLabel: 'label',
optionId: 'value',
optionList: [
{
label: '全部',
value: null
},
{
label: '是',
value: 1
},
{
label: '否',
value: 0
}
]
}
)
this.tableParams.tableColumns.splice(
6,
0,
{
label: '关注公众号',
prop: 'subscribe',
width: 140,
line: 1,
addHtml: 'subscribe'
},
{
label: '登录小程序',
prop: 'isLoginApplet',
width: 140,
line: 1,
addHtml: 'isLoginApplet'
}
)
}
this.getDictionaryFun()
this.getStaffList()
},
// filters:{
// // 截取@后面的文字
// cutText(str){
// let index = str.lastIndexOf("\@")
// start = str.substring(0,index)
// res = str.substring(index+1,str.length)
// return
// }
// },
methods: {
followList(str) {
if (!str) {
return []
}
return str.split(',')
},
statusText(text) {
return text === -1 ? '删除好友' : text === 0 ? '正常' : ''
},
setTableHeightEvent() {
this.$refs.clientManage.setTableHeightFun()
},
setTableFinishFun() {
let list = this.$refs.clientManage.data
if (!list?.length) return
list = list.map(element => {
if (element.buyDate) {
element.buyDate = element.buyDate.split(' ')[0]
}
return element
})
// this.$refs.clientManage.data.length ? (this.$refs.clientManage.tableHeightValues = '') : this.$refs.clientManage.setTableHeightFun()
console.log('setTableFinishFun')
this.getGptList()
},
getParams() {
let params = JSON.parse(JSON.stringify(this.searchForm))
if (params.daterange) {
params.beginTime = this.searchForm.daterange[0]
params.endTime = this.searchForm.daterange[1]
} else {
if (params.beginTime) delete params.beginTime && delete params.endTime
}
if (params.purchaseCar) {
params.beginCarBuyDate = this.searchForm.purchaseCar[0]
params.endCarBuyDate = this.searchForm.purchaseCar[1]
} else {
if (params.beginCarBuyDate) delete params.beginCarBuyDate && delete params.endCarBuyDate
}
delete params.daterange
delete params.purchaseCar
return params
},
beforeSearchFn() {
return new Promise(async resolve => {
if (Object.keys(this.$route.query).length && this.queryFlag == 0) {
const res = JSON.parse(window.localStorage.getItem('sourceList'))
let add_way = this.$route.query.addWay || ''
let isJoinVal = this.$route.query.isJoin || null
let addWayObj = res.find(i => i.label === add_way)
this.searchForm.addWay = addWayObj.value
this.searchForm.isJoin = isJoinVal === null ? null : Number(isJoinVal)
setTimeout(() => {
this.$refs.combiForm.expandFn()
}, 100)
// document.querySelector('.operate').lastElementChild.click()
this.queryFlag = 1
}
this.searchFormTable = this.getParams()
resolve()
})
},
getDictionaryFun() {
getDictionaryFun({ dictType: 'add_way' }).then(res => {
if (!res) {
return
}
// addWaySource
const id = this.clientManageFormList.findIndex(item => {
return item.name == 'addWay'
})
let data = res.map(item => {
return {
// ...item,
label: item.dictLabel,
value: item.dictValue
}
})
data.unshift({ label: '全部', value: '' })
this.sourceList = data || []
if (data && data.length > 0) {
window.localStorage.setItem('sourceList', JSON.stringify(data))
}
this.$set(this.clientManageFormList[id], 'optionList', data)
})
},
getStaffList(val) {
const params = {
staffName: val ? val.trim() : ''
}
getStaffList(params).then(res => {
if (res.length == 0) {
return ''
}
const id = this.clientManageFormList.findIndex(item => {
return item.name == 'followStaff'
})
const staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({ label: '全部', value: '' })
this.followstaffList = staff
this.$nextTick(() => {
this.clientManageFormList[id].optionList = staff
})
})
},
//来源 value值转为对应label
toLabel(value) {
if (value !== 0 && !value) {
return
}
let curElement = this.sourceList.find(item => {
return item.value === value
})
return curElement.label
},
handleDrawer() {
this.drawer = true
},
//导出
handleExport() {
let params = this.getParams()
clientManageExportApi(params).then(res => {
this.$Utils.exportFn(res)
})
},
//搜索表格
searchTable() {
this.$refs.clientManage.refreshTable()
},
syncClick() {
let _this = this
_this.sloading = true
syncCustomer({})
.then(res => {
if (!res) {
return false
}
_this.sloading = false
_this.$message.success('已同步客户')
_this.$refs.clientManage.refreshTable()
})
.catch(err => {
_this.sloading = false
})
},
//重置表格
resetTable() {
Object.assign(this.keys, { subject: '', festival: '' })
this.orderform.result = ''
this.gptRequest = false
this.disabled = false
this.searchForm = {}
this.$refs.clientManage.refreshTable()
// 点击之后强制页面刷新
// this.reload()
// this.$forceUpdate() // 没用
// this.$router.go(0)//没有预期效果,会出现一段空白页,用户体验不好
// location.reload() //没有预期效果,会出现一段空白页,用户体验不好
},
goDetail(id) {
this.$router.push({
path: '/clientManage/clientDetail',
query: {
id: id
}
})
},
async handleOrder() {
this.disabled = true
this.gptRequest = true
this.searchForm = {}
// this.resetTable()
// const tagsAll = this.tableParams.reduce((tags, next) => {
// tags += next.labelUnitList.map(({ labelName }) => labelName).join(',')
// return tags + ','
// }, '')
// 取值范围是:"${tagsAll}"输出json格式`
// 帮我创建一个人群名为测试群,描述为test,未加企微的客户。
// 帮我创建一个人群名为名车群,描述为名车车主群。去年和今年3月到4月间购车的奥迪和宝马车主。
// 帮我创建一个人群名为名车群,描述为名车车主群。去年和今年3月到4月间购车的奥迪和宝马有试驾的车主。
// 帮我创建一个人群名为名车群,描述为名车车主群。近两年购车的奥迪和宝马的30岁以下的有保养记录和试驾记录的男性车主。
//,取值范围:"'2020年','2021年','2022年','2023年','2000年','2001年','2002年','2003年'";
//,取值范围:"'1月','2月','3月','4月','5月','6月','7月','8月',9月,10月,11月,12月";
//,取值范围为:"'有','无'"
//取值范围为:"'30岁以下','31-40岁','41-55岁'",
// 提取出购车月份,命名为buyMonth,例如5月,用数组输出;
// tags包括上面的购车年份,命名为buyYear,购车月份,命名为buyMonth,车型,命名为brand,是否保养,命名为maintain
// 提取出是否已加企微,命名为isJoin,取值范围为:"'','1','0'",''表示全部,'1'表示是,'0'表示否;
// 提取出客户名称,命名为customerName;
//提取出车架号,命名为carVin;
//提取出联系电话(手机号),命名为customerPhone,不用补全;
// 提取出开始时间,命名为beginDate,格式为:yyyy-MM-dd,例如:2022-11-12,只有以上文字包含"购车"或者"时间"才提取,不然取值'';
//提取出结束时间,命名为endDate,格式为:yyyy-MM-dd,例如:2022-11-12,只有以上文字包含"购车"或者"时间"才提取,不然取值'';
//具体城市则取值省简称加字母,比如
//或者车牌号
if (this.orderform.order == '') {
this.orderform.order = this.placeholder
}
Object.assign(this.keys, { subject: '', festival: '' })
const order = this.orderform.order
// const content = '帮我查询从2023-3-29日至2023-04-05日期间西安飞广州或者深圳的机票,从上面一句话中提取出发日期,命名为date,出发地,命名为start,目的地,命名为end,输出json格式。'
const content = `${order},针对上面这段文字,
提取出营销相关的关键字,命名为subject,输出数组格式;
如果有提到购车时间,则提取出购车时间范围,命名为beginDate和endDate,格式为:yyyy-MM-dd,例如:2022-11-12;
提取出节日,命名为festival,如果是数字,转化成大写,例如:五一节;
提取出车主归属地,命名为carNumber,如广东的车主,则取值为"粤",广州的车主取值"粤A";
提取出性别,命名为customerSex,取值范围:"0,1,2",0表示全部,1表示男,2表示女;
所有提取的字段未精确匹配到的不提取和输出。
今天是${dayjs(new Date()).format('YYYY年MM月DD日')}。
中国各省车牌开头的列表:京:北京;津:天津;冀:河北;晋:山西;蒙:内蒙古;辽:辽宁;吉:吉林;黑:黑龙江;沪:上海;苏:江苏;浙:浙江;皖:安徽;闽:福建;赣:江西;鲁:山东;豫:河南;鄂:湖北;湘:湖南;粤:广东;桂:广西;琼:海南;渝:重庆;川:四川;贵:贵州;云:云南;藏:西藏;陕:陕西;甘:甘肃;青:青海;宁:宁夏;新:新疆;
输出json格式`
const result = await this.$apis.crowdManage.gpt(content)
this.disabled = false
this.orderform.result = JSON.stringify(result)
const { code, success, message, data } = result
if (code == '000000' && success) {
if (!data) {
this.$message.error('生成查询异常,请重试!')
return
}
const { subject = [], festival, beginDate, endDate, ...others } = data
this.keys = { subject: subject.join(','), festival }
//searchForm
this.searchForm = { ...others, customerSex: data.customerSex == 0 || data.customerSex == null ? null : Number(data.customerSex) }
if (beginDate && endDate) {
this.searchForm.purchaseCar = [beginDate, endDate]
}
// 设置 searchForm
this.searchTable()
} else {
console.log('error')
this.gptRequest = false
this.$message.error(message || '生成查询异常,请重试!')
}
},
async handleResetOrder() {
await this.resetTable()
},
// 获取节日祝福语
async getGptList() {
console.log('获取祝福语')
console.log(this.gptRequest)
if (!this.gptRequest && !this.keys.subject) {
return false
}
if (this.$refs.orderform) {
this.$refs.orderform.resetFields()
}
this.gptRequest = false
this.drawer = false
let list = this.$refs.clientManage.data
console.log('666666666666')
list = list.map(element => {
element.content = '正在生成中...'
return element
})
// let content = '我有一批客户,资料(id,customerName,customerSex,customerPhone,buyDate,carVin,carNumber) 分别是:'
// let content = `现在是2023年,我有${list.length}个客户资料分别是:`
// let cutomerInfo = []
// for (let index = 0; index < list.length; index++) {
// let { customerName, customerSex, customerPhone, buyDate, carVin, carNumber } = list[index]
// // const content = `忽略之前的上下文,对姓名为${k.customerName}客户,${k.customerName}是一个人,性别为${{ 1: '男', 2: '女' }[k.customerSex] || '先生/女士'},客户手机号为${k.customerPhone},${k.customerPhone}是客户的电话不是客服电话;生成一条最少100字的4s店新车营销文案,字段命名为content。只需content一个字段即可;输出json格式`
// // console.log(content, 'content') 车架号:${carVin},
// cutomerInfo.push(`客户${index + 1},姓名:${customerName},性别:${{ 1: '男', 2: '女' }[customerSex] || '先生/女士'},电话:${customerPhone},购车日期:${buyDate},车牌号:${carNumber}`)
// }
// content += `${cutomerInfo.join(';')};请根据客户的特征,分别为每个客户生成一条50字左右关于${this.keys.subject || ''}的营销文案。字段命名为content;整条结果以数组输出,命名为customers。输出json格式.`
let content = `今天是${dayjs(new Date()).format('YYYY年MM月DD日')}。请帮我生成一条50字左右的营销文案。关键字:${this.keys.festival || ''} ${this.keys.subject || ''};字段命名为content;输出json格式.`
// this.$apis.crowdManage.gpt(content).then(result => {
// const { code, success, message, data } = result
// if (code == '000000' && success) {
// // if (!result.data) {
// // this.$message.error('生成文案异常,请重试!')
// // return
// // }
// // console.log(result)
// // let _obj = result.data
// // this.$refs.clientManage.data[index].content = _obj.content
// // this.$refs.clientManage.data = this.$refs.clientManage.data
// list.map((k, i) => {
// k.content = result?.data?.customers[i]?.content || '生成文案异常,请重试!'
// const { customerName, customerSex, customerPhone } = k
// k.content &&
// k.content != '生成文案异常,请重试!' &&
// setTimeout(() => {
// this.$notify({
// title: `发送成功!`,
// message: `${customerName}${{ 1: '先生', 2: '女士' }[customerSex] || '先生/女士'},手机号:${customerPhone} 发送成功.`,
// type: 'success'
// })
// }, i * 1000)
// return k
// })
// this.$forceUpdate()
// } else {
// this.$message.error(message || '生成文案异常,请重试!')
// }
// })
this.$apis.crowdManage.gpt(content).then(result => {
const { code, success, message } = result
const _content = result?.data?.content
if (code == '000000' && success) {
list.map((k, i) => {
const { customerName, customerSex, customerPhone } = k
const user = `${customerName}${{ 1: '先生', 2: '女士' }[customerSex] || '先生/女士'}`
if (_content) {
k.content = `尊敬的${user}: ${_content}`
setTimeout(() => {
this.$notify({
title: `发送成功!`,
message: `${user},手机号:${customerPhone} 发送成功.`,
type: 'success'
})
}, i * 1000)
} else {
k.content = '生成文案异常,请重试!'
}
return k
})
this.$forceUpdate()
} else {
this.$message.error(message || '生成文案异常,请重试!')
}
})
}
},
mounted() {}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
// /deep/.el-table .el-table__header tr th{
// line-height: 30px;
// }
/deep/.glsx-combi-formwrap {
width: 100%;
.glsx-combi-form {
.gl-search {
.glsx-combi-form-block {
display: flex !important;
justify-content: space-around !important;
.el-form-item--small {
&#purchaseCar {
width: 100%;
}
}
}
}
}
}
/deep/.el-drawer {
&__body {
.order-form {
padding: 0 30px;
}
}
}
.expandImg {
display: flex;
// justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.scrm-sub-client-container {
.pageTitle {
margin-bottom: 20px;
position: relative;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
border: 1px solid #5850ff;
}
}
padding: 20px 20px 30px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.searchTop {
// margin-bottom: 20px;
}
.glsx-table {
// /deep/ .el-table__fixed {
// height: 100% !important; //设置高优先,以覆盖内联样式
// }
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
.entmicro {
display: flex;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
// }
}
.el-tag {
// margin-right: 10px;
max-width: 110px;
cursor: pointer;
background-color: #fff !important;
}
}
}
.gpt_box {
display: flex;
.left {
flex: 1;
}
.right {
flex-shrink: 0;
width: 400px;
margin-left: 40px;
}
}
</style>