<template>
  <div>
    <el-button size="mini" type="text" @click="detailBtn">商 品 明 细</el-button>
    <el-dialog title="新 增" :visible.sync="dialogFormVisible" width="80%">
      <div slot="title" style="font-size: 15px">
        商品价格调整单明细
      </div>
      <basicLayout 
        ref="basicLayout" 
        formPath="productMoneyOdd/productOddDetail" 
        tableName="productDetailTable" 
        idName="sa_itempriceadjustid" 
        :apiId="{query:20221025160904,del:20221025095404}" 
        :options="options"
        @listCreate="list">
        <div slot="custom"></div>
        <template v-slot:tbList="scope">
          <div v-if="scope.data.column.data[scope.data.column.columnname] === ''">
          --
          </div>
          <div v-else-if="scope.data.column.columnname == 'province'">
          {{`${scope.data.column.data['province']}、${scope.data.column.data['city']}、${scope.data.column.data['county']}`}}
        </div>
          <div v-else>
            {{scope.data.column.data[[scope.data.column.columnname]]}}
          </div>
        </template>
        <template v-slot:tbOpreation="scope">
          <delete-btn @deleteCreate="deleteCreate" v-if="tool.checkAuth($route.name,'delete')" :id="scope.data.data.sa_itempriceadjust_itemsid" @deleteSuccess="$refs.basicLayout.listData()" nameId="20221025095404" nameKey="sa_itempriceadjust_itemsids"/>
        </template>
      </basicLayout>
    </el-dialog>
    
  </div>
</template>

<script>
export default {
  props:['rowData'],
  components:{},
  name: "index",
  data() {
    return {
      options:[],
      dialogFormVisible: false,
      productList:''
    }
  },
  provide () {
    return {
      rowData:() => this.rowData,
      productList:() => this.productList
    }
  },
  mounted () {
    
  },
  methods: {
    deleteCreate (param) {
      param.content.sa_itempriceadjustid = this.rowData.sa_itempriceadjustid
    },
    detailBtn () {
      this.getProductList()
      this.dialogFormVisible = true
    },
    list (param) {
      param.content.sa_itempriceadjustid = this.rowData.sa_itempriceadjustid
    },
    /* 获取可添加的商品 */
    async getProductList () {
      let res = await this.$api.requested({
          "accesstoken": "0930ace78dc873659508aaa361ebada7",
          "id": 20221028154004,
          "content": {
              "pageNumber": 1,
              "pageSize": 20,
              "where": {
                  "condition": ""
              }
          }
      })
      this.productList = res.data
      console.log(this.productList);
    },
  }
}
</script>

<style scoped>

</style>