shish 11 месяцев назад
Родитель
Сommit
8b3f19b1d0
3 измененных файлов с 111 добавлено и 51 удалено
  1. 0 1
      hdApp/src/admin/cg/mall.vue
  2. 107 50
      hdApp/src/admin/home/workbench.vue
  3. 4 0
      hdApp/src/api/main/index.js

+ 0 - 1
hdApp/src/admin/cg/mall.vue

@@ -93,7 +93,6 @@ export default {
     goToMallPt (url) {
       // #ifdef MP-WEIXIN
       let self = this
-      console.log(url + '?account=' + self.loginInfo.shopId)
       uni.navigateToMiniProgram({
         appId: this.getappIdList.mall.miniAppId,
         path: url + '?account=' + self.loginInfo.shopId,

+ 107 - 50
hdApp/src/admin/home/workbench.vue

@@ -73,13 +73,13 @@
             <view class="header-line"></view>
           </view>
           <view class="icon-grid">
-            <view class="icon-item" @click="showMallOptions">
+            <view class="icon-item" @click="showMallOptions(1)">
               <view class="icon-wrapper">
                 <image class="icon-image" :src="`${constant.hostUrl}/image/ghs/home/shop2.png`" mode="aspectFit"></image>
               </view>
               <view class="icon-text">商城</view>
             </view>
-            <view class="icon-item" @click="goPage({url: '/admin/goods/list'})">
+            <view class="icon-item" @click="showMallOptions(2)">
               <view class="icon-wrapper">
                 <image class="icon-image" :src="`${constant.hostUrl}/image/ghs/home/shop2.png`" mode="aspectFit"></image>
               </view>
@@ -132,7 +132,7 @@
             <view class="header-line"></view>
           </view>
           <view class="icon-grid">
-            <view class="icon-item" @click="goPage({url: '/admin/cg/mall'})">
+            <view class="icon-item" @click="showMallOptions(3)">
               <view class="icon-wrapper">
                 <image class="icon-image" :src="`${constant.hostUrl}/image/ghs/home/shop2.png`" mode="aspectFit"></image>
               </view>
@@ -422,9 +422,6 @@
   <!-- 商城选项弹框 -->
   <uni-popup ref="mallOptionsPopup" type="center" mask-background-color="rgba(0,0,0,0.4)">
     <view class="mall-options-container">
-      <view class="mall-options-header">
-        <text class="mall-options-title">商城</text>
-      </view>
       <view class="mall-options-buttons">
         <view class="mall-option-btn" @click="copyMallLink">
           <view class="option-icon">📋</view>
@@ -443,6 +440,7 @@
 <script>
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite";
+import { getShortUrl } from "@/api/main";
 import { getStat,getStrokeCount } from '@/api/console'
 import { consoleIndex } from "@/api/workbench";
 import NotLogin from "@/components/not-login";
@@ -481,7 +479,9 @@ export default {
       lookMoney:1,
       currentGhs:{},
       displaySupplierList: [],// 用于显示在弹框中的供货商列表
-      shopInfo:[]
+      shopInfo:[],
+      urlNo:1,
+      shortUrlList:[]
     };
   },
   computed: {
@@ -499,6 +499,7 @@ export default {
             }else{
               this.loginStyle  = 2
               uni.showTabBar()
+              this.getMallData()
             }
           }
       }
@@ -527,6 +528,7 @@ export default {
             }else{
               this.loginStyle  = 2
               uni.showTabBar()
+              this.getMallData()
             }
           }
       }
