index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view>
  3. <view v-if="isLogin && userInfo" class="imgs_bg">
  4. <view class="infos" @click="to('/pages/profile/index')">
  5. <image
  6. :src="
  7. userInfo.avatar
  8. ? $method.splitImgHost(userInfo.avatar, true)
  9. : defaultHead
  10. "
  11. ></image>
  12. <text>{{ userInfo.realname }}</text>
  13. </view>
  14. <view class="profit">
  15. <view class="profit-commis fl_b">
  16. <view class="profit-commis-money">{{
  17. (userInfo.cash + userInfo.usedCash + userInfo.freezeCash) | toFixed
  18. }}</view>
  19. <view class="profit-commis-btn" @click="to('/pages/cashout/index')"
  20. >提现</view
  21. >
  22. </view>
  23. <text>总佣金</text>
  24. <view class="profit-embody fl_b">
  25. <view>可提现:{{ userInfo.cash | toFixed }}元</view>
  26. <view>已提现:{{ userInfo.usedCash | toFixed }}元</view>
  27. </view>
  28. </view>
  29. <view class="about">
  30. <view
  31. class="fl_b about_item"
  32. @click="to(item.path)"
  33. v-for="(item, idx) in list"
  34. :key="idx"
  35. >
  36. <view class="fl">
  37. <image src="../../static/image/icon_partake.png" mode="" />
  38. <text>{{ item.title }}</text>
  39. </view>
  40. <image src="../../static/image/icon_more.png" mode="" />
  41. </view>
  42. </view>
  43. <view class="logout" @click="logout">退出</view>
  44. </view>
  45. <view class="login_wrap" v-if="!isLogin">
  46. <view class="login_text">欢迎来到业务员平台</view>
  47. <view class="login_text">您还没有登录哦~</view>
  48. <u-button
  49. class="c_btn loginBtn"
  50. text="立即登录/注册"
  51. @click="jumpLogin"
  52. ></u-button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { mapGetters } from "vuex";
  58. export default {
  59. data() {
  60. return {
  61. isLogin: false,
  62. defaultHead: require("../../static/image/defhead.png"),
  63. list: [
  64. {
  65. title: "活动参与",
  66. icon: "../../static/image/icon_partake.png",
  67. path: "/pages/actlist/index",
  68. },
  69. {
  70. title: "佣金收益",
  71. icon: "../../static/image/icon_profit.png",
  72. path: "/pages/commission/index",
  73. },
  74. ],
  75. };
  76. },
  77. onLoad(option) {},
  78. onShow() {
  79. this.isLogin = this.$method.isLogin();
  80. if (this.isLogin) {
  81. !this.userInfo && this.$store.dispatch("getUserInfo");
  82. }
  83. },
  84. methods: {
  85. logout() {
  86. this.$store.commit("EXIT");
  87. this.isLogin = false;
  88. },
  89. jumpLogin() {
  90. uni.navigateTo({
  91. url: "/pages/login/login",
  92. });
  93. },
  94. to(path) {
  95. uni.navigateTo({
  96. url: path,
  97. });
  98. },
  99. },
  100. computed: {
  101. ...mapGetters(["userInfo"]),
  102. },
  103. };
  104. </script>
  105. <style>
  106. page {
  107. background-color: #f6f7fb;
  108. }
  109. </style>
  110. <style scoped lang="scss">
  111. .login_wrap {
  112. text-align: center;
  113. margin-top: 256rpx;
  114. .login_text {
  115. &:nth-of-type(1) {
  116. font-weight: bold;
  117. color: #222222;
  118. font-size: 48rpx;
  119. }
  120. &:nth-of-type(2) {
  121. font-weight: 500;
  122. color: #666666;
  123. font-size: 32rpx;
  124. margin: 32rpx 0 160rpx;
  125. }
  126. }
  127. .loginBtn {
  128. width: 86%;
  129. margin: 0 auto;
  130. }
  131. }
  132. .imgs_bg {
  133. padding: 0 32rpx;
  134. box-sizing: border-box;
  135. width: 100%;
  136. height: 429rpx;
  137. padding-top: 60rpx;
  138. background: linear-gradient(180deg, #3f8dfd 49%, rgba(0, 105, 255, 0) 100%);
  139. .infos {
  140. display: flex;
  141. align-items: center;
  142. image {
  143. width: 160rpx;
  144. height: 160rpx;
  145. border-radius: 50%;
  146. }
  147. text {
  148. font-weight: bold;
  149. color: #ffffff;
  150. font-size: 36rpx;
  151. padding-left: 24rpx;
  152. }
  153. }
  154. .profit {
  155. margin-top: 48rpx;
  156. background: url("../../static/image/profitbg.png") no-repeat;
  157. background-size: 100% 100%;
  158. padding: 40rpx 40rpx 50rpx;
  159. color: #2465c1;
  160. .profit-commis {
  161. font-size: 32rpx;
  162. .profit-commis-money {
  163. font-size: 72rpx;
  164. }
  165. .profit-commis-btn {
  166. width: 152rpx;
  167. height: 70rpx;
  168. background: #ffffff;
  169. border-radius: 120rpx;
  170. text-align: center;
  171. line-height: 70rpx;
  172. }
  173. }
  174. .profit-embody {
  175. margin-top: 56rpx;
  176. color: #5f83b8;
  177. font-size: 28rpx;
  178. }
  179. }
  180. .about {
  181. background: #ffffff;
  182. padding: 32rpx;
  183. margin-top: 32rpx;
  184. border-radius: 16rpx;
  185. .about_item {
  186. margin-bottom: 48rpx;
  187. &:last-child {
  188. margin-bottom: 0;
  189. }
  190. view {
  191. image {
  192. width: 56rpx;
  193. height: 56rpx;
  194. }
  195. text {
  196. padding-left: 20rpx;
  197. color: #24263d;
  198. font-weight: bold;
  199. font-size: 32rpx;
  200. }
  201. }
  202. image {
  203. width: 40rpx;
  204. height: 40rpx;
  205. }
  206. }
  207. }
  208. }
  209. .logout {
  210. text-align: center;
  211. font-size: 32rpx;
  212. margin-top: 56rpx;
  213. font-weight: bold;
  214. color: #3f8dfd;
  215. }
  216. </style>