myorder.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view>
  3. <!-- 顶部导航 -->
  4. <fa-navbar title="我的消费订单"></fa-navbar>
  5. <view class="list u-bg-white">
  6. <view class="item u-flex u-p-30 u-border-bottom" v-for="(item,index) in list" :key="index" @click="goDetail(item.archives)">
  7. <view class=""><u-image width="300rpx" border-radius="10" height="225rpx" :src="item.archives.image"></u-image></view>
  8. <view class="u-m-l-20 content">
  9. <view class="u-text-weight"><text class="u-line-2">{{item.title}}</text></view>
  10. <view class="u-p-t-15"><u-tag :text="item.title" shape="circle" :bg-color="lightColor" :border-color="faBorderColor" :color="theme.bgColor" /></view>
  11. <view class="u-p-t-15 u-type-error">
  12. 支付金额:
  13. </view>
  14. <view class="u-p-t-15 u-tips-color">{{item.createtime}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 回到顶部 -->
  19. <u-back-top :scroll-top="scrollTop" :icon-style="{color:theme.bgColor}" :custom-style="{backgroundColor:lightColor}"></u-back-top>
  20. <!-- 更多 -->
  21. <view class="u-p-t-30 u-p-b-30"><u-loadmore bg-color="#f4f6f8" :status="has_more ? status : 'nomore'" /></view>
  22. <!-- 底部导航 -->
  23. <fa-tabbar></fa-tabbar>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. onLoad() {
  29. this.getMyOrder();
  30. },
  31. data() {
  32. return {
  33. list:[],
  34. page: 1,
  35. has_more: false,
  36. status: 'loadmore',
  37. scrollTop: 0
  38. };
  39. },
  40. methods: {
  41. getMyOrder:async function(){
  42. let res = await this.$api.getOrder({page:this.page});
  43. this.status = 'loadmore';
  44. if(!res.code){
  45. this.$u.toast(res.msg);
  46. return;
  47. }
  48. this.list = [...this.list,...res.data.orderList.data];
  49. this.has_more = res.data.last_page>res.data.current_page;
  50. },
  51. goDetail(item) {
  52. let p = item.model_id == 2 ? '/pages/product/detail' : '/pages/article/detail';
  53. this.$Router.push({
  54. path:p,
  55. query:{id:item.id}
  56. });
  57. }
  58. },
  59. onPageScroll(e) {
  60. this.scrollTop = e.scrollTop;
  61. },
  62. //底部加载更多
  63. onReachBottom() {
  64. if (this.has_more) {
  65. this.status = 'loading';
  66. this.page++;
  67. this.getMyOrder();
  68. }
  69. }
  70. };
  71. </script>
  72. <style lang="scss">
  73. page {
  74. background-color: #f4f6f8;
  75. }
  76. </style>