|
|
@@ -223,37 +223,16 @@ function getBanner() {
|
|
|
|
|
|
const saleBatches = ref([])
|
|
|
function getSaleBatch() {
|
|
|
- if (saleBatches.value.length === 0) {
|
|
|
- return http.post('saleBatch/all', {}, { body: 'json' }).then(res => {
|
|
|
- saleBatches.value = res.content.map(item => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- empty: false,
|
|
|
- hotInfo: {}
|
|
|
- }
|
|
|
- })
|
|
|
- if (!res.empty) {
|
|
|
- res.content.forEach((item, index) => {
|
|
|
- http.post(
|
|
|
- '/product/list',
|
|
|
- {
|
|
|
- query: {
|
|
|
- batchId: item.id,
|
|
|
- status: 'IN_STOCK'
|
|
|
- },
|
|
|
- size: 1,
|
|
|
- sort: 'modifiedAt,desc'
|
|
|
- },
|
|
|
- { body: 'json' }
|
|
|
- ).then(res => {
|
|
|
- saleBatches.value[index].empty = res.empty
|
|
|
- })
|
|
|
- })
|
|
|
+ return http.post('saleBatch/all', {}, { body: 'json' }).then(res => {
|
|
|
+ saleBatches.value = res.content.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ empty: false,
|
|
|
+ hotInfo: {}
|
|
|
}
|
|
|
})
|
|
|
- } else {
|
|
|
- saleBatches.value.forEach((item, index) => {
|
|
|
- if (getStatus(item) === '抢购中' && !item.empty) {
|
|
|
+ if (!res.empty) {
|
|
|
+ res.content.forEach((item, index) => {
|
|
|
http.post(
|
|
|
'/product/list',
|
|
|
{
|
|
|
@@ -268,9 +247,9 @@ function getSaleBatch() {
|
|
|
).then(res => {
|
|
|
saleBatches.value[index].empty = res.empty
|
|
|
})
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const i18n = useI18n()
|