<template>
  <select-modal @close="closeAction" title="随车购商品" class="order-goods-modal">
    <view class="goods-container">
      <scroll-view class="goods-scroll-view" :scroll-y="true">
        <view class="goods-item" v-for="item in goodsList" :key="item.order_id" @click.stop="gotoDetail(item)">
          <image mode="aspectFit" class="goods-img" :src="item.goods_pic"/>
          <view class="goods-info-view">
            <text class="app-fc-main fs-32 app-font-bold-500 app-text-ellipse">
              {{ item.goods_name || '--' }}
            </text>
            <text class="app-fc-normal fs-24 goods-num-text">{{ `数量X${item.number}` }}</text>
            <text class="app-fc-main fs-28 goods-price-text" >实付款
              <text class="fs-28 app-fc-alarm">{{ `¥${item.goods_price}` }}</text>
            </text>
          </view>
          <image src="@/static/images/arrow_right_black.png" mode="aspectFit" class="good-arrow"/>
        </view>
      </scroll-view>
    </view>
    <view class="goods-price-container">
      <view class="goods-left-view">
        <view class="price-view">
          <text class="app-fc-main fs-28">¥</text>
          <text class="app-fc-main app-font-bold-700 fs-50 price-text">{{ price }}</text>
        </view>
        <view class="price-tips-view">
          <image src="/pageHome/static/tips.png" mode="aspectFit" class="tips-img"/>
          <text class="fs-24">商品总价</text>
        </view>
      </view>
      <view class="submit-btn" @click.stop="closeAction">
        <text class="app-fc-white fs-30">确定</text>
      </view>
    </view>
  </select-modal>
</template>

<script>
import SelectModal from "@/components/select-modal.vue";

export default {
  components: { SelectModal },
  props: {
    goodsList: {
      type: Array,
      default: () => []
    },
    price: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {};
  },
  options: {
    styleIsolation: "shared",
  },
  methods: {
    closeAction() {
      this.$emit('close');
    },
    gotoDetail(item){
      this.$emit('gotoDetail', item.goods_id);
    },
  },
}
</script>

<style lang="scss" scoped>
.order-goods-modal {

  ::v-deep {
    .selected-modal .model-container {
      background: #fff0f5;
      position: relative;
    }
  }

  .goods-container {
    width: 100%;
    height: 800rpx;
    position: relative;

    .goods-scroll-view {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      padding: 0 32rpx;
      box-sizing: border-box;

      .goods-item {
        width: 100%;
        height: 200rpx;
        display: flex;
        align-items: center;
        background-color: #fff;
        border-radius: 40rpx;
        margin-top: 32rpx;
        padding: 20rpx;
        box-sizing: border-box;

        .goods-img {
          width: 160rpx;
          height: 160rpx;
          margin-right: 24rpx;
        }

        .goods-info-view {
          display: flex;
          flex-direction: column;
          width: calc(100% - 160rpx - 24rpx - 40rpx);
          .goods-num-text {
            margin-top: 16rpx;
          }

          .goods-price-text {
            margin-top: 40rpx;
          }
        }

        .good-arrow {
          width: 20rpx;
          height: 20rpx;
          margin-left: 20rpx;
        }
      }
    }
  }

  .goods-price-container {
    width: 100%;
    background-color: #fff;
    padding: 26rpx 32rpx;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .goods-left-view {
      display: flex;
      flex-direction: column;

      .price-view {
        display: flex;
        flex-direction: row;
        align-items: flex-end;

        .price-text {
          margin-left: 8rpx;
          line-height: 50rpx;
        }
      }

      .price-tips-view {
        margin-top: 10rpx;
        display: flex;
        flex-direction: row;
        align-items: center;

        .tips-img {
          width: 24rpx;
          height: 24rpx;
          margin-right: 2rpx;
        }
      }
    }

    .submit-btn {
      width: 260rpx;
      height: 92rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #FE019B;
      border-radius: 46rpx;
    }
  }
}


</style>
