Browse Source

2021-12-20

cmy 4 years ago
parent
commit
e70ca968f9
8 changed files with 1116 additions and 1001 deletions
  1. 493 438
      pages/cart/cart.vue
  2. 205 184
      pages/category/category.vue
  3. 14 11
      pages/index/index.vue
  4. 1 2
      pages/money/pay.vue
  5. 341 313
      pages/money/pay1.vue
  6. 6 12
      pages/product/product.vue
  7. 26 15
      pages/user/user.vue
  8. 30 26
      utils/wxAuthorized.js

+ 493 - 438
pages/cart/cart.vue

@@ -5,7 +5,8 @@
 			<image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
 			<image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
 			<view v-if="hasLogin" class="empty-tips">
 			<view v-if="hasLogin" class="empty-tips">
 				空空如也
 				空空如也
-				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛></navigator>
+				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛>
+				</navigator>
 			</view>
 			</view>
 			<view v-else class="empty-tips">
 			<view v-else class="empty-tips">
 				空空如也
 				空空如也
@@ -27,15 +28,10 @@
 				<block v-for="(item, index) in cartList" :key="item.id">
 				<block v-for="(item, index) in cartList" :key="item.id">
 					<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
 					<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
 						<view class="image-wrapper">
 						<view class="image-wrapper">
-							<image
-								:src="item.productInfo.image"
-								:class="[item.loaded]"
-								mode="aspectFill"
-								lazy-load
-								@load="onImageLoad('cartList', index)"
-								@error="onImageError('cartList', index)"
-							></image>
-							<view class="iconfont iconroundcheckfill checkbox" :class="{ checked: item.checked }" @click="check('item', index)"></view>
+							<image :src="item.productInfo.image" :class="[item.loaded]" mode="aspectFill" lazy-load
+								@load="onImageLoad('cartList', index)" @error="onImageError('cartList', index)"></image>
+							<view class="iconfont iconroundcheckfill checkbox" :class="{ checked: item.checked }"
+								@click="check('item', index)"></view>
 						</view>
 						</view>
 						<view class="item-right">
 						<view class="item-right">
 							<text class="clamp title">{{ item.productInfo.store_name }}</text>
 							<text class="clamp title">{{ item.productInfo.store_name }}</text>
@@ -51,9 +47,9 @@
 								:index="index"
 								:index="index"
 								@eventChange="numberChange"
 								@eventChange="numberChange"
 							></uni-number-box> -->
 							></uni-number-box> -->
-							<view class="munbox flex" >
+							<view class="munbox flex">
 								<image src="../../static/icon/reduce.png" mode="" @click="reduce(item,index)"></image>
 								<image src="../../static/icon/reduce.png" mode="" @click="reduce(item,index)"></image>
-								<input type="number" :value="item.cart_num" disabled/>
+								<input type="number" :value="item.cart_num" disabled />
 								<image src="../../static/icon/add.png" mode="" @click="add(item)"></image>
 								<image src="../../static/icon/add.png" mode="" @click="add(item)"></image>
 							</view>
 							</view>
 						</view>
 						</view>
@@ -64,7 +60,8 @@
 			<!-- 底部菜单栏 -->
 			<!-- 底部菜单栏 -->
 			<view class="action-section">
 			<view class="action-section">
 				<view class="checkbox">
 				<view class="checkbox">
-					<view class="iconfont iconroundcheckfill icon-checked-box" @click="check('all')" :class="{ 'icon-checked': allChecked }"></view>
+					<view class="iconfont iconroundcheckfill icon-checked-box" @click="check('all')"
+						:class="{ 'icon-checked': allChecked }"></view>
 					<!-- <view class="clear-btn" @click="allChecked ? clearCart() : ''" :class="{ show: allChecked }"><text>清空</text></view> -->
 					<!-- <view class="clear-btn" @click="allChecked ? clearCart() : ''" :class="{ show: allChecked }"><text>清空</text></view> -->
 				</view>
 				</view>
 				<view class="total-box">
 				<view class="total-box">
@@ -81,474 +78,532 @@
 	</view>
 	</view>
 </template>
 </template>
 
 
