Browse Source

绑定关系重复展示隐藏&分享后页面按钮展示&订单类型展示

viczhq 1 month ago
parent
commit
41c6211071

+ 7 - 0
project.private.config.json

@@ -10,6 +10,13 @@
10 10
     "miniprogram": {
11 11
       "list": [
12 12
         {
13
+          "name": "pages/memberSub/earningsOrder/index",
14
+          "pathName": "pages/memberSub/earningsOrder/index",
15
+          "query": "type=2",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
13 20
           "name": "pages/memberSub/cashOut/index",
14 21
           "pathName": "pages/memberSub/cashOut/index",
15 22
           "query": "",

+ 9 - 6
src/api/request.js

@@ -42,12 +42,15 @@ export default async (options = { method: 'GET', data: {} }) => {
42 42
       case 200:
43 43
         return data;
44 44
       case 400:
45
-        if (msg) {
46
-          Taro.showToast({
47
-            title: msg,
48
-            icon: 'none',
49
-            mask: true,
50
-          });
45
+        if (options.url.includes('/user/get_share_unique_value')) {
46
+        } else {
47
+          if (msg) {
48
+            Taro.showToast({
49
+              title: msg,
50
+              icon: 'none',
51
+              mask: true,
52
+            });
53
+          }
51 54
         }
52 55
         return Promise.reject(msg);
53 56
       case 422:

+ 2 - 2
src/components/ProductCard/index.jsx

@@ -2,9 +2,9 @@ import { View, Text, Image } from '@tarojs/components'
2 2
 import Taro from '@tarojs/taro'
3 3
 import './index.less'
4 4
 
5
-const ProductCard = ({ product }) => {
5
+const ProductCard = ({ product,isShare }) => {
6 6
   return (
7
-    <View onClick={() => Taro.navigateTo({ url: `/pages/indexSub/productDetail/index?id=${product.id}` })} className='product-card'>
7
+    <View onClick={() => Taro.navigateTo({ url: `/pages/indexSub/productDetail/index?id=${product.id}&isShare=${isShare}` })} className='product-card'>
8 8
       <Image className='product-img' src={product.image_url} mode='aspectFill' />
9 9
       <View className='product-content'>
10 10
         <Text className='title'>{product.item_title}</Text>

+ 48 - 32
src/components/index/ProductList/index.jsx

@@ -16,6 +16,7 @@ import joinStoreBg from "../../../images/index/jionStore.png";
16 16
 import joinStoreAc from "../../../images/index/joinStoreAc.png";
17 17
 import saveMoneyBg from "../../../images/index/save-money.png";
18 18
 import buy from "../../../images/index/buy.png";
19
+import shareBuy from "../../../images/index/shareBuy.png";
19 20
 import shareEarnBg from "../../../images/index/share-earn.png";
20 21
 import seckillIcon from "../../../images/seckill/seckillIcon.png";
21 22
 import { isDebounce } from "../../../common/debounce";
@@ -24,7 +25,7 @@ const ProductList = forwardRef((props, ref) => {
24 25
     productList, // 商品列表数据
25 26
     loading, // 加载状态
26 27
     isSeckill, // 是否专项区域页面使用
27
-    tagTitle,//专项区域名称
28
+    tagTitle, //专项区域名称
28 29
     isManagement, // 是否管理页面使用
29 30
     isManagementStatus, // 是否管理状态
30 31
     isProductClassify, // 是否分类页面使用
@@ -34,6 +35,7 @@ const ProductList = forwardRef((props, ref) => {
34 35
     isNoMore, // 是否没有更多
35 36
     shareUserId, // 分享用户id
36 37
     isEmpty, // 是否为空
38
+    isShare, //是否是分享
37 39
   } = props;
38 40
 
39 41
   const [selectedProducts, setSelectedProducts] = useState([]); // 商品选择状态
@@ -69,7 +71,7 @@ const ProductList = forwardRef((props, ref) => {
69 71
       selectProduct(id);
70 72
     } else {
71 73
       Taro.navigateTo({
72
-        url: `/pages/indexSub/productDetail/index?id=${id}&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}&&tagTitle=${tagTitle}`,
74
+        url: `/pages/indexSub/productDetail/index?id=${id}&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}&&tagTitle=${tagTitle}&&isShare=${isShare}`,
73 75
       });
74 76
     }
75 77
   };
@@ -197,9 +199,7 @@ const ProductList = forwardRef((props, ref) => {
197 199
                   style={{ WebkitBoxOrient: "vertical" }}
198 200
                 >
199 201
                   <Text className="self-tag">
200
-                    {isSeckill
201
-                      ? tagTitle
202
-                      : "自营"}
202
+                    {isSeckill ? tagTitle : "自营"}
203 203
                   </Text>
204 204
                   {product.item_title}
205 205
                 </View>
@@ -238,40 +238,55 @@ const ProductList = forwardRef((props, ref) => {
238 238
                     </View>
239 239
                   )}
240 240
                 </View>
241
-                <View className="profit-line">
242
-                  {Number(product.estimated_commission_buy) > 0 ? (
243
-                    <View className="save-money">
241
+                <View className={`profit-line ${isShare ? 'flexEnd' : ''}`}>
242
+                  {!isShare ? (
243
+                    Number(product.estimated_commission_buy) > 0 ? (
244
+                      <View className="save-money">
245
+                        <Image
246
+                          className="bg"
247
+                          src={saveMoneyBg}
248
+                          mode="aspectFit"
249
+                        />
250
+                        <View className="content">
251
+                          <Text className="label">自购省</Text>
252
+                          <Text className="money">
253
+                            ¥{product.estimated_commission_buy}
254
+                          </Text>
255
+                        </View>
256
+                      </View>
257
+                    ) : (
258
+                      <View className="buy">
259
+                        <Image className="bg" src={buy} mode="aspectFit" />
260
+                        <View className="content">立 即 购 买</View>
261
+                      </View>
262
+                    )
263
+                  ) : (
264
+                    // 这里添加 isShare 为 true 时要显示的内容
265
+                    <View className="shareBuy">
266
+                      <Image className="bg" src={shareBuy} />
267
+                      <View className="content">立 即 购 买</View>
268
+                    </View>
269
+                  )}
270
+
271
+                  {!isShare && (
272
+                    <View className="share-earn">
244 273
                       <Image
245 274
                         className="bg"
246
-                        src={saveMoneyBg}
275
+                        src={shareEarnBg}
247 276
                         mode="aspectFit"
248 277
                       />
249 278
                       <View className="content">
250
-                        <Text className="label">自购省</Text>
251
-                        <Text className="money">
252
-                          ¥{product.estimated_commission_buy}
253
-                        </Text>
279
+                        <Button
280
+                          onClick={(e) => shareProduct(product, e)} // 传递事件对象
281
+                        >
282
+                          <Text className="label">分享赚</Text>
283
+                          <Text className="money">
284
+                            ¥{product.estimated_commission_promotion}
285
+                          </Text>
286
+                        </Button>
254 287
                       </View>
255 288
                     </View>
256
-                  ) : (
257
-                    <View className="buy">
258
-                      <Image className="bg" src={buy} mode="aspectFit" />
259
-                      <View className="content">立 即 购 买</View>
260
-                    </View>
261 289
                   )}
262
-                  <View className="share-earn">
263
-                    <Image className="bg" src={shareEarnBg} mode="aspectFit" />
264
-                    <View className="content">
265
-                      <Button
266
-                        onClick={(e) => shareProduct(product, e)} // 传递事件对象
267
-                      >
268
-                        <Text className="label">分享赚</Text>
269
-                        <Text className="money">
270
-                          ¥{product.estimated_commission_promotion}
271
-                        </Text>
272
-                      </Button>
273
-                    </View>
274
-                  </View>
275 290
                 </View>
276 291
               </View>
277 292
             </View>
@@ -313,7 +328,7 @@ const ProductList = forwardRef((props, ref) => {
313 328
 
314 329
 ProductList.defaultProps = {
315 330
   isSeckill: false,
316
-  tagTitle:'',
331
+  tagTitle: "",
317 332
   productList: [],
318 333
   loading: false,
319 334
   isManagement: false,
@@ -323,6 +338,7 @@ ProductList.defaultProps = {
323 338
   isNoMore: false,
324 339
   shareUserId: "",
325 340
   isEmpty: false, // 是否为空
341
+  isShare: false, //分享
326 342
   onAddProduct: () => {}, // 添加商品方法
327 343
   onDeleteProductSelect: () => {}, // 删除商品选中id数组
328 344
 };

+ 33 - 3
src/components/index/ProductList/index.less

@@ -126,11 +126,12 @@
126 126
           }
127 127
         }
128 128
       }
129
-
129
+      .flexEnd{
130
+        justify-content: flex-end;
131
+      }
130 132
       .profit-line {
131 133
         display: flex;
132 134
         gap: 20px;
133
-
134 135
         .save-money {
135 136
           color: #F6C71A;
136 137
           // color: #F6C71A;
@@ -145,7 +146,8 @@
145 146
           //   text-align: center;
146 147
           // }
147 148
         }
148
-        .buy{
149
+
150
+        .buy {
149 151
           color: #F6C71A;
150 152
           display: flex;
151 153
           align-items: center;
@@ -161,6 +163,7 @@
161 163
             top: 0;
162 164
             left: 0;
163 165
           }
166
+
164 167
           .content {
165 168
             width: 74px;
166 169
             height: 80px;
@@ -169,6 +172,33 @@
169 172
             text-align: center;
170 173
           }
171 174
         }
175
+
176
+        .shareBuy {
177
+          color: #F6C71A;
178
+          display: flex;
179
+          align-items: center;
180
+          justify-content: center;
181
+          position: relative;
182
+          width: 60%;
183
+          height: 84px;
184
+          .bg {
185
+            width: 100%;
186
+            height: 100%;
187
+            position: absolute;
188
+            top: 0;
189
+            left: 0;
190
+          }
191
+
192
+          .content {
193
+            width: 100%;
194
+            height: 80px;
195
+            font-size: 30px;
196
+            text-align: center;
197
+            line-height: 80px;
198
+            letter-spacing:8px;
199
+          }
200
+        }
201
+
172 202
         .share-earn {
173 203
           color: #fff;
174 204
         }

BIN
src/images/index/shareBuy.png


+ 28 - 19
src/pages/indexSub/productDetail/index.jsx

@@ -31,7 +31,7 @@ export default class Index extends Component {
31 31
     productLikeList: [], //推荐商品列表
32 32
     productPromotion: [], //商品推广转链
33 33
     isSeckill: false, //是否是专项区域页面
34
-    tagTitle:'',//专项跳转标题
34
+    tagTitle: "", //专项跳转标题
35 35
     shareJump: "", //分享跳转标识
36 36
     shareTitle: "", //分享标题
37 37
     shareUserId: "", //分享用户id
@@ -68,18 +68,27 @@ export default class Index extends Component {
68 68
     Taro.hideShareMenu({
69 69
       menus: ["shareAppMessage", "shareTimeline"],
70 70
     });
71
-    const { id, isShare, isSeckill, shareJump, shareUserId,tagTitle,shareType } =
72
-      Taro.getCurrentInstance().router.params;
71
+    const {
72
+      id,
73
+      isShare,
74
+      isSeckill,
75
+      shareJump,
76
+      shareUserId,
77
+      tagTitle,
78
+      shareType,
79
+    } = Taro.getCurrentInstance().router.params;
80
+    console.log(isShare);
81
+
73 82
     let session_key = Taro.getStorageSync("session_key");
74 83
     let userInfo = Taro.getStorageSync("userInfo");
75 84
     let isShowSign = Taro.getStorageSync("isShowSign");
76 85
     this.setState(
77 86
       {
78 87
         id,
79
-        isShare,
88
+        isShare: isShare === "true",
80 89
         isSeckill: isSeckill === "true",
81 90
         shareUserId: shareUserId,
82
-        tagTitle:tagTitle,
91
+        tagTitle: tagTitle,
83 92
       },
84 93
       () => {
85 94
         // 获取分享跳转标识
@@ -224,17 +233,17 @@ export default class Index extends Component {
224 233
     }
225 234
   };
226 235
   render() {
227
-    const { productDetail,tagTitle } = this.state;
236
+    const { productDetail, tagTitle } = this.state;
228 237
     return (
229 238
       <View
230 239
         className="index"
231 240
         style={{ paddingTop: Taro.navigationBarHeight + "px" }}
232 241
       >
233
-        {!this.state.isShare && (
234
-          <View className="back-btn" onClick={this.handleBack}>
235
-            <AtIcon value="chevron-left" size="24" color="#999999"></AtIcon>
236
-          </View>
237
-        )}
242
+        {/* {!this.state.isShare && ( */}
243
+        <View className="back-btn" onClick={this.handleBack}>
244
+          <AtIcon value="chevron-left" size="24" color="#999999"></AtIcon>
245
+        </View>
246
+        {/* )} */}
238 247
         {/* 轮播图 */}
239 248
         <Swiper className="swiper" autoplay circular>
240 249
           {productDetail.images &&
@@ -253,9 +262,7 @@ export default class Index extends Component {
253 262
           {/* 商品名称 */}
254 263
           <Text className="product-name">
255 264
             <Text className="self-tag">
256
-              {this.state.isSeckill
257
-                ? tagTitle
258
-                : "自营"}
265
+              {this.state.isSeckill ? tagTitle : "自营"}
259 266
             </Text>
260 267
             {productDetail.item_title}
261 268
           </Text>
@@ -275,11 +282,13 @@ export default class Index extends Component {
275 282
               )}
276 283
             </View>
277 284
             {/* 标签区域 */}
278
-            <View className="tag-box">
279
-              <Text className="tag">
280
-                分享赚¥{productDetail.estimated_commission_promotion}
281
-              </Text>
282
-            </View>
285
+            {!this.state.isShare && (
286
+              <View className="tag-box">
287
+                <Text className="tag">
288
+                  分享赚¥{productDetail.estimated_commission_promotion}
289
+                </Text>
290
+              </View>
291
+            )}
283 292
           </View>
284 293
 
285 294
           {/* 分割线 */}

+ 1 - 0
src/pages/indexSub/seckillIndex/index.jsx

@@ -175,6 +175,7 @@ export default class Index extends Component {
175 175
             isNoMore={this.state.isNoMore}
176 176
             shareUserId={this.state.shareUserId}
177 177
             tagTitle={this.state.title}
178
+            isShare={this.state.isShare}
178 179
           />
179 180
         </View>
180 181
       </View>

+ 4 - 3
src/pages/login/index.jsx

@@ -67,9 +67,10 @@ export default class Index extends Component {
67 67
           icon: "none",
68 68
         });
69 69
 
70
-        // 再获取用户信息
71
-        const userInfoRes = await getUserInfo();
72
-        Taro.setStorageSync("userInfo", userInfoRes);
70
+        // 获取用户信息
71
+        getUserInfo().then(userInfoRes => {
72
+          Taro.setStorageSync("userInfo", userInfoRes);
73
+        });
73 74
         try {
74 75
           // 先处理分享跳转
75 76
           let shareJump = Taro.getStorageSync("shareJump");

+ 22 - 15
src/pages/memberSub/earningsOrder/index.jsx

@@ -193,16 +193,23 @@ export default class Index extends Component {
193 193
               <View className="order-info">
194 194
                 <View className="order-details">
195 195
                   <View className="detail-item">
196
-                    <Text className="label">订单编号:</Text>
197
-                    <Text className="value">{item.order_number}</Text>
198
-                    <Text
199
-                      className="copy-text"
200
-                      onClick={() => this.handleCopy(item.order_number)}
201
-                    >
202
-                      复制
203
-                    </Text>
196
+                    <View className="left">
197
+                      <Text className="label">订单编号:</Text>
198
+                      <Text className="value">{item.order_number}</Text>
199
+                      <Text
200
+                        className="copy-text"
201
+                        onClick={() => this.handleCopy(item.order_number)}
202
+                      >
203
+                        复制
204
+                      </Text>
205
+                    </View>
206
+                    <View className="right">
207
+                      <Text className="order-status">
208
+                        {tabList[item.state + 1].title}
209
+                      </Text>
210
+                    </View>
204 211
                   </View>
205
-                  <View className="detail-item">
212
+                  <View className="detail-item fixWidth">
206 213
                     <Text className="label">下单时间:</Text>
207 214
                     <Text className="value">{item.pay_time}</Text>
208 215
                   </View>
@@ -226,12 +233,12 @@ export default class Index extends Component {
226 233
                     <View className="promotion-info">
227 234
                       <View className="tag">预估收入</View>
228 235
                       <Text className="amount">
229
-                      ¥
230
-                      {orderType == 2
231
-                        ? item.assess_amount_text_promotion_yuan
232
-                        : item.assess_amount_text_buy_yuan}
233
-                    </Text>
234
-                  </View>
236
+                        ¥
237
+                        {orderType == 2
238
+                          ? item.assess_amount_text_promotion_yuan
239
+                          : item.assess_amount_text_buy_yuan}
240
+                      </Text>
241
+                    </View>
235 242
                   )}
236 243
                   <View className="payment-info">
237 244
                     <Text className="label">实付金额:</Text>

+ 38 - 22
src/pages/memberSub/earningsOrder/index.less

@@ -2,6 +2,7 @@
2 2
     background-color: #f9f9f9; // ... 其他样式 ...
3 3
     min-height: 100vh;
4 4
 }
5
+
5 6
 // 订单类型切换
6 7
 .order-type-switch {
7 8
     display: flex;
@@ -10,6 +11,7 @@
10 11
     padding: 20px 134px 10px 134px;
11 12
     align-items: center;
12 13
     box-sizing: border-box;
14
+
13 15
     .order-type-item {
14 16
         font-size: 30px;
15 17
         color: #999999;
@@ -18,11 +20,13 @@
18 20
         box-sizing: border-box;
19 21
         border-radius: 40px;
20 22
     }
23
+
21 24
     .order-type-item.active {
22 25
         color: #fff;
23 26
         background-color: #fa9703;
24 27
     }
25 28
 }
29
+
26 30
 // tab切换
27 31
 .tab-container {
28 32
     display: flex;
@@ -31,6 +35,7 @@
31 35
     padding: 22px 34px;
32 36
     box-sizing: border-box;
33 37
     align-items: center;
38
+
34 39
     .tab-item {
35 40
         font-size: 26px;
36 41
         color: #000000;
@@ -68,7 +73,7 @@
68 73
         display: flex;
69 74
         align-items: center;
70 75
         border-radius: 14px;
71
-        padding:18px;
76
+        padding: 18px;
72 77
         background-color: #f6f6f6;
73 78
 
74 79
         .search-icon {
@@ -142,32 +147,40 @@
142 147
             justify-content: space-between;
143 148
             padding-bottom: 24px;
144 149
             padding-top: 24px;
150
+
145 151
             .order-details {
152
+                width: 100%;
146 153
                 .detail-item {
147 154
                     display: flex;
148 155
                     align-items: center;
156
+                    justify-content: space-between;
149 157
                     margin-bottom: 8px;
150
-
151
-                    .label {
152
-                        color: #999;
153
-                        font-size: 22px;
154
-                        margin-right: 12px;
155
-                        line-height: 32px;
158
+                    color: #999;
159
+                    font-size: 22px;
160
+                    line-height: 32px;
161
+                    .left{
162
+                        display: flex;
163
+                        align-items: center;
164
+                        .label {
165
+                            margin-right: 12px;
166
+                        }
167
+                        .copy-text {
168
+                            color: #F6C71A;
169
+                            margin-left: 30px;
170
+                        }
156 171
                     }
157
-
158
-                    .value {
159
-                        color: #999;
160
-                        font-size: 22px;
161
-                        line-height: 32px;
162
-                    }
163
-
164
-                    .copy-text {
165
-                        color: #F6C71A;
166
-                        font-size: 22px;
167
-                        margin-left: 30px;
168
-                        line-height: 32px;
172
+                    .right{
173
+                        display: flex;
174
+                        align-items: center;
175
+                        .order-status {
176
+                            font-size: 24px;
177
+                            color: #F6C71A;
178
+                        }
169 179
                     }
170 180
                 }
181
+                .fixWidth{
182
+                    width: fit-content;
183
+                }
171 184
             }
172 185
 
173 186
             .member-info {
@@ -272,17 +285,20 @@
272 285
         }
273 286
     }
274 287
 }
288
+
275 289
 // 加载中
276 290
 .loading {
277 291
     width: 100%;
278 292
     position: relative;
279 293
     height: 60px;
280
-  }
294
+}
295
+
281 296
 // 没有更多
282 297
 .no-more {
283
-    padding:0 33px;
298
+    padding: 0 33px;
284 299
     box-sizing: border-box;
285
-    .at-divider__content{
300
+
301
+    .at-divider__content {
286 302
         background-color: #f9f9f9;
287 303
     }
288 304
 }

+ 2 - 2
src/pages/memberSub/storeManagement/index.jsx

@@ -137,7 +137,7 @@ export default class Index extends Component {
137 137
     });
138 138
   }
139 139
   render() {
140
-    const { shopDetail, productList, loading, isNoMore } = this.state;
140
+    const { shopDetail, productList, loading, isNoMore,isShare } = this.state;
141 141
     return (
142 142
       <View className="index">
143 143
         {/* 头部卡片 */}
@@ -177,7 +177,7 @@ export default class Index extends Component {
177 177
           {productList && (
178 178
             <View className="product-card-list">
179 179
               {productList.map((product) => (
180
-                <ProductCard key={product.id} product={product} />
180
+                <ProductCard key={product.id} product={product} isShare={isShare}/>
181 181
               ))}
182 182
             </View>
183 183
           )}