This commit is contained in:
yanran200730
2022-11-08 18:18:00 +08:00
parent 77755d0298
commit 50a21c9e45
2 changed files with 39 additions and 5 deletions

View File

@@ -19,7 +19,8 @@
data () {
return {
title: '',
content: ''
content: '',
id: ''
}
},
@@ -27,6 +28,18 @@
...mapState(['user'])
},
onLoad (query) {
if (query.id) {
this.id = query.id
this.$instance.post(`/api/appmerchantinfo/queryDiscountDetailById?id=${query.id}`).then(res => {
if (res.code === 0) {
this.title = res.data.title
this.content = res.data.content
}
})
}
},
methods: {
save () {
if (!this.title) {
@@ -42,10 +55,11 @@
title: this.title,
content: this.content,
openId: this.user.openId,
mid: this.user.merchantInfo.id
mid: this.user.merchantInfo.id,
id: this.id || ''
}).then(res => {
if (res.code === 0) {
this.$toast('保存成功')
this.$toast(this.id ? '修改成功' : '发布成功')
uni.$emit('updateList')
setTimeout(() => {

View File

@@ -22,10 +22,10 @@
</div>
<div class="item-bottom">
<div hover-class="bg-hover" @click="$linkTo('./AddDiscounts?id=' + item.id)" v-if="item.status === '0'">修改</div>
<div hover-class="bg-hover">删除</div>
<div hover-class="bg-hover" @click="remove(item.id)">删除</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
<AiEmpty v-if="!list.length && isMore"></AiEmpty>
</div>
</div>
<div class="btn-wrapper">
@@ -97,6 +97,26 @@
}).catch(() => {
this.$hideLoading()
})
},
remove (id) {
this.$dialog.confirm({
title: '温馨提示',
content: '确定删除该优惠信息吗?'
}).then(() => {
this.$loading()
this.$instance.post(`/api/appmerchantinfo/deleteDiscount?id=${id}`).then(res => {
if (res.code === 0) {
this.current = 1
this.isMore = false
this.getList()
this.$toast('删除成功')
}
})
}).catch(() => {
})
}
},