<template>
  <div>
    <el-dropdown size="small" :hide-on-click="false" @command="addBtn">
      <span class="el-dropdown-link">
        <el-button ref="btn" size="small" type="primary">新 建</el-button>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="经销项目" v-if="flag === 1">经销项目协议</el-dropdown-item>
        <el-dropdown-item command="直销项目" v-if="flag === 2">直销项目协议</el-dropdown-item>
        <el-dropdown-item command="居间">居间协议</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-drawer
      :title="`新建${contractType}协议`"
      :visible.sync="drawer"
      :show-close="false"
      direction="rtl"
      size="40%"
      append-to-body
      @close="closeDrawer">
      <div class="drawer__panel">
        <!--经销项目-->
        <el-row v-if="contractType == '经销项目'">
          <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="140px" size="small">
            <el-col :span="24">
              <el-form-item label="合同标题:" prop="title">
                <el-input type="text" size="small" v-model="form.title"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="经销商:" prop="enterprisename">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="agentVisible"
                    width="500">
                  <selectAgent type="5" ref="member" typemx="经销项目协议" :param="agentListPrams"  :radio="true" @onSelect="agentChange" @onCancel="agentVisible = false"></selectAgent>
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('agentVisible')" v-model="form.enterprisename"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目名称:" prop="projectname">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="projectVisible"
                    width="600">
<!--                  <seleteProject ref="project" type="1" :sys_enterpriseid='form.sys_enterpriseid' @onSelect="projectChange" @onCanel="projectVisible=false"></seleteProject>-->
                  <el-input disabled type="text" slot="reference" size="small" v-model="form.projectname" @focus="showChange('projectVisible')"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目编号:" prop="">
                <el-input disabled type="text" size="small" v-model="form.projectnum" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="业务员:" prop="">
                <el-input disabled type="text" size="small" v-model="form.salername"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="折扣(%):" prop="discountrate"  >
                <el-input type="text" size="small" v-model="form.discountrate" placeholder="请输入折扣"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="付款条件:" prop="paytype">
                <el-select v-model="form.paytype" placeholder="请选择" style="width: 100%;">
                  <el-option
                      v-for="item in payTypeData"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="发货日期提醒(天):" prop="reminddays"  >
                <el-input type="text" size="small" v-model="form.reminddays" placeholder="请输入发货日期提醒天数"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同有效期:" prop="begdate">
                <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="签约日期:" prop="signdate">
                <el-date-picker
                    v-model="form.signdate"
                    style="width: 100%"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="签约金额(元):" prop="signamount">
                <el-input type="text" size="small" placeholder="系统自动计算" disabled v-model="form.signamount"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同模板:" prop="">
                <el-input disabled type="text" size="small" :value="$route.query.type == '框架' ? '经销合作' : $route.query.type"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同描述:" prop="hrid">
                <el-input type="textarea" size="small" v-model="form.remarks"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
        <!--直销项目-->
        <el-row v-if="contractType == '直销项目'">
          <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="140px" size="small">
            <el-col :span="24">
              <el-form-item label="合同标题:" prop="title">
                <el-input type="text" size="small" v-model="form.title"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="客户" prop="sys_enterpriseid">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="accountVisible"
                    width="500">
                  <selectAgent type="7" ref="member" typemx="直销项目协议" :param="agentListPrams" :radio="true" @onSelect="accountChange" @onCancel="accountVisible = false"></selectAgent>
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('accountVisible')" v-model="form.enterprisename"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目:" prop="projectname">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="projectVisible"
                    width="600">
