许成详 преди 6 години
родител
ревизия
aa3097c3d4
променени са 2 файла, в които са добавени 50 реда и са изтрити 119 реда
  1. 46
    3
      src/pages/user/orderList/index.vue
  2. 4
    116
      src/pages/user/orderList/page.scss

+ 46
- 3
src/pages/user/orderList/index.vue Целия файл

@@ -6,11 +6,18 @@
6 6
     <div class="flex-item">
7 7
       <div class="flex-h">
8 8
         <div class="flex-item">
9
-          <ul>
9
+          <!-- <ul>
10 10
             <li v-for="(item,index) in orders.list" :key="index">
11 11
               <orderListItem :data="item"></orderListItem>
12 12
             </li>
13
-          </ul>
13
+          </ul> -->
14
+          <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='orders.list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
15
+            <ul>
16
+              <li v-for="(item,index) in orders.list" :key="index">
17
+                <orderListItem :data="item"></orderListItem>
18
+              </li>
19
+            </ul>
20
+          </scroll>
14 21
         </div>
15 22
       </div>
16 23
     </div>
@@ -18,6 +25,8 @@
18 25
 </template>
19 26
 
20 27
 <script>
28
+import scroll from '../../../components/scroll/scroll'
29
+import noMore from '../../../components/noMore/noMore'
21 30
 import topCaseInfo from '../../../components/topCaseInfo/index'
22 31
 import orderListItem from '../../../components/orderListItem/index'
23 32
 import { mapState, createNamespacedHelpers } from 'vuex'
