<template>
  <div>
    <el-button :type="disabled?'':'primary'" :size="btn_size?btn_size:'small'" @click="onshow" :disabled="disabled">{{ btnName ? $t(btnName) : $t('批量上架') }}</el-button>
  </div>
</template>

<script>
export default {
  name: "batchUp",
  props:["rowData","disabled","btnName","btn_size"],
  methods:{
    onshow(){
      this.onBatchUp()
    },
    onBatchUp(){
      this.$confirm(this.$t('确定上架这些商品吗')+'?', this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(async () => {
        let row = []
        this.rowData.forEach(function (item,index) {
          row[index] = item.sc_points_productid
        })
        const res = await this.$api.requested({
          "id": 2026052209114006,
          "content": {
            "sc_points_productids": row.join(",")
          },
        })
        this.tool.showMessage(res,()=>{
          this.$emit('batchUpSuccess')
        })
      }).catch(async () => {
        this.$message({
          type: 'info',
          message: this.$t('已取消批量上架')
        });
      });
    }
  }
}
</script>

<style scoped>

</style>