equityServiceStatistics.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="dataReport-service-container">
  3. <el-card>
  4. <el-cascader
  5. v-model="filterObj.sale"
  6. placeholder="请选择销售"
  7. style="width: 230px; margin-right: 10px"
  8. :options="salesArr"
  9. :props="defaultSalesProps"
  10. :show-all-levels="false"
  11. collapse-tags
  12. clearable
  13. filterable
  14. @change="changeFilter"
  15. >
  16. </el-cascader>
  17. <el-cascader
  18. v-model="filterObj.serveTypeId"
  19. placeholder="请选择销售"
  20. style="width: 230px; margin-right: 10px"
  21. :options="customSellerList"
  22. :props="defaultSalesProps"
  23. :show-all-levels="false"
  24. collapse-tags
  25. clearable
  26. filterable
  27. @change="changeFilter"
  28. >
  29. </el-cascader>
  30. <!-- <el-select clearable multiple v-model="filterObj.serveTypeId" placeholder="请选择咨询销售" style="width: 230px; margin-right: 10px" @change="changeFilter">
  31. <el-option v-for="item in customSellerList" :key="item.AdminId" :label="item.RealName" :value="item.AdminId"> </el-option>
  32. </el-select> -->
  33. <el-select clearable v-model="filterObj.status" placeholder="客户状态" style="width: 230px; margin-right: 10px" @change="changeFilter">
  34. <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  35. </el-select>
  36. <el-select clearable v-model="filterObj.serviceType" placeholder="服务类型" style="width: 230px; margin-right: 10px" @change="changeFilter">
  37. <el-option v-for="item in serviceTypeOptions" :key="item.ServeTypeId" :label="item.ServeTypeName" :value="item.ServeTypeId"> </el-option>
  38. </el-select>
  39. <el-select
  40. v-model="filterObj.lable"
  41. clearable
  42. filterable
  43. remote
  44. reserve-keyword
  45. placeholder="请输入服务主题标签"
  46. :remote-method="remoteMethod"
  47. style="width: 230px; margin-right: 10px"
  48. @change="selectLableHandler"
  49. >
  50. <el-option v-for="item in lableOptions" :key="item.Md5Key" :label="item.TagName" :value="item.Md5Key"> </el-option>
  51. </el-select>
  52. <el-input placeholder="请输入客户名称" v-model="searchVal" style="width: 230px; margin-right: 10px" @input="handleSearch" clearable>
  53. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  54. </el-input>
  55. <a :href="exportExcel" download>
  56. <el-button type="primary">下载</el-button>
  57. </a>
  58. </el-card>
  59. <el-card style="margin-top: 20px">
  60. <el-table :data="tableData" border style="width: 100%" @sort-change="sortChangeHandle">
  61. <el-table-column align="center" prop="CompanyName" width="180">
  62. <template slot="header" slot-scope="{}">
  63. <span>客户名称</span>
  64. <el-tooltip effect="dark" placement="top-start">
  65. <div slot="content">
  66. <p>分配或者取消分配服务销售后,最多10分钟后客户会在此列表更新</p>
  67. </div>
  68. <i class="el-icon-warning"></i>
  69. </el-tooltip>
  70. </template>
  71. <template slot-scope="{ row }">
  72. <el-tooltip effect="dark" placement="top-start" content="过去4周,kp均未覆盖服务" v-if="row.IsUserMaker == -1">
  73. <span class="deletesty" @click="goDetail(row)">{{ row.CompanyName }}</span>
  74. </el-tooltip>
  75. <span v-else class="editsty" @click="goDetail(row)">{{ row.CompanyName }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column align="center" prop="ServeCoverageRate" width="180">
  79. <template slot="header" slot-scope="{}">
  80. <span>近4周平均服务覆盖率</span>
  81. <el-tooltip effect="dark" placement="top-start">
  82. <div slot="content">
  83. <p>近4周服务覆盖率的平均值</p>
  84. </div>
  85. <i class="el-icon-warning"></i>
  86. </el-tooltip>
  87. </template>
  88. <template slot-scope="{ row }">
  89. <span @click="clickCoverage(row)" class="editsty">{{ row.ServeCoverageRate }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column align="center" prop="Status" label="当前状态" width="80"> </el-table-column>
  93. <el-table-column align="center" prop="SellerName" label="销售" width="100"> </el-table-column>
  94. <el-table-column align="center" prop="ShareSeller" label="服务组销售" width="100"> </el-table-column>
  95. <el-table-column align="center" prop="StartDate" sortable="custom" label="合同期限" width="180">
  96. <template slot-scope="{ row }">
  97. <span>{{ row.StartDate }}~{{ row.EndDate }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column align="center" prop="Money" sortable="custom" label="合同金额" width="110"> </el-table-column>
  101. <el-table-column align="center" prop="PermissionName" label="签约套餐"></el-table-column>
  102. <el-table-column align="center" prop="ThisMonthAmount" label="本月服务量" width="100">
  103. <template slot-scope="{ row }">
  104. <span @click="billClickHandler(row, 1, '月')" class="editsty">{{ row.ThisMonthAmount }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column align="center" prop="LastMonthQoq" label="上月环比">
  108. <template slot-scope="{ row }">
  109. <span :style="{ color: row.LastMonthQoqIsRed ? 'red' : '#333' }">{{ row.LastMonthQoq }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column align="center" prop="LastMonthAmount" label="上月服务量" width="100">
  113. <template slot-scope="{ row }">
  114. <span @click="billClickHandler(row, 2, '月')" class="editsty">{{ row.LastMonthAmount }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column align="center" prop="TwoMonthAmount" label="上上月服务量" width="118">
  118. <template slot-scope="{ row }">
  119. <span @click="billClickHandler(row, 3, '月')" class="editsty">{{ row.TwoMonthAmount }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column align="center" prop="ThisWeekAmount" width="118">
  123. <template slot="header" slot-scope="{}">
  124. <p>本周服务量</p>
  125. <p>{{ getWeekRange(0) }}</p>
  126. </template>
  127. <template slot-scope="{ row }">
  128. <span @click="billClickHandler(row, 1, '周')" class="editsty">{{ row.ThisWeekAmount }}</span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column align="center" prop="LastWeekAmount" width="118">
  132. <template slot="header" slot-scope="{}">
  133. <p>上周服务量</p>
  134. <p>{{ getWeekRange(-1) }}</p>
  135. </template>
  136. <template slot-scope="{ row }">
  137. <span @click="billClickHandler(row, 2, '周')" class="editsty">{{ row.LastWeekAmount }}</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="center" prop="TwoWeekAmount" width="118">
  141. <template slot="header" slot-scope="{}">
  142. <p>上上周服务量</p>
  143. <p>{{ getWeekRange(-2) }}</p>
  144. </template>
  145. <template slot-scope="{ row }">
  146. <span @click="billClickHandler(row, 3, '周')" class="editsty">{{ row.TwoWeekAmount }}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" prop="ThreeWeekAmount" width="118">
  150. <template slot="header" slot-scope="{}">
  151. <p>上三周服务量</p>
  152. <p>{{ getWeekRange(-3) }}</p>
  153. </template>
  154. <template slot-scope="{ row }">
  155. <span @click="billClickHandler(row, 4, '周')" class="editsty">{{ row.ThreeWeekAmount }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column align="center" label="操作" width="80" v-if="isRoleType == 'admin' || isRoleType == '权益'">
  159. <template slot-scope="{ row }">
  160. <span @click="historicalNotesClickHandler(row)" class="editsty">历史备注</span>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. <!-- 页数选择器 -->
  165. <m-page style="margin: 20px 0" :page_no="page_no" :pageSize="pageSize" :total="total" @handleCurrentChange="pageChange" />
  166. </el-card>
  167. <!-- 覆盖率弹框 -->
  168. <coverage-rate-dlg :isCoverageRateShow.sync="isCoverageRateShow" :dlgForm.sync="dlgForm" />
  169. <!-- 服务明细- -->
  170. <service-details-dlg
  171. :isServiceDetailsShow.sync="isServiceDetailsShow"
  172. :dlgForm.sync="dlgForm"
  173. :selectForm="{
  174. TagType: this.tagType,
  175. TagId: this.tagId,
  176. ServeTypeId: this.filterObj.serviceType,
  177. WhatWeek: this.whatWeek,
  178. WhatMonth: this.whatMonth,
  179. }"
  180. />
  181. <historical-notes-dlg :historicalNotesDlgVisible.sync="historicalNotesDlgVisible" :CompanyId.sync="historicalNotesId" />
  182. </div>
  183. </template>
  184. <script>
  185. import { dataMainInterface, customInterence } from "@/api/api.js";
  186. import CoverageRateDlg from "./components/CoverageRateDlg.vue";
  187. import ServiceDetailsDlg from "./components/ServiceDetailsDlg.vue";
  188. import mPage from "@/components/mPage.vue";
  189. import HistoricalNotesDlg from "@/components/historicalNotesDlg.vue";
  190. export default {
  191. name: "",
  192. components: { CoverageRateDlg, ServiceDetailsDlg, mPage, HistoricalNotesDlg },
  193. props: {},
  194. data() {
  195. return {
  196. page_no: 1,
  197. total: 0,
  198. pageSize: 10,
  199. salesArr: [], //销售列表
  200. tableData: [],
  201. defaultSalesProps: {
  202. multiple: true,
  203. label: "RealName",
  204. children: "ChildrenList",
  205. value: "AdminId",
  206. }, //销售级联配置
  207. filterObj: {
  208. sale: "",
  209. status: "",
  210. serviceType: "",
  211. lable: "",
  212. ServeTypeId: "",
  213. },
  214. statusOptions: [
  215. { label: "正式客户", value: "正式" },
  216. { label: "未续约客户", value: "未续约" },
  217. ],
  218. serviceTypeOptions: [],
  219. isCoverageRateShow: false, //覆盖率弹框
  220. isServiceDetailsShow: false, //服务明细弹框
  221. dlgForm: {},
  222. sortType: "",
  223. sortParam: "",
  224. lableOptions: [],
  225. tagType: "",
  226. tagId: "",
  227. whatWeek: "", // 周度的
  228. whatMonth: "", // 月度的
  229. customSellerList: [],
  230. searchVal: "", //客户名称
  231. historicalNotesDlgVisible: false, //历史备注的弹框
  232. historicalNotesId: 0,
  233. };
  234. },
  235. computed: {
  236. exportExcel() {
  237. let salesArr = [];
  238. if (this.filterObj.sale.length) {
  239. salesArr = this.filterObj.sale.map((item) => {
  240. return item[item.length - 1];
  241. });
  242. }
  243. let SellerIds = [];
  244. if (this.filterObj.serveTypeId && this.filterObj.serveTypeId.length) {
  245. SellerIds = this.filterObj.serveTypeId.map((item) => {
  246. return item[item.length - 1];
  247. });
  248. }
  249. let baseUrl = process.env.API_ROOT + "/cygx/rai_serve/list";
  250. let token = localStorage.getItem("auth") || "";
  251. let paramStr = "";
  252. let parmsa = {
  253. SellerId: salesArr.join(","),
  254. ShareSellerId: SellerIds.join(","), //共享小时id
  255. ServeTypeId: this.filterObj.serviceType,
  256. TagType: this.tagType,
  257. TagId: this.tagId,
  258. Status: this.filterObj.status,
  259. SortType: this.sortType,
  260. IsExport: true,
  261. KeyWord: this.searchVal,
  262. };
  263. for (let key in parmsa) {
  264. paramStr = `${paramStr}&${key}=${parmsa[key]}`;
  265. }
  266. return `${baseUrl}?${token}${paramStr}`;
  267. },
  268. // crm 15.9.1 区分权益FICC的展示
  269. isRoleType() {
  270. return localStorage.getItem("RoleType") || "";
  271. },
  272. },
  273. watch: {},
  274. created() {},
  275. mounted() {
  276. this.getSale();
  277. this.getRaiServeTypeList();
  278. this.getDataList();
  279. this.getRaiServeCustomSellerList();
  280. },
  281. methods: {
  282. handleSearch() {
  283. this.page_no = 1;
  284. this.getDataList();
  285. },
  286. /* 获取销售 */
  287. getSale() {
  288. customInterence.getSalesRaiData().then((res) => {
  289. if (res.Ret === 200) {
  290. this.salesArr = res.Data.List;
  291. }
  292. });
  293. },
  294. /* 筛选改变时 */
  295. changeFilter() {
  296. this.page_no = 1;
  297. this.getDataList();
  298. },
  299. // 时间的计算
  300. getWeekRange(offset) {
  301. const now = new Date();
  302. const startOfWeek = new Date(now);
  303. startOfWeek.setDate(now.getDate() - now.getDay() + 1 + offset * 7); // 设置为每周的周一
  304. const endOfWeek = new Date(startOfWeek);
  305. endOfWeek.setDate(startOfWeek.getDate() + 6); // 设置为每周的周日
  306. const formatDate = (date) => {
  307. const year = date.getFullYear();
  308. const month = ("0" + (date.getMonth() + 1)).slice(-2);
  309. const day = ("0" + date.getDate()).slice(-2);
  310. return `${month}-${day}`;
  311. };
  312. return `(${formatDate(startOfWeek)} ~ ${formatDate(endOfWeek)})`;
  313. },
  314. pageChange(page_no) {
  315. this.page_no = page_no;
  316. this.getDataList();
  317. },
  318. // 获取表格数据
  319. async getDataList() {
  320. let salesArr = [];
  321. if (this.filterObj.sale.length) {
  322. salesArr = this.filterObj.sale.map((item) => {
  323. return item[item.length - 1];
  324. });
  325. }
  326. let SellerIds = [];
  327. if (this.filterObj.serveTypeId && this.filterObj.serveTypeId.length) {
  328. SellerIds = this.filterObj.serveTypeId.map((item) => {
  329. return item[item.length - 1];
  330. });
  331. }
  332. const res = await dataMainInterface.getRaiServeList({
  333. PageSize: this.pageSize,
  334. CurrentIndex: this.page_no,
  335. SellerId: salesArr.join(","),
  336. ShareSellerId: SellerIds.join(","), //共享小时id
  337. ServeTypeId: this.filterObj.serviceType,
  338. TagType: this.tagType,
  339. TagId: this.tagId,
  340. Status: this.filterObj.status,
  341. SortType: this.sortType,
  342. KeyWord: this.searchVal,
  343. SortParam: this.sortParam,
  344. });
  345. if (res.Ret === 200) {
  346. this.tableData = res.Data.List || [];
  347. this.total = res.Data.Paging.Totals;
  348. }
  349. },
  350. sortChangeHandle({ column, prop, order }) {
  351. this.sortType = order === "ascending" ? "asc" : order === "descending" ? "desc" : "";
  352. this.sortParam = prop == "Money" ? "money" : prop == "StartDate" ? "endDate" : "";
  353. this.getDataList();
  354. },
  355. /* 详情页 */
  356. goDetail(item) {
  357. const { href } = this.$router.resolve({
  358. path: "/customDetail",
  359. query: {
  360. id: item.CompanyId,
  361. },
  362. });
  363. window.open(href, "_blank");
  364. },
  365. // 搜索标签
  366. async remoteMethod(query) {
  367. if (query !== "") {
  368. const res = await dataMainInterface.getRaiServeSearchTag({
  369. KeyWord: query,
  370. });
  371. if (res.Ret === 200) {
  372. this.lableOptions = res.Data.List || [];
  373. }
  374. } else {
  375. this.lableOptions;
  376. }
  377. },
  378. // 远程搜索标签
  379. selectLableHandler() {
  380. if (this.filterObj.lable) {
  381. this.lableOptions.forEach((item) => {
  382. if (item.Md5Key === this.filterObj.lable) {
  383. this.tagType = item.TagType;
  384. this.tagId = item.TagId;
  385. }
  386. });
  387. } else {
  388. this.tagType = "";
  389. this.tagId = "";
  390. }
  391. this.changeFilter();
  392. },
  393. // 近四周覆盖率
  394. clickCoverage(item) {
  395. this.isCoverageRateShow = true;
  396. this.dlgForm = item;
  397. },
  398. // 点击了明细
  399. billClickHandler(item, type, what) {
  400. this.whatWeek = what == "周" ? type : "";
  401. this.whatMonth = what == "月" ? type : "";
  402. this.isServiceDetailsShow = true;
  403. this.dlgForm = item;
  404. },
  405. // 获取服务类型列表
  406. async getRaiServeTypeList() {
  407. const res = await dataMainInterface.getRaiServeTypeList();
  408. if (res.Ret === 200) {
  409. this.serviceTypeOptions = res.Data.List || [];
  410. }
  411. },
  412. //
  413. async getRaiServeCustomSellerList() {
  414. const res = await dataMainInterface.getRaiServeCustomSellerList();
  415. if (res.Ret === 200) {
  416. this.customSellerList = res.Data || [];
  417. }
  418. },
  419. // 点击了历史留言
  420. historicalNotesClickHandler(item) {
  421. this.historicalNotesDlgVisible = true;
  422. this.historicalNotesId = item.CompanyId;
  423. },
  424. },
  425. };
  426. </script>
  427. <style scoped lang="scss">
  428. .dataReport-service-container {
  429. }
  430. </style>