123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845 |
- <template>
- <view class="container">
- <view class="top-search flex">
- <view class="search-box flex" @click="clickSearch()">
- <image class="search" src="../../static/icon/search-h.png" mode=""></image>
- <view class="search-font">输入关键词搜索</view>
- </view>
- </view>
- <!-- 顶部logo and 搜索 end-->
- <view class="jg"></view>
- <!-- 轮播图 start -->
- <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
- <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item" @click="bannerNavToUrl(item)"><image :src="item.pic" /></swiper-item>
- </swiper>
- <!-- 轮播图 end -->
- <view class="swiper-btm flex">
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">自用购物返利</view>
- </view>
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">分享好友赚钱</view>
- </view>
- <view class="btm-item flex">
- <image src="../../static/icon/index-gou.png" mode=""></image>
- <view class="">超值正品优惠</view>
- </view>
- </view>
- <view class="navbar">
- <view class="navbar-box flex">
- <view class="navbar-item" @click="navTo('/pages/category/category')">
- <image class="nitem-image" src="../../static/sy/sy12.png" mode=""></image>
- <view class="nitem-font">全部分类</view>
- </view>
- <view class="navbar-item" @click="navTo('/pages/product/classify')">
- <image class="nitem-image" src="../../static/sy/sy14.png" mode=""></image>
- <view class="nitem-font">热销推荐</view>
- </view>
- <view class="navbar-item" @click="navTo('/pages/index/message')">
- <image class="nitem-image" src="../../static/sy/sy15.png" mode=""></image>
- <view class="nitem-font">公司介绍</view>
- </view>
- <view class="navbar-item" @click="navTo('/pages/user/shareQrCode')">
- <image class="nitem-image" src="../../static/sy/sy13.png" mode=""></image>
- <view class="nitem-font">邀请有礼</view>
- </view>
- </view>
- </view>
- <view class="jx-box">
- <view class="jx-box-title"><image src="../../static/sy/sy03.png" mode=""></image></view>
- <view class="jx-box-img"><image src="../../static/sy/sy09.png" mode=""></image></view>
- </view>
- <!-- <view class="jx-box-content" v-for="(item, index) in bastList">
- <view class="content-left"><image :src="item.image" mode=""></image></view>
- <view class="content-right">
- <view class="shop-name">{{ item.store_name }}</view>
- <view class="shop-content">
- <view class="shop-content-left">
- <view class="price-box">
- <view class="yuan-price">¥{{ item.ot_price * 1 }}</view>
- <image src="../../static/sy/sy06.png" mode=""></image>
- <view class="j-price">直降{{ (item.ot_price - item.price).toFixed(2) * 1 }}元</view>
- </view>
- <view class="price-x">¥{{ item.price * 1 }}</view>
- </view>
- <view class="shop-content-right" @click="navToDetailPagevip(item)">购买升级</view>
- </view>
- </view>
- </view> -->
- <!-- <view class="more" @click="navTo('/pages/product/vip')">
- <view class="more-font">查看更多</view>
- <image class="more-icon" src="../../static/img/img39.png" mode=""></image>
- </view> -->
- <view class="xian"></view>
- <view class="product-box" v-if="shoplist.length != 0">
- <view class="product-title">
- <view class="bb"></view>
- <view class="pt-title">猜你喜欢</view>
- <view class="bb"></view>
- </view>
- <view class="hotgoods">
- <view class="hotgoods-item" v-for="item in shoplist" :key="item.id" @click="navToDetailPage(item)">
- <view class="image-wrapper"><image class="image" :src="item.image" mode="scaleToFill"></image></view>
- <view class="title clamp">{{ item.store_name }}</view>
- <view class="redRange">
- 分红额度:{{item.give_award_range}}
- </view>
- <view class="hot-price">
- <!-- <view class="hotPrice-box">会员价</view> -->
- <view class="price">
- <text class="font-size-sm">¥</text>
- {{ item.price * 1 }}
- </view>
- <view class="yuanPrice">{{ item.ot_price }}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- <u-tabbar activeColor="#434A54" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
- </view>
- </template>
- <script>
- import { lookSubpoints, lookOneself } from '../../api/user.js';
- import seckill from '../../components/seckill/seckill.vue';
- import { loadIndexs } from '@/api/index.js';
- import { getUserInfo, spread } from '@/api/user.js';
- import { setCoupons } from '@/api/functionalUnit.js';
- import { getProducts } from '@/api/product.js';
- import { interceptor } from '@/utils/loginUtils';
- import { mapState, mapMutations } from 'vuex';
- import { tabbar } from '@/utils/tabbar.js';
- // #ifdef H5
- import { weixindata, shareLoad } from '@/utils/wxAuthorized';
- // #endif
- export default {
- components: {
- seckill
- },
- data() {
- return {
- tabbar: tabbar,
- current: 0,
- shareShow: false, //分享海报
- pageProportion: 0, //保存页面基于750宽度的比例
- swiperHeight: 0,
- checkid: 0,
- titleNViewBackground: '',
- longitude: 0, //经度
- latitude: 0, //纬度
- swiperCurrent: 0,
- swiperLength: 0,
- carouselList: [], //轮播列表
- bastList: [], //会员礼包
- shoplist: [], //猜你喜欢
- page: 1,
- limit: 5
- };
- },
- computed: {
- ...mapState(['loginInterceptor', 'baseURL']),
- ...mapState('user', ['hasLogin', 'userInfo'])
- },
- onLoad: function(option) {
- this.getaddress();
- // #ifdef MP
- if (option.scene) {
- // 存储小程序邀请人
- uni.setStorage({
- key: 'spread_code',
- data: option.scene
- });
- }
- // #endif
- // #ifdef H5
- this.IndexShare();
- //#endif
- },
- onShow: function() {
- // 判断是否强制登录
- if (!this.hasLogin) {
- // 登录拦截
- interceptor();
- }
- this.loadData();
- this.getvip();
- },
- //下拉刷新
- onPullDownRefresh() {
- this.loadData();
- },
- // #ifndef MP
- // 监听导航栏输入框点击事件
- onNavigationBarSearchInputClicked(e) {
- //跳转到搜索页面
- this.clickSearch();
- },
- // #endif
- methods: {
- ...mapMutations(['setLat', 'setLon']),
- // #ifdef H5
- IndexShare() {
- let obj = this;
- let pages = getCurrentPages();
- // 获取当前页面
- let page = pages[pages.length - 1];
- let path = '#/' + page.route + '?';
- // 保存传值
- for (let i in page.options) {
- path += i + '=' + page.options[i] + '&';
- }
- console.log(obj.Path);
- // 保存邀请人
- path += 'spread=' + this.userInfo.uid;
- let data = {
- link: this.baseURL + '/index/' + path,
- title: this.userInfo.nickname + '邀请您进入黄金稻子',
- desc: '欢迎加入黄金稻子',
- imgUrl: 'http://hjdz.liuniu946.com/index/static/img/logo.jpg'
- };
- console.log(data, '分享数据');
- shareLoad(data);
- },
- // #endif
- getaddress() {
- console.log('dizhi+++++++++++');
- let obj = this;
- // uni.getLocation({
- // type: 'gcj02',
- // success: res => {
- // console.log(res, 123456);
- // obj.setLat(res.latitude);
- // obj.setLon(res.longitude);
- // },
- // fail: err => {
- // console.log(err, 'shi+++++++++++++++');
- // openMap().then(e => {
- // this.getaddress();
- // });
- // }
- // });
- weixindata().then(wxOjb => {
- console.log(wxOjb, '获取微信');
- wxOjb.getLocation({
- type: 'gcj02',
- success: res => {
- console.log(res, 123456);
- obj.setLat(res.latitude);
- obj.setLon(res.longitude);
- },
- fail: err => {
- console.log(err, 'shi+++++++++++++++');
- openMap().then(e => {
- this.getaddress();
- });
- }
- });
- });
- },
- navTo(url) {
- if (url == '') {
- this.$api.msg('暂未开通,敬请期待');
- } else {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- });
- }
- });
- }
- },
- // 监听切换事件
- listChange(e) {
- this.checkid = e.detail.current;
- },
- // 點擊搜索框
- clickSearch() {
- uni.navigateTo({
- url: '/pages/product/search'
- });
- },
- // 监听图片加载完成
- onImageError(key, index) {
- this[key][index].image = '/static/error/errorImage.jpg';
- },
- // 请求载入数据
- async loadData() {
- loadIndexs({})
- .then(({ data }) => {
- let goods = data.info;
- this.carouselList = data.banner;
- this.swiperLength = this.carouselList.length;
- this.shoplist = data.likeInfo; //会员礼包
- uni.stopPullDownRefresh();
- })
- .catch(e => {
- uni.stopPullDownRefresh();
- });
- },
- // getvip() {
- // getProducts({ cid: 52, page: 1, limit: 10 }).then(({ data }) => {
- // this.bastList = data; //会员礼包
- // console.log(this.bastList, '123456');
- // });
- // },
- //轮播图切换修改背景色
- swiperChange(e) {
- const index = e.detail.current;
- this.swiperCurrent = index;
- this.titleNViewBackground = this.carouselList[index].background;
- },
- //详情页
- navToDetailPagevip(item) {
- let id = item.id;
- uni.navigateTo({
- url: '/pages/product/product?id=' + id + '&isVip=1'
- });
- },
- navToDetailPage(item) {
- let id = item.id;
- uni.navigateTo({
- url: '/pages/product/product?id=' + id
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .container {
- background: #ffffff;
- height: auto;
- min-height: 100%;
- }
- .top-search {
- height: 80rpx;
- padding: 0 20rpx;
- background-color: #fff;
- .search-box {
- justify-content: center;
- width: 698rpx;
- height: 60rpx;
- background: #eeeeee;
- // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
- border-radius: 30rpx;
- .search {
- width: 34rpx;
- height: 34rpx;
- }
- .search-font {
- margin-left: 14rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #cbcbcb;
- }
- }
- }
- .jg {
- height: 20rpx;
- background-color: #fff;
- }
- .top-swiper {
- width: 750rpx;
- height: 360rpx;
- // margin: 20rpx 0 0;
- image {
- width: 750rpx;
- height: 360rpx;
- }
- }
- .swiper-btm {
- height: 60rpx;
- width: 750rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- font-size: 21rpx;
- font-weight: 500;
- color: #333333;
- .btm-item {
- flex-grow: 1;
- justify-content: center;
- image {
- width: 25rpx;
- height: 25rpx;
- margin-right: 14rpx;
- }
- }
- }
- .navbar {
- position: relative;
- z-index: 2;
- padding: 0 50rpx;
- width: 750rpx;
- background: #ffffff;
- .navbar-box {
- padding-top: 38rpx;
- .navbar-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 20%;
- .nitem-image {
- width: 90rpx;
- height: 90rpx;
- }
- .nitem-font {
- margin-top: 22rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #000000;
- }
- }
- }
- }
- .jx-box {
- background: #fff;
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 750rpx;
- .jx-box-title {
- margin: 50rpx 0;
- width: 610rpx;
- height: 30rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .jx-box-img {
- width: 750rpx;
- height: 220rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .jx-box-content {
- margin: 20rpx auto 0;
- display: flex;
- width: 710rpx;
- background: #ffffff;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 10rpx;
- padding: 20rpx 30rpx 20rpx 14rpx;
- .content-left {
- flex-shrink: 0;
- width: 236rpx;
- height: 236rpx;
- background: #e2e2e2;
- border-radius: 10rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .content-right {
- width: 100%;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- .shop-name {
- width: 382rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .shop-content {
- display: flex;
- justify-content: space-between;
- .shop-content-left {
- display: flex;
- flex-direction: column;
- .price-box {
- display: flex;
- align-items: center;
- .yuan-price {
- font-size: 26rpx;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- image {
- margin-left: 8rpx;
- width: 16rpx;
- height: 18rpx;
- }
- .j-price {
- margin-left: 8rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #b59467;
- }
- }
- .price-x {
- font-size: 36rpx;
- font-weight: bold;
- color: #ff4c4c;
- }
- }
- .shop-content-right {
- margin-top: 20rpx;
- align-items: center;
- text-align: center;
- width: 137rpx;
- height: 52rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #ffffff;
- background: linear-gradient(90deg, #bb9159, #e6c79d);
- border-radius: 26rpx;
- line-height: 52rpx;
- }
- }
- }
- }
- .more {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 104rpx;
- .more-font {
- margin-left: 10rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- .more-icon {
- width: 16rpx;
- height: 28rpx;
- }
- }
- .xian {
- height: 20rpx;
- background: #eeeeee;
- }
- .product-box {
- margin-top: 20rpx;
- background: #ffffff;
- padding: 26rpx 30rpx 20rpx;
- .product-title {
- display: flex;
- align-items: center;
- justify-content: center;
- .pt-image {
- width: 36rpx;
- height: 36rpx;
- }
- .bb {
- width: 120rpx;
- height: 1rpx;
- background: #989898;
- }
- .pt-title {
- margin: 0 28rpx;
- font-size: 30rpx;
- font-weight: 500;
- color: #363636;
- }
- .pt-tip {
- margin-left: 16rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #95a0b1;
- }
- }
- .hotgoods {
- margin-top: 38rpx;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- padding: 0 0 30rpx;
- .hotgoods-item {
- width: 44%;
- background: #ffffff;
- margin: 20rpx;
- box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
- border-radius: 10px;
- .image-wrapper {
- width: 100%;
- height: 330rpx;
- border-radius: 3px;
- overflow: hidden;
- position: relative;
- .image-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- z-index: 2;
- }
- .image {
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- }
- }
- .title {
- margin-left: 15rpx;
- margin-top: 20rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .redRange{
- font-size: $font-sm;
- margin-left: 15rpx;
- color: #999999;
- }
- .titlee {
- margin-left: 15rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .hot-price {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- padding: 14rpx 0 30rpx;
- .hotPrice-box {
- width: 70rpx;
- height: 28rpx;
- background: linear-gradient(90deg, #c79a4c, #f9df7f);
- border-radius: 5rpx;
- text-align: center;
- line-height: 28rpx;
- font-size: 20rpx;
- font-weight: 400;
- color: #ffffff;
- }
- .price {
- margin-left: 10rpx;
- font-size: 36rpx;
- color: #ff0000;
- font-weight: 500;
- }
- .yuanPrice {
- margin-left: 10rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .cart-icon {
- image {
- width: 44rpx;
- height: 44rpx;
- }
- }
- }
- }
- }
- }
- .shop {
- margin-top: 20rpx;
- background: #ffffff;
- padding: 0 12rpx;
- .shop-title {
- padding: 30rpx 0 20rpx;
- display: flex;
- align-items: center;
- border-bottom: 1px solid #e3e6e7;
- .shop-item {
- width: 25%;
- display: flex;
- align-items: center;
- justify-content: center;
- .sitem-font {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .jt-down {
- width: 10rpx;
- height: 8rpx;
- margin-left: 12rpx;
- }
- }
- }
- }
- .shop-main {
- padding: 32rpx 18rpx 0 12rpx;
- align-items: flex-start;
- justify-content: flex-start;
- .main-left {
- width: 180rpx;
- height: 180rpx;
- border-radius: 10rpx;
- }
- .main-right {
- width: 500rpx;
- justify-content: space-between;
- align-items: flex-start;
- margin-left: 20rpx;
- padding: 13rpx 0 35rpx;
- border-bottom: 1px solid #eaeced;
- .shopm-info {
- max-width: 60%;
- line-height: 1;
- .shopm-title {
- display: flex;
- justify-content: flex-start;
- .shopmt-font {
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .shopmt-good {
- margin-left: 6rpx;
- width: 30rpx;
- height: 30rpx;
- border: 1px solid #ff4c4c;
- border-radius: 5rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ff4c4c;
- text-align: center;
- line-height: 30rpx;
- }
- }
- .address {
- margin-top: 16rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- .shopmt-tip {
- position: relative;
- display: inline-block;
- flex-grow: 0;
- margin-top: 52rpx;
- padding: 8rpx;
- background: #fcf3f0;
- border-radius: 16rpx 16rpx 16rpx 0px;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ff440d;
- }
- }
- .right {
- height: 100%;
- margin-top: 5rpx;
- display: flex;
- flex-direction: column;
- .mright-top {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .mrt-image {
- width: 20rpx;
- height: 28rpx;
- }
- .mrt-font {
- margin-left: 8rpx;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- }
- .mright-bottom {
- margin-top: 80rpx;
- display: flex;
- justify-content: flex-end;
- .mrb-item {
- width: 46rpx;
- height: 46rpx;
- margin-left: 14rpx;
- }
- }
- }
- }
- }
- </style>
|