修改筛选门店
parent
4a9bb036b8
commit
d52ec7402b
|
|
@ -42,11 +42,16 @@
|
||||||
import { http } from '@/utils/request'
|
import { http } from '@/utils/request'
|
||||||
import { onMounted, ref, reactive, computed, toRaw } from 'vue'
|
import { onMounted, ref, reactive, computed, toRaw } from 'vue'
|
||||||
import debounce from '@climblee/uv-ui/libs/function/debounce'
|
import debounce from '@climblee/uv-ui/libs/function/debounce'
|
||||||
|
import { empty } from '@climblee/uv-ui/libs/function/test'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#fff',
|
default: '#fff',
|
||||||
},
|
},
|
||||||
|
isAll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getData()
|
getData()
|
||||||
|
|
@ -93,15 +98,14 @@ const storeText = computed(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function truncateString(str, maxLength) {
|
function truncateString(str, maxLength) {
|
||||||
if (str.length <= maxLength) {
|
if (str.length <= maxLength) {
|
||||||
return str;
|
return str
|
||||||
}
|
}
|
||||||
if (maxLength <= 3) {
|
if (maxLength <= 3) {
|
||||||
return str.substring(0, maxLength) + '...';
|
return str.substring(0, maxLength) + '...'
|
||||||
}
|
}
|
||||||
return str.substring(0, maxLength - 3) + '...';
|
return str.substring(0, maxLength - 3) + '...'
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectMenu = (e) => {
|
const selectMenu = (e) => {
|
||||||
|
|
@ -116,6 +120,9 @@ const selectMenu = (e) => {
|
||||||
|
|
||||||
debounce(
|
debounce(
|
||||||
() => {
|
() => {
|
||||||
|
const obj = toRaw(arrayToObject(result.value))
|
||||||
|
if (!props.isAll && empty(obj.store_id)) return
|
||||||
|
|
||||||
emit('change', toRaw(arrayToObject(result.value)))
|
emit('change', toRaw(arrayToObject(result.value)))
|
||||||
},
|
},
|
||||||
500,
|
500,
|
||||||
|
|
@ -134,7 +141,11 @@ function arrayToObject(arr) {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
http.get('/region').then((res) => {
|
http.get('/region').then((res) => {
|
||||||
regions.value = res
|
regions.value = res
|
||||||
provinces.value = [{ name: '全部区域', code: null }].concat(res.province)
|
let _all = []
|
||||||
|
|
||||||
|
_all = [{ name: '全部区域', code: null }]
|
||||||
|
|
||||||
|
provinces.value = _all.concat(res.province)
|
||||||
citys.value = getCityByCode()
|
citys.value = getCityByCode()
|
||||||
regionsConfirm({
|
regionsConfirm({
|
||||||
value: [provinces.value[0], citys.value[0]],
|
value: [provinces.value[0], citys.value[0]],
|
||||||
|
|
@ -172,7 +183,11 @@ const getStoreData = () => {
|
||||||
params: params,
|
params: params,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
store.value = [{ title: '全部门店', id: null }].concat(res)
|
let _all = []
|
||||||
|
if (props.isAll) {
|
||||||
|
_all = [{ title: '全部门店', id: null }]
|
||||||
|
}
|
||||||
|
store.value = _all.concat(res)
|
||||||
storeConfirm({ value: [store.value[0]] })
|
storeConfirm({ value: [store.value[0]] })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
bgColor="#fff"
|
bgColor="#fff"
|
||||||
v-if="checkPermission(['admin'])"
|
v-if="checkPermission(['admin'])"
|
||||||
>
|
>
|
||||||
<StoreDown color="#333333" @change="storeChange"></StoreDown>
|
<StoreDown color="#333333" @change="storeChange" :isAll="false"></StoreDown>
|
||||||
</uv-sticky>
|
</uv-sticky>
|
||||||
|
|
||||||
<uv-form
|
<uv-form
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue