Prechádzať zdrojové kódy

feat: 新增分销管理-商品分享模块

wenxingxing 19 hodín pred
rodič
commit
41ff735292

+ 1 - 1
pages/shopping/productDetails.vue

@@ -194,7 +194,7 @@
 </template>
 
 <script>
-import {CustomToast} from '@/components/custom-toast.vue';
+import CustomToast from '@/components/custom-toast.vue';
 
 	import {
 		getDicts

+ 1 - 11
pages_company/managerOrder/confirmOrder.vue

@@ -339,17 +339,7 @@
 					});
 					return;
 				}
-
-				uni.requestSubscribeMessage({
-					tmplIds: this.temps,
-					success(res) {
-						that.createOrder();
-					},
-					fail(res) {
-						that.createOrder();
-					}
-				})
-
+				this.createOrder();
 			},
 			createOrder() {
 				var that = this;

+ 40 - 10
pages_company/managerOrder/productDetails.vue

@@ -27,7 +27,7 @@
 					<text class="label">零售价</text>
 					<text class="old">¥{{product.otPrice}}</text>
 				</view>
-				<view class="share-box">
+				<view class="share-box" @tap="handleOpenShare">
 					<text class="text">分享</text>
 					<u-icon name="share-fill" color="#FF233C" size="18"></u-icon>
 				</view>
@@ -186,14 +186,13 @@
 			<image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png"></image>
 			<text class="text">加载中...</text>
 		</view>
-    <CustomToast ref="customToast">
-    </CustomToast>
+    <CustomToast ref="customToast" />
 		<!-- <u-modal :show="showModal" title="温馨提示" content="处方药须凭处方在药师指导下购买和使用" @confirm="hideModal()"></u-modal> -->
 	</view>
 </template>
 
 <script>
-import {CustomToast} from '@/components/custom-toast.vue';
+import CustomToast from '@/components/custom-toast.vue';
 
 	import {
 		getDicts
@@ -213,7 +212,7 @@ import {CustomToast} from '@/components/custom-toast.vue';
 		components: {
 			item: {},
 			popupBottom,
-      CustomToast
+			CustomToast
 		},
 		data() {
 			return {
@@ -264,11 +263,6 @@ import {CustomToast} from '@/components/custom-toast.vue';
 		},
 		onLoad(options) {
 			console.log("qxj options:",options);
-			uni.showShareMenu({
-				withShareTicket: true,
-				//小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
-				menus: ["shareAppMessage", "shareTimeline"] //不设置默认发送给朋友
-			})
 			this.getDicts();
 			this.productId = options.productId;
 			this.companyUserId= options.companyUserId
@@ -283,6 +277,42 @@ import {CustomToast} from '@/components/custom-toast.vue';
 			}
 		},
 		methods: {
+			handleOpenShare() {
+			//#ifdef H5
+				uni.showToast({
+					title: '请使用APP操作',
+					icon: 'none'
+				});				
+			//#endif
+			
+			//#ifdef APP-PLUS
+			uni.share({
+				provider: "weixin",
+				scene: 'WXSceneSession',
+				type: 5,
+				imageUrl: 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png', //分享封面图片
+				title: this.product.productName, // 分享标题
+				miniProgram: {
+					id: getApp().globalData.miniprogamId,
+					path: '/pages_company/managerOrder/productDetails?productId=' + this.product.productId + "&userId=" + this.userinfo.userId +"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,
+					type: 0, //0-正式版; 1-测试版; 2-体验版。 默认值为0。
+					webUrl: "http://uniapp.dcloud.io"
+				},
+				success: function(res) {
+					uni.showToast({
+						title: "分享成功",
+						icon: 'none'
+					});
+				},
+				fail: function(err) {
+					// 此处是调起微信分享失败的回调
+				},
+				complete: (e) => {
+					console.log("WXSceneSession", e)
+				}
+			});
+			//#endif
+			},
 			getuser() {
 				getUserInfo().then(
 					res => {

+ 4 - 0
pages_company/storeOrder.vue

@@ -89,6 +89,10 @@
 				},
 				// 列表数据
 				dataList: [],
+				downOption: {
+					auto: false, 
+					use:true,
+				},
 			};
 		},
 		onLoad(options) {

+ 4 - 22
pages_company/storeProductPackageDetails.vue

@@ -26,10 +26,10 @@
 					<text class="old" v-if="package!=null">¥{{package.money.toFixed(2)}}</text>
 				</view>
 			</view>
-			<view class="name-box">
+			<view v-if="package!=null" class="name-box">
 				{{package.title || ''}}
 			</view>
-			<view class="intro">
+			<view v-if="package!=null" class="intro">
 				{{package.descs || ''}}
 			</view>
 		</view>
@@ -66,7 +66,7 @@
 			<!-- <view class="inner">
 				<view  v-html="package.content" style="font-size:0" ></view>
 			</view> -->
-			<view v-html="package.content"></view>
+			<view v-if="package!=null" v-html="package.content"></view>
 		</view>
 		<!-- 底部按钮 -->
 		<view class="btn-foot">
@@ -76,7 +76,7 @@
 					</image>
 					<text class="label">首页</text>
 				</view>
-				<view class="item" style="position: relative;">
+				<view v-if="false" class="item" style="position: relative;">
 					<image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/consult_small.png" mode="">
 					</image>
 					<text class="label">咨询</text>
@@ -142,24 +142,6 @@
 			// })
 
 
-		},
-		//发送给朋友
-		onShareAppMessage(res) {
-			return {
-				title: this.package && this.package.title || '',
-				path: `/pages_company/storeProductPackageDetails?packageId=${this.package.packageId}` + "&companyId=" +
-					this.companyId + "&companyUserId=" + this.companyUserId,
-				imageUrl: this.package.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
-			}
-		},
-		//分享到朋友圈
-		onShareTimeline(res) {
-			return {
-				title: this.package && this.package.title || '',
-				query: 'packageId=' + this.package.packageId + "&companyId=" + this.companyId + "&companyUserId=" + this
-					.companyUserId, //页面参数
-				imageUrl: this.package.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
-			}
 		},
 		onShow() {
 			console.log("onshow")

+ 1 - 11
pages_shopping/shopping/confirmCreateOrder.vue

@@ -301,17 +301,7 @@
 					});
 					return;
 				}
-				
-				uni.requestSubscribeMessage({
-					tmplIds: this.temps,
-					success(res) {
-						 that.createOrder();
-					},
-					fail(res) {
-						that.createOrder();
-					}
-				})
-				
+				this.createOrder();			
 			},
 			createOrder(){
 				var that=this;

+ 1 - 9
pages_shopping/shopping/confirmPackageOrder.vue

@@ -257,15 +257,7 @@
 					return;
 				}
 				
-				uni.requestSubscribeMessage({
-					tmplIds: this.temps,
-					success(res) {
-						 that.createPackageOrder();
-					},
-					fail(res) {
-						that.createPackageOrder();
-					}
-				})
+				this.createPackageOrder()
 				
 				
 			},