hwq 2 năm trước cách đây
mục cha
commit
6554a48f8d
5 tập tin đã thay đổi với 467 bổ sung534 xóa
  1. 320 360
      pages/index/index.vue
  2. 136 162
      pages/money/pay.vue
  3. 2 3
      pages/money/paySuccess.vue
  4. 1 1
      pages/order/createOrder.vue
  5. 8 8
      pages/product/product.vue

+ 320 - 360
pages/index/index.vue

@@ -1,9 +1,8 @@
 <template>
 	<view class="container">
 		<!-- 轮播图 start -->
-		<swiper class="top-swiper" autoplay="true" duration="400" interval="10000" @change="swiperChange">
-			<swiper-item v-for="(item, index) in bannerList" :key="index" class="carousel-item"
-				@click="navto(item.url)">
+		<swiper class="top-swiper" autoplay="true" duration="400" interval="10000">
+			<swiper-item v-for="(item, index) in bannerList" :key="index" class="carousel-item" @click="navto(item.url)">
 				<image class="topImg" :src="item.pic" mode="scaleToFill" />
 			</swiper-item>
 		</swiper>
@@ -11,19 +10,16 @@
 		<view class="user-section">
 			<view class="user-info-box">
 				<view class="detail" @click="navTo('/pages/set/userinfo')">
-					<view class="portrait-box">
-						<image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image>
-					</view>
+					<view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image></view>
 					<view class="info-box">
 						<view class="username">{{ userInfo.nickname || '游客' }}</view>
 						<view class="font-size-sm">升级会员享收益</view>
 					</view>
 				</view>
-				<view class="config text-white ">
-					某娘粉丝
-				</view>
+				<view class="config text-white ">某娘粉丝</view>
+				s
 			</view>
-			<view class="upVipBox flex margin-t-20">
+			<view class="upVipBox flex margin-t-20" @click="navto(item.url)">
 				<image class="upViewTip" src="../../static/img/indexUpVipIcon.png" mode="scaleToFill"></image>
 				<view class="flex-grow-true padding-c-10 flex">
 					<view>
@@ -37,18 +33,15 @@
 				</view>
 			</view>
 		</view>
-		<swiper indicator-dots indicator-color='rgba(255, 255, 255, .5)' indicator-active-color='#FFFFFF'
-			class="content-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
+		<swiper indicator-dots indicator-color="rgba(255, 255, 255, .5)" indicator-active-color="#FFFFFF" class="content-swiper" autoplay="true" duration="400" interval="5000">
 			<swiper-item v-for="(item, index) in activity" :key="index" class="nav" @click="navto(item.url)">
 				<image class="contentImg" :src="item.pic" mode="scaleToFill" />
 			</swiper-item>
 		</swiper>
 		<view class="cate-section flex">
 			<view class="cate-item flex" v-for="item in menus" @click="navto(item.url)">
-				<view class="img-wrapper flex">
-					<image :src="item.pic" mode=" scaleToFill"></image>
-				</view>
-				<view class="item-title">{{item.name}}</view>
+				<view class="img-wrapper flex"><image :src="item.pic" mode=" scaleToFill"></image></view>
+				<view class="item-title">{{ item.name }}</view>
 			</view>
 		</view>
 		<view class="activty padding-b-20">
@@ -57,42 +50,24 @@
 				<view class="margin-c-20">推荐商品</view>
 				<image class="action-title-icon" src="../../static/img/indexTitleRight.png" mode="scaleToFill"></image>
 			</view>
-			<view class="action-title-tip">
-				悦享套餐 格调生活
-			</view>
+			<view class="action-title-tip">悦享套餐 格调生活</view>
 		</view>
-		<view class="productList" v-for="(item,ind) in hotgoods">
-			<view class="tipLeft text-white font-size-base">
-				立省¥{{item.ot_price-item.price}}
-			</view>
+		<view class="productList" v-for="(item, ind) in hotgoods">
+			<view class="tipLeft text-white font-size-base">立省¥{{ item.ot_price - item.price }}</view>
 			<image class="productImg" :src="item.image" mode="scaleToFill"></image>
 			<view class="padding-c-20 padding-t-10 padding-b-20">
-				<view class="product-name clamp">
-					{{item.store_name}}
-				</view>
+				<view class="product-name clamp">{{ item.store_name }}</view>
 				<view class="flex padding-t-10">
-					<view class="mask">
-						{{item.store_info}}
-					</view>
-					<view class="sales" v-if="item.sales>0">
-						已售{{item.sales+item.unit_name}}
-					</view>
+					<view class="mask">{{ item.store_info }}</view>
+					<view class="sales" v-if="item.sales > 0">已售{{ item.sales + item.unit_name }}</view>
 				</view>
 				<view class="flex padding-t-10">
 					<view class="flex money">
-						<view class="payMoney font-size-sm">
-							¥
-						</view>
-						<view class="payMoney font-size-lg">
-							{{item.price}}
-						</view>
-						<view class="oldMoney margin-l-10">
-							{{item.ot_price}}
-						</view>
-					</view>
-					<view class="buttomPlay text-white" @click.stop="navto('/pages/')">
-						立即抢购
+						<view class="payMoney font-size-sm">¥</view>
+						<view class="payMoney font-size-lg">{{ item.price }}</view>
+						<view class="oldMoney margin-l-10">{{ item.ot_price }}</view>
 					</view>
