guhongwei преди 2 години
родител
ревизия
7654e3aa73
променени са 5 файла, в които са добавени 585 реда и са изтрити 2 реда
  1. 12 0
      pages.json
  2. 90 1
      pages/home/index.vue
  3. 1 1
      pages/index/index.vue
  4. 257 0
      pagesRest/activity/info.vue
  5. 225 0
      pagesRest/activity/list.vue

+ 12 - 0
pages.json

@@ -288,6 +288,18 @@
 					"style": {
 						"navigationBarTitleText": "商品类别"
 					}
+				},
+				{
+					"path": "activity/list",
+					"style": {
+						"navigationBarTitleText": "活动列表"
+					}
+				},
+				{
+					"path": "activity/info",
+					"style": {
+						"navigationBarTitleText": "活动详情"
+					}
 				}
 
 			]

+ 90 - 1
pages/home/index.vue

@@ -42,6 +42,20 @@
 							</view>
 						</view>
 					</view>
+					<view class="zero act">
+						<view class="list" v-for="(item,index) in platformactList" :key="index" @tap="toAct(item)">
+							<view class="img">
+								<image class="image" :src="item.cover&&item.cover.length>0?item.cover[0].url:''" mode="">
+								</image>
+							</view>
+							<view class="title">
+								<text>{{item.title}}</text>
+							</view>
+							<view class="time" v-if="item.act_time.is_use=='0'">
+								<text>{{item.act_time.value}}</text>
+							</view>
+						</view>
+					</view>
 					<view class="zero five">
 						<view class="five_pubu">
 							<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toBuy(item)">
@@ -91,6 +105,8 @@
 				],
 				recomList: [ //推荐好物
 				],
+				platformactList: [ //平台活动
+				],
 				marketList: [ //商品列表
 				],
 				total: 0,
@@ -136,6 +152,11 @@
 				// 推荐好货
 				res = await that.$api(`/viewGoods/iatg`, 'GET', {});
 				if (res.errcode == '0') that.$set(that, `recomList`, res.data);
+				// 平台活动
+				res = await that.$api(`/platformAct`, 'GET', {
+					show_index: 0
+				});
+				if (res.errcode == '0') that.$set(that, `platformactList`, res.data);
 				// 首页产品列表
 				res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					skip: that.skip,
@@ -177,7 +198,15 @@
 				const that = this;
 				that.clearPage();
 				uni.navigateTo({
-					url: `/pagesRest/recom/index?act_tags=${e.value}&type=2`
+					url: `/pagesRest/recom/index?act_tags=${e.value}`
+				})
+			},
+			// 平台活动
+			toAct(e) {
+				const that = this;
+				that.clearPage();
+				uni.navigateTo({
+					url: `/pagesRest/activity/info?id=${e._id}`
 				})
 			},
 			// 购买
@@ -371,6 +400,66 @@
 			}
 		}
 
