index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view class="info">
  5. <view class="avatar">
  6. <image :src="userInfo.avatar"></image>
  7. </view>
  8. <view class="text">
  9. <view class="name">{{userInfo.nickname}}<text>{{userInfo.levelname}}</text></view>
  10. <view>{{userInfo.mobile}}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="money">
  15. <view class="balance">
  16. 账户余额(元)
  17. <view>{{userInfo.money}}</view>
  18. </view>
  19. <view>
  20. <navigator class="recharge" hover-class="none" url="/pages/users/recharge/index">充值</navigator>
  21. <navigator class="detail" hover-class="none" url="/pages/users/record/index?type=recharge">明细</navigator>
  22. </view>
  23. </view>
  24. <view class="order-wrapper">
  25. <view class="order-hd flex">
  26. <view class="left">我的订单</view>
  27. <navigator class="right flex" hover-class="none" url="/pages/users/order/index" open-type="navigate">
  28. 查看全部
  29. <text class="iconfont icon-xiangyou"></text>
  30. </navigator>
  31. </view>
  32. <view class="order-bd">
  33. <block v-for="(item,index) in orderMenu" :key="index">
  34. <navigator class="order-item" hover-class="none" :url="item.url">
  35. <view class="pic">
  36. <image :src="item.img" mode=""></image>
  37. <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
  38. </view>
  39. <view class="txt">{{item.title}}</view>
  40. </navigator>
  41. </block>
  42. </view>
  43. </view>
  44. <view class="menu">
  45. <view class="title">我的服务</view>
  46. <view class="list">
  47. <navigator class="item" url="/pages/users/spread/index" hover-class="none">
  48. <text class="iconfont icon-iconfontzhizuobiaozhun49"></text>
  49. <text>邀请好友</text>
  50. </navigator>
  51. <navigator class="item" url="/pages/users/record/index?type=consumption" hover-class="none">
  52. <text class="iconfont icon-xiaofeimingxi"></text>
  53. <text>消费明细</text>
  54. </navigator>
  55. <navigator class="item" url="/pages/users/commission/index" hover-class="none">
  56. <text class="iconfont icon-yongjinmingxi"></text>
  57. <text>佣金明细</text>
  58. </navigator>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. mapGetters
  66. } from "vuex";
  67. import {
  68. toLogin
  69. } from '@/libs/login.js';
  70. import {
  71. getUserInfo,
  72. getOrder
  73. } from '@/api/api.js';
  74. export default {
  75. data() {
  76. return {
  77. userInfo: {},
  78. orderMenu: [
  79. {
  80. title: '未支付',
  81. img: '../../static/images/order1.png',
  82. url: '/pages/users/order/index?status=0'
  83. },
  84. {
  85. title: '打单中',
  86. img: '../../static/images/order2.png',
  87. url: '/pages/users/order/index?status=1'
  88. },
  89. {
  90. title: '已出单',
  91. img: '../../static/images/order3.png',
  92. url: '/pages/users/order/index?status=2'
  93. },
  94. {
  95. title: '异常',
  96. img: '../../static/images/order4.png',
  97. url: '/pages/users/order/index?status=9'
  98. },
  99. {
  100. title: '取消',
  101. img: '../../static/images/order5.png',
  102. url: '/pages/users/order/index?status=-1'
  103. }
  104. ],
  105. }
  106. },
  107. computed: mapGetters(['isLogin']),
  108. onLoad() {
  109. if (this.isLogin) {
  110. this.getUserInfo();
  111. this.getOrderData();
  112. }else{
  113. toLogin();
  114. }
  115. },
  116. methods: {
  117. getUserInfo: function() {
  118. let that = this;
  119. getUserInfo().then(res => {
  120. that.userInfo = res.data;
  121. });
  122. },
  123. //获取订单统计数据
  124. getOrderData: function() {
  125. let that = this;
  126. getOrder().then(res => {
  127. that.orderMenu.forEach((item, index) => {
  128. switch (item.title) {
  129. case '未支付':
  130. item.num = res.data.unpaid
  131. break
  132. case '打单中':
  133. item.num = res.data.inorder
  134. break
  135. case '已出单':
  136. item.num = res.data.sendOrder
  137. break
  138. case '异常':
  139. item.num = res.data.abnormalOrder
  140. break
  141. case '取消':
  142. item.num = res.data.cancelOrder
  143. break
  144. }
  145. })
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style scoped lang="scss">
  152. .header{
  153. height:360rpx;
  154. background: linear-gradient(90deg,#ff5c00 0,#FF464E);
  155. .info{
  156. display: flex;
  157. padding-top: 80rpx;
  158. padding-left: 25rpx;
  159. .avatar{
  160. width: 125rpx;
  161. height: 125rpx;
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. border-radius: 50%;
  166. border: 1px solid hsla(0,0%,100%,.5);
  167. image{
  168. width:110rpx;
  169. height:110rpx;
  170. border-radius: 50%;
  171. }
  172. }
  173. .text{
  174. color:#fff;
  175. padding-left: 20rpx;
  176. padding-top: 10rpx;
  177. .name{
  178. font-size: 36rpx;
  179. font-weight: bolder;
  180. margin-bottom: 10rpx;
  181. text{
  182. color: #fff;
  183. opacity: 0.8;
  184. font-size: 24rpx;
  185. border: 1px solid hsla(0,0%,100%,.6);
  186. border-radius: 30rpx;
  187. padding: 2rpx 15rpx;
  188. margin-left: 15rpx;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. .money{
  195. width:700rpx;
  196. margin-left: 25rpx;
  197. margin-top: -100rpx;
  198. background: #fff;
  199. border-radius: 20rpx;
  200. padding: 30rpx;
  201. display: flex;
  202. justify-content:space-between;
  203. .balance{
  204. font-size: 30rpx;
  205. view{
  206. font-size: 50rpx;
  207. font-weight: 600;
  208. color: #ff5c00;
  209. margin-top: 20rpx;
  210. }
  211. }
  212. .recharge{
  213. background: #ff5c00;
  214. color:#fff;
  215. font-size: 28rpx;
  216. text-align: center;
  217. border-radius: 30rpx;
  218. width:150rpx;
  219. height:60rpx;
  220. line-height: 60rpx;
  221. margin-bottom: 20rpx;
  222. }
  223. .detail{
  224. width:150rpx;
  225. height:60rpx;
  226. line-height: 60rpx;
  227. border: 1rpx solid #ebedf0;
  228. border-radius: 30rpx;
  229. font-size: 28rpx;
  230. text-align: center;
  231. }
  232. }
  233. .order-wrapper {
  234. width:700rpx;
  235. margin-left: 25rpx;
  236. background: #fff;
  237. border-radius: 15rpx;
  238. .order-hd {
  239. justify-content: space-between;
  240. padding: 25rpx 20rpx;
  241. margin-top: 25rpx;
  242. font-size: 30rpx;
  243. color: #282828;
  244. .right {
  245. align-items: center;
  246. color: #666666;
  247. font-size: 26rpx;
  248. .icon-xiangyou {
  249. margin-left: 5rpx;
  250. margin-top: 6rpx;
  251. font-size: 26rpx;
  252. }
  253. }
  254. }
  255. .order-bd {
  256. display: flex;
  257. .order-item {
  258. display: flex;
  259. flex-direction: column;
  260. justify-content: center;
  261. align-items: center;
  262. width: 20%;
  263. height: 160rpx;
  264. .pic {
  265. position: relative;
  266. text-align: center;
  267. image {
  268. width: 70rpx;
  269. height: 70rpx;
  270. }
  271. }
  272. .txt {
  273. font-size: 26rpx;
  274. color: #454545;
  275. }
  276. }
  277. }
  278. }
  279. .menu{
  280. width:700rpx;
  281. margin: 25rpx;
  282. padding: 25rpx 20rpx;
  283. border-radius: 15rpx;
  284. background: #fff;
  285. .title{
  286. font-size: 30rpx;
  287. }
  288. .list{
  289. width:660rpx;
  290. overflow: hidden;
  291. .item{
  292. width:25%;
  293. float:left;
  294. text-align: center;
  295. margin-top: 30rpx;
  296. image{
  297. width:70rpx;
  298. height:70rpx;
  299. }
  300. text{
  301. display: block;
  302. color:#636363;
  303. }
  304. .iconfont{
  305. font-size: 70rpx;
  306. }
  307. }
  308. }
  309. }
  310. .order-status-num {
  311. min-width:12rpx;
  312. background-color: #fff;
  313. color: #ee5a52;
  314. border-radius: 15px;
  315. position: absolute;
  316. right:-12rpx;
  317. top: -10rpx;
  318. font-size: 20rpx;
  319. padding: 0 8rpx;
  320. border: 1px solid #ee5a52;
  321. }
  322. </style>