diff --git a/src/api/index.js b/src/api/index.js index 92beaa0..c7dd89d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -50,6 +50,7 @@ export default { updateAccountAllEnable: `users/users/userAccount/updateAccountAllEnable`, updateTeamStatus: `nakadai/kindergarten/platformTeamAccount/updateTeamStatus`, delUserAccounts: `users/users/userAccount/delUserAccounts`, + deletePrompt: `users/users/userAccount/deletePrompt`, queryUserInfoByPhone: `nakadai/nakadai/partner-team/queryUserInfoByPhone`, transferAdmin: `nakadai/nakadai/partnerAccount/transferAdmin`, savePartnerAccount: `nakadai/nakadai/partnerAccount/savePartnerAccount`, diff --git a/src/pages/activity/add/index.vue b/src/pages/activity/add/index.vue index 4775d3a..6137032 100644 --- a/src/pages/activity/add/index.vue +++ b/src/pages/activity/add/index.vue @@ -201,9 +201,11 @@
- 保存 - 发布 + 预览 取消 diff --git a/src/pages/miniProgramMg/index/banner/add/index.vue b/src/pages/miniProgramMg/index/banner/add/index.vue index d2746f1..128793e 100644 --- a/src/pages/miniProgramMg/index/banner/add/index.vue +++ b/src/pages/miniProgramMg/index/banner/add/index.vue @@ -54,7 +54,34 @@ :value="item.id"> - + + + + + + + + + + @@ -95,6 +122,7 @@ export default { originForm: {}, form: { correspondingLinkId: '', + goodsId: '', coverUrl: '', details: '1', description: '', @@ -122,6 +150,7 @@ export default { name: '店铺' }, ], + goods: [], linkDetails: [], submiting: false, updateTime: 0, @@ -160,7 +189,20 @@ export default { } }) } + // 商品id + if (data.selectLinkId === '1' && data.correspondingLinkId.includes(',')) { + const linkId = data.correspondingLinkId.split(',') + data.correspondingLinkId = +linkId[0] + if (linkId.length > 1) { + data.goodsId = +linkId[1] + } + } else { + data.correspondingLinkId = +data.correspondingLinkId + } + if (!data.correspondingLinkId) data.correspondingLinkId = '' + if (!data.goodsId) data.goodsId = '' this.form = data + data.goodsId && this.getGoods() this.getDetails() }).catch(err => { }) }, @@ -169,7 +211,7 @@ export default { if (id) this.form.correspondingLinkId = '' const { selectLinkId } = this.form // 活动列表 - if (selectLinkId === '2') { + if (selectLinkId === '2') { // 活动列表 const { data } = await this.$post(this.api.postLoginActivity, { pageNum: 1, pageSize: 1000, @@ -180,7 +222,7 @@ export default { e.id = +e.id }) this.linkDetails = data.records - } else if (selectLinkId === '3') { // 供应商 + } else if (selectLinkId === '1' || selectLinkId === '3') { // 供应商 const { data } = await this.$post(this.api.selectEnterpriseCertificationList, { pageNum: 1, pageSize: 1000, @@ -195,6 +237,22 @@ export default { this.linkDetails = [] } }, + // 查询商品 + async getGoods (id) { + if (id) this.form.goodsId = '' + if (this.form.correspondingLinkId) { + const { page } = await this.$get(this.api.prodList, { + current: 1, + size: 1000, + shopId: this.form.correspondingLinkId + }) + page.records.forEach(e => { + e.name = e.prodName + e.id = e.prodId + }) + this.goods = page.records + } + }, // 清除链接详情 clearDetails () { this.form.correspondingLinkId = '' @@ -228,12 +286,14 @@ export default { // 提交 save (status) { if (this.submiting) return false - const { form } = this + const form = JSON.parse(JSON.stringify(this.form)) if (!form.productName) return Util.warningMsg('请填写产品名称'); // 发布需要校验 if (status) { if (!form.coverUrl) return Util.warningMsg('请上传图片'); } + if (form.selectLinkId === '1' && form.correspondingLinkId && form.goodsId) form.correspondingLinkId = form.correspondingLinkId + ',' + form.goodsId + form.publishStatus = status this.submiting = true if (this.id) { diff --git a/src/pages/miniProgramMg/index/hot/add/index.vue b/src/pages/miniProgramMg/index/hot/add/index.vue index 44ccd18..61e3327 100644 --- a/src/pages/miniProgramMg/index/hot/add/index.vue +++ b/src/pages/miniProgramMg/index/hot/add/index.vue @@ -53,6 +53,7 @@ 外链接 + {{ form.correspondingLinkId }} @@ -67,7 +68,34 @@ :value="item.id"> - + + + + + + + + + + @@ -112,6 +140,7 @@ export default { originForm: {}, form: { correspondingLinkId: '', + goodsId: '', coverUrl: '', details: '1', description: '', @@ -139,6 +168,7 @@ export default { name: '店铺' }, ], + goods: [], linkDetails: [], submiting: false, updateTime: 0, @@ -179,7 +209,20 @@ export default { } }) } + // 商品id + if (data.selectLinkId === '1' && data.correspondingLinkId.includes(',')) { + const linkId = data.correspondingLinkId.split(',') + data.correspondingLinkId = +linkId[0] + if (linkId.length > 1) { + data.goodsId = +linkId[1] + } + } else { + data.correspondingLinkId = +data.correspondingLinkId + } + if (!data.correspondingLinkId) data.correspondingLinkId = '' + if (!data.goodsId) data.goodsId = '' this.form = data + data.goodsId && this.getGoods() this.getDetails() }).catch(err => { }) }, @@ -187,18 +230,6 @@ export default { async getDetails (id) { if (id) this.form.correspondingLinkId = '' const { selectLinkId } = this.form - // if (selectLinkId === '1') { - // const { data } = await this.$get(this.api.prodList, { - // current: 1, - // size: 1000, - // status: '', - // }) - // data.records.forEach(e => { - // e.name = e.competitionName - // e.id = +e.id - // }) - // this.linkDetails = data.records - // } else if (selectLinkId === '2') { // 活动列表 const { data } = await this.$post(this.api.postLoginActivity, { pageNum: 1, @@ -206,11 +237,11 @@ export default { listType: 0, }) data.records.forEach(e => { - e.name = e.competitionName e.id = +e.id + e.name = e.competitionName }) this.linkDetails = data.records - } else if (selectLinkId === '3') { // 供应商 + } else if (selectLinkId === '1' || selectLinkId === '3') { // 供应商 const { data } = await this.$post(this.api.selectEnterpriseCertificationList, { pageNum: 1, pageSize: 1000, @@ -218,13 +249,29 @@ export default { }) data.records.forEach(e => { e.name = e.companyName - e.id = +e.teamId + e.id = e.teamId }) this.linkDetails = data.records } else { this.linkDetails = [] } }, + // 查询商品 + async getGoods (id) { + if (id) this.form.goodsId = '' + if (this.form.correspondingLinkId) { + const { page } = await this.$get(this.api.prodList, { + current: 1, + size: 1000, + shopId: this.form.correspondingLinkId + }) + page.records.forEach(e => { + e.name = e.prodName + e.id = e.prodId + }) + this.goods = page.records + } + }, // 清除链接详情 clearDetails () { this.form.correspondingLinkId = '' @@ -259,13 +306,15 @@ export default { // 提交 save (status) { if (this.submiting) return false - const { form } = this + const form = JSON.parse(JSON.stringify(this.form)) if (!form.productName) return Util.warningMsg('请填写产品名称'); // 发布需要校验 if (status) { if (!this.pics.length) return Util.warningMsg('请上传封面图'); if (form.details === '1' && !form.description) return Util.warningMsg('请填写详情内容'); } + if (form.selectLinkId === '1' && form.correspondingLinkId && form.goodsId) form.correspondingLinkId = form.correspondingLinkId + ',' + form.goodsId + form.coverUrl = this.pics.map(e => e.url).join() form.publishStatus = status this.submiting = true diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue index 6e30db3..ef002bd 100644 --- a/src/pages/user/list/index.vue +++ b/src/pages/user/list/index.vue @@ -288,8 +288,9 @@ export default { toDetail (row, detail) { this.$router.push(`detail?openId=${row.appOpenId}${detail ? '&show=1' : ''}`) }, - handleDelete (row) { - this.$confirm('确定要删除吗?', '提示', { + async handleDelete (row) { + const res = await this.$post(this.api.deletePrompt, [row.appOpenId]) + this.$confirm(res.tips || '确定要删除吗?', '提示', { type: 'warning' }).then(() => { this.$post(this.api.delUserAccounts, [row.appOpenId]).then(async (res) => { @@ -308,10 +309,11 @@ export default { handleSelectionChange (val) { this.multipleSelection = val; }, - delAllSelection () { + async delAllSelection () { if (this.multipleSelection.length) { let delList = this.multipleSelection.map(e => e.appOpenId); - this.$confirm('确定要删除选中数据吗?', '提示', { + const res = await this.$post(this.api.deletePrompt, delList) + this.$confirm(res.tips || '确定要删除选中数据吗?', '提示', { type: 'warning' }).then(() => { this.$post(this.api.delUserAccounts, delList).then(async (res) => {