Commit 468cb76e by 前端

车主优选代码

1 parent e8fe61e7
...@@ -1901,6 +1901,51 @@ ...@@ -1901,6 +1901,51 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true "dev": true
}, },
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"ssri": { "ssri": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
...@@ -1909,6 +1954,28 @@ ...@@ -1909,6 +1954,28 @@
"requires": { "requires": {
"minipass": "^3.1.1" "minipass": "^3.1.1"
} }
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
} }
} }
}, },
...@@ -13222,75 +13289,6 @@ ...@@ -13222,75 +13289,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": { "vue-router": {
"version": "3.6.5", "version": "3.6.5",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz",
......
...@@ -18,7 +18,6 @@ const getCategoryListApi = params => { ...@@ -18,7 +18,6 @@ const getCategoryListApi = params => {
reject() reject()
}) })
} }
console.log(params, '8888')
params.method = 'scrm.api.shopmall.discover.category.page' params.method = 'scrm.api.shopmall.discover.category.page'
return http({ return http({
url, url,
...@@ -48,9 +47,20 @@ const batchAddCategoryApi = params => { ...@@ -48,9 +47,20 @@ const batchAddCategoryApi = params => {
}) })
} }
const batchDetailApi = params => {
params.method = 'scrm.api.shopmall.discover.category.detail'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default { export default {
addCategoryApi, addCategoryApi,
getCategoryListApi, getCategoryListApi,
delCategoryApi, delCategoryApi,
batchAddCategoryApi batchAddCategoryApi,
batchDetailApi
} }
<template> <template>
<div class="category-list-ctnr"> <div class="category-list-ctnr">
<GLTabs class="tabs" v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> <GLTabs class="tabs" v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs>
<pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId" :tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav> <template v-if="activeName ==1">
<pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId"
:tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav>
<div class="main-wrap"> <div class="main-wrap">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData"
@handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">二级分类列表</span> <span class="table-title">二级分类列表</span>
<el-button class="operate-btn" type="primary" size="small" @click="editCategory">新增二级分类</el-button> <el-button class="operate-btn" type="primary" size="small" @click="editCategory">新增二级分类</el-button>
</div> </div>
<GLTable ref="categoryRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"> <GLTable ref="categoryRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf"
@setTableFinishFun="setTableFinishFun">
<div slot="brandSlot"> <div slot="brandSlot">
<span>{{ brandList.slice(0, 3).join('、') }}</span> <span>{{ brandList.slice(0, 3).join('、') }}</span>
<el-popover <el-popover
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
width="400" width="400"
trigger="hover"> trigger="hover">
<span> <span>
{{brandList.join('、')}} {{ brandList.join('、') }}
</span> </span>
<span class="more-brand" slot="reference">...[{{ brandList.length }}]</span> <span class="more-brand" slot="reference">...[{{ brandList.length }}]</span>
</el-popover> </el-popover>
...@@ -26,17 +31,25 @@ ...@@ -26,17 +31,25 @@
</div> </div>
</GLTable> </GLTable>
</div> </div>
</template>
<template v-if="activeName==2">
<ownerPreference></ownerPreference>
</template>
</div> </div>
</template> </template>
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import pullDownNav from './components/pullDownNav' import pullDownNav from './components/pullDownNav'
export default { import ownerPreference from "views/category/ownerPreference";
export default {
name: 'App', name: 'App',
components:{ components: {
pullDownNav pullDownNav,
ownerPreference
}, },
data() { data() {
return { return {
...@@ -44,7 +57,7 @@ ...@@ -44,7 +57,7 @@
curMainCategoryId: '', curMainCategoryId: '',
tabPaneList: [], tabPaneList: [],
mainCategoryList: [], mainCategoryList: [],
brandList:['丰田','本田','一汽大众','奔驰','宝马','奥迪','比亚迪'], brandList: ['丰田', '本田', '一汽大众', '奔驰', '宝马', '奥迪', '比亚迪'],
buttonList: [ buttonList: [
{ {
type: 'el-button', type: 'el-button',
...@@ -120,27 +133,28 @@ ...@@ -120,27 +133,28 @@
}, },
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' } pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'}
} }
}, },
created() { created() {
this.getChannelList() this.getChannelList()
}, },
watch:{ watch: {
curMainCategoryId:{ curMainCategoryId: {
handler(){ handler() {
this.handleSearch() this.handleSearch()
}, },
deep: true deep: true
}, },
activeName:{ activeName: {
handler(){ handler() {
this.getMainCategory() this.getMainCategory()
}, },
deep: true deep: true
}, },
}, },
mounted() {}, mounted() {
},
methods: { methods: {
//获取频道名称 //获取频道名称
getChannelList() { getChannelList() {
...@@ -150,19 +164,27 @@ ...@@ -150,19 +164,27 @@
pageNum: 1 pageNum: 1
}) })
.then(res => { .then(res => {
if(res?.list?.length){ if (res?.list?.length) {
let tabPaneList = [] let tabPaneList = []
res.list.forEach(item => { res.list.forEach(item => {
if(item.channelType == 5 || item.channelType == 5){ if (item.channelType == 5 || item.channelType == 5) {
tabPaneList.push({label: item.channelName,name: item.channelType==5 ? 1 : 2 ,merchantChannelId: item.id}) tabPaneList.push({
label: item.channelName,
name: item.channelType == 5 ? 1 : 2,
merchantChannelId: item.id
})
} }
}) })
tabPaneList.push({
label: '车主优选',
name: 2
})
this.tabPaneList = tabPaneList this.tabPaneList = tabPaneList
this.activeName = tabPaneList[0].name this.activeName = tabPaneList[0].name
} }
}) })
}, },
getMainCategory(){ getMainCategory() {
const params = { const params = {
pageSize: 1000, pageSize: 1000,
pageNum: 1, pageNum: 1,
...@@ -170,21 +192,21 @@ ...@@ -170,21 +192,21 @@
categoryType: this.activeName categoryType: this.activeName
} }
this.$apis.category.getCategoryListApi(params).then(res => { this.$apis.category.getCategoryListApi(params).then(res => {
if(res?.list?.length){ if (res?.list?.length) {
this.mainCategoryList = res.list this.mainCategoryList = res.list
this.curMainCategoryId = res.list[0].id this.curMainCategoryId = res.list[0].id
}else{ } else {
this.curMainCategoryId = '' this.curMainCategoryId = ''
} }
}) })
}, },
inputBlur(e){ inputBlur(e) {
this.addCategory(e.value) this.addCategory(e.value)
}, },
handleEdit(e){ handleEdit(e) {
this.addCategory(e.categoryName, e.id) this.addCategory(e.categoryName, e.id)
}, },
delCategory(e, type){ delCategory(e, type) {
this.$confirm(`删除后数据将无法恢复,是否确认删除${e.categoryName}?`, '提示', { this.$confirm(`删除后数据将无法恢复,是否确认删除${e.categoryName}?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -192,10 +214,10 @@ ...@@ -192,10 +214,10 @@
callback: action => { callback: action => {
if (action == 'confirm') { if (action == 'confirm') {
this.$apis.category.delCategoryApi({id: e.id}).then(res => { this.$apis.category.delCategoryApi({id: e.id}).then(res => {
if(res){ if (res) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.getMainCategory() this.getMainCategory()
if(type) { if (type) {
this.handleSearch() this.handleSearch()
} }
} }
...@@ -204,15 +226,15 @@ ...@@ -204,15 +226,15 @@
} }
}) })
}, },
addCategory(val, id){ addCategory(val, id) {
let params = { let params = {
categoryType: this.activeName, categoryType: this.activeName,
categoryLevel: 1, categoryLevel: 1,
categoryName: val categoryName: val
} }
if(id) params.id = id if (id) params.id = id
this.$apis.category.addCategoryApi(params).then(res => { this.$apis.category.addCategoryApi(params).then(res => {
if(res){ if (res) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.getMainCategory() this.getMainCategory()
} }
...@@ -251,39 +273,40 @@ ...@@ -251,39 +273,40 @@
//接收到的数据为空 //接收到的数据为空
this.$refs.categoryRef.data.length ? (this.$refs.categoryRef.tableHeightValues = '') : this.$refs.categoryRef.setTableHeightFun() this.$refs.categoryRef.data.length ? (this.$refs.categoryRef.tableHeightValues = '') : this.$refs.categoryRef.setTableHeightFun()
}, },
editCategory(row={}) { editCategory(row = {}) {
if(!this.activeName) return this.$message.error('暂无频道') if (!this.activeName) return this.$message.error('暂无频道')
const target = this.mainCategoryList.find(item => item.id == this.curMainCategoryId) const target = this.mainCategoryList.find(item => item.id == this.curMainCategoryId)
if(!target) return this.$message.error('请选择一级分类') if (!target) return this.$message.error('请选择一级分类')
const params = { const params = {
categoryType: this.activeName, categoryType: this.activeName,
parentCategoryId: target.id, parentCategoryId: target.id,
parentCategoryName: target.categoryName parentCategoryName: target.categoryName
} }
if(row.id) { if (row.id) {
params.id = row.id params.id = row.id
params.name = row.categoryName params.name = row.categoryName
} }
const queryStr = encodeURIComponent(JSON.stringify(params)) const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/category/add/`+queryStr,query: { $title: row.id ? '编辑二级分类' : '新增二级分类' }}) this.$router.push({path: `/category/add/` + queryStr, query: {$title: row.id ? '编辑二级分类' : '新增二级分类'}})
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.category-list-ctnr{ .category-list-ctnr {
.tabs{ .tabs {
margin-bottom: 16px; margin-bottom: 16px;
} }
.main-wrap{
.main-wrap {
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
} }
.more-brand{
.more-brand {
color: #5850FF; color: #5850FF;
cursor: pointer; cursor: pointer;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!