<template>
  <el-dialog title="微信转POS" :visible.sync="dialogVisible" custom-class="customer-dialog" @close="cancel" width="420px">
      <p style="margin-bottom: 8px">确认将此客户的微信信息删除吗？删除后：</p>
      <p style="margin-bottom: 8px">
        1、此客户的客户类型将从微信会员转为POS会员；<br/>
        2、该客户与微信侧的关联信息将被清除（公众号和小程序）；<br/>
        3、与该客户相关的数据统计将产生影响如微信会员数、POS转微信会员数等
      </p>
      <p>删除后不可恢复，请谨慎操作！</p>
    <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" @click="okBtn">确定</el-button>
      </span>
  </el-dialog>
</template>

<script>
import { doFetchGet } from '../../axios/api';
import url from '../../axios/url';
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    memberId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
    };
  },
  methods: {
    cancel() {
      this.$emit('update:dialogVisible', false);
    },
    okBtn() {
      doFetchGet(url.weChantToPos,{mid: this.memberId}).then((res)=>{
        if(res.data.errorCode == 0){
          this.cancel();
          this.$emit('refresh');
          this.$message.success('操作成功');
        }else{
          this.$message.error(res.data.message);
        }
      })
      
    }
  }
};
</script>
<style lang="less">
.customer-dialog {
  /deep/.el-dialog__header{
    font-size: 16px !important;
  }
}
</style>
<style lang="less" scoped>
  .customer-dialog {
    background: #000000;
    opacity: 0.5;
    p {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #303133;
      line-height: 20px;
    }
  }
</style>