<template>
  <div class="orderPush-container">
    <div class="cid-content">
      <div class="cid-lable">CID:</div>
      <el-input style="width: 400px;" v-model="cid" placeholder="请输入内容"></el-input>
    </div>
    <el-input
      type="textarea"
      :autosize="{ minRows: 10, maxRows: 10}"
      placeholder="请输入内容"
      v-model="textarea">
    </el-input>
    <div class="btn-order-push" >
      <el-button type="primary" @click="testOrderPush">测试推送</el-button>
    </div>
  </div>
</template>

<script>
import { orderPushTest } from '@/api/orderPush/orderPush'
export default {
  data(){
    return{
      textarea:"测试推送到手机",
      cid:'e39150691541a18fd86ef4cf08415bc4'
    }
  },
  methods:{
    async testOrderPush(){

      let pamres = {
        cid: this.cid, // 终端id
        title: "小发同城", // 标题
        message: this.textarea,
        "clickType":"url", // 点击类型
        "clickContent":"https://mall.gpxscs.cn"// 跳转地址
      }

      let res = await orderPushTest(pamres)
      if(res && res.second == '推送成功'){
        this.$message({
          message: '推送成功',
          type: 'success'
        });
      }else{
        this.$message({
          message: res.msg || res.second,
          type: 'error'
        });
      }
    }
  }
}
</script>

<style lang="scss">
.orderPush-container{


  .cid-content{
    display: flex;
    align-items: center;
    margin: 20px 0;

    .cid-lable{
      margin-right: 20px;
    }
  }

  .btn-order-push{
    margin: 20px auto;
    text-align: center;
  }
}

</style>