detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <view class="clueDetail_wrap">
  3. <view class="telPhone">
  4. <view class="left">
  5. <view class="phone"
  6. >电话:
  7. <show-real-text
  8. :real="receiptDetail.phone"
  9. :type="params.type"
  10. v-if="receiptDetail.phone"
  11. ></show-real-text>
  12. </view>
  13. <view
  14. class="copy_btn"
  15. v-if="params.type != '1'"
  16. @click="handleCopy(receiptDetail)"
  17. >复制</view
  18. >
  19. </view>
  20. <view class="right"> 发单人 : {{ receiptDetail.createNickName }} </view>
  21. </view>
  22. <view class="clueDetail_top_info">
  23. <view class="top_info_item">
  24. <view class="top">
  25. {{ defaultText(receiptDetail.clueOwnerName) }}
  26. </view>
  27. <view class="bottom"> 线索所属人 </view>
  28. </view>
  29. <view class="top_info_item">
  30. <view class="top">
  31. {{ defaultText(receiptDetail.brand) }}
  32. </view>
  33. <view class="bottom"> 品牌 </view>
  34. </view>
  35. <view class="top_info_item">
  36. <view class="top">
  37. {{ defaultText(receiptDetail.identificationName) }}
  38. </view>
  39. <view class="bottom"> 接单人 </view>
  40. </view>
  41. <view class="top_info_item">
  42. <view class="top">
  43. {{ crmFormCategoryFormat(receiptDetail.category) }}
  44. </view>
  45. <view class="bottom"> 类别 </view>
  46. </view>
  47. <view class="top_info_item">
  48. <view class="top">
  49. {{ crmFormTacticFormat(receiptDetail.tactic) }}
  50. </view>
  51. <view class="bottom"> 采用战术 </view>
  52. </view>
  53. <view class="top_info_item status-item">
  54. <view class="top">
  55. {{ crmFollowStatusFormat(receiptDetail.status) }}
  56. </view>
  57. <view class="bottom"> 跟进状态 </view>
  58. </view>
  59. </view>
  60. <view class="clue_state_wrap">
  61. <view class="top_left">阶段:</view>
  62. <view class="steps_wrap">
  63. <ld-select
  64. v-model="receiptDetail.state"
  65. :list="crmFormStateDict"
  66. value-key="dictValue"
  67. label-key="dictLabel"
  68. placeholder="点击选择阶段"
  69. @change="handleStateConfirm"
  70. >
  71. </ld-select>
  72. </view>
  73. </view>
  74. <!-- 跟进状态 -->
  75. <view class="order_action_wrap">
  76. <view class="action_title">状态:</view>
  77. <view class="action_buttons" v-if="['1','2'].includes(receiptDetail.status)">
  78. <u-button
  79. v-if="receiptDetail.status === '1'"
  80. type="success"
  81. size="small"
  82. text="接单"
  83. @click="handleOrderForm"
  84. customStyle="margin-right: 20rpx;"
  85. ></u-button>
  86. <u-button
  87. v-if="receiptDetail.status === '2'"
  88. type="primary"
  89. size="small"
  90. text="收单"
  91. @click="handleReceiptForm"
  92. customStyle="margin-right: 20rpx;"
  93. ></u-button>
  94. <u-button
  95. v-if="receiptDetail.status === '2'"
  96. type="warning"
  97. size="small"
  98. text="未收"
  99. @click="handleDenialForm"
  100. customStyle="margin-right: 20rpx;"
  101. ></u-button>
  102. <u-button
  103. v-if="receiptDetail.status === '1'"
  104. type="error"
  105. size="small"
  106. text="撤销"
  107. @click="handleDelete"
  108. customStyle="margin-right: 20rpx;"
  109. ></u-button>
  110. </view>
  111. <view v-else class="last_status">
  112. 该订单{{ crmFollowStatusFormat(receiptDetail.status) }}不可再操作
  113. </view>
  114. </view>
  115. <view class="clue_tag_wrap">
  116. <view class="clue_tag_add_btn" @click="handleAddClueTag">
  117. + 添加标签
  118. </view>
  119. <u-tag
  120. :text="tag.name"
  121. plain
  122. plainFill
  123. :closable="true"
  124. @close="hanldeTagClose(tag)"
  125. borderColor="#fff"
  126. v-for="tag in receiptDetail.tags"
  127. :key="tag.id"
  128. style="margin-left: 10px; margin-bottom: 10px"
  129. :bgColor="tag.color"
  130. color="#fff"
  131. ></u-tag>
  132. </view>
  133. <yui-tabs
  134. :tabs="tabs"
  135. v-model="activeIndex"
  136. :lineWidth="'120rpx'"
  137. :isLazyRender="false"
  138. color="#108cff"
  139. titleActiveColor="#108cff"
  140. :swipeable="true"
  141. :swiper="false"
  142. :ellipsis="false"
  143. :scroll-threshold="3"
  144. >
  145. <template #chatFile>
  146. <upload-file
  147. :clueId="clueId"
  148. :sourceId="orderId"
  149. ref="uploadFile1"
  150. type="2"
  151. orderFileType="1"
  152. isDuplicate="1"
  153. ></upload-file>
  154. </template>
  155. <template #quoteFile>
  156. <upload-file
  157. :clueId="clueId"
  158. :sourceId="orderId"
  159. ref="uploadFile2"
  160. type="2"
  161. orderFileType="2"
  162. isDuplicate="1"
  163. ></upload-file>
  164. </template>
  165. <template #hdImageFile>
  166. <upload-file
  167. :clueId="clueId"
  168. :sourceId="orderId"
  169. ref="uploadFile3"
  170. type="2"
  171. orderFileType="3"
  172. isDuplicate="1"
  173. ></upload-file>
  174. </template>
  175. <template #otherFile>
  176. <upload-file
  177. :clueId="clueId"
  178. :sourceId="orderId"
  179. ref="uploadFile4"
  180. type="2"
  181. orderFileType="4"
  182. isDuplicate="1"
  183. ></upload-file>
  184. </template>
  185. <template #frontendFile>
  186. <upload-file
  187. :clueId="clueId"
  188. ref="uploadFile5"
  189. type="6"
  190. isDuplicate="1"
  191. ></upload-file>
  192. </template>
  193. <template #frontendFollow>
  194. <clue-follow
  195. :clueId="clueId"
  196. ref="clueFollow"
  197. type="4"
  198. ></clue-follow>
  199. </template>
  200. <template #followRecord>
  201. <clue-follow
  202. :clueId="clueId"
  203. ref="follow"
  204. type="5"
  205. ></clue-follow>
  206. </template>
  207. <template #receiptInfo>
  208. <receipt-form-list
  209. :sendFormId="orderId"
  210. :clueId="clueId"
  211. :receiptDetail="receiptDetail"
  212. ref="receiptFormList"
  213. ></receipt-form-list>
  214. </template>
  215. <!-- <template #commissionInfo>
  216. <commission-form-list
  217. :sendFormId="receiptDetail.id"
  218. :clueId="receiptDetail.clueId"
  219. ref="commissionFormList"
  220. ></commission-form-list>
  221. </template> -->
  222. </yui-tabs>
  223. <u-tabbar
  224. class="clueDetail_tabber"
  225. :fixed="true"
  226. inactiveColor="#ffffff"
  227. :placeholder="true"
  228. :safeAreaInsetBottom="true"
  229. >
  230. <u-tabbar-item
  231. text="拨打电话"
  232. icon="../../static/clueDetail/icon-phone.png"
  233. @click="handleCallPhone"
  234. ></u-tabbar-item>
  235. <u-tabbar-item
  236. text="添加收单"
  237. icon="../../static/orderDetail/sd.png"
  238. @click="handleAddReceiptForm"
  239. ></u-tabbar-item>
  240. <u-tabbar-item
  241. text="添加跟进"
  242. icon="../../static/caseDetail/icon-follow.png"
  243. @click="handleAddFollow"
  244. ></u-tabbar-item>
  245. </u-tabbar>
  246. <group-select
  247. class="clueTagsSelect"
  248. :list="clueTagGroupVoList"
  249. scrollHeight="720rpx"
  250. groupName="groupName"
  251. groupChild="clueTagDataList"
  252. label-key="name"
  253. value-key="id"
  254. placeholder="请选择线索标签"
  255. v-model="checkTags"
  256. multiple
  257. clearable
  258. ref="clueTag"
  259. @confirm="handleClueTagConfirm"
  260. ></group-select>
  261. </view>
  262. </template>
  263. <script>
  264. import { cloneDeep } from "lodash";
  265. import { selectDictLabel } from "@/utils/util";
  266. import uploadFile from "../tabs/uploadFile/index.vue";
  267. import clueFollow from "../tabs/followRecord/index.vue";
  268. import receiptFormList from "../tabs/receiptFormList/receiptFormList.vue";
  269. // import commissionFormList from "../tabs/commissionFormList/commissionFormList.vue";
  270. export default {
  271. components: {
  272. uploadFile,
  273. clueFollow,
  274. receiptFormList,
  275. // commissionFormList,
  276. },
  277. props: {
  278. orderId: {
  279. type: [String, Number],
  280. required: true,
  281. },
  282. clueId: {
  283. type: [String, Number],
  284. required: true,
  285. },
  286. params: {
  287. type: Object,
  288. required: true,
  289. },
  290. },
  291. data() {
  292. return {
  293. showModal: false,
  294. showStateSelect: false,
  295. receiptDetail: {},
  296. checkTags: [],
  297. clueTagGroupVoList: [],
  298. crmFormCategoryDict: [],
  299. crmFormTacticDict: [],
  300. crmFormStateDict: [],
  301. crmHandelStatusDict: [],
  302. tabs: [
  303. {
  304. label: "收单信息",
  305. slot: "receiptInfo",
  306. },
  307. {
  308. label: "聊天附件",
  309. slot: "chatFile",
  310. },
  311. {
  312. label: "报价附件",
  313. slot: "quoteFile",
  314. },
  315. {
  316. label: "高清图附件",
  317. slot: "hdImageFile",
  318. },
  319. {
  320. label: "其他附件",
  321. slot: "otherFile",
  322. },
  323. {
  324. label: "前端附件",
  325. slot: "frontendFile",
  326. },
  327. {
  328. label: "前端跟进",
  329. slot: "frontendFollow",
  330. },
  331. {
  332. label: "跟进记录",
  333. slot: "followRecord",
  334. },
  335. // {
  336. // label: "收单分成",
  337. // slot: "commissionInfo",
  338. // },
  339. ],
  340. activeIndex: 0,
  341. };
  342. },
  343. methods: {
  344. async hanldeTagClose(tag) {
  345. const { id, tags } = this.receiptDetail;
  346. const copyTags = cloneDeep(tags);
  347. if (id == null) {
  348. uni.$u.toast("修改异常");
  349. return;
  350. }
  351. const index = copyTags.findIndex((v) => v.id === tag.id);
  352. if (index !== -1) {
  353. copyTags.splice(index, 1);
  354. const allTags = copyTags.map((v) => v.id).join(",");
  355. await uni.$u.api.updateTags({
  356. id: id,
  357. allTags,
  358. });
  359. this.receiptDetail.tags = copyTags;
  360. this.checkTags = this.receiptDetail.tags.map((v) => v.id);
  361. }
  362. },
  363. async handleClueTagConfirm() {
  364. const allTags = this.checkTags.join(",");
  365. await uni.$u.api.updateTags({
  366. id: this.receiptDetail.id,
  367. allTags,
  368. });
  369. this.getDetail();
  370. },
  371. handleAddClueTag() {
  372. this.$refs.clueTag.showModal();
  373. },
  374. async handleStateConfirm(e) {
  375. const state = e.value;
  376. await uni.$u.api.updateOrderState({
  377. id: this.receiptDetail.id,
  378. state,
  379. });
  380. uni.$u.toast("操作成功");
  381. },
  382. defaultText(text) {
  383. return text ? text : "-";
  384. },
  385. crmFormCategoryFormat(v) {
  386. return v ? selectDictLabel(this.crmFormCategoryDict, v) : "-";
  387. },
  388. crmFormTacticFormat(v) {
  389. return v ? selectDictLabel(this.crmFormTacticDict, v) : "-";
  390. },
  391. crmFollowStatusFormat(v) {
  392. return selectDictLabel(this.crmHandelStatusDict, v);
  393. },
  394. selectDictLabel,
  395. handleCopy(item) {
  396. uni.setClipboardData({
  397. data: item.phone,
  398. success: function () {
  399. uni.$u.toast("复制成功");
  400. },
  401. });
  402. },
  403. // 添加联系人
  404. handleCallPhone() {
  405. uni.makePhoneCall({
  406. phoneNumber: this.receiptDetail.phone,
  407. success: () => {
  408. this.$store.commit("call/SET_FORM", {
  409. clueId: this.receiptDetail.clueId,
  410. type: "3",
  411. callee: this.receiptDetail.phone,
  412. });
  413. },
  414. });
  415. },
  416. // 添加跟进记录
  417. handleAddFollow() {
  418. uni.navigateTo({
  419. url: `/pages/addFollow/index?orderId=${this.orderId}`,
  420. });
  421. },
  422. // 跳转到收单表单页面
  423. handleAddReceiptForm() {
  424. uni.navigateTo({
  425. url: `/pages/receiptForm/index?orderId=${this.orderId}&clueId=${this.clueId}`,
  426. });
  427. },
  428. handleUploadRecord() {
  429. uni.navigateTo({
  430. url: `/pages/uploadRecord/index?clueId=${this.orderId}`,
  431. });
  432. },
  433. // 接单操作
  434. async handleOrderForm() {
  435. if (this.receiptDetail.status === "2") {
  436. uni.$u.toast("当前订单已经被接单");
  437. return;
  438. }
  439. uni.showModal({
  440. title: "提示",
  441. content: "确定要接单吗?",
  442. success: async (res) => {
  443. if (res.confirm) {
  444. try {
  445. await uni.$u.api.oderForm({
  446. status: "2",
  447. id: this.receiptDetail.id,
  448. });
  449. uni.$u.toast("接单成功");
  450. this.getDetail(); // 刷新详情
  451. } catch (error) {
  452. uni.$u.toast("接单失败");
  453. }
  454. }
  455. },
  456. });
  457. },
  458. // 收单操作
  459. async handleReceiptForm() {
  460. if (
  461. this.receiptDetail.status === "3" ||
  462. this.receiptDetail.status === "4"
  463. ) {
  464. uni.$u.toast("当前订单已经被收单或未收");
  465. return;
  466. }
  467. uni.showModal({
  468. title: "提示",
  469. content: "确定要收单吗?",
  470. success: async (res) => {
  471. if (res.confirm) {
  472. try {
  473. await uni.$u.api.oderForm({
  474. status: "3",
  475. id: this.receiptDetail.id,
  476. });
  477. uni.$u.toast("收单成功");
  478. this.getDetail(); // 刷新详情
  479. } catch (error) {
  480. uni.$u.toast("收单失败");
  481. }
  482. }
  483. },
  484. });
  485. },
  486. // 未收操作
  487. async handleDenialForm() {
  488. if (
  489. this.receiptDetail.status === "3" ||
  490. this.receiptDetail.status === "4"
  491. ) {
  492. uni.$u.toast("当前订单已经被收单或未收");
  493. return;
  494. }
  495. uni.showModal({
  496. title: "提示",
  497. content: "确定要标记为未收吗?",
  498. success: async (res) => {
  499. if (res.confirm) {
  500. try {
  501. await uni.$u.api.oderForm({
  502. status: "4",
  503. id: this.receiptDetail.id,
  504. });
  505. uni.$u.toast("标记未收成功");
  506. this.getDetail(); // 刷新详情
  507. } catch (error) {
  508. uni.$u.toast("操作失败");
  509. }
  510. }
  511. },
  512. });
  513. },
  514. // 撤销操作
  515. async handleDelete() {
  516. uni.showModal({
  517. title: "提示",
  518. content: "是否确定撤销?",
  519. success: async (res) => {
  520. if (res.confirm) {
  521. try {
  522. await uni.$u.api.deleteOrder([this.receiptDetail.id]);
  523. uni.$u.toast("撤销成功");
  524. // 撤销后返回上一页
  525. setTimeout(() => {
  526. uni.navigateBack();
  527. }, 1500);
  528. } catch (error) {
  529. uni.$u.toast("撤销失败");
  530. }
  531. }
  532. },
  533. });
  534. },
  535. // 初始化详情页
  536. async handleInit() {
  537. this.getDetail();
  538. this.$getDicts("crm_form_category").then((res) => {
  539. this.crmFormCategoryDict = res;
  540. });
  541. this.$getDicts("crm_form_tactic").then((res) => {
  542. this.crmFormTacticDict = res;
  543. });
  544. this.$getDicts("crm_form_state").then((res) => {
  545. this.crmFormStateDict = res;
  546. });
  547. this.$getDicts("crm_form_status").then((res) => {
  548. this.crmHandelStatusDict = res;
  549. });
  550. uni.$u.api
  551. .getClueTagGroupVoList({
  552. tagGroupApplication: "2",
  553. })
  554. .then(({ data }) => {
  555. this.clueTagGroupVoList = data;
  556. });
  557. },
  558. getDetail() {
  559. uni.$u.api.getClueSendFormVoByOrderId({
  560. id: this.orderId,
  561. })
  562. .then((res) => {
  563. this.receiptDetail = res.data;
  564. this.checkTags = this.receiptDetail.tags
  565. ? this.receiptDetail.tags.map((v) => v.id)
  566. : [];
  567. });
  568. },
  569. },
  570. created() {
  571. this.handleInit();
  572. },
  573. };
  574. </script>
  575. <style lang="scss" scoped>
  576. .clueTagsSelect {
  577. height: 0;
  578. overflow: hidden;
  579. }
  580. .clue_tag_wrap {
  581. display: flex;
  582. align-items: center;
  583. background-color: #fff;
  584. padding: 0 10px;
  585. margin: 20px 0;
  586. flex-wrap: wrap;
  587. min-height: 50px;
  588. .clue_tag_add_btn {
  589. font-size: 14px;
  590. color: #108cff;
  591. }
  592. }
  593. .clue_state_wrap {
  594. background-color: #fff;
  595. padding: 10px;
  596. margin-bottom: 20px;
  597. display: flex;
  598. align-items: center;
  599. .top_left {
  600. font-size: 16px;
  601. flex: 0 0 50px;
  602. }
  603. .steps_wrap {
  604. flex: 1;
  605. }
  606. }
  607. .order_action_wrap {
  608. padding: 10px;
  609. margin: 15px 0;
  610. background: #fff;
  611. display: flex;
  612. align-items: center;
  613. .action_title {
  614. font-size: 16px;
  615. flex : 0 0 50px;
  616. }
  617. .last_status{
  618. color: #c0c0c7;
  619. font-size: 14px;
  620. }
  621. .action_buttons {
  622. display: grid;
  623. grid-template-columns: repeat(2, 1fr);
  624. gap: 10px;
  625. ::v-deep .u-button {
  626. height: 30px !important;
  627. font-size: 12px !important;
  628. border-radius: 8px !important;
  629. border: 1px solid #e2e8f0 !important;
  630. background: #ffffff !important;
  631. color: #2d3748 !important;
  632. font-weight: 500 !important;
  633. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  634. transition: all 0.3s ease !important;
  635. &.u-button--success {
  636. background: #ffd025 !important;
  637. color: white !important;
  638. border-color: #ffd025 !important;
  639. }
  640. // 特别样式化不同按钮类型
  641. &.u-button--primary {
  642. background: #35dbd9 !important;
  643. color: white !important;
  644. border-color: #35dbd9 !important;
  645. }
  646. &.u-button--warning {
  647. background: #ba9fb0 !important;
  648. color: white !important;
  649. border-color: #ba9fb0 !important;
  650. }
  651. &.u-button--error {
  652. background: #e53e3e !important;
  653. color: white !important;
  654. border-color: #e53e3e !important;
  655. }
  656. }
  657. }
  658. }
  659. .clueDetail_tabber {
  660. ::v-deep .u-tabbar__content {
  661. background: #108cff;
  662. border-top-right-radius: 10px;
  663. border-top-left-radius: 10px;
  664. }
  665. }
  666. .clueDetail_wrap {
  667. .telPhone {
  668. display: flex;
  669. background: #fff;
  670. padding: 20px;
  671. justify-content: space-between;
  672. .left {
  673. display: flex;
  674. }
  675. .copy_btn {
  676. color: #4fa5fe;
  677. margin-left: 10px;
  678. }
  679. }
  680. .clueDetail_top_info {
  681. display: flex;
  682. flex-wrap: wrap;
  683. background-color: #ffffff;
  684. padding-top: 20px;
  685. margin: 18px 0;
  686. .top_info_item {
  687. width: 33.33%;
  688. text-align: center;
  689. margin-bottom: 20px;
  690. .top {
  691. font-size: 15px;
  692. color: #202020;
  693. margin-bottom: 5px;
  694. font-weight: bold;
  695. }
  696. .bottom {
  697. font-size: 15px;
  698. color: #c0c0c7;
  699. }
  700. }
  701. }
  702. }
  703. </style>