积分超市

This commit is contained in:
yanran200730
2023-04-13 14:26:31 +08:00
parent 27b91ad6fa
commit 1cb5b85483
2 changed files with 129 additions and 35 deletions

View File

@@ -18,25 +18,25 @@
:selectList="dict.getDict('integralSSType')"> :selectList="dict.getDict('integralSSType')">
</ai-select> </ai-select>
</el-form-item> </el-form-item>
<el-form-item v-if="form.type === '0'" label="可见范围" label-width="120px" prop="sendScope"> <el-form-item label="可见范围" label-width="120px" prop="serviceType" :rules="[{required: true, message: '请选择可见范围', trigger: 'change'}]">
<el-radio-group v-model="form.sendScope"> <el-radio-group v-model="form.serviceType">
<el-radio label="0">不限</el-radio> <el-radio label="0">不限</el-radio>
<el-radio label="1">仅指定网格可见</el-radio> <el-radio label="1">仅指定网格可见</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-if="form.type === '0'" label="选择网格" style="width: 100%;" label-width="120px" prop="girdNames" :rules="[{ required: true, message: '请选择选择群主', trigger: 'change' }]"> <el-form-item label="选择网格" v-if="form.serviceType === '1'" style="width: 100%;" label-width="120px" prop="visibleNames" :rules="[{ required: true, message: '请选择网格', trigger: 'change' }]">
<ai-picker <ai-picker
:instance="instance" :instance="instance"
multiple multiple
dialogTitle="选择网格" dialogTitle="选择网格"
:ops="{label: 'girdName'}" :ops="{label: 'girdName', id: 'girdCode'}"
pageTitle="网格" pageTitle="网格"
:action="'/app/appgirdinfo/girdList'" :action="'/app/appgirdinfo/girdList?idType=1'"
v-model="form.girdList" v-model="form.girdList"
@pick="onPick" @pick="onPick"
@change="onSelcetChange"> @change="onSelcetChange">
<div class="AppAnnounceDetail-select"> <div class="AppAnnounceDetail-select">
<el-input size="small" class="AppAnnounceDetail-select__input" placeholder="请选择..." disabled v-model="form.girdNames"></el-input> <el-input size="small" class="AppAnnounceDetail-select__input" placeholder="请选择..." disabled v-model="form.visibleNames"></el-input>
<div class="select-left" v-if="form.girdList.length"> <div class="select-left" v-if="form.girdList.length">
<span v-for="(item, index) in girdList" :key="index" v-if="index < 9">{{ item.girdName }}</span> <span v-for="(item, index) in girdList" :key="index" v-if="index < 9">{{ item.girdName }}</span>
<em v-if="girdList.length > 9">{{ girdList.length }}</em> <em v-if="girdList.length > 9">{{ girdList.length }}</em>
@@ -53,11 +53,11 @@
</ai-card> </ai-card>
<ai-card title="商品列表"> <ai-card title="商品列表">
<template #right> <template #right>
<el-button type="primary" icon="iconfont iconAdd" @click="isShow = true">选择商品</el-button> <el-button type="primary" icon="iconfont iconAdd" @click="showList">选择商品</el-button>
</template> </template>
<template #content> <template #content>
<ai-table <ai-table
:tableData="tableData" :tableData="form.goodsList"
:col-configs="chooseColConfigs" :col-configs="chooseColConfigs"
:total="total" :total="total"
:current.sync="search.current" :current.sync="search.current"
@@ -73,10 +73,10 @@
<ai-uploader <ai-uploader
:disabled="true" :disabled="true"
:instance="instance" :instance="instance"
:value="[{url: row.picUrl}]" :value="[{url: row.goods.picUrl}]"
:limit="1"> :limit="1">
</ai-uploader> </ai-uploader>
<p>{{ row.title }}</p> <p>{{ row.goods.title }}</p>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -108,6 +108,14 @@
<el-input-number style="width: 140px;" size="small" type="input" v-model="row.stock" clearable placeholder="请输入" :min="1"></el-input-number> <el-input-number style="width: 140px;" size="small" type="input" v-model="row.stock" clearable placeholder="请输入" :min="1"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" slot="options" align="center" width="120" fixed="right">
<template v-slot="{ row, $index }">
<div class="table-options">
<el-button v-if="row.id" type="text" :title="row.status === '0' ? '上架' : '下架'" @click="changeStatus(row)">{{ row.status === '0' ? '上架' : '下架' }}</el-button>
<el-button type="text" title="删除" @click="remove(row.id, $index)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table> </ai-table>
</template> </template>
</ai-card> </ai-card>
@@ -115,6 +123,7 @@
title="选择商品" title="选择商品"
:visible.sync="isShow" :visible.sync="isShow"
:destroyOnClose="true" :destroyOnClose="true"
@confirm="onConfirm"
width="1080px"> width="1080px">
<ai-search-bar> <ai-search-bar>
<template slot="left"> <template slot="left">
@@ -145,6 +154,7 @@
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-table <ai-table
ref="aiTable"
style="margin-top: 8px;" style="margin-top: 8px;"
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
@@ -196,8 +206,10 @@
form: { form: {
title: '', title: '',
type: '', type: '',
girdNames: '', serviceType: '0',
girdList: [] visibleNames: '',
girdList: [],
goodsList: []
}, },
girdList: [], girdList: [],
id: '', id: '',
@@ -212,13 +224,12 @@
tableData: [], tableData: [],
chooseColConfigs: [ chooseColConfigs: [
{ slot: 'goods' }, { slot: 'goods' },
{ prop: 'type', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v) }, { prop: 'goods', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v.type) },
{ slot: 'integralPrice' }, { slot: 'integralPrice' },
{ slot: 'payMoney' }, { slot: 'payMoney' },
{ prop: 'onlineTime', label: '商品链接', align: 'center' }, // { prop: 'goods', label: '商品链接', align: 'center' },
{ slot: 'stock' }, { 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: [ colConfigs: [
{ type: 'selection', label: '', align: 'left' }, { type: 'selection', label: '', align: 'left' },
@@ -228,7 +239,8 @@
{ prop: 'onlineTime', label: '上架时间', align: 'center' }, { prop: 'onlineTime', label: '上架时间', align: 'center' },
{ prop: 'createTime', label: '申请时间', align: 'center' }, { prop: 'createTime', 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) }
] ],
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) { 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) { 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) { if (res.code === 0) {
this.form = res.data this.form = {
this.form.picUrl = [{ ...res.data,
url: res.data.picUrl 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) { onSelcetChange (e) {
if (e.length) { if (e.length) {
this.form.girdNames = '1' this.form.visibleNames = '1'
} else { } else {
this.form.girdNames = '' this.form.visibleNames = ''
this.form.girdList = [] this.form.girdList = []
} }
}, },
@@ -289,10 +364,19 @@
confirm () { confirm () {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (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, ...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 => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message.success('提交成功') this.$message.success('提交成功')

View File

@@ -15,7 +15,7 @@
placeholder="请选择类型" placeholder="请选择类型"
:selectList="dict.getDict('integralSGStatus')"> :selectList="dict.getDict('integralSGStatus')">
</ai-select> </ai-select>
<el-button type="primary" icon="iconfont iconAdd" @click="add()">添加</el-button> <el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template> </template>
<template slot="right"> <template slot="right">
<el-input <el-input
@@ -38,10 +38,20 @@
:current.sync="search.current" :current.sync="search.current"
:size.sync="search.size" :size.sync="search.size"
@getList="getList"> @getList="getList">
<el-table-column label="网格店铺服务网格" slot="grid" align="center">
<template v-slot="{ row }">
<span>{{ row.serviceType === '1' ? row.visibleNames || '-' : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="居民店铺服务地区" slot="area" align="center">
<template v-slot="{ row }">
<span>{{ row.serviceType === '0' ? row.visibleNames || '-' : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" slot="options" align="center" width="160" fixed="right"> <el-table-column label="操作" slot="options" align="center" width="160" fixed="right">
<template v-slot="{ row }"> <template v-slot="{ row }">
<div class="table-options"> <div class="table-options">
<el-button type="text" title="编辑" @click="edit(row)">编辑</el-button> <el-button type="text" title="编辑" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" :title="row.status === '0' ? '上架' : '下架'" @click="changeStatus(row)">{{ row.status === '0' ? '上架' : '下架' }}</el-button> <el-button type="text" :title="row.status === '0' ? '上架' : '下架'" @click="changeStatus(row)">{{ row.status === '0' ? '上架' : '下架' }}</el-button>
<el-button type="text" title="删除" @click="remove(row.id)">删除</el-button> <el-button type="text" title="删除" @click="remove(row.id)">删除</el-button>
</div> </div>
@@ -76,12 +86,12 @@
tableData: [], tableData: [],
shopList: [], shopList: [],
colConfigs: [ colConfigs: [
{ prop: 'id', label: '店铺ID', align: 'left' }, { prop: 'serialNumber', label: '店铺ID', align: 'left' },
{ prop: 'title', label: '店铺名称', align: 'center' }, { prop: 'title', label: '店铺名称', align: 'center' },
{ prop: 'type', label: '店铺类型', align: 'center', format: v => this.dict.getLabel('integralSSType', v) }, { prop: 'type', label: '店铺类型', align: 'center', format: v => this.dict.getLabel('integralSSType', v) },
{ prop: 'onlineTime', label: '网格店铺服务网格', align: 'center' }, { slot: 'grid', label: '网格店铺服务网格', align: 'center' },
{ prop: 'createTime', label: '居民店铺服务地区', align: 'center' }, { slot: 'area', label: '居民店铺服务地区', align: 'center' },
{ prop: 'createTime', label: '店铺商品数', align: 'center' }, { prop: 'goodsCount', label: '店铺商品数', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSSStatus', v) } { prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSSStatus', v) }
] ]
} }
@@ -111,7 +121,7 @@
}) })
}, },
add (id) { toAdd (id) {
this.$emit('change', { this.$emit('change', {
type: 'AddStore', type: 'AddStore',
params: { params: {