Przeglądaj źródła

打开和分享

shish 4 lat temu
rodzic
commit
b4e1e32d89

+ 40 - 7
ghsApp/src/admin/home/mall.vue

@@ -7,12 +7,12 @@
     <div class="confirm-btn">
       <button class="admin-button-com big blue" @click="downloadImg">保存图片</button>
     </div>
-    <!-- #ifdef MP-WEIXIN -->
+
     <view style="margin:50upx 0 0 30upx;font-size:30upx;">打开直接分享给客户</view>
     <div class="confirm-btn1">
       <button class="admin-button-com big blue" @click="goToMallPt()">打开商城</button>
     </div>
-    <!-- #endif -->
+
   </view>
 </template>
 <script>
@@ -59,18 +59,51 @@ export default {
       }).catch(err => {})
     },
     goToMallPt () {
-      let self = this
-        console.log('pagesPurchase/ghsProduct?shopId='+ this.loginInfo.shopId+'&id=0&ghsShopAdminId='+this.loginInfo.shopAdminId+'&fromCg=1')
+        let that = this
+        // #ifdef MP-WEIXIN
+        console.log('pagesPurchase/ghsProduct?shopId='+ that.loginInfo.shopId+'&id=0&ghsShopAdminId='+that.loginInfo.shopAdminId+'&fromCg=1')
         uni.navigateToMiniProgram({
 					//姜枫-2021.04.13
-					appId: this.getappIdList.hd.miniAppId,
-					path: 'pagesPurchase/ghsProduct?shopId='+ this.loginInfo.shopId+'&id=0&ghsShopAdminId='+this.loginInfo.shopAdminId+'&fromCg=1',
+					appId: that.getappIdList.hd.miniAppId,
+					path: 'pagesPurchase/ghsProduct?shopId='+ that.loginInfo.shopId+'&id=0&ghsShopAdminId='+that.loginInfo.shopAdminId+'&fromCg=1',
 					//develop 开发版 trial 体验版 release 正式版
 					envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
-					extraData: { 'shopId': this.loginInfo.shopId, 'id': 0, 'name':'', },
+					extraData: { 'shopId': that.loginInfo.shopId, 'id': 0, 'name':'', },
           success (res) {
           }
         })
+        // #endif
+        // #ifdef APP-PLUS
+        if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
+          plus.share.getServices(function(s){
+            var sweixin
+            for (var i = 0; i < s.length; i++) {
+              var t = s[i];
+              if (t.id == 'weixin') {
+                  sweixin = t;
+              }
+            }
+            if (sweixin && sweixin.nativeClient) {
+              sweixin.launchMiniProgram({
+                id: 'gh_73b8b357d19a',
+                path: '/pagesPurchase/ghsProduct?shopId='+ that.loginInfo.shopId+'&id=0&ghsShopAdminId='+that.loginInfo.shopAdminId+'&fromCg=1',
+                type: 0
+              });
+            } else {
+              that.$msg("没有找到微信服务")
+              //that.$msg("获取微信失败:" + e.message)
+              //console.log(JSON.stringify(e));
+            }
+          }, function(e){
+              that.$msg("没有找到微信服务哦")
+              //that.$msg("获取微信失败:" + e.message)
+              //console.log(JSON.stringify(e));
+          });
+        } else {
+          that.$msg("即将跳转小程序,请安装微信")
+          return false
+        }
+        // #endif
     },
   }
 }

+ 0 - 33
ghsApp/src/admin/item/components/ItemStock.vue

