Răsfoiți Sursa

分享功能

shish 3 ani în urmă
părinte
comite
615e8b69f5

+ 2 - 7
hdApp/src/admin/ghsProduct/components/buy-foot.vue

@@ -1,13 +1,9 @@
 <template>
 	<div class="app-footer">
         <div class="btn-left">
-            <div class="btn-wrap" @click="$msg('开发中')">
-                <i class="iconfont iconxiaoxi"></i>
-                <div class="btn-text">客服</div>
-            </div>
-            <div class="btn-wrap" @click="$msg('开发中')">
+            <div class="btn-wrap" @click="goShop()">
                 <i class="iconfont icondianpu"></i>
-                <div class="btn-text">店铺</div>
+                <div class="btn-text">店铺首页</div>
             </div>
         </div>
         <div class="btn-right">
@@ -15,7 +11,6 @@
         </div>
     </div>
 </template>
-
 <script>
 export default {
     name: 'buy-foot',

+ 28 - 8
hdApp/src/admin/ghsProduct/detail.vue

@@ -11,7 +11,7 @@
           <text v-if="Number(productInfo.discountPrice) > 0">【特价】</text>
           {{ productInfo.name}}
         </view>
-        <button class="tui-share-btn tui-share-position" >
+        <button open-type="share" class="tui-share-btn tui-share-position" >
           <app-tag type="gray" tui-tag-class="tui-tag-share tui-size" shape="circleLeft" size="small" >
             <view class="flex-center">
               <i class="iconfont iconfenxiang"></i>
@@ -42,7 +42,7 @@
         </view>
       </view>
     </view>
-    <buy-foot @buy="showPopup" />
+    <buy-foot @buy="showPopup" @goShop="goShopIndex()" />
     <sel-popup :show="popupShow" :info="productInfo" :buyNum="buyNum" @change="changeNum" @close="hidePopup" @nextFn="nextFn" />
     <app-share-mask :show="showShare" text="分享商品" @click="hideShare" />
   </view>
@@ -58,9 +58,10 @@ import { mapGetters } from "vuex";
 import { getGhsProductDetail } from "@/api/product";
 import { ghsInfo,getGhsDataApi } from "@/api/ghs";
 import productMins from "@/mixins/cgProduct";
+import { share } from "@/mixins";
 export default {
   name: "detail",
-  mixins: [productMins],
+  mixins: [productMins,share],
   components: {
     AppSwiper,
     AppTag,
@@ -106,6 +107,9 @@ export default {
       this.addItemEvent(customData)
       this.$util.pageTo({url:"/admin/billing/affirmGhs?id="+this.option.ghsId,type:2})
     },
+    goShopIndex(){
+      this.$util.pageTo({url:'/pagesPurchase/ghsProduct?id='+this.option.ghsId,type:2})
+    },
     init() {
       let that = this
 			//扫码进来
@@ -126,7 +130,7 @@ export default {
           ghsInfo({shopId: shopId}).then(res => {
             let ghsId = res.data.id
             that.option.ghsId = ghsId
-            that.productDetail(id)
+            that.productDetail(id,shopId)
           })
         }else{
           that.$msg('二维码有问题')
@@ -135,18 +139,23 @@ export default {
         if(this.option.ghsId){
           this.isShare = false
           getGhsDataApi({id: this.option.ghsId}).then(res => {
-            that.productDetail(this.option.id)
+            if(res.code == 1){
+              let shopId = res.data.shopId ? res.data.shopId : 0
+              that.productDetail(this.option.id,shopId)
+            }
           })
-        }else{
+        }
+        if(this.option.shopId){
           ghsInfo({shopId: this.option.shopId}).then(res => {
             let ghsId = res.data.id;
             that.option.ghsId = ghsId
-            that.productDetail(this.option.id)
+            that.productDetail(this.option.id,this.option.shopId)
           })
         }
       }
     },
-    productDetail(id){
+    productDetail(id,shopId){
+      let that = this
       getGhsProductDetail({ id: id}).then(res => {
         if (!this.$util.isEmpty(res.data)){
 
@@ -156,6 +165,17 @@ export default {
           newArr.push({img: res.data.bigCover});
           this.imgList = newArr;
 
+          let title = res.data.name+' ¥'+res.data.price
+          if(res.data.discountPrice && Number(res.data.discountPrice) > 0){
+            title = '【特价】'+title
+          }
+          let shareParams = {
+            title: title,
+            desc: res.data.price,
+            imgUrl: res.data.bigCover,
+            pagePath: `admin/ghsProduct/detail?id=${id}&shopId=${shopId}`
+          };
+          that.jweixinFn(shareParams)
         }
       })
     },

+ 2 - 6
mallApp/src/pages/item/components/buy-foot.vue

@@ -1,13 +1,9 @@
 <template>
 	<div class="app-footer">
         <div class="btn-left">
-            <div class="btn-wrap">
-                <i class="iconfont iconxiaoxi"></i>
-                <div class="btn-text">客服</div>
-            </div>
-            <div class="btn-wrap">
+            <div class="btn-wrap" @click="goShop()">
                 <i class="iconfont icondianpu"></i>
-                <div class="btn-text">店铺</div>
+                <div class="btn-text">店铺首页</div>
             </div>
         </div>
         <div class="btn-right">

+ 24 - 8
mallApp/src/pages/item/detail.vue

@@ -11,7 +11,7 @@
           <text v-if="Number(data.discountPrice) > 0">【特价】</text>
           {{ data.name }}
         </view>
-        <button class="tui-share-btn tui-share-position">
+        <button open-type="share" class="tui-share-btn tui-share-position">
           <app-tag type="gray" tui-tag-class="tui-tag-share tui-size" shape="circleLeft" size="small" >
             <view class="flex-center">
               <i class="iconfont iconfenxiang"></i>
@@ -43,7 +43,7 @@
       </view>
     </view>
     <sel-popup :show="popupShow" :info="data" :buyNum="buyNum" @change="changeNum" @close="hidePopup" @nextFn="nextFn" />
-    <buy-foot @buy="showPopup" :stock="data.stock" />
+    <buy-foot @buy="showPopup" :stock="data.stock" @goShop="goShopIndex()" />
   </view>
 </template>
 <script>
@@ -58,9 +58,10 @@ import { mapGetters } from "vuex";
 import { getMallItemInfo } from "@/api/item";
 import { getHdInfo } from "@/api/hd";
 import productMins from "@/mixins/cgProduct";
+import { share } from "@/mixins";
 export default {
   name: "detail",
-  mixins: [productMins],
+  mixins: [productMins,share],
   components: {
     AppSwiper,
     AppTag,
@@ -109,6 +110,9 @@ export default {
       this.addItemEvent(customData)
       this.$util.pageTo({url:"/pages/billing/affirmGhs?account="+this.option.account,type:2})
     },
+    goShopIndex(){
+      this.$util.pageTo({url:"/pages/item/item?account="+this.option.account,type:2})
+    },
     init() {
       let that = this
 			//扫码进来
@@ -123,7 +127,6 @@ export default {
 					value = arr[1];
 					sceneArray[name] = value;
 				}
-        console.log(sceneArray)
         let id = sceneArray.id ? sceneArray.id : 0
         let account = sceneArray.a ? sceneArray.a : 0
         this.option.account = account
@@ -131,7 +134,7 @@ export default {
           uni.setStorageSync('account',account)
           getHdInfo().then(res=>{
             if(res.code == 1){
-              that.getItemDetail(id)
+              that.getItemDetail(id,account)
             }
           })
         }else{
@@ -139,11 +142,11 @@ export default {
         }
 			}else{
         let id = this.option.id ? this.option.id : 0
-        //let account = this.option.account ? this.option.account : 0
-        that.getItemDetail(id)
+        let account = this.option.account ? this.option.account : 0
+        that.getItemDetail(id,account)
       }
     },
-    getItemDetail(id){
+    getItemDetail(id,account){
         getMallItemInfo({id: id}).then(res => {
           if (this.$util.isEmpty(res.data)){
             return false
@@ -152,6 +155,19 @@ export default {
           let newArr = [];
           newArr.push({img: this.data.bigCover});
           this.imgList = newArr;
+
+          let skPrice = this.data.skPrice ? parseFloat(this.data.skPrice) : 0
+          let title = this.data.name+' ¥'+skPrice
+          if(this.data.discountPrice && Number(this.data.discountPrice) > 0){
+            title = '【特价】'+title
+          }
+          let shareParams = {
+            title: title,
+            desc: skPrice,
+            imgUrl: this.data.cover,
+            pagePath: `pages/item/detail?id=${id}&account=${account}`
+          };
+          this.jweixinFn(shareParams)
         })
     },
     changeNum(e) {