index.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536
  1. <template>
  2. <div class="tenant">
  3. <!-- <div style="padding: 20px; background: #fff; margin-bottom: 20px">
  4. <el-button type="primary" style="margin-left: 10px" @click="openModal()">添加客户</el-button>
  5. </div> -->
  6. <div style="display:flex;height:calc(100vh - 140px);">
  7. <div style="width:240px;height:100%;overflow:auto;background:#fff;padding:10px">
  8. <div style="margin-bottom:10px">
  9. <el-button type="primary" style="width:100%" @click="handleSearch()">全部客户</el-button>
  10. </div>
  11. <el-collapse v-model="activeNames">
  12. <el-collapse-item title="客户跟进" name="1">
  13. <template #title>
  14. <div>
  15. <!-- <img src="@/assets/images/custom-1.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
  16. 客户跟进 -->
  17. <TitleInfo :content="'客户跟进'"></TitleInfo>
  18. </div>
  19. </template>
  20. <div style="padding:0 10px">
  21. <div style="display:flex;justify-content:space-between;cursor:pointer" :class="{'activeSearch':(4+'follow')==activeSearch}"
  22. @click="handleSearchOne(4)">
  23. <span>近7天有跟进</span> <span>{{leftDataFour[0]}}</span>
  24. </div>
  25. <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
  26. :class="{'activeSearch':(1+'follow')==activeSearch}" @click="handleSearchOne(1)">
  27. <span>超7天未跟进</span> <span>{{leftDataFour[7]}}</span>
  28. </div>
  29. <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
  30. :class="{'activeSearch':(2+'follow')==activeSearch}" @click="handleSearchOne(2)">
  31. <span>超30天未跟进</span> <span>{{leftDataFour[30]}}</span>
  32. </div>
  33. <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
  34. :class="{'activeSearch':(3+'follow')==activeSearch}" @click="handleSearchOne(3)">
  35. <span>超半年未跟进</span> <span>{{leftDataFour[180]}}</span>
  36. </div>
  37. </div>
  38. </el-collapse-item>
  39. <el-collapse-item title="客户来源" name="2">
  40. <template #title>
  41. <div>
  42. <!-- <img src="@/assets/images/custom-2.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
  43. 客户来源 -->
  44. <TitleInfo :content="'客户来源'"></TitleInfo>
  45. </div>
  46. </template>
  47. <div style="padding:0 10px">
  48. <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerSource" :key="item.value"
  49. :class="{'activeSearch':(item.value+'source')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
  50. @click="handleSearch(item.value,'source')">
  51. <span>{{item.label}}</span> <span>{{showLeftData(item.value,'source')}}</span>
  52. </div>
  53. </div>
  54. </el-collapse-item>
  55. <el-collapse-item title="客户类型" name="3">
  56. <template #title>
  57. <div>
  58. <!-- <img src="@/assets/images/custom-4.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
  59. 客户类型 -->
  60. <TitleInfo :content="'客户类型'"></TitleInfo>
  61. </div>
  62. </template>
  63. <div style="padding:0 10px">
  64. <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerStatus" :key="item.value"
  65. :class="{'activeSearch':(item.value+'status')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
  66. @click="handleSearch(item.value,'status')">
  67. <span>{{item.label}}</span> <span>{{showLeftData(item.value,'status')}}</span>
  68. </div>
  69. </div>
  70. </el-collapse-item>
  71. <el-collapse-item title="客户标签" name="4">
  72. <template #title>
  73. <div>
  74. <!-- <img src="@/assets/images/custom-3.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
  75. 客户标签 -->
  76. <TitleInfo :content="'客户标签'"></TitleInfo>
  77. </div>
  78. </template>
  79. <div style="padding:0 10px">
  80. <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerTag" :key="item.value"
  81. :class="{'activeSearch':(item.value+'tag')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
  82. @click="handleSearch(item.value,'tag')">
  83. <span>{{item.label}}</span> <span>{{showLeftData(item.value,'tag')}}</span>
  84. </div>
  85. </div>
  86. </el-collapse-item>
  87. </el-collapse>
  88. </div>
  89. <div style="width:10px"></div>
  90. <div style="width:calc(100% - 250px);height:100%;overflow:auto">
  91. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :statConfig="[]"
  92. :selectConfig="selectConfig" highlight-current-row :action-list="[
  93. {
  94. text: '更新小满客户',
  95. action: () => updateList(),
  96. },
  97. ]" @moreSearch="moreSearch" @get-list="getList" ref="table">
  98. <!-- {
  99. text: '添加客户',
  100. action: () => openModal(),
  101. }, -->
  102. <template #isTop="{ item }">
  103. <div>
  104. <img style="cursor: pointer; width: 20px; transform: translateY(5px)" :src="'/img/isTop.png'" @click="deleteTop(item)"
  105. v-if="item.isTop === 1" />
  106. <img style="cursor: pointer; width: 20px; transform: translateY(5px)" :src="'/img/noTop.png'" @click="addTop(item)" v-else />
  107. </div>
  108. </template>
  109. <template #address="{ item }">
  110. <span>{{ item.countryName }}</span>
  111. <span v-if="item.provinceName"> ,{{ item.provinceName }}</span>
  112. <span v-if="item.cityName"> ,{{ item.cityName }}</span>
  113. </template>
  114. <template #name="{ item }">
  115. <div style="cursor: pointer; color: #409eff; word-break: break-all" @click="handleClickName(item)">
  116. {{ item.name }}
  117. </div>
  118. </template>
  119. <template #tags="{ item }">
  120. <div style="width: 100%">
  121. <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tag" closable :key="index" @close="tagClose(tag, item)">
  122. {{ dictValueLabel(tag, customerTag) }}
  123. </el-tag>
  124. <template v-if="item.tag.length !== customerTag.length">
  125. <el-select v-if="item.addTagShow" v-model="addTag" style="width: 100%" @change="
  126. (val) => {
  127. return changeTag(val, item);
  128. }
  129. ">
  130. <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value"
  131. :disabled="judgeTagSelect(item.tag, tag.value)" />
  132. </el-select>
  133. <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else>
  134. +
  135. </el-tag>
  136. </template>
  137. </div>
  138. </template>
  139. <template #companyId="{item}">
  140. <div style="width: 100%;">
  141. <div v-if="item.companyId" style="display:flex;justify-content:space-between">
  142. <span>{{item.companyId}}</span>
  143. <el-icon style="cursor:pointer;position:relative;top:6px" size="18" color="#409EFF" @click="handleDeleteCompanyId(item)">
  144. <Delete />
  145. </el-icon>
  146. </div>
  147. <div v-else style="text-align:right"><el-icon style="cursor:pointer" size="18" color="#409EFF" @click="handleBindCompanyId(item)">
  148. <CirclePlus />
  149. </el-icon></div>
  150. </div>
  151. </template>
  152. <template #follow="{ item }">
  153. <div :class="'getWidth' + item.id" style="width: 100%">
  154. <div style="width: 100%; display: flex">
  155. <template v-if="
  156. item.customerFollowRecordsList &&
  157. item.customerFollowRecordsList.length > 0
  158. ">
  159. <div :style="
  160. index > 2
  161. ? 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer; display: none'
  162. : 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer'
  163. " v-for="(record, index) in item.customerFollowRecordsList" :key="record.id">
  164. <el-popover placement="bottom" :width="300" trigger="hover" @show="recordShow(record)">
  165. <template #reference>
  166. <div>
  167. <span v-if="record.date">{{
  168. record.date.substr(0, 10)
  169. }}</span>
  170. <el-icon style="margin-left: 8px; transform: translateY(2px)" @click="deleteFollow(record)">
  171. <DeleteFilled />
  172. </el-icon>
  173. </div>
  174. </template>
  175. <template #default>
  176. <div style="width: 100%">
  177. <div style="color: #909399; margin: 8px 0">
  178. 跟进时间: {{ record.date }}
  179. </div>
  180. <div style="margin-top: 8px">
  181. 跟进人:
  182. {{ dictValueLabel(record.createUser, userList) }}
  183. </div>
  184. <!-- <div style="margin-top: 8px">
  185. 跟进内容: {{ record.content }}
  186. </div> -->
  187. <div v-if="record.type == '30'">
  188. <div style="word-wrap: break-word; margin: 8px 0" v-html="getStyle(record.content)" v-if="record.content"></div>
  189. <div v-else>跟进记录:</div>
  190. </div>
  191. <div v-else>
  192. <div style="word-wrap: break-word; margin: 8px 0">
  193. {{ getContent(record) }}
  194. </div>
  195. </div>
  196. <div style="margin: 8px 0; display: flex" v-if="record.fileList && record.fileList.length > 0">
  197. <div style="width: 36px">附件:</div>
  198. <div style="width: calc(100% - 36px)">
  199. <div v-for="(file, index) in record.fileList" :key="index">
  200. <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </template>
  206. </el-popover>
  207. </div>
  208. <div style="
  209. line-height: 32px;
  210. margin-right: 8px;
  211. padding: 0 8px;
  212. background-color: #eeeeee;
  213. border-radius: 4px;
  214. cursor: pointer;
  215. " @click="clickMore(item)" v-if="item.customerFollowRecordsList.length >= 3">
  216. 更多
  217. </div>
  218. </template>
  219. </div>
  220. </div>
  221. </template>
  222. </byTable>
  223. </div>
  224. </div>
  225. <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="800">
  226. <AddCustomer ref="AddCustomerDom" :modalType="modalType" :customerId="customerId" @refreshList="refreshList"></AddCustomer>
  227. <template #footer>
  228. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  229. <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
  230. </template>
  231. </el-dialog>
  232. <el-dialog title="分配" v-if="openAllocation" v-model="openAllocation" width="300">
  233. <byForm :formConfig="formConfigAllocation" :formOption="formOption" v-model="formAllocation.data" :rules="rulesAllocation" ref="allocation">
  234. </byForm>
  235. <template #footer>
  236. <el-button @click="openAllocation = false" size="large">取 消</el-button>
  237. <el-button type="primary" @click="submitAllocation()" size="large">确 定</el-button>
  238. </template>
  239. </el-dialog>
  240. <el-dialog title="添加跟进记录" v-if="openFollow" v-model="openFollow" width="500" destroy-on-close>
  241. <byForm :formConfig="formConfigAFollow" :formOption="formOption" v-model="formFollow.data" :rules="rulesFollow" ref="follow">
  242. <template #fileSlot>
  243. <div style="width: 100%">
  244. <el-upload v-model:fileList="fileList" :action="uploadUrl" :data="uploadData" multiple :before-upload="uploadFile"
  245. :on-preview="onPreviewFile">
  246. <el-button type="primary">文件上传</el-button>
  247. </el-upload>
  248. </div>
  249. </template>
  250. </byForm>
  251. <template #footer>
  252. <el-button @click="openFollow = false" size="large">取 消</el-button>
  253. <el-button type="primary" @click="submitFollow()" size="large">确 定</el-button>
  254. </template>
  255. </el-dialog>
  256. <el-dialog title="跟进记录" v-if="openRecordMore" v-model="openRecordMore" width="800" destroy-on-close>
  257. <div>
  258. <div style="padding: 8px 0">
  259. <el-button type="primary" @click="clickFollowUp(rowData)" plain>添加跟进记录</el-button>
  260. </div>
  261. <div style="padding-top: 16px">
  262. <div v-infinite-scroll="infiniteScroll" class="infinite-scroll" :infinite-scroll-disabled="judgeTotal()">
  263. <el-timeline>
  264. <el-timeline-item v-for="(record, index) in recordList" :key="index" :timestamp="record.date" hide-timestamp>
  265. <div>
  266. <div style="
  267. padding: 0 0 8px 0;
  268. display: flex;
  269. justify-content: space-between;
  270. ">
  271. <span>{{
  272. dictValueLabel(record.createUser, userList)
  273. }}</span>
  274. <span>{{ record.date }}</span>
  275. </div>
  276. <div v-if="record.type == '30'">
  277. <div style="word-wrap: break-word; margin: 8px 0" v-html="getStyle(record.content)" v-if="record.content"></div>
  278. <div v-else>跟进记录:</div>
  279. </div>
  280. <div v-else>
  281. <div style="word-wrap: break-word; margin: 8px 0">
  282. {{ getContent(record) }}
  283. </div>
  284. </div>
  285. <div style="margin: 8px 0; display: flex" v-if="record.fileList && record.fileList.length > 0">
  286. <div style="width: 36px">附件:</div>
  287. <div style="width: calc(100% - 36px)">
  288. <div v-for="(file, index) in record.fileList" :key="index">
  289. <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. </el-timeline-item>
  295. </el-timeline>
  296. </div>
  297. </div>
  298. </div>
  299. <template #footer>
  300. <el-button @click="openRecordMore = false" size="large">关 闭</el-button>
  301. </template>
  302. </el-dialog>
  303. <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="600" :before-close="cancelSearch">
  304. <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
  305. <template #address>
  306. <el-row style="width: 100%">
  307. <el-col :span="8">
  308. <el-form-item prop="countryId">
  309. <el-select v-model="sourceList.pagination.countryId" placeholder="国家" clearable filterable
  310. @change="(val) => getCitySearchData(val, '20', true)">
  311. <el-option v-for="item in countrySearchData" :label="item.name" :value="item.id">
  312. </el-option>
  313. </el-select>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :span="8">
  317. <el-form-item prop="provinceName">
  318. <selectCity placeholder="省/洲" @change="(val) => getCitySearchData(val, '30', true)" addressId="provinceId" addressName="provinceName"
  319. v-model="sourceList.pagination" :data="provinceSearchData">
  320. </selectCity>
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="8">
  324. <el-form-item prop="cityName">
  325. <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="sourceList.pagination" :data="citySearchData">
  326. </selectCity>
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. </template>
  331. <template #tags>
  332. <div style="width: 100%">
  333. <el-tag style="margin-right: 8px" type="info" v-for="(tag, index) in sourceList.pagination.tags" closable :key="index"
  334. @close="tagSearchClose(tag)">
  335. {{ dictValueLabel(tag, customerTag) }}
  336. </el-tag>
  337. <template v-if="sourceList.pagination.tags.length !== customerTag.length">
  338. <el-select v-if="addTagSearchShow" v-model="addSearchTag" style="margin-top: 8px" @change="changeSearchTag">
  339. <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value" :disabled="
  340. judgeTagSelect(sourceList.pagination.tags, tag.value)
  341. " />
  342. </el-select>
  343. <el-tag style="cursor: pointer" type="info" @click="addTagSearchShow = true" v-else>
  344. +
  345. </el-tag>
  346. </template>
  347. </div>
  348. </template>
  349. </byForm>
  350. <template #footer>
  351. <el-button @click="cancelSearch()" size="large">取 消</el-button>
  352. <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
  353. </template>
  354. </el-dialog>
  355. <el-dialog title="手动绑定小满客户" v-if="xmDialog" v-model="xmDialog" width="600">
  356. <byForm :formConfig="xmFormConfig" :formOption="xmFormOption" v-model="xmFormData.data" :rules="xmRules" ref="xmFormDom">
  357. <template #companyId>
  358. <div style="width:100%;display:flex">
  359. <div style="width:calc(100% - 85px)">
  360. <el-form-item label="" prop="companyName" label-width="0px">
  361. <el-input disabled v-model="xmFormData.data.companyName" placeholder="请选择"></el-input>
  362. </el-form-item>
  363. </div>
  364. <el-button type="primary" style="width:68px;margin-left:15px" @click="openSelectXm = true" plain>选择</el-button>
  365. </div>
  366. </template>
  367. </byForm>
  368. <template #footer>
  369. <el-button @click="xmDialog = false" size="large">取 消</el-button>
  370. <el-button type="primary" @click="submitXmForm()" size="large">确 定</el-button>
  371. </template>
  372. </el-dialog>
  373. <el-dialog :title="'选择小满客户'" v-if="openSelectXm" v-model="openSelectXm" width="80%">
  374. <XmCustomer :isSelect="true" @selectXmCustomer="selectXmCustomer"></XmCustomer>
  375. <template #footer>
  376. <el-button @click="openSelectXm = false" size="large">取 消</el-button>
  377. </template>
  378. </el-dialog>
  379. </div>
  380. </template>
  381. <script setup>
  382. import { ElMessage, ElMessageBox } from "element-plus";
  383. import byTable from "@/components/byTable/index";
  384. import byForm from "@/components/byForm/index";
  385. import { computed, ref } from "vue";
  386. import useUserStore from "@/store/modules/user";
  387. import selectCity from "@/components/selectCity/index.vue";
  388. import TitleInfo from "@/components/TitleInfo/index.vue";
  389. import AddCustomer from "@/views/customer/addCustomer.vue";
  390. import XmCustomer from "@/views/xiaoman/index.vue";
  391. const AddCustomerDom = ref(null);
  392. const customerId = ref("");
  393. const { proxy } = getCurrentInstance();
  394. const activeNames = ref(["1", "2", "3", "4"]);
  395. const loading = ref(false);
  396. const submitLoading = ref(false);
  397. const openAllocation = ref(false);
  398. const customerTag = ref([]);
  399. const customerSource = ref([]);
  400. const customerStatus = ref([]);
  401. const contactType = ref([]);
  402. const userList = ref([]);
  403. const fileList = ref([]);
  404. const uploadData = ref({});
  405. const statisticsType = ref([
  406. {
  407. label: "客户来源统计",
  408. value: 1,
  409. },
  410. {
  411. label: "客户类型统计",
  412. value: 2,
  413. },
  414. {
  415. label: "业务员统计",
  416. value: 3,
  417. },
  418. ]);
  419. const sourceList = ref({
  420. data: [],
  421. pagination: {
  422. total: 0,
  423. pageNum: 1,
  424. pageSize: 10,
  425. keyword: "",
  426. type: "",
  427. source: "",
  428. status: "",
  429. name: "",
  430. countryId: "",
  431. provinceId: "",
  432. cityId: "",
  433. customerCode: "",
  434. userId: "",
  435. tag: "",
  436. tags: [],
  437. },
  438. paginationTwo: {
  439. statisticsType: 1,
  440. type: null,
  441. },
  442. });
  443. const statConfig = computed(() => [
  444. {
  445. label: "客户来源统计",
  446. data: [
  447. {
  448. label: "合计",
  449. num: statisticalData.value.countAmount,
  450. type: 2,
  451. },
  452. ...customerSource.value
  453. .filter((a) => getNum(a.value) > 0)
  454. .map((b) => {
  455. let num = getNum(b.value);
  456. return {
  457. label: b.label,
  458. num,
  459. type: 1,
  460. };
  461. }),
  462. ],
  463. },
  464. {
  465. label: "客户类型统计",
  466. data: [
  467. {
  468. label: "合计",
  469. num: statisticalData.value.countAmount,
  470. type: 2,
  471. },
  472. ...customerStatus.value
  473. .filter((a) => getNum(a.value) > 0)
  474. .map((b) => {
  475. let num = getNum(b.value);
  476. return {
  477. label: b.label,
  478. num,
  479. type: 1,
  480. };
  481. }),
  482. ],
  483. },
  484. {
  485. label: "业务员统计",
  486. data: [
  487. {
  488. label: "合计",
  489. num: statisticalData.value.countAmount,
  490. type: 2,
  491. },
  492. ...userList.value
  493. .filter((a) => getNum(a.value) > 0)
  494. .map((b) => {
  495. let num = getNum(b.value);
  496. return {
  497. label: b.label,
  498. num,
  499. type: 1,
  500. };
  501. }),
  502. ],
  503. },
  504. ]);
  505. const selectConfig = computed(() => {
  506. return [
  507. {
  508. label: "客户状态",
  509. prop: "type",
  510. data: [
  511. {
  512. label: "公海",
  513. value: "0",
  514. },
  515. {
  516. label: "私海",
  517. value: "1",
  518. },
  519. ],
  520. },
  521. {
  522. label: "客户来源",
  523. prop: "source",
  524. data: customerSource.value,
  525. },
  526. {
  527. label: "客户类型",
  528. prop: "status",
  529. data: customerStatus.value,
  530. },
  531. ];
  532. });
  533. const config = computed(() => {
  534. return [
  535. {
  536. attrs: {
  537. label: "",
  538. slot: "isTop",
  539. fixed: "left",
  540. width: 60,
  541. align: "center",
  542. },
  543. },
  544. {
  545. attrs: {
  546. label: "客户名称",
  547. slot: "name",
  548. fixed: "left",
  549. width: 160,
  550. },
  551. },
  552. {
  553. attrs: {
  554. label: "所在城市",
  555. slot: "address",
  556. width: 160,
  557. },
  558. },
  559. {
  560. attrs: {
  561. label: "客户来源",
  562. prop: "source",
  563. width: 150,
  564. },
  565. render(type) {
  566. let arr = type.split(",");
  567. if (arr && arr.length > 0) {
  568. let str = "";
  569. for (let i = 0; i < arr.length; i++) {
  570. const val = arr[i];
  571. str =
  572. str +
  573. proxy.dictValueLabel(val, customerSource.value) +
  574. (i < arr.length - 1 ? " , " : "");
  575. }
  576. return str;
  577. }
  578. // return proxy.dictValueLabel(type, customerSource.value);
  579. },
  580. },
  581. {
  582. attrs: {
  583. label: "客户类型",
  584. prop: "status",
  585. width: 120,
  586. },
  587. render(type) {
  588. return proxy.dictValueLabel(type, customerStatus.value);
  589. },
  590. },
  591. {
  592. attrs: {
  593. label: "客户标签",
  594. slot: "tags",
  595. width: 180,
  596. },
  597. },
  598. {
  599. attrs: {
  600. label: "业务员",
  601. prop: "userId",
  602. width: 140,
  603. },
  604. render(type) {
  605. let data = userList.value.filter((item) => item.value == type);
  606. if (data && data.length > 0) {
  607. return data[0].label;
  608. } else {
  609. return "";
  610. }
  611. },
  612. },
  613. // {
  614. // attrs: {
  615. // label: "小满客户ID",
  616. // slot: "companyId",
  617. // width: 170,
  618. // },
  619. // },
  620. {
  621. attrs: {
  622. label: "跟进",
  623. slot: "follow",
  624. "min-width": 440,
  625. },
  626. },
  627. {
  628. attrs: {
  629. label: "操作",
  630. width: 190,
  631. align: "center",
  632. fixed: "right",
  633. },
  634. renderHTML(row) {
  635. return [
  636. {
  637. attrs: {
  638. label: "分配",
  639. type: "primary",
  640. text: true,
  641. },
  642. el: "button",
  643. click() {
  644. formAllocation.data = {
  645. id: row.id,
  646. userId: row.userId,
  647. };
  648. openAllocation.value = true;
  649. },
  650. },
  651. {
  652. attrs: {
  653. label: "跟进",
  654. type: "primary",
  655. text: true,
  656. },
  657. el: "button",
  658. click() {
  659. clickFollowUp(row);
  660. },
  661. },
  662. {
  663. attrs: {
  664. label: "修改",
  665. type: "primary",
  666. text: true,
  667. },
  668. el: "button",
  669. click() {
  670. update(row);
  671. },
  672. },
  673. {
  674. attrs: {
  675. label: "删除",
  676. type: "primary",
  677. text: true,
  678. },
  679. el: "button",
  680. click() {
  681. ElMessageBox.confirm(
  682. "此操作将永久删除该数据, 是否继续?",
  683. "提示",
  684. {
  685. confirmButtonText: "确定",
  686. cancelButtonText: "取消",
  687. type: "warning",
  688. }
  689. ).then(() => {
  690. proxy
  691. .post("/customer/delete", {
  692. id: row.id,
  693. })
  694. .then(() => {
  695. ElMessage({
  696. message: "删除成功",
  697. type: "success",
  698. });
  699. getList();
  700. obtainStatisticalData();
  701. });
  702. });
  703. },
  704. },
  705. ];
  706. },
  707. },
  708. ];
  709. });
  710. const modalType = ref("add");
  711. const dialogVisible = ref(false);
  712. const openFollow = ref(false);
  713. const formAllocation = reactive({
  714. data: {},
  715. });
  716. const formFollow = reactive({
  717. data: {},
  718. });
  719. const formOption = reactive({
  720. inline: true,
  721. labelWidth: 100,
  722. itemWidth: 100,
  723. rules: [],
  724. });
  725. const formConfigAllocation = computed(() => {
  726. return [
  727. {
  728. type: "select",
  729. label: "业务员",
  730. prop: "userId",
  731. itemWidth: 100,
  732. data: userList.value,
  733. clearable: true,
  734. },
  735. ];
  736. });
  737. const rulesAllocation = ref({
  738. userId: [{ required: true, message: "请选择业务员", trigger: "change" }],
  739. });
  740. const formConfigAFollow = computed(() => {
  741. return [
  742. {
  743. type: "date",
  744. itemType: "datetime",
  745. label: "跟进时间",
  746. prop: "date",
  747. itemWidth: 100,
  748. },
  749. {
  750. type: "input",
  751. itemType: "textarea",
  752. label: "跟进内容",
  753. prop: "content",
  754. itemWidth: 100,
  755. },
  756. {
  757. type: "slot",
  758. label: "上传附件",
  759. prop: "fileList",
  760. slotName: "fileSlot",
  761. },
  762. ];
  763. });
  764. const rulesFollow = ref({
  765. date: [{ required: true, message: "请选择跟进时间", trigger: "change" }],
  766. content: [{ required: true, message: "请输入跟进内容", trigger: "blur" }],
  767. });
  768. const allocation = ref(null);
  769. const follow = ref(null);
  770. const getList = async (req) => {
  771. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  772. loading.value = true;
  773. proxy.post("/customer/page", sourceList.value.pagination).then((res) => {
  774. res.rows.forEach((x) => {
  775. x.addTagShow = false;
  776. if (x.tag) {
  777. x.tag = x.tag.split(",");
  778. } else {
  779. x.tag = [];
  780. }
  781. });
  782. sourceList.value.data = res.rows;
  783. sourceList.value.pagination.total = res.total;
  784. setTimeout(() => {
  785. loading.value = false;
  786. }, 200);
  787. });
  788. };
  789. const openModal = () => {
  790. modalType.value = "add";
  791. dialogVisible.value = true;
  792. };
  793. const submitAllocation = () => {
  794. allocation.value.handleSubmit(() => {
  795. proxy.post("/customer/CustomerAllocation", formAllocation.data).then(() => {
  796. ElMessage({
  797. message: "分配成功",
  798. type: "success",
  799. });
  800. openAllocation.value = false;
  801. getList();
  802. obtainStatisticalData();
  803. });
  804. });
  805. };
  806. const submitFollow = () => {
  807. follow.value.handleSubmit(() => {
  808. if (fileList.value && fileList.value.length > 0) {
  809. formFollow.data.fileList = fileList.value.map((item) => {
  810. return {
  811. id: item.raw.id,
  812. fileName: item.raw.fileName,
  813. fileUrl: item.raw.fileUrl,
  814. };
  815. });
  816. } else {
  817. formFollow.data.fileList = [];
  818. }
  819. proxy
  820. .post("/customerFollowRecords/" + modalType.value, formFollow.data)
  821. .then(
  822. () => {
  823. ElMessage({
  824. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  825. type: "success",
  826. });
  827. openFollow.value = false;
  828. getList();
  829. },
  830. (err) => {
  831. console.log(err);
  832. }
  833. );
  834. });
  835. };
  836. const submitForm = () => {
  837. AddCustomerDom.value.handleSubmit();
  838. };
  839. const getDict = () => {
  840. proxy
  841. .getDictOne([
  842. "customer_tag",
  843. "customer_source",
  844. "customer_status",
  845. "contact_type",
  846. ])
  847. .then((res) => {
  848. customerTag.value = res["customer_tag"].map((x) => ({
  849. label: x.dictValue,
  850. value: x.dictKey,
  851. }));
  852. customerSource.value = res["customer_source"].map((x) => ({
  853. label: x.dictValue,
  854. value: x.dictKey,
  855. }));
  856. customerStatus.value = res["customer_status"].map((x) => ({
  857. label: x.dictValue,
  858. value: x.dictKey,
  859. }));
  860. contactType.value = res["contact_type"].map((x) => ({
  861. label: x.dictValue,
  862. value: x.dictKey,
  863. }));
  864. });
  865. proxy
  866. .get("/tenantUser/list", {
  867. pageNum: 1,
  868. pageSize: 10000,
  869. tenantId: useUserStore().user.tenantId,
  870. })
  871. .then((res) => {
  872. userList.value = res.rows.map((item) => {
  873. return {
  874. label: item.nickName,
  875. value: item.userId,
  876. };
  877. });
  878. });
  879. };
  880. getDict();
  881. getList();
  882. const handleClickName = (row) => {
  883. proxy.$router.push({
  884. name: "Portrait",
  885. query: {
  886. id: row.id,
  887. },
  888. });
  889. };
  890. const deleteFollow = (data) => {
  891. ElMessageBox.confirm("是否确认删除该跟进?", "提示", {
  892. confirmButtonText: "确定",
  893. cancelButtonText: "取消",
  894. type: "warning",
  895. }).then(() => {
  896. proxy
  897. .post("/customerFollowRecords/delete", {
  898. id: data.id,
  899. })
  900. .then(() => {
  901. ElMessage({
  902. message: "删除成功",
  903. type: "success",
  904. });
  905. getList();
  906. });
  907. });
  908. };
  909. const addTag = ref("");
  910. const judgeTagSelect = (data, val) => {
  911. if (data && data.length > 0) {
  912. if (data.includes(val)) {
  913. return true;
  914. }
  915. }
  916. return false;
  917. };
  918. const changeTag = (val, item) => {
  919. let data = {
  920. id: item.id,
  921. tag: JSON.parse(JSON.stringify(item.tag)),
  922. };
  923. data.tag.push(val);
  924. data.tag = data.tag.join(",");
  925. proxy.post("/customer/editTag", data).then(() => {
  926. ElMessage({
  927. message: "添加成功",
  928. type: "success",
  929. });
  930. item.addTagShow = false;
  931. addTag.value = "";
  932. getList();
  933. });
  934. };
  935. const tagClose = (val, item) => {
  936. let data = {
  937. id: item.id,
  938. tag: JSON.parse(JSON.stringify(item.tag)),
  939. };
  940. data.tag = data.tag.filter((row) => row !== val);
  941. if (data.tag && data.tag.length > 0) {
  942. data.tag = data.tag.join(",");
  943. } else {
  944. data.tag = "";
  945. }
  946. proxy.post("/customer/editTag", data).then(() => {
  947. ElMessage({
  948. message: "添加成功",
  949. type: "success",
  950. });
  951. item.addTagShow = false;
  952. addTag.value = "";
  953. getList();
  954. });
  955. };
  956. const showSelect = (item) => {
  957. item.addTagShow = true;
  958. };
  959. const clickFollowUp = (item) => {
  960. formFollow.data = {
  961. customerId: item.id,
  962. fileList: [],
  963. };
  964. fileList.value = [];
  965. modalType.value = "add";
  966. openFollow.value = true;
  967. openRecordMore.value = false;
  968. };
  969. const uploadFile = async (file) => {
  970. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  971. uploadData.value = res.uploadBody;
  972. file.id = res.id;
  973. file.fileName = res.fileName;
  974. file.fileUrl = res.fileUrl;
  975. return true;
  976. };
  977. const onPreviewFile = (file) => {
  978. window.open(file.raw.fileUrl, "_blank");
  979. };
  980. const getStyle = (val) => {
  981. if (val) {
  982. return "跟进记录: " + val.replace(/\n|\r\n/g, "<br>");
  983. } else {
  984. return "";
  985. }
  986. };
  987. const getContent = (item) => {
  988. if (item.type === "10") {
  989. return "跟进记录: " + "报价单总金额 " + proxy.moneyFormat(item.amount, 2);
  990. } else if (item.type === "20") {
  991. return (
  992. "跟进记录: " +
  993. "合同总金额 " +
  994. proxy.moneyFormat(item.amount, 2) +
  995. ` (${item.contractCode}) `
  996. );
  997. }
  998. };
  999. const recordShow = (item) => {
  1000. if (
  1001. !(item.fileList && item.fileList.length > 0) &&
  1002. JSON.stringify(item.fileList) !== "[]"
  1003. ) {
  1004. proxy
  1005. .post("/fileInfo/getList", { businessIdList: [item.id] })
  1006. .then((fileObj) => {
  1007. item.fileList = fileObj[item.id] || [];
  1008. });
  1009. }
  1010. };
  1011. const openFile = (path) => {
  1012. window.open(path, "_blank");
  1013. };
  1014. const recordList = ref([]);
  1015. const rowData = ref({});
  1016. const openRecordMore = ref(false);
  1017. const queryParams = ref({
  1018. total: 0,
  1019. pageNum: 1,
  1020. pageSize: 10,
  1021. customerId: "",
  1022. });
  1023. const clickMore = (item) => {
  1024. if (openRecordMore.value === false) {
  1025. queryParams.value.pageNum = 1;
  1026. recordList.value = [];
  1027. rowData.value = item;
  1028. queryParams.value.customerId = item.id;
  1029. }
  1030. proxy.post("/customerFollowRecords/page", queryParams.value).then((res) => {
  1031. recordList.value = recordList.value.concat(res.rows);
  1032. queryParams.value.total = res.total;
  1033. proxy
  1034. .post("/fileInfo/getList", {
  1035. businessIdList: res.rows.map((rows) => rows.id),
  1036. })
  1037. .then((fileObj) => {
  1038. for (let i = 0; i < res.rows.length; i++) {
  1039. recordList.value[
  1040. parseInt(
  1041. i + (queryParams.value.pageNum - 1) * queryParams.value.pageSize
  1042. )
  1043. ].fileList =
  1044. fileObj[
  1045. recordList.value[
  1046. parseInt(
  1047. i +
  1048. (queryParams.value.pageNum - 1) * queryParams.value.pageSize
  1049. )
  1050. ].id
  1051. ] || [];
  1052. }
  1053. });
  1054. });
  1055. openRecordMore.value = true;
  1056. };
  1057. const infiniteScroll = () => {
  1058. queryParams.value.pageNum++;
  1059. clickMore();
  1060. };
  1061. const judgeTotal = () => {
  1062. if (
  1063. queryParams.value.pageNum * queryParams.value.pageSize >=
  1064. queryParams.value.total
  1065. ) {
  1066. return true;
  1067. }
  1068. return false;
  1069. };
  1070. const deleteTop = (item) => {
  1071. proxy.post("/customerTop/delete", { customerId: item.id }).then(() => {
  1072. item.isTop = 0;
  1073. });
  1074. };
  1075. const addTop = (item) => {
  1076. proxy.post("/customerTop/add", { customerId: item.id }).then(() => {
  1077. item.isTop = 1;
  1078. });
  1079. };
  1080. const statisticalData = ref({
  1081. countAmount: 0,
  1082. customerList: [],
  1083. });
  1084. const leftData = ref({});
  1085. const leftDataFour = ref({
  1086. 0: 0,
  1087. 7: 0,
  1088. 30: 0,
  1089. 180: 0,
  1090. });
  1091. const obtainStatisticalData = () => {
  1092. proxy
  1093. .post("/customer/sourceStatistics", { statisticsType: 1, type: null })
  1094. .then((res) => {
  1095. leftData.value.source = res;
  1096. });
  1097. proxy
  1098. .post("/customer/sourceStatistics", { statisticsType: 2, type: null })
  1099. .then((res) => {
  1100. leftData.value.status = res;
  1101. });
  1102. proxy.post("/customer/tagStatistics", { type: null }).then((res) => {
  1103. leftData.value.tag = res;
  1104. });
  1105. proxy.post("/customer/followStatistics", { type: null }).then((res) => {
  1106. leftDataFour.value = res;
  1107. });
  1108. };
  1109. obtainStatisticalData();
  1110. const showLeftData = (dictKey, att) => {
  1111. const data = leftData.value[att];
  1112. if (data && data.customerList.length > 0) {
  1113. const current = data.customerList.find((x) => x[att] == dictKey);
  1114. if (current && current.count) {
  1115. return current.count;
  1116. } else {
  1117. return 0;
  1118. }
  1119. }
  1120. };
  1121. const activeSearch = ref("");
  1122. const handleSearch = (value, att) => {
  1123. activeSearch.value = value + att;
  1124. sourceList.value.pagination = {
  1125. total: 0,
  1126. pageNum: 1,
  1127. pageSize: 10,
  1128. keyword: "",
  1129. type: "",
  1130. source: "",
  1131. status: "",
  1132. name: "",
  1133. countryId: "",
  1134. provinceId: "",
  1135. cityId: "",
  1136. customerCode: "",
  1137. userId: "",
  1138. tag: "",
  1139. tags: [],
  1140. };
  1141. if (value || att) {
  1142. sourceList.value.pagination[att] = value;
  1143. }
  1144. getList();
  1145. };
  1146. const handleSearchOne = (type, att = "follow") => {
  1147. activeSearch.value = type + att;
  1148. sourceList.value.pagination = {
  1149. total: 0,
  1150. pageNum: 1,
  1151. pageSize: 10,
  1152. keyword: "",
  1153. type: "",
  1154. source: "",
  1155. status: "",
  1156. name: "",
  1157. countryId: "",
  1158. provinceId: "",
  1159. cityId: "",
  1160. customerCode: "",
  1161. userId: "",
  1162. tag: "",
  1163. tags: [],
  1164. };
  1165. if (type == 4) {
  1166. sourceList.value.pagination.beginDay = -1;
  1167. sourceList.value.pagination.endDay = 7;
  1168. } else if (type == 1) {
  1169. sourceList.value.pagination.beginDay = 7;
  1170. sourceList.value.pagination.endDay = 30;
  1171. } else if (type == 2) {
  1172. sourceList.value.pagination.beginDay = 30;
  1173. sourceList.value.pagination.endDay = 180;
  1174. } else {
  1175. sourceList.value.pagination.beginDay = 180;
  1176. sourceList.value.pagination.endDay = "";
  1177. }
  1178. getList();
  1179. };
  1180. const getNum = (val) => {
  1181. let num = 0;
  1182. if (
  1183. statisticalData.value.customerList &&
  1184. statisticalData.value.customerList.length > 0
  1185. ) {
  1186. statisticalData.value.customerList.map((item) => {
  1187. if (sourceList.value.paginationTwo.statisticsType === 1) {
  1188. if (item.source === val) {
  1189. num = item.count;
  1190. }
  1191. } else if (sourceList.value.paginationTwo.statisticsType === 2) {
  1192. if (item.status === val) {
  1193. num = item.count;
  1194. }
  1195. } else if (sourceList.value.paginationTwo.statisticsType === 3) {
  1196. if (item.userId === val) {
  1197. num = item.count;
  1198. }
  1199. }
  1200. });
  1201. }
  1202. return num;
  1203. };
  1204. const update = (row) => {
  1205. modalType.value = "edit";
  1206. customerId.value = row.id;
  1207. dialogVisible.value = true;
  1208. };
  1209. const countrySearchData = ref([]);
  1210. const provinceSearchData = ref([]);
  1211. const citySearchData = ref([]);
  1212. const getCitySearchData = (id, type, isChange) => {
  1213. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1214. if (type === "20") {
  1215. provinceSearchData.value = res;
  1216. if (isChange) {
  1217. sourceList.value.pagination.provinceId = "";
  1218. sourceList.value.pagination.provinceName = "";
  1219. sourceList.value.pagination.cityId = "";
  1220. sourceList.value.pagination.cityName = "";
  1221. }
  1222. } else if (type === "30") {
  1223. citySearchData.value = res;
  1224. if (isChange) {
  1225. sourceList.value.pagination.cityId = "";
  1226. sourceList.value.pagination.cityName = "";
  1227. }
  1228. } else {
  1229. countrySearchData.value = res;
  1230. }
  1231. });
  1232. };
  1233. getCitySearchData("0");
  1234. const openSearch = ref(false);
  1235. const formSearchConfig = computed(() => {
  1236. return [
  1237. {
  1238. type: "input",
  1239. prop: "name",
  1240. label: "客户名称",
  1241. itemType: "text",
  1242. },
  1243. {
  1244. type: "input",
  1245. prop: "contactName",
  1246. label: "客户联系人",
  1247. itemType: "text",
  1248. itemWidth: 50,
  1249. },
  1250. {
  1251. type: "input",
  1252. prop: "contactEmail",
  1253. label: "联系人邮箱",
  1254. itemType: "text",
  1255. itemWidth: 50,
  1256. },
  1257. {
  1258. type: "slot",
  1259. slotName: "address",
  1260. label: "所在城市",
  1261. },
  1262. {
  1263. type: "select",
  1264. label: "客户来源",
  1265. prop: "source",
  1266. itemWidth: 50,
  1267. data: customerSource.value,
  1268. clearable: true,
  1269. },
  1270. {
  1271. type: "select",
  1272. label: "客户类型",
  1273. prop: "status",
  1274. itemWidth: 50,
  1275. data: customerStatus.value,
  1276. clearable: true,
  1277. },
  1278. {
  1279. type: "select",
  1280. label: "业务员",
  1281. prop: "userId",
  1282. data: userList.value,
  1283. clearable: true,
  1284. },
  1285. {
  1286. type: "slot",
  1287. slotName: "tags",
  1288. label: "客户标签",
  1289. },
  1290. ];
  1291. });
  1292. const addSearchTag = ref("");
  1293. const addTagSearchShow = ref(false);
  1294. // let copySearch = ref({});
  1295. const moreSearch = () => {
  1296. if (sourceList.value.pagination.tag) {
  1297. sourceList.value.pagination.tags =
  1298. sourceList.value.pagination.tag.split(",");
  1299. } else {
  1300. sourceList.value.pagination.tags = [];
  1301. }
  1302. addTagSearchShow.value = false;
  1303. // copySearch.value = proxy.deepClone(sourceList.value.pagination);
  1304. openSearch.value = true;
  1305. };
  1306. const cancelSearch = () => {
  1307. // sourceList.value.pagination = copySearch.value;
  1308. openSearch.value = false;
  1309. };
  1310. const submitSearch = () => {
  1311. if (
  1312. sourceList.value.pagination.tags &&
  1313. sourceList.value.pagination.tags.length > 0
  1314. ) {
  1315. sourceList.value.pagination.tag =
  1316. sourceList.value.pagination.tags.join(",");
  1317. } else {
  1318. sourceList.value.pagination.tag = "";
  1319. }
  1320. openSearch.value = false;
  1321. sourceList.value.pagination.keyword = "";
  1322. sourceList.value.pagination.pageNum = 1;
  1323. getList();
  1324. };
  1325. const tagSearchClose = (val) => {
  1326. sourceList.value.pagination.tags = sourceList.value.pagination.tags.filter(
  1327. (item) => item !== val
  1328. );
  1329. };
  1330. const changeSearchTag = (val) => {
  1331. sourceList.value.pagination.tags.push(val);
  1332. addTagSearchShow.value = false;
  1333. addSearchTag.value = "";
  1334. };
  1335. const table = ref(null);
  1336. onMounted(() => {
  1337. watch(
  1338. () => table.value.statSelectVal,
  1339. (val) => {
  1340. sourceList.value.paginationTwo.statisticsType = val + 1;
  1341. obtainStatisticalData();
  1342. }
  1343. );
  1344. });
  1345. const refreshList = () => {
  1346. dialogVisible.value = false;
  1347. getList();
  1348. };
  1349. const updateList = () => {
  1350. proxy.msgTip("更新中", 2);
  1351. proxy.post("/xiaomanCustomer/updateList").then((res) => {
  1352. setTimeout(() => {
  1353. proxy.msgTip("更新成功", 1);
  1354. }, 300);
  1355. });
  1356. };
  1357. const handleDeleteCompanyId = (row) => {
  1358. proxy
  1359. .msgConfirm()
  1360. .then((res) => {
  1361. proxy
  1362. .post("/afterSalesRecords/delete", {
  1363. id: row.id,
  1364. })
  1365. .then(() => {
  1366. proxy.msgTip("解绑成功", 1);
  1367. getList();
  1368. });
  1369. })
  1370. .catch((err) => {});
  1371. };
  1372. const openSelectXm = ref(false);
  1373. const xmDialog = ref(false);
  1374. const xmFormDom = ref(null);
  1375. const xmFormData = reactive({
  1376. data: {},
  1377. });
  1378. const xmFormOption = reactive({
  1379. inline: true,
  1380. labelWidth: 100,
  1381. itemWidth: 100,
  1382. });
  1383. const xmFormConfig = computed(() => {
  1384. return [
  1385. {
  1386. type: "slot",
  1387. slotName: "companyId",
  1388. label: "小满客户",
  1389. prop: "companyName",
  1390. itemWidth: 100,
  1391. },
  1392. ];
  1393. });
  1394. const xmRules = ref({
  1395. companyName: [{ required: true, message: "请选择小满客户", trigger: "blur" }],
  1396. });
  1397. const handleBindCompanyId = (row) => {
  1398. xmDialog.value = true;
  1399. xmFormData.data = {
  1400. id: row.id,
  1401. };
  1402. };
  1403. const selectXmCustomer = (row) => {
  1404. console.log(row, "sada");
  1405. };
  1406. const submitXmForm = () => {
  1407. xmFormDom.value.handleSubmit(() => {
  1408. proxy.post("/customer/CustomerAllocationss", xmFormData.data).then(() => {
  1409. ElMessage({
  1410. message: "绑定成功",
  1411. type: "success",
  1412. });
  1413. xmDialog.value = false;
  1414. getList();
  1415. });
  1416. });
  1417. };
  1418. </script>
  1419. <style lang="scss" scoped>
  1420. .tenant {
  1421. padding: 20px;
  1422. }
  1423. .infinite-scroll {
  1424. max-height: calc(89vh - 94px - 70px - 58px - 16px);
  1425. overflow-y: auto;
  1426. &::-webkit-scrollbar {
  1427. width: 0px;
  1428. }
  1429. }
  1430. .by-dropdown {
  1431. position: relative;
  1432. text-align: left;
  1433. height: 32px;
  1434. z-index: 1010;
  1435. padding: 0 10px;
  1436. transition: all 0.5s ease;
  1437. cursor: pointer;
  1438. line-height: 32px;
  1439. .by-dropdown-title {
  1440. font-size: 14px;
  1441. background-color: #fff;
  1442. }
  1443. ul {
  1444. position: absolute;
  1445. left: 0;
  1446. top: 32px;
  1447. padding: 0;
  1448. margin: 0;
  1449. z-index: 1200;
  1450. display: none;
  1451. white-space: nowrap;
  1452. background-color: #fff;
  1453. li {
  1454. list-style: none;
  1455. z-index: 1200;
  1456. font-size: 12px;
  1457. height: 30px;
  1458. padding: 0 10px;
  1459. }
  1460. li:hover {
  1461. background-color: #eff6ff;
  1462. color: #0084ff;
  1463. }
  1464. }
  1465. }
  1466. .by-dropdown::before {
  1467. display: block;
  1468. width: 1px;
  1469. content: " ";
  1470. position: absolute;
  1471. height: 14px;
  1472. top: 8px;
  1473. background-color: #ddd;
  1474. right: 0;
  1475. z-index: 1011;
  1476. }
  1477. .by-dropdown:hover {
  1478. background: #ffffff;
  1479. border-radius: 2px 2px 2px 2px;
  1480. opacity: 1;
  1481. ul {
  1482. background: #ffffff;
  1483. box-shadow: 0px 2px 16px 1px rgba(0, 0, 0, 0.06);
  1484. border-radius: 2px 2px 2px 2px;
  1485. opacity: 1;
  1486. display: block;
  1487. text-align: left;
  1488. }
  1489. }
  1490. .by-dropdown-lists {
  1491. max-height: 50vh;
  1492. overflow-y: auto;
  1493. line-height: 1;
  1494. }
  1495. .statistics-text {
  1496. padding-left: 8px;
  1497. width: 152px;
  1498. overflow: hidden;
  1499. text-overflow: ellipsis;
  1500. white-space: nowrap;
  1501. }
  1502. .activeSearch {
  1503. background: #409eff;
  1504. color: #fff;
  1505. border-radius: 2px;
  1506. padding: 0 5px;
  1507. }
  1508. </style>