Browse Source

分享商品优化

viczhq 4 days ago
parent
commit
bdec53ef1e

+ 7 - 7
project.private.config.json

@@ -10,6 +10,13 @@
10
     "miniprogram": {
10
     "miniprogram": {
11
       "list": [
11
       "list": [
12
         {
12
         {
13
+          "name": "pages/login/index",
14
+          "pathName": "pages/login/index",
15
+          "query": "",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
13
           "name": "pages/memberSub/earningsOrder/index",
20
           "name": "pages/memberSub/earningsOrder/index",
14
           "pathName": "pages/memberSub/earningsOrder/index",
21
           "pathName": "pages/memberSub/earningsOrder/index",
15
           "query": "",
22
           "query": "",
@@ -59,13 +66,6 @@
59
           "scene": null
66
           "scene": null
60
         },
67
         },
61
         {
68
         {
62
-          "name": "pages/mineSub/login/index",
63
-          "pathName": "pages/mineSub/login/index",
64
-          "query": "",
65
-          "launchMode": "default",
66
-          "scene": null
67
-        },
68
-        {
69
           "name": "pages/searchList/index",
69
           "name": "pages/searchList/index",
70
           "pathName": "pages/indexSub/searchList/index",
70
           "pathName": "pages/indexSub/searchList/index",
71
           "query": "",
71
           "query": "",

+ 4 - 0
src/api/request.js

@@ -38,6 +38,9 @@ export default async (options = { method: 'GET', data: {} }) => {
38
       method: options.method.toUpperCase(),
38
       method: options.method.toUpperCase(),
39
     });
39
     });
40
     const { code,data, msg } = res.data;
40
     const { code,data, msg } = res.data;
41
+    console.log('==========',options.url);
42
+    console.log('options',options.data);
43
+    console.log('res',res);
41
     switch (code) {
44
     switch (code) {
42
       case 200:
45
       case 200:
43
         return data;
46
         return data;
@@ -75,6 +78,7 @@ export default async (options = { method: 'GET', data: {} }) => {
75
           url: '/pages/login/index',
78
           url: '/pages/login/index',
76
         });
79
         });
77
         // throw new Error('需要登录');
80
         // throw new Error('需要登录');
81
+        return
78
       default:
82
       default:
79
         Taro.showToast({
83
         Taro.showToast({
80
           title: `${msg || '请求失败'}`,
84
           title: `${msg || '请求失败'}`,

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

@@ -6,7 +6,7 @@ import selectStep from "../../images/productDetail/selectStep.png";
6
 import xianyu from "../../images/productDetail/xianyu.png";
6
 import xianyu from "../../images/productDetail/xianyu.png";
7
 import stepThree from "../../images/productDetail/stepThree.png";
7
 import stepThree from "../../images/productDetail/stepThree.png";
8
 export default function Modal(props) {
8
 export default function Modal(props) {
9
-  const { productPromotion } = props;
9
+  const { productPromotion, isOpened, title, linkText } = props;
10
   const handleCopyLink = () => {
10
   const handleCopyLink = () => {
11
     Taro.setClipboardData({
11
     Taro.setClipboardData({
12
       data: productPromotion.short_tpwd,
12
       data: productPromotion.short_tpwd,
@@ -18,12 +18,12 @@ export default function Modal(props) {
18
     });
18
     });
19
   }
19
   }
20
   return (
20
   return (
21
-    <AtModal isOpened={props.isOpened} closeOnClickOverlay={true}>
21
+    <AtModal isOpened={isOpened} closeOnClickOverlay={true}>
22
       <AtModalContent>
22
       <AtModalContent>
23
         <View className="container">
23
         <View className="container">
24
-          <View className="title">{props.title}</View>
24
+          <View className="title">{title}</View>
25
           <View className="content">
25
           <View className="content">
26
-            <View className="link-text">{props.linkText}</View>
26
+            <View className="link-text">{linkText}</View>
27
             <View className="steps">
27
             <View className="steps">
28
               <View className="step-item">
28
               <View className="step-item">
29
                 <View className="step-title">
29
                 <View className="step-title">

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

@@ -44,8 +44,8 @@
44
             margin-top: 17px;
44
             margin-top: 17px;
45
             padding: 0 17px;
45
             padding: 0 17px;
46
             display: flex;
46
             display: flex;
47
-            justify-content: space-between;
48
-
47
+            // justify-content: space-between;
48
+            gap: 10px;
49
             .product-item {
49
             .product-item {
50
                 width: 100px;
50
                 width: 100px;
51
                 text-align: center;
51
                 text-align: center;

+ 34 - 13
src/components/index/ProductList/index.jsx

@@ -7,8 +7,10 @@ import React, {
7
 import { View, Text, Image, Button } from "@tarojs/components";
7
 import { View, Text, Image, Button } from "@tarojs/components";
8
 import { AtCheckbox, AtActivityIndicator } from "taro-ui";
8
 import { AtCheckbox, AtActivityIndicator } from "taro-ui";
9
 import { setShareContent } from "../../../common/share";
9
 import { setShareContent } from "../../../common/share";
10
+import { getShareJump } from "../../../service";
10
 import Taro from "@tarojs/taro";
11
 import Taro from "@tarojs/taro";
11
 import "./index.less";
12
 import "./index.less";
13
+import ShareModal from "../../shareModal";
12
 import joinStoreBg from "../../../images/index/jionStore.png";
14
 import joinStoreBg from "../../../images/index/jionStore.png";
13
 import joinStoreAc from "../../../images/index/joinStoreAc.png";
15
 import joinStoreAc from "../../../images/index/joinStoreAc.png";
14
 import saveMoneyBg from "../../../images/index/save-money.png";
16
 import saveMoneyBg from "../../../images/index/save-money.png";
@@ -19,6 +21,7 @@ const ProductList = forwardRef((props, ref) => {
19
     productList, // 商品列表数据
21
     productList, // 商品列表数据
20
     loading, // 加载状态
22
     loading, // 加载状态
21
     isSeckill, // 是否秒杀页面使用
23
     isSeckill, // 是否秒杀页面使用
24
+    isHighCommission, // 是否高佣金页面使用
22
     isManagement, // 是否管理页面使用
25
     isManagement, // 是否管理页面使用
23
     isManagementStatus, // 是否管理状态
26
     isManagementStatus, // 是否管理状态
24
     isProductClassify, // 是否分类页面使用
27
     isProductClassify, // 是否分类页面使用
@@ -26,10 +29,10 @@ const ProductList = forwardRef((props, ref) => {
26
     onAddProduct, // 添加商品方法
29
     onAddProduct, // 添加商品方法
27
     onDeleteProductSelect, // 删除商品选中id数组
30
     onDeleteProductSelect, // 删除商品选中id数组
28
     isNoMore, // 是否没有更多
31
     isNoMore, // 是否没有更多
29
-    onShareProduct, // 分享商品方法
30
-    } = props;
32
+  } = props;
31
 
33
 
32
   const [selectedProducts, setSelectedProducts] = useState([]); // 商品选择状态
34
   const [selectedProducts, setSelectedProducts] = useState([]); // 商品选择状态
35
+  const [shareModalOpened, setShareModalOpened] = useState(false); // 分享弹窗状态
33
   // 监听选中状态变化
36
   // 监听选中状态变化
34
   useEffect(() => {
37
   useEffect(() => {
35
     // 每当 selectedProducts 变化时,调用父组件的回调
38
     // 每当 selectedProducts 变化时,调用父组件的回调
@@ -45,7 +48,7 @@ const ProductList = forwardRef((props, ref) => {
45
       setSelectedProducts([]);
48
       setSelectedProducts([]);
46
     }
49
     }
47
   }, [isSelectAll]);
50
   }, [isSelectAll]);
48
-  // 定义 clearSelectedItems 方法
51
+  // 定义 clearSelectedItems 方法,父组件调用清除选中状态
49
   useImperativeHandle(ref, () => ({
52
   useImperativeHandle(ref, () => ({
50
     clearSelectedItems: () => {
53
     clearSelectedItems: () => {
51
       setSelectedProducts([]);
54
       setSelectedProducts([]);
@@ -58,7 +61,7 @@ const ProductList = forwardRef((props, ref) => {
58
       selectProduct(id);
61
       selectProduct(id);
59
     } else {
62
     } else {
60
       Taro.navigateTo({
63
       Taro.navigateTo({
61
-        url: `/pages/indexSub/productDetail/index?id=${id}`,
64
+        url: `/pages/indexSub/productDetail/index?id=${id}&&isHighCommission=${isHighCommission}&&isSeckill=${isSeckill}`,
62
       });
65
       });
63
     }
66
     }
64
   };
67
   };
@@ -86,14 +89,23 @@ const ProductList = forwardRef((props, ref) => {
86
       onAddProduct && onAddProduct(productId, index);
89
       onAddProduct && onAddProduct(productId, index);
87
     }
90
     }
88
   };
91
   };
89
-  // 分享商品 
92
+  // 分享商品
90
   const shareProduct = (product, e) => {
93
   const shareProduct = (product, e) => {
91
     e.stopPropagation(); // 防止事件穿透
94
     e.stopPropagation(); // 防止事件穿透
92
-    props.onShareProduct && props.onShareProduct();
93
-    setShareContent({
94
-      title: product.item_title,
95
-      path: `/pages/indexSub/productDetail/index?id=${product.id}&&isShare=${true}`,
96
-      imageUrl: product.image_url,
95
+    getShareJump({
96
+      share_type: 1,
97
+      share_id: product.id,
98
+    }).then((res) => {
99
+      // 设置分享内容
100
+      setShareContent({
101
+        title: product.item_title,
102
+        path: `/pages/indexSub/productDetail/index?id=${
103
+          product.id
104
+        }&&isShare=${true}&&shareJump=${res.share_unique_value}`,
105
+        imageUrl: product.image_url,
106
+      });
107
+      // 打开分享弹窗
108
+      setShareModalOpened(true);
97
     });
109
     });
98
   };
110
   };
99
   return (
111
   return (
@@ -126,7 +138,11 @@ const ProductList = forwardRef((props, ref) => {
126
                   style={{ WebkitBoxOrient: "vertical" }}
138
                   style={{ WebkitBoxOrient: "vertical" }}
127
                 >
139
                 >
128
                   <Text className="self-tag">
140
                   <Text className="self-tag">
129
-                    {!isSeckill ? "自营" : "鱼市��杀"}
141
+                    {isSeckill
142
+                      ? "鱼市秒杀"
143
+                      : isHighCommission
144
+                      ? "高佣专项"
145
+                      : "自营"}
130
                   </Text>
146
                   </Text>
131
                   {product.item_title}
147
                   {product.item_title}
132
                 </View>
148
                 </View>
@@ -179,7 +195,6 @@ const ProductList = forwardRef((props, ref) => {
179
                     <Image className="bg" src={shareEarnBg} mode="aspectFit" />
195
                     <Image className="bg" src={shareEarnBg} mode="aspectFit" />
180
                     <View className="content">
196
                     <View className="content">
181
                       <Button
197
                       <Button
182
-                        openType="share"
183
                         onClick={(e) => shareProduct(product, e)} // 传递事件对象
198
                         onClick={(e) => shareProduct(product, e)} // 传递事件对象
184
                       >
199
                       >
185
                         <Text className="label">分享赚</Text>
200
                         <Text className="label">分享赚</Text>
@@ -209,12 +224,19 @@ const ProductList = forwardRef((props, ref) => {
209
         </View>
224
         </View>
210
       )}
225
       )}
211
       {isNoMore && <View className="no-more">没有更多了~</View>}
226
       {isNoMore && <View className="no-more">没有更多了~</View>}
227
+      {/* 分享弹窗 */}
228
+      <ShareModal
229
+        onClose={() => setShareModalOpened(false)}
230
+        isOpened={shareModalOpened}
231
+        title="分享赚"
232
+      />
212
     </View>
233
     </View>
213
   );
234
   );
214
 });
235
 });
215
 
236
 
216
 ProductList.defaultProps = {
237
 ProductList.defaultProps = {
217
   isSeckill: false,
238
   isSeckill: false,
239
+  isHighCommission: false,
218
   productList: [],
240
   productList: [],
219
   loading: false,
241
   loading: false,
220
   isManagement: false,
242
   isManagement: false,
@@ -224,7 +246,6 @@ ProductList.defaultProps = {
224
   isNoMore: false,
246
   isNoMore: false,
225
   onAddProduct: () => {}, // 添加商品方法
247
   onAddProduct: () => {}, // 添加商品方法
226
   onDeleteProductSelect: () => {}, // 删除商品选中id数组
248
   onDeleteProductSelect: () => {}, // 删除商品选中id数组
227
-  onShareProduct: () => {}, // 分享商品方法
228
 };
249
 };
229
 
250
 
230
 export default ProductList;
251
 export default ProductList;

+ 1 - 1
src/components/index/ProductList/index.less

@@ -57,7 +57,7 @@
57
         -webkit-line-clamp: 2;
57
         -webkit-line-clamp: 2;
58
         /* autoprefixer: ignore next */
58
         /* autoprefixer: ignore next */
59
         -webkit-box-orient: vertical;
59
         -webkit-box-orient: vertical;
60
-
60
+        line-height: 42px;
61
 
61
 
62
         .self-tag {
62
         .self-tag {
63
           padding: 2px 8px;
63
           padding: 2px 8px;

+ 17 - 0
src/components/shareModal/index.jsx

@@ -0,0 +1,17 @@
1
+import { AtModal, AtModalContent } from "taro-ui";
2
+import { View, Image, Text, Button } from "@tarojs/components";
3
+import "./index.less";
4
+
5
+export default function shareModal(props) {
6
+  const { title, isOpened, onClose } = props;
7
+  return (
8
+    <AtModal isOpened={isOpened} closeOnClickOverlay={true} onClose={onClose}>
9
+      <AtModalContent>
10
+        <View className="container">
11
+          <View className="title">{title}</View>
12
+          <Button openType="share" onClick={onClose}>分享</Button>
13
+        </View>
14
+      </AtModalContent>
15
+    </AtModal>
16
+  );
17
+}

+ 21 - 0
src/components/shareModal/index.less

@@ -0,0 +1,21 @@
1
+  .at-modal__container {
2
+    width: 610px !important;
3
+  }
4
+  .at-modal__content {
5
+    max-height: none !important;  // 移除最大高度限制
6
+    min-height: auto !important;  // 移除最小高度限制
7
+    height: auto !important;      // 高度自适应
8
+  }
9
+.container{
10
+    display: flex;
11
+    flex-direction: column;
12
+    align-items: center;
13
+    justify-content: center;
14
+    .title{
15
+        color: #000000;
16
+        font-size: 32px;
17
+        font-weight: bold;
18
+        line-height: 46px;
19
+        margin-bottom: 20px;
20
+    }
21
+}

+ 13 - 12
src/pages/index/index.jsx

@@ -1,6 +1,13 @@
1
 import Taro from "@tarojs/taro"; // 导入 Taro
1
 import Taro from "@tarojs/taro"; // 导入 Taro
2
 import { Component } from "react";
2
 import { Component } from "react";
3
-import { View, Image, Swiper, SwiperItem, Text } from "@tarojs/components";
3
+import {
4
+  View,
5
+  Image,
6
+  Swiper,
7
+  SwiperItem,
8
+  Text,
9
+  Button,
10
+} from "@tarojs/components";
4
 import { AtTabs } from "taro-ui";
11
 import { AtTabs } from "taro-ui";
5
 import { getHomeData, getProductList } from "../../service";
12
 import { getHomeData, getProductList } from "../../service";
6
 import { getShareContent } from "../../common/share";
13
 import { getShareContent } from "../../common/share";
@@ -63,7 +70,6 @@ export default class Index extends Component {
63
   componentDidShow() {
70
   componentDidShow() {
64
     this.getHomeData(); //获取首页数据
71
     this.getHomeData(); //获取首页数据
65
   }
72
   }
66
-
67
   // 添加回到顶部方法
73
   // 添加回到顶部方法
68
   handleBackTop = () => {
74
   handleBackTop = () => {
69
     Taro.pageScrollTo({
75
     Taro.pageScrollTo({
@@ -101,14 +107,6 @@ export default class Index extends Component {
101
       loading: false,
107
       loading: false,
102
     }));
108
     }));
103
   };
109
   };
104
-
105
-  // 分享商品
106
-  handleShareProduct = () => {
107
-    Taro.showShareMenu({
108
-      withShareTicket: true,
109
-      menus: ["shareAppMessage"],
110
-    });
111
-  };
112
   // 配置分享内容
110
   // 配置分享内容
113
   onShareAppMessage() {
111
   onShareAppMessage() {
114
     return getShareContent();
112
     return getShareContent();
@@ -174,7 +172,9 @@ export default class Index extends Component {
174
           </View>
172
           </View>
175
         </View>
173
         </View>
176
         {/* 骨架屏 */}
174
         {/* 骨架屏 */}
177
-        <Skeleton isSkeletonShow={!homeData.banner&&!productList.length>0}/>
175
+        <Skeleton
176
+          isSkeletonShow={!homeData.banner && !productList.length > 0}
177
+        />
178
         {/* 分类列表组件 */}
178
         {/* 分类列表组件 */}
179
         {homeData.icon && <CategoryList categoryList={homeData.icon} />}
179
         {homeData.icon && <CategoryList categoryList={homeData.icon} />}
180
         {/* 运营区域 */}
180
         {/* 运营区域 */}
@@ -186,7 +186,7 @@ export default class Index extends Component {
186
           <ProductList
186
           <ProductList
187
             productList={productList}
187
             productList={productList}
188
             loading={loading}
188
             loading={loading}
189
-            onShareProduct={this.handleShareProduct}
189
+            onShareProduct={this.handleShare}
190
           />
190
           />
191
         </View>
191
         </View>
192
         {/* 添加浮动按钮 */}
192
         {/* 添加浮动按钮 */}
@@ -206,6 +206,7 @@ export default class Index extends Component {
206
             <Image className="back-top" src={backTopIcon} mode="aspectFit" />
206
             <Image className="back-top" src={backTopIcon} mode="aspectFit" />
207
           </View>
207
           </View>
208
         </View>
208
         </View>
209
+        {/* 分享弹窗 */}
209
       </View>
210
       </View>
210
     );
211
     );
211
   }
212
   }

+ 1 - 9
src/pages/indexSub/highCommission/index.jsx

@@ -32,13 +32,6 @@ export default class Index extends Component {
32
       loading: false,
32
       loading: false,
33
     }));
33
     }));
34
   };
34
   };
35
-  // 分享商品
36
-  handleShareProduct = () => {
37
-      Taro.showShareMenu({
38
-        withShareTicket: true,
39
-        menus: ["shareAppMessage"],
40
-    });
41
-  };
42
   // 配置分享内容
35
   // 配置分享内容
43
   onShareAppMessage() {
36
   onShareAppMessage() {
44
     return getShareContent();
37
     return getShareContent();
@@ -60,10 +53,9 @@ export default class Index extends Component {
60
         {/* 商品列表 */}
53
         {/* 商品列表 */}
61
         <View className="product-list">
54
         <View className="product-list">
62
           <ProductList
55
           <ProductList
63
-            isSeckill={true}
56
+            isHighCommission={true}
64
             productList={this.state.productList}
57
             productList={this.state.productList}
65
             loading={this.state.loading}
58
             loading={this.state.loading}
66
-            handleShareProduct={this.handleShareProduct}
67
           />
59
           />
68
         </View>
60
         </View>
69
       </View>
61
       </View>

+ 100 - 36
src/pages/indexSub/productDetail/index.jsx

@@ -1,7 +1,19 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
-import { View, Text, Swiper, SwiperItem, Image, Button } from "@tarojs/components";
2
+import {
3
+  View,
4
+  Text,
5
+  Swiper,
6
+  SwiperItem,
7
+  Image,
8
+} from "@tarojs/components";
3
 import { AtIcon } from "taro-ui";
9
 import { AtIcon } from "taro-ui";
4
-import { getProductDetail, getProductLikeList,getProductPromotion } from "../../../service";
10
+import {
11
+  getProductDetail,
12
+  getProductLikeList,
13
+  getProductPromotion,
14
+  getShareJump,
15
+  bindShareJump,
16
+} from "../../../service";
5
 import "./index.less";
17
 import "./index.less";
6
 import Taro from "@tarojs/taro";
18
 import Taro from "@tarojs/taro";
7
 import productDetailIcon from "../../../images/productDetail/productDetailIcon.png";
19
 import productDetailIcon from "../../../images/productDetail/productDetailIcon.png";
@@ -11,26 +23,35 @@ import selfBuy from "../../../images/productDetail/selfBuy.png";
11
 import share from "../../../images/productDetail/share.png";
23
 import share from "../../../images/productDetail/share.png";
12
 import ProductCard from "../../../components/ProductCard"; //产品卡片
24
 import ProductCard from "../../../components/ProductCard"; //产品卡片
13
 import Modal from "../../../components/Modal"; //弹窗
25
 import Modal from "../../../components/Modal"; //弹窗
14
-
26
+import ShareModal from "../../../components/shareModal"; //分享弹窗
15
 export default class Index extends Component {
27
 export default class Index extends Component {
16
   state = {
28
   state = {
17
     id: "", //商品id
29
     id: "", //商品id
18
     isShare: false, //是否是分享
30
     isShare: false, //是否是分享
19
-    isOpened: false, //是否打开弹窗
31
+    isOpened: '', //是否打开弹窗
20
     productDetail: [], //商品详情
32
     productDetail: [], //商品详情
21
     productLikeList: [], //推荐商品列表
33
     productLikeList: [], //推荐商品列表
22
     productPromotion: [], //商品推广转链
34
     productPromotion: [], //商品推广转链
35
+    isHighCommission: false, //是否是高佣金页面
36
+    isSeckill: false, //是否是秒杀页面
37
+    shareJump: "", //分享跳转标识
23
   };
38
   };
24
   // 获取产品详情的方法
39
   // 获取产品详情的方法
25
-  fetchProductDetails = async (id) => { 
40
+  fetchProductDetails = async (id) => {
26
     const res = await getProductDetail({
41
     const res = await getProductDetail({
27
       goods_id: id,
42
       goods_id: id,
28
     });
43
     });
29
-    this.setState({
30
-      productDetail: res,
31
-    },() => {
32
-      this.getProductPromotion(); //获取商品推广转链
33
-    });
44
+    this.setState(
45
+      {
46
+        productDetail: res,
47
+      },
48
+      () => {
49
+        let session_key = Taro.getStorageSync("session_key");
50
+        if (session_key) {
51
+          this.getProductPromotion(); //获取商品推广转链
52
+        }
53
+      }
54
+    );
34
   };
55
   };
35
   // 获取猜你喜欢列表
56
   // 获取猜你喜欢列表
36
   getProductLikeList = async () => {
57
   getProductLikeList = async () => {
@@ -46,17 +67,35 @@ export default class Index extends Component {
46
       item_id: [this.state.productDetail.item_id],
67
       item_id: [this.state.productDetail.item_id],
47
     });
68
     });
48
     this.setState({
69
     this.setState({
49
-      productPromotion: res.alibaba_idle_affiliate_general_link_convert_response.result.result,
70
+      productPromotion:
71
+        res.alibaba_idle_affiliate_general_link_convert_response.result.result,
50
     });
72
     });
51
   };
73
   };
52
   componentDidMount() {
74
   componentDidMount() {
53
-    const { id, isShare } = Taro.getCurrentInstance().router.params;
54
-    this.setState({
55
-      id,
56
-      isShare,
57
-    });
58
-    this.fetchProductDetails(id); //获取产品详情
59
-    this.getProductLikeList(); //获取猜你喜欢列表
75
+    const { id, isShare, isHighCommission, isSeckill, shareJump } =
76
+      Taro.getCurrentInstance().router.params;
77
+    this.setState(
78
+      {
79
+        id,
80
+        isShare,
81
+        isHighCommission: isHighCommission === "true",
82
+        isSeckill: isSeckill === "true",
83
+      },
84
+      () => {
85
+        // 获取分享跳转标识
86
+        shareJump &&
87
+          Taro.setStorage({
88
+            key: "shareJump",
89
+            data: shareJump,
90
+          });
91
+        this.fetchProductDetails(id); //获取产品详情
92
+        this.getProductLikeList(); //获取猜你喜欢列表
93
+        let session_key = Taro.getStorageSync("session_key");
94
+        if (session_key && shareJump) {
95
+          this.bindShareJump(); //绑定分享跳转标识
96
+        }
97
+      }
98
+    );
60
   }
99
   }
61
   // 复制商品编号
100
   // 复制商品编号
62
   handleCopy = (text) => {
101
   handleCopy = (text) => {
@@ -79,26 +118,42 @@ export default class Index extends Component {
79
   };
118
   };
80
 
119
 
81
   // 立即购买
120
   // 立即购买
82
-  handleBuy = () => {
121
+  handleBuy = async () => {
122
+    if (!this.state.productPromotion.short_tpwd) {
123
+      await this.getProductPromotion();
124
+    }
83
     this.setState({
125
     this.setState({
84
-      isOpened: true,
126
+      isOpened: 'self',
85
     });
127
     });
86
   };
128
   };
129
+
87
   // 分享
130
   // 分享
88
-  handleShare = () => {
89
-    // 只显示分享菜单
90
-    Taro.showShareMenu({
91
-      withShareTicket: true,
92
-      menus: ['shareAppMessage']
131
+  openSharePopup = async () => {
132
+    const res = await getShareJump({
133
+      share_type: 1,
134
+      share_id: this.state.id,
93
     });
135
     });
136
+    this.setState({
137
+      shareJump: res.share_unique_value,
138
+      isOpened: 'share',
139
+    });
140
+  };
141
+  // 绑定分享跳转标识
142
+  bindShareJump = async () => {
143
+    let shareJump = Taro.getStorageSync("shareJump");
144
+    await bindShareJump({
145
+      share_type: 1,
146
+      share_unique_value: shareJump,
147
+    });
148
+    Taro.removeStorageSync("shareJump");
94
   };
149
   };
95
   // 配置分享内容
150
   // 配置分享内容
96
   onShareAppMessage() {
151
   onShareAppMessage() {
97
     return {
152
     return {
98
       title: this.state.productDetail.item_title,
153
       title: this.state.productDetail.item_title,
99
-      path: `/pages/indexSub/productDetail/index?id=${this.state.id}&&isShare=${this.state.isShare}`,
100
-      imageUrl: this.state.productDetail.images[0].img
101
-    }
154
+      path: `/pages/indexSub/productDetail/index?id=${this.state.id}&&isShare=true&&isHighCommission=${this.state.isHighCommission}&&isSeckill=${this.state.isSeckill}&&shareJump=${this.state.shareJump}`,
155
+      imageUrl: this.state.productDetail.images[0].img,
156
+    };
102
   }
157
   }
103
   // 添加返回方法
158
   // 添加返回方法
104
   handleBack = () => {
159
   handleBack = () => {
@@ -111,7 +166,6 @@ export default class Index extends Component {
111
       });
166
       });
112
     }
167
     }
113
   };
168
   };
114
-
115
   render() {
169
   render() {
116
     const { productDetail } = this.state;
170
     const { productDetail } = this.state;
117
     return (
171
     return (
@@ -141,7 +195,13 @@ export default class Index extends Component {
141
         <View className="product-info">
195
         <View className="product-info">
142
           {/* 商品名称 */}
196
           {/* 商品名称 */}
143
           <Text className="product-name">
197
           <Text className="product-name">
144
-            <Text className="self-tag">自营</Text>
198
+            <Text className="self-tag">
199
+              {this.state.isHighCommission
200
+                ? "高佣专项"
201
+                : this.state.isSeckill
202
+                ? "鱼市秒杀"
203
+                : "自营"}
204
+            </Text>
145
             {productDetail.item_title}
205
             {productDetail.item_title}
146
           </Text>
206
           </Text>
147
 
207
 
@@ -219,13 +279,11 @@ export default class Index extends Component {
219
             {!this.state.isShare ? (
279
             {!this.state.isShare ? (
220
               <>
280
               <>
221
                 <View
281
                 <View
222
-                  onClick={this.handleShare}
282
+                  onClick={this.openSharePopup}
223
                   className="bottom-buy-right-self"
283
                   className="bottom-buy-right-self"
224
                 >
284
                 >
225
-                <Button openType="share" onClick={this.handleShare}>
226
                   <Image src={share} mode="aspectFit" />
285
                   <Image src={share} mode="aspectFit" />
227
                   <Text className="bottom-buy-text">分享赚</Text>
286
                   <Text className="bottom-buy-text">分享赚</Text>
228
-                </Button>
229
                 </View>
287
                 </View>
230
                 <View
288
                 <View
231
                   onClick={this.handleBuy}
289
                   onClick={this.handleBuy}
@@ -242,12 +300,18 @@ export default class Index extends Component {
242
             )}
300
             )}
243
           </View>
301
           </View>
244
         </View>
302
         </View>
245
-        {/* 分享弹窗 */}
303
+        {/* 自购弹窗 */}
246
         <Modal
304
         <Modal
247
-          linkText={this.state.productPromotion.short_tpwd}
248
           title="咸鱼口令已复制"
305
           title="咸鱼口令已复制"
249
-          isOpened={this.state.isOpened}
306
+          isOpened={this.state.isOpened=='self'}
250
           productPromotion={this.state.productPromotion}
307
           productPromotion={this.state.productPromotion}
308
+          linkText={this.state.productPromotion.short_tpwd}
309
+        />
310
+        {/* 分享弹窗 */}
311
+        <ShareModal
312
+          isOpened={this.state.isOpened=='share'}
313
+          onClose={() => this.setState({ isOpened: '' })}
314
+          title="分享赚"
251
         />
315
         />
252
       </View>
316
       </View>
253
     );
317
     );

+ 25 - 20
src/pages/indexSub/productDetail/index.less

@@ -205,7 +205,9 @@
205
             .bottom-buy-right-self {
205
             .bottom-buy-right-self {
206
                 background-color: #fbe00f;
206
                 background-color: #fbe00f;
207
                 color: #000000;
207
                 color: #000000;
208
-
208
+                display: flex;
209
+                justify-content: center;
210
+                align-items: center;
209
                 image {
211
                 image {
210
                     width: 47px;
212
                     width: 47px;
211
                     height: 46px;
213
                     height: 46px;
@@ -260,23 +262,26 @@
260
 }
262
 }
261
 
263
 
262
 // 清除Button默认样式
264
 // 清除Button默认样式
263
-Button {
264
-    padding: 0;
265
-    margin: 0;
266
-    background: none;
267
-    border: none;
268
-    line-height: normal;
269
-    height: 100%;
270
-    width: 100%;
271
-    display: flex;
272
-    justify-content: center;
273
-    align-items: center;
274
-
275
-    &::after {
276
-        border: none;
277
-    }
278
-}
265
+// Button {
266
+//     padding: 0;
267
+//     margin: 0;
268
+//     background: none;
269
+//     border: none;
270
+//     line-height: normal;
271
+//     height: 100%;
272
+//     width: 100%;
273
+//     display: flex;
274
+//     justify-content: center;
275
+//     align-items: center;
276
+
277
+//     &::after {
278
+//         border: none;
279
+//     }
280
+// }
281
+
279
 .button-hover {
282
 .button-hover {
280
-    background-color: transparent !important; /* 移除背景高亮 */
281
-    box-shadow: none !important;             /* 移除可能的阴影 */
282
-  }
283
+    background-color: transparent !important;
284
+    /* 移除背景高亮 */
285
+    box-shadow: none !important;
286
+    /* 移除可能的阴影 */
287
+}

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

@@ -32,13 +32,6 @@ export default class Index extends Component {
32
       loading: false,
32
       loading: false,
33
     }));
33
     }));
34
   };
34
   };
35
-  // 分享商品
36
-  handleShareProduct = () => {
37
-    Taro.showShareMenu({
38
-      withShareTicket: true,
39
-      menus: ["shareAppMessage"],
40
-    });
41
-  };
42
   // 配置分享内容
35
   // 配置分享内容
43
   onShareAppMessage() {
36
   onShareAppMessage() {
44
     return getShareContent();
37
     return getShareContent();
@@ -63,7 +56,6 @@ export default class Index extends Component {
63
             isSeckill={true}
56
             isSeckill={true}
64
             productList={this.state.productList}
57
             productList={this.state.productList}
65
             loading={this.state.loading}
58
             loading={this.state.loading}
66
-            onShareProduct={this.handleShareProduct}
67
           />
59
           />
68
         </View>
60
         </View>
69
       </View>
61
       </View>

+ 21 - 7
src/pages/login/index.jsx

@@ -1,8 +1,8 @@
1
 import { Component } from "react";
1
 import { Component } from "react";
2
-import { View, Image, Button, Checkbox } from "@tarojs/components";
2
+import { View, Image, Button } from "@tarojs/components";
3
 import Taro from "@tarojs/taro";
3
 import Taro from "@tarojs/taro";
4
 import { AtCheckbox } from "taro-ui";
4
 import { AtCheckbox } from "taro-ui";
5
-import { login,getUserInfo } from "../../service";
5
+import { login,getUserInfo,bindShareJump } from "../../service";
6
 import { objToParam } from "../../common/toParams";
6
 import { objToParam } from "../../common/toParams";
7
 import "./index.less";
7
 import "./index.less";
8
 import logo1 from "../../images/logo1.png";
8
 import logo1 from "../../images/logo1.png";
@@ -61,18 +61,32 @@ export default class Index extends Component {
61
                 title: '登录成功',
61
                 title: '登录成功',
62
                 icon: 'none',
62
                 icon: 'none',
63
               })
63
               })
64
+              // 获取个人信息
64
               getUserInfo().then(res => {
65
               getUserInfo().then(res => {
65
                 Taro.setStorageSync('userInfo', res)
66
                 Taro.setStorageSync('userInfo', res)
66
               })
67
               })
68
+              // 绑定分享跳转标识
69
+              let shareJump = Taro.getStorageSync('shareJump')
70
+              if(shareJump){
71
+                bindShareJump({
72
+                  share_unique_value: shareJump,
73
+                  share_type:1
74
+                }).then(res => {
75
+                  Taro.removeStorageSync('shareJump')
76
+                  if (global.globalData.optionsData) {
77
+                    delete global.globalData.optionsData.shareJump
78
+                  }
79
+                })
80
+              }
67
               let lastPage = Taro.getStorageSync('currentPage')
81
               let lastPage = Taro.getStorageSync('currentPage')
68
               if (lastPage == 'pages/mineSub/login/index') {
82
               if (lastPage == 'pages/mineSub/login/index') {
69
                 lastPage = 'pages/index/index'
83
                 lastPage = 'pages/index/index'
70
               }
84
               }
71
-                Taro.reLaunch({
72
-                  url: `/${lastPage}?${objToParam(Taro.getStorageSync('optionsData'))}`
73
-                })
74
-                Taro.removeStorageSync('currentPage')
75
-                global.globalData.optionsData = {}
85
+              Taro.reLaunch({
86
+                url: `/${lastPage}?${objToParam(global.globalData.optionsData)}`
87
+              })
88
+              Taro.removeStorageSync('currentPage')
89
+              global.globalData.optionsData = {}
76
             });
90
             });
77
           },
91
           },
78
         });
92
         });

+ 0 - 8
src/pages/memberSub/productClassify/index.jsx

@@ -90,13 +90,6 @@ export default class Index extends Component {
90
       }
90
       }
91
     });
