define({ name: "delivery", template: `
配送
统一邮费 运费模板
请输入大于等于0的数
{{item.dispatch_name}}
{{item.name}}
`, data(){ return { freight_list:[{ id:0, name:"默认模板" },{ id:1, name:"其他模板" }], yesRegular:true, } }, watch:{ 'form.dispatch.dispatch_type':{ handler(val, olVal) { if(this.form.dispatch.dispatch_type) { this.yesRegular = this.form.dispatch.dispatch_price == "" ? false : true; } }, deep:true }, 'form.dispatch.dispatch_price':{ handler(val, olVal){ let regular = new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/) let dispatchPrice = regular.test(this.form.dispatch.dispatch_price); if(!dispatchPrice){ this.yesRegular = false return } this.yesRegular = true }, deep:true } }, mounted() { let dispatch_type_ids_list = [] this.form.dispatch.dispatch_type_ids.forEach(element => { dispatch_type_ids_list.push(element * 1) }); if(this.form.dispatch.dispatch_id == null || this.form.dispatch.dispatch_id == 0){ this.form.dispatch.dispatch_id = "" } this.form.dispatch.dispatch_type_ids = dispatch_type_ids_list }, methods: { extraDate(){ }, validate(){ if(!this.yesRegular){ return false; }else{ let new_dispatch_type_ids = []; for(let item of this.form.dispatch.dispatch_type_ids) { for(let citem of this.form.dispatchTypesSetting) { if(item == citem.id) { new_dispatch_type_ids.push(item) } } } return { dispatch_type:this.form.dispatch.dispatch_type, dispatch_price:this.form.dispatch.dispatch_price ? this.form.dispatch.dispatch_price : "", dispatch_type_ids:new_dispatch_type_ids, dispatch_id:this.form.dispatch.dispatch_id }; } } }, style: `.tip-bg { color: #EE3939; font-size: 12px; line-height: 1; margin-top: 10px; }`, props: { form: { type: Object, default() { return {} } } } })