<template>
  <view class="good-del">
    <uni-popup ref="popup" type="dialog">
      <uni-popup-dialog
        mode="base"
        message="成功消息"
        :duration="2000"
        :before-close="true"
        type="info"
        cancel-txt="再想想"
        confirm-txt="删除"
        content="确定要删除这些商品吗？"
        :show-title="false"
        @cancel="close"
        @confirm="confirm"
      >
        确定要删除这些商品吗？
      </uni-popup-dialog>
    </uni-popup>
  </view>
</template>
<script>
import uniPopupDialog from "@/components/uni-popup/uni-popup-dialog.vue";
import { mapActions } from "../shopCartModules";
export default {
  name: "GoodDel",
  components: {
    uniPopupDialog
  },
  props: {
    show: {
      type: Boolean,
      default() {
        return false;
      }
    }
  },
  watch: {
    show: function(val) {
      if (val) {
        this.$refs?.popup?.open();
      } else {
        this.$refs?.popup?.close();
      }
    }
  },
  methods: {
    ...mapActions({
      delCartGood: "del_cart_good"
    }),
    close() {
      this.$emit("close");
    },
    confirm() {
      this.$emit("close");
      this.delCartGood();
    }
  }
};
</script>
<style lang="scss">
.uni-dialog-button-text {
  color: #333;
}
</style>
