Quellcode durchsuchen

Merge branch 'developer' of http://git.caimei365.com/zhengjinyi/caimei-applets-weisha into developer

zhengjinyi vor 4 Jahren
Ursprung
Commit
389a3531d3
1 geänderte Dateien mit 59 neuen und 48 gelöschten Zeilen
  1. 59 48
      pages/goods/product.vue

+ 59 - 48
pages/goods/product.vue

@@ -216,31 +216,40 @@
 							<scroll-view class="tui-popup-scroll" scroll-y="true">
 								<view class="content-tr">
 									<view class="content-td">起订量</view>
-									<view class="content-th">{{product.minBuyNumber}}</view>
+									<view class="content-th">{{ product.minBuyNumber }}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">品牌</view>
-									<view class="content-th">{{product.brandName == null? '其他' : product.brandName}}</view>
+									<view class="content-th">{{
+										product.brandName == null ? '其他' : product.brandName
+									}}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">分类</view>
-									<view class="content-th">{{product.typeName == null? '暂无' : product.typeName}}</view>
+									<view class="content-th">{{
+										product.typeName == null ? '暂无' : product.typeName
+									}}</view>
 								</view>
 								<view class="content-tr">
-									<view class="content-td">包装规格</view> 
-									<view class="content-th">{{product.unit}}</view>
+									<view class="content-td">包装规格</view>
+									<view class="content-th">{{ product.unit }}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">商品编码</view>
-									<view class="content-th">{{product.productCode}}</view>
+									<view class="content-th">{{ product.productCode }}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">库存</view>
-									<view class="content-th">{{product.stock}}</view>
+									<view class="content-th">{{ product.stock }}</view>
 								</view>
-								<view class="content-tr" v-if="product.parametersList.length>0" v-for="(item, index) in product.parametersList" :key="index">
-									<view class="content-td">{{item.paramsName}}</view>
-									<view class="content-th">{{item.paramsContent}}</view>
+								<view
+									class="content-tr"
+									v-if="product.parametersList.length > 0"
+									v-for="(item, index) in product.parametersList"
+									:key="index"
+								>
+									<view class="content-td">{{ item.paramsName }}</view>
+									<view class="content-th">{{ item.paramsContent }}</view>
 								</view>
 							</scroll-view>
 						</div>
@@ -268,6 +277,7 @@ import customP from '@/components/cm-module/headerNavbar/header-poduct' //自定
 import cmPrice from '@/components/cm-module/productDetails/cm-price.vue' //价格显示
 import cmAttributes from '@/components/cm-module/productDetails/cm-attributes.vue' //规格信息
 import parser from '@/components/jyf-Parser/index' //富文本处理
+import shareAlert from '@/components/cm-module/modelAlert/shareAlert' //分享弹窗
 import tuiSkeleton from '@/components/tui-skeleton/tui-skeleton'
 import recommend from '@/components/cm-module/productDetails/recommend' //相关推荐
 import cmParameter from '@/components/cm-module/productDetails/cm-parameter' //相关参数
@@ -285,7 +295,8 @@ export default {
 		cmPrice,
 		cmAttributes,
 		cmParameter,
-		cmService
+		cmService,
+		shareAlert
 	},
 	data() {
 		return {
@@ -363,21 +374,55 @@ export default {
 			this.backPage = option.page
 		}
 		if (this.isShareType == 'share') {
+			this.initData()
 			authorize.getSetting().then(wxResponse => {
 				// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
-				console.log(wxResponse)
 				if (wxResponse == 1) {
 					wxLogin.wxLoginAuthorize()
 				} else {
 					console.log(new Date() + '用户未授权微信信息')
 				}
 			})
+		} else {
+			this.$api
+				.getStorage()
+				.then(resolve => {
+					this.userID = resolve.userID ? resolve.userID : ''
+					this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
+					this.shopID = resolve.shopID ? resolve.shopID : ''
+					if (
+						this.userIdentity == 0 ||
+						this.userIdentity == 2 ||
+						this.userIdentity == 4
+					) {
+						this.isShowButton = true
+					} else {
+						this.isShowButton = false
+					}
+					if (isPreviewImg) {
+						isPreviewImg = false
+						return
+					} else {
+						this.initData()
+					}
+				})
+				.catch(error => {
+					this.initData()
+				})
 		}
 		this.getWinHeight()
 	},
 	computed: {
 		...mapState(['hasLogin', 'isWxAuthorize', 'identity'])
 	},
+	onShareAppMessage() {
+		console.log(this.product)
+		return {
+			title: this.product.productName,
+			path: `/pages/goods/product?type=share&id=${this.product.productId}`,
+			imageUrl: `${this.productImage[0]}`
+		}
+	},
 	methods: {
 		initData() {
 			// 初始化商品详情查询
@@ -621,13 +666,12 @@ export default {
 			//丢弃
 		},
 		onShare(res) {
-			console.log(this.product)
 			//分享转发
 			if (res.from === 'button') {
 				// 来自页面内转发按钮
 			}
 			return {
-				title: `${this.product.productName}`,
+				title: this.product.productName,
 				path: `pages/goods/product?type=share&id=${this.productId}`,
 				imageUrl: `${this.productImage[0]}`
 			}
@@ -736,40 +780,7 @@ export default {
 			this.isScrollTop = false
 		}
 	},
-	onShareAppMessage(res) {
-		//分享转发
-		if (res.from === 'button') {
-			// 来自页面内转发按钮
-		}
-		return {
-			title: `${this.product.name}`,
-			path: `pages/goods/product?type=share&id=${this.productID}`,
-			imageUrl: `${this.productImage[0]}`
-		}
-	},
-	onShow() {
-		this.$api
-			.getStorage()
-			.then(resolve => {
-				this.userID = resolve.userID ? resolve.userID : ''
-				this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
-				this.shopID = resolve.shopID ? resolve.shopID : ''
-				if (this.userIdentity == 0 || this.userIdentity == 2 || this.userIdentity == 4) {
-					this.isShowButton = true
-				} else {
-					this.isShowButton = false
-				}
-				if (isPreviewImg) {
-					isPreviewImg = false
-					return
-				} else {
-					this.initData()
-				}
-			})
-			.catch(error => {
-				this.initData()
-			})
-	}
+	onShow() {}
 }
 </script>