Authored by htoooth

fix

... ... @@ -42,6 +42,12 @@ class ApiService {
return result.data.data
})
}
async getSortList() {
return this.request.post('/label/sortlist', {}).then(result => {
return result.data.data
})
}
}
export default ApiService
\ No newline at end of file
... ...
<template>
<Cascader :data="categoryList" :value="handleValue" change-on-select @on-change="selectChange"></Cascader>
</template>
<script>
import ApiService from 'service/api'
export default {
props: {
value: {
type: Array,
default() {
return []
}
}
},
data() {
let self = this
return {
handleValue: self.value.map(i => i.value),
categoryList: []
}
},
created() {
this.api = new ApiService()
this.getSortList()
},
methods: {
getSortList() {
this.api.getSortList().then(result => {
this.categoryList = result.list.map(i => {
let sortItem = {
value: i.id,
label: i.sortName
}
if (i.subList) {
sortItem.children = i.subList.map(s => {
return {
value: s.id,
label: s.sortName
}
})
}
return sortItem
})
})
},
selectChange(val) {
const len = val.length
const max = val[0] || ''
const mid = val[1] || ''
let maxItem = this.categoryList.find(i => i.value == max) || {}
let midItem = maxItem && maxItem.children && maxItem.children.find(i => i.value == mid) || {}
this.$emit('input', [
{value: max, label: maxItem.label || ''},
{value: mid, label: midItem.label || ''}
])
}
},
watch: {
value(newValue) {
this.handleValue = newValue.map(v => v.value)
}
}
}
</script>
<style>
</style>
... ...
... ... @@ -45,6 +45,9 @@
<Card>
<div>
<Form ref="from" inline :label-width="70">
<FormItem label="品类">
<SelectCategory v-model="sortList"></SelectCategory>
</FormItem>
<FormItem label="skn">
<Input type="text" placeholder="skn" v-model="searchItem.productSkn">
</Input>
... ... @@ -57,6 +60,13 @@
<Input type="text" placeholder="skn" v-model="searchItem.endSkn">
</Input>
</FormItem>
<FormItem label="来源">
<Select v-model="searchItem.source">
<Option :value="0">全部</Option>
<Option :value="1">有货</Option>
<Option :value="2">天猫</Option>
</Select>
</FormItem>
<Button type="primary" @click="onClickForSearch">搜索</Button>
<Button type="error" @click="onClickForClear">清除</Button>
</Form>
... ... @@ -74,6 +84,7 @@
import ApiService from 'service/api'
import ProductImage from './components/product-image'
import CheckImage from './components/check-image'
import SelectCategory from './components/select-category'
export default {
data () {
... ... @@ -132,8 +143,12 @@
searchItem: {
productSkn: '',
startSkn: '',
endSkn: ''
endSkn: '',
source: 0,
maxSortId: 0,
middleSortId: 0
},
sortList: [],
pager: {
rows : 0,
size : 10,
... ... @@ -157,6 +172,8 @@
this.searchItem.productSkn = ''
this.searchItem.startSkn = ''
this.searchItem.endSkn = ''
this.searchItem.source = 0
this.sortList = []
},
onClickForAll(row) {
let imageList = row.imageList.map(r => r.imageId)
... ... @@ -204,7 +221,17 @@
},
components: {
ProductImage,
CheckImage
CheckImage,
SelectCategory
},
watch: {
sortList: {
handler(newVal){
this.searchItem.maxSortId = newVal[0] && newVal[0].value || ''
this.searchItem.midSortId = newVal[1] && newVal[1].value || ''
},
deep: true
}
}
}
</script>
\ No newline at end of file
... ...