-<script>	
-import { getCartList, getCartNum, cartDel } from '@/api/user.js';
-import { mapState } from 'vuex';
-import uniNumberBox from '@/components/uni-number-box.vue';
-import { saveUrl, interceptor } from '@/utils/loginUtils.js';
-export default {
-	components: {
-		uniNumberBox
-	},
-	data() {
-		return {
-			total: 0, //总价格
-			allChecked: false, //全选状态  true|false
-			empty: false, //空白页现实  true|false
-			cartList: [],
-			mer_id:0,//商户id
-		};
-	},
-	onShow() {
-		// 只有登录时才加载数据
-		if (this.hasLogin) {
-			this.loadData();
-		}
-		
-	},
-	watch: {
-		//显示空白页
-		cartList(e) {
-			let empty = e.length === 0 ? true : false;
-			if (this.empty !== empty) {
-				this.empty = empty;
+<script>
+	import {
+		getCartList,
+		getCartNum,
+		cartDel
+	} from '@/api/user.js';
+	import {
+		mapState
+	} from 'vuex';
+	import uniNumberBox from '@/components/uni-number-box.vue';
+	import {
+		saveUrl,
+		interceptor
+	} from '@/utils/loginUtils.js';
+	// #ifdef H5
+	import {
+		weixinObj,
+		shareLoad
+	} from '@/utils/wxAuthorized';
+	// #endif
+	export default {
+		components: {
+			uniNumberBox
+		},
+		data() {
+			return {
+				total: 0, //总价格
+				allChecked: false, //全选状态  true|false
+				empty: false, //空白页现实  true|false
+				cartList: [],
+				mer_id: 0, //商户id
+			};
+		},
+		onShow() {
+			// 只有登录时才加载数据
+			if (this.hasLogin) {
+				this.loadData();
 			}
 			}
-		}
-	},
-	computed: {
-		...mapState('user', ['hasLogin'])
-	},
-	methods: {
-		reduce(item,index) {
-			if(item.cart_num == 1) {
+
+		},
+		watch: {
+			//显示空白页
+			cartList(e) {
+				let empty = e.length === 0 ? true : false;
+				if (this.empty !== empty) {
+					this.empty = empty;
+				}
+			}
+		},
+		onLoad() {
+			// #ifdef H5
+			shareLoad();
+			// #endif
+		},
+		computed: {
+			...mapState('user', ['hasLogin'])
+		},
+		methods: {
+			reduce(item, index) {
+				if (item.cart_num == 1) {
+					uni.showModal({
+						content: '删除该商品?',
+						success: e => {
+							if (e.confirm) {
+								this.deleteCartItem(index)
+							}
+						}
+					});
+
+				} else {
+					item.cart_num--
+					this.newNumberChange(item)
+				}
+			},
+			add(item) {
+				console.log(item)
+				if (item.productInfo.stock > item.cart_num) {
+					item.cart_num++
+					this.newNumberChange(item)
+				} else {
+					return
+				}
+			},
+			//请求数据
+			async loadData() {
+				let obj = this;
+				getCartList({})
+					.then(function(e) {
+						// 获取当前购物车物品增加数量
+						let nub = obj.cartList.length;
+						// 获取之前对象数组
+						let aArray = obj.cartList.reverse();
+						// 获取返回数据对象数组
+						let bArray = e.data.valid.reverse();
+						obj.cartList = bArray
+							.map((item, ind) => {
+								// 设置返回数据默认为勾选状态
+								item.checked = true;
+								// 获取相同数组之前对象的数据
+								let carlist = aArray[ind];
+								// 判断之前是否已经加载完毕
+								if (carlist && carlist.loaded == 'loaded') {
+									item.loaded = 'loaded';
+								}
+								return item;
+							})
+							.reverse();
+						obj.calcTotal(); //计算总价
+					})
+					.catch(function(e) {
+						console.log(e);
+					});
+			},
+			//监听image加载完成
+			onImageLoad(key, index) {
+				// 修改载入完成后图片class样式
+				this.$set(this[key][index], 'loaded', 'loaded');
+			},
+			//监听image加载失败
+			onImageError(key, index) {
+				this[key][index].image = '/static/error/errorImage.jpg';
+			},
+			// 跳转到登录页
+			navToLogin() {
+				// 保存地址
+				saveUrl();
+				// 登录拦截
+				interceptor();
+			},
+			//选中状态处理
+			check(type, index) {
+				if (type === 'item') {
+					this.cartList[index].checked = !this.cartList[index].checked;
+				} else {
+					const checked = !this.allChecked;
+					const list = this.cartList;
+					list.forEach(item => {
+						item.checked = checked;
+					});
+					this.allChecked = checked;
+				}
+				this.calcTotal(type);
+			},
+			//数量
+			numberChange(data) {
+				let arr = this.cartList[data.index];
+				arr.cart_num = data.number;
+				getCartNum({
+						id: arr.id,
+						number: data.number
+					})
+					.then(e => {
+						console.log(e);
+					})
+					.catch(function(e) {
+						console.log(e);
+					});
+				this.calcTotal();
+			},
+			newNumberChange(item) {
+				getCartNum({
+						id: item.id,
+						number: item.cart_num
+					})
+					.then(e => {
+						console.log(e);
+					})
+					.catch(function(e) {
+						console.log(e);
+					});
+				this.calcTotal();
+			},
+			//删除
+			deleteCartItem(index) {
+				let list = this.cartList;
+				let row = list[index];
+				let id = row.id;
+				cartDel({
+					ids: id
+				});
+				this.cartList.splice(index, 1);
+				uni.hideLoading();
+				this.calcTotal();
+			},
+			//清空
+			clearCart() {
 				uni.showModal({
 				uni.showModal({
-					content: '删除该商品?',
+					content: '清空购物车?',
 					success: e => {
 					success: e => {
 						if (e.confirm) {
 						if (e.confirm) {
-							this.deleteCartItem(index)
+							let st = this.cartList.map(e => {
+								return e.id;
+							});
+							cartDel({
+								ids: st.join(',')
+							}).then(e => {
+								console.log(e);
+							});
+							this.cartList = [];
 						}
 						}
 					}
 					}
 				});
 				});
-				
-			}else {
-				item.cart_num--
-				this.newNumberChange(item)
-			}
-		},
-		add(item) {
-			console.log(item)
-			if(item.productInfo.stock > item.cart_num) {
-				item.cart_num++
-				this.newNumberChange(item)
-			}else {
-				return 
-			}
-		},
-		//请求数据
-		async loadData() {
-			let obj = this;
-			getCartList({})
-				.then(function(e) {
-					// 获取当前购物车物品增加数量
-					let nub = obj.cartList.length;
-					// 获取之前对象数组
-					let aArray = obj.cartList.reverse();
-					// 获取返回数据对象数组
-					let bArray = e.data.valid.reverse();
-					obj.cartList = bArray
-						.map((item, ind) => {
-							// 设置返回数据默认为勾选状态
-							item.checked = true;
-							// 获取相同数组之前对象的数据
-							let carlist = aArray[ind];
-							// 判断之前是否已经加载完毕
-							if (carlist && carlist.loaded == 'loaded') {
-								item.loaded = 'loaded';
-							}
-							return item;
-						})
-						.reverse();
-					obj.calcTotal(); //计算总价
-				})
-				.catch(function(e) {
-					console.log(e);
-				});
-		},
-		//监听image加载完成
-		onImageLoad(key, index) {
-			// 修改载入完成后图片class样式
-			this.$set(this[key][index], 'loaded', 'loaded');
-		},
-		//监听image加载失败
-		onImageError(key, index) {
-			this[key][index].image = '/static/error/errorImage.jpg';
-		},
-		// 跳转到登录页
-		navToLogin() {
-			// 保存地址
-			saveUrl();
-			// 登录拦截
-			interceptor();
-		},
-		//选中状态处理
-		check(type, index) {
-			if (type === 'item') {
-				this.cartList[index].checked = !this.cartList[index].checked;
-			} else {
-				const checked = !this.allChecked;
-				const list = this.cartList;
+			},
+			//计算总价
+			calcTotal() {
+				let list = this.cartList;
+				if (list.length === 0) {
+					this.empty = true;
+					return;
+				}
+				let total = 0;
+				let checked = true;
 				list.forEach(item => {
 				list.forEach(item => {
-					item.checked = checked;
+					if (item.checked === true) {
+						total += item.productInfo.price * item.cart_num;
+					} else if (checked === true) {
+						checked = false;
+					}
 				});
 				});
 				this.allChecked = checked;
 				this.allChecked = checked;
-			}
-			this.calcTotal(type);
-		},
-		//数量
-		numberChange(data) {
-			let arr = this.cartList[data.index];
-			arr.cart_num = data.number;
-			getCartNum({ id: arr.id, number: data.number })
-				.then(e => {
-					console.log(e);
-				})
-				.catch(function(e) {
-					console.log(e);
+				this.total = Number(total.toFixed(2));
+			},
+			//创建订单
+			createOrder() {
+				let list = this.cartList;
+				let goodsData = [];
+				list.forEach(item => {
+					console.log(item, '7777')
+					if (item.checked) {
+						goodsData.push(item.id);
+					}
 				});
 				});
-			this.calcTotal();
-		},
-		newNumberChange(item) {
-			getCartNum({ id: item.id, number: item.cart_num })
-				.then(e => {
-					console.log(e);
-				})
-				.catch(function(e) {
-					console.log(e);
+
+				uni.navigateTo({
+					url: '/pages/order/createOrder?id=' + goodsData.join(',')
 				});
 				});
-			this.calcTotal();
-		},
-		//删除
-		deleteCartItem(index) {
-			let list = this.cartList;
-			let row = list[index];
-			let id = row.id;
-			cartDel({
-				ids: id
-			});
-			this.cartList.splice(index, 1);
-			uni.hideLoading();
-			this.calcTotal();
-		},
-		//清空
-		clearCart() {
-			uni.showModal({
-				content: '清空购物车?',
-				success: e => {
-					if (e.confirm) {
-						let st = this.cartList.map(e => {
-							return e.id;
-						});
-						cartDel({
-							ids: st.join(',')
-						}).then(e => {
-							console.log(e);
-						});
-						this.cartList = [];
-					}
-				}
-			});
-		},
-		//计算总价
-		calcTotal() {
-			let list = this.cartList;
-			if (list.length === 0) {
-				this.empty = true;
-				return;
 			}
 			}
-			let total = 0;
-			let checked = true;
-			list.forEach(item => {
-				if (item.checked === true) {
-					total += item.productInfo.price * item.cart_num;
-				} else if (checked === true) {
-					checked = false;
-				}
-			});
-			this.allChecked = checked;
-			this.total = Number(total.toFixed(2));
-		},
-		//创建订单
-		createOrder() {
-			let list = this.cartList;
-			let goodsData = [];
-			list.forEach(item => {
-				console.log(item,'7777')
-				if (item.checked) {
-					goodsData.push(item.id);
-				}
-			});
-
-			uni.navigateTo({
-				url: '/pages/order/createOrder?id=' + goodsData.join(',')
-			});
 		}
 		}
-	}
-};
+	};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
-.container {
-	padding-bottom: 134rpx;
-	background-color: $page-color-base;
+	.container {
+		padding-bottom: 134rpx;
+		background-color: $page-color-base;
+	
 	/* 空白页 */
 	/* 空白页 */
-	.empty {
-		position: fixed;
-		left: 0;
-		top: 0;
-		width: 100%;
-		height: 100vh;
-		padding-bottom: 100rpx;
-		display: flex;
-		justify-content: center;
-		flex-direction: column;
-		align-items: center;
-		background: #fff;
-		.emptyImg {
-			width: 300rpx;
-			height: 250rpx;
-			margin-bottom: 30rpx;
-		}
-		.empty-tips {
+		.empty {
+			position: fixed;
+			left: 0;
+			top: 0;
+			width: 100%;
+			height: 100vh;
+			padding-bottom: 100rpx;
 			display: flex;
 			display: flex;
-			font-size: $font-sm + 2rpx;
-			color: $font-color-disabled;
-			.navigator {
-				color: $uni-color-primary;
-				margin-left: 16rpx;
+			justify-content: center;
+			flex-direction: column;
+			align-items: center;
+			background: #fff;
+
+			.emptyImg {
+				width: 300rpx;
+				height: 250rpx;
+				margin-bottom: 30rpx;
+			}
+
+			.empty-tips {
+				display: flex;
+				font-size: $font-sm + 2rpx;
+				color: $font-color-disabled;
+
+				.navigator {
+					color: $uni-color-primary;
+					margin-left: 16rpx;
+				}
 			}
 			}
 		}
 		}
 	}
 	}
-}
-/* 购物车列表项 */
-.cart-item {
-	width: 710rpx;
-	height: 210rpx;
-	background: #FFFFFF;
-	box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
-	border-radius: 10rpx;
-	margin: 20rpx auto;
-	
-	display: flex;
-	position: relative;
-	padding: 30rpx 26rpx 30rpx 80rpx;
-	.image-wrapper {
-		width: 150rpx;
-		height: 150rpx;
-		flex-shrink: 0;
-		position: relative;
-		image {
-			border-radius: 8rpx;
-		}
-	}
-	.checkbox {
-		position: absolute;
-		top: 0;
-		bottom: 0;
-		left: -65rpx;
-		margin: auto 0;
-		height: 50rpx;
-		z-index: 8;
-		font-size: 44rpx;
-		line-height: 1;
-		padding: 4rpx;
-		color: $font-color-disabled;
-		background: #fff;
-		border-radius: 50px;
-	}
-	.item-right {
+
+	/* 购物车列表项 */
+	.cart-item {
+		width: 710rpx;
+		height: 210rpx;
+		background: #FFFFFF;
+		box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
+		border-radius: 10rpx;
+		margin: 20rpx auto;
+
 		display: flex;
 		display: flex;
-		flex-direction: column;
-		flex: 1;
-		overflow: hidden;
 		position: relative;
 		position: relative;
-		padding-left: 30rpx;
-		.munbox {
-			width: 144rpx;
-			height: 44rpx;
-			position: absolute;
-			bottom: 0;
-			right: 0;
-			input {
-				display: inline-block;
-				text-align: center;
-			}
+		padding: 30rpx 26rpx 30rpx 80rpx;
+
+		.image-wrapper {
+			width: 150rpx;
+			height: 150rpx;
+			flex-shrink: 0;
+			position: relative;
+
 			image {
 			image {
-				flex-shrink: 0;
-				width: 44rpx;
-				height: 44rpx;
+				border-radius: 8rpx;
 			}
 			}
 		}
 		}
-		.title,
-		.price {
-			font-size: $font-base + 2rpx;
-			color: $font-color-dark;
-			height: 40rpx;
-			line-height: 40rpx;
-		}
-		.attr {
-			font-size: $font-sm + 2rpx;
-			color: $font-color-light;
+
+		.checkbox {
+			position: absolute;
+			top: 0;
+			bottom: 0;
+			left: -65rpx;
+			margin: auto 0;
 			height: 50rpx;
 			height: 50rpx;
-			line-height: 50rpx;
-			
-			font-size: 26rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #999999;
-		}
-		.price {
-			// height: 50rpx;
-			// line-height: 50rpx;
-			padding-top: 20rpx;
-			font-size: 34rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #FF4C4C;
+			z-index: 8;
+			font-size: 44rpx;
+			line-height: 1;
+			padding: 4rpx;
+			color: $font-color-disabled;
+			background: #fff;
+			border-radius: 50px;
 		}
 		}
-		.step {
-			margin-top: 20rpx;
+
+		.item-right {
+			display: flex;
+			flex-direction: column;
+			flex: 1;
+			overflow: hidden;
+			position: relative;
+			padding-left: 30rpx;
+
+			.munbox {
+				width: 144rpx;
+				height: 44rpx;
+				position: absolute;
+				bottom: 0;
+				right: 0;
+
+				input {
+					display: inline-block;
+					text-align: center;
+				}
+
+				image {
+					flex-shrink: 0;
+					width: 44rpx;
+					height: 44rpx;
+				}
+			}
+
+			.title,
+			.price {
+				font-size: $font-base + 2rpx;
+				color: $font-color-dark;
+				height: 40rpx;
+				line-height: 40rpx;
+			}
+
+			.attr {
+				font-size: $font-sm + 2rpx;
+				color: $font-color-light;
+				height: 50rpx;
+				line-height: 50rpx;
+
+				font-size: 26rpx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #999999;
+			}
+
+			.price {
+				// height: 50rpx;
+				// line-height: 50rpx;
+				padding-top: 20rpx;
+				font-size: 34rpx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #FF4C4C;
+			}
+
+			.step {
+				margin-top: 20rpx;
+			}
+
+			.title {
+				font-size: 34rpx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #333333;
+			}
 		}
 		}
-		.title {
+
+		.del-btn {
+			padding: 4rpx 10rpx;
 			font-size: 34rpx;
 			font-size: 34rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #333333;
-		}
-	}
-	.del-btn {
-		padding: 4rpx 10rpx;
-		font-size: 34rpx;
-		height: 50rpx;
-		color: $font-color-light;
-	}
-}
-/* 底部栏 */
-.action-section {
-	/* #ifdef H5 */
-	margin-bottom: 100rpx;
-	/* #endif */
-	position: fixed;
-	left: 30rpx;
-	bottom: 30rpx;
-	z-index: 95;
-	display: flex;
-	align-items: center;
-	width: 690rpx;
-	height: 100rpx;
-	padding: 0 30rpx;
-	background: rgba(255, 255, 255, 0.9);
-	box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
-	border-radius: 16rpx;
-	.checkbox {
-		height: 52rpx;
-		position: relative;
-		.icon-checked-box {
-			border-radius: 50rpx;
-			background-color: #ffffff;
-			width: 52rpx;
-			height: 100%;
-			position: relative;
-			z-index: 5;
-			font-size: 53rpx;
-			line-height: 1;
+			height: 50rpx;
 			color: $font-color-light;
 			color: $font-color-light;
 		}
 		}
-		.icon-checked {
-			color: $base-color;
-		}
-	}
-	.clear-btn {
-		position: absolute;
-		left: 26rpx;
-		top: 0;
-		z-index: 4;
-		width: 0;
-		height: 52rpx;
-		line-height: 52rpx;
-		padding-left: 38rpx;
-		font-size: $font-base;
-		color: #fff;
-		background: $font-color-disabled;
-		border-radius: 0 50px 50px 0;
-		opacity: 0;
-		transition: 0.2s;
-		&.show {
-			opacity: 1;
-			width: 120rpx;
-		}
 	}
 	}
-	.total-box {
-		flex: 1;
+
+	/* 底部栏 */
+	.action-section {
+		/* #ifdef H5 */
+		margin-bottom: 100rpx;
+		/* #endif */
+		position: fixed;
+		left: 30rpx;
+		bottom: 30rpx;
+		z-index: 95;
 		display: flex;
 		display: flex;
-		flex-direction: column;
-		text-align: right;
-		padding-right: 40rpx;
-		
-		.price {
-			font-size: $font-lg;
-			color: $font-color-dark;
+		align-items: center;
+		width: 690rpx;
+		height: 100rpx;
+		padding: 0 30rpx;
+		background: rgba(255, 255, 255, 0.9);
+		box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
+		border-radius: 16rpx;
+
+		.checkbox {
+			height: 52rpx;
+			position: relative;
+
+			.icon-checked-box {
+				border-radius: 50rpx;
+				background-color: #ffffff;
+				width: 52rpx;
+				height: 100%;
+				position: relative;
+				z-index: 5;
+				font-size: 53rpx;
+				line-height: 1;
+				color: $font-color-light;
+			}
+
+			.icon-checked {
+				color: $base-color;
+			}
 		}
 		}
-		.coupon {
-			font-size: $font-sm;
-			color: $font-color-light;
-			text {
+
+		.clear-btn {
+			position: absolute;
+			left: 26rpx;
+			top: 0;
+			z-index: 4;
+			width: 0;
+			height: 52rpx;
+			line-height: 52rpx;
+			padding-left: 38rpx;
+			font-size: $font-base;
+			color: #fff;
+			background: $font-color-disabled;
+			border-radius: 0 50px 50px 0;
+			opacity: 0;
+			transition: 0.2s;
+
+			&.show {
+				opacity: 1;
+				width: 120rpx;
+			}
+		}
+
+		.total-box {
+			flex: 1;
+			display: flex;
+			flex-direction: column;
+			text-align: right;
+			padding-right: 40rpx;
+
+			.price {
+				font-size: $font-lg;
 				color: $font-color-dark;
 				color: $font-color-dark;
 			}
 			}
+
+			.coupon {
+				font-size: $font-sm;
+				color: $font-color-light;
+
+				text {
+					color: $font-color-dark;
+				}
+			}
 		}
 		}
-	}
+	
 	.confirm-btn {
 	.confirm-btn {
-		padding: 0 38rpx;
-		margin: 0;
-		border-radius: 100px;
-		height: 76rpx;
-		line-height: 76rpx;
-		font-size: $font-base + 2rpx;
-		background: $base-color;
-	}
-}
-/* 复选框选中状态 */
-.action-section .checkbox.checked,
-.cart-item .checkbox.checked {
-	color: $base-color;
-}
-.cart-hand {
-	width: 750rpx;
-	height: 88rpx;
-	background: #FFFFFF;
-	font-size: 30rpx;
-	font-family: PingFang SC;
-	font-weight: bold;
-	color: #333333;
-	line-height: 88rpx;
-	padding-left: 28rpx;
-	padding-right: 26rpx;
-	.hand-tit {
-		text {
-			color: #FF4C4C;
+			padding: 0 38rpx;
+			margin: 0;
+			border-radius: 100px;
+			height: 76rpx;
+			line-height: 76rpx;
+			font-size: $font-base + 2rpx;
+			background: $base-color;
 		}
 		}
-	
 	}
 	}
-	.hand-btn {
-		width: 164rpx;
-		height: 62rpx;
-		border: 2rpx solid #FF4C4C;
-		border-radius: 31rpx;
-		font-size: 26rpx;
+
+	/* 复选框选中状态 */
+	.action-section .checkbox.checked,
+	.cart-item .checkbox.checked {
+		color: $base-color;
+	}
+
+	.cart-hand {
+		width: 750rpx;
+		height: 88rpx;
+		background: #FFFFFF;
+		font-size: 30rpx;
 		font-family: PingFang SC;
 		font-family: PingFang SC;
 		font-weight: bold;
 		font-weight: bold;
-		color: #FF4C4C;
-		line-height: 62rpx;
-		text-align: center;
+		color: #333333;
+		line-height: 88rpx;
+		padding-left: 28rpx;
+		padding-right: 26rpx;
+
+		.hand-tit {
+			text {
+				color: #FF4C4C;
+			}
+
+		}
+
+		.hand-btn {
+			width: 164rpx;
+			height: 62rpx;
+			border: 2rpx solid #FF4C4C;
+			border-radius: 31rpx;
+			font-size: 26rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FF4C4C;
+			line-height: 62rpx;
+			text-align: center;
+		}
 	}
 	}
-}
 </style>
 </style>

