<style>
  .addFreightRule .form-box {
    background: #fff;
    padding: 20px 50% 20px 0;
    margin-top: 10px;
  }
  .addFreightRule .prompt{
    margin: -10px 20px 20px;
    background-color: #F4F4F5;
    padding: 10px 15px;
    color: #909399;
    display: inline-block;
    font-size: 13px;
  }
</style>
<template>
  <div class="addFreightRule">
      <div id="pane-first">
        <div class="form-box">
          <el-form :model="msg" style="padding:0 50px;" :rules="rules" ref="msg" label-width="90px">
            <el-form-item label="规则名称" prop="MallName" class="is-required">
              <el-input v-model="msg.RulesName"/>
            </el-form-item>
            <el-form-item label="计费方式">
              <el-radio-group v-model="msg.LogisticsType" >
                <el-radio :label="1">按重计费</el-radio>
                <el-radio :label="2">按件计费</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="运费规则"  class="is-required">
                <span style="color: #409EFF;font-size: 14px;cursor: pointer;" @click="dialogFormVisible=true">+新增规则</span>
            </el-form-item>
          </el-form>


        </div>
        <el-button type="primary" style="margin: 12px 0 " @click="preserve">保存</el-button>
        <el-button style="margin: 12px 0 " @click="cancel">取消</el-button>

      </div>

    <!--新增规则弹窗-->
      <el-dialog title="新增规则" :visible.sync="dialogFormVisible" >
        <el-form :model="msg.Detail" :rules="rules">
          <el-row :gutter="0">
            <el-col :span="11">
              <el-form-item label="首重(克)：" label-width="100px" style="padding: 0px 1rem;" prop="MallName2">
                <el-input v-model="msg.Detail.First" />
              </el-form-item>
            </el-col>
            <el-col :span="11">
              <el-form-item label="首费（元）" label-width="100px" style="padding: 0px 1rem;" >
                <el-input v-model="msg.Detail.FirstPrice" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="0">
            <el-col :span="11">
              <el-form-item label="续重(克)：" label-width="100px" style="padding: 0px 1rem;" >
                <el-input v-model="msg.Detail.Second" />
              </el-form-item>
            </el-col>
            <el-col :span="11">
              <el-form-item label="续费（元）" label-width="100px" style="padding: 0px 1rem;" >
                <el-input v-model="msg.Detail.SecondPrice" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
      </el-dialog>
  </div>
</template>

<script>
    export default {
        name: "addFreightRule",
      data(){
          return{
            msg:{
              ID:"",
              RulesName:'',
              jifei:1,
              Detail:{
                First:0,
                FirstPrice:0,
                Second:0,
                SecondPrice:0,
              }

            },
            dialogFormVisible:false,
            rules: {
              MallName: [
                {required: true, message: "请输入规则名称", trigger: "blur"}
              ],
              MallName2: [
                {required: true, message: "请输入规则名称", trigger: "blur"}
              ],


            },
          }
      },
      methods:{
        cancel(){
          this.$router.go(-1);//返回上一层
        },
        preserve(){

        },
        addRule(){

        }
      }
    }
</script>

<style scoped>

</style>
