index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 { getDeignerPointsActivities, scanCodeCheckPaper } 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. import { qrCodeString2Object, requestToast } from '@designer-hub/app/src/core/utils/common'
  20. import { QrCodeBusinessType } from '../../core/libs/enums'
  21. import { useRouter } from '../../composables/router'
  22. import PageHelperEvo from '@/components/page-helper-evo.vue'
  23. defineOptions({
  24. name: 'Home',
  25. })
  26. const router = useRouter()
  27. const userStore = useUserStore()
  28. const { isLogined, userInfo } = storeToRefs(userStore)
  29. const orderAmount = ref()
  30. const pointsAmount = computed(() => orderAmount.value * 10)
  31. const toDesigner = () => {
  32. uni.navigateTo({ url: '/pages/designer/index' })
  33. }
  34. const handleScanning = async () => {
  35. console.log('handleScanning')
  36. const { result } = await uni.scanCode({ scanType: ['qrCode'] })
  37. const { type, options } = qrCodeString2Object(result)
  38. if (type !== QrCodeBusinessType.InStoreWriteOff) {
  39. uni.showToast({ title: '不支持此二维码/条码', icon: 'none', duration: 5000 })
  40. return
  41. }
  42. await requestToast(() => scanCodeCheckPaper({ orderNo: options.no }), {
  43. success: true,
  44. successTitle: '验券成功',
  45. })
  46. }
  47. const handle2Settlement = () => {
  48. if ((orderAmount.value ?? '') === '') {
  49. uni.showToast({ title: '请输入金额', icon: 'none', duration: 5000 })
  50. return
  51. }
  52. router.push(
  53. `/pages/home/merchant/settlement?orderAmount=${orderAmount.value}&pointsAmount=${pointsAmount.value}`,
  54. )
  55. }
  56. const toAddReporting = () => {
  57. uni.navigateTo({ url: '/pages/home/merchant/add-reporting-information' })
  58. }
  59. onShow(async () => {
  60. await Promise.all([])
  61. })
  62. onLoad(() => {
  63. console.log(isLogined.value)
  64. if (!isLogined.value) {
  65. uni.reLaunch({ url: '/pages/login/index' })
  66. }
  67. })
  68. onShareAppMessage(() => ({}))
  69. </script>
  70. <template>
  71. <view class="flex-grow relative">
  72. <template v-if="userInfo.appLoginType === 1">
  73. <div class="aspect-[0.96/1] absolute left-0 right-0 top--1">
  74. <wd-img
  75. width="100%"
  76. height="100%"
  77. :src="merchantPageHeaderBg"
  78. custom-class="vertical-bottom"
  79. ></wd-img>
  80. </div>
  81. <wd-navbar custom-class="bg-transparent!" safe-area-inset-top :bordered="false">
  82. <template #left>
  83. <div
  84. @click="toAddReporting"
  85. class="ml-1 text-center text-white text-lg font-normal font-['PingFang_SC'] leading-relaxed"
  86. >
  87. 今日待办
  88. </div>
  89. </template>
  90. </wd-navbar>
  91. <div class="flex flex-col gap-8 p-4 relative box-border">
  92. <div>
  93. <div class="text-white text-sm font-normal font-['PingFang_SC'] leading-relaxed my-2.5">
  94. {{ dayjs().format('YYYY-MM-DD') }}
  95. </div>
  96. <Card>
  97. <div>
  98. <!-- <wd-steps :active="1" vertical>
  99. <wd-step description="注册1个账号" />
  100. <wd-step description="登录账号并绑定手机" />
  101. <wd-step description="完善个人信息" />
  102. </wd-steps> -->
  103. <div
  104. class="flex items-center justify-center b-t b-t-solid b-t-[#f6f6f6] pt-3.5"
  105. @click="router.push('/pages/home/agent/todo/index')"
  106. >
  107. <div class="text-[#2357e9] text-xs font-normal font-['PingFang_SC'] leading-none">
  108. 全部待办
  109. </div>
  110. <wd-icon name="arrow-right" size="10" color="#2357e9" />
  111. </div>
  112. </div>
  113. </Card>
  114. </div>
  115. <div>
  116. <SectionHeading
  117. title="渠道任务"
  118. path="/pages/home/tasks/index"
  119. end-text="查看全部"
  120. custom-class="mb-5"
  121. ></SectionHeading>
  122. <Card><wd-status-tip image="search" tip="当前暂无未开始/进行中的任务" /></Card>
  123. </div>
  124. <div>
  125. <SectionHeading title="设计师" path="" custom-class="mb-5"></SectionHeading>
  126. <div class="flex flex-col gap-4">
  127. <template
  128. v-for="{ label, color } of [
  129. { label: '重点跟进设计师', color: '#FF523F' },
  130. { label: '全部设计师', color: '#7199FF' },
  131. { label: '本月新增设计师', color: '#FFE786' },
  132. { label: '超过30天未跟进', color: '#89F4E3' },
  133. { label: '超过60天未产生积分设计师', color: '#FFBA6A' },
  134. { label: '超过60天未消耗积分设计师', color: '#C494FF' },
  135. { label: '未成交过设计师', color: '#FF9EE2' },
  136. ]"
  137. :key="label"
  138. >
  139. <div
  140. class="h-12 bg-white rounded-lg shadow flex items-center hover:bg-[#fff6f5]"
  141. @click="toDesigner"
  142. >
  143. <div
  144. class="w-1.5 h-12 rounded-tl-lg rounded-bl-lg shadow"
  145. :style="{ background: color }"
  146. ></div>
  147. <div class="flex-1 mx-3">
  148. <SectionHeading
  149. :title="label"
  150. path="/pages/designer/index"
  151. size="sm"
  152. ></SectionHeading>
  153. </div>
  154. </div>
  155. </template>
  156. </div>
  157. </div>
  158. <div>
  159. <SectionHeading title="设计师最新动态" path="" custom-class="mb-5"></SectionHeading>
  160. <PageHelperEvo
  161. :request="getDeignerPointsActivities"
  162. :query="{ brokerId: userInfo.userId }"
  163. >
  164. <template #default="{ source }">
  165. <div class="flex flex-col gap-4">
  166. <template v-for="({ title, date }, i) in source.list" :key="i">
  167. <Card>
  168. <div
  169. class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-none"
  170. >
  171. {{ title }}
  172. </div>
  173. <div
  174. class="mt-3 text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
  175. >
  176. {{ dayjs(date).format('YYYY-MM-DD hh:mm') }}
  177. </div>
  178. </Card>
  179. </template>
  180. </div>
  181. </template>
  182. </PageHelperEvo>
  183. </div>
  184. </div>
  185. </template>
  186. <template v-if="userInfo.appLoginType === 2">
  187. <div
  188. class="bg-white backdrop-blur-[60px] my-[16px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  189. >
  190. <div
  191. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[37px] flex items-center justify-center"
  192. >
  193. <wd-img width="36px" height="36px" :src="scanIcon"></wd-img>
  194. </div>
  195. <div class="w-full mt-[45px]">
  196. <wd-button block :round="false" @click="handleScanning">
  197. <div
  198. class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
  199. >
  200. 扫码验券
  201. </div>
  202. </wd-button>
  203. </div>
  204. </div>
  205. <div
  206. class="bg-white backdrop-blur-[60px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
  207. >
  208. <div
  209. class="w-[68px] h-[68px] bg-[#2357e9] rounded-full mt-[34px] flex items-center justify-center"
  210. >
  211. <wd-img width="36px" height="36px" :src="bookIcon"></wd-img>
  212. </div>
  213. <div class="w-full flex items-center mt-[40px] gap-5">
  214. <div
  215. class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed w-[96px]"
  216. >
  217. 输入订单金额
  218. </div>
  219. <div class="flex-1 bg-[#f5f7f9] rounded-lg flex items-center p-3.5">
  220. <wd-input
  221. custom-class="bg-transparent! flex-1"
  222. type="number"
  223. no-border
  224. placeholder="请输金额"
  225. v-model="orderAmount"
  226. />
  227. </div>
  228. </div>
  229. <div class="w-full flex items-center mt-[20px] gap-5">
  230. <div
  231. class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed w-[96px]"
  232. >
  233. 需支付积分
  234. </div>
  235. <div class="text-[#ff2d2d] text-base font-normal font-['PingFang_SC'] leading-relaxed">
  236. {{ pointsAmount }} 积分
  237. </div>
  238. </div>
  239. <div class="w-full mt-[45px]">
  240. <wd-button block :round="false" @click="handle2Settlement">
  241. <div
  242. class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
  243. >
  244. 积分结账
  245. </div>
  246. </wd-button>
  247. </div>
  248. </div>
  249. </template>
  250. </view>
  251. </template>
  252. <style></style>