积分超市
This commit is contained in:
@@ -18,25 +18,25 @@
|
||||
:selectList="dict.getDict('integralSSType')">
|
||||
</ai-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === '0'" label="可见范围" label-width="120px" prop="sendScope">
|
||||
<el-radio-group v-model="form.sendScope">
|
||||
<el-form-item label="可见范围" label-width="120px" prop="serviceType" :rules="[{required: true, message: '请选择可见范围', trigger: 'change'}]">
|
||||
<el-radio-group v-model="form.serviceType">
|
||||
<el-radio label="0">不限</el-radio>
|
||||
<el-radio label="1">仅指定网格可见</el-radio>
|
||||
</el-radio-group>
|
||||
</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
|
||||
:instance="instance"
|
||||
multiple
|
||||
dialogTitle="选择网格"
|
||||
:ops="{label: 'girdName'}"
|
||||
:ops="{label: 'girdName', id: 'girdCode'}"
|
||||
pageTitle="网格"
|
||||
:action="'/app/appgirdinfo/girdList'"
|
||||
:action="'/app/appgirdinfo/girdList?idType=1'"
|
||||
v-model="form.girdList"
|
||||
@pick="onPick"
|
||||
@change="onSelcetChange">
|
||||
<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">
|
||||
<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>
|
||||
@@ -53,11 +53,11 @@
|
||||
</ai-card>
|
||||
<ai-card title="商品列表">
|
||||
<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 #content>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:tableData="form.goodsList"
|
||||
:col-configs="chooseColConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
@@ -73,10 +73,10 @@
|
||||
<ai-uploader
|
||||
:disabled="true"
|
||||
:instance="instance"
|
||||
:value="[{url: row.picUrl}]"
|
||||
:value="[{url: row.goods.picUrl}]"
|
||||
:limit="1">
|
||||
</ai-uploader>
|
||||
<p>{{ row.title }}</p>
|
||||
<p>{{ row.goods.title }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
</ai-card>
|
||||
@@ -115,6 +123,7 @@
|
||||
title="选择商品"
|
||||
:visible.sync="isShow"
|
||||
:destroyOnClose="true"
|
||||
@confirm="onConfirm"
|
||||
width="1080px">
|
||||
<ai-search-bar>
|
||||
<template slot="left">
|
||||
@@ -145,6 +154,7 @@
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
ref="aiTable"
|
||||
style="margin-top: 8px;"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
@@ -196,8 +206,10 @@
|
||||
form: {
|
||||
title: '',
|
||||
type: '',
|
||||
girdNames: '',
|
||||
girdList: []
|
||||
serviceType: '0',
|
||||
visibleNames: '',
|
||||
girdList: [],
|
||||
goodsList: []
|
||||
},
|
||||
girdList: [],
|
||||
id: '',
|
||||
@@ -212,13 +224,12 @@
|
||||
tableData: [],
|
||||
chooseColConfigs: [
|
||||
{ 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: '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('提交成功')
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
placeholder="请选择类型"
|
||||
:selectList="dict.getDict('integralSGStatus')">
|
||||
</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 slot="right">
|
||||
<el-input
|
||||
@@ -38,10 +38,20 @@
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@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">
|
||||
<template v-slot="{ row }">
|
||||
<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="删除" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
@@ -76,12 +86,12 @@
|
||||
tableData: [],
|
||||
shopList: [],
|
||||
colConfigs: [
|
||||
{ prop: 'id', label: '店铺ID', align: 'left' },
|
||||
{ prop: 'serialNumber', label: '店铺ID', align: 'left' },
|
||||
{ prop: 'title', label: '店铺名称', align: 'center' },
|
||||
{ prop: 'type', label: '店铺类型', align: 'center', format: v => this.dict.getLabel('integralSSType', v) },
|
||||
{ prop: 'onlineTime', label: '网格店铺服务网格', align: 'center' },
|
||||
{ prop: 'createTime', label: '居民店铺服务地区', align: 'center' },
|
||||
{ prop: 'createTime', label: '店铺商品数', align: 'center' },
|
||||
{ slot: 'grid', label: '网格店铺服务网格', align: 'center' },
|
||||
{ slot: 'area', label: '居民店铺服务地区', align: 'center' },
|
||||
{ prop: 'goodsCount', label: '店铺商品数', align: 'center' },
|
||||
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSSStatus', v) }
|
||||
]
|
||||
}
|
||||
@@ -111,7 +121,7 @@
|
||||
})
|
||||
},
|
||||
|
||||
add (id) {
|
||||
toAdd (id) {
|
||||
this.$emit('change', {
|
||||
type: 'AddStore',
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user