Browse Source

捡漏计算器对接接口

viczhq 1 month ago
parent
commit
736ba6fbfe

+ 14 - 7
project.private.config.json

@@ -10,6 +10,20 @@
10
     "miniprogram": {
10
     "miniprogram": {
11
       "list": [
11
       "list": [
12
         {
12
         {
13
+          "name": "pages/calculatorSub/calculatorResult/index",
14
+          "pathName": "pages/calculatorSub/calculatorResult/index",
15
+          "query": "",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
20
+          "name": "pages/calculatorSub/calculatorWishList/index",
21
+          "pathName": "pages/calculatorSub/calculatorWishList/index",
22
+          "query": "id=2815",
23
+          "launchMode": "default",
24
+          "scene": null
25
+        },
26
+        {
13
           "name": "pages/member/index",
27
           "name": "pages/member/index",
14
           "pathName": "pages/member/index",
28
           "pathName": "pages/member/index",
15
           "query": "",
29
           "query": "",
@@ -45,13 +59,6 @@
45
           "scene": null
59
           "scene": null
46
         },
60
         },
47
         {
61
         {
48
-          "name": "pages/calculatorSub/calculatorWishList/index",
49
-          "pathName": "pages/calculatorSub/calculatorWishList/index",
50
-          "query": "",
51
-          "launchMode": "default",
52
-          "scene": null
53
-        },
54
-        {
55
           "name": "pages/calculatorSub/calculator/index",
62
           "name": "pages/calculatorSub/calculator/index",
56
           "pathName": "pages/calculatorSub/calculator/index",
63
           "pathName": "pages/calculatorSub/calculator/index",
57
           "query": "",
64
           "query": "",

+ 26 - 11
src/pages/calculatorSub/calculator/index.jsx

@@ -1,17 +1,22 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
 import { View, Image, Text, Button } from "@tarojs/components";
2
 import { View, Image, Text, Button } from "@tarojs/components";
3
+import { getCalculatorPartData } from "../../../service/activity";
3
 import "./index.less";
4
 import "./index.less";
4
 import Taro from "@tarojs/taro";
5
 import Taro from "@tarojs/taro";
5
 import more from "../../../images/calculator/more.png";
6
 import more from "../../../images/calculator/more.png";
6
 import toShare from "../../../images/calculator/toShare.png";
7
 import toShare from "../../../images/calculator/toShare.png";
7
 import wish from "../../../images/calculator/wish.png";
8
 import wish from "../../../images/calculator/wish.png";
8
 export default class Index extends Component {
9
 export default class Index extends Component {
9
-  state = {};
10
-  componentDidMount() {}
10
+  state = {
11
+    calculatorPartData: {},// 捡漏计算器部分数据
12
+  };
13
+  componentDidMount() {
14
+    this.getCalculatorPartData();// 获取捡漏计算器部分数据
15
+  }
11
   // 去TA的捡漏心愿
16
   // 去TA的捡漏心愿
12
-  toWishList = () => {
17
+  toWishList = (id) => {
13
     Taro.navigateTo({
18
     Taro.navigateTo({
14
-      url: `/pages/calculatorSub/calculatorWishList/index`,
19
+      url: `/pages/calculatorSub/calculatorWishList/index?id=${id}`,
15
     });
20
     });
16
   };
21
   };
17
   // 去捡漏清单
22
   // 去捡漏清单
@@ -20,6 +25,13 @@ export default class Index extends Component {
20
       url: `/pages/calculatorSub/calculatorInventory/index`,
25
       url: `/pages/calculatorSub/calculatorInventory/index`,
21
     });
26
     });
22
   };
27
   };
28
+  // 获取捡漏计算器部分数据
29
+  async getCalculatorPartData() {
30
+    const res = await getCalculatorPartData();
31
+    this.setState({
32
+      calculatorPartData: res.jianlou_list,
33
+    });
34
+  };
23
   // 配置分享内容
35
   // 配置分享内容
24
   onShareAppMessage(res) {
36
   onShareAppMessage(res) {
25
     return {
37
     return {
@@ -29,6 +41,7 @@ export default class Index extends Component {
29
     }
41
     }
30
   }
42
   }
31
   render() {
43
   render() {
44
+    const { calculatorPartData } = this.state;
32
     return (
45
     return (
33
       <View className="index">
46
       <View className="index">
34
         {/* 顶部 */}
47
         {/* 顶部 */}
@@ -54,18 +67,20 @@ export default class Index extends Component {
54
             </View>
67
             </View>
55
             {/* 列表 */}
68
             {/* 列表 */}
56
             <View className="list-box">
69
             <View className="list-box">
57
-              <View className="list-item">
58
-                <View className="list-item-left">
59
-                  <Image className="avatar" src={wish} />
70
+              {calculatorPartData.length > 0 && calculatorPartData.map((item, index) => (
71
+                <View key={index} className="list-item">
72
+                  <View className="list-item-left">
73
+                    <Image className="avatar" src={item.icon} />
60
                   <View className="list-item-left-text">
74
                   <View className="list-item-left-text">
61
-                    <Text className="name">按时打卡上课的急啊离开就</Text>
62
-                    <Text className="wishNum">15次捡漏许愿</Text>
75
+                    <Text className="name">{item.name}</Text>
76
+                    <Text className="wishNum">{item.activity_jianlou_cnt}次捡漏许愿</Text>
63
                   </View>
77
                   </View>
64
                 </View>
78
                 </View>
65
-                <View onClick={this.toWishList} className="list-item-right">
79
+                <View onClick={() => this.toWishList(item.id)} className="list-item-right">
66
                   查看
80
                   查看
67
                 </View>
81
                 </View>
68
-              </View>
82
+                </View>
83
+              ))}
69
             </View>
84
             </View>
70
           </View>
85
           </View>
71
           {/* 查看全部 */}
86
           {/* 查看全部 */}

+ 61 - 15
src/pages/calculatorSub/calculatorInventory/index.jsx

@@ -1,28 +1,74 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
 import { View, Image, Text } from "@tarojs/components";
2
 import { View, Image, Text } from "@tarojs/components";
3
 import "./index.less";
3
 import "./index.less";
4
-import wish from "../../../images/calculator/wish.png";
5
-
4
+import Taro from "@tarojs/taro";
5
+import { getCalculatorList } from "../../../service/activity";
6
 export default class Index extends Component {
6
 export default class Index extends Component {
7
-  state = {};
8
-  componentDidMount() {}
7
+  state = {
8
+    inventoryList: [],
9
+    page: 1, // 添加页码
10
+    totalPages: 1, // 添加总页数
11
+    loading: false, // 添加加载状态
12
+  };
13
+  componentDidMount() {
14
+    this.getCalculatorList(true); // 获取捡漏清单
15
+  }
16
+  // 获取捡漏清单
17
+  getCalculatorList = async (isRefresh) => {
18
+    this.setState({ loading: true });
19
+    const res = await getCalculatorList({
20
+      page: this.state.page,
21
+      page_size: 10,
22
+    });
23
+    this.setState({
24
+      inventoryList: isRefresh
25
+        ? res.jianlou_list
26
+        : [...this.state.inventoryList, ...res.jianlou_list],
27
+      totalPages: res.total_pages,
28
+      loading: false,
29
+    });
30
+  }
31
+  // 查看心愿列表
32
+  toWishList = (id) => {
33
+    Taro.navigateTo({
34
+      url: `/pages/calculatorSub/calculatorWishList/index?id=${id}`,
35
+    });
36
+  };
37
+  // 页面上拉触底
38
+  onReachBottom = () => {
39
+    const { page, totalPages, loading } = this.state;
40
+    if (page < totalPages && !loading) {
41
+      this.setState(
42
+        (prevState) => ({ page: prevState.page + 1 }),
43
+        () => this.getCalculatorList(false)
44
+      );
45
+    }
46
+  };
9
   render() {
47
   render() {
10
     return (
48
     return (
11
       <View className="index">
49
       <View className="index">
12
         {/* 列表 */}
50
         {/* 列表 */}
13
         <View className="list-box">
51
         <View className="list-box">
14
-          <View className="list-item">
15
-            <View className="list-item-left">
16
-              <Image className="avatar" src={wish} />
17
-              <View className="list-item-left-text">
18
-                <Text className="name">按时打卡上课的急啊离开就</Text>
19
-                <Text className="wishNum">15次捡漏许愿</Text>
52
+          {this.state.inventoryList.length > 0 &&
53
+            this.state.inventoryList.map((item, index) => (
54
+              <View key={index} className="list-item">
55
+                <View className="list-item-left">
56
+                  <Image className="avatar" src={item.icon} />
57
+                  <View className="list-item-left-text">
58
+                    <Text className="name">{item.name}</Text>
59
+                    <Text className="wishNum">
60
+                      {item.activity_jianlou_cnt}次捡漏许愿
61
+                    </Text>
62
+                  </View>
63
+                </View>
64
+                <View
65
+                  onClick={() => this.toWishList(item.id)}
66
+                  className="list-item-right"
67
+                >
68
+                  查看
69
+                </View>
20
               </View>
70
               </View>
21
-            </View>
22
-            <View onClick={this.toWishList} className="list-item-right">
23
-              查看
24
-            </View>
25
-          </View>
71
+            ))}
26
         </View>
72
         </View>
27
       </View>
73
       </View>
28
     );
74
     );

+ 83 - 37
src/pages/calculatorSub/calculatorResult/index.jsx

@@ -1,73 +1,119 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
 import { View, Image, Text } from "@tarojs/components";
2
 import { View, Image, Text } from "@tarojs/components";
3
 import "./index.less";
3
 import "./index.less";
4
+import Taro from "@tarojs/taro";
4
 export default class Index extends Component {
5
 export default class Index extends Component {
5
   state = {
6
   state = {
7
+    isSearch: 1,// 是否计算成功
8
+    list: [],// 列表
6
   };
9
   };
7
   componentDidMount() {
10
   componentDidMount() {
11
+    let { isSearch, list } = Taro.getCurrentInstance().router.params;
12
+    this.setState({
13
+      isSearch,
14
+      list: JSON.parse(decodeURIComponent(list)),
15
+    });
16
+  }
17
+  // 再次捡漏
18
+  handleAgain = () => {
19
+    Taro.navigateBack();
20
+  }
21
+  // 精选推荐
22
+  handleGoodRecommend = (id) => {
23
+    Taro.navigateTo({
24
+      url: `/pages/indexSub/productDetail/index?id=${id}&&isShare=true`,
25
+    });
8
   }
26
   }
9
   render() {
27
   render() {
28
+    const { isSearch, list } = this.state;
10
     return (
29
     return (
11
       <View className="index">
30
       <View className="index">
12
         {/* 顶部盒子 */}
31
         {/* 顶部盒子 */}
13
         <View className="top-box">
32
         <View className="top-box">
14
-          <Image className="top-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/resultImg.png' />
15
-          {/* <Image className="top-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/failResult.png' /> */}
33
+          <Image
34
+            className="top-img"
35
+            src={isSearch == 1 ? "https://yushi.tos-cn-beijing.volces.com/calculator/resultImg.png" : "https://yushi.tos-cn-beijing.volces.com/calculator/failResult.png"}
36
+          />
16
           {/* 捡漏产品 */}
37
           {/* 捡漏产品 */}
17
           <View className="calculator-info">
38
           <View className="calculator-info">
18
-              <View className="title-box">
19
-                <Text className="title-text-left">您想要的:</Text>
20
-                <Text className="title-text">购买北京到深圳的机票</Text>
21
-              </View>
22
-              <View className="title-box">
23
-                <Text className="title-text-left">期望花费:</Text>
24
-                <Text className="title-text">1000元</Text>
25
-              </View>
39
+            <View className="title-box">
40
+              <Text className="title-text-left">您想要的:</Text>
41
+              <Text className="title-text">购买北京到深圳的机票</Text>
42
+            </View>
43
+            <View className="title-box">
44
+              <Text className="title-text-left">期望花费:</Text>
45
+              <Text className="title-text">1000元</Text>
46
+            </View>
26
           </View>
47
           </View>
27
           {/* 首选推荐产品 */}
48
           {/* 首选推荐产品 */}
28
           <View className="first-recommend">
49
           <View className="first-recommend">
29
             <View className="first-recommend-title">
50
             <View className="first-recommend-title">
30
-              <Image className="first-recommend-title-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/recommend.png' />
51
+              <Image
52
+                className="first-recommend-title-img"
53
+                src="https://yushi.tos-cn-beijing.volces.com/calculator/recommend.png"
54
+              />
31
               <Text className="first-recommend-title-text">首选推荐</Text>
55
               <Text className="first-recommend-title-text">首选推荐</Text>
32
             </View>
56
             </View>
33
             <View className="first-recommend-content">
57
             <View className="first-recommend-content">
34
-              <View className="product-info">
35
-                <Image className="product-avatar" src='https://yushi.tos-cn-beijing.volces.com/calculator/default-avatar.png' />
36
-                <View className="product-detail">
37
-                  <Text className="product-title">深圳往返北京机票</Text>
38
-                  <View className="price-box">
39
-                    <Text className="current-price">899</Text>
40
-                    <Text className="original-price">¥1299</Text>
58
+              {list.length > 0 && (
59
+                <View className="product-info">
60
+                  <Image
61
+                    className="product-avatar"
62
+                    mode="aspectFill"
63
+                    src={list[0].image_url}
64
+                  />
65
+                  <View className="product-detail">
66
+                    <Text className="product-title">{list[0].item_title}</Text>
67
+                    <View className="price-box">
68
+                      <Text className="current-price">{list[0].reserve_price}</Text>
69
+                      {list[0].original_price != 0 && (
70
+                        <Text className="original-price">¥{list[0].original_price}</Text>
71
+                      )}
72
+                    </View>
41
                   </View>
73
                   </View>
42
                 </View>
74
                 </View>
43
-              </View>
75
+              )}
44
             </View>
76
             </View>
45
             {/* 再次捡漏 */}
77
             {/* 再次捡漏 */}
46
-            <View className="first-recommend-button">
47
-              <Image className="first-recommend-button-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/resultButton.png' />
78
+            <View onClick={this.handleAgain} className="first-recommend-button">
79
+              <Image
80
+                className="first-recommend-button-img"
81
+                src="https://yushi.tos-cn-beijing.volces.com/calculator/resultButton.png"
82
+              />
48
               <Text className="first-recommend-button-text">再次捡漏</Text>
83
               <Text className="first-recommend-button-text">再次捡漏</Text>
49
             </View>
84
             </View>
50
           </View>
85
           </View>
51
         </View>
86
         </View>
52
-          {/* 精选推荐列表 */}
53
-          <View className="good-recommend-content">
54
-            <View className="good-recommend-list-title">
55
-              <Image className="good-recommend-list-title-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/recommendIcon.png' />
56
-              <Text className="good-recommend-list-title-text">精选推荐</Text>
57
-            </View>
58
-            {/* 精选推荐列表内容 */}
59
-              <View className="good-recommend-list">
60
-                <View className="good-recommend-list-item">
61
-                  <Image className="item-image" src='https://yushi.tos-cn-beijing.volces.com/calculator/default-avatar.png' />
62
-                  <Text className="item-title">深圳往返北京机票</Text>
63
-                  <View className="item-price">
64
-                    <Text className="price-symbol">¥</Text>
65
-                    <Text className="current-price">899</Text>
66
-                    <Text className="original-price">¥1299</Text>
67
-                  </View>
87
+        {/* 精选推荐列表 */}
88
+        <View className="good-recommend-content">
89
+          <View className="good-recommend-list-title">
90
+            <Image
91
+              className="good-recommend-list-title-img"
92
+              src="https://yushi.tos-cn-beijing.volces.com/calculator/recommendIcon.png"
93
+            />
94
+            <Text className="good-recommend-list-title-text">精选推荐</Text>
95
+          </View>
96
+          {/* 精选推荐列表内容 */}
97
+          <View className="good-recommend-list">
98
+            {list.length > 1 && list.slice(1, 7).map((item, index) => (
99
+              <View onClick={() => this.handleGoodRecommend(item.id)} key={index} className="good-recommend-list-item">
100
+                <Image
101
+                  mode="aspectFill"
102
+                  className="item-image"
103
+                  src={item.image_url}
104
+                />
105
+                <Text className="item-title">{item.item_title}</Text>
106
+                <View className="item-price">
107
+                  <Text className="price-symbol">¥</Text>
108
+                  <Text className="current-price">{item.reserve_price}</Text>
109
+                  {item.original_price != 0 && (
110
+                    <Text className="original-price">¥{item.original_price}</Text>
111
+                  )}
68
                 </View>
112
                 </View>
69
               </View>
113
               </View>
114
+            ))}
70
           </View>
115
           </View>
116
+        </View>
71
       </View>
117
       </View>
72
     );
118
     );
73
   }
119
   }

+ 6 - 2
src/pages/calculatorSub/calculatorResult/index.less

@@ -110,7 +110,6 @@
110
                     height: 146px;
110
                     height: 146px;
111
                     border-radius: 20px;
111
                     border-radius: 20px;
112
                     margin-right: 12px;
112
                     margin-right: 12px;
113
-                    background-color: red;
114
                 }
113
                 }
115
 
114
 
116
                 .product-detail {
115
                 .product-detail {
@@ -230,13 +229,18 @@
230
                     width: 220px;
229
                     width: 220px;
231
                     height: 213px;
230
                     height: 213px;
232
                     border-radius: 20px 20px 0 0;
231
                     border-radius: 20px 20px 0 0;
233
-                    background-color: red;
234
                 }
232
                 }
235
 
233
 
236
                 .item-title {
234
                 .item-title {
237
                     font-size: 18px;
235
                     font-size: 18px;
238
                     color: #000000;
236
                     color: #000000;
239
                     line-height: 33px;
237
                     line-height: 33px;
238
+                    height: 60px;
239
+                    display: -webkit-box;
240
+                    -webkit-box-orient: vertical;
241
+                    -webkit-line-clamp: 2;
242
+                    overflow: hidden;
243
+                    text-overflow: ellipsis;
240
                 }
244
                 }
241
 
245
 
242
                 .item-price {
246
                 .item-price {

+ 100 - 30
src/pages/calculatorSub/calculatorWish/index.jsx

@@ -1,19 +1,92 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
 import { View, Image, Text, Input } from "@tarojs/components";
2
 import { View, Image, Text, Input } from "@tarojs/components";
3
+import Taro from "@tarojs/taro";
3
 import "./index.less";
4
 import "./index.less";
4
 import iconOne from "../../../images/calculator/iconOne.png";
5
 import iconOne from "../../../images/calculator/iconOne.png";
5
 import iconTwo from "../../../images/calculator/iconTwo.png";
6
 import iconTwo from "../../../images/calculator/iconTwo.png";
6
 import iconThree from "../../../images/calculator/iconThree.png";
7
 import iconThree from "../../../images/calculator/iconThree.png";
8
+import {
9
+  getCalculatorData,
10
+  getCalculatorSearch,
11
+} from "../../../service/activity";
7
 export default class Index extends Component {
12
 export default class Index extends Component {
8
-  state = {};
9
-  componentDidMount() {}
13
+  state = {
14
+    wishList: [],
15
+    wish: "", // 心愿
16
+    price: "", // 价格
17
+  };
18
+  componentDidMount() {
19
+    this.getCalculator(); // 计算捡漏
20
+  }
21
+  // 计算捡漏
22
+  getCalculator = async () => {
23
+    const res = await getCalculatorData();
24
+    this.setState({
25
+      wishList: res,
26
+    });
27
+  };
28
+  // 搜索捡漏
29
+  getCalculatorSearch = async () => {
30
+    if (!this.state.wish.trim()) {
31
+      Taro.showToast({
32
+        title: "请输入您想要捡漏的物品或服务",
33
+        icon: "none",
34
+      });
35
+      return;
36
+    }
37
+    if (!this.state.price.trim()) {
38
+      Taro.showToast({
39
+        title: "请输入您预期的价格",
40
+        icon: "none",
41
+      });
42
+      return;
43
+    }
44
+    Taro.showLoading({
45
+      title: "正在计算...",
46
+    });
47
+    try {
48
+      const res = await getCalculatorSearch({
49
+        keyword: this.state.wish,
50
+        money: this.state.price,
51
+      });
52
+      Taro.navigateTo({
53
+        url: `/pages/calculatorSub/calculatorResult/index?isSearch=${
54
+          res.is_search
55
+        }&&list=${encodeURIComponent(JSON.stringify(res.goods_list))}`,
56
+      });
57
+    } finally {
58
+      Taro.hideLoading();
59
+    }
60
+  };
61
+  // 心愿输入框改变
62
+  handleWishChange = (e) => {
63
+    this.setState({
64
+      wish: e.detail.value,
65
+    });
66
+  };
67
+  // 价格输入框改变
68
+  handlePriceChange = (e) => {
69
+    if (e.detail.value < 1 && e.detail.value.trim() !== "") {
70
+      e.detail.value = 1;
71
+    }
72
+    this.setState({
73
+      price: e.detail.value,
74
+    });
75
+  };
10
   render() {
76
   render() {
11
     return (
77
     return (
12
       <View className="index">
78
       <View className="index">
13
-        <Image className="top-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/wishTopImg.png' />
79
+        <Image
80
+          className="top-img"
81
+          src="https://yushi.tos-cn-beijing.volces.com/calculator/wishTopImg.png"
82
+        />
14
         {/* 底部 */}
83
         {/* 底部 */}
15
         <View className="bottom-box">
84
         <View className="bottom-box">
16
-          <Image mode="heightFix" className="bg-img" src='https://yushi.tos-cn-beijing.volces.com/calculator/bottomImg.png' />
85
+          <Image
86
+            mode="heightFix"
87
+            className="bg-img"
88
+            src="https://yushi.tos-cn-beijing.volces.com/calculator/bottomImg.png"
89
+          />
17
           {/* 输入内容区域 */}
90
           {/* 输入内容区域 */}
18
           <View className="input-box">
91
           <View className="input-box">
19
             <View className="input-box-title">
92
             <View className="input-box-title">
@@ -23,8 +96,10 @@ export default class Index extends Component {
23
             <View className="input-box-content">
96
             <View className="input-box-content">
24
               <View className="input-box-content-box">
97
               <View className="input-box-content-box">
25
                 <Input
98
                 <Input
99
+                  value={this.state.wish}
100
+                  onInput={this.handleWishChange}
26
                   className="input-box-content-input"
101
                   className="input-box-content-input"
27
-                  placeholder="请输入你的心愿"
102
+                  placeholder="请详细描述需求"
28
                 />
103
                 />
29
               </View>
104
               </View>
30
               <View className="input-box-content-text">
105
               <View className="input-box-content-text">
@@ -38,10 +113,14 @@ export default class Index extends Component {
38
               <Text className="title-text">您预期的价格</Text>
113
               <Text className="title-text">您预期的价格</Text>
39
             </View>
114
             </View>
40
             <View className="input-box-content">
115
             <View className="input-box-content">
41
-            <View className="input-box-content-box">
116
+              <View className="input-box-content-box">
42
                 <Input
117
                 <Input
118
+                  value={this.state.price}
119
+                  onInput={this.handlePriceChange}
120
+                  type="number"
121
+                  min="1"
43
                   className="input-box-content-input"
122
                   className="input-box-content-input"
44
-                  placeholder="请输入你的心愿"
123
+                  placeholder="价格最低不能少于1元"
45
                 />
124
                 />
46
               </View>
125
               </View>
47
               <View className="input-box-content-text">
126
               <View className="input-box-content-text">
@@ -49,37 +128,28 @@ export default class Index extends Component {
49
               </View>
128
               </View>
50
             </View>
129
             </View>
51
           </View>
130
           </View>
52
-          <View className="button-box">
53
-            <Image className="button-icon" src='https://yushi.tos-cn-beijing.volces.com/calculator/buttonTwo.png' />
131
+          <View onClick={this.getCalculatorSearch} className="button-box">
132
+            <Image
133
+              className="button-icon"
134
+              src="https://yushi.tos-cn-beijing.volces.com/calculator/buttonTwo.png"
135
+            />
54
             <View className="button-text-box">
136
             <View className="button-text-box">
55
-                <Text className="button-text">捡漏计算</Text>
137
+              <Text className="button-text">捡漏计算</Text>
56
             </View>
138
             </View>
57
           </View>
139
           </View>
58
           {/* 底部捡漏列表 */}
140
           {/* 底部捡漏列表 */}
59
-          <View className="bottom-list-box">  
141
+          <View className="bottom-list-box">
60
             <View className="bottom-list-box-title">
142
             <View className="bottom-list-box-title">
61
               <Image className="title-icon" src={iconThree} />
143
               <Image className="title-icon" src={iconThree} />
62
               <Text className="title-text">TA们捡了哪些漏</Text>
144
               <Text className="title-text">TA们捡了哪些漏</Text>
63
             </View>
145
             </View>
64
-            <View className="bottom-list-box-content">  
65
-              <View className="bottom-list-box-content-item"> 
66
-              TA想要“从北京到深圳的机票”,捡漏200元
67
-              </View>
68
-              <View className="bottom-list-box-content-item"> 
69
-              TA想要“从北京到深圳的机票”,捡漏200元
70
-              </View>
71
-              <View className="bottom-list-box-content-item"> 
72
-              TA想要“从北京到深圳的机票”,捡漏200元
73
-              </View>
74
-              <View className="bottom-list-box-content-item"> 
75
-              TA想要“从北京到深圳的机票”,捡漏200元
76
-              </View>
77
-              <View className="bottom-list-box-content-item"> 
78
-              TA想要“从北京到深圳的机票”,捡漏200元
79
-              </View>
80
-              <View className="bottom-list-box-content-item"> 
81
-              TA想要“从北京到深圳的机票”,捡漏200元
82
-              </View>
146
+            <View className="bottom-list-box-content">
147
+              {this.state.wishList.length > 0 &&
148
+                this.state.wishList.map((item, index) => (
149
+                  <View key={index} className="bottom-list-box-content-item">
150
+                    TA想要“{item.jianlou_title}”,捡漏{item.reserve_price}元
151
+                  </View>
152
+                ))}
83
             </View>
153
             </View>
84
           </View>
154
           </View>
85
         </View>
155
         </View>

+ 1 - 1
src/pages/calculatorSub/calculatorWish/index.less

@@ -20,7 +20,7 @@
20
         align-items: center;
20
         align-items: center;
21
 
21
 
22
         .bg-img {
22
         .bg-img {
23
-            width: 100%;
23
+            width: 100% !important;
24
             height: 100%;
24
             height: 100%;
25
             position: absolute;
25
             position: absolute;
26
             top: 0;
26
             top: 0;

+ 29 - 38
src/pages/calculatorSub/calculatorWishList/index.jsx

@@ -1,54 +1,45 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
-import { View} from "@tarojs/components";
2
+import Taro from "@tarojs/taro";
3
+import { View } from "@tarojs/components";
3
 import "./index.less";
4
 import "./index.less";
5
+import { getCalculatorDetail } from "../../../service/activity";
4
 export default class Index extends Component {
6
 export default class Index extends Component {
5
   state = {
7
   state = {
6
-    wishList: [
7
-      {
8
-        title: "iPhone 15 Pro",
9
-        price: "¥8999",
10
-        time: "2024-03-20"
11
-      },
12
-      {
13
-        title: "机械键盘",
14
-        price: "¥599",
15
-        time: "2024-03-21"
16
-      },
17
-      {
18
-        title: "显示器",
19
-        price: "¥2399",
20
-        time: "2024-03-22"
21
-      },
22
-      {
23
-        title: "耳机",
24
-        price: "¥999",
25
-        time: "2024-03-23"
26
-      }
27
-    ]
8
+    wishList: [],
28
   };
9
   };
29
   componentDidMount() {
10
   componentDidMount() {
11
+    const { id } = Taro.getCurrentInstance().router.params;
12
+    this.getCalculatorDetail(id); // 获取心愿列表
13
+  }
14
+  // 获取心愿列表
15
+  async getCalculatorDetail(id) {
16
+    const res = await getCalculatorDetail({
17
+      user_id: id,
18
+    });
19
+    this.setState({
20
+      wishList: res,
21
+    });
30
   }
22
   }
31
   render() {
23
   render() {
32
     return (
24
     return (
33
       <View className="index">
25
       <View className="index">
34
         {/* 心愿列表 */}
26
         {/* 心愿列表 */}
35
         <View className="wish-list">
27
         <View className="wish-list">
36
-          {this.state.wishList.map((item, index) => (
37
-            <View key={index} className="item">
38
-              <View className="left">
39
-                {index+1}
40
-            </View>
41
-            <View className="right">
42
-              <View className="left-text">
43
-                <View className="title">{item.title}</View>
44
-                <View className="price">预算&emsp;{item.price}元</View>
45
-              </View>
46
-              <View className="right-text">
47
-                {item.time}
28
+          {this.state.wishList.length > 0 &&
29
+            this.state.wishList.map((item, index) => (
30
+              <View key={index} className="item">
31
+                <View className="left">{index + 1}</View>
32
+                <View className="right">
33
+                  <View className="left-text">
34
+                    <View className="title">{item.jianlou_title}</View>
35
+                    <View className="price">
36
+                      预算&emsp;{item.reserve_price}元
37
+                    </View>
38
+                  </View>
39
+                  <View className="right-text">{item.time}</View>
40
+                </View>
48
               </View>
41
               </View>
49
-            </View>
50
-            </View>
51
-          ))}
42
+            ))}
52
         </View>
43
         </View>
53
       </View>
44
       </View>
54
     );
45
     );

+ 4 - 0
src/pages/calculatorSub/calculatorWishList/index.less

@@ -34,9 +34,13 @@
34
                     flex-direction: column;
34
                     flex-direction: column;
35
 
35
 
36
                     .title {
36
                     .title {
37
+                        width: 300px;
37
                         font-weight: 500;
38
                         font-weight: 500;
38
                         font-size: 30px;
39
                         font-size: 30px;
39
                         color: #333333;
40
                         color: #333333;
41
+                        white-space: nowrap;
42
+                        overflow: hidden;
43
+                        text-overflow: ellipsis;
40
                     }
44
                     }
41
 
45
 
42
                     .price {
46
                     .price {

+ 39 - 0
src/service/activity.js

@@ -0,0 +1,39 @@
1
+import Request from '../api/request';
2
+// -----------------------------------------------------------捡漏计算器
3
+// 获取捡漏计算机数据展示
4
+export const getCalculatorData = data =>
5
+  Request({
6
+    url: '/activity/get_jianlou_data_show',
7
+    method: 'POST',
8
+    data,
9
+  });
10
+//   获取用户捡漏清单详情
11
+export const getCalculatorDetail = data =>
12
+  Request({
13
+    url: '/activity/get_jianlou_detail',
14
+    method: 'POST',
15
+    data,
16
+  });
17
+//   用户捡漏清单列表
18
+export const getCalculatorList = data =>
19
+  Request({
20
+    url: '/activity/get_jianlou_list',
21
+    method: 'POST',
22
+    data,
23
+  });
24
+//   搜索捡漏计算器
25
+export const getCalculatorSearch = data =>
26
+  Request({
27
+    url: '/activity/search_jianlou_calculator',
28
+    method: 'POST',
29
+    data,
30
+  });
31
+//   捡漏计算器部分数据
32
+export const getCalculatorPartData = data =>
33
+  Request({
34
+    url: '/activity/get_jianlou_calculator',
35
+    method: 'POST',
36
+    data,
37
+  });
38
+
39
+