Xiao_123 4 месяцев назад
Родитель
Сommit
5719cb2648

+ 11 - 4
src/views/mall/home/components/hotGoods.vue

@@ -22,7 +22,7 @@
 
 <script setup>
 defineOptions({ name: 'mall-home-hotGoods'})
-import { ref, computed } from 'vue'
+import { ref, computed, watch } from 'vue'
 import { getProductByIds } from '@/api/mall/index'
 import { formatSales, fen2yuan } from '@/hooks/web/useGoods'
 import { isArray } from 'lodash-es'
@@ -33,15 +33,22 @@ const router = useRouter()
 
 // 根据id获取商品列表
 const goodList = ref([])
-const getGoodsList = async () => {
-  const productCard = props.templateData?.home?.components.find(item => item.id === 'ProductCard')
+const getGoodsList = async (val) => {
+  const productCard = val?.home?.components.find(item => item.id === 'ProductCard')
   if (!productCard) return
   const ids = productCard.property.spuIds
   if (!ids.length) return
   const data = await getProductByIds(ids)
   goodList.value = data
 }
-getGoodsList()
+
+watch(
+  () => props.templateData,
+  async (val) => {
+    await getGoodsList(val)
+  },
+  { immediate: true, deep: true }
+)
 
 // 格式化销量、库存信息
 const salesAndStock = computed(() => (data) => {

+ 1 - 2
src/views/recruit/personal/PersonalCenter/tradeOrder/components/detail.vue

@@ -1,8 +1,7 @@
 <template>
   <div class="mt-16">
     <div class="default-width pb-5">
-      <!-- 实体商品才展示 -->
-      <v-banner v-if="showBanner(order)" color="primary" :text="formatOrderStatusDescription(order)" style="background-color: #00897B; color: #fff;"></v-banner>
+      <v-banner color="primary" :text="formatOrderStatusDescription(order)" style="background-color: #00897B; color: #fff;"></v-banner>
 
       <!-- 商品列表 -->
       <v-card class="my-3 pa-5">