index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. onLoad() {
  95. this.userData = uni.getStorageSync("userData")
  96. },
  97. onShow() {
  98. NET.request(API.getMainInfo + this.userData.userId, {}, 'GET').then(res => {
  99. this.mainInfo = res.data
  100. }).catch(error => {
  101. this.$refs.uTips.show({
  102. title: '获取个人信息失败',
  103. type: 'warning',
  104. })
  105. })
  106. },
  107. methods: {
  108. // 我的种植
  109. entrustClick() {
  110. uni.navigateTo({
  111. url: '/pagesMain/plantList'
  112. });
  113. },
  114. // 我的积分
  115. integralClick() {
  116. uni.navigateTo({
  117. url: '/pagesMain/integralList'
  118. });
  119. },
  120. // 我的优惠券
  121. couponClick() {
  122. uni.navigateTo({
  123. url: '/pagesMain/couponList'
  124. });
  125. },
  126. // 地址管理
  127. addressClick() {
  128. uni.navigateTo({
  129. url: '/pagesMain/addressList?type=1'
  130. });
  131. },
  132. // 我的订单
  133. orderClick(type) {
  134. uni.navigateTo({
  135. url: '/pagesMain/orderList?type=' + type
  136. });
  137. },
  138. // 关于我们
  139. aboutUsClick() {
  140. uni.navigateTo({
  141. url: '/pagesMain/aboutUs'
  142. });
  143. },
  144. }
  145. }
  146. </script>
  147. <style lang='scss'>
  148. page {
  149. width: 100%;
  150. height: 100%;
  151. }
  152. .content {
  153. width: 100%;
  154. height: 100%;
  155. background-color: #F3F3F3;
  156. .main-bg {
  157. width: 100%;
  158. height: 195px;
  159. position: relative;
  160. background-size: 100% 195px;
  161. background-position: center top;
  162. background-repeat: no-repeat;
  163. background-image: url(@/static/images/userbackground.png)
  164. }
  165. .page-content {
  166. width: 100%;
  167. height: 100%;
  168. display: flex;
  169. flex-direction: column;
  170. z-index: 10;
  171. margin-top: -200px;
  172. position: relative;
  173. .user-info-box {
  174. width: 100%;
  175. box-sizing: border-box;
  176. padding: 30upx;
  177. display: flex;
  178. flex-direction: row;
  179. align-items: center;
  180. .user-image {
  181. width: 130upx;
  182. height: 130upx;
  183. }
  184. .user-info {
  185. flex: 1;
  186. display: flex;
  187. flex-direction: column;
  188. padding-left: 20upx;
  189. box-sizing: border-box;
  190. z-index: 10;
  191. .user-logoin-title {
  192. font-size: 36upx;
  193. font-weight: 500;
  194. color: rgba(255, 255, 255, 1);
  195. }
  196. .user-level {
  197. width: 70px;
  198. height: 20px;
  199. background: #FFFFFF;
  200. color: #FF850C;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. font-size: 12px;
  205. }
  206. .user-logoin-lable {
  207. font-size: 24upx;
  208. font-weight: 400;
  209. color: rgba(255, 255, 255, 1);
  210. margin-top: 20upx;
  211. }
  212. }
  213. .user-info-right {
  214. width: 30upx;
  215. height: 30upx;
  216. }
  217. }
  218. .user-activity {
  219. display: flex;
  220. text-align: center;
  221. align-items: center;
  222. justify-content: center;
  223. padding: 0 15px 15px 15px;
  224. color: #FFFFFF;
  225. }
  226. .order-box {
  227. width: 690upx;
  228. height: 170upx;
  229. background: rgba(255, 255, 255, 1);
  230. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  231. border-radius: 10upx;
  232. display: flex;
  233. flex-direction: row;
  234. align-items: center;
  235. margin-left: 30upx;
  236. z-index: 10;
  237. .order-line {
  238. width: 12upx;
  239. height: 106upx;
  240. }
  241. .order-item {
  242. flex: 1;
  243. display: flex;
  244. flex-direction: column;
  245. align-items: center;
  246. justify-content: center;
  247. .order-item-icon {
  248. color: #52A63A;
  249. font-size: 30px;
  250. }
  251. .order-item-text {
  252. font-size: 28upx;
  253. margin-top: 10upx;
  254. font-weight: 500;
  255. }
  256. }
  257. }
  258. .item-btn {
  259. width: 100%;
  260. height: 100upx;
  261. display: flex;
  262. flex-direction: row;
  263. align-items: center;
  264. box-sizing: border-box;
  265. background-color: #fff;
  266. padding: 0 30upx;
  267. .item-btn-icon {
  268. color: #52A63A;
  269. font-size: 20px;
  270. /* width: 48upx;
  271. height: 48upx; */
  272. }
  273. .item-btn-text {
  274. font-size: 28upx;
  275. margin-left: 20upx;
  276. font-weight: 500;
  277. flex: 1;
  278. color: rgba(102, 102, 102, 1);
  279. }
  280. }
  281. .line-box {
  282. height: 5px;
  283. display: flex;
  284. justify-content: center;
  285. align-items: center;
  286. background: #FFFFFF;
  287. .split-line {
  288. width: 100%;
  289. height: 1px;
  290. background: #EEEEEE;
  291. }
  292. }
  293. .mt20 {
  294. margin-top: 20upx;
  295. }
  296. .mb5 {
  297. margin-bottom: 5px;
  298. }
  299. .mr5 {
  300. margin-right: 5px;
  301. }
  302. .mr20 {
  303. margin-right: 20px;
  304. }
  305. .font18 {
  306. font-size: 18px;
  307. }
  308. .font10 {
  309. font-size: 10px;
  310. }
  311. }
  312. }
  313. </style>