<template>
  <div class="goods-group">
    <div class="store-info">
      <div class="store-name">
        <div class="icon-shop"></div>
        <div class="name">{{storeName ? storeName : storeMap[storeID].name}}</div>
      </div>
      <div class="store-mobile" @click="call(storeMap[storeID].mobile)">{{storeMap[storeID].mobile}}</div>
    </div>
    <div class="sku-list">
      <div class="sku-item" v-for="(sku, index) in skuList" :key="index">
        <div class="sku-item-left">
          <img :src="$filters.urlToHttps(sku.img)" alt="" class="sku-item-img">
        </div>
        <div class="sku-item-center">
          <div class="sku-name">{{sku.name}}</div>
          <div class="sku-count">x{{sku.count}}</div>
        </div>
        <div class="sku-item-right">
          <div class="sku-totalMoney">￥{{$filters.toFixed2((sku.curPrice * sku.count))}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
import { modal } from '@/utils/uniapi.js'
import PlusMinus from "@/components/goodCmp/plus-minus/plus-minus";
export default {
  props: {
    storeID: {
      type: String,
      default: ''
    },
    skuList: {
      type: Array,
      default: []
    },
    storeName: {
      type: String,
      default: ''
    }
  },
  components: {
    PlusMinus
  },
  computed: {
    ...mapGetters({
      storeMap: 'indexPage/storeMap'
    })
  },
  methods: {
    async call (phoneNumber) {
      if (phoneNumber) {
        let confirm = await modal('拨打电话', '是否拨打门店电话')
        if (confirm) uni.makePhoneCall({phoneNumber})
      }
    },
    handleMinus() {
      console.log('在子组件中，打印父组件的信息',this.$refs)
    }
  }
}
</script>

<style lang="scss">
@import './goods-group.scss';
</style>