许成详 6 years ago
parent
commit
aa3097c3d4
2 changed files with 50 additions and 119 deletions
  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 View File

6
     <div class="flex-item">
6
     <div class="flex-item">
7
       <div class="flex-h">
7
       <div class="flex-h">
8
         <div class="flex-item">
8
         <div class="flex-item">
9
-          <ul>
9
+          <!-- <ul>
10
             <li v-for="(item,index) in orders.list" :key="index">
10
             <li v-for="(item,index) in orders.list" :key="index">
11
               <orderListItem :data="item"></orderListItem>
11
               <orderListItem :data="item"></orderListItem>
12
             </li>
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
         </div>
21
         </div>
15
       </div>
22
       </div>
16
     </div>
23
     </div>
18
 </template>
25
 </template>
19
 
26
 
20
 <script>
27
 <script>
28
+import scroll from '../../../components/scroll/scroll'
29
+import noMore from '../../../components/noMore/noMore'
21
 import topCaseInfo from '../../../components/topCaseInfo/index'
30
 import topCaseInfo from '../../../components/topCaseInfo/index'
22
 import orderListItem from '../../../components/orderListItem/index'
31
 import orderListItem from '../../../components/orderListItem/index'
23
 import { mapState, createNamespacedHelpers } from 'vuex'
32
 import { mapState, createNamespacedHelpers } from 'vuex'
29
   name: '',
38
   name: '',
30
   data () {
39
   data () {
31
     return {
40
     return {
41
+      pullUpLoad: true,
42
+      pullUpLoadThreshold: 40,
43
+      startY: 0,
32
       page: 1,
44
       page: 1,
33
       pagesize: 10,
45
       pagesize: 10,
46
+      isloading: true,
47
+      hasMore: true,
34
     }
48
     }
35
   },
49
   },
36
   computed: {
50
   computed: {
40
     ...mapOrdersState({
54
     ...mapOrdersState({
41
       orders: x => x.orders,
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
   components: {
69
   components: {
45
     topCaseInfo,
70
     topCaseInfo,
46
     orderListItem,
71
     orderListItem,
72
+    scroll,
73
+    noMore,
47
   },
74
   },
48
   created () {
75
   created () {
49
     this.getCustomerGoodsOrder({
76
     this.getCustomerGoodsOrder({
54
   methods: {
81
   methods: {
55
     ...mapOrdersActions([
82
     ...mapOrdersActions([
56
       'getCustomerGoodsOrder',
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
 </script>
103
 </script>

+ 4
- 116
src/pages/user/orderList/page.scss View File

13
       &>div{
13
       &>div{
14
         margin: 0 .25rem;
14
         margin: 0 .25rem;
15
         overflow: visible;
15
         overflow: visible;
16
-        &>ul{
16
+        div{
17
+          overflow: visible;
18
+        }
19
+        ul{
17
           width: 100%;
20
           width: 100%;
18
           position: relative;
21
           position: relative;
19
           overflow: visible;
22
           overflow: visible;
27
             box-shadow: 0 0 .2rem .02rem rgba(0, 0, 0, .1);
30
             box-shadow: 0 0 .2rem .02rem rgba(0, 0, 0, .1);
28
             padding: .08rem 0;
31
             padding: .08rem 0;
29
             margin: .25rem auto 0;
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
       }