diff --git a/src/project/tianfuxing/AppMy/AddDiscounts.vue b/src/project/tianfuxing/AppMy/AddDiscounts.vue index 179242d..bf2fa39 100644 --- a/src/project/tianfuxing/AppMy/AddDiscounts.vue +++ b/src/project/tianfuxing/AppMy/AddDiscounts.vue @@ -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(() => { diff --git a/src/project/tianfuxing/AppMy/Merchants.vue b/src/project/tianfuxing/AppMy/Merchants.vue index b26231e..3ac147e 100644 --- a/src/project/tianfuxing/AppMy/Merchants.vue +++ b/src/project/tianfuxing/AppMy/Merchants.vue @@ -22,10 +22,10 @@