index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <view class="content">
  3. <view class="main-bg"></view>
  4. <view class="page-content">
  5. <view class="user-info-box" @click="gologin" v-if="!userData.userName">
  6. <image class="user-image" src="@/static/images/userDefaultHead.png" mode="widthFix"></image>
  7. <view class="user-info">
  8. <view class="user-logoin-title">点击登录</view>
  9. <view class="user-logoin-lable">登录后享受更多权益~</view>
  10. </view>
  11. </view>
  12. <view class="user-info-box" v-else>
  13. <image class="user-image" :src="userData.headImage" mode="widthFix" style="border-radius: 50%;"></image>
  14. <view class="user-info">
  15. <view class="user-logoin-title mb5">{{userData.userName}}</view>
  16. <view class="user-level" v-if="mainInfo.flag">
  17. <view class="iconfont iconVIP mr5"></view>
  18. <view>VIP用户</view>
  19. </view>
  20. </view>
  21. <image class="user-info-right" src="" mode=""></image>
  22. </view>
  23. <view class="user-activity">
  24. <view class="mr20" @click="entrustClick()">
  25. <view class="font18">{{mainInfo.entrustNo ? mainInfo.entrustNo : 0}}</view>
  26. <view class="font10">共享种植</view>
  27. </view>
  28. <view class="mr20">|</view>
  29. <view class="mr20" @click="integralClick()">
  30. <view class="font18">{{mainInfo.totalIntegral ? mainInfo.totalIntegral : 0}}</view>
  31. <view class="font10">我的积分</view>
  32. </view>
  33. <view class="mr20">|</view>
  34. <view @click="couponClick()">
  35. <view class="font18">{{mainInfo.memberCouponNo ? mainInfo.memberCouponNo : 0}}</view>
  36. <view class="font10">我的优惠券</view>
  37. </view>
  38. </view>
  39. <view class="order-box">
  40. <view class="order-item" @click="orderClick(2)">
  41. <view class="iconfont icondaifukuan order-item-icon"></view>
  42. <view class="order-item-text">待付款</view>
  43. </view>
  44. <view class="order-item" @click="orderClick(3)">
  45. <view class="iconfont icondaifahuo order-item-icon"></view>
  46. <view class="order-item-text">待发货</view>
  47. </view>
  48. <view class="order-item" @click="orderClick(4)">
  49. <view class="iconfont icondaishouhuo order-item-icon"></view>
  50. <view class="order-item-text">待收货</view>
  51. </view>
  52. <view class="order-item" @click="orderClick(5)">
  53. <view class="iconfont icondaipingjia order-item-icon"></view>
  54. <view class="order-item-text">待评价</view>
  55. </view>
  56. </view>
  57. <view class="item-btn mt20" @click="addressClick()">
  58. <view class="iconfont icondizhiguanli item-btn-icon"></view>
  59. <view class="item-btn-text">收货地址</view>
  60. <view class="iconfont iconfangxiang"></view>
  61. </view>
  62. <view class="line-box">
  63. <view class="split-line"></view>
  64. </view>
  65. <view class="item-btn" @click="aboutUsClick()">
  66. <view class="iconfont iconguanyu item-btn-icon"></view>
  67. <view class="item-btn-text">关于我们</view>
  68. <view class="iconfont iconfangxiang"></view>
  69. </view>
  70. </view>
  71. <u-top-tips ref="uTips"></u-top-tips>
  72. </view>
  73. </template>
  74. <script>
  75. const NET = require('@/utils/request')
  76. const API = require('@/config/api')
  77. export default {
  78. data() {
  79. return {
  80. integral: '',
  81. userData: {
  82. userId: '',
  83. userName: '',
  84. headImage: '',
  85. },
  86. mainInfo: {
  87. flag: false,
  88. entrustNo: '',
  89. totalIntegral: '',
  90. memberCouponNo: '',
  91. },
  92. }
  93. },
  94. onShow() {
  95. this.userData = uni.getStorageSync("userData")
  96. this.getBaseData()
  97. },
  98. onPullDownRefresh() {
  99. this.getBaseData()
  100. setTimeout(() => {
  101. uni.stopPullDownRefresh();
  102. }, 500)
  103. },
  104. methods: {
  105. // 获取全部数据
  106. getBaseData() {
  107. NET.request(API.getMainInfo, {}, 'GET').then(res => {
  108. this.mainInfo = res.data
  109. }).catch(error => {
  110. this.$refs.uTips.show({
  111. title: '获取个人信息失败',
  112. type: 'warning',
  113. })
  114. })
  115. },
  116. // 我的种植
  117. entrustClick() {
  118. uni.navigateTo({
  119. url: '/pagesMain/plantList'
  120. });
  121. },
  122. // 我的积分
  123. integralClick() {
  124. uni.navigateTo({
  125. url: '/pagesMain/integralList'
  126. });
  127. },
  128. // 我的优惠券
  129. couponClick() {
  130. uni.navigateTo({
  131. url: '/pagesMain/couponList'
  132. });
  133. },
  134. // 地址管理
  135. addressClick() {
  136. uni.navigateTo({
  137. url: '/pagesMain/addressList?type=1'
  138. });
  139. },
  140. // 我的订单
  141. orderClick(type) {
  142. uni.navigateTo({
  143. url: '/pagesMain/orderList?type=' + type
  144. });
  145. },
  146. // 关于我们
  147. aboutUsClick() {
  148. uni.navigateTo({
  149. url: '/pagesMain/aboutUs'
  150. });
  151. },
  152. }
  153. }
  154. </script>
  155. <style lang='scss'>
  156. page {
  157. width: 100%;
  158. height: 100%;
  159. }
  160. .content {
  161. width: 100%;
  162. height: 100%;
  163. background-color: #F3F3F3;
  164. .main-bg {
  165. width: 100%;
  166. height: 195px;
  167. position: relative;
  168. background-size: 100% 195px;
  169. background-position: center top;
  170. background-repeat: no-repeat;
  171. background-image: url(@/static/images/userbackground.png)
  172. }
  173. .page-content {
  174. width: 100%;
  175. height: 100%;
  176. display: flex;
  177. flex-direction: column;
  178. z-index: 10;
  179. margin-top: -200px;
  180. position: relative;
  181. .user-info-box {
  182. width: 100%;
  183. box-sizing: border-box;
  184. padding: 30upx;
  185. display: flex;
  186. flex-direction: row;
  187. align-items: center;
  188. .user-image {
  189. width: 130upx;
  190. height: 130upx;
  191. }
  192. .user-info {
  193. flex: 1;
  194. display: flex;
  195. flex-direction: column;
  196. padding-left: 20upx;
  197. box-sizing: border-box;
  198. z-index: 10;
  199. .user-logoin-title {
  200. font-size: 36upx;
  201. font-weight: 500;
  202. color: rgba(255, 255, 255, 1);
  203. }
  204. .user-level {
  205. width: 70px;
  206. height: 20px;
  207. background: #FFFFFF;
  208. color: #FF850C;
  209. display: flex;
  210. align-items: center;
  211. justify-content: center;
  212. font-size: 12px;
  213. }
  214. .user-logoin-lable {
  215. font-size: 24upx;
  216. font-weight: 400;
  217. color: rgba(255, 255, 255, 1);
  218. margin-top: 20upx;
  219. }
  220. }
  221. .user-info-right {
  222. width: 30upx;
  223. height: 30upx;
  224. }
  225. }
  226. .user-activity {
  227. display: flex;
  228. text-align: center;
  229. align-items: center;
  230. justify-content: center;
  231. padding: 0 15px 15px 15px;
  232. color: #FFFFFF;
  233. }
  234. .order-box {
  235. width: 690upx;
  236. height: 170upx;
  237. background: rgba(255, 255, 255, 1);
  238. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  239. border-radius: 10upx;
  240. display: flex;
  241. flex-direction: row;
  242. align-items: center;
  243. margin-left: 30upx;
  244. z-index: 10;
  245. .order-line {
  246. width: 12upx;
  247. height: 106upx;
  248. }
  249. .order-item {
  250. flex: 1;
  251. display: flex;
  252. flex-direction: column;
  253. align-items: center;
  254. justify-content: center;
  255. .order-item-icon {
  256. color: #52A63A;
  257. font-size: 30px;
  258. }
  259. .order-item-text {
  260. font-size: 28upx;
  261. margin-top: 10upx;
  262. font-weight: 500;
  263. }
  264. }
  265. }
  266. .item-btn {
  267. width: 100%;
  268. height: 100upx;
  269. display: flex;
  270. flex-direction: row;
  271. align-items: center;
  272. box-sizing: border-box;
  273. background-color: #fff;
  274. padding: 0 30upx;
  275. .item-btn-icon {
  276. color: #52A63A;
  277. font-size: 20px;
  278. /* width: 48upx;
  279. height: 48upx; */
  280. }
  281. .item-btn-text {
  282. font-size: 28upx;
  283. margin-left: 20upx;
  284. font-weight: 500;
  285. flex: 1;
  286. color: rgba(102, 102, 102, 1);
  287. }
  288. }
  289. .line-box {
  290. height: 5px;
  291. display: flex;
  292. justify-content: center;
  293. align-items: center;
  294. background: #FFFFFF;
  295. .split-line {
  296. width: 100%;
  297. height: 1px;
  298. background: #EEEEEE;
  299. }
  300. }
  301. .mt20 {
  302. margin-top: 20upx;
  303. }
  304. .mb5 {
  305. margin-bottom: 5px;
  306. }
  307. .mr5 {
  308. margin-right: 5px;
  309. }
  310. .mr20 {
  311. margin-right: 20px;
  312. }
  313. .font18 {
  314. font-size: 18px;
  315. }
  316. .font10 {
  317. font-size: 10px;
  318. }
  319. }
  320. }
  321. </style>