@@ -29,8 +38,13 @@ export default {
29 38
   name: '',
30 39
   data () {
31 40
     return {
41
+      pullUpLoad: true,
42
+      pullUpLoadThreshold: 40,
43
+      startY: 0,
32 44
       page: 1,
33 45
       pagesize: 10,
46
+      isloading: true,
47
+      hasMore: true,
34 48
     }
35 49
   },
36 50
   computed: {
@@ -40,10 +54,23 @@ export default {
40 54
     ...mapOrdersState({
41 55
       orders: x => x.orders,
42 56
     }),
57
+    pullUpLoadObj: function () {
58
+      return this.pullUpLoad
59
+        ? {
60
+          threshold: parseInt(this.pullUpLoadThreshold),
61
+          txt: {
62
+            more: this.pullUpLoadMoreTxt,
63
+            noMore: this.pullUpLoadNoMoreTxt
64
+          }
65
+        }
66
+        : false
67
+    }
43 68
   },
44 69
   components: {
45 70
     topCaseInfo,
46 71
     orderListItem,
72
+    scroll,
73
+    noMore,
47 74
   },
48 75
   created () {
49 76
     this.getCustomerGoodsOrder({
@@ -54,7 +81,23 @@ export default {
54 81
   methods: {
55 82
     ...mapOrdersActions([
56 83
       'getCustomerGoodsOrder',
57
-    ])
84
+    ]),
85
+    getList () {
86
+      var _that = this
87
+      Math.ceil(this.orders.pagenum / this.orders.pagesize) > this.page ? this.hasMore = true : this.hasMore = false
88
+      // this.list.length <= 8 ? this.hasMore = true : this.hasMore = false
89
+      if (this.hasMore) {
90
+        setTimeout(() => {
91
+          _that.getCustomerGoodsOrder({
92
+            page: _that.page,
93
+            pagesize: _that.pagesize,
94
+          })
95
+        }, 1000)
96
+      } else {
97
+        this.$refs.scroll.forceUpdate()
98
+        return false
99
+      }
100
+    },
58 101
   }
59 102
 }
60 103
 </script>

+ 4
- 116
src/pages/user/orderList/page.scss Целия файл

@@ -13,7 +13,10 @@
13 13
       &>div{
14 14
         margin: 0 .25rem;
15 15
         overflow: visible;
16
-        &>ul{
16
+        div{
17
+          overflow: visible;
18
+        }
19
+        ul{
17 20
           width: 100%;
18 21
           position: relative;
19 22
           overflow: visible;
@@ -27,121 +30,6 @@
27 30
             box-shadow: 0 0 .2rem .02rem rgba(0, 0, 0, .1);
28 31
             padding: .08rem 0;
29 32
             margin: .25rem auto 0;
30
-            // .title{
31
-            //   width: 100%;
32
-            //   position: relative;
33
-            //   overflow: hidden;
34
-            //   align-items: center;
35
-            //   &>div:nth-child(1){
36
-            //     width: .5rem;
37
-            //     text-align: center;
38
-            //     *{
39
-            //       display: inline-block;
40
-            //       font-size: .1rem;
41
-            //       line-height: .17rem;
42
-            //     }
43
-            //     i{
44
-            //       font-size: .15rem;
45
-            //     }
46
-            //   }
47
-            //   &>div:nth-child(1).orange{
48
-            //     *{
49
-            //       color: #fc6243;
50
-            //     }
51
-            //   }
52
-            //   &>div:nth-child(1).grey{
53
-            //     *{
54
-            //       color: #ccc;
55
-            //     }
56
-            //   }
57
-            //   &>div:nth-child(1).green{
58
-            //     *{
59
-            //       color: #63c86f;
60
-            //     }
61
-            //   }
62
-            //   &>div:nth-child(2){
63
-            //     margin-right: .1rem;
64
-            //     &>div{
65
-            //       width: 100%;
66
-            //       position: relative;
67
-            //       overflow: hidden;
68
-            //       span{
69
-            //         width: 100%;
70
-            //         display: block;
71
-            //         font-size: .14rem;
72
-            //         overflow: hidden;
73
-            //         text-overflow: ellipsis;
74
-            //         white-space: nowrap;
75
-            //       }
76
-            //     }
77
-            //   }
78
-            //   &>span{
79
-            //     font-size: .11rem;
80
-            //     color: #666;
81
-            //     margin-right: .15rem;
82
-            //   }
83
-            // }
84
-            // .line{
85
-            //   width: 100%;
86
-            //   height: .2rem;
87
-            //   position: relative;
88
-            //   overflow: hidden;
89
-            //   &>div{
90
-            //     width: 100%;
91
-            //     position: absolute;
92
-            //     overflow: hidden;
93
-            //     left: 0;
94
-            //     top: 50%;
95
-            //     transform: translateY(-50%) translateX(-.035rem);
96
-            //     -webkit-transform: translateY(-50%) translateX(-.035rem);
97
-            //     font-size: 0;
98
-            //     white-space: nowrap;
99
-            //     i{
100
-            //       display: inline-block;
101
-            //       width: .07rem;
102
-            //       height: .07rem;
103
-            //       position: relative;
104
-            //       overflow: hidden;
105
-            //       border-radius: 100%;
106
-            //       background: #eee;
107
-            //       margin-right: .1rem;
108
-            //     }
109
-            //   }
110
-            // }
111
-            // .list{
112
-            //   &>div{
113
-            //     margin: 0 .15rem;
114
-            //     &>ul{
115
-            //       margin: .06rem auto;
116
-            //       &>li{
117
-            //         font-size: 0;
118
-            //         white-space: nowrap;
119
-            //         &>*{
120
-            //           display: inline-block;
121
-            //           vertical-align: middle;
122
-            //           width: 50%;
123
-            //           overflow: hidden;
124
-            //           text-overflow: ellipsis;
125
-            //           white-space: nowrap;
126
-            //         }
127
-            //         &>span{
128
-            //           line-height: .26rem;
129
-            //           font-size: .14rem;
130
-            //           color: #555;
131
-            //         }
132
-            //         &>div{
133
-            //           text-align: right;
134
-            //           font-size: 0;
135
-            //           span{
136
-            //             font-size: .11rem;
137
-            //             line-height: .26rem;
138
-            //             color: #666;
139
-            //           }
140
-            //         }
141
-            //       }
142
-            //     }
143
-            //   }
144
-            // }
145 33
           }
146 34
         }
147 35
       }