diff --git a/project/fengdu/app/AppIntegratingSupermarket/components/AddStore.vue b/project/fengdu/app/AppIntegratingSupermarket/components/AddStore.vue index 06418b55..edb54e80 100644 --- a/project/fengdu/app/AppIntegratingSupermarket/components/AddStore.vue +++ b/project/fengdu/app/AppIntegratingSupermarket/components/AddStore.vue @@ -18,25 +18,25 @@ :selectList="dict.getDict('integralSSType')"> - - + + 不限 仅指定网格可见 - +
- +
{{ item.girdName }} 等{{ girdList.length }}个 @@ -53,11 +53,11 @@ @@ -108,6 +108,14 @@ + + + @@ -115,6 +123,7 @@ title="选择商品" :visible.sync="isShow" :destroyOnClose="true" + @confirm="onConfirm" width="1080px"> this.dict.getLabel('integralSGType', v) }, + { prop: 'goods', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v.type) }, { slot: 'integralPrice' }, { slot: 'payMoney' }, - { prop: 'onlineTime', label: '商品链接', align: 'center' }, + // { prop: 'goods', label: '商品链接', align: 'center' }, { slot: 'stock' }, - { prop: 'jdUrl', label: '申请时间', align: 'center' }, - { prop: 'status', width: 90, label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGStatus', v) } + { prop: 'status', width: 90, label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGStatus', v) || '已上架' } ], colConfigs: [ { type: 'selection', label: '', align: 'left' }, @@ -228,7 +239,8 @@ { prop: 'onlineTime', label: '上架时间', align: 'center' }, { prop: 'createTime', label: '申请时间', align: 'center' }, { prop: 'status', width: 90, label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGStatus', v) } - ] + ], + chooseList: [] } }, @@ -258,17 +270,80 @@ }) }, + changeStatus (row) { + this.$confirm(`确定${row.status === '0' ? '上架' : '下架'}该商品?`).then(() => { + this.instance.post(`/app/appintegralsupermarketshop/enable?id=${id}`).then(res => { + if (res.code == 0) { + this.$message.success(`${row.status === '0' ? '上架' : '下架'}成功`) + this.getInfo(this.params.id) + } + }) + }) + }, + handleSelectionChange (e) { - console.log(e) + this.chooseList = e + }, + + remove (id, index) { + this.$confirm('确定删除该商品吗?').then(() => { + if (!this.id) { + this.form.goodsList.splice(index, 1) + } else { + this.instance.post(`/app/appintegralsupermarketshop/delete?id=${id}`).then(res => { + if (res.code == 0) { + this.$message.success('删除成功!') + this.getInfo(this.params.id) + } + }) + } + }) + }, + + showList () { + this.isShow = true + + this.$nextTick(() => { + if (this.form.goodsList.length) { + this.form.goodsList.map(v => v.goods).forEach(v => { + console.log(v) + this.$refs.aiTable.toggleRowSelection(v, true) + }) + } + }) + }, + + onConfirm () { + this.isShow = false + this.form.goodsList = this.chooseList.map(v => { + return { + goods: { + ...v + }, + goodsId: v.id, + integralPrice: '', + payMoney: '', + stock: '', + status: v.status + } + }) }, getInfo (id) { - this.instance.post(`/app/appintegralmerchandise/queryDetailById?id=${id}`).then(res => { + this.instance.post(`/app/appintegralsupermarketshop/queryDetailById?id=${id}`).then(res => { if (res.code === 0) { - this.form = res.data - this.form.picUrl = [{ - url: res.data.picUrl - }] + this.form = { + ...res.data, + visibleNames: '1', + girdList: res.data.serviceType === '1' ? res.data.visibleConfig.map(v => v.visibleId) : [] + } + + this.girdList = res.data.visibleConfig.map(v => { + return { + girdCode: v.visibleId, + girdName: v.visibleName + } + }) } }) }, @@ -279,9 +354,9 @@ onSelcetChange (e) { if (e.length) { - this.form.girdNames = '1' + this.form.visibleNames = '1' } else { - this.form.girdNames = '' + this.form.visibleNames = '' this.form.girdList = [] } }, @@ -289,10 +364,19 @@ confirm () { this.$refs.form.validate((valid) => { if (valid) { - this.instance.post(`/app/appintegralsupermarketgoods/addOrUpdate`, { + if (!this.form.goodsList.length) { + return this.$message.error('请选择商品') + } + + this.instance.post(`/app/appintegralsupermarketshop/addOrUpdate`, { ...this.form, - picUrl: this.form.picUrl[0].url, - id: this.params.id || '' + id: this.params.id || '', + visibleConfig: this.girdList.map(v => { + return { + visibleId: v.girdCode, + visibleName: v.girdName + } + }) }).then(res => { if (res.code == 0) { this.$message.success('提交成功') diff --git a/project/fengdu/app/AppIntegratingSupermarket/components/StoreList.vue b/project/fengdu/app/AppIntegratingSupermarket/components/StoreList.vue index 0c3cab1a..521af4f3 100644 --- a/project/fengdu/app/AppIntegratingSupermarket/components/StoreList.vue +++ b/project/fengdu/app/AppIntegratingSupermarket/components/StoreList.vue @@ -15,7 +15,7 @@ placeholder="请选择类型" :selectList="dict.getDict('integralSGStatus')"> - 添加 + 添加