index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <route lang="json5">
  2. {
  3. layout: 'tabbar',
  4. style: {
  5. navigationStyle: 'custom',
  6. navigationBarTitleText: '首页',
  7. },
  8. }
  9. </route>
  10. <script lang="ts" setup>
  11. import useRequest from '../../hooks/useRequest'
  12. import dayjs from 'dayjs'
  13. import { getCircles } from '../../core/libs/requests'
  14. import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
  15. import Card from '@designer-hub/app/src/components/card.vue'
  16. import { merchantPageHeaderBg, scanIcon, bookIcon } from '@designer-hub/assets/src/svgs'
  17. import { useUserStore } from '../../store'
  18. import { storeToRefs } from 'pinia'
  19. defineOptions({
  20. name: 'Home',
  21. })
  22. const userStore = useUserStore()
  23. const { isLogined, userInfo } = storeToRefs(userStore)
  24. // 测试 uni API 自动引入
  25. const { data } = useRequest(async () => ({ code: 0, msg: '', data: {} }) as IResData<any>, {
  26. initialData: {
  27. banners: [],
  28. hots: [
  29. {
  30. id: 1,
  31. title: '日本研学·东京艺术大学游学',
  32. img: '',
  33. start: dayjs('2024-07-15').toDate(),
  34. end: dayjs('2024-08-10').toDate(),
  35. },
  36. {
  37. id: 1,
  38. title: '日本研学·东京艺术大学游学',
  39. img: '',
  40. start: dayjs('2024-07-15').toDate(),
  41. end: dayjs('2024-08-10').toDate(),
  42. },
  43. ],
  44. dynamics: [
  45. {
  46. author: {
  47. avatar: 'https://via.placeholder.com/35x35',
  48. nickname: '苏小萌',
  49. level: '0',
  50. },
  51. content: '用心做好设计,为客户创造美好家居环境',
  52. images: ['https://via.placeholder.com/165x220'],
  53. tags: ['意大利游学设计班'],
  54. shares: 0,
  55. comments: 0,
  56. likes: 0,
  57. createdAt: dayjs('2024-07-15').toDate(),
  58. },
  59. {
  60. author: {
  61. avatar: 'https://via.placeholder.com/35x35',
  62. nickname: '苏小萌',
  63. level: '0',
  64. },
  65. content: '用心做好设计,为客户创造美好家居环境',
  66. images: ['https://via.placeholder.com/220x165'],
  67. tags: ['意大利游学设计班'],
  68. shares: 0,
  69. comments: 0,
  70. likes: 0,
  71. createdAt: dayjs('2024-07-15').toDate(),
  72. },
  73. {
  74. author: {
  75. avatar: 'https://via.placeholder.com/35x35',
  76. nickname: '苏小萌',
  77. level: '0',
  78. },
  79. content: '用心做好设计,为客户创造美好家居环境',
  80. images: [
  81. 'https://via.placeholder.com/104x104',
  82. 'https://via.placeholder.com/104x204',
  83. 'https://via.placeholder.com/204x104',
  84. ],
  85. tags: ['意大利游学设计班'],
  86. shares: 0,
  87. comments: 0,
  88. likes: 0,
  89. createdAt: dayjs('2024-07-15').toDate(),
  90. },
  91. ],
  92. studyTour: null,
  93. },
  94. })
  95. const { data: circlesData, run } = useRequest(() => getCircles({}), { initialData: { list: [] } })
  96. console.log(data.value)
  97. const toDesigner = () => {
  98. uni.navigateTo({ url: '/pages/designer/index' })
  99. }
  100. const toSettlement = async () => {
  101. console.log('11')
  102. await uni.navigateTo({ url: '/pages/home/merchant/settlement' })
  103. }
  104. onShow(async () => {
  105. // await run()
  106. console.log(circlesData.value)
  107. })
  108. onLoad(() => {
  109. console.log(isLogined.value)
  110. if (!isLogined.value) {
  111. uni.reLaunch({ url: '/pages/login/index' })
  112. }
  113. })
  114. onShareAppMessage(() => ({}))
  115. </script>
  116. <template>
  117. <view class="flex-grow relative">
  118. <template v-if="userInfo.appLoginType === 1">
  119. <div class="aspect-[0.96/1] absolute left-0 right-0 top--1">
  120. <wd-img
  121. width="100%"
  122. height="100%"
  123. :src="merchantPageHeaderBg"
  124. custom-class="vertical-bottom"
  125. ></wd-img>
  126. </div>
  127. 1
  128. <wd-navbar custom-class="bg-transparent!" safe-area-inset-top :bordered="false">
  129. <template #left>
  130. <div
  131. class="ml-1 text-center text-white text-lg font-normal font-['PingFang SC'] leading-relaxed"
  132. >
  133. 今日待办
  134. </div>
  135. </template>
  136. </wd-navbar>
  137. <div class="flex flex-col gap-8 p-4 relative box-border">
  138. <div>
  139. <SectionHeading
  140. title="渠道任务"
  141. path="/pages/home/tasks/index"
  142. end-text="查看全部"
  143. custom-class="mb-5"
  144. ></SectionHeading>
  145. <Card><wd-status-tip image="search" tip="当前暂无未开始/进行中的任务" /></Card>
  146. </div>
  147. <div>
  148. <SectionHeading title="设计师" path="" custom-class="mb-5"></SectionHeading>
  149. <div class="flex flex-col gap-4">
  150. <template
  151. v-for="{ label, color } of [
  152. { label: '重点跟进设计师', color: '#FF523F' },
  153. { label: '全部设计师', color: '#7199FF' },
  154. { label: '本月新增设计师', color: '#FFE786' },
  155. { label: '超过30天未跟进', color: '#89F4E3' },
  156. { label: '超过60天未产生积分设计师', color: '#FFBA6A' },
  157. { label: '超过60天未消耗积分设计师', color: '#C494FF' },
  158. { label: '未成交过设计师', color: '#FF9EE2' },
  159. ]"
  160. :key="label"
  161. >
  162. <div
  163. class="h-12 bg-white rounded-lg shadow flex items-center hover:bg-[#fff6f5]"
  164. @click="toDesigner"
  165. >
  166. <div
  167. class="w-1.5 h-12 rounded-tl-lg rounded-bl-lg shadow"
  168. :style="{ background: color }"
  169. ></div>
  170. <div class="flex-1 mx-3">
  171. <SectionHeading
  172. :title="label"
  173. path="/pages/designer/index"
  174. size="sm"
  175. ></SectionHeading>
  176. </div>
  177. </div>
  178. </template>
  179. </div>
  180. </div>
  181. <div>
  182. <SectionHeading title="设计师最新动态" path="" custom-class="mb-5"></SectionHeading>
  183. <div class="flex flex-col gap-4">
  184. <template
  185. v-for="{ title, date } of [
  186. { title: '苏小萌报名了日本设计游学', date: new Date() },
  187. { title: '苏小萌报名了骑行活动', date: new Date() },
  188. { title: '苏小萌获取imola16000积分', date: new Date() },
  189. ]"
  190. :key="title"
  191. >
  192. <Card>
  193. <div class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-none">
  194. {{ title }}
  195. </div>
  196. <div
  197. class="mt-3 text-black/30 text-xs font-normal font-['PingFang SC'] leading-none"
  198. >
  199. {{ dayjs(date).format('YYYY-MM-DD hh:mm') }}
  200. </div>
  201. </Card>
  202. </template>
  203. </div>
  204. </div>
  205. </div>
  206. </template>
  207. <template v-if="userInfo.appLoginType === 2">
  208. <div
  209. class="bg-white backdrop-blur-[60px] my-[16px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  210. >
  211. <div
  212. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[37px] flex items-center justify-center"
  213. >
  214. <wd-img width="36px" height="36px" :src="scanIcon"></wd-img>
  215. </div>
  216. <div class="w-full mt-[45px]">
  217. <wd-button block :round="false">
  218. <div
  219. class="text-center text-white text-base font-normal font-['PingFang SC'] leading-normal"
  220. >
  221. 扫码验券
  222. </div>
  223. </wd-button>
  224. </div>
  225. </div>
  226. <div
  227. class="bg-white backdrop-blur-[60px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  228. >
  229. <div
  230. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[34px] flex items-center justify-center"
  231. >
  232. <wd-img width="36px" height="36px" :src="bookIcon"></wd-img>
  233. </div>
  234. <div class="w-full flex items-center mt-[40px]">
  235. <div
  236. class="text-black/90 text-base font-normal font-['PingFang SC'] leading-relaxed width-[96px]"
  237. >
  238. 输入订单金额
  239. </div>
  240. <div class="bg-[#f5f7f9] rounded-lg flex items-center flex-1 ml-[16px]">
  241. <wd-input type="number" no-border placeholder="请输金额" />
  242. </div>
  243. </div>
  244. <div class="w-full flex items-center mt-[20px]">
  245. <div
  246. class="text-black/90 text-base font-normal font-['PingFang SC'] leading-relaxed width-[96px]"
  247. >
  248. 需支付积分
  249. </div>
  250. <div
  251. class="text-[#ff2d2d] text-base font-normal font-['PingFang SC'] leading-relaxed ml-[20px]"
  252. >
  253. 3400 积分
  254. </div>
  255. </div>
  256. <div class="w-full mt-[45px]">
  257. <wd-button block :round="false" @click="toSettlement">
  258. <div
  259. class="text-center text-white text-base font-normal font-['PingFang SC'] leading-normal"
  260. >
  261. 积分结账
  262. </div>
  263. </wd-button>
  264. </div>
  265. </div>
  266. </template>
  267. </view>
  268. </template>
  269. <style>
  270. /* :deep(.wd-input) {
  271. background: transparent;
  272. height: 100%;
  273. border: none;
  274. width: 100%;
  275. } */
  276. </style>