+ 205 - 184
pages/category/category.vue

@@ -1,13 +1,16 @@
 <template>
 <template>
 	<view class="content">
 	<view class="content">
 		<scroll-view scroll-y class="left-aside">
 		<scroll-view scroll-y class="left-aside">
-			<view v-for="item in flist" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }" @click="tabtap(item)">{{ item.cate_name }}</view>
+			<view v-for="item in flist" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }"
+				@click="tabtap(item)">{{ item.cate_name }}</view>
 		</scroll-view>
 		</scroll-view>
-		<scroll-view scroll-with-animation scroll-y class="right-aside" @scroll="asideScroll" :scroll-top="tabScrollTop">
+		<scroll-view scroll-with-animation scroll-y class="right-aside" @scroll="asideScroll"
+			:scroll-top="tabScrollTop">
 			<view v-for="item in flist" :key="item.id" class="s-list" :id="'main-' + item.id">
 			<view v-for="item in flist" :key="item.id" class="s-list" :id="'main-' + item.id">
 				<text class="s-item">{{ item.cate_name }}</text>
 				<text class="s-item">{{ item.cate_name }}</text>
 				<view class="t-list ">
 				<view class="t-list ">
-					<view @click="navToList(item.id, titem.id)" class="t-item" v-for="titem in item.children" :key="titem.id">
+					<view @click="navToList(item.id, titem.id)" class="t-item" v-for="titem in item.children"
+						:key="titem.id">
 						<image :src="titem.pic"></image>
 						<image :src="titem.pic"></image>
 						<text>{{ titem.cate_name }}</text>
 						<text>{{ titem.cate_name }}</text>
 					</view>
 					</view>
