|  |  |  | 
|---|
|  |  |  | <el-form-item label="车型名称" prop="bikeTypeName"> | 
|---|
|  |  |  | {{ form.bikeTypeName }} | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="工作日计费"> | 
|---|
|  |  |  | <el-form-item label="工作日计费" prop="base"> | 
|---|
|  |  |  | <el-select v-model="form.baseType" @change="selectBaseType"> | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="item in priceType" | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="节假日计费"> | 
|---|
|  |  |  | <el-form-item label="节假日计费" prop="holiday"> | 
|---|
|  |  |  | <el-select v-model="form.holidayBaseType" @change="selectHolidayBaseType"> | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="item in priceType" | 
|---|
|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import GlobalAlertWindow from '@/components/common/GlobalAlertWindow' | 
|---|
|  |  |  | import { create } from '@/api/business/pricingParam' | 
|---|
|  |  |  | import { updatePricingDetailById } from '@/api/business/pricingParam' | 
|---|
|  |  |  | // import { findList } from '@/api/business/roomTime' | 
|---|
|  |  |  | import { numRule } from '@/utils/form' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaPriceConfigWindow', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | 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 { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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 { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | const holidayRule = (rule, value, callback) => { | 
|---|
|  |  |  | if (this.form.holidayBaseType==1) { | 
|---|
|  |  |  | if (!this.form.holidayBasePrice || this.form.holidayBasePrice<0) { | 
|---|
|  |  |  | callback(new Error()) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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 { | 
|---|
|  |  |  | callback() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | 
|---|
|  |  |  | backInfoRequired: false, | 
|---|
|  |  |  | // 验证规则 | 
|---|
|  |  |  | rules: { | 
|---|
|  |  |  | duration: [ | 
|---|
|  |  |  | { required: true, validator: numRule, message: '请输入计费时长', tigger: 'blur' } | 
|---|
|  |  |  | base: [ | 
|---|
|  |  |  | { required: true, validator: baseRule, message: '请完善工作日计价信息', tigger: 'blur' } | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | backReason: [ | 
|---|
|  |  |  | { required: true, message: '请选择调整原因', tigger: 'change'}, | 
|---|
|  |  |  | holiday: [ | 
|---|
|  |  |  | { required: true, validator: holidayRule, message: '请完善节假日计价信息', tigger: 'blur'}, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.isWorking = true | 
|---|
|  |  |  | create(this.form) | 
|---|
|  |  |  | updatePricingDetailById(this.form) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.visible = false | 
|---|
|  |  |  | this.$tip.apiSuccess('修改成功') | 
|---|