<template>
  <div class="page">
    <topBar
      v-if="topList.length > 0"
      :topList="topList"
      :moren="moren"
    ></topBar>
    <div class="main">
      <div class="main_title">
        <div class="bluekuai"></div>
        <div class="title_word">{{'支付配置'}}</div>
      </div>
      <div class="main_content">
        <el-form ref="form" :model="form" >
          <el-row>
            <el-col :span="8" v-for="(aitem, aindex) in zfList" :key="aindex" class="selects">
              <el-form-item :label="aitem.label">
<!--                <a class="my_stars">*</a>-->
                <el-select clearable  v-model="aitem.value">
                  <el-option
                    v-for="item in alowList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-select :disabled="aitem.value==1" clearable  v-model="aitem.systemConfigParam.value" style="margin-left: 10px">
                  <el-option
                    v-for="item in hourList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
    <div class="my_footer">
      <div style="margin: 0 auto">
        <el-button class="myBtn"> {{ '取消' }}</el-button>
        <el-button style="margin-left: 40px" type="primary" class="myBtn1" @click="saveDate"
                   v-has-buttons="['zfpzConfirm']"
          > {{ '确认' }}</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
import topBar from "@/components/topBarRole";
import { getzccsPayList, saveYfpz } from "@/api/system";
import {getRouters} from "@/api/settle";
export default {
  name: "Zfpz",
  components: {
    topBar,
  },
  data() {
    return {
      moren: "zfpz",
      topList: [
        {
          name: '注册次数',
          path: "xtcs",
          url: "xtcs",
          changed: false,
        },
        {
          name: '运输方式',
          path: "ysfs",
          url: "ysfs",
          changed: false,
        },
        {
          name: '支付配置',
          path: "zfpz",
          url: "zfpz",
          changed: false,
        },
        {
          name: '邮费配置',
          path: "yfpz",
          url: "yfpz",
          changed: false,
        },
        {
          name: '安置校验',
          path: "azjy",
          url: "azjy",
          changed: false,
        },
        {
          name: '撤单日期',
          path: "cdsj",
          url: "cdsj",
          changed: false,
        },
        {
          name: '升级方式',
          path: "sjfs",
          url: "cdsj",
          changed: false,
        },
        {
          name:'直推方式',
          path:'ztfs',
          url: "ztfs",
          changed: false,
        }
      ],
      alowList: [
        { value: "0", label: '允许' },
        { value: "1", label: '禁止' },
      ],
      hourList: [
        {
          value: "1",
          label: '12小时',
        },
        {
          value: "2",
          label: '24小时',
        },
        {
          value: "3",
          label: '48小时',
        },
        {
          value: "4",
          label: '72小时',
        },
      ],
      form: {},
      zfList: [],
    };
  },
  created() {
    this.getzccsList();
    this.getUserRoute();
  },
  methods: {
    getUserRoute() {
      getRouters().then((res)=>{
        res.data.forEach((item)=>{
          this.topList.forEach((items)=>{
            if (item.routeName == items.url){
              items.changed = true
            }
          })
        })
      })
    },
    getzccsList() {
      getzccsPayList({ key: "PAYMENT" }).then((res) => {
        this.zfList = res.data;
      });
    },
    saveDate() {
      saveYfpz(this.zfList).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.msg,
            type: "success",
          });
          this.getzccsList();
        } else {
          this.$message({
            message: res.msg,
            type: "warning",
          });
        }
        this.getzccsList();
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.myBtn{
  width: 120px;
  height: 38px;
  border-radius: 5px;
  color: #fff;
  background-color: #CCCCCC;
  border-color: #ccc;
}
.myBtn1{
  width: 120px;
  height: 38px;
  border-radius: 5px;
  color: #fff;
  background-color: #C8161D;
  border-color: #C8161D;
}
.selects{
  position: relative;
}
::v-deep .el-form-item{
  position: relative;
}
::v-deep .el-input__icon{
  line-height: 45px;
}
//::v-deep .el-icon-arrow-up:before{
//  content: url('~@/assets/images/down.png') !important;
//  height: 7px;
//}
::v-deep .input_s .el-select .el-input input{
  text-align: center;
}
::v-deep .el-input{
  //width: 166px;
}
::v-deep .el-input__inner{
  //width: 166px;
  height: 32px;
}
::v-deep .el-form-item__label{
  color: #333;
  font-weight: inherit;
  margin-left: 10px;
}
::v-deep [class*="el-col-"] {
  display: flex;
}
::v-deep .el-form-item {
  display: flex;
  margin-bottom: 10px;
}
.page {
  padding: 20px;
  background: #f9f9f9;
  font-size: 14px;
  .main {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
    .main_title {
      display: flex;
      align-items: center;
      padding: 10px 0;
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
      .bluekuai {
        width: 5px;
        height: 19px;
        background: #C8161D;
        margin-right: 20px;
      }
      .title_word {
        font-size: 14px;
        font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
        font-weight: bold;
        color: #333333;
      }
    }
    .main_content {
      padding: 20px 25px;
    }
  }
  .footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    .thebtn {
      width: 120px;
      height: 38px;
    }
  }
}
</style>