91
     });
92
   };
92
   };
93
-  // 分享商品
94
-  handleShareProduct = () => {
95
-    Taro.showShareMenu({
96
-      withShareTicket: true,
97
-      menus: ["shareAppMessage"],
98
-    });
99
-  };
100
   // 配置分享内容
93
   // 配置分享内容
101
   onShareAppMessage() {
94
   onShareAppMessage() {
102
     return getShareContent();
95
     return getShareContent();
@@ -125,7 +118,6 @@ export default class Index extends Component {
125
           loading={this.state.loading}
118
           loading={this.state.loading}
126
           productList={this.state.productList}
119
           productList={this.state.productList}
127
           isProductClassify={true}
120
           isProductClassify={true}
128
-          onShareProduct={this.handleShareProduct}
129
           onAddProduct={(productId, index) =>
121
           onAddProduct={(productId, index) =>
130
             this.onAddProduct(productId, index)
122
             this.onAddProduct(productId, index)
131
           }
123
           }

+ 0 - 8
src/pages/memberSub/productManagement/index.jsx

@@ -204,13 +204,6 @@ export default class Index extends Component {
204
       });
204
       });
205
     }
205
     }
206
   };
206
   };
207
-  // 分享商品
208
-  handleShareProduct = () => {
209
-    Taro.showShareMenu({
210
-      withShareTicket: true,
211
-      menus: ["shareAppMessage"],
212
-    });
213
-  };
214
   // 配置分享内容
