天府星
This commit is contained in:
@@ -1,22 +1,91 @@
|
||||
<template>
|
||||
<div class="Store">
|
||||
<div class="store-list">
|
||||
<div class="store-item" v-for="(item, index) in 4" :key="index" hover-class="text-hover" @click="$linkTo('./StoreDetail')">
|
||||
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png" />
|
||||
<div class="store-item" v-for="(item, index) in list" :key="index" hover-class="text-hover" @click="$linkTo('./StoreDetail?id=' + item.id)">
|
||||
<image :src="item.userAvatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/banner.png'" />
|
||||
<div class="middle">
|
||||
<h2>实惠超市</h2>
|
||||
<p>Lv.1会员进店享受9折优惠</p>
|
||||
<h2>{{ item.merchantName }}</h2>
|
||||
<p>{{ item.title }}</p>
|
||||
</div>
|
||||
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
|
||||
</div>
|
||||
</div>
|
||||
<AiEmpty v-if="!list.length"></AiEmpty>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapState } from 'vuex'
|
||||
export default {
|
||||
appName: '商家优惠',
|
||||
name: 'Store',
|
||||
|
||||
data () {
|
||||
return {
|
||||
current: 1,
|
||||
list: [],
|
||||
isMore: false,
|
||||
isFixed: false,
|
||||
statusBarHeight: 20,
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user', 'token'])
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
this.getList()
|
||||
|
||||
if (!this.token) {
|
||||
this.autoLogin()
|
||||
} else {
|
||||
this.getUserInfo()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions(['autoLogin', 'getUserInfo']),
|
||||
|
||||
getList () {
|
||||
if (this.isMore) return
|
||||
|
||||
this.$loading()
|
||||
this.$instance.post(`/api/appmerchantinfo/discountList`, null, {
|
||||
withoutToken: true,
|
||||
params: {
|
||||
current: this.current,
|
||||
size: 10,
|
||||
status: 1
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$hideLoading()
|
||||
if (this.current > 1) {
|
||||
this.list = [...this.list, ...res.data.records]
|
||||
} else {
|
||||
this.list = res.data.records
|
||||
}
|
||||
|
||||
if (res.data.records.length < 10) {
|
||||
this.isMore = true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.current = this.current + 1
|
||||
} else {
|
||||
this.isMore = true
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onReachBottom () {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user