+		.act {
+			background-color: var(--f2Color);
+			padding: 2vw 2vw 0 2vw;
+			display: flex;
+			flex-direction: column;
+
+			.act_1 {
+				text-align: center;
+				margin: 0 0 2vw 0;
+				font-family: cursive;
+				color: #ff0000;
+				font-size: 20px;
+			}
+
+			.list {
+				border-radius: 10px;
+				position: relative;
+
+				.img {
+					.image {
+						width: 100%;
+						height: 14vh;
+						box-shadow: 0 0 5px #f1f1f1;
+						border-radius: 10px;
+					}
+				}
+
+				.title {
+					position: absolute;
+					top: 5vw;
+					text-align: center;
+					width: 95%;
+					left: 2vw;
+
+
+					text {
+						font-size: 20px;
+						font-family: cursive;
+						color: #000000;
+						font-weight: bold;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						-webkit-line-clamp: 2;
+						word-break: break-all;
+						display: -webkit-box;
+						-webkit-box-orient: vertical;
+					}
+				}
+
+				.time {
+					position: absolute;
+					bottom: 2vw;
+					right: 2vw;
+					font-size: 12px;
+					width: 100%;
+					text-align: right;
+				}
+			}
+		}
+
 		.five {
 			display: flex;
 			flex-direction: column;

+ 1 - 1
pages/index/index.vue

@@ -53,7 +53,7 @@
 							data: res,
 							success: function() {
 								uni.redirectTo({
-									// url: `/pagesHome/shop/index`
+									// url: `/pagesRest/activity/list`
 									url: `/pages/home/index`
 								})
 							}

+ 257 - 0
pagesRest/activity/info.vue

@@ -0,0 +1,257 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<view class="one_1" v-if="barActive=='0'">
+					<scroll-view scroll-y="true" class="scroll-view">
+						<view class="content">
+							<u-parse :content="info.content.value"></u-parse>
+						</view>
+					</scroll-view>
+				</view>
+				<view class="one_2" v-else-if="barActive=='1'">
+					<view class="one_2_1">
+						<input type="text" v-model="searchInfo.name" @blur="toInput" placeholder="搜索商品">
+					</view>
+					<view class="one_2_2">
+						<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+							<view class="list-scroll-view">
+								<view class="pubu">
+									<view class="list" v-for="(item,index) in list" :key="index">
+										{{item.goods}}
+									</view>
+								</view>
+								<view class="is_bottom" v-if="is_bottom">
+									<text>我们也是有底线的!</text>
+								</view>
+							</view>
+						</scroll-view>
+					</view>
+				</view>
+			</view>
+			<view class="two">
+				<view class="list" v-for="(item,index) in barList" :key="index" @tap="barChange(index,item)">
+					<view class="icon">
+						<text :class="['iconfont',barActive==index?item.acticon:item.icon]"></text>
+					</view>
+					<view :class="['name',barActive==index?'activename':'']">
+						{{item.name}}
+					</view>
+				</view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	import uParse from "@/components/u-parse/u-parse.vue";
+	export default {
+		components: {
+			uParse,
+		},
+		data() {
+			return {
+				id: '',
+				barActive: '0',
+				barList: [ //底部菜单
+					{
+						icon: 'icon-shangdian',
+						acticon: "icon-shangdian-copy",
+						name: '活动详情'
+					},
+					{
+						icon: 'icon-shangpinfenlei',
+						acticon: "icon-shangpinfenlei-copy",
+						name: '商品列表'
+					}
+				],
+				// 详情
+				info: {},
+				// 商品列表
+				list: [],
+				total: 0,
+				page: 0,
+				skip: 0,
+				limit: 6,
+				// 查询
+				searchInfo: {},
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
+			};
+		},
+		onLoad: function(e) {
+			const that = this;
+			that.$set(that, `id`, e.id || '634fa595e4ed552882f05a6f');
+		},
+		onShow: function() {
+			const that = this;
+			that.searchAct();
+		},
+		methods: {
+			async searchAct() {
+				const that = this;
+				if (that.id) {
+					// 查询详情
+					let res = await that.$api(`/platformAct/${that.id}`, 'GET');
+					if (res.errcode == '0') {
+						uni.setNavigationBarTitle({
+							title: res.data.title
+						});
+						that.$set(that, `info`, res.data)
+					}
+					that.search()
+				}
+			},
+			// 查询列表
+			async search() {
+				const that = this;
+				// 查询商品列表
+				let info = {
+					skip: that.skip,
+					limit: that.limit,
+					platformAct: that.id
+				}
+				let res = await that.$api(`/goodsJoinAct`, 'GET', {
+					...info,
+					...that.searchInfo
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				}
+			},
+			toPage() {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 输入框
+			toInput(e) {
+				const that = this;
+				if (e.detail.value) that.$set(that.searchInfo, `name`, e.detail.value);
+				that.clearPage();
+				that.search();
+			},
+			// 选择底部菜单
+			barChange(index, item) {
+				const that = this;
+				that.$set(that, `barActive`, index);
+				// uni.setNavigationBarTitle({
+				// 	title: item.name
+				// });
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			position: relative;
+			flex-grow: 1;
+
+			.one_1 {
+				height: 92vh;
+
+				.content {
+					padding: 2vw;
+				}
+
+				image {
+					width: 100% !important;
+				}
+			}
+
+			.one_2 {
+				height: 92vh;
+
+				.one_2_1 {
+					border-bottom: 1px solid var(--f85Color);
+					padding: 2vw;
+
+					input {
+						padding: 2vw;
+						background-color: var(--f1Color);
+						font-size: var(--font14Size);
+						border-radius: 5px;
+					}
+				}
+
+				.one_2_2 {
+					padding: 2vw;
+				}
+			}
+		}
+
+		.two {
+			display: flex;
+			flex-direction: row;
+			justify-content: space-around;
+			border-top: 1px solid #f1f1f1;
+
+			.list {
+				padding: 1vw 0;
+				text-align: center;
+
+				.icon {}
+
+				.name {
+					font-size: 12px;
+				}
+
+				.activename {
+					color: var(--fFB1Color);
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: row;
+			flex-wrap: wrap;
+		}
+	}
+</style>

+ 225 - 0
pagesRest/activity/list.vue

@@ -0,0 +1,225 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<input type="text" v-model="searchInfo.title" @blur="toInput" placeholder="请输入活动名称">
+			</view>
+			<view class="two">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+					<view class="list-scroll-view">
+						<view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
+							<view class="img">
+								<image class="image" :src="item.cover&&item.cover.length>0?item.cover[0].url:''" mode="">
+								</image>
+							</view>
+							<view class="title">
+								<text>{{item.title}}</text>
+							</view>
+							<view class="time" v-if="item.act_time.is_use=='0'">
+								<text>{{item.act_time.value}}</text>
+							</view>
+						</view>
+						<view class="is_bottom" v-if="is_bottom">
+							<text>我们也是有底线的!</text>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				searchInfo: {},
+				list: [],
+				total: 0,
+				page: 0,
+				skip: 0,
+				limit: 6,
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
+			};
+		},
+		onLoad: function(e) {},
+		onShow: function() {
+			const that = this;
+			that.search();
+		},
+		methods: {
+			async search() {
+				const that = this;
+				let info = {
+					skip: that.skip,
+					limit: that.limit
+				}
+				let res = await that.$api(`/platformAct`, 'GET', {
+					...info,
+					...that.searchInfo
+				});
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data]
+					that.$set(that, `list`, list);
+					that.$set(that, `total`, res.total);
+				}
+			},
+			toPage() {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 输入框
+			toInput(e) {
+				const that = this;
+				if (e.detail.value) that.$set(that.searchInfo, `title`, e.detail.value);
+				else that.$set(that, `searchInfo`, {});
+				that.clearPage();
+				that.search();
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			},
+			toInfo(e) {
+				const that = this;
+				that.clearPage();
+				uni.navigateTo({
+					url: `/pagesRest/activity/info?id=${e._id}`
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			border-bottom: 1px solid var(--f85Color);
+			padding: 2vw;
+
+			input {
+				padding: 2vw;
+				background-color: var(--f1Color);
+				font-size: var(--font14Size);
+				border-radius: 5px;
+			}
+		}
+
+		.two {
+			position: relative;
+			flex-grow: 1;
+
+			.list {
+				margin: 2vw 2vw 0 2vw;
+				width: 96vw;
+				border-radius: 10px;
+				box-shadow: 0 0 5px #858585;
+				position: relative;
+
+				.img {
+					.image {
+						width: 100%;
+						height: 14vh;
+						box-shadow: 0 0 5px #f1f1f1;
+						border-radius: 10px;
+					}
+				}
+
+				.title {
+					position: absolute;
+					top: 5vw;
+					text-align: center;
+					width: 95%;
+					left: 2vw;
+
+					text {
+						font-size: 20px;
+						font-family: cursive;
+						color: #000000;
+						font-weight: bold;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						-webkit-line-clamp: 2;
+						word-break: break-all;
+						display: -webkit-box;
+						-webkit-box-orient: vertical;
+					}
+				}
+
+				.time {
+					position: absolute;
+					bottom: 2vw;
+					right: 2vw;
+					font-size: 12px;
+					width: 100%;
+					text-align: right;
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: row;
+			flex-wrap: wrap;
+		}
+	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 1vw 0;
+			display: inline-block;
+		}
+	}
+
+	.is_bottom {
+		text-align: center;
+		width: 100vw;
+
+		text {
+			padding: 1vw 0;
+			display: inline-block;
+		}
+	}
+</style>