@@ -18,203 +21,221 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getCategoryList } from '@/api/product.js';
-export default {
-	data() {
-		return {
-			sizeCalcState: false,
-			tabScrollTop: 0,
-			currentId: 9,
-			flist: [],
-			mer_id:0,//商户id
-		};
-	},
-	onLoad() {
-		this.loadData();
-		
-	},
-	// 监听导航栏输入框点击事件
-	onNavigationBarSearchInputClicked(e) {
-		uni.navigateTo({
-			url: '/pages/product/search'
-		});
-	},
-	methods: {
-		// 载入数据
-		async loadData() {
-			let obj = this;
-			getCategoryList({})
-				.then(({ data }) => {
-					obj.flist = data.map(function(s) {
-						return s;
-					});
-				})
-				.catch(err => {
-					console.log(err);
-				});
+	import {
+		getCategoryList
+	} from '@/api/product.js';
+	// #ifdef H5
+	import {
+		weixinObj,
+		shareLoad
+	} from '@/utils/wxAuthorized';
+	// #endif
+	export default {
+		data() {
+			return {
+				sizeCalcState: false,
+				tabScrollTop: 0,
+				currentId: 9,
+				flist: [],
+				mer_id: 0, //商户id
+			};
 		},
 		},
-		//一级分类点击
-		tabtap(item) {
-			console.log(item);
-			// 判断有没有初始化页面高度对象数据
-			if (!this.sizeCalcState) {
-				this.calcSize();
-			}
-			// 获取当前点击的id
-			this.currentId = item.id;
-			console.log(item.top);
-			this.tabScrollTop = item.top;
-			console.log(this.tabScrollTop);
+		onLoad() {
+			this.loadData();
+			// #ifdef H5
+			shareLoad();
+			// #endif
 		},
 		},
-		//右侧栏滚动
-		asideScroll(e) {
-			// 判断有没有初始化页面高度对象数据
-			if (!this.sizeCalcState) {
-				this.calcSize();
-			}
-			let scrollTop = e.detail.scrollTop;
-			let box = 0; //列表包裹框高度初始化
-			let bottom = 10; //距离页面底部多少像素左侧列表切换到最后一个一级分类
-			// 查询当前页面对象
-			let view = uni.createSelectorQuery().select('.content');
-			view.fields(
-				{
-					id: true,
-					dataset: true,
-					rect: true,
-					size: true,
-					scrollOffset: true
-				},
-				function(e) {
-					// 保存包裹框高度
-					box = e.height;
+		// 监听导航栏输入框点击事件
+		onNavigationBarSearchInputClicked(e) {
+			uni.navigateTo({
+				url: '/pages/product/search'
+			});
+		},
+		methods: {
+			// 载入数据
+			async loadData() {
+				let obj = this;
+				getCategoryList({})
+					.then(({
+						data
+					}) => {
+						obj.flist = data.map(function(s) {
+							return s;
+						});
+					})
+					.catch(err => {
+						console.log(err);
+					});
+			},
+			//一级分类点击
+			tabtap(item) {
+				console.log(item);
+				// 判断有没有初始化页面高度对象数据
+				if (!this.sizeCalcState) {
+					this.calcSize();
 				}
 				}
-			).exec();
-			// 获取所有距离顶部大于滚轮距离页面高度的所有分类
-			let tabs = this.flist.filter(item =>( item.top-10) <= scrollTop).reverse();
-			if (tabs.length > 0) {
-				// 判断是否已经到达滚轮底部
-				if (box + scrollTop + bottom >= e.detail.scrollHeight) {
-					this.currentId = this.flist[this.flist.length - 1].id;
-				} else {
-					this.currentId = tabs[0].id;
+				// 获取当前点击的id
+				this.currentId = item.id;
+				console.log(item.top);
+				this.tabScrollTop = item.top;
+				console.log(this.tabScrollTop);
+			},
+			//右侧栏滚动
+			asideScroll(e) {
+				// 判断有没有初始化页面高度对象数据
+				if (!this.sizeCalcState) {
+					this.calcSize();
 				}
 				}
-			}
-		},
-		//计算右侧栏每个tab的高度等信息
-		calcSize() {
-			let h = 0;
-			this.flist.forEach(item => {
-				let view = uni.createSelectorQuery().select('#main-' + item.id);
-				view.fields(
-					{
-						size: true
+				let scrollTop = e.detail.scrollTop;
+				let box = 0; //列表包裹框高度初始化
+				let bottom = 10; //距离页面底部多少像素左侧列表切换到最后一个一级分类
+				// 查询当前页面对象
+				let view = uni.createSelectorQuery().select('.content');
+				view.fields({
+						id: true,
+						dataset: true,
+						rect: true,
+						size: true,
+						scrollOffset: true
 					},
 					},
-					data => {
-						item.top = h;
-						h += data.height;
-						item.bottom = h;
+					function(e) {
+						// 保存包裹框高度
+						box = e.height;
 					}
 					}
 				).exec();
 				).exec();
-			});
-			this.sizeCalcState = true;
-		},
-		navToList(sid, tid) {
-			// 点击导航跳转到详细页面
-			uni.navigateTo({
-				url: '/pages/product/list?fid='+this.currentId+'&sid='+sid+'&tid='+tid
-			});
+				// 获取所有距离顶部大于滚轮距离页面高度的所有分类
+				let tabs = this.flist.filter(item => (item.top - 10) <= scrollTop).reverse();
+				if (tabs.length > 0) {
+					// 判断是否已经到达滚轮底部
+					if (box + scrollTop + bottom >= e.detail.scrollHeight) {
+						this.currentId = this.flist[this.flist.length - 1].id;
+					} else {
+						this.currentId = tabs[0].id;
+					}
+				}
+			},
+			//计算右侧栏每个tab的高度等信息
+			calcSize() {
+				let h = 0;
+				this.flist.forEach(item => {
+					let view = uni.createSelectorQuery().select('#main-' + item.id);
+					view.fields({
+							size: true
+						},
+						data => {
+							item.top = h;
+							h += data.height;
+							item.bottom = h;
+						}
+					).exec();
+				});
+				this.sizeCalcState = true;
+			},
+			navToList(sid, tid) {
+				// 点击导航跳转到详细页面
+				uni.navigateTo({
+					url: '/pages/product/list?fid=' + this.currentId + '&sid=' + sid + '&tid=' + tid
+				});
+			}
 		}
 		}
-	}
-};
+	};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
-page,
-.content {
-	height: 100%;
-	background-color: #f8f8f8;
-}
+	page,
+	.content {
+		height: 100%;
+		background-color: #f8f8f8;
+	}
 
 
-.content {
-	display: flex;
-}
-.left-aside {
-	flex-shrink: 0;
-	width: 200rpx;
-	height: 100%;
-	background-color: #fff;
-}
-.f-item {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 100%;
-	height: 100rpx;
-	font-size: 28rpx;
-	color: $font-color-base;
-	position: relative;
-	&.active {
-		// color: $base-color;
-		color: #000;
-		font-weight: bold;
-		background: #f8f8f8;
-		&:before {
-			content: '';
-			position: absolute;
-			left: 0;
-			top: 50%;
-			transform: translateY(-50%);
-			height: 36rpx;
-			width: 8rpx;
-			background-color: $base-color;
-			border-radius: 0 4px 4px 0;
-			opacity: 0.8;
+	.content {
+		display: flex;
+	}
+
+	.left-aside {
+		flex-shrink: 0;
+		width: 200rpx;
+		height: 100%;
+		background-color: #fff;
+	}
+
+	.f-item {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		width: 100%;
+		height: 100rpx;
+		font-size: 28rpx;
+		color: $font-color-base;
+		position: relative;
+
+		&.active {
+			// color: $base-color;
+			color: #000;
+			font-weight: bold;
+			background: #f8f8f8;
+
+			&:before {
+				content: '';
+				position: absolute;
+				left: 0;
+				top: 50%;
+				transform: translateY(-50%);
+				height: 36rpx;
+				width: 8rpx;
+				background-color: $base-color;
+				border-radius: 0 4px 4px 0;
+				opacity: 0.8;
+			}
 		}
 		}
 	}
 	}
-}
 
 
-.right-aside {
-	flex: 1;
-	overflow: hidden;
-	padding-left: 20rpx;
-	padding-right: 20rpx;
-}
-.s-item {
-	display: flex;
-	align-items: center;
-	height: 70rpx;
-	padding-top: 8rpx;
-	font-size: 28rpx;
-	color: $font-color-dark;
-}
-.t-list {
-	display: flex;
-	flex-wrap: wrap;
-	border-radius: 15rpx;
-	width: 100%;
-	background: #fff;
-	padding-top: 12rpx;
-	&:after {
-		content: '';
-		flex: 99;
-		height: 0;
+	.right-aside {
+		flex: 1;
+		overflow: hidden;
+		padding-left: 20rpx;
+		padding-right: 20rpx;
 	}
 	}
-}
-.t-item {
-	flex-shrink: 0;
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	flex-direction: column;
-	width: 171rpx;
-	font-size: 26rpx;
-	color: #666;
-	padding-bottom: 20rpx;
 
 
-	image {
-		width: 140rpx;
-		height: 140rpx;
+	.s-item {
+		display: flex;
+		align-items: center;
+		height: 70rpx;
+		padding-top: 8rpx;
+		font-size: 28rpx;
+		color: $font-color-dark;
+	}
+
+	.t-list {
+		display: flex;
+		flex-wrap: wrap;
+		border-radius: 15rpx;
+		width: 100%;
+		background: #fff;
+		padding-top: 12rpx;
+
+		&:after {
+			content: '';
+			flex: 99;
+			height: 0;
+		}
+	}
+
+	.t-item {
+		flex-shrink: 0;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		flex-direction: column;
+		width: 171rpx;
+		font-size: 26rpx;
+		color: #666;
+		padding-bottom: 20rpx;
+
+		image {
+			width: 140rpx;
+			height: 140rpx;
+		}
 	}
 	}
-}
 </style>
 </style>

+ 14 - 11
pages/index/index.vue

@@ -1,18 +1,13 @@
 <template>
 <template>
 	<view class="container">
 	<view class="container">
 		<!-- 小程序头部兼容 -->
 		<!-- 小程序头部兼容 -->
-		<view class="lalala">
-
-		</view>
+		<view class="lalala"></view>
 		<view class="input-box flex" @click="clickSearch">
 		<view class="input-box flex" @click="clickSearch">
 			<view class=" input-content flex">
 			<view class=" input-content flex">
 				<view class="iconfont iconsearch"></view>
 				<view class="iconfont iconsearch"></view>
 				<view class="input"><input type="text" disabled placeholder="请输入搜索内容" /></view>
 				<view class="input"><input type="text" disabled placeholder="请输入搜索内容" /></view>
 			</view>
 			</view>
 		</view>
 		</view>
-		
-		
-
 		<!-- 头部轮播 -->
 		<!-- 头部轮播 -->
 		<view class="carousel-section">
 		<view class="carousel-section">
 			<!-- 标题栏和状态栏占位符 -->
 			<!-- 标题栏和状态栏占位符 -->