@@ -61,40 +61,7 @@ export default {
 			this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+id})
 		},
 		goToProduct(id) {
-			// #ifdef MP-WEIXIN
 			this.$emit('goToProduct', id)
-			// #endif
-			// #ifdef APP-PLUS
-			let that = this
-			if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
-				var sweixin
-				plus.share.getServices(function(s){
-					for (var i = 0; i < s.length; i++) {
-						var t = s[i];
-						if (t.id == 'weixin') {
-							sweixin = t;
-						}
-					}
-					if (sweixin) { //&& sweixin.nativeClient
-						sweixin.launchMiniProgram({
-							id: 'gh_73b8b357d19a',
-							path: 'admin/item/list',
-							type: 0
-						});
-					} else {
-						that.$msg('没有找到微信服务');
-						return false;
-					}
-				}, function(e){
-					that.$msg("没有找到微信服务哦")
-					//that.$msg("获取微信失败:" + e.message)
-					//console.log(JSON.stringify(e));
-				});
-			}else{
-				this.$msg("即将跳转小程序,请安装微信")
-				return false
-			}
-			// #endif
 		},
 		addEvent() {
 			this.$emit("add");

+ 32 - 0
ghsApp/src/admin/item/list.vue

@@ -248,6 +248,7 @@ export default {
 		},
 		goToProduct (id) {
 			let that = this
+			// #ifdef MP-WEIXIN
 			console.log('admin/ghsProduct/detail?shopId='+ that.loginInfo.shopId+'&id=0&ghsShopAdminId='+that.loginInfo.shopAdminId+'&id='+id)
 			uni.navigateToMiniProgram({
 				//姜枫-2021.04.13
@@ -263,6 +264,37 @@ export default {
 				success (res) {
 				}
 			})
+			// #endif
+			// #ifdef APP-PLUS
+			if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
+				var sweixin
+				plus.share.getServices(function(s){
+					for (var i = 0; i < s.length; i++) {
+						var t = s[i];
+						if (t.id == 'weixin') {
+							sweixin = t;
+						}
+					}
+					if (sweixin) { //&& sweixin.nativeClient
+						sweixin.launchMiniProgram({
+							id: 'gh_73b8b357d19a',
+							path: 'admin/ghsProduct/detail?shopId='+ that.loginInfo.shopId+'&ghsShopAdminId='+that.loginInfo.shopAdminId+'&id='+id,
+							type: 0
+						});
+					} else {
+						that.$msg('没有找到微信服务');
+						return false;
+					}
+				}, function(e){
+					that.$msg("没有找到微信服务哦")
+					//that.$msg("获取微信失败:" + e.message)
+					//console.log(JSON.stringify(e));
+				});
+			}else{
+				this.$msg("即将跳转小程序,请安装微信")
+				return false
+			}
+			// #endif
 		},
 		affirm(val) {
 			if (val.index === 0) {

+ 46 - 14
hdApp/src/admin/cg/mall.vue

@@ -7,12 +7,10 @@
     <div class="confirm-btn">
       <button class="admin-button-com big blue" @click="downloadImg">保存图片</button>
     </div>
-    <!-- #ifdef MP-WEIXIN -->
     <view style="margin:50upx 0 0 30upx;font-size:30upx;">打开直接分享给客户</view>
     <div class="confirm-btn1">
-      <button class="admin-button-com big blue" @click="goToMallPt('pages/home/index')">打开商城</button>
+      <button class="admin-button-com big blue" @click="goToMallPt()">打开商城</button>
     </div>
-    <!-- #endif -->
   </view>
 </template>
 <script>
@@ -59,20 +57,54 @@ export default {
         this.imgUrl = res.data.imgUrl
       }).catch(err => {})
     },
-    goToMallPt (url) {
+    goToMallPt () {
+      // #ifdef MP-WEIXIN
+      let url = 'pages/home/index'
       let self = this
       console.log(url + '?account=' + self.loginInfo.shopId)
-        uni.navigateToMiniProgram({
-          appId: this.getappIdList.mall.miniAppId,
-          path: url + '?account=' + self.loginInfo.shopId,
-          //develop 开发版 trial 体验版 release 正式版
-          envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
-          extraData: {
-            'hdShopAdminId': self.loginInfo.shopAdminId
-          },
-          success (res) {
+      uni.navigateToMiniProgram({
+        appId: this.getappIdList.mall.miniAppId,
+        path: url + '?account=' + self.loginInfo.shopId,
+        //develop 开发版 trial 体验版 release 正式版
+        envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
+        extraData: {
+          'hdShopAdminId': self.loginInfo.shopAdminId
+        },
+        success (res) {}
+      })
+      // #endif
+      // #ifdef APP-PLUS
+      let that = this
+      if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
+        plus.share.getServices(function(s){
+          var sweixin
+          for (var i = 0; i < s.length; i++) {
+            var t = s[i];
+            if (t.id == 'weixin') {
+                sweixin = t;
+            }
           }
-        })
+          if (sweixin && sweixin.nativeClient) {
+            sweixin.launchMiniProgram({
+              id: 'gh_73b8b357d19a',
+              path: '/pages/home/index?account='+self.loginInfo.shopId,
+              type: 0
+            });
+          } else {
+            that.$msg("没有找到微信服务")
+            //that.$msg("获取微信失败:" + e.message)
+            //console.log(JSON.stringify(e));
+          }
+        }, function(e){
+            that.$msg("没有找到微信服务哦")
+            //that.$msg("获取微信失败:" + e.message)
+            //console.log(JSON.stringify(e));
+        });
+      } else {
+				this.$msg("即将跳转小程序,请安装微信")
+				return false
+      }
+			// #endif
     },
   }
 }