207
   // 配置分享内容
215
   onShareAppMessage() {
208
   onShareAppMessage() {
216
     return getShareContent();
209
     return getShareContent();
@@ -278,7 +271,6 @@ export default class Index extends Component {
278
                     loading={this.state.loading}
271
                     loading={this.state.loading}
279
                     onDeleteProductSelect={this.onDeleteProductSelect}
272
                     onDeleteProductSelect={this.onDeleteProductSelect}
280
                     isNoMore={this.state.isNoMore}
273
                     isNoMore={this.state.isNoMore}
281
-                    onShareProduct={this.handleShareProduct}
282
                   />
274
                   />
283
                 )}
275
                 )}
284
               </View>
276
               </View>

+ 14 - 9
src/pages/memberSub/storeManagement/index.jsx

@@ -2,7 +2,7 @@ import { Component } from "react";
2
 import { View, Text, Image, Button } from "@tarojs/components";
2
 import { View, Text, Image, Button } from "@tarojs/components";
3
 import { AtIcon } from "taro-ui";
3
 import { AtIcon } from "taro-ui";
4
 import "./index.less";
4
 import "./index.less";
5
-import { getMyShopList, getMyShopDetail, getShareShopDetail, getShareShopProductList } from "../../../service";
5
+import { getMyShopList, getMyShopDetail, getShareShopDetail, getShareShopProductList, getShareJump,bindShareJump } from "../../../service";
6
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
6
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
7
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
7
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
8
 import ProductCard from "../../../components/ProductCard"; //卡片模块