<!--                  <seleteProject ref="project" type="1" @onSelect="projectChange" @onCanel="projectVisible=false"></seleteProject>-->
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('projectVisible')" v-model="form.projectname"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目地址:" prop="">
                <el-input disabled type="text" size="small" v-model="address"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="业务员:" prop="">
                <el-input disabled type="text" size="small" v-model="form.salername"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="折扣(%):" prop="discountrate"  >
                <el-input type="text" size="small" v-model="form.discountrate" placeholder="请输入折扣"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="付款条件:" prop="paytype">
                <el-select v-model="form.paytype" placeholder="请选择" style="width: 100%;">
                  <el-option
                      v-for="item in payTypeData"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="发货日期提醒(天):" prop="reminddays"  >
                <el-input type="text" size="small" v-model="form.reminddays" placeholder="请输入发货日期提醒天数"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="收货人:" prop="receiptName">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="receiptVisible"
                    width="600">
                  <seleteReceipt ref="receipt" type="1" @onSelect="receiptChange" @onCanel="receiptVisible = false"></seleteReceipt>
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('receiptVisible')" v-model="form.receiptName"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="收货人电话:" prop="">
                <el-input disabled type="text" size="small" v-model="form.phonenumber"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同有效期:" prop="begdate">
                <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="签约日期:" prop="signdate">
                <el-date-picker
                    v-model="form.signdate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="签约金额(元):" prop="signamount">
                <el-input type="text" placeholder="系统自动计算" disabled size="small" v-model="form.signamount"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同模板:" prop="">
                <el-input disabled type="text" size="small" :value="$route.query.type == '框架' ? '经销合作' : $route.query.type"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同描述:" prop="hrid">
                <el-input type="textarea" size="small" v-model="form.remarks"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
        <!--居间协议-->
        <el-row v-if="contractType == '居间'">
          <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="135px" size="small">
            <el-col :span="24">
              <el-form-item label="合同标题:" prop="title">
                <el-input type="text" size="small" v-model="form.title"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="居间商:" prop="enterprisename">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="agentVisible"
                    width="500">
                  <selectAgent ref="member" type="5" typemx="居间协议" :param="agentListPrams" :radio="true" @onSelect="centerChange" @onCancel="agentVisible = false"></selectAgent>
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('agentVisible')" v-model="form.enterprisename"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目合同:" prop="ascription_title">
                <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="concratVisible"
                    width="600">
                  <seleteProjectContract type="3" ref="project" @onSelect="concratChange" @onCanel="concratVisible=false" ></seleteProjectContract>
                  <el-input readonly type="text" slot="reference" size="small" @focus="showChange('concratVisible')" v-model="form.ascription_title"></el-input>
                </el-popover>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目名称:" prop="projectname">
                <el-input disabled type="text" size="small" v-model="form.projectname"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="项目编号:" prop="projectnum">
                <el-input disabled type="text" size="small" v-model="form.projectnum"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="业务员:" prop="">
                <el-input disabled type="text" size="small" v-model="form.salername"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="签约日期:" prop="signdate">
                <el-date-picker
                    v-model="form.signdate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="计算方式" prop="">
                <el-radio-group v-model="form.calculatemodel">
                  <el-radio label="1">按订单金额比例计算</el-radio>
                  <el-radio label="2">按居间产品折扣计算</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="24" v-if="form.calculatemodel==1">
              <el-form-item label="订单金额比例(%):" prop="orderratio" >
                <el-input type="text" size="small" v-model.number="form.orderratio"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24" v-if="form.calculatemodel==2">
              <el-form-item label="居间产品折扣(%):" prop="productdiscount">
                <el-input type="text" size="small" v-model.number="form.productdiscount"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同有效期:" prop="begdate">
                <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
              </el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item label="合同模板:" prop="">
                <el-input disabled type="text" size="small" :value="$route.query.type == '框架' ? '经销合作' : $route.query.type"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="合同描述:" prop="hrid">
                <el-input type="textarea" size="small" v-model="form.remarks"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
      </div>
      <div class="fixed__btn__panel">
        <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'

import selectAgent from '@/HDrpManagement/contractManage/components/selectAgent'
import TimeSelect from '@/HDrpManagement/contractManage/components/TimeSelect'
import seleteProjectContract from './seleteProjectContract'
import seleteReceipt from '@/HDrpManagement/contractManage/components/seleteReceipt'

