浏览代码

商品详情分享配置、位置地图查看;

Sinea 1 年之前
父节点
当前提交
22f2830c07
共有 1 个文件被更改,包括 19 次插入16 次删除
  1. 19 16
      pages/index/product/index.vue

+ 19 - 16
pages/index/product/index.vue

@@ -62,11 +62,11 @@
 		</view>
 		<view class="foot-panel">
 			<view class="foot-wrap">
-				<button class="share-btn">
+				<button class="share-btn" open-type="share">
 					<image class="icon" src="@/static/svg/user_nav_4.svg"></image>
 					分享海报
 				</button>
-				<button class="btn btn-1">电话咨询</button>
+				<button class="btn btn-1" @click="handleCallPhone">电话咨询</button>
 				<button class="btn">下单购买</button>
 			</view>
 		</view>
@@ -93,6 +93,12 @@ export default {
 		this.getProductDetail();
 		this.getTagConfig();
 	},
+	onShareAppMessage() {
+		return {
+			title: this.productInfo.name,
+			path: '/pages/index/product/index?id=' + this.productId
+		};
+	},
 	methods: {
 		// 获取商品详情
 		async getProductDetail() {
@@ -111,20 +117,17 @@ export default {
 				phoneNumber: this.productInfo.telephone
 			});
 		},
-		handleOpenLocation(){
-		// let {coordinate} = this.productInfo
-		// 	uni.openLocation({
-		// 				latitude: latitude,
-		// 				longitude: longitude,
-		// 				success: function () {
-		// 					console.log('success');
-		// 				}
-		// 			});
-		// 		if (!this.productInfo.coordinate) return;
-		// 		uni.makePhoneCall({
-		// 			phoneNumber: this.productInfo.telephone
-		// 		});
-		}
+		handleOpenLocation() {
+			let { coordinate, address } = this.productInfo;
+			if (!coordinate) return;
+			coordinate = coordinate.split(',');
+			console.log(coordinate);
+			uni.openLocation({
+				latitude: +coordinate[0],
+				longitude: +coordinate[1],
+				address
+			});
+		},
 		filterDict
 	}
 };