index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <script setup lang="ts">
  2. import { StaticUrl } from '@/config'
  3. import router from '@/router'
  4. definePage({
  5. name: 'smqjh-my',
  6. layout: 'tabbar',
  7. islogin: false,
  8. style: {
  9. navigationBarTitleText: '个人中心',
  10. navigationStyle: 'custom',
  11. disableScroll: true,
  12. },
  13. })
  14. const tabList = ref([
  15. { title: '待支付', icon: `${StaticUrl}/1.png`, name: 'smqjh-order' },
  16. { title: '待收货', icon: `${StaticUrl}/2.png`, name: 'smqjh-order' },
  17. { title: '已完成', icon: `${StaticUrl}/6.png`, name: 'smqjh-order' },
  18. { title: '退款售后', icon: `${StaticUrl}/3.png`, name: 'common-afterSalesList' },
  19. ])
  20. onMounted(() => {
  21. useUserStore().getUserInfo()
  22. })
  23. const { token, userInfo, getUserAvatar } = storeToRefs(useUserStore())
  24. function handleLoginOut() {
  25. useGlobalMessage().confirm({
  26. title: '提示',
  27. msg: '确定要退出登录吗?',
  28. success: async () => {
  29. useUserStore().$reset()
  30. useSmqjhCartStore().$reset()
  31. useAddressStore().$reset()
  32. router.replace({ name: 'smqjh-login' })
  33. },
  34. })
  35. }
  36. function handleGo(item: { name: string }) {
  37. if (item.name === 'common-afterSalesList') {
  38. useGlobalToast().show('此功能暂未开放')
  39. return
  40. }
  41. router.push({ name: item.name })
  42. }
  43. </script>
  44. <template>
  45. <view class="page-class bg-#F9F9F9 dark:bg-[var(--wot-dark-background)]">
  46. <wd-navbar
  47. title="个人中心" custom-style="background-color: transparent !important;" :bordered="false"
  48. safe-area-inset-top fixed :z-index="99"
  49. />
  50. <view class="header relative h-408rpx rounded-18px">
  51. <view class="absolute bottom-100rpx left-0 box-border w-full flex items-center justify-between pl48rpx pr58rpx">
  52. <template v-if="!token">
  53. <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx" />
  54. <view class="text-32rpx font-semibold">
  55. 请登录后使用完整功能
  56. </view>
  57. <wd-button custom-class="login-btn" @click="router.replace({ name: 'smqjh-login' })">
  58. 登录
  59. </wd-button>
  60. </template>
  61. <template v-else>
  62. <view class="flex items-center">
  63. <image :src="getUserAvatar" alt="" class="h100rpx w100rpx flex-shrink-0 rounded-full" />
  64. <view class="ml20rpx flex-1">
  65. <view class="text-32rpx font-semibold">
  66. {{ userInfo.nickName }}
  67. </view>
  68. <view class="mt12rpx rounded-8rpx bg-white px12rpx py4rpx text-24rpx text-[var(--them-color)] opacity-70">
  69. {{ userInfo.channelName }}
  70. </view>
  71. </view>
  72. </view>
  73. <view class="flex flex-col items-center" @click="router.push({ name: 'common-user-center' })">
  74. <image
  75. :src="`${StaticUrl}/user-setting.png`"
  76. class="h48rpx w48rpx"
  77. />
  78. <view class="mt12rpx text-24rpx text-[var(--them-color)]">
  79. 账户设置
  80. </view>
  81. </view>
  82. </template>
  83. </view>
  84. </view>
  85. <view class="relative z-50 -mt48rpx">
  86. <wd-card>
  87. <template #title>
  88. <view class="flex items-center justify-between">
  89. <view class="text-32rpx font-semibold">
  90. 订单列表
  91. </view>
  92. <view class="flex items-center" @click="router.push({ name: 'smqjh-order' })">
  93. <view class="text-28rpx">
  94. 查看全部
  95. </view>
  96. <wd-icon name="arrow-right" size="18px" />
  97. </view>
  98. </view>
  99. </template>
  100. <view class="grid grid-cols-4 gap-4">
  101. <view v-for="item in tabList" :key="item.title" class="flex flex-col items-center justify-center" @click="handleGo(item)">
  102. <image :src="item.icon" class="h56rpx w56rpx" />
  103. <view class="mt20rpx text-24rpx">
  104. {{ item.title }}
  105. </view>
  106. </view>
  107. </view>
  108. <view class="h20rpx" />
  109. </wd-card>
  110. </view>
  111. <view class="item-cell mt20rpx">
  112. <wd-card custom-class="card">
  113. <wd-cell-group custom-class="cell-group">
  114. <wd-cell title="收货地址" custom-title-class="cell-title" clickable is-link @click="router.push({ name: 'common-addressList' })">
  115. <template #icon>
  116. <image :src="`${StaticUrl}/4.png`" class="h50rpx w50rpx" />
  117. </template>
  118. </wd-cell>
  119. <wd-cell custom-title-class="cell-title" clickable is-link>
  120. <template #icon>
  121. <image :src="`${StaticUrl}/5.png`" class="h50rpx w50rpx" />
  122. </template>
  123. <template #title>
  124. <view class="ml20rpx w90%">
  125. <Zcontact>联系平台客服</Zcontact>
  126. </view>
  127. </template>
  128. </wd-cell>
  129. </wd-cell-group>
  130. </wd-card>
  131. </view>
  132. <view class="item-cell mt20rpx">
  133. <wd-card custom-class="card">
  134. <wd-cell-group custom-class="cell-group">
  135. <wd-cell title="积分" custom-title-class="cell-title" clickable is-link @click="router.push({ name: 'common-integral' })">
  136. <template #icon>
  137. <image :src="`${StaticUrl}/7.png`" class="h50rpx w50rpx" />
  138. </template>
  139. </wd-cell>
  140. <wd-cell title="评价" custom-title-class="cell-title" clickable is-link>
  141. <template #icon>
  142. <image :src="`${StaticUrl}/8.png`" class="h50rpx w50rpx" />
  143. </template>
  144. </wd-cell>
  145. </wd-cell-group>
  146. </wd-card>
  147. </view>
  148. <view v-if="token" class="mt80rpx flex items-center justify-center">
  149. <wd-button @click="handleLoginOut">
  150. 退出登录
  151. </wd-button>
  152. </view>
  153. </view>
  154. </template>
  155. <style lang="scss" scoped>
  156. .header {
  157. background: linear-gradient( 113deg, #F7FFDC 0%, #E0FF8E 25%, #F2FFCE 51%, #E3FF98 83%, #F6FFD6 100%);
  158. }
  159. .page-class {
  160. height: calc(100vh - var(--window-top) - 150rpx);
  161. :deep() {
  162. .login-btn {
  163. min-width: 0 !important;
  164. width: 180rpx;
  165. }
  166. .cell-title {
  167. padding-left: 20rpx;
  168. }
  169. }
  170. }
  171. .item-cell {
  172. :deep() {
  173. .card {
  174. padding: 0 !important;
  175. }
  176. .cell-group{
  177. overflow: hidden;
  178. border-radius: 12rpx;
  179. }
  180. .wd-cell__right{
  181. width: 60rpx !important;
  182. flex: unset !important;
  183. }
  184. }
  185. }
  186. </style>