visitorDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <Page title="访客计划详情">
  3. <template v-slot:headerRight>
  4. <div class="themeTextColor" v-if="detailedData.finishState == 0" @click="visitorEditor">编辑</div>
  5. </template>
  6. <template v-slot:body>
  7. <!-- 头部 -->
  8. <div class="planDetailsHead">
  9. <div class="w-full flex items-center justify-between">
  10. <div class="text-size-in font-bold text-[#474A56]">{{ detailedData.planName }}</div>
  11. <div :class="`labelTag ${detailedData.finishState == 0 ? 'toBeCompleted' : 'completed'}`">{{ ['未完成',
  12. '已完成'][detailedData.finishState] }}</div>
  13. </div>
  14. <div class="w-full mt-4">拜访目的:{{ detailedData.visitGoalName }}</div>
  15. <div class="w-full mt-4">拜访时间: {{ detailedData.visitTime }}</div>
  16. <div class="line"></div>
  17. <div class="w-full flex items-center">
  18. <van-icon name="user-circle-o" class="text-size-in mr-2" />
  19. 客户:
  20. <div class="ml-2 themeTextColor decoration-auto underline" @click="jumpToCustomerDetails()">{{
  21. detailedData.customName }}</div>
  22. </div>
  23. </div>
  24. <!-- 主体 -->
  25. <van-cell-group>
  26. <van-cell title="计划名称" :value="detailedData.planName" />
  27. <van-cell title="客户姓名" :value="detailedData.customName" />
  28. <van-cell title="负责人" :value="detailedData.inchargerName" />
  29. <van-cell title="拜访目的" :value="detailedData.visitGoalName" />
  30. <van-cell title="拜访时间" :value="detailedData.visitTime" />
  31. <van-cell title="提醒" :value="detailedData.remindTypeName" />
  32. <van-cell title="提醒时间" :value="detailedData.remindTime" v-if="detailedData.remindType == -1" />
  33. <van-cell title="备注" :value="detailedData.remark" />
  34. </van-cell-group>
  35. <div class="h-10"></div>
  36. <!-- 弹窗 -->
  37. <van-popup v-model:show="showContacts" closeable position="bottom" round>
  38. <div class="newModuleAdded relative">
  39. <div class="text-size-large text-[#474A56] absolute topTitle">联系人号码</div>
  40. <div class="flex flex-col overflow-y-auto boxLxr">
  41. <template v-for="item in contactList">
  42. <a :href="`tel:+${item.phone}`">
  43. <div class="bg-[#F8F8FA] flex justify-between items-center px-6 py-4 mb-3 rounded">
  44. <div class="w-3/12">{{ item.name }}</div>
  45. <div class="flex-1">{{ item.phone }}</div>
  46. <van-icon name="phone" color="#075985" size="1.4rem" />
  47. </div>
  48. </a>
  49. </template>
  50. </div>
  51. </div>
  52. </van-popup>
  53. <van-popup v-model:show="showDelay" closeable position="bottom" round>
  54. <div class="newModuleAdded relative">
  55. <div class="text-size-large text-[#474A56] absolute topTitle">{{ delayRestartText }}时间</div>
  56. <div class="flex flex-col overflow-y-auto h-52">
  57. <div class="flex-1">
  58. <div class="px-6 py-4 bg-[#F8F8FA] flex justify-between items-center mt-2" @click="showDatePicker = true">
  59. <div>选择时间</div>
  60. <div class="flex items-center">
  61. {{ showDelayData }}
  62. <van-icon name="arrow" size="1.2rem" class="ml-2" />
  63. </div>
  64. </div>
  65. </div>
  66. <van-button type="primary" :disabled="!showDelayData" @click="delayTimeEvent()">保存</van-button>
  67. </div>
  68. </div>
  69. </van-popup>
  70. <van-popup v-model:show="showDatePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
  71. <van-date-picker v-model="showDatePickerVal" @confirm="showPickerConfirm" @cancel="showDatePicker = false" />
  72. </van-popup>
  73. <van-popup v-model:show="timeShowPicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
  74. <van-time-picker v-model="currentTime" title="选择时间" @confirm="timeConfirm" />
  75. </van-popup>
  76. </template>
  77. <template v-slot:footer v-if="detailedData.finishState == 0">
  78. <div class="w-full flex justify-between layout">
  79. <div class="footerBtnLeft layouts" @click="showContactsCli()">
  80. <div class="imgClss">
  81. <img src="/src/assets/image/lianxir.png" alt="">
  82. </div>
  83. 联系人
  84. </div>
  85. <div class="footerBtnRight layouts" @click="delayRestart('DELAY')">
  86. <div class="imgClss">
  87. <img src="/src/assets/image/yanqi.png" alt="">
  88. </div>
  89. 延期
  90. </div>
  91. <div class="coverWithWhite"></div>
  92. <div class="bigCircle" @click="completeThePlan()">
  93. <div class="imgClss">
  94. <img src="/src/assets/image/wanc.png" alt="">
  95. </div>
  96. 完成
  97. </div>
  98. </div>
  99. </template>
  100. <template v-slot:footer v-if="detailedData.finishState != 0">
  101. <div class="w-full flex justify-between layout">
  102. <div class="footerBtnTwoLeft layoutsTwo" @click="showContactsCli()">
  103. <div class="imgClss">
  104. <img src="/src/assets/image/lianxir.png" alt="">
  105. </div>
  106. 联系人
  107. </div>
  108. <div class="footerBtnTwoLeft layoutsTwo" @click="delayRestart('RESTART')">
  109. <div class="imgClss">
  110. <img src="/src/assets/image/chongqi.png" alt="">
  111. </div>
  112. 重启
  113. </div>
  114. </div>
  115. </template>
  116. </Page>
  117. </template>
  118. <script setup>
  119. import { ref } from "vue";
  120. import { showConfirmDialog } from 'vant';
  121. import { useLifecycle } from "@hooks/useCommon.js";
  122. import { OBTAIN_DETAILS_OF_THE_VISIT_PLAN, POSTPONE_THE_VISIT_PLAN, COMPLETE_THE_VISIT_PLAN, OBTAIN_CUSTOMER_DETAILS } from "@hooks/useApi"
  123. import useToast from "@hooks/useToast"
  124. import requests from "@common/requests";
  125. import useRouterStore from "@store/useRouterStore.js";
  126. import dayjs from "dayjs";
  127. import { routingInfos } from "@utility/generalVariables.js";
  128. import useFixedData from "@store/useFixedData.js";
  129. import PullDownSelector from "@components/common/pullDownSelector.vue";
  130. const router = useRouterStore();
  131. const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
  132. const detailedData = ref({});
  133. const showContacts = ref(false);
  134. const showDelay = ref(false)
  135. const showDatePicker = ref(false)
  136. const timeShowPicker = ref(false)
  137. const showDatePickerVal = ref(dayjs().format("YYYY-MM-DD").split('-'))
  138. const showDelayData = ref('')
  139. const currentTime = ref('')
  140. const contactList = ref([]);
  141. const delayRestartText = ref('')
  142. function delayRestart(type = 'DELAY') {
  143. const textType = { 'DELAY': '延期', 'RESTART': '重启' }
  144. delayRestartText.value = textType[type]
  145. showDelay.value = true
  146. showDelayData.value = ''
  147. }
  148. function visitorEditor() {
  149. router.navigateTo({
  150. pathName: 'addEditorVisitor',
  151. success: () => {
  152. router.emit('addEditorVisitorParameter', {
  153. row: JSON.stringify(detailedData.value || {}),
  154. date: JSON.stringify(detailedData.value.visitTime || {})
  155. })
  156. }
  157. })
  158. }
  159. function jumpToCustomerDetails() {
  160. const routerInfo = routingInfos['customer']
  161. requests.post(OBTAIN_CUSTOMER_DETAILS, { id: detailedData.value.customId }).then(res => {
  162. router.navigateTo({
  163. pathName: 'details',
  164. success: () => {
  165. router.emit('detailParameter', {
  166. routerInfo: JSON.stringify(routerInfo || {}),
  167. parameter: JSON.stringify(res.data || {})
  168. })
  169. }
  170. })
  171. })
  172. }
  173. function showContactsCli() {
  174. if (!((contactList.value || []).length)) {
  175. toastText('该联系人无号码')
  176. return
  177. }
  178. showContacts.value = true
  179. }
  180. function completeThePlan() {
  181. showConfirmDialog({
  182. title: `完成访客计划`,
  183. message: `确定完成【${detailedData.value.planName}】访客计划吗?`,
  184. }).then(() => {
  185. requests.post(COMPLETE_THE_VISIT_PLAN, { planId: detailedData.value.id, }).then((res) => {
  186. toastSuccess('操作成功')
  187. getDetailData(detailedData.value)
  188. })
  189. })
  190. }
  191. function delayTimeEvent() {
  192. requests.post(POSTPONE_THE_VISIT_PLAN, { planId: detailedData.value.id, visitTime: showDelayData.value }).then(() => {
  193. toastSuccess(`操作成功`)
  194. getDetailData(detailedData.value)
  195. showDelay.value = false
  196. })
  197. }
  198. function getDetailData(row) {
  199. requests.post(OBTAIN_DETAILS_OF_THE_VISIT_PLAN, { planId: row.id }).then(({ data = [] }) => {
  200. detailedData.value = data
  201. contactList.value = data.contacts || []
  202. })
  203. }
  204. function showPickerConfirm({ selectedValues }) {
  205. const dates = selectedValues.join('-')
  206. const times = dayjs().format("hh:mm")
  207. showDelayData.value = `${dates} ${times}`
  208. currentTime.value = times.split(':')
  209. showDatePicker.value = false
  210. timeShowPicker.value = true
  211. }
  212. function timeConfirm({ selectedValues }) {
  213. const dates = dayjs(new Date(showDatePickerVal.value)).format("YYYY-MM-DD")
  214. showDelayData.value = `${dates} ${selectedValues.join(':')}`
  215. timeShowPicker.value = false
  216. }
  217. function processingDataSource(data) {
  218. const row = JSON.parse(data.row);
  219. detailedData.value = row || {}
  220. getDetailData(row)
  221. }
  222. useLifecycle({
  223. load: () => {
  224. router.on("visitorDetailsParameter", (data) => {
  225. processingDataSource(data);
  226. });
  227. },
  228. });
  229. </script>
  230. <style lang="scss" scoped>
  231. .planDetailsHead {
  232. background: #ffa35919;
  233. padding: 14px 18px;
  234. margin: 10px;
  235. .toBeCompleted {
  236. background: rgba($color: #f38b3c, $alpha: 0.1);
  237. border-color: #f38b3c;
  238. color: #f38b3c;
  239. }
  240. .completed {
  241. background: rgba($color: #07c160, $alpha: 0.1);
  242. border-color: #07c160;
  243. color: #07c160;
  244. }
  245. .labelTag {
  246. font-size: 10px;
  247. padding: 3px 8px;
  248. border-radius: 4px;
  249. border: 1px solid;
  250. }
  251. .line {
  252. width: 100%;
  253. height: 1px;
  254. background-color: #E6D3C7;
  255. margin: 14px 0;
  256. }
  257. }
  258. .layout {
  259. height: 90px;
  260. position: relative;
  261. .layouts {
  262. width: 40%;
  263. height: 100%;
  264. background: #fff;
  265. box-shadow: 0px -2px 30px 0px #00000014;
  266. display: flex;
  267. flex-direction: column;
  268. align-items: center;
  269. justify-content: center;
  270. }
  271. .layoutsTwo {
  272. width: 40%;
  273. height: 100%;
  274. background: #fff;
  275. display: flex;
  276. flex-direction: column;
  277. align-items: center;
  278. justify-content: center;
  279. }
  280. .footerBtnLeft {
  281. border-top-right-radius: 25px;
  282. .imgClss {
  283. width: 30px;
  284. height: 30px;
  285. margin-bottom: 6px;
  286. }
  287. }
  288. .footerBtnTwoLeft {
  289. width: 50%;
  290. .imgClss {
  291. width: 30px;
  292. height: 30px;
  293. margin-bottom: 6px;
  294. }
  295. }
  296. .footerBtnRight {
  297. border-top-left-radius: 25px;
  298. .imgClss {
  299. width: 26px;
  300. height: 24px;
  301. margin-bottom: 9px;
  302. }
  303. }
  304. .coverWithWhite {
  305. width: 20%;
  306. background: #fff;
  307. position: absolute;
  308. bottom: 0;
  309. left: 50%;
  310. transform: translateX(-50%);
  311. height: 70px;
  312. z-index: 1;
  313. }
  314. .bigCircle {
  315. width: 80px;
  316. height: 80px;
  317. ;
  318. border-radius: 50%;
  319. background: $themeColor;
  320. box-shadow: 0px -2px 30px 0px #00000014;
  321. position: absolute;
  322. bottom: 27px;
  323. left: 50%;
  324. transform: translateX(-50%);
  325. z-index: 2;
  326. color: #fff;
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. flex-direction: column;
  331. .imgClss {
  332. width: 25.5px;
  333. height: 25.5px;
  334. margin-bottom: 4px;
  335. }
  336. }
  337. }
  338. .newModuleAdded {
  339. padding: 45px 25px 45px 25px;
  340. }
  341. .topTitle {
  342. top: 14px;
  343. }
  344. .boxLxr {
  345. max-height: 180px;
  346. }
  347. </style>