my.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="pensonal">
  3. <network-error />
  4. <view class="login u-flex"
  5. @click="login">
  6. <block v-if="!userInfo.nick_name">
  7. <image class="avatar"
  8. src="~@/static/icon/avatar.png"></image>
  9. <text class="name u-content-color line-50 ml-16 u-flex-1 bold">点击登录</text>
  10. </block>
  11. <block v-else>
  12. <image class="avatar"
  13. :src="userInfo.head_url"></image>
  14. <view class="name line-50 ml-16 u-flex-1 u-line-1 bold">{{userInfo.nick_name}}</view>
  15. </block>
  16. <block v-if="userInfo.token">
  17. <view class="info u-font-22"
  18. @click.stop="toUserDetail">个人信息<u-icon name="arrow-right"></u-icon>
  19. </view>
  20. </block>
  21. </view>
  22. <view class="commission"
  23. @click="jumpToCommissionApply">
  24. <view class="left">
  25. <image src="~@/static/icon/icon_commission.png"
  26. class="icon"></image>
  27. <text class="title">可返金额</text>
  28. </view>
  29. <view class="right">
  30. <text class="right-flag">¥</text>
  31. <text class="right-money">{{userInfo ? (userInfo.amount*1/100).toFixed(2) : '--'}}</text>
  32. </view>
  33. </view>
  34. <image class="banner"
  35. :src="bannerUrl"
  36. @click="jumpToCommission"></image>
  37. <view class="divider"></view>
  38. <view class="item-list">
  39. <view class="item u-flex"
  40. @click="toDetail(3)">
  41. <view class="icon-wh icon-order"></view>
  42. <view class="u-font-28 ml-28 u-flex-1 title">我的订单</view>
  43. <view class="jiantou-wh icon-jiantou"></view>
  44. </view>
  45. <view class="item u-flex u-border-bottom"
  46. @click="toDetail(2)">
  47. <view class="icon-wh icon-aboutour"></view>
  48. <view class="u-font-28 ml-28 u-flex-1 title">关于我们</view>
  49. <view class="jiantou-wh icon-jiantou "></view>
  50. </view>
  51. <view class="item u-flex u-border-bottom"
  52. @click="toDetail(4)">
  53. <view class="icon-wh icon-kf"></view>
  54. <view class="u-font-28 ml-28 u-flex-1 title">联系客服</view>
  55. <view class="jiantou-wh icon-jiantou "></view>
  56. </view>
  57. <view class="item u-flex u-border-bottom"
  58. @click="toDetail(1)">
  59. <view class="icon-wh icon-problem"></view>
  60. <view class="u-font-28 ml-28 u-flex-1 title">常见问题</view>
  61. <view class="jiantou-wh icon-jiantou "></view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import * as api from '../api/userApi'
  68. export default {
  69. data () {
  70. return {}
  71. },
  72. computed: {
  73. userInfo () {
  74. return this.$store.state.userInfo
  75. },
  76. bannerUrl () {
  77. return this.$store.state.commission_banner
  78. }
  79. },
  80. onShow () {
  81. if (this.userInfo) {
  82. api.getUserInfoByToken().then(({ code, data }) => {
  83. if (code === 200) {
  84. this.$store.commit('updateUserInfo', data)
  85. }
  86. })
  87. }
  88. },
  89. methods: {
  90. toDetail (type) {
  91. let url
  92. if (type === 4) {
  93. url = '/pagesSub/my/kefu'
  94. uni.navigateTo({
  95. url: url
  96. })
  97. }
  98. if (type === 1 || type === 2) {
  99. url = type === 1 ? '/pagesSub/my/commonProblem' : '/pagesSub/my/about'
  100. uni.navigateTo({
  101. url: url
  102. })
  103. }
  104. if (type === 3) {
  105. uni.switchTab({
  106. url: 'order'
  107. })
  108. }
  109. },
  110. // 登录
  111. login () {
  112. if (this.userInfo.token) { return }
  113. uni.navigateTo({
  114. url: '/pagesSub/other/login'
  115. })
  116. },
  117. jumpToCommissionApply () {
  118. if (this.userInfo) {
  119. uni.navigateTo({ url: '/pagesSub/commission/commission' })
  120. } else {
  121. uni.navigateTo({
  122. url: '/pagesSub/other/login'
  123. })
  124. }
  125. },
  126. jumpToCommission () {
  127. if (this.userInfo) {
  128. uni.navigateTo({ url: '/pagesSub/commission/invite' })
  129. } else {
  130. uni.navigateTo({
  131. url: '/pagesSub/other/login'
  132. })
  133. }
  134. },
  135. // 个人信息
  136. toUserDetail () {
  137. uni.navigateTo({
  138. url: '/pagesSub/my/userDetail'
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .divider {
  146. height: 16rpx;
  147. background-color: #f4f5f9;
  148. }
  149. .commission {
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. width: 90%;
  154. margin-left: 5%;
  155. box-shadow: 0px 0px 20rpx 2rpx rgba(0, 0, 0, 0.06);
  156. border-radius: 40rpx;
  157. height: 100rpx;
  158. padding: 0 40rpx 0 40rpx;
  159. margin-bottom: 40rpx;
  160. .left {
  161. display: flex;
  162. flex-direction: row;
  163. justify-content: center;
  164. align-items: center;
  165. .icon {
  166. width: 44rpx;
  167. height: 48rpx;
  168. }
  169. .title {
  170. margin-left: 14rpx;
  171. font-size: 28rpx;
  172. font-weight: 600;
  173. color: #111;
  174. }
  175. }
  176. .right {
  177. color: #ff6632;
  178. &-flag {
  179. bottom: 0;
  180. font-size: 24rpx;
  181. font-weight: 600;
  182. }
  183. &-money {
  184. bottom: 0;
  185. font-size: 36rpx;
  186. font-weight: 600;
  187. }
  188. }
  189. }
  190. .banner {
  191. height: 170rpx;
  192. width: 90%;
  193. margin-left: 5%;
  194. margin-bottom: 40rpx;
  195. }
  196. .pensonal {
  197. width: 750px;
  198. background: #fff;
  199. }
  200. .login {
  201. width: 100%;
  202. height: 156px;
  203. align-items: center;
  204. padding: 8px 0 40px 40px;
  205. }
  206. .info {
  207. width: 124px;
  208. height: 48px;
  209. line-height: 48px;
  210. background: $bg-personl-info-color;
  211. color: #ffffff;
  212. text-align: right;
  213. border-radius: 100px 0px 0px 100px;
  214. }
  215. .avatar {
  216. width: 108px;
  217. height: 108px;
  218. border-radius: 54px;
  219. }
  220. .name {
  221. width: 414px;
  222. height: 50px;
  223. font-size: 36px;
  224. margin-left: 16px;
  225. }
  226. .item-list {
  227. width: 100%;
  228. background: #fff;
  229. box-sizing: border-box;
  230. padding: 0 32px 0 40px;
  231. .item {
  232. width: 100%;
  233. height: 96px;
  234. .title {
  235. color: $u-main-color;
  236. }
  237. }
  238. }
  239. // .border-bottom {
  240. // border-bottom: 1px solid $u-border-color;
  241. // }
  242. .icon-wh {
  243. width: 36px;
  244. height: 36px;
  245. }
  246. .jiantou-wh {
  247. width: 14px;
  248. height: 24px;
  249. }
  250. .ml-28 {
  251. margin-left: 28px;
  252. }
  253. </style>