Browse Source

调整我的小店加载状态

viczhq 1 month ago
parent
commit
77d2050285

+ 1 - 1
src/pages/memberSub/earningsOrder/index.jsx

@@ -15,7 +15,7 @@ export default class Index extends Component {
15
     page: 1, //页数
15
     page: 1, //页数
16
     loading: false, //加载状态
16
     loading: false, //加载状态
17
     totalPages: 1, // 添加总页数
17
     totalPages: 1, // 添加总页数
18
-    isNoMore: false,
18
+    isNoMore: false, // 是否没有更多
19
     orderList: [], //订单列表
19
     orderList: [], //订单列表
20
     userInfo: {}, //个人信息
20
     userInfo: {}, //个人信息
21
   };
21
   };

+ 1 - 0
src/pages/memberSub/earningsOrder/index.less

@@ -210,6 +210,7 @@
210
                 justify-content: space-between;
210
                 justify-content: space-between;
211
 
211
 
212
                 .product-name {
212
                 .product-name {
213
+                    height: 80px;
213
                     font-size: 28px;
214
                     font-size: 28px;
214
                     color: #000000;
215
                     color: #000000;
215
                     line-height: 41px;
216
                     line-height: 41px;

+ 80 - 43
src/pages/memberSub/storeManagement/index.jsx

@@ -1,8 +1,15 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
 import { View, Text, Image, Button } from "@tarojs/components";
2
 import { View, Text, Image, Button } from "@tarojs/components";
3
-import { AtIcon } from "taro-ui";
3
+import { AtIcon, AtActivityIndicator } from "taro-ui";
4
 import "./index.less";
4
 import "./index.less";
5
-import { getMyShopList, getMyShopDetail, getShareShopDetail, getShareShopProductList, getShareJump,bindShareJump } from "../../../service";
5
+import {
6
+  getMyShopList,
7
+  getMyShopDetail,
8
+  getShareShopDetail,
9
+  getShareShopProductList,
10
+  getShareJump,
11
+  bindShareJump,
12
+} from "../../../service";
6
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
13
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
7
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
14
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
8
 import ProductCard from "../../../components/ProductCard"; //卡片模块
15
 import ProductCard from "../../../components/ProductCard"; //卡片模块
@@ -17,13 +24,16 @@ export default class Index extends Component {
17
     loading: false, //加载状态
24
     loading: false, //加载状态
18
     totalPages: 1, // 添加总页数
25
     totalPages: 1, // 添加总页数
19
     isShare: false, // 是否是分享进入
26
     isShare: false, // 是否是分享进入
20
-    shopId: '', // 店铺id
27
+    shopId: "", // 店铺id
28
+    isNoMore: false, // 是否没有更多
21
   };
29
   };
22
   // 获取店铺详情
30
   // 获取店铺详情
23
   getMyShopDetail = async () => {
31
   getMyShopDetail = async () => {
24
-    const res = this.state.isShare ? await getShareShopDetail({
25
-      store_id: this.state.shopId
26
-    }) :  await getMyShopDetail();
32
+    const res = this.state.isShare
33
+      ? await getShareShopDetail({
34
+          store_id: this.state.shopId,
35
+        })
36
+      : await getMyShopDetail();
27
     this.setState({
37
     this.setState({
28
       shopDetail: res,
38
       shopDetail: res,
29
     });
39
     });
@@ -33,36 +43,44 @@ export default class Index extends Component {
33
     const { page } = this.state;
43
     const { page } = this.state;
34
     this.setState({ loading: true });
44
     this.setState({ loading: true });
35
 
45
 
36
-    const res = this.state.isShare ? await getShareShopProductList({
37
-      store_id: this.state.shopId,
38
-      page,
39
-      page_size: 10,
40
-      tag_name:'全部'
41
-    }) : await getMyShopList({
42
-      page,
43
-      page_size: 10,
44
-      tag_name:'全部'
45
-    });
46
+    const res = this.state.isShare
47
+      ? await getShareShopProductList({
48
+          store_id: this.state.shopId,
49
+          page,
50
+          page_size: 10,
51
+          tag_name: "全部",
52
+        })
53
+      : await getMyShopList({
54
+          page,
55
+          page_size: 10,
56
+          tag_name: "全部",
57
+        });
46
 
58
 
47
     this.setState((prevState) => ({
59
     this.setState((prevState) => ({
48
-      productList: isBack ? res.goods_list : [...prevState.productList, ...res.goods_list],
60
+      productList: isBack
61
+        ? res.goods_list
62
+        : [...prevState.productList, ...res.goods_list],
49
       totalPages: res.total_pages,
63
       totalPages: res.total_pages,
50
       loading: false,
64
       loading: false,
65
+      isNoMore: res.total_pages <= page,
51
     }));
66
     }));
52
   };
67
   };
53
 
68
 
54
   componentDidShow() {
69
   componentDidShow() {
55
     const { router } = Taro.getCurrentInstance();
70
     const { router } = Taro.getCurrentInstance();
56
     const params = router.params;
71
     const params = router.params;
57
-    
58
-    this.setState({
59
-      isManager: JSON.parse(params.isManager), //是否是店长
60
-      isShare: params.isShare||false, // 是否是分享进入
61
-      shopId: params.shopId||'', // 店铺id
62
-    },()=>{
63
-      this.getMyShopDetail(); //获取店铺详情
64
-      this.getMyShopList(true); //获取店铺数据
65
-    });
72
+
73
+    this.setState(
74
+      {
75
+        isManager: JSON.parse(params.isManager), //是否是店长
76
+        isShare: params.isShare || false, // 是否是分享进入
77
+        shopId: params.shopId || "", // 店铺id
78
+      },
79
+      () => {
80
+        this.getMyShopDetail(); //获取店铺详情
81
+        this.getMyShopList(true); //获取店铺数据
82
+      }
83
+    );
66
   }
84
   }
67
   // 页面上拉触底
85
   // 页面上拉触底
68
   onReachBottom = () => {
86
   onReachBottom = () => {
@@ -82,38 +100,38 @@ export default class Index extends Component {
82
   };
100
   };
83
   // 配置分享内容
101
   // 配置分享内容
84
   onShareAppMessage() {
102
   onShareAppMessage() {
85
-    const name = Taro.getStorageSync('userInfo').name;
103
+    const name = Taro.getStorageSync("userInfo").name;
86
     return {
104
     return {
87
       title: `${name}的店铺`,
105
       title: `${name}的店铺`,
88
       path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false`,
106
       path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false`,
89
-      imageUrl: ''
90
-    }
107
+      imageUrl: "",
108
+    };
91
     return getShareJump({
109
     return getShareJump({
92
-      share_type:2,
93
-      share_id: this.state.shopDetail.id
94
-    }).then(res=>{
110
+      share_type: 2,
111
+      share_id: this.state.shopDetail.id,
112
+    }).then((res) => {
95
       return {
113
       return {
96
         title: "店铺",
114
         title: "店铺",
97
         path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false&&shareJump=${res.share_unique_value}`,
115
         path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false&&shareJump=${res.share_unique_value}`,
98
-        imageUrl: ''
99
-      }
100
-    })
116
+        imageUrl: "",
117
+      };
118
+    });
101
   }
119
   }
102
   render() {
120
   render() {
103
-    const { shopDetail, productList } = this.state;
121
+    const { shopDetail, productList, loading, isNoMore } = this.state;
104
     return (
122
     return (
105
       <View className="index">
123
       <View className="index">
106
         {/* 头部卡片 */}
124
         {/* 头部卡片 */}
107
         <View className="header-card">
125
         <View className="header-card">
108
           <Image className="bg-image" src={storeManagement} mode="widthFix" />
126
           <Image className="bg-image" src={storeManagement} mode="widthFix" />
109
-          {/* 分享铺 */}
127
+          {/* 分享���铺 */}
110
           {!this.state.isShare && (
128
           {!this.state.isShare && (
111
-          <View className="share-shop">
112
-            <Button onClick={this.handleShare} openType="share">
113
-            <Text>分享店铺</Text>
114
-            <AtIcon value="chevron-right" size="10" color="#fff"></AtIcon>
115
-            </Button>
116
-          </View>
129
+            <View className="share-shop">
130
+              <Button onClick={this.handleShare} openType="share">
131
+                <Text>分享店铺</Text>
132
+                <AtIcon value="chevron-right" size="10" color="#fff"></AtIcon>
133
+              </Button>
134
+            </View>
117
           )}
135
           )}
118
           {/* 个人信息 */}
136
           {/* 个人信息 */}
119
           <View className="user-info">
137
           <View className="user-info">
@@ -169,6 +187,25 @@ export default class Index extends Component {
169
             </View>
187
             </View>
170
           )}
188
           )}
171
         </View>
189
         </View>
190
+        {/* 加载中 */}
191
+        {loading && (
192
+          <View className="loading-container">
193
+            <AtActivityIndicator
194
+              content="加载中..."
195
+            isOpened={loading}
196
+            mode="center"
197
+            color="#fdf764"
198
+            />
199
+          </View>
200
+        )}
201
+        {/* 没有更多 */}
202
+        {isNoMore && (
203
+          <View className="no-more">
204
+            <View className="no-more-line">
205
+              <Text className="no-more-text">我是有底线的</Text>
206
+            </View>
207
+          </View>
208
+        )}
172
       </View>
209
       </View>
173
     );
210
     );
174
   }
211
   }

