This commit is contained in:
yanran200730
2022-11-08 18:10:21 +08:00
parent ecd44a3c78
commit 77755d0298
10 changed files with 548 additions and 210 deletions

View File

@@ -1,28 +1,31 @@
<template>
<div class="merchants">
<div class="top">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png" />
<image :src="user.merchantInfo.photoUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" />
<div class="right">
<h2>商户名称名称名称</h2>
<p>成都市金牛区xxxx大厦成都成都成都成都市金牛区xxxx大厦成都成都成都成</p>
<h2>{{ user.merchantInfo.merchantName }}</h2>
<p>{{ user.merchantInfo.address }}</p>
</div>
</div>
<div class="merchants-wrapper">
<h2>我发布的优惠</h2>
<div class="merchants-list">
<div class="item">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item-top">
<h2>Lv.1会员进店享受9折优惠</h2>
<p>百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北京天安门广场隆重举行各界代表7万余人以盛百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北京天安门广场隆重举行各界代表7万余人以盛</p>
<h2>{{ item.title }}</h2>
<p>{{ item.content }}</p>
<div class="item-tags">
<span>审核通过</span>
<span v-if="item.status === '1'">审核通过</span>
<span v-if="item.status === '0'">待审核</span>
<span v-if="item.status === '2'">审核拒绝</span>
</div>
</div>
<div class="item-bottom">
<div hover-class="bg-hover">修改</div>
<div hover-class="bg-hover" @click="$linkTo('./AddDiscounts?id=' + item.id)" v-if="item.status === '0'">修改</div>
<div hover-class="bg-hover">删除</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
<div class="btn-wrapper">
@@ -32,22 +35,73 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
appName: '商户中心',
name: 'Merchants',
data () {
return {
list: [],
current: 1,
isMore: false
}
},
onLoad () {
computed: {
...mapState(['user'])
},
onLoad () {
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.isMore = false
this.getList()
})
},
methods: {
getList () {
if (this.isMore) return
this.$instance.post(`/api/appmerchantinfo/discountList`, null, {
params: {
current: this.current,
size: 10,
openId: this.user.openId
}
}).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
}
this.pageShow = true
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>