index.vue 6.1 KB

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