index.vue 8.9 KB

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