+					<view class="buttomPlay text-white" @click.stop="navto('/pages/product/product?id=' + item.id)">立即抢购</view>
 				</view>
 			</view>
 		</view>
@@ -100,376 +75,361 @@
 </template>
 
 <script>
-	import {
-		loadIndexs,
-	} from '@/api/index.js';
-	import {
-		getUserInfo
-	} from '@/api/user.js';
-	import {
-		interceptor
-	} from '@/utils/loginUtils';
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
+import { loadIndexs } from '@/api/index.js';
+import { getUserInfo } from '@/api/user.js';
+import { interceptor } from '@/utils/loginUtils';
+import { mapState, mapMutations } from 'vuex';
 
-	export default {
-		data() {
-			return {
-				// 轮播图
-				bannerList: [],
-				// 中间轮播图
-				activity: [],
-				// 金刚区
-				menus: [],
-				// 首页推荐
-				hotgoods: []
-			};
-		},
-		computed: {
-			...mapState(['loginInterceptor']),
-			...mapState('user', ['userInfo', 'checkedStore', 'des', 'latlng', 'hasLogin'])
-		},
-		async onLoad(option) {
-			let obj = this;
-			// #ifndef MP
-			if (option.spread) {
-				// 存储其他邀请人
-				uni.setStorageSync('spread', option.spread);
-			}
-			// #endif
-			// #ifdef MP
-			if (option.scene) {
-				// 存储小程序邀请人
-				uni.setStorage({
-					key: 'spread_code',
-					data: option.scene
+export default {
+	data() {
+		return {
+			// 轮播图
+			bannerList: [],
+			// 中间轮播图
+			activity: [],
+			// 金刚区
+			menus: [],
+			// 首页推荐
+			hotgoods: []
+		};
+	},
+	computed: {
+		...mapState(['loginInterceptor']),
+		...mapState('user', ['userInfo', 'checkedStore', 'des', 'latlng', 'hasLogin'])
+	},
+	async onLoad(option) {
+		let obj = this;
+		// #ifndef MP
+		if (option.spread) {
+			// 存储其他邀请人
+			uni.setStorageSync('spread', option.spread);
+		}
+		// #endif
+		// #ifdef MP
+		if (option.scene) {
+			// 存储小程序邀请人
+			uni.setStorage({
+				key: 'spread_code',
+				data: option.scene
+			});
+		}
+		// #endif
+		//获取当前位置
+		await this.loadData();
+	},
+	onShow() {
+		// 判断是否强制登录
+		if (this.loginInterceptor && !this.hasLogin) {
+			// 登录拦截
+			interceptor();
+		}
+		if (this.userInfo.uid) {
+			console.log(this.userInfo);
+			getUserInfo({})
+				.then(({ data }) => {
+					this.setUserInfo(data);
+				})
+				.catch(e => {
+					console.log(e);
 				});
-			}
-			// #endif
-			//获取当前位置
-			await this.loadData();
-
-		},
-		onShow() {
-			// 判断是否强制登录
-			if (this.loginInterceptor && !this.hasLogin) {
-				// 登录拦截
-				interceptor();
-			}
-			if (this.userInfo.uid) {
-				console.log(this.userInfo);
-				getUserInfo({})
-					.then(({
-						data
-					}) => {
-						this.setUserInfo(data);
-						if (this.userInfo.store_info.length != 0) {
-							this.isAdmin = true;
-						}
-					})
-					.catch(e => {
-						console.log(e);
-					});
-			}
-		},
-		//下拉刷新
-		onPullDownRefresh() {
-			this.loadData();
-		},
-		onShareAppMessage(options) {
-			// 设置菜单中的转发按钮触发转发事件时的转发内容
-			let pages = getCurrentPages(); //获取加载的页面
-			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
-			let url = currentPage.route; //当前页面url
-			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
-			let shareObj = {
-				// title: '子臣餐饮数字化服务平台', // 默认是小程序的名称(可以写slogan等)
-				path: url + '?scene=' + this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
-				imageUrl: '',
-				success: function(res) {
-					// 转发成功之后的回调
-					if (res.errMsg == 'shareAppMessage:ok') {}
-				},
-				fail: function() {
-					// 转发失败之后的回调
-					if (res.errMsg == 'shareAppMessage:fail cancel') {
-						// 用户取消转发
-					} else if (res.errMsg == 'shareAppMessage:fail') {
-						// 转发失败,其中 detail message 为详细失败信息
-					}
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		this.loadData();
+	},
+	onShareAppMessage(options) {
+		// 设置菜单中的转发按钮触发转发事件时的转发内容
+		let pages = getCurrentPages(); //获取加载的页面
+		let currentPage = pages[pages.length - 1]; //获取当前页面的对象
+		let url = currentPage.route; //当前页面url
+		let item = currentPage.options; //如果要获取url中所带的参数可以查看options
+		let shareObj = {
+			// title: '子臣餐饮数字化服务平台', // 默认是小程序的名称(可以写slogan等)
+			path: url + '?scene=' + this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
+			imageUrl: '',
+			success: function(res) {
+				// 转发成功之后的回调
+				if (res.errMsg == 'shareAppMessage:ok') {
 				}
-			};
-			return shareObj;
-		},
-		methods: {
-			...mapMutations('user', ['setUserInfo']),
-			navTo(url) {
-				uni.navigateTo({
-					url: url
-				});
-			},
-			// 點擊搜索框
-			clickSearch() {
-				uni.navigateTo({
-					url: '/pages/product/search'
-				});
-			},
-			// 请求载入数据
-			async loadData() {
-				loadIndexs({})
-					.then(({
-						data
-					}) => {
-						// banner轮播图
-						this.bannerList = data.banner;
-						// 中间轮播图
-						this.activity = data.activity;
-						// 金刚区
-						this.menus = data.menus;
-						// 商品推荐
-						this.hotgoods = data.info.bastList;
-					})
-					.catch(e => {
-						uni.stopPullDownRefresh();
-					});
 			},
-			// 轮播图跳转
-			navto(item) {
-				// #ifdef H5
-				console.log(url.indexOf('http'), 'banner');
-				if (url.indexOf('http') >= 0) {
-					window.location.href = url;
+			fail: function() {
+				// 转发失败之后的回调
+				if (res.errMsg == 'shareAppMessage:fail cancel') {
+					// 用户取消转发
+				} else if (res.errMsg == 'shareAppMessage:fail') {
+					// 转发失败,其中 detail message 为详细失败信息
 				}
-				// #endif
-				//测试数据没有写id,用title代替
-				uni.navigateTo({
-					url: url
+			}
+		};
+		return shareObj;
+	},
+	methods: {
+		...mapMutations('user', ['setUserInfo']),
+		navTo(url) {
+			uni.navigateTo({
+				url: url
+			});
+		},
+		// 點擊搜索框
+		clickSearch() {
+			uni.navigateTo({
+				url: '/pages/product/search'
+			});
+		},
+		// 请求载入数据
+		async loadData() {
+			loadIndexs({})
+				.then(({ data }) => {
+					// banner轮播图
+					this.bannerList = data.banner;
+					// 中间轮播图
+					this.activity = data.activity;
+					// 金刚区
+					this.menus = data.menus;
+					// 商品推荐
+					this.hotgoods = data.info.bastList;
+				})
+				.catch(e => {
+					uni.stopPullDownRefresh();
 				});
-			},
+		},
+		// 轮播图跳转
+		navto(url) {
+			// #ifdef H5
+			console.log(url.indexOf('http'), 'banner');
+			if (url.indexOf('http') >= 0) {
+				window.location.href = url;
+			}
+			// #endif
+			//测试数据没有写id,用title代替
+			uni.navigateTo({
+				url: url
+			});
 		}
-	};
+	}
+};
 </script>
 
 <style lang="scss">
-	.container {
-		height: 100%;
-		background-color: $page-color-base;
-		padding-bottom: 30rpx;
-	}
+.container {
+	height: 100%;
+	background-color: $page-color-base;
+	padding-bottom: 30rpx;
+}
 
-	.content-box {
-		height: 100%;
-	}
+.content-box {
+	height: 100%;
+}
 
-	.user-section {
-		position: relative;
-		width: 690rpx;
-		margin: 0 30rpx;
-		margin-top: -100rpx;
-		padding: 20rpx;
-		border-radius: 15rpx;
-		background-color: #FFFFFF;
+.user-section {
+	position: relative;
+	width: 690rpx;
+	margin: 0 30rpx;
+	margin-top: -100rpx;
+	padding: 20rpx;
+	border-radius: 15rpx;
+	background-color: #ffffff;
 
-		.upVipBox {
-			padding: 12rpx;
-			background-color: #F5F5F5;
-			border-radius: 10rpx;
-			font-weight: bold;
+	.upVipBox {
+		padding: 12rpx;
+		background-color: #f5f5f5;
+		border-radius: 10rpx;
+		font-weight: bold;
 
-			.upViewTip {
-				height: 78rpx;
-				width: 78rpx;
-			}
+		.upViewTip {
+			height: 78rpx;
+			width: 78rpx;
 		}
+	}
 
-		.user-info-box {
-			position: relative;
-			height: 100%;
-			width: 100%;
-			color: white;
-			display: flex;
-			justify-content: space-between;
-			z-index: 10;
+	.user-info-box {
+		position: relative;
+		height: 100%;
+		width: 100%;
+		color: white;
+		display: flex;
+		justify-content: space-between;
+		z-index: 10;
 
-			.detail {
-				display: flex;
-				// justify-content: space-between;
-				width: 100%;
+		.detail {
+			display: flex;
+			// justify-content: space-between;
+			width: 100%;
 
-				.portrait-box {
-					height: 80rpx;
-					width: 80rpx;
+			.portrait-box {
+				height: 80rpx;
+				width: 80rpx;
 
-					.portrait {
-						width: 100%;
-						height: 100%;
-						border: 5rpx solid #fff;
-						border-radius: 50%;
-					}
+				.portrait {
+					width: 100%;
+					height: 100%;
+					border: 5rpx solid #fff;
+					border-radius: 50%;
 				}
+			}
 
-				.info-box {
-					margin: auto 20rpx;
-					color: $font-color-dark;
+			.info-box {
+				margin: auto 20rpx;
+				color: $font-color-dark;
 
-					.username {
-						font-size: $font-lg;
-						font-weight: bold;
-						// height: 100%;
-					}
+				.username {
+					font-size: $font-lg;
+					font-weight: bold;
+					// height: 100%;
 				}
 			}
+		}
 
-			.config {
-				flex-shrink: 0;
-				line-height: 1;
-				padding-top: 5rpx;
-				margin: auto 0;
-				padding: 16rpx 34rpx;
-				border-radius: 26rpx;
-				font-size: $font-sm;
-				background-color: #E896B3;
-				text-align: center;
-			}
+		.config {
+			flex-shrink: 0;
+			line-height: 1;
+			padding-top: 5rpx;
+			margin: auto 0;
+			padding: 16rpx 34rpx;
+			border-radius: 26rpx;
+			font-size: $font-sm;
+			background-color: #e896b3;
+			text-align: center;
 		}
 	}
+}
+
+.top-swiper {
+	width: 750rpx;
+	height: 580rpx;
 
-	.top-swiper {
+	.topImg {
 		width: 750rpx;
 		height: 580rpx;
-
-		.topImg {
-			width: 750rpx;
-			height: 580rpx;
-		}
 	}
+}
+
+.content-swiper {
+	background-color: #ffffff;
+	margin: 20rpx 30rpx;
+	width: 690rpx;
+	height: 238rpx;
+	border-radius: 15rpx;
 
-	.content-swiper {
-		background-color: #FFFFFF;
-		margin: 20rpx 30rpx;
+	.contentImg {
 		width: 690rpx;
 		height: 238rpx;
-		border-radius: 15rpx;
-
-		.contentImg {
-			width: 690rpx;
-			height: 238rpx;
-		}
 	}
+}
 
-	.cate-section {
-		justify-content: flex-start;
-		background-color: #fff;
-		padding: 30rpx 10rpx;
-		padding-bottom: 10rpx;
-		margin: 20rpx 30rpx 0rpx 30rpx;
-		flex-wrap: wrap;
-		border-radius: 15rpx;
+.cate-section {
+	justify-content: flex-start;
+	background-color: #fff;
+	padding: 30rpx 10rpx;
+	padding-bottom: 10rpx;
+	margin: 20rpx 30rpx 0rpx 30rpx;
+	flex-wrap: wrap;
+	border-radius: 15rpx;
 
-		.cate-item {
-			flex-grow: 0;
-			width: 25%;
-			flex-direction: column;
-			text-align: center;
-			align-items: center;
-			justify-content: center;
-			padding-bottom: 20rpx;
+	.cate-item {
+		flex-grow: 0;
+		width: 25%;
+		flex-direction: column;
+		text-align: center;
+		align-items: center;
+		justify-content: center;
+		padding-bottom: 20rpx;
 
-			.img-wrapper {
+		.img-wrapper {
+			width: 90rpx;
+			height: 90rpx;
+			border-radius: 20rpx;
+			position: relative;
+
+			image {
 				width: 90rpx;
 				height: 90rpx;
-				border-radius: 20rpx;
-				position: relative;
-
-				image {
-					width: 90rpx;
-					height: 90rpx;
-					position: absolute;
-					left: 50%;
-					top: 50%;
-					transform: translate(-50%, -50%);
-				}
+				position: absolute;
+				left: 50%;
+				top: 50%;
+				transform: translate(-50%, -50%);
 			}
+		}
 
-			.item-title {
-				margin-top: 15rpx;
-				font-size: 26rpx;
-				font-weight: bold;
-				color: #6B4216;
-			}
+		.item-title {
+			margin-top: 15rpx;
+			font-size: 26rpx;
+			font-weight: bold;
+			color: #6b4216;
 		}
 	}
+}
 
-	.activty {
-		padding-top: 30rpx;
+.activty {
+	padding-top: 30rpx;
 
-		.action-title {
-			color: #EE2F72;
-			font-weight: bold;
-			justify-content: center;
+	.action-title {
+		color: #ee2f72;
+		font-weight: bold;
+		justify-content: center;
 
-			.action-title-icon {
-				width: 20rpx;
-				height: 12rpx;
-			}
+		.action-title-icon {
+			width: 20rpx;
+			height: 12rpx;
 		}
+	}
 
-		.action-title-tip {
-			font-size: $font-sm;
-			color: $font-color-light;
-			text-align: center;
-		}
+	.action-title-tip {
+		font-size: $font-sm;
+		color: $font-color-light;
+		text-align: center;
 	}
+}
 
-	.productList {
-		margin: 0 30rpx 20rpx 30rpx;
-		border-radius: 20rpx;
-		overflow: hidden;
-		background-color: #FFFFFF;
-		position: relative;
-		line-height: 1;
-		.tipLeft{
-			background-color:rgba(255, 51, 66, 1) ;
-			border-radius: 100rpx;
-			border-bottom-left-radius: 0rpx;
-			padding: 15rpx 25rpx;
-			position: absolute;
-			left: 0;
-			top: 0;
-			z-index: 9;
-		}
-		.productImg {
-			height: 330rpx;
-			width: 690rpx;
-		}
-		.product-name{
-			font-size: $font-base + 2rpx;
-			font-weight: bold;
-			color: $font-color-dark;
+.productList {
+	margin: 0 30rpx 20rpx 30rpx;
+	border-radius: 20rpx;
+	overflow: hidden;
+	background-color: #ffffff;
+	position: relative;
+	line-height: 1;
+	.tipLeft {
+		background-color: rgba(255, 51, 66, 1);
+		border-radius: 100rpx;
+		border-bottom-left-radius: 0rpx;
+		padding: 15rpx 25rpx;
+		position: absolute;
+		left: 0;
+		top: 0;
+		z-index: 9;
+	}
+	.productImg {
+		height: 330rpx;
+		width: 690rpx;
+	}
+	.product-name {
+		font-size: $font-base + 2rpx;
+		font-weight: bold;
+		color: $font-color-dark;
+	}
+	.mask,
+	.sales {
+		font-size: $font-sm;
+		color: $font-color-light;
+	}
+	.money {
+		align-items: flex-end;
+		line-height: 0;
+		.payMoney {
+			color: #ff4c4c;
 		}
-		.mask,.sales{
-			font-size: $font-sm;
+		.oldMoney {
+			text-decoration: line-through;
 			color: $font-color-light;
-		}
-		.money{
-			align-items: flex-end;
-			line-height: 0;
-			.payMoney{
-				color: #FF4C4C;
-			}
-			.oldMoney{
-				text-decoration:line-through;
-				color: $font-color-light;
-				font-size: $font-base - 2rpx;
-			}
-		}
-		.buttomPlay{
 			font-size: $font-base - 2rpx;
-			background-color:#EE2F72 ;
-			border-radius: 10rpx;
-			padding: 10rpx 20rpx;
 		}
 	}
+	.buttomPlay {
+		font-size: $font-base - 2rpx;
+		background-color: #ee2f72;
+		border-radius: 10rpx;
+		padding: 10rpx 20rpx;
+	}
+}
 </style>

+ 136 - 162
pages/money/pay.vue

@@ -2,31 +2,33 @@
 	<view class="app">
 		<view class="price-box">
 			<text>支付金额</text>
-			<text class="price">{{ money.toFixed(2) }}</text>
+			<text class="price">{{ money }}</text>
 		</view>
 		<view class="pay-type-list">
+			<!-- #ifndef APP-PLUS -->
 			<view class="type-item b-b" @click="changePayType(1)">
 				<text class="icon iconfont iconweixin"></text>
 				<view class="con">
 					<text class="tit">微信支付</text>
 					<text>推荐使用微信支付</text>
 				</view>
-				<label class="radio"><radio value="" color="#ee2f72" :checked="payType == 1"></radio></label>
+				<label class="radio"><radio value="" color="#5dbc7c" :checked="payType == 1"></radio></label>
 			</view>
+			<!-- #endif -->
 			<!-- #ifdef APP-PLUS -->
 			<view class="type-item b-b" @click="changePayType(2)">
 				<text class="icon iconfont iconzhifubao"></text>
 				<view class="con"><text class="tit">支付宝支付</text></view>
-				<label class="radio"><radio value="" color="#ee2f72" :checked="payType == 2"></radio></label>
+				<label class="radio"><radio value="" color="#5dbc7c" :checked="payType == 2"></radio></label>
 			</view>
 			<!-- #endif -->
-			<view class="type-item" @click="changePayType(3)" v-if="yue">
+			<view class="type-item" @click="changePayType(3)" v-if="isyue == 'false'">
 				<text class="icon iconfont iconyue"></text>
 				<view class="con">
 					<text class="tit">余额支付</text>
 					<text>可用余额 ¥{{ now_money }}</text>
 				</view>
-				<label class="radio"><radio value="" color="#ee2f72" :checked="payType == 3"></radio></label>
+				<label class="radio"><radio value="" color="#5dbc7c" :checked="payType == 3"></radio></label>
 			</view>
 		</view>
 		<text class="mix-btn" :class="{ clickbg: payLoding }" @click="!payLoding ? confirm() : ''">确认支付</text>
@@ -36,17 +38,14 @@
 <script>
 import { balance } from '@/api/wallet.js';
 import { createOrderkey, computedOrderkey, orderPay } from '@/api/order.js';
+import { getUserInfo } from '@/api/user.js';
 import { mapState } from 'vuex';
+import { isIOS } from '@/utils/platform.js';
 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, //余额
@@ -58,11 +57,7 @@ export default {
 			froms: '', //保存h5中数据来源对象
 			// #endif
 			pinkid: '', //保存拼团商品id
-			store_id: 0,
-			point_id: 0,
-			shipping_type: 1,
-			goodsType: 0,
-			yue: false //是否开启余额抵扣
+			isyue: '' //是否开启零钱抵扣
 		};
 	},
 	computed: {
@@ -71,57 +66,35 @@ export default {
 		// #endif
 	},
 	onLoad(options) {
-		this.yue = options.isyue;
-		if (options.store_id) {
-			this.store_id = options.store_id;
-		}
-		if (options.goodstype) {
-			this.goodsType = options.goodstype;
-			console.log(this.goodsType, 'this.goodsTypethis.goodsTypethis.goodsType');
-		}
+		this.isyue = options.isyue;
+		this.ispg = uni.getSystemInfoSync().platform;
+		console.log(this.ispg);
 		if (options.type == 1) {
-			console.log(options.ordid, options.money, '------------------------');
 			this.type = 1;
 			this.orderId = options.ordid;
-			this.money = options.money * 1;
+			this.money = options.money;
 		} else {
 			this.orderKey = options.key;
 			let prepage = this.$api.prePage();
 			computedOrderkey({
 				orderkey: this.orderKey,
-				couponId: prepage.couponChecked ? prepage.couponChecked.id : '', //优惠券编号
+				couponId: prepage.couponChecked.id, //优惠券编号
 				addressId: prepage.addressData.id, //地址编号
 				useIntegral: prepage.checkedPoints ? 1 : 0,
-				useIntegral: prepage.checkedYue ? 1 : 0,
-				shipping_type: prepage.shipping_type
+				useNowMoney: prepage.checkedYue ? 1 : 0
 			}).then(({ data }) => {
 				// 获取支付金额
-				console.log(data, '123456');
-				this.money = +data.result.pay_price;
-				//快递
-				// if (this.shipping_type == 1) {
-				// 	this.money = +data.result.pay_price + +data.result.deposit;
-				// }
-				//自提
-				// if (this.shipping_type == 2) {
-				// 	this.money = +data.result.pay_price + +data.result.deposit - +data.result.pay_postage;
-				// }
+				this.money = data.result.pay_price;
 			});
 		}
 		// 保存pinkid
 		if (options.pinkid) {
 			this.pinkid = options.pinkid;
 		}
-		if (options.point_id) {
-			this.point_id = options.point_id;
-			console.log(this.point_id, 'this.point_id+++++++++++++');
-		}
-		if (options.shipping_type) {
-			this.shipping_type = options.shipping_type;
-		}
 		// 载入余额
-		balance({}).then(({ data }) => {
+		getUserInfo({}).then(({ data }) => {
 			// 获取余额
+			console.log(data, '123456');
 			this.now_money = data.now_money;
 		});
 	},
@@ -138,10 +111,14 @@ export default {
 			if (this.payType == 3) {
 				this.payName = 'yue';
 			}
+			if (this.payType == 4) {
+				this.payName = 'brokerage';
+			}
 		},
 		// 支付金额
 		orderMoneyPay() {
 			let obj = this;
+			console.log(obj.orderId, '编号');
 			orderPay({
 				uni: obj.orderId,
 				// #ifdef H5
@@ -164,8 +141,10 @@ export default {
 							obj.$api.msg(msg);
 						}
 					}
+					//#ifndef APP-PLUS
 					if (obj.payName == 'weixin' || obj.payName == 'routine') {
 						let da = e.data.result.jsConfig;
+						console.log(da, '支付打印');
 						let data = {
 							// #ifdef H5
 							timestamp: da.timestamp,
@@ -180,32 +159,92 @@ export default {
 							success: function(res) {
 								obj.paySuccessTo();
 							},
-							fail: () => {
-								uni.switchTab({
-									url: '/pages/cart/cart?state=0'
-								});
+							fail: e => {
+								console.log(e, '失败');
+								// uni.navigateTo({
+								// 	url: '/pages/order/order?state=0'
+								// });
 							}
 						};
 						// #ifdef H5
 						if (obj.payName == 'weixin') {
-							obj.weichatObj.chooseWXPay(data);
+							console.log(obj.money, '支付金额');
+							if (obj.money * 1 == 0) {
+								obj.paySuccessTo();
+							} else {
+								obj.weichatObj.chooseWXPay(data);
+							}
 						}
 						// #endif
-						console.log('开始支付');
 						// #ifdef MP-WEIXIN
-						console.log('MP-WEIXIN++++++++++');
-						console.log(obj.payName);
 						if (obj.payName == 'weixin') {
-							console.log('开始支付');
-							wx.requestPayment(data);
+							if (obj.money * 1 == 0) {
+								obj.paySuccessTo();
+							} else {
+								wx.requestPayment(data);
+							}
 						}
 						// #endif
 					}
+					// #endif
+					//#ifdef APP-PLUS
+					if (obj.payName == 'weixin' || obj.payName == 'routine') {
+						let da = e.data.result.jsConfig;
+						console.log('--da--', da);
+						let data = {
+							appid: da.appid,
+							noncestr: da.noncestr,
+							package: da.package,
+							partnerid: da.partnerid,
+							prepayid: da.prepayid,
+							timestamp: da.timestamp,
+							sign: da.sign
+						};
+						console.log('--data--', data);
+						uni.requestPayment({
+							provider: 'wxpay',
+							orderInfo: data,
+							success(res) {
+								console.log(res);
+								uni.showToast({
+									title: '支付成功',
+									duration: 2000
+								});
+								obj.paySuccessTo();
+							},
+							fail(res) {
+								console.log(res, '失败');
+							}
+						});
+					}
+					if (obj.payName == 'ali') {
+						const url = e.data.result.jsConfig;
+						console.log(url, 'url');
+						uni.requestPayment({
+							provider: 'alipay',
+							orderInfo: url,
+							success: res => {
+								console.log(res);
+								uni.showToast({
+									title: '支付成功',
+									duration: 2000
+								});
+								obj.paySuccessTo();
+							},
+							fail: e => {
+								console.log(e);
+							},
+							complete: () => {}
+						});
+						obj.payLoding = false;
+					}
+					//#endif
 					uni.hideLoading();
 					obj.payLoding = false;
 				})
 				.catch(e => {
 					// 支付完成
+					uni.hideLoading();
 					obj.payLoding = false;
 					console.log(e);
 				});
@@ -214,97 +253,43 @@ export default {
 		paySuccessTo() {
 			uni.hideLoading();
 			uni.redirectTo({
-				url: '/pages/money/paySuccess?orderid=' + this.orderId + '&mun=' + this.money
+				url: '/pages/money/paySuccess?orderid=' + this.orderId
 			});
 		},
 		//确认支付
 		confirm: async function() {
 			let obj = this;
-			wx.getSetting({
-				withSubscriptions: true,
-				success(res) {
-					if (res['utyQMQe5vfiJt1CA3-Q3JnGd2_dQ3mdyY0K44Gpaut4'] == 'accept') {
-						console.log('订阅成功');
-					}
-				}
-			});
-			if (wx.requestSubscribeMessage) {
-				wx.requestSubscribeMessage({
-					tmplIds: ['utyQMQe5vfiJt1CA3-Q3JnGd2_dQ3mdyY0K44Gpaut4'],
-					success(res) {
-						console.log(res, '订阅消息');
-					},
-					fail(err) {
-						console.log(err);
-					},
-					complete() {
-						// 判断是否余额不足
-						if (obj.payName == 'yue' && +obj.now_money < obj.money) {
-							uni.showModal({
-								title: '提示',
-								content: '账户余额不足!',
-								showCancel: false,
-								success: res => {},
-								fail: () => {},
-								complete: () => {}
-							});
-							return;
-						}
-						uni.showLoading({
-							title: '支付中',
-							mask: true
-						});
-						// 支付中
-						obj.payLoding = true;
-						// #ifdef H5
-						// 获取当前是否为微信浏览器
-						obj.froms = uni.getStorageSync('weichatBrowser') || '';
-						// #endif
-						// 判断是否为未支付订单中跳转进入
-						if (obj.type != 1) {
-							// 初次生成订单
-							console.log('初次生成订单');
-							obj.firstCreateOrder();
-						} else {
-							// 已经生成订单未支付
-							console.log('已经生成订单未支付');
-							obj.orderMoneyPay();
-						}
-					}
+
+			// 判断是否余额不足
+			if (obj.payName == 'yue' && +obj.now_money < obj.money) {
+				uni.showModal({
+					title: '提示',
+					content: '账户余额不足!',
+					showCancel: false,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
 				});
+				return;
+			}
+			// 判断是否余额不足
+			uni.showLoading({
+				title: '支付中',
+				mask: true
+			});
+			// 支付中
+			obj.payLoding = true;
+			// #ifdef H5
+			// 获取当前是否为微信浏览器
+			obj.froms = uni.getStorageSync('weichatBrowser') || '';
+			// #endif
+			// 判断是否为未支付订单中跳转进入
+			if (obj.type != 1) {
+				// 初次生成订单
+				obj.firstCreateOrder();
 			} else {
-				// 判断是否余额不足
-				if (obj.payName == 'yue' && +obj.now_money < obj.money) {
-					uni.showModal({
-						title: '提示',
-						content: '账户余额不足!',
-						showCancel: false,
-						success: res => {},
-						fail: () => {},
-						complete: () => {}
-					});
-					return;
-				}
-				uni.showLoading({
-					title: '支付中',
-					mask: true
-				});
-				// 支付中
-				obj.payLoding = true;
-				// #ifdef H5
-				// 获取当前是否为微信浏览器
-				obj.froms = uni.getStorageSync('weichatBrowser') || '';
-				// #endif
-				// 判断是否为未支付订单中跳转进入
-				if (obj.type != 1) {
-					// 初次生成订单
-					console.log('初次生成订单');
-					obj.firstCreateOrder();
-				} else {
-					// 已经生成订单未支付
-					console.log('已经生成订单未支付');
-					obj.orderMoneyPay();
-				}
+				// 已经生成订单未支付
+				obj.orderMoneyPay();
 			}
 		},
 		// 初次订单创建
@@ -312,17 +297,16 @@ export default {
 			let obj = this;
 			// 获取下单页面数据
 			let prepage = obj.$api.prePage();
-			console.log(obj.goodsType, 'obj.goodsType+++++++++++++++++++');
+
 			let data = {
-				free_check: obj.goodsType == '3' ? '1' : '0',
 				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为否
+				useNowMoney: prepage.checkedYue ? 1 : 0, //是否余额抵扣
 				payType: obj.payName, //支付类型  weixin-微信 yue-余额
 				mark: prepage.desc, //备注
-				time_area: prepage.time_area, //配送时间
 				// #ifdef H5
 				from: obj.froms ? 'weixin' : 'H5', //来源
 				// #endif
@@ -332,23 +316,17 @@ export default {
 				// #ifdef APP-PLUS
 				from: 'app', //来源
 				// #endif
-				shipping_type: this.shipping_type //提货方式 1 快递 2自提
+				shipping_type: 1 //提货方式 1 快递 2自提
 			};
-			if (obj.goodsType == '3') {
-				data.free_check = '1';
-				data.shipping_type = '2';
-			} else {
-				data.store_id = obj.store_id;
-				data.point_id = obj.point_id;
-			}
-			console.log(data, '888888888887777777777777');
 			// 判断是否拼团商品
 			if (obj.pinkid) {
 				data.pinkId = obj.pinkid;
 			}
+			console.log(data, '订单参数', obj.orderKey, '订单key');
 			// 生成订单
 			createOrderkey(data, obj.orderKey)
 				.then(({ data, status, msg }) => {
+					console.log(data, '生成订单');
 					// 判断是否支付失败
 					if (data.status == 'ORDER_EXIST') {
 						uni.showModal({
@@ -364,7 +342,7 @@ export default {
 					obj.orderId = data.result.orderId;
 					// 判断是否为余额支付
 					if (obj.payName == 'yue') {
-						if (status == 200 && data.status == 'SUCCESS') {
+						if (status == 200) {
 							obj.paySuccessTo();
 						} else {
 							obj.$api.msg(msg);
@@ -375,8 +353,9 @@ export default {
 					}
 				})
 				.catch(e => {
+					uni.hideLoading();
 					obj.payLoding = false;
-					console.log(e);
+					console.log(e, '123456789');
 				});
 		}
 	}
@@ -402,7 +381,6 @@ export default {
 		font-size: 50upx;
 		color: #303133;
 		margin-top: 12upx;
-
 		&:before {
 			content: '¥';
 			font-size: 40upx;
@@ -414,7 +392,6 @@ export default {
 	margin-top: 20upx;
 	background-color: #fff;
 	padding-left: 60upx;
-
 	.type-item {
 		height: 120upx;
 		padding: 20upx 0;
@@ -430,25 +407,23 @@ export default {
 		width: 100upx;
 		font-size: 52upx;
 	}
-
+	.iconweixin1 {
+		color: #ff0000;
+	}
 	.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;
@@ -457,7 +432,6 @@ export default {
 		color: $font-color-light;
 	}
 }
-
 .mix-btn {
 	display: flex;
 	align-items: center;

+ 2 - 3
pages/money/paySuccess.vue

@@ -9,7 +9,6 @@
 			<navigator url="/pages/index/index" open-type="switchTab" class="mix-btn hollow">返回首页</navigator>
 		</view> -->
 		<view class="btn-wrapper" >
-			<navigator :url="'/pages/order/orderDetail?id='+orderId" open-type="redirect" class="look-btn" v-if="isshow">查看订单</navigator>
 			<navigator url="/pages/index/index" open-type="switchTab" class="bank">返回首页</navigator>
 		</view>
 	</view>
@@ -97,7 +96,7 @@
 		.look-btn {
 			width: 301rpx;
 			height: 78rpx;
-			background: #901b21;
+			background: #ee2f72;
 			text-align: center;
 			line-height: 78rpx;
 			border-radius: 10rpx;
@@ -110,7 +109,7 @@
 			text-align: center;
 			line-height: 78rpx;
 			background: #FFFFFF;
-			border: 2px solid #901B21;
+			border: 2px solid #ee2f72;
 			border-radius: 10rpx;
 			color: #901b21;
 		}

+ 1 - 1
pages/order/createOrder.vue

@@ -293,7 +293,7 @@ export default {
 			computedOrderkey({
 				orderkey: this.orderKey,
 				useIntegral: this.checkedPoints ? 1 : 0, //是否积分抵扣
-				useNowMoney: this.checkedYue ? 1 : 0, //是否积分抵扣
+				useNowMoney: this.checkedYue ? 1 : 0, //是否余额抵扣
 				couponId: this.couponChecked.id, //优惠券编号
 				addressId: this.tabCurrentIndex == 0 ? this.addressData.id : '', //地址编号
 				shipping_type: this.shipping_type //提货方式 1 快递 2自提

+ 8 - 8
pages/product/product.vue

@@ -33,7 +33,7 @@
 				<text class="price-tip">¥</text>
 				<view class="price">
 					{{ actionPrice }}
-					<text class="m-price" v-if="actionPrice*1 < goodsObjact.ot_price*1">¥{{ goodsObjact.ot_price }}</text>
+					<text class="m-price" v-if="actionPrice * 1 < goodsObjact.ot_price * 1">¥{{ goodsObjact.ot_price }}</text>
 				</view>
 			</view>
 			<text class="title clamp2" v-if="goodsObjact.title">{{ goodsObjact.title }}</text>
@@ -238,7 +238,7 @@ export default {
 		obj.userInfo = uni.getStorageSync('userInfo');
 		//保存商品id
 		this.goodsid = options.id;
-		this.goodsType = options.type * 1;
+		this.goodsType = options.type * 1 || 0;
 		if (this.goodsType == 3) {
 			//获取兑换券的兑换说明
 			// this.getDhsm(2);
@@ -438,10 +438,10 @@ export default {
 						console.log(str, 'str');
 						// 设置默认值
 						obj.actionPrice = obj.productValue[str].price;
-						console.log(obj.actionPrice,'obj.actionPrice')
+						console.log(obj.actionPrice, 'obj.actionPrice');
 						obj.goodsNumberMax = obj.productValue[str].stock;
-						if(obj.goodsType == 3) {
-							obj.goodsNumberMax = 1
+						if (obj.goodsType == 3) {
+							obj.goodsNumberMax = 1;
 						}
 						obj.actionImage = obj.productValue[str].image;
 						obj.uniqueId = obj.productValue[str].unique;
@@ -452,8 +452,8 @@ export default {
 						obj.actionPrice = goods.price; //保存默认选中商品价格
 						obj.actionImage = goods.image_base; //保存默认选中商品图片
 						obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
-						if(obj.goodsType == 3) {
-							obj.goodsNumberMax = 1
+						if (obj.goodsType == 3) {
+							obj.goodsNumberMax = 1;
 						}
 						obj.shopId = data.mer_id; //保存商店id
 					}
@@ -971,7 +971,7 @@ page {
 	margin-bottom: -40rpx;
 	display: flex;
 	justify-content: space-between;
-	.bg{
+	.bg {
 		width: 750rpx;
 		height: 165rpx;
 		position: absolute;