8
 import ProductCard from "../../../components/ProductCard"; //卡片模块
@@ -52,6 +52,8 @@ export default class Index extends Component {
52
   componentDidShow() {
52
   componentDidShow() {
53
     const { router } = Taro.getCurrentInstance();
53
     const { router } = Taro.getCurrentInstance();
54
     const params = router.params;
54
     const params = router.params;
55
+    console.log(params,1111);
56
+    
55
     this.setState({
57
     this.setState({
56
       isManager: JSON.parse(params.isManager), //是否是店长
58
       isManager: JSON.parse(params.isManager), //是否是店长
57
       isShare: params.isShare||false, // 是否是分享进入
59
       isShare: params.isShare||false, // 是否是分享进入
@@ -77,20 +79,23 @@ export default class Index extends Component {
77
       url: "/pages/mineSub/infoEdit/index",
79
       url: "/pages/mineSub/infoEdit/index",
78
     });
80
     });
79
   };
81
   };
80
-  // 分享店铺
81
-  handleShare = () => {
82
-    Taro.showShareMenu({
83
-      withShareTicket: true,
84
-      menus: ['shareAppMessage']
85
-    });
86
-  };
87
   // 配置分享内容
82
   // 配置分享内容
88
   onShareAppMessage() {
83
   onShareAppMessage() {
89
     return {
84
     return {
90
       title: "店铺",
85
       title: "店铺",
91
-      path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false`,
86
+      path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false&&shareJump=${res.share_unique_value}`,
92
       imageUrl: ''
87
       imageUrl: ''
93
     }
88
     }
89
+    return getShareJump({
90
+      share_type:2,
91
+      share_id: this.state.shopDetail.id
92
+    }).then(res=>{
93
+      return {
94
+        title: "店铺",
95
+        path: `/pages/memberSub/storeManagement/index?shopId=${this.state.shopDetail.id}&isShare=true&isManager=false&&shareJump=${res.share_unique_value}`,
96
+        imageUrl: ''
97
+      }
98
+    })
94
   }
99
   }
95
   render() {
100
   render() {
96
     const { shopDetail, productList } = this.state;
101
     const { shopDetail, productList } = this.state;

+ 14 - 0
src/service/index.js

@@ -79,6 +79,20 @@ export const getUserAgreement = data =>
79
     method: 'POST',
79
     method: 'POST',
80
     data,
80
     data,
81
   })
81
   })
82
+  // 获取分享跳转标识
83
+export const getShareJump = data =>
84
+  Request({
85
+    url: '/user/get_not_oneself_store_detail',
86
+    method: 'POST',
87
+    data,
88
+  })
89
+  // 绑定分享跳转标识
90
+  export const bindShareJump = data =>
91
+  Request({
92
+    url: '/user/get_share_unique_value',
93
+    method: 'POST',
94
+    data,
95
+  })
82
 // ---------------------会员
96
 // ---------------------会员
83
 // 获取会员详情
97
 // 获取会员详情
84
 export const getVipInfo = data =>
98
 export const getVipInfo = data =>