index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <route lang="json5">
  2. {
  3. layout: 'tabbar',
  4. style: {
  5. navigationBarTitleText: '首页',
  6. navigationBarBackgroundColor: '#fff',
  7. navigationStyle: 'custom',
  8. },
  9. }
  10. </route>
  11. <script lang="ts" setup>
  12. import dayjs from 'dayjs'
  13. import {
  14. getDesignerPointsActivities,
  15. getTaskList,
  16. getTodoPage,
  17. getTodos,
  18. scanCodeCheckPaper,
  19. } from '../../core/libs/requests'
  20. import SectionHeading from '@/components/section-heading.vue'
  21. import Card from '@designer-hub/app/src/components/card.vue'
  22. import { merchantPageHeaderBg, scanIcon, bookIcon } from '@designer-hub/assets/src/svgs'
  23. import { useUserStore } from '../../store'
  24. import { storeToRefs } from 'pinia'
  25. import { qrCodeString2Object, requestToast } from '@designer-hub/app/src/core/utils/common'
  26. import { QrCodeBusinessType } from '../../core/libs/enums'
  27. import { useRouter } from '../../composables/router'
  28. import PageHelperEvo from '@/components/page-helper-evo.vue'
  29. import TaskCard from '../agent/components/task-card.vue'
  30. import { getTasks } from '../../core/libs/agent-requests'
  31. import { ComponentExposed } from 'vue-component-type-helpers'
  32. defineOptions({
  33. name: 'Home',
  34. })
  35. const router = useRouter()
  36. const userStore = useUserStore()
  37. const { isLogined, userInfo, isAgent, isMerchant } = storeToRefs(userStore)
  38. const orderAmount = ref()
  39. const todoPageHelperRef = ref<ComponentExposed<typeof PageHelperEvo>>()
  40. const pointsAmount = computed(() => orderAmount.value * 10)
  41. const dynamicsList = ref<{ content: string, createTime: number }[]>([]);
  42. const todosQuery = computed(() => ({
  43. brokerId: String(userInfo.value.userId),
  44. executionTime: [
  45. dayjs().startOf('days').format('YYYY-MM-DD HH:mm:ss'),
  46. dayjs().endOf('days').format('YYYY-MM-DD HH:mm:ss'),
  47. ].join(','),
  48. }))
  49. const designerPointsActivitiesQuery = computed(() => ({
  50. brokerId: String(userInfo.value.userId),
  51. }))
  52. const { data: tasks, run: setTasks } = useRequest(
  53. () => getTasks({ brokerId: userInfo.value.userId, status: '1,2', pageNo: 1, pageSize: -1 }),
  54. { initialData: { list: [], total: 0 } },
  55. )
  56. const toDesigner = () => {
  57. uni.navigateTo({ url: '/pages/designer/index' })
  58. }
  59. const handleScanning = async () => {
  60. console.log('handleScanning')
  61. const { result } = await uni.scanCode({ scanType: ['qrCode'] })
  62. const { type, options } = qrCodeString2Object(result)
  63. if (type !== QrCodeBusinessType.InStoreWriteOff) {
  64. uni.showToast({ title: '不支持此二维码/条码', icon: 'none', duration: 5000 })
  65. return
  66. }
  67. await requestToast(() => scanCodeCheckPaper({ orderNo: options.no }), {
  68. success: true,
  69. successTitle: '验券成功',
  70. })
  71. }
  72. const handle2Settlement = () => {
  73. if ((orderAmount.value ?? '') === '') {
  74. uni.showToast({ title: '请输入金额', icon: 'none', duration: 5000 })
  75. return
  76. }
  77. router.push(
  78. `/pages/home/merchant/settlement?orderAmount=${orderAmount.value}&pointsAmount=${pointsAmount.value}`,
  79. )
  80. }
  81. const toAddReporting = () => {
  82. uni.navigateTo({ url: '/pages/home/merchant/add-reporting-information' })
  83. }
  84. const getDynamicsList = async () =>{
  85. await getDesignerPointsActivities({brokerId:String(userInfo.value.userId)}).then(x =>{
  86. dynamicsList.value = x.data.list
  87. });
  88. console.log(dynamicsList.value,"dynamicsList.value")
  89. }
  90. onShow(async () => {
  91. if (isAgent.value) {
  92. await Promise.all([setTasks(), todoPageHelperRef.value?.refresh()])
  93. }
  94. getDynamicsList();
  95. })
  96. onLoad(() => {
  97. console.log(isLogined.value)
  98. if (!isLogined.value) {
  99. uni.reLaunch({ url: '/pages/login/index' })
  100. }
  101. })
  102. onShareAppMessage(() => ({}))
  103. </script>
  104. <template>
  105. <view class="flex-grow relative">
  106. <template v-if="isAgent">
  107. <div class="aspect-[0.96/1] absolute left-0 right-0 top--1">
  108. <wd-img
  109. width="100%"
  110. height="100%"
  111. :src="merchantPageHeaderBg"
  112. custom-class="vertical-bottom"
  113. ></wd-img>
  114. </div>
  115. <wd-navbar custom-class="bg-transparent!" safe-area-inset-top :bordered="false">
  116. <template #left>
  117. <div
  118. class="ml-1 text-center text-white text-lg font-normal font-['PingFang_SC'] leading-relaxed"
  119. >
  120. 今日待办
  121. </div>
  122. </template>
  123. </wd-navbar>
  124. <div class="flex flex-col gap-8 p-4 relative box-border">
  125. <div>
  126. <div class="text-white text-sm font-normal font-['PingFang_SC'] leading-relaxed my-2.5">
  127. {{ dayjs().format('YYYY-MM-DD') }}
  128. </div>
  129. <Card>
  130. <div>
  131. <PageHelperEvo ref="todoPageHelperRef" :request="getTodoPage" :query="todosQuery">
  132. <template #default="{ source }">
  133. <div class="flex flex-col py-6">
  134. <template v-for="(it, index) in source?.list" :key="index">
  135. <div>
  136. <div class="grid grid-cols-[56px_12px_1fr] items-center gap-4">
  137. <div
  138. class="w-14 text-end text-black text-base font-normal font-['PingFang_SC'] leading-none"
  139. >
  140. {{ dayjs(it.executionTime).format('HH:mm') }}
  141. </div>
  142. <div class="w-3 h-3 relative">
  143. <div
  144. class="w-3 h-3 left-0 top-0 absolute rounded-full"
  145. :class="`${it.status === 1 ? 'bg-[#517df8]/10' : 'bg-[#5e5e5e]/10'}`"
  146. ></div>
  147. <div
  148. class="w-1.5 h-1.5 left-[3px] top-[3px] absolute rounded-full"
  149. :class="`${it.status === 1 ? 'bg-[#517df8]' : 'bg-[#a8a8a8]'}`"
  150. ></div>
  151. </div>
  152. <div class="text-black/60 text-sm font-normal font-['PingFang_SC']">
  153. {{ it.content }}
  154. </div>
  155. </div>
  156. <div
  157. v-if="index < (source?.list?.length ?? 0) - 1"
  158. class="grid grid-cols-[56px_12px_1fr] gap-4"
  159. >
  160. <div class=""></div>
  161. <div class="w-3 flex justify-center">
  162. <div class="w-.25 h-10 bg-[#EDEDED]"></div>
  163. </div>
  164. <div></div>
  165. </div>
  166. </div>
  167. </template>
  168. </div>
  169. </template>
  170. </PageHelperEvo>
  171. <div
  172. class="flex items-center justify-center b-t b-t-solid b-t-[#f6f6f6] pt-3.5"
  173. @click="router.push('/pages/agent/todo/index')"
  174. >
  175. <div class="text-[#2357e9] text-xs font-normal font-['PingFang_SC'] leading-none">
  176. 全部待办
  177. </div>
  178. <wd-icon name="arrow-right" size="10" color="#2357e9" />
  179. </div>
  180. </div>
  181. </Card>
  182. </div>
  183. <div>
  184. <SectionHeading
  185. title="任务"
  186. path="/pages/agent/tasks/index"
  187. end-text="查看全部"
  188. custom-class="mb-5"
  189. ></SectionHeading>
  190. <div class="flex overflow-x-auto whitespace-nowrap mx--4 px-4 gap-4 box-border">
  191. <Card custom-class="w-full" v-if="!tasks.list.length">
  192. <wd-status-tip image="search" tip="当前暂无未开始/进行中的任务" />
  193. </Card>
  194. <template v-for="(it, i) in tasks.list" :key="i">
  195. <div class="inline-block">
  196. <div class="w-[calc(75vw)]">
  197. <TaskCard :options="it" @change="setTasks()"></TaskCard>
  198. </div>
  199. </div>
  200. </template>
  201. </div>
  202. </div>
  203. <div>
  204. <SectionHeading title="设计师" path="" custom-class="mb-5"></SectionHeading>
  205. <div class="flex flex-col gap-4">
  206. <template
  207. v-for="{ label, color, ...it } of [
  208. {
  209. label: '关系报备',
  210. color: 'white',
  211. path: '/pages/agent/report-infos/index',
  212. },
  213. {
  214. label: '全部设计师',
  215. color: '#7199FF',
  216. path: '/pages/agent/designer/index?title=全部设计师',
  217. },
  218. {
  219. label: '重点跟进设计师',
  220. color: '#FF523F',
  221. path: '/pages/agent/designer/index?title=重点跟进设计师&tags=1',
  222. },
  223. {
  224. label: '本月新增设计师',
  225. color: '#FFE786',
  226. path: '/pages/agent/designer/index?title=本月新增设计师&tags=2',
  227. },
  228. {
  229. label: '超过30天未跟进',
  230. color: '#89F4E3',
  231. path: '/pages/agent/designer/index?title=超过30天未跟进&tags=3',
  232. },
  233. {
  234. label: '超过60天未产生积分设计师',
  235. color: '#FFBA6A',
  236. path: '/pages/agent/designer/index?title=超过60天未产生积分设计师&tags=4',
  237. },
  238. {
  239. label: '超过60天未消耗积分设计师',
  240. color: '#C494FF',
  241. path: '/pages/agent/designer/index?title=超过60天未消耗积分设计师&tags=5',
  242. },
  243. {
  244. label: '未成交过设计师',
  245. color: '#FF9EE2',
  246. path: '/pages/agent/designer/index?title=未成交过设计师&tags=6',
  247. },
  248. ]"
  249. :key="label"
  250. >
  251. <div class="h-12 bg-white rounded-lg shadow flex items-center hover:bg-[#fff6f5]">
  252. <div
  253. class="w-1.5 h-12 rounded-tl-lg rounded-bl-lg shadow"
  254. :style="{ background: color }"
  255. ></div>
  256. <div class="flex-1 mx-3">
  257. <SectionHeading :title="label" :path="it.path" size="sm"></SectionHeading>
  258. </div>
  259. </div>
  260. </template>
  261. </div>
  262. </div>
  263. <div>
  264. <SectionHeading title="设计师最新动态" path="" custom-class="mb-5"></SectionHeading>
  265. <!-- <PageHelperEvo-->
  266. <!-- :request="getDesignerPointsActivities"-->
  267. <!-- :query="designerPointsActivitiesQuery"-->
  268. <!-- >-->
  269. <!-- <template>-->
  270. <div class="flex flex-col gap-4" v-for="(it, i) in dynamicsList" :key="i">
  271. <!-- <template >-->
  272. <Card class="mb-4">
  273. <div
  274. class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-none"
  275. >
  276. {{ it.content }}
  277. </div>
  278. <div
  279. class="mt-3 text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
  280. >
  281. {{ dayjs(it.createTime).format('YYYY-MM-DD HH:mm') }}
  282. </div>
  283. </Card>
  284. <!-- </template>-->
  285. </div>
  286. <!-- </template>-->
  287. <!-- </PageHelperEvo>-->
  288. </div>
  289. </div>
  290. </template>
  291. <template v-if="isMerchant">
  292. <div
  293. class="bg-white backdrop-blur-[60px] my-[16px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  294. >
  295. <div
  296. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[37px] flex items-center justify-center"
  297. >
  298. <wd-img width="36px" height="36px" :src="scanIcon"></wd-img>
  299. </div>
  300. <div class="w-full mt-[45px]">
  301. <wd-button block :round="false" @click="handleScanning">
  302. <div
  303. class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
  304. >
  305. 扫码验券
  306. </div>
  307. </wd-button>
  308. </div>
  309. </div>
  310. <div
  311. class="bg-white backdrop-blur-[60px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  312. >
  313. <div
  314. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[34px] flex items-center justify-center"
  315. >
  316. <wd-img width="36px" height="36px" :src="bookIcon"></wd-img>
  317. </div>
  318. <div class="w-full flex items-center mt-[40px] gap-5">
  319. <div
  320. class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed w-[96px]"
  321. >
  322. 输入订单金额
  323. </div>
  324. <div class="flex-1 bg-[#f5f7f9] rounded-lg flex items-center p-3.5">
  325. <wd-input
  326. custom-class="bg-transparent! flex-1"
  327. type="number"
  328. no-border
  329. placeholder="请输金额"
  330. v-model="orderAmount"
  331. />
  332. </div>
  333. </div>
  334. <div class="w-full flex items-center mt-[20px] gap-5">
  335. <div
  336. class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed w-[96px]"
  337. >
  338. 需支付积分
  339. </div>
  340. <div class="text-[#ff2d2d] text-base font-normal font-['PingFang_SC'] leading-relaxed">
  341. {{ pointsAmount }} 积分
  342. </div>
  343. </div>
  344. <div class="w-full mt-[45px]">
  345. <wd-button block :round="false" @click="handle2Settlement">
  346. <div
  347. class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
  348. >
  349. 积分结账
  350. </div>
  351. </wd-button>
  352. </div>
  353. </div>
  354. </template>
  355. </view>
  356. </template>
  357. <style></style>