|
@@ -4,11 +4,10 @@
|
|
|
<view class="one">
|
|
|
<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
|
|
|
<view class="list-scroll-view">
|
|
|
- 微店
|
|
|
- <!-- <view class="list" v-for="(item,index) in list" :key="index">
|
|
|
+ <view class="list" v-for="(item,index) in list" :key="index" @tap="toShop(item)">
|
|
|
<view class="list_1">
|
|
|
<view class="l">
|
|
|
- <image class="image" :src="item.url" mode=""></image>
|
|
|
+ <image class="image" :src="item.logo&&item.logo.length>0?item.logo[0].url:''" mode=""></image>
|
|
|
</view>
|
|
|
<view class="c">
|
|
|
<view class="name">
|
|
@@ -25,14 +24,14 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="list_2">
|
|
|
- <view class="market" v-for="(tag,indexs) in item.market" :key="indexs">
|
|
|
- <image class="image" :src="tag.url" mode=""></image>
|
|
|
+ <view class="market" v-for="(tag,indexs) in item.market" :key="indexs" @tap="toBuy(tag)">
|
|
|
+ <image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode=""></image>
|
|
|
<view class="money">
|
|
|
- ¥{{tag.money}}
|
|
|
+ ¥{{tag.sell_money}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
@@ -47,61 +46,96 @@
|
|
|
frameStyle: {
|
|
|
useBar: true
|
|
|
},
|
|
|
- list: [ //
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '官方自营店',
|
|
|
- market_num: 12,
|
|
|
- follow_num: 12,
|
|
|
- is_follow: true,
|
|
|
- market: [ //
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- money: 10
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- money: 10
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- money: 10
|
|
|
- }
|
|
|
-
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '官方自营店',
|
|
|
- market_num: 12,
|
|
|
- follow_num: 12,
|
|
|
- is_follow: false,
|
|
|
- market: [ //
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- money: 10
|
|
|
- }
|
|
|
-
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ page: 0,
|
|
|
+ skip: 0,
|
|
|
+ limit: 5,
|
|
|
};
|
|
|
},
|
|
|
- onShow: function() {},
|
|
|
+ onShow: function() {
|
|
|
+ const that = this;
|
|
|
+ that.search()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ async search() {
|
|
|
+ const that = this;
|
|
|
+ let info = {
|
|
|
+ skip: that.skip,
|
|
|
+ limit: that.limit
|
|
|
+ }
|
|
|
+ const res = await that.$api(`/viewShop/microIndex`, `GET`, {
|
|
|
+ ...info,
|
|
|
+ })
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let list = [...that.list, ...res.data];
|
|
|
+ that.$set(that, `list`, list)
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
// 分页
|
|
|
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 uni.showToast({
|
|
|
+ title: '没有更多数据了'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 商铺
|
|
|
+ toShop(e) {
|
|
|
+ const that = this;
|
|
|
+ that.clearPage();
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesHome/shop/index?id=${e._id}`
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 购买
|
|
|
+ toBuy(e) {
|
|
|
+ const that = this;
|
|
|
+ that.clearPage();
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesHome/order/detail?id=${e._id}`
|
|
|
+ })
|
|
|
},
|
|
|
// 关注
|
|
|
toFolllow(e) {
|
|
|
console.log(e);
|
|
|
},
|
|
|
toPath(e) {
|
|
|
- if (e && e.route) uni.redirectTo({
|
|
|
- url: `/${e.route}`
|
|
|
- })
|
|
|
+ if (e && e.route && e.type == '0') {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/${e.route}`
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/${e.route}`
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
+ // 清空列表
|
|
|
+ clearPage() {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `list`, [])
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
+ that.$set(that, `limit`, 5)
|
|
|
+ that.$set(that, `page`, 0)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|