+ 107 - 53
src/pages/memberSub/storeManagement/index.less

@@ -4,6 +4,7 @@
4
     min-height: 100vh;
4
     min-height: 100vh;
5
     background-color: #f9f9f9;
5
     background-color: #f9f9f9;
6
     padding-bottom: 150px;
6
     padding-bottom: 150px;
7
+
7
     .header-card {
8
     .header-card {
8
         width: 100%;
9
         width: 100%;
9
         height: 256px;
10
         height: 256px;
@@ -84,7 +85,7 @@
84
                 font-size: 22px;
85
                 font-size: 22px;
85
                 line-height: 40px;
86
                 line-height: 40px;
86
                 margin-right: 7px;
87
                 margin-right: 7px;
87
-            color: #FFFFFF;
88
+                color: #FFFFFF;
88
             }
89
             }
89
         }
90
         }
90
     }
91
     }
@@ -98,6 +99,7 @@
98
         box-sizing: border-box;
99
         box-sizing: border-box;
99
         position: relative;
100
         position: relative;
100
         z-index: 1;
101
         z-index: 1;
102
+
101
         .product-list-title {
103
         .product-list-title {
102
             display: flex;
104
             display: flex;
103
             flex-direction: column;
105
             flex-direction: column;
@@ -122,59 +124,67 @@
122
             }
124
             }
