| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- <template>
- <div class="Appindex">
- <!-- 顶部 -->
- <view class="head">
- <!-- 搜索框 -->
- <view class="head_search">
- <text class="iconfont"></text>
- <text class="search_text">请输入搜索关键字</text>
- </view>
- <!-- 搜索框-end -->
- <!-- 轮播图 -->
- <swiper-banner :radius="1" imgScale="5:2" :imgArr="BannerImg" :duration="1000" :interval="5000" :circular="true" :autoplay="true" @goList="goList" :indicator-dots="true" indicator-active-color="#12B280" indicator-color="rgba(255, 255, 255, .82)"></swiper-banner>
- <!-- 轮播图-end -->
- <!-- 公告 -->
- <view class="head_notice clearfix">
- <view class="notice_title">
- <image class="gg_img" src="@/static/img/gg.png"></image>
- </view>
- <swiper class="notice_swiper" vertical autoplay circular :interval="5000" :duration="1000">
- <swiper-item v-for="(item, index) in not_list" :key="index">
- <text class="not_list ellipsis1">{{ item.title }}</text>
- <text class="not_ico iconfont"></text>
- </swiper-item>
- </swiper>
- </view>
- <!-- 公告-end -->
- <!-- 金刚区 -->
- <view class="head_area">
- <view class="area_list" v-for="(item, index) in area_list" :key="index" @click="setPageUrl(item)">
- <image class="area_img" :src="item.url"></image>
- <view class="area_name">{{ item.name }}</view>
- </view>
- </view>
- <!-- 金刚区-end -->
- <!-- 活动 -->
- <view class="activity" v-if="spc_list.length > 0">
- <image class="act_one_img" :src="spc_list[0].url" mode=""></image>
- <view class="act_other">
- <image class="act_two_img" :src="spc_list[1].url" mode=""></image>
- <image class="act_two_img" :src="spc_list[2].url" mode=""></image>
- </view>
- </view>
- <!-- 活动-end -->
- </view>
- <view class="list_bar">
- <div class="tit">猜你喜欢</div>
- <view class="product-list">
- <view class="product" v-for="(i, s) in productList" :key="s" @click="NavToGoodsDetail(i.id,i.type)">
- <view class="image-view">
- <image class="product-image" :src="i.original_img"></image>
- </view>
- <view :class="['product-title', 'ellipsis1']">{{ i.goods_name }}</view>
- <view class="product-price">
- <text class="product-price-original"><text class="product-unit">¥</text>{{ i.price }}</text>
- <!-- <text class="product-price-favour">¥{{i.originalPrice}}</text> -->
- <!-- <text class="product-tip">{{i.tip}}</text> -->
- </view>
- <view class="product-txt">{{ i.give_integral + "积分" }}</view>
- </view>
- <view class='fz_w_text mar_t20 mar_b20'>茶,让生活更美好!</view>
- </view>
- </view>
- </div>
- </template>
- <script>
- let app=getApp();
- var appEv = app.$vm.$options;
- // import goodslist from "@/components/goodsList"; //商品列表
- import swiperBanner from "@/components/swiperBanner"; //轮播
- import { get, post } from "@/request/api.js";
- export default {
- name: "Appindex",
- components: {
- // goodslist, //商品列表
- swiperBanner, //轮播
- },
- data() {
- return {
- BannerImg: [], // 轮播图列表
- not_list: [], // 公告列表
- // 金刚区
- area_list: [
- {name: "零售区", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/cart.png", type:1},
- {name: "批发区", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/wholesale.png", type:2},
- {name: "精品优选", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/preferred.png", type:3},
- {name: "今日值买", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/integral.png", type:4}
- ],
- spc_list: [
- {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/f70cd8e0-e468-45eb-a9f7-2c42713cd607.jpg"},
- {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/b13c0186-fdfc-4b87-b466-5c9fc336cc54.jpg"},
- {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/49886d9c-ce5a-49ca-a281-12910541344f.jpg"}
- ], //活动列表
- productList: [], //商品数据
- };
- },
- onLoad(option) {
- },
- onLaunch() {},
- onShow() {
- this.loadData()
- this.getBanner(); //获取轮播图
- this.getAnnounce(); //获取公告列表
- // this.getImageTwo(); //金刚区
- // this.getImage(); //获取活动列表
- },
- onHide() {},
- methods: {
- loadData() {
- post("goods/indexGoods").then((res) => {
- if (res.code === 0) {
- this.productList = res.data.data;
- }
- });
- },
- // 跳转到商品详情页
- NavToGoodsDetail(id, type) {
- this.goto("/pages/product/p_details", { id, type });
- },
- // 获取轮播图
- getBanner() {
- post("banner").then((res) => {
- if (res.code === 0) {
- this.BannerImg = []
- res.data.data.forEach(e => {
- if(e.image) this.BannerImg.push(e.image)
- });
- // this.BannerImg = res.list;
- }
- });
- },
- // 获取公告列表
- getAnnounce() {
- post("notice").then((res) => {
- console.log(res);
- if (res.code === 0) {
- this.not_list = [res.data.data];
- }
- });
- },
-
- // 获取金刚区列表
- getImageTwo() {
- post("ShuZiTeaSpecial/special/imageTwo").then((res) => {
- if (res.status == 200) {
- this.area_list = res.data;
- }
- });
- },
- // 获取活动区列表
- getImage() {
- post("ShuZiTeaSpecial/special/image").then((res) => {
- if (res.status == 200) {
- this.spc_list = res.data;
- }
- });
- },
- // 轮播图跳转
- goList(e) {
- let id = e.id;
- // uni.navigateTo({
- // url: "/pages/prefecture-list/index?id=" + id + "&type=1",
- // });
- },
- // 金刚区跳转
- setPageUrl(item){
- if(item.type == 1){
- this.goto('/pages/product/productRetail',{type:item.type})
- }else if(item.type == 2){
- this.goto('/pages/product/productWholesale',{type:item.type})
- }
- // else if(item.type == 3){
- // this.goto('/pages/product/productRetail',{type:item.type})
- // }
- // else if(item.type == 4){
- // this.goto('/pages/product/productRetail',{type:item.type})
- // }
- else{
- appEv.errTips('此功能暂未开放!')
- return false
- }
- },
- },
- computed: {},
- watch: {},
- };
- </script>
- <style scoped lang='scss'>
- .head {
- padding: 12rpx 28rpx;
- }
- .head_search {
- width: 100%;
- height: 64rpx;
- line-height: 64rpx;
- background: #f3f5f7;
- border-radius: 32rpx;
- text-align: center;
- font-size: 28rpx;
- color: #bbbbbb;
- margin-bottom: 26rpx;
- .search_text {
- margin-left: 14rpx;
- }
- }
- .head_notice {
- margin: 30rpx 0;
- .notice_title {
- width: 130rpx;
- height: 40rpx;
- float: left;
- .gg_img {
- width: 100%;
- height: 40rpx;
- }
- }
- .notice_swiper {
- height: 40rpx;
- padding-left: 20rpx;
- font-size: 28rpx;
- float: left;
- box-sizing: border-box;
- width: calc(100% - 130rpx);
- .not_list {
- width: calc(100% - 50rpx);
- }
- .not_ico {
- width: 30rpx;
- font-size: 28rpx;
- color: #999;
- }
- .not_list,
- .not_ico {
- display: inline-block;
- vertical-align: middle;
- height: 40rpx;
- line-height: 40rpx;
- }
- }
- }
- // 金刚区
- .head_area {
- margin: 20rpx 0 20rpx;
- padding: 20rpx 0;
- border-radius: 18rpx;
- box-shadow: 2px 2px 13px 1px rgba(17, 18, 29, 0.08);
- .area_list {
- display: inline-block;
- width: 25%;
- text-align: center;
- .area_img {
- width: 46rpx;
- height: 46rpx;
- margin-bottom: 12rpx;
- }
- .area_name {
- font-size: 24rpx;
- color: #474747;
- }
- }
- }
- // 金刚区-end
- // 活动
- .activity {
- .act_one_img {
- display: inline-block;
- width: 300rpx;
- height: 378rpx;
- margin-right: 10rpx;
- }
- .act_other {
- display: inline-block;
- width: calc(100% - 300rpx - 10rpx);
- }
- .act_two_img {
- width: 100%;
- height: 185rpx;
- }
- }
- // 活动-end
- // 商品列表
- .list_bar{
- .tit{
- text-align: center;
- font-size: 36rpx;
- color: #121212;
- padding: 40rpx 0 20rpx;
- font-weight: bold;
- }
- }
- .product-list {
- padding: 0 20rpx;
- display: flex;
- width: 100%;
- flex-wrap: wrap;
- flex-direction: row;
- .product {
- width: 50%;
- padding: 20rpx 10rpx;
- display: flex;
- flex-direction: column;
- }
- .product-image {
- border-radius: 10rpx 10rpx 0 0;
- width: 100%;
- height: 260rpx;
- object-fit: cover;
- }
- .product-title {
- width: 100%;
- overflow: hidden;
- line-height: 1.5;
- }
- .product-price {
- color: #121212;
- font-size: 28rpx;
- position: relative;
- }
- .product-price-original {
- color: #18bb88;
- }
- .product-price-favour {
- color: #888888;
- text-decoration: line-through;
- margin-left: 10upx;
- }
- .product-tip {
- position: absolute;
- right: 10upx;
- background-color: #ff3333;
- color: #ffffff;
- padding: 0 10upx;
- border-radius: 5upx;
- }
- .product-unit {
- font-size: 24rpx;
- }
- .product-txt {
- font-size: 22rpx;
- color: #787878;
- }
- }
- </style>
|