| | |
| | | obj.elBusForm |
| | | .getComponentById('minOrderAmount') |
| | | .$parent.clearValidate() |
| | | } else { |
| | | updateForm({ minOrderAmount: undefined }) |
| | | } |
| | | }, |
| | | }, |
| | |
| | | type: 'textarea', |
| | | rows: 6, |
| | | }, |
| | | default: |
| | | '此券每人限领1张。仅限用于花满芫鲜花交易平台鲜切花花款满额使用,不可与其他优惠同享、不可叠加使用', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入使用规则', |
| | |
| | | label: '优惠券使用条件:', |
| | | id: 'minOrderAmount', |
| | | type: 'input-number', |
| | | el: { |
| | | min: 0, |
| | | el: (row) => ({ |
| | | min: row.couponDiscountType === 'discount' ? 0.01 : 0, |
| | | max: 99999999, |
| | | precision: 2, |
| | | controls: false, |
| | | }, |
| | | }), |
| | | prefix: '满', |
| | | unit: '元', |
| | | rules: { |
| | |
| | | type: 'input-number', |
| | | el: { |
| | | min: 0.01, |
| | | max: 99999999, |
| | | precision: 2, |
| | | controls: false, |
| | | }, |
| | | unit: '元', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入优惠券面值', |
| | | trigger: 'blur', |
| | | rules: (row) => { |
| | | return [ |
| | | { |
| | | required: true, |
| | | message: '请输入优惠券面值', |
| | | trigger: 'blur', |
| | | }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (value && row.minOrderAmount && value > row.minOrderAmount) { |
| | | callback(new Error('优惠券面值不能大于优惠券使用条件')) |
| | | } else { |
| | | callback() |
| | | } |
| | | }, |
| | | trigger: 'blur', |
| | | }, |
| | | ] |
| | | }, |
| | | }, |
| | | ] |
| | |
| | | } |
| | | |
| | | // 优惠券领取/发放记录 |
| | | export const couponRecordColumn = () => { |
| | | export const couponRecordColumn = (timeName) => { |
| | | return [ |
| | | { label: '序号', type: 'index' }, |
| | | { label: '店铺名称', prop: 'customerName' }, |
| | | { label: '优惠券类型', prop: 'couponDiscountTypeName' }, |
| | | { |
| | | label: '使用条件', |
| | | formatter: (row) => `满${row.minOrderAmount}`, |
| | | }, |
| | | { label: '优惠券面值', prop: 'couponDiscountValue' }, |
| | | { label: '联系方式', prop: 'tel' }, |
| | | { label: timeName, prop: 'createTime' }, |
| | | { label: '状态', prop: 'statusName' }, |
| | | { label: '使用时间', prop: 'index' }, |
| | | { label: '使用时间', prop: 'usedTime' }, |
| | | { label: '订单号', prop: 'orderNo' }, |
| | | ] |
| | | } |
| | |
| | | }, |
| | | } |
| | | } |
| | | |
| | | export const getImageUrlRules = (row, form) => { |
| | | const id = 'imageUrl' |
| | | let required = false |
| | | let message = '' |
| | | if (row.getType === 'home') { |
| | | required = true |
| | | message = '图片为必填项目' |
| | | } |
| | | const curField = form.find((field) => field.id === id) |
| | | if (curField && curField.rules && required) { |
| | | curField.rules.required = true |
| | | curField.rules.message = message |
| | | } else if (curField && curField.rules) { |
| | | curField.rules.required = false |
| | | curField.rules.message = message |
| | | } |
| | | } |
| | | |
| | | export const dateTimeRules = (format = 'YYYY-MM-DD HH:mm') => { |
| | | return { |
| | | validator: (rule, value, callback) => { |
| | | if ( |
| | | Array.isArray(value) && |
| | | value.filter((i) => !!i).length === 2 && |
| | | utils.formatDate(value[0], 'YYYY-MM-DD HH:mm') > |
| | | utils.formatDate(value[1], 'YYYY-MM-DD HH:mm') |
| | | ) { |
| | | callback(new Error('开始时间不能大于结束时间')) |
| | | } else { |
| | | callback() |
| | | } |
| | | }, |
| | | } |
| | | } |