mine.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <u-navbar title="我的" titleStyle="color: #fff;" @leftClick="leftClick" height="44px" bgColor="rgb(255,255,255,0)" :placeholder="true"></u-navbar>
  5. <view class="top hflex acenter">
  6. <image :src="user.headimg" mode="aspectFill" class="avatar"></image>
  7. <view class="top_text text_hide">{{user.nickname}}</view>
  8. </view>
  9. <view class="hflex acenter jbetween tabs">
  10. <block v-for="(item,index) in tabs" :key="index">
  11. <view class="vflex acenter tab_item" @click="toDetail(item.url)">
  12. <image :src="item.src" class="tab_icon"></image>
  13. <view class="tab_text">{{item.name}}</view>
  14. </view>
  15. </block>
  16. </view>
  17. <view class="order">
  18. <view class="hflex acenter jbetween">
  19. <view class="title">我的订单</view>
  20. <view class="right" @click="toOrder(0)">查看全部</view>
  21. </view>
  22. <view class="hflex acenter jbetween" style="margin-top: 32rpx;">
  23. <block v-for="(item,index) in orderList" :key="index">
  24. <view class="vflex acenter order_item" @click="toOrder(item.id)">
  25. <image :src="item.src" mode="aspectFill" class="order_icon"></image>
  26. <view class="order_text">{{item.name}}</view>
  27. </view>
  28. </block>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import $api from '@/static/js/api.js'
  36. var that = ''
  37. export default {
  38. data() {
  39. return {
  40. user: {},
  41. tabs: [
  42. {
  43. src: '/static/images/shop/consulting.png',
  44. name: '消息',
  45. url: '/page_shop/pages/mine/chat'
  46. },
  47. {
  48. src: '/static/images/shop/collect.png',
  49. name: '收藏',
  50. url: '/page_shop/pages/mine/collect'
  51. },
  52. {
  53. src: '/static/images/shop/address.png',
  54. name: '地址',
  55. url: '/page_shop/pages/address/list'
  56. }
  57. ],
  58. orderList: [
  59. {
  60. src: 'https://ship-expert.zhousi.hdlkeji.com/common/order_icon1.png',
  61. name: '待付款',
  62. id: 1,
  63. },
  64. {
  65. src: 'https://ship-expert.zhousi.hdlkeji.com/common/order_icon2.png',
  66. name: '待发货',
  67. id: 2,
  68. },
  69. {
  70. src: 'https://ship-expert.zhousi.hdlkeji.com/common/order_icon3.png',
  71. name: '待收货',
  72. id: 3,
  73. },
  74. {
  75. src: 'https://ship-expert.zhousi.hdlkeji.com/common/order_icon4.png',
  76. name: '退款/售后',
  77. id: 4,
  78. }
  79. ]
  80. }
  81. },
  82. onLoad() {
  83. that = this
  84. that.getUser()
  85. },
  86. onShow() {
  87. var token = uni.getStorageSync('token')
  88. if(!token) {
  89. $api.info('请先登录')
  90. setTimeout(() =>{
  91. $api.jump('/pages/login/code_login')
  92. }, 1000)
  93. }
  94. },
  95. methods: {
  96. // 返回
  97. leftClick() {
  98. console.log('返回');
  99. $api.jump(-1)
  100. },
  101. getUser() {
  102. $api.req({
  103. url: '/data/api.auth.Center/get',
  104. method: 'POST'
  105. }, function(res) {
  106. if(res.code == 1) {
  107. that.user = res.data
  108. }
  109. })
  110. },
  111. // 进入详情页面
  112. toDetail(url) {
  113. $api.jump(url)
  114. },
  115. toOrder(id) {
  116. if(id == 4) {
  117. $api.jump('/page_shop/pages/order/refund')
  118. } else {
  119. id = id + 1
  120. $api.jump('/page_shop/pages/order/list?id=' + id)
  121. }
  122. }
  123. },
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. .content {
  128. background: #F5F5F5;
  129. .box {
  130. width: 100%;
  131. background: linear-gradient(360deg, #F5F5F5 0%, #506DFF 100%);
  132. box-sizing: border-box;
  133. padding: 0 30rpx;
  134. .top {
  135. width: 100%;
  136. padding: 8rpx 0 30rpx;
  137. .avatar {
  138. width: 120rpx;
  139. height: 120rpx;
  140. border-radius: 50%;
  141. border: 2px solid #FFFFFF;
  142. }
  143. .top_text {
  144. max-width: 400rpx;
  145. font-size: 40rpx;
  146. font-weight: 500;
  147. color: #FFFFFF;
  148. line-height: 56rpx;
  149. margin-left: 12rpx;
  150. }
  151. }
  152. .tabs {
  153. padding: 30rpx 0 40rpx;
  154. .tab_item {
  155. width: 33%;
  156. text-align: center;
  157. .tab_icon {
  158. width: 52rpx;
  159. height: 52rpx;
  160. }
  161. .tab_text {
  162. font-size: 26rpx;
  163. font-weight: 400;
  164. color: #FFFFFF;
  165. line-height: 36rpx;
  166. padding-top: 12rpx;
  167. }
  168. }
  169. }
  170. .order {
  171. width: 100%;
  172. box-sizing: border-box;
  173. padding: 24rpx 20rpx;
  174. background: #FFFFFF;
  175. border-radius: 10px;
  176. .title {
  177. font-size: 28rpx;
  178. font-weight: 500;
  179. color: #0A0A0A;
  180. line-height: 40rpx;
  181. }
  182. .right {
  183. font-size: 24rpx;
  184. font-weight: 400;
  185. color: #B4B4B4;
  186. line-height: 34rpx;
  187. }
  188. .order_item{
  189. width: 25%;
  190. text-align: center;
  191. .order_icon {
  192. width: 52rpx;
  193. height: 52rpx;
  194. }
  195. .order_text {
  196. padding-top: 24rpx;
  197. font-size: 26rpx;
  198. font-weight: 400;
  199. color: #0A0A0A;
  200. line-height: 36rpx;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>