visitorDetails.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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">延期时间</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"></div>
  81. 联系人
  82. </div>
  83. <div class="footerBtnRight layouts" @click="showDelay = true, showDelayData = ''">
  84. <div class="imgClss"></div>
  85. 延期
  86. </div>
  87. <div class="coverWithWhite"></div>
  88. <div class="bigCircle" @click="completeThePlan()">
  89. <div class="imgClss"></div>
  90. 完成
  91. </div>
  92. </div>
  93. </template>
  94. </Page>
  95. </template>
  96. <script setup>
  97. import { ref } from "vue";
  98. import { showConfirmDialog } from 'vant';
  99. import { useLifecycle } from "@hooks/useCommon.js";
  100. import { OBTAIN_DETAILS_OF_THE_VISIT_PLAN, POSTPONE_THE_VISIT_PLAN, COMPLETE_THE_VISIT_PLAN, OBTAIN_CUSTOMER_DETAILS } from "@hooks/useApi"
  101. import useToast from "@hooks/useToast"
  102. import requests from "@common/requests";
  103. import useRouterStore from "@store/useRouterStore.js";
  104. import dayjs from "dayjs";
  105. import { routingInfos } from "@utility/generalVariables.js";
  106. import useFixedData from "@store/useFixedData.js";
  107. import PullDownSelector from "@components/common/pullDownSelector.vue";
  108. const router = useRouterStore();
  109. const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
  110. const detailedData = ref({});
  111. const showContacts = ref(false);
  112. const showDelay = ref(false)
  113. const showDatePicker = ref(false)
  114. const timeShowPicker = ref(false)
  115. const showDatePickerVal = ref(dayjs().format("YYYY-MM-DD").split('-'))
  116. const showDelayData = ref('')
  117. const currentTime = ref('')
  118. const contactList = ref([]);
  119. function visitorEditor() {
  120. router.navigateTo({
  121. pathName: 'addEditorVisitor',
  122. success: () => {
  123. router.emit('addEditorVisitorParameter', {
  124. row: JSON.stringify(detailedData.value || {}),
  125. date: JSON.stringify(detailedData.value.visitTime || {})
  126. })
  127. }
  128. })
  129. }
  130. function jumpToCustomerDetails() {
  131. const routerInfo = routingInfos['customer']
  132. requests.post(OBTAIN_CUSTOMER_DETAILS, { id: detailedData.value.customId }).then(res => {
  133. router.navigateTo({
  134. pathName: 'details',
  135. success: () => {
  136. router.emit('detailParameter', {
  137. routerInfo: JSON.stringify(routerInfo || {}),
  138. parameter: JSON.stringify(res.data || {})
  139. })
  140. }
  141. })
  142. })
  143. }
  144. function showContactsCli() {
  145. if(!((contactList.value || []).length)) {
  146. toastText('该联系人无号码')
  147. return
  148. }
  149. showContacts.value = true
  150. }
  151. function completeThePlan() {
  152. showConfirmDialog({
  153. title: `完成访客计划`,
  154. message: `确定完成【${detailedData.value.planName}】访客计划吗?`,
  155. }).then(() => {
  156. requests.post(COMPLETE_THE_VISIT_PLAN, { planId: detailedData.value.id, }).then((res) => {
  157. toastSuccess('操作成功')
  158. getDetailData(detailedData.value)
  159. })
  160. })
  161. }
  162. function delayTimeEvent() {
  163. requests.post(POSTPONE_THE_VISIT_PLAN, { planId: detailedData.value.id, visitTime: showDelayData.value }).then(() => {
  164. toastSuccess(`操作成功`)
  165. getDetailData(detailedData.value)
  166. showDelay.value = false
  167. })
  168. }
  169. function getDetailData(row) {
  170. requests.post(OBTAIN_DETAILS_OF_THE_VISIT_PLAN, { planId: row.id }).then(({ data = [] }) => {
  171. detailedData.value = data
  172. contactList.value = data.contacts || []
  173. })
  174. }
  175. function showPickerConfirm({ selectedValues }) {
  176. const dates = selectedValues.join('-')
  177. const times = dayjs().format("hh:mm")
  178. showDelayData.value = `${dates} ${times}`
  179. currentTime.value = times.split(':')
  180. showDatePicker.value = false
  181. timeShowPicker.value = true
  182. }
  183. function timeConfirm({ selectedValues }) {
  184. const dates = dayjs(new Date(showDatePickerVal.value)).format("YYYY-MM-DD")
  185. showDelayData.value = `${dates} ${selectedValues.join(':')}`
  186. timeShowPicker.value = false
  187. }
  188. function processingDataSource(data) {
  189. const row = JSON.parse(data.row);
  190. detailedData.value = row || {}
  191. getDetailData(row)
  192. }
  193. useLifecycle({
  194. load: () => {
  195. router.on("visitorDetailsParameter", (data) => {
  196. processingDataSource(data);
  197. });
  198. },
  199. });
  200. </script>
  201. <style lang="scss" scoped>
  202. .planDetailsHead {
  203. background: #ffa35919;
  204. padding: 14px 18px;
  205. margin: 10px;
  206. .toBeCompleted {
  207. background: rgba($color: #f38b3c, $alpha: 0.1);
  208. border-color: #f38b3c;
  209. color: #f38b3c;
  210. }
  211. .completed {
  212. background: rgba($color: #07c160, $alpha: 0.1);
  213. border-color: #07c160;
  214. color: #07c160;
  215. }
  216. .labelTag {
  217. font-size: 10px;
  218. padding: 3px 8px;
  219. border-radius: 4px;
  220. border: 1px solid;
  221. }
  222. .line {
  223. width: 100%;
  224. height: 1px;
  225. background-color: #E6D3C7;
  226. margin: 14px 0;
  227. }
  228. }
  229. .layout {
  230. height: 90px;
  231. position: relative;
  232. .layouts {
  233. width: 40%;
  234. height: 100%;
  235. background: #fff;
  236. box-shadow: 0px -2px 30px 0px #00000014;
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. justify-content: center;
  241. }
  242. .footerBtnLeft {
  243. border-top-right-radius: 25px;
  244. .imgClss {
  245. width: 30px;
  246. height: 30px;
  247. background-color: #000;
  248. margin-bottom: 6px;
  249. }
  250. }
  251. .footerBtnRight {
  252. border-top-left-radius: 25px;
  253. .imgClss {
  254. width: 26px;
  255. height: 24px;
  256. background-color: #000;
  257. margin-bottom: 9px;
  258. }
  259. }
  260. .coverWithWhite {
  261. width: 20%;
  262. background: #fff;
  263. position: absolute;
  264. bottom: 0;
  265. left: 50%;
  266. transform: translateX(-50%);
  267. height: 70px;
  268. z-index: 1;
  269. }
  270. .bigCircle {
  271. width: 80px;
  272. height: 80px;
  273. ;
  274. border-radius: 50%;
  275. background: $themeColor;
  276. box-shadow: 0px -2px 30px 0px #00000014;
  277. position: absolute;
  278. bottom: 27px;
  279. left: 50%;
  280. transform: translateX(-50%);
  281. z-index: 2;
  282. color: #fff;
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. flex-direction: column;
  287. .imgClss {
  288. width: 25.5px;
  289. height: 25.5px;
  290. margin-bottom: 4px;
  291. background: #000;
  292. }
  293. }
  294. }
  295. .newModuleAdded {
  296. padding: 45px 25px 45px 25px;
  297. }
  298. .topTitle {
  299. top: 14px;
  300. }
  301. .boxLxr {
  302. max-height: 180px;
  303. }
  304. </style>