index.vue 8.9 KB

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