@@ -193,8 +188,8 @@
 	} from 'vuex';
 	} from 'vuex';
 	// #ifdef H5
 	// #ifdef H5
 	import {
 	import {
-		weixindata,
-		weixinlocation
+		weixinObj,
+		shareLoad
 	} from '@/utils/wxAuthorized';
 	} from '@/utils/wxAuthorized';
 	// #endif
 	// #endif
 
 
@@ -265,7 +260,7 @@
 			};
 			};
 		},
 		},
 		computed: {
 		computed: {
-			...mapState(['loginInterceptor', 'weichatObj', 'baseURL', 'urlFile']),
+			...mapState(['loginInterceptor', 'baseURL', 'urlFile']),
 			...mapState('user', ['hasLogin', 'userInfo']),
 			...mapState('user', ['hasLogin', 'userInfo']),
 			...mapState('latlon', ['lat', 'lon']),
 			...mapState('latlon', ['lat', 'lon']),
 			auth(){
 			auth(){
@@ -330,7 +325,9 @@
 				});
 				});
 			}
 			}
 			// #endif
 			// #endif
-
+			// #ifdef H5
+			shareLoad();
+			// #endif
 			// weixinObj.showAllNonBaseMenuItem();
 			// weixinObj.showAllNonBaseMenuItem();
 			// this.getaddress();
 			// this.getaddress();
 		},
 		},
@@ -856,7 +853,13 @@
 	}
 	}
 
 
 	.input-box {
 	.input-box {
-
+		/* #ifdef H5 */
+		position: fixed;
+		left: 0;
+		right: 0;
+		top: 0;
+		z-index: 99999;
+		/* #endif */
 		width: 100%;
 		width: 100%;
 		padding: 25rpx;
 		padding: 25rpx;
 		background-color: rgba(0, 0, 0, 0);
 		background-color: rgba(0, 0, 0, 0);

+ 1 - 2
pages/money/pay.vue

@@ -55,8 +55,7 @@
 	} from '@/api/user.js';
 	} from '@/api/user.js';
 
 
 	// #ifdef H5
 	// #ifdef H5
