@ -31,7 +31,7 @@
< / template >
< script setup lang = "ts" >
import { ref , toRefs , onMounted } from 'vue'
import { ref , toRefs , watch } from 'vue'
import { useRootStore } from '@/store/root'
import { getCustomerList } from '@/http/api/base'
import { HTTP_CODE } from '@/enums'
@ -39,8 +39,23 @@ import ScrollView from '@/base/ScrollView/ScrollView.vue'
import ScrollListItem from '@/components/ScrollListItem/ScrollListItem.vue'
import Loading from '@/base/Loading/Loading.vue'
type Props = {
mallCode : string
}
const props = withDefaults ( defineProps < Props > ( ) , {
mallCode : ''
} )
watch (
( ) => props . mallCode ,
( ) => {
_getCustomerList ( )
}
)
const store = useRootStore ( )
const { config , device } = toRefs ( store )
const { config } = toRefs ( store )
const customerList = ref < Customer [ ] > ( [ ] )
const pageIndex = ref ( 1 )
@ -54,8 +69,6 @@ function scrollEnd() {
_getCustomerList ( )
}
onMounted ( _getCustomerList )
function _getCustomerList ( ) {
if ( loading . value || loaded . value ) {
return
@ -64,7 +77,7 @@ function _getCustomerList() {
const params = {
pageIndex : pageIndex . value ,
pageSize : 10 ,
mallCode : device . value . mallCode
mallCode : props . mallCode
}
getCustomerList ( config . value . smallUrl , params )
. then ( ( { code , data } ) => {