Przeglądaj źródła

首页专项区域动态配置

viczhq 1 miesiąc temu
rodzic
commit
ca744c6322

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

@@ -9,7 +9,7 @@ import selectStep from "../../images/productDetail/selectStep.png";
9 9
 import xianyu from "../../images/productDetail/xianyu.png";
10 10
 import stepThree from "../../images/productDetail/stepThree.png";
11 11
 export default function Modal(props) {
12
-  const { productPromotion, isOpened, title, linkText, id, shareUserId,isHighCommission,isSeckill } =
12
+  const { productPromotion, isOpened, title, linkText, id, shareUserId,isSeckill } =
13 13
     props;
14 14
   const handleCopyLink = () => {
15 15
     if (!isDebounce(500)) return; // 如果在300ms内重复触发,直接返回
@@ -20,7 +20,7 @@ export default function Modal(props) {
20 20
         title: "口令已复制",
21 21
         icon: "success",
22 22
       });
23
-      if (isHighCommission || isSeckill) {
23
+      if (isSeckill) {
24 24
         const dayid = formatDate(new Date(), "YYYY-MM-DD");
25 25
         let userId = "";
26 26
         if (Taro.getStorageSync("loginInfo")) {

+ 4 - 18
src/components/index/OperationArea/index.jsx

@@ -5,24 +5,17 @@ import "./index.less";
5 5
 const OperationArea = ({ recommend }) => {
6 6
   // 添加跳转方法
7 7
   const handleNavigate = (type) => {
8
-    if (type === "鱼市秒杀") {
9
-      Taro.navigateTo({
10
-        url: `/pages/indexSub/seckillIndex/index?isDirect=true`,
11
-      });
12
-    } else if (type === "高佣专项") {
13
-      Taro.navigateTo({
14
-        url: `/pages/indexSub/highCommission/index?isDirect=true`,
15
-      });
16
-    }
8
+    Taro.navigateTo({
9
+      url: `/pages/indexSub/seckillIndex/index?isDirect=true&title=${type.name}&id=${type.id}`,
10
+    });
17 11
   };
18
-
19 12
   return (
20 13
     <View className="operation-wrap">
21 14
       {recommend.map((item, index) => (
22 15
         <View
23 16
           key={index}
24 17
           className="operation-item"
25
-          onClick={() => handleNavigate(item.tag.name)}
18
+          onClick={() => handleNavigate(item.tag)}
26 19
         >
27 20
           <View className="title-wrap">
28 21
             <Text className="title">{item.tag.name}</Text>
@@ -53,13 +46,6 @@ const OperationArea = ({ recommend }) => {
53 46
           </View>
54 47
         </View>
55 48
       ))}
56
-
57
-      {/* <View className="operation-item" onClick={() => handleNavigate('highCommission')}>
58
-        <View className="title-wrap">
59
-          <Text className="title">高佣专项</Text>
60
-          <Text className="tag">高佣金必囤爆品</Text>
61
-        </View>
62
-      </View> */}
63 49
     </View>
64 50
   );
65 51
 };

+ 2 - 2
src/components/index/OperationArea/index.less

@@ -2,14 +2,14 @@
2 2
     margin: 16px 16px 0;
3 3
     display: flex;
4 4
     justify-content: space-between;
5
-
5
+    flex-wrap: wrap;
6 6
     .operation-item {
7 7
         width: 350px;
8 8
         height: 256px;
9 9
         background: #FFFFFF;
10 10
         border-radius: 16px;
11 11
         border: 1px solid #FFFFFF;
12
-
12
+        margin-bottom: 16px;
13 13
         .title {
14 14
             font-size: 28px;
15 15
             font-weight: bold;

+ 9 - 11
src/components/index/ProductList/index.jsx

@@ -23,8 +23,8 @@ const ProductList = forwardRef((props, ref) => {
23 23
   const {
24 24
     productList, // 商品列表数据
25 25
     loading, // 加载状态
26
-    isSeckill, // 是否秒杀页面使用
27
-    isHighCommission, // 是否高佣金��面使用
26
+    isSeckill, // 是否专项区域页面使用
27
+    tagTitle,//专项区域名称
28 28
     isManagement, // 是否管理页面使用
29 29
     isManagementStatus, // 是否管理状态
30 30
     isProductClassify, // 是否分类页面使用
@@ -69,7 +69,7 @@ const ProductList = forwardRef((props, ref) => {
69 69
       selectProduct(id);
70 70
     } else {
71 71
       Taro.navigateTo({
72
-        url: `/pages/indexSub/productDetail/index?id=${id}&&isHighCommission=${isHighCommission}&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}`,
72
+        url: `/pages/indexSub/productDetail/index?id=${id}&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}&&tagTitle=${tagTitle}`,
73 73
       });
74 74
     }
75 75
   };
@@ -149,24 +149,24 @@ const ProductList = forwardRef((props, ref) => {
149 149
           product.id
150 150
         }&&isShare=${true}&&shareJump=${
151 151
           res.share_unique_value
152
-        }&&isHighCommission=${isHighCommission}&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}`,
152
+        }&&isSeckill=${isSeckill}&&shareUserId=${shareUserId}`,
153 153
         imageUrl: product.image_url,
154 154
       });
155 155
       setShareLink(res.share_unique_value);
156 156
       setShareModalOpened(true);
157
-      if (isHighCommission || isSeckill) {
157
+      if (isSeckill) {
158 158
         handleLog(product.id);
159 159
       }
160 160
     });
161 161
   };
162 162
   return (
163 163
     <View className="product-list-wrap">
164
-      {isSeckill && (
164
+      {/* {isSeckill && (
165 165
         <View className="seckill-icon">
166 166
           <Image src={seckillIcon} mode="aspectFit" />
167 167
           <Text>每日疯抢 限时秒杀</Text>
168 168
         </View>
169
-      )}
169
+      )} */}
170 170
       {productList.map((product, index) => (
171 171
         <View key={product.id}>
172 172
           <View onClick={() => toDetail(product.id)} className="product-item">
@@ -198,9 +198,7 @@ const ProductList = forwardRef((props, ref) => {
198 198
                 >
199 199
                   <Text className="self-tag">
200 200
                     {isSeckill
201
-                      ? "鱼市秒杀"
202
-                      : isHighCommission
203
-                      ? "高佣专项"
201
+                      ? tagTitle
204 202
                       : "自营"}
205 203
                   </Text>
206 204
                   {product.item_title}
@@ -315,7 +313,7 @@ const ProductList = forwardRef((props, ref) => {
315 313
 
316 314
 ProductList.defaultProps = {
317 315
   isSeckill: false,
318
-  isHighCommission: false,
316
+  tagTitle:'',
319 317
   productList: [],
320 318
   loading: false,
321 319
   isManagement: false,

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

@@ -44,7 +44,7 @@ export default class Index extends Component {
44 44
   handleBannerClick = (item) => {
45 45
     if(item.type_jpath==1){
46 46
       Taro.navigateTo({
47
-        url: `${item.jpath}?isBanner=true`
47
+        url: `${item.jpath}&isBanner=true`
48 48
       })
49 49
     }
50 50
   };
@@ -174,7 +174,7 @@ export default class Index extends Component {
174 174
                     <Image
175 175
                       className="banner-img"
176 176
                       src={item.img}
177
-                      mode="aspectFill"
177
+                      mode="widthFix"
178 178
                     />
179 179
                   </SwiperItem>
180 180
                 ))}

+ 4 - 1
src/pages/index/index.less

@@ -132,7 +132,10 @@
132 132
       }
133 133
     }
134 134
   }
135
-
135
+  // 商品列表
136
+  .product-list-wrap {
137
+    margin-top: 0;
138
+  }
136 139
   // 添加浮动按钮样式
137 140
   .float-buttons {
138 141
     position: fixed;

+ 10 - 13
src/pages/indexSub/productDetail/index.jsx

@@ -30,8 +30,8 @@ export default class Index extends Component {
30 30
     productDetail: [], //商品详情
31 31
     productLikeList: [], //推荐商品列表
32 32
     productPromotion: [], //商品推广转链
33
-    isHighCommission: false, //是否是高佣金页面
34
-    isSeckill: false, //是否是秒杀页面
33
+    isSeckill: false, //是否是专项区域页面
34
+    tagTitle:'',//专项跳转标题
35 35
     shareJump: "", //分享跳转标识
36 36
     shareTitle: "", //分享标题
37 37
     shareUserId: "", //分享用户id
@@ -68,7 +68,7 @@ export default class Index extends Component {
68 68
     Taro.hideShareMenu({
69 69
       menus: ["shareAppMessage", "shareTimeline"],
70 70
     });
71
-    const { id, isShare, isHighCommission, isSeckill, shareJump, shareUserId } =
71
+    const { id, isShare, isSeckill, shareJump, shareUserId,tagTitle } =
72 72
       Taro.getCurrentInstance().router.params;
73 73
     let session_key = Taro.getStorageSync("session_key");
74 74
     let userInfo = Taro.getStorageSync("userInfo");
@@ -77,9 +77,9 @@ export default class Index extends Component {
77 77
       {
78 78
         id,
79 79
         isShare,
80
-        isHighCommission: isHighCommission === "true",
81 80
         isSeckill: isSeckill === "true",
82 81
         shareUserId: shareUserId,
82
+        tagTitle:tagTitle,
83 83
       },
84 84
       () => {
85 85
         // 获取分享跳转标识
@@ -93,7 +93,7 @@ export default class Index extends Component {
93 93
         if (session_key && shareJump) {
94 94
           this.bindShareJump(); //绑定分享跳转标识
95 95
         }
96
-        if (this.state.isHighCommission || this.state.isSeckill) {
96
+        if (this.state.isSeckill) {
97 97
           this.handleLog("direct_to_product"); //埋点
98 98
         }
99 99
       }
@@ -142,7 +142,7 @@ export default class Index extends Component {
142 142
   // 埋点
143 143
   handleLog = (event_type) => {
144 144
     if (!isDebounce(500)) return; // 如果在300ms内重复触发,直接返回
145
-    if (this.state.isHighCommission || this.state.isSeckill) {
145
+    if (this.state.isSeckill) {
146 146
       const dayid = formatDate(new Date(), "YYYY-MM-DD");
147 147
       const event_type_title =
148 148
         event_type == "share_product_link"
@@ -202,7 +202,7 @@ export default class Index extends Component {
202 202
   onShareAppMessage() {
203 203
     return {
204 204
       title: this.state.shareTitle || this.state.productDetail.item_title,
205
-      path: `/pages/indexSub/productDetail/index?id=${this.state.id}&&isShare=true&&isHighCommission=${this.state.isHighCommission}&&isSeckill=${this.state.isSeckill}&&shareJump=${this.state.shareJump}`,
205
+      path: `/pages/indexSub/productDetail/index?id=${this.state.id}&&isShare=true&&isSeckill=${this.state.isSeckill}&&shareJump=${this.state.shareJump}&&tagTitle=${this.state.tagTitle}`,
206 206
       imageUrl: this.state.productDetail.images[0].img,
207 207
     };
208 208
   }
@@ -218,7 +218,7 @@ export default class Index extends Component {
218 218
     }
219 219
   };
220 220
   render() {
221
-    const { productDetail } = this.state;
221
+    const { productDetail,tagTitle } = this.state;
222 222
     return (
223 223
       <View
224 224
         className="index"
@@ -247,10 +247,8 @@ export default class Index extends Component {
247 247
           {/* 商品名称 */}
248 248
           <Text className="product-name">
249 249
             <Text className="self-tag">
250
-              {this.state.isHighCommission
251
-                ? "高佣专项"
252
-                : this.state.isSeckill
253
-                ? "鱼市秒杀"
250
+              {this.state.isSeckill
251
+                ? tagTitle
254 252
                 : "自营"}
255 253
             </Text>
256 254
             {productDetail.item_title}
@@ -368,7 +366,6 @@ export default class Index extends Component {
368 366
           linkText={this.state.productPromotion.short_tpwd}
369 367
           id={this.state.id}
370 368
           shareUserId={this.state.shareUserId}
371
-          isHighCommission={this.state.isHighCommission}
372 369
           isSeckill={this.state.isSeckill}
373 370
         />
374 371
         {/* 分享弹窗 */}

+ 1 - 1
src/pages/indexSub/seckillIndex/index.config.js

@@ -1,3 +1,3 @@
1 1
 export default definePageConfig({
2
-  navigationBarTitleText: '鱼市秒杀'
2
+  navigationBarTitleText: '鱼市专项'
3 3
 })

+ 29 - 20
src/pages/indexSub/seckillIndex/index.jsx

@@ -2,13 +2,14 @@ import { Component } from "react";
2 2
 import { View, Image } from "@tarojs/components";
3 3
 import "./index.less";
4 4
 import Taro from "@tarojs/taro";
5
-import seckillImg from "../../../images/seckill/seckillTop.jpg";
6 5
 import ProductList from "../../../components/index/ProductList";
7 6
 import { getRecommendProductList, addLog } from "../../../service";
8 7
 import { formatDate } from "../../../common/time";
9 8
 import { getShareContent } from "../../../common/share";
10 9
 export default class Index extends Component {
11 10
   state = {
11
+    title: "", // 页面标题
12
+    id: "", // 页面类型id
12 13
     productList: [], //推荐商品列表
13 14
     page: 1, //页数
14 15
     loading: false, //加载状态
@@ -18,9 +19,10 @@ export default class Index extends Component {
18 19
     isBanner: false, // 是否是banner跳转
19 20
     isShare: false, // 是否是分享跳转
20 21
     shareUserId: "", // 分享用户id
22
+    img: "", // 图片
21 23
   };
22 24
   componentDidMount() {
23
-    const { isDirect, isBanner, isShare, shareUserId } =
25
+    const { isDirect, isBanner, isShare, shareUserId, title, id } =
24 26
       Taro.getCurrentInstance().router.params || "";
25 27
     this.setState(
26 28
       {
@@ -28,20 +30,26 @@ export default class Index extends Component {
28 30
         isBanner: isBanner || false,
29 31
         isShare: isShare || false,
30 32
         shareUserId: shareUserId || "",
33
+        title: title || "",
34
+        id: id || "",
31 35
       },
32 36
       () => {
37
+        // 设置页面标题
38
+        Taro.setNavigationBarTitle({
39
+          title: this.state.title || "鱼市",
40
+        });
33 41
         this.handleLog(
34 42
           isDirect
35
-            ? "direct_to_fish_seckill"
43
+            ? `direct_to_${this.state.id}_${this.state.title}`
36 44
             : isBanner
37
-            ? "banner_to_fish_seckill"
45
+            ? `banner_to_${this.state.id}_${this.state.title}`
38 46
             : isShare
39
-            ? "share_to_fish_seckill"
40
-            : "direct_to_fish_seckill"
47
+            ? `share_to_${this.state.id}_${this.state.title}`
48
+            : `direct_to_${this.state.id}_${this.state.title}`
41 49
         );
50
+        this.getRecommendProductList();
42 51
       }
43 52
     );
44
-    this.getRecommendProductList();
45 53
   }
46 54
   // 获取推荐商品列表
47 55
   getRecommendProductList = async () => {
@@ -49,7 +57,7 @@ export default class Index extends Component {
49 57
     this.setState({ loading: true });
50 58
 
51 59
     const res = await getRecommendProductList({
52
-      tag_id: 120,
60
+      tag_id: this.state.id,
53 61
       page,
54 62
       page_size: 10,
55 63
     });
@@ -59,19 +67,20 @@ export default class Index extends Component {
59 67
       totalPages: res.total_pages,
60 68
       loading: false,
61 69
       isNoMore: res.total_pages <= page,
70
+      img: res.img,
62 71
     }));
63 72
   };
64 73
   // 埋点
65 74
   handleLog = (event_type) => {
66 75
     const dayid = formatDate(new Date(), "YYYY-MM-DD");
67 76
     const event_type_title =
68
-      event_type == "banner_to_fish_seckill"
69
-        ? "从banner 跳转到鱼市秒杀"
70
-        : event_type == "share_to_fish_seckill"
71
-        ? "从分享链接跳转到鱼市秒杀"
72
-        : event_type == "direct_to_fish_seckill"
73
-        ? "直接点击进入鱼市秒杀"
74
-        : "直接点击进入鱼市秒杀";
77
+      event_type == `banner_to_${this.state.id}_${this.state.title}`
78
+        ? `从banner 跳转到${this.state.title}`
79
+        : event_type == `share_to_${this.state.id}_${this.state.title}`
80
+        ? `从分享链接跳转到${this.state.title}`
81
+        : event_type == `direct_to_${this.state.id}_${this.state.title}`
82
+        ? `直接点击进入${this.state.title}`
83
+        : `直接点击进入${this.state.title}`;
75 84
     let userId = "";
76 85
     if (Taro.getStorageSync("loginInfo")) {
77 86
       userId = Taro.getStorageSync("loginInfo").id;
@@ -84,7 +93,7 @@ export default class Index extends Component {
84 93
       });
85 94
     }
86 95
     addLog({
87
-      users_id: userId||0,
96
+      users_id: userId || 0,
88 97
       goods_id: 0,
89 98
       event_type_title,
90 99
       event_type,
@@ -98,11 +107,10 @@ export default class Index extends Component {
98 107
     if (Taro.getStorageSync("loginInfo")) {
99 108
       shareUserId = Taro.getStorageSync("loginInfo").id;
100 109
     }
101
-    const shareConfig = getShareContent();
102 110
     if (res.from == "menu") {
103 111
       return {
104
-        title: "鱼市秒杀",
105
-        path: `/pages/indexSub/seckillIndex/index?isShare=true&shareUserId=${shareUserId}`,
112
+        title: `${this.state.title}`,
113
+        path: `/pages/indexSub/seckillIndex/index?isShare=true&shareUserId=${shareUserId}&title=${this.state.title}&id=${this.state.id}`,
106 114
         imageUrl: "",
107 115
       };
108 116
     } else {
@@ -122,7 +130,7 @@ export default class Index extends Component {
122 130
   render() {
123 131
     return (
124 132
       <View className="index">
125
-        <Image className="seckill" src={seckillImg} mode="aspectFill" />
133
+        <Image className="seckill" src={this.state.img} mode="widthFix" />
126 134
         {/* 商品列表 */}
127 135
         <View className="product-list">
128 136
           <ProductList
@@ -131,6 +139,7 @@ export default class Index extends Component {
131 139
             loading={this.state.loading}
132 140
             isNoMore={this.state.isNoMore}
133 141
             shareUserId={this.state.shareUserId}
142
+            tagTitle={this.state.title}
134 143
           />
135 144
         </View>
136 145
       </View>

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

@@ -2,6 +2,7 @@
2 2
     width: 100%;
3 3
     padding-bottom: 40px;
4 4
     box-sizing: border-box;
5
+    background-color: #f9f9f9;
5 6
     .seckill{
6 7
         width: 100%;
7 8
         height: 300px;

+ 5 - 3
src/pages/memberSub/earningsOrder/index.jsx

@@ -222,15 +222,17 @@ export default class Index extends Component {
222 222
                 />
223 223
                 <View className="product-details">
224 224
                   <Text className="product-name">{item.item_title}</Text>
225
-                  <View className="promotion-info">
226
-                    <View className="tag">预估收入</View>
227
-                    <Text className="amount">
225
+                  {item.state_code != 3 && (
226
+                    <View className="promotion-info">
227
+                      <View className="tag">预估收入</View>
228
+                      <Text className="amount">
228 229
                       ¥
229 230
                       {orderType == 2
230 231
                         ? item.assess_amount_text_promotion_yuan
231 232
                         : item.assess_amount_text_buy_yuan}
232 233
                     </Text>
233 234
                   </View>
235
+                  )}
234 236
                   <View className="payment-info">
235 237
                     <Text className="label">实付金额:</Text>
236 238
                     <Text className="amount">¥{item.actual_paid_fee}</Text>

+ 1 - 1
src/service/index.js

@@ -36,7 +36,7 @@ export const getProductLikeList = data =>
36 36
     method: 'POST',
37 37
     data,
38 38
   })
39
-// 获取推荐商品列表   (包括鱼市商品 = 120;高佣专属 = 121)
39
+// 获取推荐商品列表
40 40
 export const getRecommendProductList = data =>
41 41
   Request({
42 42
     url: '/api/get_goods_data_list_recommend',