-
-	import weixinObj from '@/plugin/jweixin-module/index.js';
+	import weixinObj from '@/utils/wxAuthorized.js';
 	// #endif
 	// #endif
 	import {
 	import {
 		mapState,
 		mapState,

+ 341 - 313
pages/money/pay1.vue

@@ -11,13 +11,17 @@
 					<text class="tit">微信支付</text>
 					<text class="tit">微信支付</text>
 					<text>推荐使用微信支付</text>
 					<text>推荐使用微信支付</text>
 				</view>
 				</view>
-				<label class="radio"><radio value="" color="#ff4c4c" :checked="payType == 1"></radio></label>
+				<label class="radio">
+					<radio value="" color="#ff4c4c" :checked="payType == 1"></radio>
+				</label>
 			</view>
 			</view>
 			<!-- #ifdef APP-PLUS -->
 			<!-- #ifdef APP-PLUS -->
 			<view class="type-item b-b" @click="changePayType(2)">
 			<view class="type-item b-b" @click="changePayType(2)">
 				<text class="icon iconfont iconzhifubao"></text>
 				<text class="icon iconfont iconzhifubao"></text>
 				<view class="con"><text class="tit">支付宝支付</text></view>
 				<view class="con"><text class="tit">支付宝支付</text></view>
-				<label class="radio"><radio value="" color="#ff4c4c" :checked="payType == 2"></radio></label>
+				<label class="radio">
+					<radio value="" color="#ff4c4c" :checked="payType == 2"></radio>
+				</label>
 			</view>
 			</view>
 			<!-- #endif -->
 			<!-- #endif -->
 			<view class="type-item" @click="changePayType(3)">
 			<view class="type-item" @click="changePayType(3)">
@@ -26,7 +30,9 @@
 					<text class="tit">余额支付</text>
 					<text class="tit">余额支付</text>
 					<text>可用余额 ¥{{ now_money }}</text>
 					<text>可用余额 ¥{{ now_money }}</text>
 				</view>
 				</view>
-				<label class="radio"><radio value="" color="#ff4c4c" :checked="payType == 3"></radio></label>
+				<label class="radio">
+					<radio value="" color="#ff4c4c" :checked="payType == 3"></radio>
+				</label>
 			</view>
 			</view>
 		</view>
 		</view>
 		<text class="mix-btn" :class="{ clickbg: payLoding }" @click="!payLoding ? confirm() : ''">确认支付</text>
 		<text class="mix-btn" :class="{ clickbg: payLoding }" @click="!payLoding ? confirm() : ''">确认支付</text>
@@ -34,343 +40,365 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { balance } from '@/api/wallet.js';
-import { createOrderkey,computedOrderkey,orderPay } from '@/api/order.js';
-import { mapState } from 'vuex';
-export default {
-	data() {
-		return {
-			payType: 1, //支付类型
-			// #ifdef H5
-			payName: 'weixin',
-			// #endif
-			// #ifdef MP-WEIXIN
-			payName: 'weixin',
-			// #endif
-			orderInfo: {},
-			money: 0.0, //订单金额
-			now_money: 0.0, //余额
-			orderKey: '',
-			orderId: '', //保存订单id
-			payLoding: false, //判断是否支付中
-			type: '', //判断是否从订单中进入
-			// #ifdef H5
-			froms: '', //保存h5中数据来源对象
-			// #endif
-			pinkid: '', //保存拼团商品id
-			isdrop: 0
-		};
-	},
-	computed: {
-		// #ifdef H5
-		...mapState(['weichatObj'])
-		// #endif
-	},
-	onLoad(options) {
-		if(options.isdrop) {
-			this.isdrop = options.isdrop*1
-		}
-		if (options.type == 1) {
-			this.type = 1;
-			this.orderId = options.ordid;
-			this.money = options.money;
-		} else {
-			this.orderKey = options.key;
-			let prepage = this.$api.prePage();
-			computedOrderkey({
-				orderkey: this.orderKey,
-				couponId: prepage.couponChecked.id, //优惠券编号
-				addressId: prepage.addressData.id, //地址编号
-				useIntegral: prepage.checkedPoints ? 1 : 0,
-				is_drop: this.isdrop
-			}).then(({ data }) => {
-				// 获取支付金额
-				this.money = data.result.pay_price;
-			});
-		}
-		// 保存pinkid
-		if (options.pinkid) {
-			this.pinkid = options.pinkid;
-		}
-		// 载入余额
-		balance({}).then(({ data }) => {
-			// 获取余额
-			this.now_money = data.now_money;
-		});
-	},
-	methods: {
-		//选择支付方式
-		changePayType(type) {
-			this.payType = type;
-			if (this.payType == 1) {
-				this.payName = 'weixin';
-			}
-			if (this.payType == 2) {
-				this.payName = 'ali';
-			}
-			if (this.payType == 3) {
-				this.payName = 'yue';
-			}
-		},
-		// 支付金额
-		orderMoneyPay() {
-			let obj = this;
-			orderPay({
-				uni: obj.orderId,
+	import {
+		balance
+	} from '@/api/wallet.js';
+	import {
+		createOrderkey,
+		computedOrderkey,
+		orderPay
+	} from '@/api/order.js';
+	import {
+		mapState
+	} from 'vuex';
+	// #ifdef H5
+	import weixinObj from '@/utils/wxAuthorized.js';
+	// #endif
+	export default {
+		data() {
+			return {
+				payType: 1, //支付类型
 				// #ifdef H5
 				// #ifdef H5
-				from: obj.froms ? 'weixin' : 'H5', //来源
+				payName: 'weixin',
 				// #endif
 				// #endif
 				// #ifdef MP-WEIXIN
 				// #ifdef MP-WEIXIN
-				from: 'routine', //来源
+				payName: 'weixin',
 				// #endif
 				// #endif
-				// #ifdef APP-PLUS
-				from: 'app', //来源
+				orderInfo: {},
+				money: 0.0, //订单金额
+				now_money: 0.0, //余额
+				orderKey: '',
+				orderId: '', //保存订单id
+				payLoding: false, //判断是否支付中
+				type: '', //判断是否从订单中进入
+				// #ifdef H5
+				froms: '', //保存h5中数据来源对象
 				// #endif
 				// #endif
-				paytype: obj.payName //支付类型  weixin-微信 yue-余额
-			})
-				.then(e => {
-					// 判断是否为余额支付
-					if (obj.payName == 'yue' && e.data.status == 'SUCCESS') {
-						if (e.status == 200) {
-							obj.paySuccessTo();
-						} else {
-							obj.$api.msg(msg);
+				pinkid: '', //保存拼团商品id
+				isdrop: 0
+			};
+		},
+		onLoad(options) {
+			if (options.isdrop) {
+				this.isdrop = options.isdrop * 1
+			}
+			if (options.type == 1) {
+				this.type = 1;
+				this.orderId = options.ordid;
+				this.money = options.money;
+			} else {
+				this.orderKey = options.key;
+				let prepage = this.$api.prePage();
+				computedOrderkey({
+					orderkey: this.orderKey,
+					couponId: prepage.couponChecked.id, //优惠券编号
+					addressId: prepage.addressData.id, //地址编号
+					useIntegral: prepage.checkedPoints ? 1 : 0,
+					is_drop: this.isdrop
+				}).then(({
+					data
+				}) => {
+					// 获取支付金额
+					this.money = data.result.pay_price;
+				});
+			}
+			// 保存pinkid
+			if (options.pinkid) {
+				this.pinkid = options.pinkid;
+			}
+			// 载入余额
+			balance({}).then(({
+				data
+			}) => {
+				// 获取余额
+				this.now_money = data.now_money;
+			});
+		},
+		methods: {
+			//选择支付方式
+			changePayType(type) {
+				this.payType = type;
+				if (this.payType == 1) {
+					this.payName = 'weixin';
+				}
+				if (this.payType == 2) {
+					this.payName = 'ali';
+				}
+				if (this.payType == 3) {
+					this.payName = 'yue';
+				}
+			},
+			// 支付金额
+			orderMoneyPay() {
+				let obj = this;
+				orderPay({
+						uni: obj.orderId,
+						// #ifdef H5
+						from: obj.froms ? 'weixin' : 'H5', //来源
+						// #endif
+						// #ifdef MP-WEIXIN
+						from: 'routine', //来源
+						// #endif
+						// #ifdef APP-PLUS
+						from: 'app', //来源
+						// #endif
+						paytype: obj.payName //支付类型  weixin-微信 yue-余额
+					})
+					.then(e => {
+						// 判断是否为余额支付
+						if (obj.payName == 'yue' && e.data.status == 'SUCCESS') {
+							if (e.status == 200) {
+								obj.paySuccessTo();
+							} else {
+								obj.$api.msg(msg);
+							}
 						}
 						}
-					}
-					if (obj.payName == 'weixin' || obj.payName == 'routine') {
-						let da = e.data.result.jsConfig;
-						let data = {
+						if (obj.payName == 'weixin' || obj.payName == 'routine') {
+							let da = e.data.result.jsConfig;
+							let data = {
+								// #ifdef H5
+								timestamp: da.timestamp,
+								// #endif
+								// #ifdef MP
+								timeStamp: da.timestamp,
+								// #endif
+								nonceStr: da.nonceStr,
+								package: da.package,
+								signType: da.signType,
+								paySign: da.paySign,
+								success: function(res) {
+									obj.paySuccessTo();
+								},
+								fail: () => {
+									uni.navigateTo({
+										url: '/pages/order/order?state=0'
+									});
+								}
+							};
 							// #ifdef H5
 							// #ifdef H5
-							timestamp: da.timestamp,
-							// #endif
-							// #ifdef MP
-							timeStamp: da.timestamp,
+							if (obj.payName == 'weixin') {
+								weixinObj.chooseWXPay(data);
+							}
 							// #endif
 							// #endif
-							nonceStr: da.nonceStr,
-							package: da.package,
-							signType: da.signType,
-							paySign: da.paySign,
-							success: function(res) {
-								obj.paySuccessTo();
-							},
-							fail: () => {
-								uni.navigateTo({
-									url: '/pages/order/order?state=0'
-								});
+							// #ifdef MP-WEIXIN
+							if (obj.payName == 'routine') {
+								wx.requestPayment(data);
 							}
 							}
-						};
-						// #ifdef H5
-						if(obj.payName == 'weixin'){
-						obj.weichatObj.chooseWXPay(data);
-						}
-						// #endif
-						// #ifdef MP-WEIXIN
-						if(obj.payName == 'routine'){
-							wx.requestPayment(data);
+							// #endif
 						}
 						}
-						// #endif
-					}
-					uni.hideLoading();
-					obj.payLoding = false;
-				})
-				.catch(e => {
-					// 支付完成
-					uni.hideLoading();
-					obj.payLoding = false;
-					console.log(e);
-				});
-		},
-		// 支付成功跳转
-		paySuccessTo() {
-			uni.hideLoading();
-			uni.redirectTo({
-				url: '/pages/money/paySuccess?orderid=' + this.orderId
-			});
-		},
-		//确认支付
-		confirm: async function() {
-			let obj = this;
-			uni.showLoading({
-				title: '支付中',
-				mask: true
-			})
-			// 判断是否余额不足
-			if (obj.payName == 'yue' && +obj.now_money < obj.money) {
-				uni.showModal({
-					title: '提示',
-					content: '账户余额不足!',
-					showCancel: false,
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
+						uni.hideLoading();
+						obj.payLoding = false;
+					})
+					.catch(e => {
+						// 支付完成
+						uni.hideLoading();
+						obj.payLoding = false;
+						console.log(e);
+					});
+			},
+			// 支付成功跳转
+			paySuccessTo() {
+				uni.hideLoading();
+				uni.redirectTo({
+					url: '/pages/money/paySuccess?orderid=' + this.orderId
 				});
 				});
-				return;
-			}
-			// 支付中
-			obj.payLoding = true;
-			// #ifdef H5
-			// 获取当前是否为微信浏览器
-			obj.froms = uni.getStorageSync('weichatBrowser') || '';
-			// #endif
-			// 判断是否为未支付订单中跳转进入
-			if (obj.type != 1) {
-				// 初次生成订单
-				obj.firstCreateOrder();
-			} else {
-				// 已经生成订单未支付
-				obj.orderMoneyPay();
-			}
-		},
-		// 初次订单创建
-		firstCreateOrder() {
-			let obj = this;
-			// 获取下单页面数据
-			let prepage = obj.$api.prePage();
-
-			let data = {
-				real_name: prepage.addressData.real_name, //联系人名称
-				phone: prepage.addressData.phone, //联系人号码
-				couponId: prepage.couponChecked.id, //优惠券编号
-				addressId: prepage.addressData.id, //支付地址id
-				useIntegral: prepage.checkedPoints ? 1 : 0, //是否积分抵扣1为是0为否
-				payType: obj.payName, //支付类型  weixin-微信 yue-余额
-				mark: prepage.desc, //备注
+			},
+			//确认支付
+			confirm: async function() {
+				let obj = this;
+				uni.showLoading({
+					title: '支付中',
+					mask: true
+				})
+				// 判断是否余额不足
+				if (obj.payName == 'yue' && +obj.now_money < obj.money) {
+					uni.showModal({
+						title: '提示',
+						content: '账户余额不足!',
+						showCancel: false,
+						success: res => {},
+						fail: () => {},
+						complete: () => {}
+					});
+					return;
+				}
+				// 支付中
+				obj.payLoding = true;
 				// #ifdef H5
 				// #ifdef H5
-				from: obj.froms ? 'weixin' : 'H5', //来源
+				// 获取当前是否为微信浏览器
+				obj.froms = uni.getStorageSync('weichatBrowser') || '';
 				// #endif
 				// #endif
-				// #ifdef MP-WEIXIN
-				from: 'routine', //来源
-				// #endif
-				// #ifdef APP-PLUS
-				from: 'app', //来源
-				// #endif
-				shipping_type: 1, //提货方式 1 快递 2自提
-				is_drop: this.isdrop//是否上门安装
-			};
-			// 判断是否拼团商品
-			if (obj.pinkid) {
-				data.pinkId = obj.pinkid;
-			}
-			// 生成订单
-			createOrderkey(data, obj.orderKey)
-				.then(({ data, status, msg }) => {
-					// 判断是否支付失败
-					if (data.status == 'ORDER_EXIST') {
-						uni.showModal({
-							title: '提示',
-							content: msg,
-							showCancel: false
-						});
-						uni.hideLoading();
-						obj.payLoding = false;
-						return;
-					}
-					// 保存订单号
-					obj.orderId = data.result.orderId;
-					// 判断是否为余额支付
-					if (obj.payName == 'yue') {
-						if (status == 200 && data.status == 'SUCCESS') {
-							obj.paySuccessTo();
+				// 判断是否为未支付订单中跳转进入
+				if (obj.type != 1) {
+					// 初次生成订单
+					obj.firstCreateOrder();
+				} else {
+					// 已经生成订单未支付
+					obj.orderMoneyPay();
+				}
+			},
+			// 初次订单创建
+			firstCreateOrder() {
+				let obj = this;
+				// 获取下单页面数据
+				let prepage = obj.$api.prePage();
+
+				let data = {
+					real_name: prepage.addressData.real_name, //联系人名称
+					phone: prepage.addressData.phone, //联系人号码
+					couponId: prepage.couponChecked.id, //优惠券编号
+					addressId: prepage.addressData.id, //支付地址id
+					useIntegral: prepage.checkedPoints ? 1 : 0, //是否积分抵扣1为是0为否
+					payType: obj.payName, //支付类型  weixin-微信 yue-余额
+					mark: prepage.desc, //备注
+					// #ifdef H5
+					from: obj.froms ? 'weixin' : 'H5', //来源
+					// #endif
+					// #ifdef MP-WEIXIN
+					from: 'routine', //来源
+					// #endif
+					// #ifdef APP-PLUS
+					from: 'app', //来源
+					// #endif
+					shipping_type: 1, //提货方式 1 快递 2自提
+					is_drop: this.isdrop //是否上门安装
+				};
+				// 判断是否拼团商品
+				if (obj.pinkid) {
+					data.pinkId = obj.pinkid;
+				}
+				// 生成订单
+				createOrderkey(data, obj.orderKey)
+					.then(({
+						data,
+						status,
+						msg
+					}) => {
+						// 判断是否支付失败
+						if (data.status == 'ORDER_EXIST') {
+							uni.showModal({
+								title: '提示',
+								content: msg,
+								showCancel: false
+							});
+							uni.hideLoading();
+							obj.payLoding = false;
+							return;
+						}
+						// 保存订单号
+						obj.orderId = data.result.orderId;
+						// 判断是否为余额支付
+						if (obj.payName == 'yue') {
+							if (status == 200 && data.status == 'SUCCESS') {
+								obj.paySuccessTo();
+							} else {
+								obj.$api.msg(msg);
+							}
 						} else {
 						} else {
-							obj.$api.msg(msg);
+							// 立即支付
+							obj.orderMoneyPay();
 						}
 						}
-					} else {
-						// 立即支付
-						obj.orderMoneyPay();
-					}
-				})
-				.catch(e => {
-					uni.hideLoading();
-					obj.payLoding = false;
-					console.log(e);
-				});
+					})
+					.catch(e => {
+						uni.hideLoading();
+						obj.payLoding = false;
+						console.log(e);
+					});
+			}
 		}
 		}
-	}
-};
+	};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
-.app {
-	width: 100%;
-}
-
-.price-box {
-	background-color: #fff;
-	height: 265upx;
-	display: flex;
-	flex-direction: column;
-	justify-content: center;
-	align-items: center;
-	font-size: 28upx;
-	color: #909399;
-
-	.price {
-		font-size: 50upx;
-		color: #303133;
-		margin-top: 12upx;
-		&:before {
-			content: '¥';
-			font-size: 40upx;
-		}
+	.app {
+		width: 100%;
 	}
 	}
-}
 
 
-.pay-type-list {
-	margin-top: 20upx;
-	background-color: #fff;
-	padding-left: 60upx;
-	.type-item {
-		height: 120upx;
-		padding: 20upx 0;
+	.price-box {
+		background-color: #fff;
+		height: 265upx;
 		display: flex;
 		display: flex;
-		justify-content: space-between;
+		flex-direction: column;
+		justify-content: center;
 		align-items: center;
 		align-items: center;
-		padding-right: 60upx;
-		font-size: 30upx;
-		position: relative;
-	}
+		font-size: 28upx;
+		color: #909399;
 
 
-	.icon {
-		width: 100upx;
-		font-size: 52upx;
-	}
-	.iconyue {
-		color: #fe8e2e;
-	}
-	.iconweixin {
-		color: #36cb59;
-	}
-	.iconzhifubao {
-		color: #01aaef;
+		.price {
+			font-size: 50upx;
+			color: #303133;
+			margin-top: 12upx;
+
+			&:before {
+				content: '¥';
+				font-size: 40upx;
+			}
+		}
 	}
 	}
-	.tit {
-		font-size: $font-lg;
-		color: $font-color-dark;
-		margin-bottom: 4upx;
+
+	.pay-type-list {
+		margin-top: 20upx;
+		background-color: #fff;
+		padding-left: 60upx;
+
+		.type-item {
+			height: 120upx;
+			padding: 20upx 0;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding-right: 60upx;
+			font-size: 30upx;
+			position: relative;
+		}
+
+		.icon {
+			width: 100upx;
+			font-size: 52upx;
+		}
+
+		.iconyue {
+			color: #fe8e2e;
+		}
+
+		.iconweixin {
+			color: #36cb59;
+		}
+
+		.iconzhifubao {
+			color: #01aaef;
+		}
+
+		.tit {
+			font-size: $font-lg;
+			color: $font-color-dark;
+			margin-bottom: 4upx;
+		}
+
+		.con {
+			flex: 1;
+			display: flex;
+			flex-direction: column;
+			font-size: $font-sm;
+			color: $font-color-light;
+		}
 	}
 	}
-	.con {
-		flex: 1;
+
+	.mix-btn {
 		display: flex;
 		display: flex;
-		flex-direction: column;
-		font-size: $font-sm;
-		color: $font-color-light;
+		align-items: center;
+		justify-content: center;
+		width: 630upx;
+		height: 80upx;
+		margin: 80upx auto 30upx;
+		font-size: $font-lg;
+		color: #fff;
+		background-color: $base-color;
+		border-radius: 10upx;
+		/* box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4); */
 	}
 	}
-}
-.mix-btn {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 630upx;
-	height: 80upx;
-	margin: 80upx auto 30upx;
-	font-size: $font-lg;
-	color: #fff;
-	background-color: $base-color;
-	border-radius: 10upx;
-	/* box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4); */
-}
 
 
-.clickbg {
-	background-color: $color-gray !important;
-}
+	.clickbg {
+		background-color: $color-gray !important;
+	}
 </style>
 </style>

+ 6 - 12
pages/product/product.vue

@@ -87,7 +87,8 @@
 		saveUrl
 		saveUrl
 	} from '@/utils/loginUtils.js';
 	} from '@/utils/loginUtils.js';
 	// #ifdef H5
 	// #ifdef H5
