shish 3 лет назад
Родитель
Сommit
ea10b40c96

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

@@ -207,6 +207,7 @@ export default {
 			})
 		},
 		downloadImg(){
+			let that = this
 			uni.downloadFile({
 				url: this.posterUrl,
 				success: (res) => {
@@ -215,6 +216,7 @@ export default {
 					uni.saveImageToPhotosAlbum({
 					filePath: res.tempFilePath,
 					success: function (data) {
+						that.$refs.posterShow.close()
 						uni.showToast({title:'保存成功'})
 					}
 					});

+ 41 - 44
hdApp/src/admin/ghsProduct/detail.vue

@@ -57,7 +57,7 @@ import AppShareMask from "@/components/module/app-share-mask";
 import { share } from "@/mixins";
 import { mapGetters } from "vuex";
 import { getGhsProductDetail } from "@/api/product";
-import { ghsInfo,getGhsDataApi } from "@/api/ghs/index";
+import { ghsInfo,getGhsDataApi } from "@/api/ghs";
 import productMins from "@/mixins/cgProduct";
 export default {
   name: "detail",
@@ -94,64 +94,61 @@ export default {
       this.$util.pageTo({url:"/admin/billing/affirmGhs?id="+this.option.ghsId,type:2})
     },
     init() {
-        let that = this
-
-        let ghsShopAdminId = this.option.ghsShopAdminId ? this.option.ghsShopAdminId : 0
-
+      let that = this
+			//扫码进来
+			if(this.option.scene){
+				const scene = decodeURIComponent(this.option.scene);
+				var sceneItem = scene.split("&");
+				var arr, name, value;
+				var sceneArray = new Array();
+				for (var i = 0, l = sceneItem.length; i < l; i++) {
+					arr = sceneItem[i].split("=");
+					name = arr[0];
+					value = arr[1];
+					sceneArray[name] = value;
+				}
+        let id = sceneArray.id ? sceneArray.id : 0
+        let shopId = sceneArray.sId ? sceneArray.sId : 0
+        if(Number(id)>0 && Number(shopId)>0){
+          ghsInfo({shopId: shopId}).then(res => {
+            let ghsId = res.data.id
+            that.option.ghsId = ghsId
+            that.productDetail(id)
+          })
+        }else{
+          that.$msg('二维码有问题')
+        }
+			}else{
         if(this.option.ghsId){
           this.isShare = false
           getGhsDataApi({id: this.option.ghsId}).then(res => {
-
-            let shopId = res.data.shopId
-            let ghsId = this.option.ghsId
-            that.productDetail(ghsId,ghsShopAdminId,shopId)
-
-          }).catch(err => {})
-
+            that.productDetail(this.option.id)
+          })
         }else{
-
           ghsInfo({shopId: this.option.shopId}).then(res => {
             let ghsId = res.data.id;
-            let shopId = this.option.shopId
-            that.productDetail(ghsId,ghsShopAdminId,shopId)
-          }).catch(err => {})
-
+            that.option.ghsId = ghsId
+            that.productDetail(this.option.id)
+          })
         }
-
+      }
     },
-    productDetail(ghsId,ghsShopAdminId,shopId){
-          let that = this
-          getGhsProductDetail({ id: this.option.id,ghsId:ghsId }).then(res => {
-            if (!this.$util.isEmpty(res.data)){
+    productDetail(id){
+      getGhsProductDetail({ id: id}).then(res => {
+        if (!this.$util.isEmpty(res.data)){
 
-              this.productInfo = res.data
+          this.productInfo = res.data
 
-              let newArr = [];
-              newArr.push({img: res.data.bigCover});
-              this.imgList = newArr;
+          let newArr = [];
+          newArr.push({img: res.data.bigCover});
+          this.imgList = newArr;
 
-              let title = res.data.name+' ¥'+res.data.price
-              if(res.data.discountPrice > 0){
-                title = '【特价】'+title
-              }
-              let shareParams = {
-                title: title,
-                desc: res.data.price,
-                imgUrl: res.data.bigCover,
-                pagePath: `pagesPurchase/ghsProduct?hdShopAdminId=${that.loginInfo.shopAdminId}&ghsShopAdminId=${ghsShopAdminId}&shopId=${shopId}&id=0`
-              };
-              that.jweixinFn(shareParams);
-
-            }
-          })
+        }
+      })
     },
     changeNum(e) {
       this.buyNum = e.value;
     },
-    goToShop(){
-      let account = uni.getStorageSync('account')
-      this.$util.pageTo({url: '/pages/home/shop',type: 4,query: {account: account}})
-    },
     showPopup() {
         this.popupShow = true
     },

+ 6 - 4
hdApp/src/mixins/cgProduct.js

@@ -192,13 +192,15 @@ export default {
 			//采购或预订的记忆花材
 			if(this.pageType == 'cg' || this.pageType == 'bookCg' ){
 				let ghsId = 0
-				if(this.option.ghsId){
+				if(this.option.ghsId && Number(this.option.ghsId)>0){
 					ghsId = Number(this.option.ghsId)
 				}
-				if(ghsId == 0 && this.option.id){
-					ghsId = Number(this.option.id)
+				if(ghsId == 0){
+					if(this.option.id && Number(this.option.id)>0){
+						ghsId = Number(this.option.id)
+					}
 				}
-				if(!this.$util.isEmpty(this.option.id)){
+				if(Number(ghsId)>0){
 					uni.setStorageSync('selectList'+this.pageType+'_ghs_'+ghsId, this.selectList)
 				}
 			}else{

+ 7 - 2
hdApp/src/mixins/globalMixins.js

@@ -41,8 +41,8 @@ export default {
 			var pages = getCurrentPages()
 			let currentRoute  = pages[pages.length-1].route;
 			if(this.$util.isEmpty(token)){
-				//首页、花店采购页、欠款单列表页、结账单详情页
-				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info' || currentRoute == 'pagesPurchase/purDetails'){
+				//首页、花店采购页、欠款单列表页、结账单详情页、花材详情页
+				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info' || currentRoute == 'pagesPurchase/purDetails' || currentRoute == 'admin/ghsProduct/detail'){
 					wxLoginFn(true).then(res => {
 						let token = res.data.token || ''
 						//用于开启小程序自动登录
@@ -74,6 +74,11 @@ export default {
 						uni.setNavigationBarTitle({ title: res.name })
 					})
 					that.setUserShopAll()
+
+					if (that.init) {
+						that.init()
+					}
+
 				  }
 				})
 			}