index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <route lang="json">
  2. {
  3. "style": {
  4. "navigationStyle": "custom"
  5. }
  6. }
  7. </route>
  8. <script setup lang="ts">
  9. import { getByDictType, getCircles, reserveDesigner } from '../../../../core/libs/requests'
  10. import { useUserStore } from '../../../../store'
  11. import { storeToRefs } from 'pinia'
  12. import { NetImages } from '../../../../core/libs/net-images'
  13. import BottomAppBar from '@/components/bottom-app-bar.vue'
  14. import { useRouter } from '../../../../core/utils/router'
  15. import NavbarEvo from '@/components/navbar-evo.vue'
  16. import { requestToast } from '../../../../core/utils/common'
  17. const router = useRouter()
  18. const userStore = useUserStore()
  19. const { userInfo } = storeToRefs(userStore)
  20. const id = ref()
  21. const tab = ref('2')
  22. const form = ref({ appointmentName: '', appointmentPhone: '' })
  23. const { data: circleTypes, run: getCircleType } = useRequest(() =>
  24. getByDictType('member_circle_type'),
  25. )
  26. const circlesData = ref({ list: [] })
  27. const setCirclesData = async (circleType) => {
  28. const { data } = await getCircles({
  29. circleType,
  30. stylistId: id.value,
  31. })
  32. circlesData.value = data
  33. }
  34. const tabs = ref([
  35. { label: '案例', value: '2' },
  36. { label: '动态', value: '1' },
  37. { label: '视频', value: '0' },
  38. ])
  39. const handleTabsChange = async ({ name }: any) => {
  40. if (['1', '2'].includes(name)) {
  41. await setCirclesData(name)
  42. }
  43. }
  44. onMounted(async () => {})
  45. onLoad(async (query: { id: string }) => {
  46. if (query.id) {
  47. id.value = query.id
  48. } else {
  49. id.value = userInfo.value.userId
  50. }
  51. await setCirclesData(tab.value)
  52. console.log(circleTypes.value)
  53. })
  54. const handleSubmit = async () => {
  55. const { code } = await requestToast(
  56. () =>
  57. reserveDesigner({
  58. ...form.value,
  59. stylistId: id.value,
  60. stylistName: '',
  61. }),
  62. { success: false, successTitle: '设计师预约成功' },
  63. )
  64. if (code === 0) {
  65. form.value = { appointmentName: '', appointmentPhone: '' }
  66. router.replace(`/pages/mine/homepage/consult/success/index?name=${''}`)
  67. }
  68. }
  69. onShareAppMessage(() => ({ title: `${userInfo.value.nickname}` }))
  70. defineExpose({
  71. navBarFixed: false,
  72. })
  73. </script>
  74. <template>
  75. <div class="flex-grow flex flex-col px-3.5">
  76. <NavbarEvo transparent dark></NavbarEvo>
  77. <div class="relative aspect-[0.79/1] mx--3.5">
  78. <div class="absolute top-0 left-0 w-full h-full">
  79. <wd-img
  80. width="100%"
  81. height="100%"
  82. :src="NetImages.ConsultDefaultBg"
  83. mode="widthFix"
  84. custom-class="aspect-[0.71/1]"
  85. />
  86. </div>
  87. </div>
  88. <div class="flex-grow flex flex-col bg-white rounded-t-2xl relative px-4">
  89. <div class="mt-13 flex gap-3 border-b-1 border-b-solid border-b-[#e1e1e1] pb-3">
  90. <div class="px-4 py-0.5 bg-[#2b2725] rounded justify-center items-center gap-2.5 flex">
  91. <div
  92. class="text-center text-white text-base font-normal font-['PingFang_SC'] tracking-wide"
  93. >
  94. 姓名
  95. </div>
  96. </div>
  97. <div class="flex-1 flex items-center">
  98. <wd-input
  99. placeholder="请填写您的真实姓名"
  100. no-border
  101. v-model="form.appointmentName"
  102. ></wd-input>
  103. </div>
  104. </div>
  105. <div class="mt-13 flex gap-3 border-b-1 border-b-solid border-b-[#e1e1e1] pb-3">
  106. <div class="px-4 py-0.5 bg-[#2b2725] rounded justify-center items-center gap-2.5 flex">
  107. <div
  108. class="text-center text-white text-base font-normal font-['PingFang_SC'] tracking-wide"
  109. >
  110. 电话
  111. </div>
  112. </div>
  113. <div class="flex-1 flex items-center">
  114. <wd-input
  115. placeholder="请输入您的手机号"
  116. no-border
  117. v-model="form.appointmentPhone"
  118. ></wd-input>
  119. </div>
  120. </div>
  121. </div>
  122. <BottomAppBar fixed placeholder>
  123. <div class="flex gap-7.5">
  124. <div class="flex-1">
  125. <wd-button block :round="false" @click="handleSubmit">提交预约</wd-button>
  126. </div>
  127. </div>
  128. </BottomAppBar>
  129. </div>
  130. </template>