|
|
@@ -2,23 +2,26 @@
|
|
|
<view class="indexBox">
|
|
|
<swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
|
|
|
<swiper-item v-for="item in imagelist" class="carousel-item" @click="navTo(item.url)">
|
|
|
- <image class="imageitem" :src="item.img" />
|
|
|
+ <image class="imageitem" :src="item.pic" />
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
<view class="hot-list-box">
|
|
|
<view class="list-box">
|
|
|
- <view class="list" v-for="(item,index) in navList.orderList" @click="navTo('/pages/user/model/model?mtype=' + item.id)">
|
|
|
+ <view class="list" v-for="(item,index) in navList.orderList" @click="navTo('/pages/product/product?id=' + item.id)">
|
|
|
<view class="list-image-box">
|
|
|
- <image class="list-image" :src="item.img" mode="widthFix"></image>
|
|
|
+ <image class="list-image" :src="item.image" mode="widthFix"></image>
|
|
|
</view>
|
|
|
<view class="list-content">
|
|
|
|
|
|
- <view class="list-title clamp">
|
|
|
- {{item.title}}
|
|
|
+ <view class="list-title clamp2">
|
|
|
+ {{item.store_name}}
|
|
|
</view>
|
|
|
<view class="list-money flex flex-start">
|
|
|
<view class="money">
|
|
|
- ¥{{item.price}}
|
|
|
+ ¥{{+item.price}}
|
|
|
+ </view>
|
|
|
+ <view class="money old">
|
|
|
+ ¥{{+item.ot_price}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -37,6 +40,11 @@
|
|
|
import {
|
|
|
loadIndexs
|
|
|
} from '@/api/index.js';
|
|
|
+
|
|
|
+ import {
|
|
|
+ groomList
|
|
|
+ } from '@/api/product.js';
|
|
|
+
|
|
|
import {
|
|
|
share
|
|
|
} from '@/api/wx';
|
|
|
@@ -47,39 +55,17 @@
|
|
|
imagelist: [],
|
|
|
// 推荐商品
|
|
|
navList: {
|
|
|
- state: 1,
|
|
|
- text: '通知',
|
|
|
loadingType: 'more',
|
|
|
orderList: [],
|
|
|
page: 1, //当前页数
|
|
|
limit: 10, //每次信息条数
|
|
|
- count: 0, //总消息条数
|
|
|
},
|
|
|
// 热门商品
|
|
|
rmList: []
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState('user', [ 'userInfo']),
|
|
|
- },
|
|
|
onLoad: function(option) {
|
|
|
- // #ifndef MP
|
|
|
- if (option.spread) {
|
|
|
- // 存储其他邀请人
|
|
|
- uni.setStorageSync('spread', option.spread);
|
|
|
- }
|
|
|
- // #endif
|
|
|
- // #ifdef MP
|
|
|
- if (option.scene) {
|
|
|
- // 存储小程序邀请人
|
|
|
- uni.setStorage({
|
|
|
- key: 'spread_code',
|
|
|
- data: option.scene
|
|
|
- });
|
|
|
- }
|
|
|
- // #endif
|
|
|
- // 加载分享信息
|
|
|
- this.share()
|
|
|
+ this.getPage();
|
|
|
},
|
|
|
onShow() {
|
|
|
this.loadIndexs();
|
|
|
@@ -87,20 +73,8 @@
|
|
|
onReady() {},
|
|
|
// 滚动到底部
|
|
|
onReachBottom() {
|
|
|
- // this.getShowTemplateList();
|
|
|
- },
|
|
|
- // #ifdef MP
|
|
|
- onShareAppMessage(options) {
|
|
|
- // 获取缓存的用户id
|
|
|
- const user = uni.getStorageSync('userInfo')
|
|
|
- // 设置菜单中的转发按钮触发转发事件时的转发内容
|
|
|
- let shareObj = {
|
|
|
- title: this.shareData.title, // 默认是小程序的名称(可以写slogan等)
|
|
|
- path: '/pages/index/index?scene=' + user.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
- };
|
|
|
- return shareObj;
|
|
|
+ this.getPage();
|
|
|
},
|
|
|
- // #endif
|
|
|
methods: {
|
|
|
share() {
|
|
|
// console.log('加载分享');
|
|
|
@@ -120,6 +94,7 @@
|
|
|
// 轮播图
|
|
|
loadIndexs().then(
|
|
|
(res) => {
|
|
|
+ that.imagelist=res.data.banner
|
|
|
console.log(res,'index');
|
|
|
}
|
|
|
).catch(
|
|
|
@@ -128,6 +103,55 @@
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
+ // 获取数据
|
|
|
+ getPage(source){
|
|
|
+ //这里是将订单挂载到tab列表下
|
|
|
+ let navItem = this.navList;
|
|
|
+ let state = navItem.state;
|
|
|
+ if (source === 'tabChange' && navItem.loaded === true) {
|
|
|
+ //tab切换只有第一次需要加载数据
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (navItem.loadingType === 'loading') {
|
|
|
+ //防止重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (navItem.loadingType === 'noMore') {
|
|
|
+ //防止重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 修改当前对象状态为加载中
|
|
|
+ navItem.loadingType = 'loading';
|
|
|
+
|
|
|
+ groomList({
|
|
|
+ page: navItem.page,
|
|
|
+ limit: navItem.limit
|
|
|
+ },3)
|
|
|
+ .then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ let arr = data.list.map(e => {
|
|
|
+ return e;
|
|
|
+ });
|
|
|
+ navItem.orderList = navItem.orderList.concat(arr);
|
|
|
+ // console.log(navItem.orderList);
|
|
|
+ navItem.page++;
|
|
|
+ if (navItem.limit == data.length) {
|
|
|
+ //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ navItem.loadingType = 'more';
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ navItem.loadingType = 'noMore';
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ this.$set(navItem, 'loaded', true);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
// 获取模板列表
|
|
|
navTo(url) {
|
|
|
if (url) {
|
|
|
@@ -164,15 +188,11 @@
|
|
|
margin: auto;
|
|
|
width: 750rpx;
|
|
|
height: 273rpx;
|
|
|
- padding: 0 $page-row-spacing;
|
|
|
- background: linear-gradient(to bottom, #ff629f, rgba(255, 255, 255, 1) 80%, rgba(255, 255, 255, 1));
|
|
|
-
|
|
|
.carousel-item {
|
|
|
border-radius: 20rpx;
|
|
|
|
|
|
.imageitem {
|
|
|
- // margin: auto;
|
|
|
- width: 690rpx;
|
|
|
+ width: 750rpx;
|
|
|
height: 273rpx;
|
|
|
}
|
|
|
}
|
|
|
@@ -193,8 +213,9 @@
|
|
|
.list {
|
|
|
box-shadow: 0px 0px 20rpx 0px rgba(50,50,52,0.06);
|
|
|
border-radius: 15rpx;
|
|
|
+ width: 330rpx;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
.list-image-box {
|
|
|
- width: 330rpx;
|
|
|
height: 420rpx;
|
|
|
overflow: hidden;
|
|
|
|
|
|
@@ -214,6 +235,11 @@
|
|
|
.money {
|
|
|
font: $font-lg;
|
|
|
color: #FF3342;
|
|
|
+ &.old{
|
|
|
+ font-size: $font-sm;
|
|
|
+ color: $font-color-light;
|
|
|
+ text-decoration:line-through ;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|