zs 2 rokov pred
rodič
commit
423c2c7d35
2 zmenil súbory, kde vykonal 13 pridanie a 32 odobranie
  1. 3 25
      pages/index/index.vue
  2. 10 7
      pagesHome/order/order.vue

+ 3 - 25
pages/index/index.vue

@@ -4,20 +4,6 @@
 			<view class="one">
 				<image class="logo" :src="logoUrl" mode=""></image>
 			</view>
-			<view class="two">
-				<button @tap="toPopup('1')">打开弹框1</button>
-				<button @tap="toPopup('2')">打开弹框2</button>
-				<uni-popup ref="popup" background-color="#fff" type="bottom">
-					<view class="popup">
-						<view class="popup_1" v-if="popup.type=='1'">
-							弹框一
-						</view>
-						<view class="popup_1" v-else-if="popup.type=='2'">
-							弹框二
-						</view>
-					</view>
-				</uni-popup>
-			</view>
 		</view>
 	</mobile-frame>
 </template>
@@ -28,9 +14,6 @@
 		data() {
 			return {
 				logoUrl: '',
-				popup: {
-					type: '1'
-				}
 			};
 		},
 		onLoad: function() {},
@@ -39,11 +22,6 @@
 			that.search();
 		},
 		methods: {
-			toPopup(e) {
-				const that = this;
-				that.$set(that.popup, `type`, e);
-				that.$refs.popup.open();
-			},
 			search() {
 				const that = this;
 				that.$set(that, `logoUrl`, that.$config.logoUrl);
@@ -54,9 +32,9 @@
 							key: 'system',
 							data: res,
 							success: function() {
-								// uni.redirectTo({
-								// 	url: `/pages/home/index`
-								// })
+								uni.redirectTo({
+									url: `/pages/home/index`
+								})
 							}
 						});
 					}

+ 10 - 7
pagesHome/order/order.vue

@@ -92,7 +92,7 @@
 			</view>
 		</view>
 		<uni-popup ref="popup" background-color="#fff" type="bottom">
-			<view class="content">
+			<view class="popup" v-if="popup.type=='1'">
 				<scroll-view scroll-y="true" class="scroll-view">
 					<view class="list" v-for="(item,index) in addressList" :key="index">
 						<view class="one">
@@ -125,9 +125,7 @@
 					</view>
 				</scroll-view>
 			</view>
-		</uni-popup>
-		<uni-popup ref="popup2" background-color="#fff" type="bottom">
-			<view class="content">
+			<view class="popup" v-else-if="popup.type=='2'">
 				<scroll-view scroll-y="true" class="scroll-view">
 					<discount :Style="Style" :couponList="couponList" @toDiscount="toDiscount"></discount>
 				</scroll-view>
@@ -144,6 +142,9 @@
 		},
 		data() {
 			return {
+				popup: {
+					type: '1'
+				},
 				Style: {
 					btn: true
 				},
@@ -180,13 +181,14 @@
 				const that = this;
 				that.$set(that, 'coupon_name', e.name)
 				that.coupon.push(e._id)
-				that.$refs.popup2.close();
+				that.$refs.popup.close();
 				this.computedTotal();
 			},
 			// 选择收货地址
 			toChoose() {
 				const that = this;
 				if (that.addressList.length > 0) {
+					that.$set(that.popup, 'type', '1')
 					that.$refs.popup.open();
 				} else {
 					uni.showToast({
@@ -198,8 +200,9 @@
 			// 选择优惠劵
 			toCoupon() {
 				const that = this;
+				that.$set(that.popup, 'type', '2')
 				that.$set(that, 'coupon', [])
-				that.$refs.popup2.open();
+				that.$refs.popup.open();
 			},
 			// 是否选中
 			toCheckbox(e) {
@@ -620,7 +623,7 @@
 		}
 	}
 
-	.content {
+	.popup {
 		display: flex;
 		flex-direction: column;
 		height: 100vw;