123
         }
125
         }
124
     }
126
     }
125
-        // 底部购买模块
126
-        .bottom-buy {
127
-            width: 100%;
128
-            background-color: #fff;
129
-            height: 126px;
130
-            padding: 19px 35px 19px 44px;
131
-            box-sizing: border-box;
132
-            position: fixed;
133
-            bottom: 0;
127
+
128
+    // 底部购买模块
129
+    .bottom-buy {
130
+        width: 100%;
131
+        background-color: #fff;
132
+        height: 126px;
133
+        padding: 19px 35px 19px 44px;
134
+        box-sizing: border-box;
135
+        position: fixed;
136
+        bottom: 0;
137
+        display: flex;
138
+        justify-content: space-between;
139
+        align-items: center;
140
+        .bottom-buy-left {
134
             display: flex;
141
             display: flex;
135
-            justify-content: space-between;
142
+            flex-direction: column;
136
             align-items: center;
143
             align-items: center;
137
-            .bottom-buy-left {
144
+
145
+            image {
146
+                width: 36px;
147
+                height: 36px;
148
+                margin-bottom: 7px;
149
+            }
150
+
151
+            .bottom-buy-text {
152
+                font-size: 22px;
153
+                line-height: 32px;
154
+                color: #000000;
155
+            }
156
+        }
157
+
158
+        .bottom-buy-right {
159
+            width: 100%;
160
+            height: 100%;
161
+            display: flex;
162
+            border-radius: 60px;
163
+            overflow: hidden;
164
+
165
+            .bottom-buy-right-self,
166
+            .bottom-buy-right-share {
167
+                line-height: 43px;
168
+                font-size: 30px;
169
+                width: 100%;
138
                 display: flex;
170
                 display: flex;
139
-                flex-direction: column;
171
+                justify-content: center;
140
                 align-items: center;
172
                 align-items: center;
173
+
141
                 image {
174
                 image {
142
-                    width: 36px;
143
-                    height: 36px;
144
-                    margin-bottom: 7px;
145
-                }
146
-    
147
-                .bottom-buy-text {
148
-                    font-size: 22px;
149
-                    line-height: 32px;
150
-                    color: #000000;
175
+                    margin-right: 9px;
151
                 }
176
                 }
152
             }
177
             }
153
-            .bottom-buy-right {
154
-                width: 100%;
155
-                height: 100%;
156
-                display: flex;
157
-                border-radius: 60px;
158
-                overflow: hidden;
159
-                .bottom-buy-right-self,.bottom-buy-right-share{
160
-                    line-height: 43px;
161
-                    font-size: 30px;
162
-                    width: 100%;
163
-                    display: flex;
164
-                    justify-content: center;
165
-                    align-items: center;
166
-                    image{
167
-                        margin-right: 9px;
168
-                    }
169
-                }
170
-                .bottom-buy-right-self{
171
-                    background-color: #fbe00f;
172
-                    color: #000000;
173
-                }
174
-                .bottom-buy-right-share{
175
-                    background-color: #ff1c14;
176
-                    color: #fff;
177
-                }
178
+
179
+            .bottom-buy-right-self {
180
+                background-color: #fbe00f;
181
+                color: #000000;
182
+            }
183
+
184
+            .bottom-buy-right-share {
185
+                background-color: #ff1c14;
186
+                color: #fff;
187
+            }
178
         }
188
         }
179
     }
189
     }
