1004749546@qq.com 4 سال پیش
والد
کامیت
75ba32b9e2
5فایلهای تغییر یافته به همراه134 افزوده شده و 30 حذف شده
  1. 5 0
      pages.json
  2. 66 0
      pages/coupon/chooseCoupon/chooseCoupon.vue
  3. 53 23
      pages/coupon/couponTpl.vue
  4. 1 1
      pages/coupon/index/index.vue
  5. 9 6
      pages/index/index.vue

+ 5 - 0
pages.json

@@ -61,6 +61,11 @@
 			"style": {
 				"navigationBarTitleText": "注意事项及服务协议"
 			}
+		}, {
+			"path": "pages/coupon/chooseCoupon/chooseCoupon",
+			"style": {
+				"navigationBarTitleText": "选择优惠卷"
+			}
 		}
 	],
 	"globalStyle": {

+ 66 - 0
pages/coupon/chooseCoupon/chooseCoupon.vue

@@ -0,0 +1,66 @@
+<template>
+	<view class="coopon-pages">
+		<couponTpl @checkOk="checkOk" :showCheck="true"></couponTpl>
+		<view class="fix-button" v-if="curCoupon">
+			<view>
+				<view>优惠:¥9.8</view>
+				<view @click="comfirn">确认</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import couponTpl from '@/pages/coupon/couponTpl.vue'
+	export default {
+		components: {
+			couponTpl
+		},
+		data() {
+			return {
+				curCoupon: null
+			};
+		},
+		methods:{
+			checkOk(item){
+				this.curCoupon = item
+			},
+			// 确认按钮
+			comfirn(){
+				uni.navigateBack()
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.coopon-pages{
+		width: 100%;
+		padding-bottom: 100rpx;
+		.fix-button{
+			width: 100%;
+			position: fixed;
+			bottom: 0;
+			> view{
+				display: flex;
+				align-items: center;
+				background: #333;
+				>view{
+					padding: 20rpx 30rpx;
+					color: #fff;
+					&:first-child{
+						width: 70%;
+						flex-grow: 1;
+					}
+					&:last-child{
+						background:red;
+						width: 30%;
+						color: #fff;
+						text-align: center;
+						font-size: 36rpx;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 53 - 23
pages/coupon/couponTpl.vue

@@ -1,8 +1,8 @@
 <template>
 	<view class="coupon-list">
-		<view class="coupon-box">
-			<view class="coupon-head" @click="checked">
-				<view class="coupon-sel coupon-checked" v-if="showCheck"></view>
+		<view class="coupon-box" v-for="item in list" :key="item.id" @click="checked(item)">
+			<view class="coupon-head">
+				<view class="coupon-sel coupon-checked" v-if="item.checked"></view>
 				<view class="coupon-sel" v-else></view>
 				<view class="coupon-title">
 					<view class="coupon-title-1">满100减50</view>
@@ -16,22 +16,6 @@
 				<view><u-icon class="icon" size="30" name="info-circle"></u-icon> 优惠卷使用说明优惠卷使用说明优惠卷使用说明优惠卷使用说明</view>
 			</view>
 		</view>
-		<view class="coupon-box diabled">
-			<view class="coupon-head" @click="checked">
-				<view class="coupon-sel coupon-checked" v-if="false"></view>
-				<view class="coupon-sel" v-else></view>
-				<view class="coupon-title">
-					<view class="coupon-title-1">满100减50</view>
-				</view>
-				<view class="coupon-price">
-					¥<text>100</text>
-				</view>
-			</view>
-			<view class="coupon-desc">
-				<view><u-icon class="icon" size="30" name="clock"></u-icon> 有效期至:2020-05-12</view>
-				<view><u-icon class="icon" size="30" name="info-circle"></u-icon> 优惠卷使用说明</view>
-			</view>
-		</view>
 	</view>
 </template>
 
@@ -41,20 +25,66 @@
 		props: {
 			showCheck: {
 				type: Boolean,
-				default: true
+				default: false
 			},
 			list:{
 				type: Array,
 				default: function(){
-					return []
+					return [
+						{
+							id: 23432445,
+							name: "满100减50",
+							price: 100,
+							yxTime: "2020-05-16",
+							remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
+							checked: false
+						},
+						{
+							id: 3544355,
+							name: "满100减50",
+							price: 100,
+							yxTime: "2020-05-16",
+							remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
+							checked: false
+						},
+						{
+							id: 234234234,
+							name: "满100减50",
+							price: 100,
+							yxTime: "2020-05-16",
+							remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
+							checked: false
+						},
+						{
+							id: 66264646,
+							name: "满100减50",
+							price: 100,
+							yxTime: "2020-05-16",
+							remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
+							checked: false
+						},
+						{
+							id: 9794694698,
+							name: "满100减50",
+							price: 100,
+							yxTime: "2020-05-16",
+							remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
+							checked: false
+						}
+					]
 				}
 			}
 		},
 		methods: {
 			// 选中优惠卷
-			checked() {
+			checked(item) {
 				if(this.showCheck){
-					
+					let has = this.list.find(item=>item.checked)
+					if(has){
+						has.checked = false
+					}
+					item.checked = true
+					this.$emit('checkOk',item)
 				}
 			},
 		},

+ 1 - 1
pages/coupon/index/index.vue

@@ -4,7 +4,7 @@
 			<u-tabs-swiper ref="uTabs" :list="tabsList" bar-width="100" :current="current" @change="tabsChange" :is-scroll="false"
 			 swiperWidth="750"></u-tabs-swiper>
 		</view>
-		<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
+		<swiper style="height: calc(100% - 40px);" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
 			<swiper-item class="swiper-item" v-for="(item, index) in tabsList" :key="index">
 				<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
 					<couponTpl></couponTpl>

+ 9 - 6
pages/index/index.vue

@@ -218,12 +218,15 @@
 			},
 			// 扫码洗车
 			scanCode () {
-				uni.scanCode({
-				    success: function (res) {
-				        console.log('条码类型:' + res.scanType);
-				        console.log('条码内容:' + res.result);
-				    }
-				});
+				uni.navigateTo({
+					url: "/pages/getOrder/getOrder"
+				})
+				// uni.scanCode({
+				//     success: function (res) {
+				//         console.log('条码类型:' + res.scanType);
+				//         console.log('条码内容:' + res.result);
+				//     }
+				// });
 			},
 			// 创建标记点
 			createMarker(point) {