visitorDetails.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <Page title="访客计划详情">
  3. <template v-slot:body>
  4. <!-- 头部 -->
  5. <div class="planDetailsHead">
  6. <div class="w-full flex items-center justify-between">
  7. <div class="text-size-in font-bold text-[#474A56]">{{ detailedData.planName }}</div>
  8. <div :class="`labelTag ${detailedData.finishState == 0 ? 'toBeCompleted' : 'completed'}`">{{ ['未完成',
  9. '已完成'][detailedData.finishState] }}</div>
  10. </div>
  11. <div class="w-full mt-4">拜访目的:{{ detailedData.visitGoalName }}</div>
  12. <div class="w-full mt-4">拜访时间: {{ detailedData.visitTime }}</div>
  13. <div class="line"></div>
  14. <div class="w-full flex items-center">
  15. <van-icon name="user-circle-o" class="text-size-in mr-2" />
  16. 客户:
  17. <div class="ml-2 themeTextColor decoration-auto underline">{{ detailedData.customName }}</div>
  18. </div>
  19. </div>
  20. <!-- 主体 -->
  21. <van-cell-group>
  22. <van-cell title="计划名称" :value="detailedData.planName" />
  23. <van-cell title="客户姓名" :value="detailedData.customName" />
  24. <van-cell title="负责人" :value="detailedData.inchargerName" />
  25. <van-cell title="拜访目的" :value="detailedData.visitGoalName" />
  26. <van-cell title="拜访时间" :value="detailedData.visitTime" />
  27. <van-cell title="提醒" :value="detailedData.remindTypeName" />
  28. <van-cell title="提醒时间" :value="detailedData.remindTime" v-if="detailedData.remindType == -1" />
  29. <van-cell title="备注" :value="detailedData.remark" />
  30. </van-cell-group>
  31. <div class="h-10"></div>
  32. <!-- 弹窗 -->
  33. <van-popup v-model:show="showContacts" closeable position="bottom" round>
  34. <div class="newModuleAdded relative">
  35. <div class="text-size-large text-[#474A56] absolute topTitle">联系人号码</div>
  36. <div class="flex flex-col overflow-y-auto boxLxr">
  37. <template v-for="item in contactList">
  38. <a :href="`tel:+${item.phone}`">
  39. <div class="bg-[#F8F8FA] flex justify-between items-center px-6 py-4 mb-3 rounded">
  40. <div class="w-3/12">{{ item.name }}</div>
  41. <div class="flex-1">{{ item.phone }}</div>
  42. <van-icon name="phone" color="#075985" size="1.4rem" />
  43. </div>
  44. </a>
  45. </template>
  46. </div>
  47. </div>
  48. </van-popup>
  49. <van-popup v-model:show="showDelay" closeable position="bottom" round>
  50. <div class="newModuleAdded relative">
  51. <div class="text-size-large text-[#474A56] absolute topTitle">延期时间</div>
  52. <div class="flex flex-col overflow-y-auto h-52">
  53. <div class="flex-1">
  54. <div class="px-6 py-4 bg-[#F8F8FA] flex justify-between items-center mt-2" @click="showDatePicker = true">
  55. <div>选择时间</div>
  56. <div class="flex items-center">
  57. {{ showDelayData }}
  58. <van-icon name="arrow" size="1.2rem" class="ml-2" />
  59. </div>
  60. </div>
  61. </div>
  62. <van-button type="primary" :disabled="!showDelayData" @click="delayTimeEvent()">保存</van-button>
  63. </div>
  64. </div>
  65. </van-popup>
  66. <van-popup v-model:show="showDatePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
  67. <van-date-picker v-model="showDatePickerVal" @confirm="showPickerConfirm" @cancel="showDatePicker = false" />
  68. </van-popup>
  69. <van-popup
  70. v-model:show="timeShowPicker"
  71. destroy-on-close
  72. position="bottom"
  73. :style="{ height: '50%' }"
  74. >
  75. <van-time-picker v-model="currentTime" title="选择时间" @confirm="timeConfirm" />
  76. </van-popup>
  77. </template>
  78. <template v-slot:footer v-if="detailedData.finishState == 0">
  79. <div class="w-full flex justify-between layout">
  80. <div class="footerBtnLeft layouts" @click="showContacts = true">
  81. <div class="imgClss"></div>
  82. 联系人
  83. </div>
  84. <div class="footerBtnRight layouts" @click="showDelay = true, showDelayData = ''">
  85. <div class="imgClss"></div>
  86. 延期
  87. </div>
  88. <div class="coverWithWhite"></div>
  89. <div class="bigCircle" @click="completeThePlan()">
  90. <div class="imgClss"></div>
  91. 完成
  92. </div>
  93. </div>
  94. </template>
  95. </Page>
  96. </template>
  97. <script setup>
  98. import { ref } from "vue";
  99. import { showConfirmDialog } from 'vant';
  100. import { useLifecycle } from "@hooks/useCommon.js";
  101. import { OBTAIN_DETAILS_OF_THE_VISIT_PLAN, POSTPONE_THE_VISIT_PLAN, COMPLETE_THE_VISIT_PLAN } from "@hooks/useApi"
  102. import useToast from "@hooks/useToast"
  103. import requests from "@common/requests";
  104. import useRouterStore from "@store/useRouterStore.js";
  105. import dayjs from "dayjs";
  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 completeThePlan() {
  120. showConfirmDialog({
  121. title: `完成访客计划`,
  122. message: `确定完成【${detailedData.value.planName}】访客计划吗?`,
  123. }).then(() => {
  124. requests.post(COMPLETE_THE_VISIT_PLAN, { planId: detailedData.value.id, }).then((res) => {
  125. toastSuccess('操作成功')
  126. getDetailData(detailedData.value)
  127. })
  128. })
  129. }
  130. function delayTimeEvent() {
  131. requests.post(POSTPONE_THE_VISIT_PLAN, { planId: detailedData.value.id, visitTime: showDelayData.value }).then(() => {
  132. toastSuccess(`操作成功`)
  133. getDetailData(detailedData.value)
  134. })
  135. }
  136. function getDetailData(row) {
  137. requests.post(OBTAIN_DETAILS_OF_THE_VISIT_PLAN, { planId: row.id }).then(({ data = [] }) => {
  138. detailedData.value = data
  139. contactList.value = data.contacts || []
  140. })
  141. }
  142. function showPickerConfirm({ selectedValues }) {
  143. const dates = selectedValues.join('-')
  144. const times = dayjs().format("hh:mm")
  145. showDelayData.value = `${dates} ${times}`
  146. currentTime.value = times.split(':')
  147. showDatePicker.value = false
  148. timeShowPicker.value = true
  149. }
  150. function timeConfirm({ selectedValues }) {
  151. const dates = dayjs(new Date(showDatePickerVal.value)).format("YYYY-MM-DD")
  152. showDelayData.value = `${dates} ${selectedValues.join(':')}`
  153. timeShowPicker.value = false
  154. }
  155. function processingDataSource(data) {
  156. const row = JSON.parse(data.row);
  157. detailedData.value = row || {}
  158. getDetailData(row)
  159. }
  160. useLifecycle({
  161. load: () => {
  162. router.on("visitorDetailsParameter", (data) => {
  163. processingDataSource(data);
  164. });
  165. },
  166. });
  167. </script>
  168. <style lang="scss" scoped>
  169. .planDetailsHead {
  170. background: #ffa35919;
  171. padding: 14px 18px;
  172. margin: 10px;
  173. .toBeCompleted {
  174. background: rgba($color: #f38b3c, $alpha: 0.1);
  175. border-color: #f38b3c;
  176. color: #f38b3c;
  177. }
  178. .completed {
  179. background: rgba($color: #07c160, $alpha: 0.1);
  180. border-color: #07c160;
  181. color: #07c160;
  182. }
  183. .labelTag {
  184. font-size: 10px;
  185. padding: 3px 8px;
  186. border-radius: 4px;
  187. border: 1px solid;
  188. }
  189. .line {
  190. width: 100%;
  191. height: 1px;
  192. background-color: #E6D3C7;
  193. margin: 14px 0;
  194. }
  195. }
  196. .layout {
  197. height: 90px;
  198. position: relative;
  199. .layouts {
  200. width: 40%;
  201. height: 100%;
  202. background: #fff;
  203. box-shadow: 0px -2px 30px 0px #00000014;
  204. display: flex;
  205. flex-direction: column;
  206. align-items: center;
  207. justify-content: center;
  208. }
  209. .footerBtnLeft {
  210. border-top-right-radius: 25px;
  211. .imgClss {
  212. width: 30px;
  213. height: 30px;
  214. background-color: #000;
  215. margin-bottom: 6px;
  216. }
  217. }
  218. .footerBtnRight {
  219. border-top-left-radius: 25px;
  220. .imgClss {
  221. width: 26px;
  222. height: 24px;
  223. background-color: #000;
  224. margin-bottom: 9px;
  225. }
  226. }
  227. .coverWithWhite {
  228. width: 20%;
  229. background: #fff;
  230. position: absolute;
  231. bottom: 0;
  232. left: 50%;
  233. transform: translateX(-50%);
  234. height: 70px;
  235. z-index: 1;
  236. }
  237. .bigCircle {
  238. width: 80px;
  239. height: 80px;
  240. ;
  241. border-radius: 50%;
  242. background: $themeColor;
  243. box-shadow: 0px -2px 30px 0px #00000014;
  244. position: absolute;
  245. bottom: 27px;
  246. left: 50%;
  247. transform: translateX(-50%);
  248. z-index: 2;
  249. color: #fff;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. flex-direction: column;
  254. .imgClss {
  255. width: 25.5px;
  256. height: 25.5px;
  257. margin-bottom: 4px;
  258. background: #000;
  259. }
  260. }
  261. }
  262. .newModuleAdded {
  263. padding: 45px 25px 45px 25px;
  264. }
  265. .topTitle {
  266. top: 14px;
  267. }
  268. .boxLxr {
  269. max-height: 180px;
  270. }
  271. </style>