<template>
|
<GlobalWindow
|
:title="title"
|
:visible.sync="visible"
|
:confirm-working="isWorking"
|
@confirm="confirm"
|
width="600px"
|
>
|
<el-form :model="form" ref="form" :rules="rules" label-width="100px">
|
<el-form-item label="日期" prop="createDate">
|
<el-date-picker
|
v-model="form.createDate"
|
type="date"
|
:picker-options="pickerOptions"
|
format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
placeholder="选择日期">
|
</el-date-picker>
|
</el-form-item>
|
</el-form>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import { syncWxBill } from '@/api/business/wxBill'
|
export default {
|
name: 'OperaMemberWindow',
|
extends: BaseOpera,
|
components: { GlobalWindow },
|
data () {
|
return {
|
pickerOptions: {
|
disabledDate (time) {
|
return time.getTime() > Date.now() - 3600 * 1000 * 24
|
// time.getTime() > Date.now(); 选择今天及今天之前的日期;
|
// time.getTime() > Date.now()c;选择今天之前的日期,不包括今天;
|
// time.getTime() < Date.now();选择今天之后的日期;
|
// time.getTime() < Date.now() - 3600 * 1000 * 24;选择今天及今天之后的日期;
|
}
|
},
|
// 表单数据
|
form: {
|
createDate: ''
|
},
|
// 验证规则
|
rules: {
|
createDate: [
|
{ required: true, message: '请选择日期!', tigger: 'blur' }
|
]
|
}
|
}
|
},
|
created () {
|
this.config({
|
api: '/business/wxBill',
|
'field.id': 'id'
|
})
|
},
|
methods: {
|
confirm () {
|
this.$refs.form.validate((valid) => {
|
// debugger
|
if (!valid) {
|
return
|
}
|
// 调用新建接口
|
this.isWorking = true
|
syncWxBill({
|
createDate: this.form.createDate
|
}).then(res => {
|
this.visible = false
|
this.$tip.apiSuccess('正在后端同步数据,请稍后刷新查看!')
|
this.$emit('success')
|
}).catch(e => {
|
this.$tip.apiFailed(e)
|
}).finally(() => {
|
this.isWorking = false
|
})
|
})
|
}
|
}
|
}
|
</script>
|