<template>
    <view class="common-page" style="padding: 0;" @click="playGlobalSound">
        <PageScroll requestStr="/app/orderinfo/getOrderListByIsbn" @updateList="updateList" ref="scrollRef"
            :otherParams="otherParams" method="post">

            <view class="list-con" v-if="dataList.length">
                <OrderItem v-for="cell in dataList" :key="cell.id" :item="cell" class="mt-20">
                </OrderItem>
            </view>
        </PageScroll>
    </view>
</template>

<script setup>
import {
    reactive
} from 'vue';
import PageScroll from '@/components/pageScroll/index.vue'
import OrderItem from '@/pages/my/components/orderItem.vue';
import {
    ref
} from 'vue';
import {
    onLoad
} from '@dcloudio/uni-app'

const otherParams = ref({
    isbnList: '',
})
const scrollRef = ref(null)
const refreshList = () => {
    scrollRef.value?.resetUpScroll()
}

//点击全局音效
function playGlobalSound(){
    uni.$u.playClickSound()
}

let dataList = ref([])
const updateList = (data, page) => {
    dataList.value = data
    if (data.length > 0 && page == 1) {
        uni.$u.ttsModule.speak('查询到' + data.length + '条数据')
    }
    if (data.length == 0 && page == 1) {
        uni.$u.ttsModule.speak('未查询到数据')
    }
}
// const isbnList = ref([]);
onLoad(() => {
    const storedList = uni.getStorageSync('isbnList');
    if (storedList) {
        otherParams.value.isbnList = storedList.map(v => v.isbn)
        refreshList()
    }
})
</script>
<style lang="scss">
.search-area {
    padding: 24rpx;
    background-color: #ffffff;
    z-index: 9;
}
</style>