-	import { weixindata, weixinlocation,shareLoad } from '@/utils/wxAuthorized';
+	import { weixinObj,shareLoad } from '@/utils/wxAuthorized';
+	import {getPageUrl } from '@/utils/loginUtils.js';
 	// #endif
 	// #endif
 	// 头部轮播图
 	// 头部轮播图
 	import topSwiper from './common/topSwiper.vue';
 	import topSwiper from './common/topSwiper.vue';
@@ -191,10 +192,8 @@
 				}
 				}
 			}
 			}
 		},
 		},
-		
 		async onLoad(options) {
 		async onLoad(options) {
 		console.log(options,'接受到的参数');
 		console.log(options,'接受到的参数');
-		
 			let obj = this;
 			let obj = this;
 			obj.option = options.cateId;
 			obj.option = options.cateId;
 			console.log(obj.option)
 			console.log(obj.option)
@@ -224,7 +223,6 @@
 		},
 		},
 		// 分享
 		// 分享
 		onShareAppMessage(options) {
 		onShareAppMessage(options) {
-			
 			// 设置菜单中的转发按钮触发转发事件时的转发内容
 			// 设置菜单中的转发按钮触发转发事件时的转发内容
 			let pages = getCurrentPages(); //获取加载的页面
 			let pages = getCurrentPages(); //获取加载的页面
 			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
 			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
@@ -264,18 +262,14 @@
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			// #ifdef MP-WEIXIN
+			// #ifdef H5
 			IndexShare() {
 			IndexShare() {
 				let obj = this
 				let obj = this
 				// console.log('dddddddffffffffffffff')
 				// console.log('dddddddffffffffffffff')
 				// 设置菜单中的转发按钮触发转发事件时的转发内容
 				// 设置菜单中的转发按钮触发转发事件时的转发内容
-				let pages = getCurrentPages(); //获取加载的页面
-				let currentPage = pages[pages.length - 1]; //获取当前页面的对象
-				let url = '/#/' + currentPage.route; //当前页面url
-				let item = currentPage.options; //如果要获取url中所带的参数可以查看options
 				let shareObj = {
 				let shareObj = {
 					title: obj.goodsObjact.store_name, // 默认是小程序的名称(可以写slogan等)
 					title: obj.goodsObjact.store_name, // 默认是小程序的名称(可以写slogan等)
-					link: obj.baseURL + url + '?id=' + item.id + '&spread=' + obj.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
+					link: getPageUrl(true), // 默认是当前页面,必须是以‘/’开头的完整路径
 					desc: obj.goodsObjact.store_name + '   价格:' + obj.goodsObjact.price,
 					desc: obj.goodsObjact.store_name + '   价格:' + obj.goodsObjact.price,
 					imgUrl: obj.goodsObjact.image,
 					imgUrl: obj.goodsObjact.image,
 					success: function(res) {
 					success: function(res) {
@@ -425,7 +419,7 @@
 						obj.mer_id = data.mer_id;
 						obj.mer_id = data.mer_id;
 						console.log(obj.mer_id,'商户编号')
 						console.log(obj.mer_id,'商户编号')
 						obj.goodsObjact = goods;
 						obj.goodsObjact = goods;
-						// obj.IndexShare()
+						obj.IndexShare()
 						if (obj.goodsObjact.description != null) {
 						if (obj.goodsObjact.description != null) {
 							obj.description = obj.goodsObjact.description.replace(/\<img/gi,
 							obj.description = obj.goodsObjact.description.replace(/\<img/gi,
 								'<img class="rich-img"');
 								'<img class="rich-img"');
@@ -487,7 +481,7 @@
 						obj.goodsNumberMax = goods.num;
 						obj.goodsNumberMax = goods.num;
 						console.log(obj.seckillObj, '数据');
 						console.log(obj.seckillObj, '数据');
 						obj.goodsObjact = goods;
 						obj.goodsObjact = goods;
-						// obj.IndexShare()
+						obj.IndexShare()
 						if (obj.goodsObjact.description != null) {
 						if (obj.goodsObjact.description != null) {
 							obj.description = obj.goodsObjact.description.replace(/\<img/gi,
 							obj.description = obj.goodsObjact.description.replace(/\<img/gi,
 								'<img class="rich-img"');
 								'<img class="rich-img"');

+ 26 - 15
pages/user/user.vue

@@ -104,14 +104,14 @@
 				</view>
 				</view>
 			</view>
 			</view>
 			<!-- 升级店长 -->
 			<!-- 升级店长 -->
-			
+
 			<navigator url="/pages/store/apply" v-if=" userInfo.level<=1">
 			<navigator url="/pages/store/apply" v-if=" userInfo.level<=1">
 				<view class="up-box">
 				<view class="up-box">
 					<image src="/static/img/upto01.png" mode=""></image>
 					<image src="/static/img/upto01.png" mode=""></image>
 				</view>
 				</view>
 			</navigator>
 			</navigator>
 			<view>
 			<view>
-			
+
 				<!-- <view class="tj-sction">
 				<!-- <view class="tj-sction">
 					<view class="tj-item" @click="navTo('/pages/money/wallet')">
 					<view class="tj-item" @click="navTo('/pages/money/wallet')">
 						<text class="num">{{ userInfo.now_money || '0.00' }}</text>
 						<text class="num">{{ userInfo.now_money || '0.00' }}</text>
@@ -178,12 +178,12 @@
 				<view class="item-box ">
 				<view class="item-box ">
 					<view class="box-title flex borde-b">
 					<view class="box-title flex borde-b">
 						<view class="title"><text>代理订单</text></view>
 						<view class="title"><text>代理订单</text></view>
-						<view class="link" @click="navTo('/pagesA/order/orderDl?state=0')" hover-class="common-hover"><text
-								class="iconfont iconenter"></text></view>
+						<view class="link" @click="navTo('/pagesA/order/orderDl?state=0')" hover-class="common-hover">
+							<text class="iconfont iconenter"></text></view>
 					</view>
 					</view>
 					<view class="order-section">
 					<view class="order-section">
-						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=0')" hover-class="common-hover"
-							:hover-stay-time="50">
+						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=0')"
+							hover-class="common-hover" :hover-stay-time="50">
 							<view class=" icon position-relative">
 							<view class=" icon position-relative">
 								<image class="icon-img" src="/static/icon/i1.png" mode="aspectFit"></image>
 								<image class="icon-img" src="/static/icon/i1.png" mode="aspectFit"></image>
 								<!-- <view class="corner" v-if="orderInfo.unpaid_count > 0">
 								<!-- <view class="corner" v-if="orderInfo.unpaid_count > 0">
@@ -192,8 +192,8 @@
 							</view>
 							</view>
 							<text>待付款</text>
 							<text>待付款</text>
 						</view>
 						</view>
-						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=1')" hover-class="common-hover"
-							:hover-stay-time="50">
+						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=1')"
+							hover-class="common-hover" :hover-stay-time="50">
 							<view class=" icon position-relative">
 							<view class=" icon position-relative">
 								<image class="icon-img" src="/static/icon/i2.png" mode="aspectFit"></image>
 								<image class="icon-img" src="/static/icon/i2.png" mode="aspectFit"></image>
 								<!-- <view class="corner" v-if="orderInfo.unshipped_count > 0">
 								<!-- <view class="corner" v-if="orderInfo.unshipped_count > 0">
@@ -202,8 +202,8 @@
 							</view>
 							</view>
 							<text>待发货</text>
 							<text>待发货</text>
 						</view>
 						</view>
-						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=2')" hover-class="common-hover"
-							:hover-stay-time="50">
+						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=2')"
+							hover-class="common-hover" :hover-stay-time="50">
 							<view class="icon position-relative">
 							<view class="icon position-relative">
 								<image class="icon-img" src="/static/icon/i3.png" mode="aspectFit"></image>
 								<image class="icon-img" src="/static/icon/i3.png" mode="aspectFit"></image>
 								<!-- <view class="corner" v-if="orderInfo.received_count > 0">
 								<!-- <view class="corner" v-if="orderInfo.received_count > 0">
@@ -212,8 +212,8 @@
 							</view>
 							</view>
 							<text>待收货</text>
 							<text>待收货</text>
 						</view>
 						</view>
-						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=4')" hover-class="common-hover"
-							:hover-stay-time="50">
+						<view class="order-item" @click="navTo('/pagesA/order/orderDl?state=4')"
+							hover-class="common-hover" :hover-stay-time="50">
 							<view class="icon position-relative">
 							<view class="icon position-relative">
 								<image class="icon-img" src="/static/icon/i4.png" mode="aspectFit"></image>
 								<image class="icon-img" src="/static/icon/i4.png" mode="aspectFit"></image>
 								<!-- <view class="corner" v-if="orderInfo.complete_count > 0">
 								<!-- <view class="corner" v-if="orderInfo.complete_count > 0">
@@ -230,8 +230,8 @@
 							thumb="/static/icon/img13.png" v-if="userInfo.level == 3"></uni-list-item>
 							thumb="/static/icon/img13.png" v-if="userInfo.level == 3"></uni-list-item>
 						<uni-list-item title="我的推广" @click="navTo('/pages/user/extension')"
 						<uni-list-item title="我的推广" @click="navTo('/pages/user/extension')"
 							thumb="/static/icon/img11.png" v-if="userInfo.level != 2"></uni-list-item>
 							thumb="/static/icon/img11.png" v-if="userInfo.level != 2"></uni-list-item>
-						<uni-list-item title="交易密码" @click="navTo('/pages/money/moneyPwd')"
-							thumb="/static/icon/i8.png" v-if="userInfo.uid"></uni-list-item>
+						<uni-list-item title="交易密码" @click="navTo('/pages/money/moneyPwd')" thumb="/static/icon/i8.png"
+							v-if="userInfo.uid"></uni-list-item>
 						<uni-list-item title="收货地址" @click="navTo('/pages/set/address')" thumb="/static/icon/img12.png">
 						<uni-list-item title="收货地址" @click="navTo('/pages/set/address')" thumb="/static/icon/img12.png">
 						</uni-list-item>
 						</uni-list-item>
 						<uni-list-item title="联系客服" @click="showPopup" thumb="/static/icon/img02.png"></uni-list-item>
 						<uni-list-item title="联系客服" @click="showPopup" thumb="/static/icon/img02.png"></uni-list-item>
@@ -277,9 +277,16 @@
 		saveUrl,
 		saveUrl,
 		interceptor
 		interceptor
 	} from '@/utils/loginUtils.js';
 	} from '@/utils/loginUtils.js';
+
 	import {
 	import {
 		logout
 		logout
 	} from '@/api/set.js';
 	} from '@/api/set.js';
+	// #ifdef H5
+	import {
+		weixinObj,
+		shareLoad
+	} from '@/utils/wxAuthorized';
+	// #endif
 	// import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
 	// import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
 	let startY = 0,
 	let startY = 0,
 		moveY = 0,
 		moveY = 0,
@@ -305,7 +312,11 @@
 				this.loadBaseData();
 				this.loadBaseData();
 				this.getMyStore();
 				this.getMyStore();
 			}
 			}
-
+		},
+		onLoad() {
+			// #ifdef H5
+			shareLoad();
+			// #endif
 		},
 		},
 		onReady() {
 		onReady() {
 			// 初始化获取页面宽度
 			// 初始化获取页面宽度

+ 30 - 26
utils/wxAuthorized.js

@@ -9,9 +9,7 @@ import {
 } from './platform.js'
 } from './platform.js'
 import store from '../store';
 import store from '../store';
 // 保存wx对象
 // 保存wx对象
-	// #ifdef H5
-	import weixinObj from "@/plugin/jweixin-module/index.js";
-	// #endif
+import weixinObj from "@/plugin/jweixin-module/index.js";
 // 保存分享数据
 // 保存分享数据
 let shareData = '';
 let shareData = '';
 // 保存注册返回appId数据
 // 保存注册返回appId数据
@@ -22,9 +20,12 @@ let router = '';
 /**
 /**
  * @param {string} 当前页面地址信息
  * @param {string} 当前页面地址信息
  */
  */
-export function loginWinxin() {
+export async function loginWinxin() {
 	console.log('1');
 	console.log('1');
 	let pages, page, path;
 	let pages, page, path;
+	if (!router) {
+		router = await setRouter();
+	}
 	try {
 	try {
 		pages = getCurrentPages();
 		pages = getCurrentPages();
 		// 获取跳转前页面
 		// 获取跳转前页面
@@ -39,7 +40,6 @@ export function loginWinxin() {
 	if (path != 'pages/redirect/redirect') {
 	if (path != 'pages/redirect/redirect') {
 		log.addLog('开始注册微信')
 		log.addLog('开始注册微信')
 		weixindata().then(() => {
 		weixindata().then(() => {
-			console.log('2');
 			// 调用
 			// 调用
 			try {
 			try {
 				weixinSq();
 				weixinSq();
@@ -74,12 +74,16 @@ function weixinSq() {
 };
 };
 
 
 // 微信注册
 // 微信注册
-export function weixindata(config) {
+export async function weixindata(config) {
 	let url;
 	let url;
 	try {
 	try {
+		// 判断是否存在router
+		if (!router) {
+			router = await setRouter();
+		}
 		if (router.mode === "history") {
 		if (router.mode === "history") {
 			// 在ios中时候注册为微信刚进入时候的页面
 			// 在ios中时候注册为微信刚进入时候的页面
-			if (window.entryUrl === '') {
+			if (!window.entryUrl) {
 				window.entryUrl = location.href.split('#')[0]
 				window.entryUrl = location.href.split('#')[0]
 			}
 			}
 			url = isAndroid() ? location.href.split('#')[0] : window.entryUrl;
 			url = isAndroid() ? location.href.split('#')[0] : window.entryUrl;
@@ -117,7 +121,7 @@ export function weixindata(config) {
 						weixinObj.ready((e) => {
 						weixinObj.ready((e) => {
 							log.addLog("注册完毕", data)
 							log.addLog("注册完毕", data)
 							console.log('注册完毕');
 							console.log('注册完毕');
-							ok(data)
+							ok(weixinObj)
 						})
 						})
 					} catch (e) {
 					} catch (e) {
 						console.log(e)
 						console.log(e)
@@ -166,16 +170,6 @@ export function shareLoad(config) {
 function shareFun(config) {
 function shareFun(config) {
 	try {
 	try {
 		console.log('再付分享内容', config);
 		console.log('再付分享内容', config);
-		// uni.showModal({
-		// 	title: '链接',
-		// 	content: config.link,
-		// 	showCancel: false,
-		// 	cancelText: '',
-		// 	confirmText: '',
-		// 	success: res => {},
-		// 	fail: () => {},
-		// 	complete: () => {}
-		// });
 		let mess;
 		let mess;
 		if (config) {
 		if (config) {
 			mess = {
 			mess = {
@@ -214,19 +208,12 @@ function shareFun(config) {
 				}
 				}
 			}
 			}
 		}
 		}
-		// uni.showModal({
-		// 	title:"提示",
-		// 	content:JSON.stringify(mess)
-		// })
-		console.log(mess,'data')
 		// 获取仓库数据
 		// 获取仓库数据
 		// 分享好友
 		// 分享好友
 		weixinObj.updateAppMessageShareData(mess);
 		weixinObj.updateAppMessageShareData(mess);
-		// weixinObj.onMenuShareAppMessage(mess);// 即将废弃
 
 
 		// 分享朋友圈
 		// 分享朋友圈
 		weixinObj.updateTimelineShareData(mess)
 		weixinObj.updateTimelineShareData(mess)
-		// weixinObj.onMenuShareTimeline(mess);// 即将废弃
 	} catch (e) {
 	} catch (e) {
 		console.log(e);
 		console.log(e);
 		//TODO handle the exception
 		//TODO handle the exception
@@ -235,7 +222,24 @@ function shareFun(config) {
 
 
 // 保存路由对象
 // 保存路由对象
 export function setRouter(route) {
 export function setRouter(route) {
-	router = route
+	return new Promise((ok, err) => {
+		router = getApp().$router;
+		console.log(router,'开始数据');
+		if (!router) {
+			const set = setInterval(() => {
+				router = getApp().$router;
+				console.log(router,'返回数据');
+				if (router) {
+					console.log(router,'结束');
+					clearInterval(set)
+					ok(router)
+				}
+			}, 100);
+		}else{
+			console.log(router,'成功');
+			ok(router)
+		}
+	})
 }
 }
 
 
 export default {
 export default {