@@ -535,6 +537,16 @@ export default {
 
   },
   methods: {
+    getMallData(){
+      getWeixinId().then(res => {
+        this.getappIdList = res.data
+      })
+      getShortUrl().then(res=>{
+        if(res.code == 1){
+          this.shortUrlList = res.data?res.data:[]
+        }
+      })
+    },
     goKjKd(){
       if(this.myShopInfo && Number(this.myShopInfo.defaultCustomId)>0){
         this.$util.pageTo({url:'/admin/billing/index2?customId='+this.myShopInfo.defaultCustomId})
@@ -781,10 +793,6 @@ export default {
       this.$util.pageTo({url:'/admin/custom/selectCustom'})
     },
     goPage (item) {
-      if (item.url === '/admin/billing/priceChange') {
-        this.goToMallPt('pages/pay/index')
-        return true
-      }
       if(this.getLoginInfo.pfShopId && Number(this.getLoginInfo.pfShopId)>0){
         if(item.pf == 0){
           this.$msg('请在批发端操作')
@@ -797,10 +805,6 @@ export default {
 
         this.getGHSList()
 
-        getWeixinId().then(res => {
-          this.getappIdList = res.data
-        })
-
         // #ifdef MP-WEIXIN
         this.isMini = 1
         // #endif
@@ -845,22 +849,9 @@ export default {
     goToProfit () {
       this.$util.pageTo({url:'/admin/stat/profit'})
     },
-    goToMallPt (url) {
-      let self = this
-        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) {
-          }
-        })
-    },
     // 显示商城选项弹框
-    showMallOptions() {
+    showMallOptions(no) {
+      this.urlNo = no
       this.$refs.mallOptionsPopup.open('center')
     },
     // 关闭商城选项弹框
@@ -870,22 +861,100 @@ export default {
     // 直接打开商城
     openMallDirect() {
       this.closeMallOptions()
-      this.goPage({url: '/admin/cg/mall'})
+      let url = ''
+      //花束商城
+      if(this.urlNo == 1){
+        url = 'pages/home/category'
+      }
+      //图集
+      if(this.urlNo == 2){
+        url = 'pages/home/mall'
+      }
+      //绿植花材商城
+      if(this.urlNo == 3){
+        url = 'pages/item/item'
+      }
+      this.goToMallPt(url)
     },
     // 复制商城链接
     copyMallLink() {
       this.closeMallOptions()
-      // 这里生成商城链接,您可以根据实际情况修改链接格式
-      const mallLink = `${this.$constant.hostUrl}/admin/cg/mall`
+      let currentShortUrl = ''
+      let text = ""
+      //花束商城
+      if(this.urlNo == 1){
+        currentShortUrl = this.shortUrlList['goodsUrl']
+        text = "点击下面链接,打开【花束商城】挑选\n\n"+currentShortUrl
+      }
+      //图集
+      if(this.urlNo == 2){
+        currentShortUrl = this.shortUrlList['imgUrl']
+        text = "点击下面链接,打开【图集】挑选\n\n"+currentShortUrl
+      }
+      //绿植花材商城
+      if(this.urlNo == 3){
+        currentShortUrl = this.shortUrlList['itemUrl']
+        text = "点击下面链接,打开【绿植花材商城】挑选\n\n"+currentShortUrl
+      }
       uni.setClipboardData({
-        data: mallLink,
+        data: text,
         success: () => {
-          this.$msg('商城链接已复制到剪贴板')
+          this.$msg('已复制')
         },
         fail: () => {
-          this.$msg('复制失败,请重试')
+          this.$msg('复制失败')
         }
       })
+    },
+    goToMallPt (url) {
+      // #ifdef MP-WEIXIN
+      let self = this
+      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) {
+            let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.mall ? that.dictInfo.miniOriginalId.current.mall : ''
+            console.log(miniOriginalId)
+            sweixin.launchMiniProgram({
+              id: miniOriginalId,
+              path: '/'+url+'?account='+that.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
     }
   }
 };
@@ -1457,25 +1526,13 @@ export default {
   overflow: hidden;
   animation: popup-in 0.3s ease-out;
   
-  .mall-options-header {
-    padding: 50upx 30upx 30upx;
-    text-align: center;
-    background-color: #f8f9fa;
-    
-    .mall-options-title {
-      font-size: 44upx;
-      font-weight: 600;
-      color: #333;
-    }
-  }
-  
   .mall-options-buttons {
-    padding: 40upx 40upx 50upx;
+    padding: 50upx 40upx 50upx;
     display: flex;
     flex-direction: column;
     gap: 40upx;
     align-items: center;
-
+ 
     .mall-option-btn {
       display: flex;
       align-items: center;

+ 4 - 0
hdApp/src/api/main/index.js

@@ -13,4 +13,8 @@ export const mainGetMemberPoster = data => {
 
 export const getWxStoreId = data => {
 	return https.get('/main/wx-store-id', data)
+}
+
+export const getShortUrl = data => {
+	return https.get('/main/get-short-url', data)
 }