export default {
  name:'',
  props:['data'],
  components:{
    selectAgent,
    TimeSelect,
    seleteProjectContract,
    seleteReceipt
  },
  data () {
    var checkNumber = (rule, value, callback) => {
      if (typeof +value != 'number') {
        return callback(new Error('请填写数字'));
      }
      callback()
    }
    var NumberSize = (rule, value, callback) => {
      if (+value > 100 || +value < 1 && value) {
        return callback(new Error('折扣范围(1-100)'));
      }
      callback()
    }
    return {
      drawer:false,
      contractType:'',
      agentVisible:false,
      salerVisible:false,
      projectVisible:false,
      accountVisible:false,
      modelVisible:false,
      concratVisible:false,
      receiptVisible:false,
      payTypeData:[],
      address:'',
      flag:0,
      form: {
        "sa_contractid": 0,
        "sys_enterpriseid": "",
        "projectname":'',
        "begdate": "",
        "enddate": "",
        "sa_projectid": "", //可选
        "type": "", //可选
        "discountrate": '', //可选
        "saler_hrid": JSON.parse(window.sessionStorage.getItem('active_account')).hrid, //可选
        "signdate": "", //可选
        "signby": "", //可选
        "remarks": "", //可选
        "title": "",
        "signamount":'',
        "salername":JSON.parse(window.sessionStorage.getItem('active_account')).name,
        "enterprisename":'',
        "sys_printmodelid": '',//可选
        "typemx":"",//可选
        "modelname":"",
        "calculatemodel":'1',
        "productdiscount":'',
        "orderratio":'',
        "ascription_title":'',
        'ascription_contractid':'',
        'receiptName':'',
        "rec_contactsid":'',//收货联系人
        'phonenumber':'',
        'paytype':'',
        'reminddays':''
      },
      rules: {
        title: [
          { required: true, message: '请填写标题', trigger: 'blur' },
        ],
        sys_enterpriseid: [
          { required: true, message: '请选择客户', trigger: 'change' },
        ],
        ascription_title: [
          { required: true, message: '请选择项目合同', trigger: 'change' },
        ],
        begdate: [
          { required: true, message: '请选择生效日期', trigger: 'blur' },
        ],
        projectname: [
          { required: true, message: '请选择项目', trigger: 'change' },
        ],
        salername: [
          { required: true, message: '请选择业务员', trigger: 'change' },
        ],
        paytype: [
          { required: true, message: '请选择付款条件', trigger: 'change' },
        ],
        reminddays: [
          { required: true, message: '请设置发货日期提醒天数', trigger: 'blur' },
        ],
        enterprisename: [
          { required: true, message: '请选择', trigger: 'change' },
        ],
        signdate: [
          { required: true, message: '请填写签约时间', trigger: 'change' },
        ],
        productdiscount: [
          { message: '必须为数字', type:'number', trigger: 'change' },
          { required: true, message: '请填写折扣', trigger: 'blur' },
        ],
        orderratio: [
          { message: '必须为数字', type:'number', trigger: 'change' },
          { required: true, message: '请填写折扣', trigger: 'blur' },
        ],
        salername: [
          { required: true, message: '请选择经销商', trigger: 'change' },
        ],
        discountrate: [
          { validator: checkNumber, trigger: 'blur'},
          { validator: NumberSize, trigger: 'blur'}
        ],
      },
      salerListParams: {
        "id": 20221122153902,
        "content": {
            "pageNumber": 1,
            "pageSize": 20,
            "where": {
                "condition": ""
            }
        },
      },
      agentListPrams: {
        "id": 20220920083901,
        "content": {
          "pageNumber": 1,
          "pageSize": 20,
          "where": {
              "condition": "",
              "type":'',
              "typemx":"",
          }
        }
      },
    }
  },
  computed: {
    ...mapGetters({
      DrawerShow:'DrawerShow'
    }),
  },
  watch: {
    drawer: {
      handler (val) {
        if (!val) {
          this.showChange(false)
          if (this.$refs.form) this.$refs.form.resetFields()
          this.$refs.timeSelect.time = ''
        }
      },
    }
  },
  methods:{
    closeDrawer () {
    },
    /*标签查询*/
    async queryTag(){
      this.flag = 0
      const res = await this.$api.requested({
        "id": 20220929085401,
        "content": {
          "ownertable":'sa_project',
          "ownerid":this.data.sa_projectid
        }
      })
      console.log(res,"标签数据")
      if (res.data.systemtag.length !== 0){
        for (let i=0;i<res.data.systemtag.length;i++){
          if (res.data.systemtag[i] === '经销'){
            this.flag = 1
            break
          }else if (res.data.systemtag[i] === '直销'){
            this.flag = 2
            break
          }
        }
      }
      console.log(this.flag,"是否经销")
    },
    addBtn (type) {
      this.form = Object.assign({},this.form,this.data)
      this.drawer = true
      this.contractType = type
      // if (type == '居间') {
      //   this.$nextTick(() => {
      //     this.$refs.projectContract.params.content.where.sa_projectid = this.data.sa_projectid
      //     this.$refs.projectContract.queryEnterpriseArchives()
      //   })
      // }
    },
    async onSubmit () {
      this.$refs.form.validate(async val => {
        if (val) {
          /* 居间新建 */
          if (this.contractType == '居间') {
            let is = this.centerEnterpriseList.some(item => item.sys_enterpriseid == this.form.sys_enterpriseid)
            if (is) {
              this.$confirm('当前项目已存在此居间商，请切换到"关联客户"维护','提示',{
                confirmButtonText:'确定',
                cancelButtonText:'取消'
              }).then(() => {
                // JSON.parse(sessionStorage.getItem('module_info')).forEach(item1 => {
                //   item1.modules.forEach(item2 => {
                //     if(item2.systemmodulename == "项目管理") {
                //       sessionStorage.setItem('active_modules',JSON.stringify(item2))
                //       this.$store.dispatch('changeDetailDrawer',true)
                //       this.$store.dispatch('DrawerShowChange',false)
                //       this.$router.push({path:'/projectChangeDetail',query:{id:this.centerEnterpriseList[0].sa_projectid}})
                //       return
                //     }
                //   })
                // })
              })
            } else {
              if (this.contractType == '直销项目') {
                this.form.type = '项目'
                this.form.typemx = '直销'
              } else if (this.contractType == '经销项目') {
                this.form.type = '项目'
                this.form.typemx = '经销'
              } else {
                this.form.type = this.contractType
              }
              this.form.discountrate ? this.form.discountrate =  (this.form.discountrate / 100).toFixed(4) : ''
              this.form.productdiscount ? this.form.productdiscount =  (this.form.productdiscount / 100).toFixed(4) : ''
              this.form.orderratio ? this.form.orderratio =  (this.form.orderratio / 100).toFixed(4) : ''
              let res = await this.$api.requested({
                "id":20221121185302,
                "content": this.form
              })
              this.tool.showMessage(res,() => {
                this.$emit('onSuccess')
                this.drawer = false
              })
            }
          } else {
            /* 其它新建 */
            if (this.contractType == '直销项目') {
              this.form.type = '项目'
              this.form.typemx = '直销'
            } else if (this.contractType == '经销项目') {
              this.form.type = '项目'
              this.form.typemx = '经销'
            } else {
              this.form.type = this.contractType
            }
            this.form.discountrate ? this.form.discountrate =  (this.form.discountrate / 100).toFixed(4) : ''
            this.form.productdiscount ? this.form.productdiscount =  (this.form.productdiscount / 100).toFixed(4) : ''
            this.form.orderratio ? this.form.orderratio =  (this.form.orderratio / 100).toFixed(4) : ''
            let res = await this.$api.requested({
              "id":20221121185302,
              "content": this.form
            })
            this.tool.showMessage(res,() => {
              console.log(res.data);
              this.$emit('onSuccess')
              this.drawer = false
              // this.$store.dispatch('DrawerShowChange',false)
              // this.$store.dispatch('changeDetailDrawer',true)
              // this.$router.push({path:'/contractDetail',query:{type:this.contractType,id:res.data.sa_contractid,rowindex:res.data.rowindex}})
            })
          }
          
        }
      })
    },
    accountChange (data) {
      this.form.enterprisename = data[0].enterprisename
      this.form.sys_enterpriseid = data[0].sys_enterpriseid
      this.accountVisible = false
    },
    projectChange (data) {
      this.form.projectname = data.projectname
      this.form.projectnum = data.projectnum
      this.form.sa_projectid = data.sa_projectid
      this.address = data.province + data.city + data.county + data.address
      this.projectVisible = false
    },
    receiptChange (data) {
      this.form.receiptName = data.name
      this.form.phonenumber = data.phonenumber
      this.form.rec_contactsid = data.contactsid
      this.receiptVisible = false
    },
    agentChange (data) {
      this.form.sys_enterpriseid = data[0].sys_enterpriseid
      this.form.enterprisename = data[0].enterprisename   
      this.agentVisible = false 
    },
    centerChange (data) {
      this.form.enterprisename = data[0].enterprisename
      this.form.sys_enterpriseid = data[0].sys_enterpriseid
      this.agentVisible = false
    },
    concratChange (data) {
      this.centerEnterpriseList = data.parties
      this.form.ascription_title = data.projectname
      this.form.ascription_contractid = data.sa_contractid
      this.form.projectname = data.projectname
      this.form.projectnum = data.projectnum
      this.form.sa_projectid = data.sa_projectid
      this.concratVisible = false
    },
    showChange (key) {
      this.agentVisible = false
      this.salerVisible = false
      this.projectVisible = false
      this.accountVisible = false
      this.modelVisible = false
      this.concratVisible = false
      this.receiptVisible = false
      /*key ? this[key] = true : '',*/
      if (key === 'projectVisible'){
        if (this.form.sys_enterpriseid !== ''){
          this.$refs.project.params.content.sys_enterpriseid = this.form.sys_enterpriseid
          this.$refs.project.queryEnterpriseArchives()
          key ? this[key] = true : ''
        }else {
          this.$refs.form.validateField("enterprisename")
          this.$refs.form.validateField("sys_enterpriseid")
        }

      }else if (key === 'receiptVisible'){
        if (this.form.sys_enterpriseid !== ''){
          this.$refs.receipt.params.content.sys_enterpriseid = this.form.sys_enterpriseid
          this.$refs.receipt.queryReceipts()
          key ? this[key] = true : ''
        }else {
          this.$refs.form.validateField("enterprisename")
          this.$refs.form.validateField("sys_enterpriseid")
        }
      }else if(key === 'concratVisible'){
        this.$refs.project.queryEnterpriseArchives()
        key ? this[key] = true : ''
      } else {
        key ? this[key] = true : ''
      }
      this.$refs.member.listData()
    },
    clearTime () {
      this.form.begdate = ''
      this.form.enddate = ''
    },
    timeChange (time) {
      this.form.begdate = time[0]
      this.form.enddate = time[1]
    },
    /*获取付款条件*/
    async payTypeList(){
      const res = await this.$api.requested({
        id: "20230110100103",
        content: {
          pageNumber: 1,
          pageSize:50,
          where: {condition: ""},
        }
      })
      console.log(res,'res')
      this.payTypeData = res.data.map((item,index)=>{
        /*if (item.point === '订单审核'){
          return {
            label:item.ruleno +  '\xa0  \xa0 \xa0 \xa0' + item.point + '\xa0  \xa0 \xa0 \xa0' + "立账额度" + (item.amountrate * 100) +'% ' + '\xa0  \xa0 \xa0 \xa0' + '后置天数' + item.days + '天',
            value:item.ruleno +  '' + item.point + '' + "立账额度" + (item.amountrate * 100) +'% ' + '' + '后置天数' + item.days + '天',
          }
        }else {
          return {
            label:item.ruleno + '\xa0  \xa0 \xa0 \xa0' + item.point + '\xa0  \xa0 \xa0 \xa0' +  '后置天数' + item.days + '天',
            value:item.ruleno + '' + item.point + '' +  '后置天数' + item.days + '天',
          }
        }*/
        return {
          label:item.ruleno + '-' + item.remarks ,
          value:item.ruleno + '-' + item.remarks
        }

      })
      /* res.data.forEach((item,index)=>{
         if (item.point === '订单审核'){
           this.payTypeData[index] = item.ruleno + ' ' + item.point + ' ' + "立账额度" + (item.amountrate * 100) +'% ' + '后置天数' + item.days
         }else {
           this.payTypeData[index] = item.ruleno + ' ' + item.point + ' ' +  '后置天数' + item.days
         }
       })*/
      console.log(this.payTypeData,'处理后数据')
    }
  },
  created() {
  },
  mounted () {
    this.queryTag()
    this.payTypeList()
  }
}

</script>
<style scoped>
.box p {
  line-height: 40px;
  text-align: center;
}
.box p:hover {
  background: #EBF1FE;
  color: #6191F8;
  cursor: pointer;
}
</style>