Browse Source

新春活动页面&&签约修改

viczhq 3 weeks ago
parent
commit
894a601b7a

+ 0 - 25
src/pages/index/index.jsx

@@ -30,8 +30,6 @@ export default class Index extends Component {
30 30
     page: 1, // 添加页码
31 31
     totalPages: 1, // 添加总页数
32 32
     loading: false, // 添加加载状态
33
-    params: {}, // 添加参数
34
-    userInfo: {}, // 添加用户信息
35 33
   };
36 34
   // 获取首页数据
37 35
   getHomeData = async () => {
@@ -82,13 +80,6 @@ export default class Index extends Component {
82 80
     );
83 81
   }
84 82
   componentDidShow() {
85
-    const params = Taro.getCurrentInstance().router.params;
86
-    const userInfo = Taro.getStorageSync("userInfo");
87
-    this.setState({
88
-      params: params,
89
-      userInfo: userInfo,
90
-    });
91
-    console.log(params, "params");
92 83
     this.setState(
93 84
       {
94 85
         page: 1,
@@ -224,22 +215,6 @@ export default class Index extends Component {
224 215
             onShareProduct={this.handleShare}
225 216
           />
226 217
         </View>
227
-        {/* 打印参数 */}
228
-        {Object.keys(this.state.params).length > 0 &&
229
-          (this.state.userInfo.id === 2818 ||
230
-            this.state.userInfo.id === 2815 ||
231
-            this.state.userInfo.id === 2820) && (
232
-            <View className="params-wrap" style={{ width: "70%" }}>
233
-              <View style={{ 
234
-                wordBreak: "break-all", 
235
-                whiteSpace: "pre-wrap",
236
-                fontSize: "12px",
237
-                padding: "10px"
238
-              }}>
239
-                {JSON.stringify(this.state.params, null, 2)}
240
-              </View>
241
-            </View>
242
-          )}
243 218
         {/* 添加浮动按钮 */}
244 219
         <View className="float-buttons">
245 220
           <View

+ 203 - 132
src/pages/indexSub/activity/index.jsx

@@ -3,69 +3,55 @@ import { View, Image, Text, ScrollView } from "@tarojs/components";
3 3
 import { AtTabs, AtActivityIndicator } from "taro-ui";
4 4
 import "./index.less";
5 5
 import Taro from "@tarojs/taro";
6
+import {
7
+  getNewYearTab,
8
+  getNewYearProductList,
9
+} from "../../../service/activity";
10
+import { addLog } from "../../../service/index";
11
+import { formatDate } from "../../../common/time";
6 12
 export default class Index extends Component {
7 13
   state = {
8 14
     current: 0,
9 15
     page: 1, //页数
10 16
     loading: false, //加载状态
11 17
     totalPages: 1, // 添加总页数
12
-    isNoMore: false, // 是否没有更多
18
+    tabList: [], //tab列表
13 19
     productList: [], //商品列表
14
-    tags: [
15
-      { title: "全部" },
16
-      { title: "限时秒杀" },
17
-      { title: "限时秒杀" },
18
-      { title: "限时秒杀" },
19
-      { title: "限时秒杀" },
20
-      { title: "限时秒杀" },
21
-      { title: "限时秒杀" },
22
-    ],
23
-    productList: [
24
-      {
25
-        id: 1,
26
-        name: "新款时尚连衣裙2024春新款时尚连衣裙2024春新款时尚连衣裙2024春",
27
-        price: "29.00",
28
-        commission: "29.9",
29
-        image: "https://yushi.tos-cn-beijing.volces.com/products/product1.png",
30
-      },
31
-      {
32
-        id: 2,
33
-        name: "轻奢真皮小方包",
34
-        price: "458.00",
35
-        commission: "45.8",
36
-        image: "https://yushi.tos-cn-beijing.volces.com/products/product2.png",
37
-      },
38
-      {
39
-        id: 3,
40
-        name: "高端蚕丝围巾披肩",
41
-        price: "199.00",
42
-        commission: "19.9",
43
-        image: "https://yushi.tos-cn-beijing.volces.com/products/product3.png",
44
-      },
45
-      {
46
-        id: 4,
47
-        name: "925纯银项链女",
48
-        price: "328.00",
49
-        commission: "32.8",
50
-        image: "https://yushi.tos-cn-beijing.volces.com/products/product4.png",
51
-      },
52
-      {
53
-        id: 5,
54
-        name: "小众设计感衬衫",
55
-        price: "268.00",
56
-        commission: "26.8",
57
-        image: "https://yushi.tos-cn-beijing.volces.com/products/product5.png",
58
-      },
59
-    ],
20
+    isShare: false, // 是否是分享跳转
21
+    isShowBack: false, // 是否显示返回按钮
22
+  };
23
+  componentDidMount() {
24
+    const { isShare, isShowBack,shareUserId } =
25
+      Taro.getCurrentInstance().router.params || "";
26
+    this.setState(
27
+      { isShare: isShare || false, isShowBack: isShowBack || false,shareUserId:shareUserId||'' },
28
+      () => {
29
+        if (isShare) {
30
+          Taro.hideHomeButton(); //隐藏返回首页
31
+        }
32
+        this.getTab(); //获取tab
33
+        this.handleLog(); //埋点
34
+      }
35
+    );
36
+  }
37
+  // 获取tab
38
+  getTab = async () => {
39
+    const res = await getNewYearTab();
40
+    const arr = [];
41
+    res.forEach((item) => {
42
+      arr.push({ title: item.title, id: item.id, name: item.name });
43
+    });
44
+    this.setState({ tabList: arr }, () => {
45
+      this.getProductList(true);
46
+    });
60 47
   };
61
-  componentDidMount() {}
62 48
   // 获取商品列表
63
-  getBrowseShopProductList = async (isRefresh = false) => {
49
+  getProductList = async (isRefresh = false) => {
64 50
     const { page } = this.state;
65 51
     this.setState({ loading: true });
66 52
 
67
-    const res = await getBrowseShopProductList({
68
-      tag_name: this.state.tabList[this.state.current].title,
53
+    const res = await getNewYearProductList({
54
+      tag_id: this.state.tabList[this.state.current].id,
69 55
       page,
70 56
       page_size: 10,
71 57
     });
@@ -78,44 +64,97 @@ export default class Index extends Component {
78 64
       loading: false,
79 65
     }));
80 66
   };
67
+  // 埋点
68
+  handleLog = () => {
69
+    const dayid = formatDate(new Date(), "YYYY-MM-DD");
70
+    let userId = "";
71
+    if (Taro.getStorageSync("loginInfo")) {
72
+      userId = Taro.getStorageSync("loginInfo").id;
73
+    }
74
+    // 构建ext对象,包含share_id
75
+    let ext = "";
76
+    if (this.state.shareUserId) {
77
+      ext = JSON.stringify({
78
+        share_users_id: this.state.shareUserId,
79
+      });
80
+    }
81
+    addLog({
82
+      users_id: userId || 0,
83
+      goods_id: 0,
84
+      event_type: this.state.isShare ? "share_to_activity" : "click_to_activity",
85
+      event_type_title: this.state.isShare ? "从分享链接进入春节活动页" : "直接点击进入春节活动页",
86
+      dayid,
87
+      ext,
88
+    });
89
+  };
81 90
   // 返回
82 91
   handleBack = () => {
83 92
     Taro.navigateBack();
84 93
   };
94
+  // 专场点击
95
+  siteClick = (title, index) => {
96
+    const item = this.state.tabList.find((item) => item.name === title);
97
+    const id = item ? item.id : "";
98
+    Taro.navigateTo({
99
+      url: `/pages/indexSub/seckillIndex/index?id=${id}&&title=${title}&&isShowBack=${this.state.isShowBack}&&isShare=${this.state.isShare}&&isDirect=true`,
100
+    });
101
+  };
85 102
   // 切换tab
86 103
   tabClick = (index) => {
87
-    this.setState({
88
-      current: index,
89
-      // page: 1,
90
-      // productList: [],
91
-      // isNoMore: false,
92
-      // isLoading: false,
104
+    this.setState(
105
+      {
106
+        current: index,
107
+        page: 1,
108
+        productList: [],
109
+        isLoading: false,
110
+      },
111
+      () => {
112
+        this.getProductList(true);
113
+      }
114
+    );
115
+  };
116
+  // 商品详情
117
+  handleProductDetail = (product) => {
118
+    Taro.navigateTo({
119
+      url: `/pages/indexSub/productDetail/index?id=${product.id}&&isShare=${this.state.isShare}&&isShowBack=${this.state.isShowBack}`,
93 120
     });
94
-    // this.getBrowseShopProductList(true);
95 121
   };
96 122
   // 滚动到底部
97 123
   handleScrollToLower = () => {
98
-    console.log("滚动到底部");
99
-    return;
100 124
     const { page, totalPages, loading } = this.state;
101 125
     if (page < totalPages && !loading) {
102 126
       this.setState(
103 127
         (prevState) => ({ page: prevState.page + 1 }),
104
-        () => this.getBrowseShopProductList()
128
+        () => this.getProductList()
105 129
       );
106 130
     }
107 131
   };
132
+  // 配置分享内容
133
+  onShareAppMessage() {
134
+    let shareUserId = "";
135
+    if (Taro.getStorageSync("loginInfo")) {
136
+      shareUserId = Taro.getStorageSync("loginInfo").id;
137
+    }
138
+    return {
139
+      title: "新春活动",
140
+      path: `/pages/indexSub/activity/index?isShare=true&&isShowBack=true&&shareUserId=${shareUserId}`,
141
+      imageUrl: "",
142
+    };
143
+  }
108 144
   render() {
109 145
     return (
110 146
       <View className="index">
111 147
         {/* 返回按钮 */}
112
-        <Image
113
-          onClick={this.handleBack}
114
-          style={{ top: Taro.navigationBarHeight + "px" }}
115
-          className="top-back"
116
-          src="https://yushi.tos-cn-beijing.volces.com/activity/back.png"
117
-          mode="widthFix"
118
-        />
148
+        {
149
+          !this.state.isShare && (
150
+            <Image
151
+              onClick={this.handleBack}
152
+              style={{ top: Taro.navigationBarHeight + "px" }}
153
+              className="top-back"
154
+              src="https://yushi.tos-cn-beijing.volces.com/activity/back.png"
155
+            mode="widthFix"
156
+          />
157
+        )}
119 158
         {/* 顶部图片包裹盒子 */}
120 159
         <View className="top-img-wrap">
121 160
           <Image
@@ -130,68 +169,100 @@ export default class Index extends Component {
130 169
           />
131 170
         </View>
132 171
         {/* 专场 */}
133
-        <View className="activity-wrap">
134
-          <View className="topBox">
135
-            <View className="item">
136
-              <View className="item-title">下午茶专场</View>
137
-              <Image
138
-                className="item-img"
139
-                src="https://yushi.tos-cn-beijing.volces.com/activity/topOne.png"
140
-                mode="widthFix"
141
-              />
142
-              <View className="item-text">点击进入</View>
172
+        {this.state.tabList.length > 0 && (
173
+          <View className="activity-wrap">
174
+            <View className="topBox">
175
+              <View
176
+                className="item"
177
+                onClick={() => {
178
+                  this.siteClick("下午茶专场", "0");
179
+                }}
180
+              >
181
+                <View className="item-title">下午茶专场</View>
182
+                <Image
183
+                  className="item-img"
184
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/topOne.png"
185
+                  mode="widthFix"
186
+                />
187
+                <View className="item-text">点击进入</View>
188
+              </View>
189
+              <View
190
+                className="item"
191
+                onClick={() => {
192
+                  this.siteClick("餐饮美食专场", "1");
193
+                }}
194
+              >
195
+                <View className="item-title">餐饮美食专场</View>
196
+                <Image
197
+                  className="item-img"
198
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/topTwo.png"
199
+                  mode="widthFix"
200
+                />
201
+                <View className="item-text">点击进入</View>
202
+              </View>
143 203
             </View>
144
-            <View className="item">
145
-              <View className="item-title">餐饮美食专场</View>
146
-              <Image
147
-                className="item-img"
148
-                src="https://yushi.tos-cn-beijing.volces.com/activity/topTwo.png"
149
-                mode="widthFix"
150
-              />
151
-              <View className="item-text">点击进入</View>
152
-            </View>
153
-          </View>
154
-          <View className="centerBox">
155
-            <View className="item">
156
-              <View className="item-title">酒店出行专场</View>
157
-              <Image
158
-                className="item-img"
159
-                src="https://yushi.tos-cn-beijing.volces.com/activity/centerOne.png"
160
-                mode="widthFix"
161
-              />
162
-              <View className="item-text">点击进入</View>
204
+            <View className="centerBox">
205
+              <View
206
+                className="item"
207
+                onClick={() => {
208
+                  this.siteClick("酒店出行专场", "2");
209
+                }}
210
+              >
211
+                <View className="item-title">酒店出行专场</View>
212
+                <Image
213
+                  className="item-img"
214
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/centerOne.png"
215
+                  mode="widthFix"
216
+                />
217
+                <View className="item-text">点击进入</View>
218
+              </View>
219
+              <View
220
+                className="item"
221
+                onClick={() => {
222
+                  this.siteClick("清洗服务专场", "3");
223
+                }}
224
+              >
225
+                <View className="item-title">清洗服务专场</View>
226
+                <Image
227
+                  className="item-img"
228
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/centerTwo.png"
229
+                  mode="widthFix"
230
+                />
231
+                <View className="item-text">点击进入</View>
232
+              </View>
233
+              <View
234
+                className="item"
235
+                onClick={() => {
236
+                  this.siteClick("游玩娱乐专场", "4");
237
+                }}
238
+              >
239
+                <View className="item-title">游玩娱乐专场</View>
240
+                <Image
241
+                  className="item-img"
242
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/centerThree.png"
243
+                  mode="widthFix"
244
+                />
245
+                <View className="item-text">点击进入</View>
246
+              </View>
163 247
             </View>
164
-            <View className="item">
165
-              <View className="item-title">清洗服务专场</View>
166
-              <Image
167
-                className="item-img"
168
-                src="https://yushi.tos-cn-beijing.volces.com/activity/centerTwo.png"
169
-                mode="widthFix"
170
-              />
171
-              <View className="item-text">点击进入</View>
172
-            </View>
173
-            <View className="item">
174
-              <View className="item-title">游玩娱乐专场</View>
175
-              <Image
176
-                className="item-img"
177
-                src="https://yushi.tos-cn-beijing.volces.com/activity/centerThree.png"
178
-                mode="widthFix"
179
-              />
180
-              <View className="item-text">点击进入</View>
181
-            </View>
182
-          </View>
183
-          <View className="bottomBox">
184
-            <View className="item">
185
-              <View className="item-title">咖啡专场</View>
186
-              <Image
187
-                className="item-img"
188
-                src="https://yushi.tos-cn-beijing.volces.com/activity/bottom.png"
189
-                mode="widthFix"
190
-              />
191
-              <View className="item-text">点击进入</View>
248
+            <View className="bottomBox">
249
+              <View
250
+                className="item"
251
+                onClick={() => {
252
+                  this.siteClick("咖啡专场", "5");
253
+                }}
254
+              >
255
+                <View className="item-title">咖啡专场</View>
256
+                <Image
257
+                  className="item-img"
258
+                  src="https://yushi.tos-cn-beijing.volces.com/activity/bottom.png"
259
+                  mode="widthFix"
260
+                />
261
+                <View className="item-text">点击进入</View>
262
+              </View>
192 263
             </View>
193 264
           </View>
194
-        </View>
265
+        )}
195 266
         <Image
196 267
           className="bottom-title-img"
197 268
           src="https://yushi.tos-cn-beijing.volces.com/activity/titleImgOne.png"
@@ -204,7 +275,7 @@ export default class Index extends Component {
204 275
             <AtTabs
205 276
               current={this.state.current}
206 277
               scroll
207
-              tabList={this.state.tags}
278
+              tabList={this.state.tabList}
208 279
               onClick={this.tabClick}
209 280
             />
210 281
           </View>
@@ -215,24 +286,24 @@ export default class Index extends Component {
215 286
           >
216 287
             <View className="product-list-container">
217 288
               {this.state.productList.map((product) => (
218
-                <View key={product.id} className="product-list-item">
289
+                <View onClick={() => this.handleProductDetail(product)} key={product.id} className="product-list-item">
219 290
                   <Image
220 291
                     className="product-img"
221
-                    src={product.image}
292
+                    src={product.image_url}
222 293
                     mode="aspectFill"
223 294
                   />
224 295
                   <View className="product-content">
225
-                    <Text className="product-title">{product.name}</Text>
296
+                    <Text className="product-title">{product.item_title}</Text>
226 297
                     <View className="product-price">
227 298
                       <View className="product-price-left">
228 299
                         <Text className="product-price-text">到手价</Text>
229 300
                         <Text className="product-price-text-price">
230
-                          ¥{product.price}
301
+                          ¥{product.reserve_price}
231 302
                         </Text>
232 303
                       </View>
233 304
                       <View className="product-commission">
234 305
                         <Text className="product-commission-text">
235
-                          赚¥{product.commission}
306
+                          赚¥{product.estimated_commission_promotion}
236 307
                         </Text>
237 308
                       </View>
238 309
                     </View>

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

@@ -215,7 +215,6 @@
215 215
                         width: 100%;
216 216
                         height: 262px;
217 217
                         border-radius: 38px;
218
-                        background-color: red;
219 218
                     }
220 219
 
221 220
                     .product-content {

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

@@ -35,11 +35,11 @@ export default class Index extends Component {
35 35
       {
36 36
         isDirect: isDirect || false,
37 37
         isBanner: isBanner || false,
38
-        isShare: isShare || false,
38
+        isShare: isShare === "true" || false,
39 39
         shareUserId: shareUserId || "",
40 40
         title: title || "",
41 41
         id: id || "",
42
-        isShowBack: isShowBack || false,
42
+        isShowBack: isShowBack === "true" || false,
43 43
       },
44 44
       () => {
45 45
         // 设置页面标题

+ 3 - 3
src/pages/member/index.jsx

@@ -17,7 +17,7 @@ import InstructionModal from "../../components/instructionModal";
17 17
 export default class Index extends Component {
18 18
   state = {
19 19
     vipInfo: {
20
-      users: { name: "去登录", icon: 'https://yushi.tos-cn-beijing.volces.com/mine/avatar.png' },
20
+      users: { name: "去登录", icon: 'https://yushi.tos-cn-beijing.volces.com/mine/avatar.png',user_identity_translate:0 },//user_identity_translate 0:默认未认证,1:已认证成功,2:认证失败,3:认证中
21 21
       earnings: { store_earnings_now: 0, store_earnings_all: 0 },
22 22
       draw_money: { store_earnings_now: 0 },
23 23
       partner: { partner_direct_cnt: 0 },
@@ -205,10 +205,10 @@ export default class Index extends Component {
205 205
                 <Text className="amount">
206 206
                   {`¥ ${vipInfo.draw_money.store_earnings_now}`}
207 207
                 </Text>
208
-                {!this.state.isAlipay && (
208
+                {(!this.state.isAlipay || vipInfo.users.user_identity_translate != 1) && (
209 209
                   <View className="warning-icon-box">
210 210
                     <Image className="warning-icon" src={warning} />
211
-                    <Text className="warning-text">未完成提现认证</Text>
211
+                    <Text className="warning-text">{vipInfo.users.user_identity_translate == 2 ? '认证失败' : vipInfo.users.user_identity_translate == 0 ? '未完成提现认证' : '认证中'}</Text>
212 212
                   </View>
213 213
                 )}
214 214
               </View>

+ 15 - 7
src/pages/memberSub/Alipay/index.jsx

@@ -21,8 +21,11 @@ export default class Index extends Component {
21 21
     isLoading: false, // 是否加载中
22 22
     isAlipay: false, // 是否已绑定支付宝
23 23
     isBank: false, // 是否已绑定银行卡
24
+    status_text: '', // 状态文案
25
+    status: 0, // 状态 0:默认未认证,1:已认证成功,2:认证失败,3:认证中
24 26
     signImg: "https://yushi.tos-cn-beijing.volces.com/mine/shenhezhong.png", // 审核中签约
25
-    // signImg: "https://video-img.fyshark.com/1735033624483%E5%B7%B2%E7%AD%BE%E7%BA%A6.png", // 签约码
27
+    singnImgFail:'https://yushi.tos-cn-beijing.volces.com/mine/shenheshibai.png',// 审核失败签约
28
+    signImgSuccess: "https://video-img.fyshark.com/1735033624483%E5%B7%B2%E7%AD%BE%E7%BA%A6.png", // 审核成功签约
26 29
   };
27 30
 
28 31
   componentDidMount () {
@@ -42,7 +45,9 @@ export default class Index extends Component {
42 45
             idCardFront: item.portrait_page,
43 46
             idCardBack: item.national_emblem_page,
44 47
             account: item.bank_no,
45
-            isAlipay: true
48
+            isAlipay: true,
49
+            status_text: item.status_text,
50
+            status: item.status
46 51
           });
47 52
         } else {
48 53
           this.setState({
@@ -52,7 +57,9 @@ export default class Index extends Component {
52 57
             idCardFront: item.portrait_page,
53 58
             idCardBack: item.national_emblem_page,
54 59
             bankCard: item.bank_no,
55
-            isBank: true
60
+            isBank: true,
61
+            status_text: item.status_text,
62
+            status: item.status
56 63
           });
57 64
         }
58 65
       });
@@ -228,7 +235,7 @@ export default class Index extends Component {
228 235
   }
229 236
   // 是否已绑定
230 237
   isBind () {
231
-    return (this.state.isAlipay && this.state.type === 'alipay') || (this.state.isBank && this.state.type === 'bank')
238
+    return (this.state.isAlipay && this.state.type === 'alipay') || (this.state.isBank && this.state.type === 'bank'&&this.state.status != 2)
232 239
   }
233 240
   render () {
234 241
     return (
@@ -313,12 +320,13 @@ export default class Index extends Component {
313 320
           }
314 321
         </View>
315 322
         {
316
-          this.isBind() &&
323
+          (this.isBind() || this.state.status == 2) &&
317 324
           <View className="alipay-info-tips">
318 325
             <View className="alipay-info-tips-item">
319
-              <Image src={this.state.signImg} className="alipay-info-tips-item-icon" />
326
+              <Image src={this.state.status == '1' ? this.state.signImgSuccess : this.state.status == '2' ? this.state.singnImgFail : this.state.signImg} className="alipay-info-tips-item-icon" />
320 327
               <View className="alipay-info-tips-item-text">
321
-                如需更改,请联系客服
328
+                {/* 如需更改,请联系客服 */}
329
+                {this.state.status_text}
322 330
               </View>
323 331
             </View>
324 332
           </View>

+ 14 - 0
src/service/activity.js

@@ -36,5 +36,19 @@ export const getCalculatorPartData = data =>
36 36
     data,
37 37
   });
38 38
 //----------------------------------------------活动
39
+// 获取新春专题tab
40
+export const getNewYearTab = data =>
41
+  Request({
42
+    url: '/activity/get_category_tab_data_spring_festival',
43
+    method: 'POST',
44
+    data,
45
+  });
46
+  // 新春商品列表
47
+  export const getNewYearProductList = data =>
48
+  Request({
49
+    url: '/api/get_goods_data_list_recommend_is_index',
50
+    method: 'POST',
51
+    data,
52
+  });
39 53
 
40 54