|
@@ -1,13 +1,14 @@
|
|
|
|
|
|
<template>
|
|
|
<div class="homeGoodsSet app-container">
|
|
|
+ <div class="tab-list">
|
|
|
+ <div class="tab" :class="[query.regionCode == item.regionCode?'active':'']" v-for="item in tableData2" :key="item.regionCode" @click="handleRegionCode(item.regionCode)">{{item.region}}</div>
|
|
|
+ </div>
|
|
|
<div class="tab-list">
|
|
|
<div class="tab" :class="[query.productType == ''?'active':'']" @click="handleTab('')">全部</div>
|
|
|
<div class="tab" :class="[query.productType == item.value?'active':'']" v-for="item in tabList" :key="item.value" @click="handleTab(item.value)">{{item.label}}</div>
|
|
|
</div>
|
|
|
- <div class="tab-list">
|
|
|
- <div class="tab" :class="[query.regionCode == item.value?'active':'']" v-for="item in regionOptions" :key="item.value" @click="handleRegionCode(item.value)">{{item.label}}</div>
|
|
|
- </div>
|
|
|
+
|
|
|
<div class="search">
|
|
|
<div>
|
|
|
|
|
@@ -255,33 +256,21 @@
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
-<el-dialog title="产品配置" width="550px" :visible.sync="dialogFormVisible1">
|
|
|
+<el-dialog title="产品配置" width="750px" :visible.sync="dialogFormVisible1">
|
|
|
<el-table
|
|
|
:data="tableData2"
|
|
|
tooltip-effect="dark"
|
|
|
border
|
|
|
- v-loading="loading"
|
|
|
+ v-loading="loading1"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="行政区域"
|
|
|
- prop="产品信息"
|
|
|
+ prop="region"
|
|
|
show-overflow-tooltip
|
|
|
+ width="150px"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- <div v-if="editList.indexOf(scope.row.regionCod) == -1">
|
|
|
- {{productType[scope.row.productType]||'暂无分类'}}
|
|
|
- </div>
|
|
|
- <el-select v-else v-model="scope.row.regionCode" filterable placeholder="请搜索选择区域">
|
|
|
- <el-option
|
|
|
- v-for="item in cityOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
@@ -291,18 +280,15 @@
|
|
|
show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- {{productType[scope.row.productType]||'暂无分类'}}
|
|
|
+ {{ formatType(scope.row.types)}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column align="center" label="操作">
|
|
|
+ <el-table-column align="center" label="操作" width="100px">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="small" @click="handleEdit(scope.row.regionCode)"
|
|
|
+ <el-button type="text" size="small" @click="handleEdit(scope.row)"
|
|
|
> 编辑</el-button
|
|
|
>
|
|
|
- <el-button type="text" size="small" @click="handleEdit(scope.row.regionCode)"
|
|
|
- > 保存 </el-button
|
|
|
- >
|
|
|
|
|
|
<el-button type="text" size="small" @click="handleRemove(scope.row.regionCode)"
|
|
|
>删除</el-button
|
|
@@ -310,12 +296,27 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <!-- <el-form label-width="130px" :model="setQuery1"
|
|
|
+ <el-button type="text" size="small" @click="handleAdd">+添加</el-button>
|
|
|
+
|
|
|
+</el-dialog>
|
|
|
+
|
|
|
+<el-dialog :title="title" width="550px" :visible.sync="dialogFormVisible4">
|
|
|
+
|
|
|
+ <el-form label-width="130px" :model="setQuery1"
|
|
|
ref="setQuery1"
|
|
|
:rules="rules1">
|
|
|
- <el-form-item label="产品类型" prop="type">
|
|
|
-
|
|
|
- <el-select v-model="setQuery1.type" multiple class="item-width-300" placeholder="请选择">
|
|
|
+ <el-form-item label="区域" prop="regionCode">
|
|
|
+ <el-select v-model="setQuery1.regionCode" class="item-width-300" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in cityOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产品类型" prop="types">
|
|
|
+ <el-select v-model="setQuery1.types" filterable multiple class="item-width-300" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in options"
|
|
|
:key="item.value"
|
|
@@ -324,10 +325,10 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- </el-form> -->
|
|
|
+ </el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
|
|
|
- <el-button type="primary" :loading="btnLoading1" @click="save1">确 定</el-button>
|
|
|
+ <el-button type="primary" :loading="btnLoading1" @click="save">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -363,13 +364,13 @@ export default {
|
|
|
return {
|
|
|
regionOptions:[],
|
|
|
cityOptions:[],
|
|
|
- editList:[],
|
|
|
date:'',
|
|
|
title:'',
|
|
|
tableData: [],
|
|
|
tableData1: [],
|
|
|
tableData2: [],
|
|
|
loading: false,
|
|
|
+ loading1: false,
|
|
|
btnLoading: false,
|
|
|
dialogFormVisible: false,
|
|
|
btnLoading1: false,
|
|
@@ -377,11 +378,12 @@ export default {
|
|
|
btnLoading2: false,
|
|
|
dialogFormVisible2: false,
|
|
|
dialogFormVisible3: false,
|
|
|
+ dialogFormVisible4: false,
|
|
|
query: {
|
|
|
distance:100000000,
|
|
|
latitude:30.57447,
|
|
|
longitude:103.92377,
|
|
|
- regionCode:520101,
|
|
|
+ regionCode:"",
|
|
|
productType:'',
|
|
|
page: 1,
|
|
|
size: 10,
|
|
@@ -417,14 +419,14 @@ export default {
|
|
|
top:0,
|
|
|
regionCode:''
|
|
|
},
|
|
|
- tabList:[],
|
|
|
rules:{
|
|
|
activityId: [{ required: true, message: "请输入活动ID", trigger: "blur" }],
|
|
|
activityMoney: [{ required: true, message: "请输入活动金额", trigger: "blur" }],
|
|
|
startTime: [{ required: true, message: "请选择活动时间", trigger: "change" }],
|
|
|
},
|
|
|
rules1:{
|
|
|
- type: [{ required: true, message: "请选择产品类型", trigger: "change" }],
|
|
|
+ regionCode: [{ required: true, message: "请选择区域", trigger: "change" }],
|
|
|
+ types: [{ type:'array',required: true, message: "请选择产品类型", trigger: "change" }],
|
|
|
},
|
|
|
rules2:{
|
|
|
top: [{ required: true, message: "请输入排序", trigger: "blur" }],
|
|
@@ -486,7 +488,31 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ tabList() {
|
|
|
+ let types = []
|
|
|
+ this.tableData2.map(item => {
|
|
|
+ if(item.regionCode == this.query.regionCode){
|
|
|
+ types = item.types
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let list = types.map(item => {
|
|
|
+ return {
|
|
|
+ label:item.productTypeDesc,
|
|
|
+ value:item.productType
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return list
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ formatType(types){
|
|
|
+ let str = ''
|
|
|
+ types.map(item=>{
|
|
|
+ str += this.productType[item.productType] + '、'
|
|
|
+ })
|
|
|
+ return str
|
|
|
+ },
|
|
|
handleSelectionChange(val){
|
|
|
this.pids = val.map(item => {
|
|
|
return { pid:item.pid,regionCode:item.regionCode}
|
|
@@ -508,18 +534,18 @@ export default {
|
|
|
},
|
|
|
handleRegionCode(val){
|
|
|
this.query.regionCode = val
|
|
|
+ this.query.productType = ''
|
|
|
this.handleSearch()
|
|
|
},
|
|
|
handleSetting(){
|
|
|
this.dialogFormVisible1 = true
|
|
|
-
|
|
|
},
|
|
|
handleSearch(){
|
|
|
this.query.page = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
handleRemove(code){
|
|
|
- this.$confirm(`此操作将${str}该数据, 是否继续?`, '提示', {
|
|
|
+ this.$confirm(`此操作将删除该数据, 是否继续?`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
@@ -531,34 +557,28 @@ export default {
|
|
|
message: '操作成功',
|
|
|
type: 'success'
|
|
|
});
|
|
|
- if(hidden){
|
|
|
- this.getList()
|
|
|
-
|
|
|
- }else{
|
|
|
- this.listHidden()
|
|
|
- }
|
|
|
+ this.listShowTypes();
|
|
|
+ this.handleSearch()
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- handleEdit(code){
|
|
|
- if(this.editList.indexOf(code) == -1){
|
|
|
- this.editList.push(code)
|
|
|
- }else{
|
|
|
- this.editList = this.editList.filter(item => item != code)
|
|
|
- }
|
|
|
+ handleEdit(row){
|
|
|
+ this.title = '编辑'
|
|
|
+ this.dialogFormVisible4 = true
|
|
|
+ this.setQuery1 = {
|
|
|
+ regionCode:row.regionCode,
|
|
|
+ types:row.types.map(item=>item.productType)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
handleAdd() {
|
|
|
- this.title = '添加'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.setQuery = {
|
|
|
- "activityContent": "",
|
|
|
- "activityId": "",
|
|
|
- "activityMoney": 0,
|
|
|
- "endTime": "",
|
|
|
- "startTime": ""
|
|
|
+ this.title = '添加'
|
|
|
+ this.setQuery1 = {
|
|
|
+ regionCode:'',types:[]
|
|
|
}
|
|
|
- this.data = []
|
|
|
+ this.dialogFormVisible4 = true
|
|
|
+
|
|
|
},
|
|
|
|
|
|
handleTop(row){
|
|
@@ -654,6 +674,7 @@ export default {
|
|
|
this.query.page = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
+ // 首页列表
|
|
|
getList() {
|
|
|
this.loading = true
|
|
|
let query = JSON.parse(JSON.stringify(this.query))
|
|
@@ -666,6 +687,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 拉黑列表
|
|
|
listHidden(){
|
|
|
let query = JSON.parse(JSON.stringify(this.query1))
|
|
|
query.page-=1
|
|
@@ -676,6 +698,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 所有产品类型
|
|
|
listAllTypes(){
|
|
|
listAllTypes().then((res) => {
|
|
|
if (res.state == "Success") {
|
|
@@ -688,50 +711,39 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 所有设置的区域产品类型
|
|
|
listShowTypes(){
|
|
|
- listShowTypes({paged:false}).then(res=>{
|
|
|
- if (res.state == "Success") {
|
|
|
- this.tabList = []
|
|
|
- res.content.map(item=>{
|
|
|
- this.tabList.push({
|
|
|
- value:item.productType,
|
|
|
- label:item.productTypeDesc
|
|
|
- })
|
|
|
- })
|
|
|
- this.setQuery1.type = res.content.map(item=>item.productType)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- save(){
|
|
|
- this.$refs.setQuery.validate((v) => {
|
|
|
- if (v) {
|
|
|
- this.btnLoading = true
|
|
|
- addOrUpdateActivityXiaoju(this.setQuery).then(res=>{
|
|
|
- this.btnLoading = false
|
|
|
- if(res.state == 'Success'){
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$notify({
|
|
|
- title: '成功',
|
|
|
- message: '操作成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.query.page = 1
|
|
|
- this.getList();
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.loading1 = true
|
|
|
+ listShowTypes().then(res=>{
|
|
|
+ this.loading1 = false
|
|
|
+ if (res.state == "Success") {
|
|
|
+ if(res.content.content.length){
|
|
|
|
|
|
+ this.query.regionCode = res.content.content[0].regionCode
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ this.tableData2 = res.content.content
|
|
|
+ resolve()
|
|
|
+ // this.setQuery1.type = res.content.map(item=>item.productType)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
- save1(){
|
|
|
+ // 添加编辑区域产品类型
|
|
|
+ save(){
|
|
|
this.$refs.setQuery1.validate((v) => {
|
|
|
if (v) {
|
|
|
this.btnLoading1 = true
|
|
|
- setShowTypes(this.setQuery1).then(res=>{
|
|
|
+ let setQuery1 = JSON.parse(JSON.stringify(this.setQuery1))
|
|
|
+ setQuery1.types = setQuery1.types.map(item=>{
|
|
|
+ return {productType:item}
|
|
|
+ })
|
|
|
+ setShowTypes(setQuery1).then(res=>{
|
|
|
this.btnLoading1 = false
|
|
|
if(res.state == 'Success'){
|
|
|
- this.dialogFormVisible1 = false
|
|
|
+ this.dialogFormVisible4 = false
|
|
|
this.$notify({
|
|
|
title: '成功',
|
|
|
message: '操作成功',
|
|
@@ -746,6 +758,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 设置排序
|
|
|
save2(){
|
|
|
this.$refs.topFrom.validate((v) => {
|
|
|
if (v) {
|
|
@@ -786,18 +799,25 @@ export default {
|
|
|
listSetTypesRegions() {
|
|
|
listSetTypesRegions().then((res) => {
|
|
|
if (res.state == "Success") {
|
|
|
- this.regionOptions = res.content
|
|
|
+ this.regionOptions = res.content.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.code,
|
|
|
+ label: item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
},
|
|
|
created() {
|
|
|
- this.listSetTypesRegions();
|
|
|
+ // this.listSetTypesRegions();
|
|
|
this.getCityList();
|
|
|
- this.getList();
|
|
|
this.listAllTypes()
|
|
|
- this.listShowTypes()
|
|
|
+ this.listShowTypes().then(() => {
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|