<template>
  <div>
    <el-main class="tableBox">
      <el-table :data="tableData" style="width: 100%" ref="illustrate">
        <el-table-column prop="userName" label="操作人" />
        <!-- <el-table-column prop="userName" label="产品名称" /> -->
        <el-table-column prop="spid" label="SPID" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="Inquire(scope.row)">查询</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-main>
    <el-dialog class="dialog" :visible.sync="infoShow">
      <el-form>
        <el-form-item label="产品订购说明">
          <el-input type="textarea" v-model="orderingInfo" :rows="6"></el-input>
        </el-form-item>
        <el-form-item label="赠送话费说明">
          <el-input v-model="givePhoneInfo" :rows="6" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="活动说明">
          <el-input v-model="manualInfo" :rows="6" type="textarea"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="infoShow = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { post, get } from '@/api/common'
export default {
  data () {
    return {
      form: {
        pageNum: 1,
        pageSize: 20
      },
      tableData: [],
      infoShow: false,
      phone: [],
      givePhoneInfo: "",
      orderingInfo: "",
      manualInfo: ""
    }
  },

  created () {
    get("/productInfo/getlog", this.form).then(res => {
      this.tableData = res.data.list
      console.log(this.tableData)
      // this.tableData.forEach((a) => {
      //   // console.log(a.spid)
      //   // get("/productInfo/page", { spid: a.spid }).then(res => {
      //   //   // console.log(res)
      //   //   // this.tableData.prodceName=a.spid.
      //   // })
      // })
    })


  },

  methods: {
    Inquire (row) {
      this.infoShow = true
      this.phone = [JSON.parse(row.notes)]
      this.givePhoneInfo = this.phone[0].givePhoneInfo
      this.orderingInfo = this.phone[0].orderingInfo
      this.manualInfo = this.phone[0].manualInfo
    }
  }
}
</script>

<style scoped>
.tableBox {
  margin-top: 10px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: #bfbfbf 0 0 2px;
}
.dialog /deep/ .el-dialog {
  height: 85vh;
  overflow: auto;
}
</style>