180
 }
190
 }
@@ -191,11 +201,55 @@ Button {
191
     display: flex;
201
     display: flex;
192
     justify-content: center;
202
     justify-content: center;
193
     align-items: center;
203
     align-items: center;
204
+
194
     &::after {
205
     &::after {
195
-      border: none;
206
+        border: none;
207
+    }
208
+}
209
+
210
+.button-hover {
211
+    background-color: transparent !important;
212
+    /* 移除背景高亮 */
213
+    box-shadow: none !important;
214
+    /* 移除可能的阴影 */
215
+}
216
+// 加载中
217
+.loading-container {
218
+    width: 100%;
219
+    position: relative;
220
+    height: 60px;
221
+}
222
+// 没有更多
223
+.no-more {
224
+    padding: 20px 0;
225
+    
226
+    &-line {
227
+        position: relative;
228
+        text-align: center;
229
+        
230
+        &::before,
231
+        &::after {
232
+            content: '';
233
+            position: absolute;
234
+            top: 50%;
235
+            width: 30%;
236
+            height: 1px;
237
+            background-color: #e5e5e5;
238
+        }
239
+        
240
+        &::before {
241
+            left: 10%;
242
+        }
243
+        
244
+        &::after {
245
+            right: 10%;
246
+        }
247
+    }
248
+    
249
+    &-text {
250
+        display: inline-block;
251
+        padding: 0 15px;
252
+        font-size: 24px;
253
+        color: #949494;
196
     }
254
     }
197
-  }
198
-  .button-hover {
199
-    background-color: transparent !important; /* 移除背景高亮 */
200
-    box-shadow: none !important;             /* 移除可能的阴影 */
201
-  }
255
+}