Branch_d40a2540 V2.3.0
yujialong 2 years ago
parent 16206af273
commit 93c7304222
  1. 127
      src/pages/product/list/index.vue

@ -42,46 +42,11 @@
<div class="filter"> <div class="filter">
<dl v-if="curTab == 1"> <dl v-if="curTab == 1">
<dt>学科专业</dt> <dt>学科专业</dt>
<el-cascader style="width: 300px;padding: 0 15px"
<dd>学科类别</dd> v-model="category"
<el-select v-model="form.categoryId" :props="props"
clearable
@change="getProfessionalClass()"
@clear="clearClass()">
<el-option label="不限"
value=""></el-option>
<el-option v-for="(item,index) in subjectList"
:key="index"
:label="item.disciplineName"
:value="item.disciplineId"></el-option>
</el-select>
<dd style="margin: 0 0 0 50px">专业类</dd>
<el-select v-model="form.professionalCategoryId"
clearable clearable
:disabled="form.categoryId ? false : true" @change="initData"></el-cascader>
@change="getProfessional"
@clear="clearProfess()">
<el-option label="不限"
value=""></el-option>
<el-option v-for="(item,index) in professionalClassList"
:key="index"
:label="item.professionalClassName"
:value="item.professionalClassId"></el-option>
</el-select>
<dd style="margin: 0 0 0 50px">专业</dd>
<el-select v-model="form.professionalId"
clearable
:disabled="form.professionalCategoryId ? false : true"
@change="initData">
<el-option label="不限"
value=""></el-option>
<el-option v-for="(item,index) in professionalList"
:key="index"
:label="item.professionalName"
:value="item.professionalId"></el-option>
</el-select>
</dl> </dl>
<dl v-if="curTab == 3"> <dl v-if="curTab == 3">
<dt>产品标签</dt> <dt>产品标签</dt>
@ -97,12 +62,12 @@
<dl> <dl>
<dt>产品类型</dt> <dt>产品类型</dt>
<div class="vals"> <div class="vals">
<dd :class="{active: form.productClassification === ''}" <dd :class="{active: form.productType === ''}"
@click="filterChange('', 'productClassification')">全部</dd> @click="filterChange('', 'productType')">全部</dd>
<dd v-for="(item, i) in classifications" <dd v-for="(item, i) in classifications"
:key="i" :key="i"
:class="{active: form.productClassification === item.typeId}" :class="{active: form.productType === item.typeId}"
@click="filterChange(item.typeId, 'productClassification')">{{ item.typeName }}</dd> @click="filterChange(item.typeId, 'productType')">{{ item.typeName }}</dd>
</div> </div>
</dl> </dl>
<dl> <dl>
@ -196,8 +161,9 @@ import { Loading } from "element-ui";
import Setting from "@/setting"; import Setting from "@/setting";
export default { export default {
data () { data () {
const that = this
return { return {
carouselHeight: '336px', carouselHeight: '350px',
banners: [], banners: [],
timer: null, timer: null,
curTab: '', curTab: '',
@ -220,17 +186,64 @@ export default {
}, },
], ],
form: { form: {
categoryId: '',
isShelves: 0, isShelves: 0,
hotTag: 1, hotTag: 1,
professionalCategoryId: '', // categoryId: '',
professionalId: '', // professionalCategoryId: '',
productClassification: '', // professionalId: '',
productType: '',
productName: '', productName: '',
purchaseStatus: '', purchaseStatus: '',
sort: 0, sort: 0,
tagId: '' tagId: ''
}, },
category: [],
//
props: {
// multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (node, resolve) {
const { level, value } = node
//
if (!level) {
that.$get(that.api.courseDiscipline).then(({ list }) => {
list.map(e => {
e.value = e.disciplineId
e.label = e.disciplineName
e.children = []
})
resolve(list)
}).catch(err => { })
} else if (level === 1) {
//
that.$get(that.api.courseProfessionalClass, {
disciplineId: value
}).then(({ list }) => {
list.map(e => {
e.value = e.professionalClassId
e.label = e.professionalClassName
e.children = []
})
resolve(list)
}).catch(err => { })
} else if (level === 2) {
//
that.$get(that.api.courseProfessional, {
professionalClassId: value
}).then(({ list }) => {
list.map(e => {
e.value = e.professionalId
e.label = e.professionalName
e.leaf = true
})
resolve(list)
}).catch(err => { })
} else {
resolve([])
}
}
},
labels: [], labels: [],
subjectList: [], // subjectList: [], //
professionalClassList: [], // professionalClassList: [], //
@ -291,8 +304,7 @@ export default {
} }
}, },
mounted () { mounted () {
console.log(11, parseInt(window.innerWidth / 5.7)) this.carouselHeight = parseInt(window.innerWidth / 5.48) + 'px'
this.carouselHeight = parseInt(window.innerWidth / 5.7) + 'px'
this.getBanner() this.getBanner()
this.getSubject() this.getSubject()
this.getLabel() this.getLabel()
@ -312,14 +324,19 @@ export default {
}, },
// //
getData () { getData () {
const { category } = this
console.log(33, this.category)
this.loadIns = Loading.service() this.loadIns = Loading.service()
this.$post(this.api.listOfGoods, { this.$post(this.api.listOfGoods, {
...this.form, ...this.form,
categoryId: category[0] || '',
professionalCategoryId: category[1] || '',
professionalId: category[2] || '',
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
}).then(({ page }) => { }).then(({ page }) => {
const list = page.records const list = page.records
list.forEach(e => { list && list.forEach(e => {
// //
const el = document.createElement('div') const el = document.createElement('div')
el.innerHTML = e.productIntroduction el.innerHTML = e.productIntroduction
@ -327,7 +344,7 @@ export default {
const cid = e.classificationId const cid = e.classificationId
e.isCourse = (cid === 1 || cid === 2) && !e.isAssociatedProduct e.isCourse = (cid === 1 || cid === 2) && !e.isAssociatedProduct
}) })
this.list = list this.list = list ? list : []
this.total = page.total this.total = page.total
this.loadIns.close() this.loadIns.close()
}).catch(res => { }).catch(res => {
@ -492,7 +509,7 @@ export default {
transform: translateX(-50%); transform: translateX(-50%);
} }
&.active:after { &.active:after {
background-color: #007eff; background-color: #9278ff;
} }
} }
} }
@ -541,7 +558,7 @@ export default {
cursor: pointer; cursor: pointer;
&.active { &.active {
font-weight: 600; font-weight: 600;
color: #007eff; color: #9278ff;
} }
} }
} }
@ -642,7 +659,7 @@ export default {
} }
.tag { .tag {
margin-right: 8px; margin-right: 8px;
color: #007eff; color: #9278ff;
background-color: #f9f9f9; background-color: #f9f9f9;
border: 0; border: 0;
} }

Loading…
Cancel
Save