<!--
  @description: 购物车-比价详情组件
  @Modifier: haofengxian
  @routerPath:
  @date: 2021-12-04 13:17
-->
<template>
  <el-dialog
    :visible.sync="compareDataDialog"
    :close-on-click-modal="false"
    class="dialog"
    title="比价详情"
    width="700px"
  >
    <div v-for="(item,index) in compareInfo" :key="index" class="dialog-content">
      <p><span>供应商名称:</span>{{ item.supplierName }}</p>
      <p class="product-content">
        <span class="product-name" @click="toDeatil(item.goodId)">
          <span style="color:#000">商品名称:</span>  {{ item.productName }}
        </span>
        <span style="color:#FF6600">￥ {{ item.price }}</span>
      </p>
    </div>
  </el-dialog>
</template>

<script>
import { productCompareInfo } from '@/api/shoppingmall/products'
export default {
  name: 'PriceDetails',
  data() {
    return {
      compareDataDialog: false,
      compareInfo: [] // 比价信息
    }
  },
  methods: {
    openDialogProductCompareInfo(compareIds) {
      this.compareDataDialog = true
      productCompareInfo(compareIds).then(res => {
        this.compareInfo = res.data
        this.compareDataDialog = false // 弹框关闭
      }).catch(() => {
        this.compareDataDialog = false // 弹框关闭
      })
    },
    // 跳转商品详情
    toDeatil(id) {
      this.$router.push({
        path: '/shop/goodsClassDetail',
        query: {
          id: id
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
