|  |  |  | 
|---|
|  |  |  | width="600px" | 
|---|
|  |  |  | @confirm="confirm" | 
|---|
|  |  |  | > | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-form :model="form" ref="form" :rules="rules" label-suffix=":"> | 
|---|
|  |  |  | <el-form-item label="车型名称" prop="bikeTypeName"> | 
|---|
|  |  |  | {{ form.bikeTypeName }} | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <!--      base--> | 
|---|
|  |  |  | <el-form-item label="工作日计费" prop="base"> | 
|---|
|  |  |  | <el-select v-model="form.baseType" @change="selectBaseType"> | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | 
|---|
|  |  |  | :value="item.id" | 
|---|
|  |  |  | ></el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | <div class="setting" v-if="form.baseType == 1" style="display: flex;"> | 
|---|
|  |  |  | <div class="setting" v-if="form.baseType === 1" style="display: flex;"> | 
|---|
|  |  |  | <el-input v-model="form.basePrice" type="number" placeholder="" v-trim/> | 
|---|
|  |  |  | 元,畅骑一整天 | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | components: { GlobalAlertWindow }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | const baseRule = (rule, value, callback) => { | 
|---|
|  |  |  | if (this.form.baseType==1) { | 
|---|
|  |  |  | if (!this.form.basePrice || this.form.basePrice<0) { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (this.form.baseType == 1) { | 
|---|
|  |  |  | if (/^[1-9]\d*$|^0$/.test(this.form.basePrice)) { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (!this.form.basePrice || this.form.basePrice<0 || !this.form.baseTime || this.form.baseTime <0 | 
|---|
|  |  |  | || !this.form.unitPrice || this.form.unitPrice<0 || !this.form.unitTime || this.form.unitTime <0 | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.basePrice)) && | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.baseTime)) && | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.unitPrice)) && | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.unitTime))) { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | const holidayRule = (rule, value, callback) => { | 
|---|
|  |  |  | if (this.form.holidayBaseType==1) { | 
|---|
|  |  |  | if (!this.form.holidayBasePrice || this.form.holidayBasePrice<0) { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (this.form.holidayBaseType === 1) { | 
|---|
|  |  |  | if (/^[1-9]\d*$|^0$/.test(this.form.holidayBasePrice)) { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (!this.form.holidayBasePrice || this.form.holidayBasePrice<0 || !this.form.holidayBaseTime || this.form.holidayBaseTime <0 | 
|---|
|  |  |  | || !this.form.holidayBasePrice || this.form.holidayBasePrice<0 || !this.form.holidayUnitTime || this.form.holidayUnitTime <0 | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.holidayBasePrice)) && | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.holidayBaseTime)) && | 
|---|
|  |  |  | (/^[1-9]\d*$|^0$/.test(this.form.holidayUnitTime))) { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  | pricePramId: null, | 
|---|
|  |  |  | bikeTypeId: null, | 
|---|
|  |  |  | pricePramId: '', | 
|---|
|  |  |  | bikeTypeId: '', | 
|---|
|  |  |  | bikeTypeName: '', | 
|---|
|  |  |  | baseType: '', | 
|---|
|  |  |  | baseTime: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | { required: true, validator: holidayRule, message: '请完善节假日计价信息', tigger: 'blur'}, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 打开窗口 | 
|---|
|  |  |  | 
|---|
|  |  |  | for (const key in this.form) { | 
|---|
|  |  |  | this.form[key] = target[key] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.form.baseType = target.baseTime==-1 ? 1 : 2 | 
|---|
|  |  |  | this.form.holidayBaseType = target.holidayBaseTime==-1 ? 1 : 2 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.form.baseType = target.baseTime === -1 ? 1 : 2 | 
|---|
|  |  |  | this.form.holidayBaseType = target.holidayBaseTime === -1 ? 1 : 2 | 
|---|
|  |  |  | // this.form.backReason = '' | 
|---|
|  |  |  | // this.form.backInfo = '' | 
|---|
|  |  |  | // this.$refs.form.clearValidate() | 
|---|