123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <div>
- <el-form ref="form" :model="form" style="width: 100%;padding: 5px" :rules="rules">
- <el-row>
- <el-col style="padding-bottom: 10px">
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row>
- <el-col :span="5" class="col-txt"><span>请选择导出时段</span></el-col>
- <el-col :span="18" class="col-input">
- <el-form-item>
- <el-date-picker
- v-model="datePicker"
- type="daterange"
- range-separator="-"
- value-format="yyyy-MM-dd"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- @change="dateChange"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" style="text-align: right">
- <el-button @click="handleClose">关 闭</el-button>
- <el-button type="primary" :loading="loading" @click.native="confirmSubmit()">提 交</el-button>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'NccSubmitIndex',
- data() {
- return {
- loading: false,
- form: {
- collectionDateFrom: '',
- collectionDateTo: ''
- },
- rules: {
- dateStart: [{ required: true, message: '请选择导出时段', trigger: 'change' }]
- },
- datePicker: []
- }
- },
- methods: {
- initData(data) {
- console.log('提交类型', data)
- this.form.type = data
- },
- handleClose() {
- this.$emit('editClose')
- },
- dateChange() {
- if (this.datePicker && this.datePicker.length) {
- this.form.collectionDateFrom = this.datePicker[0]
- this.form.collectionDateTo = this.datePicker[1]
- } else {
- this.form.collectionDateFrom = ''
- this.form.collectionDateTo = ''
- }
- },
- confirmSubmit() {
- const _this = this
- if (!this.form.collectionDateFrom || !this.form.collectionDateTo) {
- _this.$message({
- message: '请选择时间段',
- type: 'warning'
- })
- return
- }
- let soaUrl = ''
- if (_this.form.type === '收款') {
- soaUrl = 'collectionRecordSubmit'
- }
- if (_this.form.type === '退款') {
- soaUrl = 'refundRecordSubmit'
- }
- if (_this.form.type === '转换') {
- soaUrl = 'convertRecordSubmit'
- }
- _this.loading = true
- const postData = Object.assign({}, _this.form)
- this.baseRequest(soaUrl, postData).then(res => {
- if (res.data.code === 200) {
- _this.$message({
- message: '提交成功',
- type: 'success'
- })
- _this.handleClose()
- } else {
- _this.$message({
- message: res.msg,
- type: 'warning'
- })
- }
- _this.loading = false
- }).catch(err => {
- _this.$message({
- message: err,
- type: 'warning'
- })
- _this.loading = false
- })
- },
- baseRequest(opUrl, postData) {
- return this.$channel.globeRequest('TransactionRecordController', opUrl, postData, 'project')
- }
- }
- }
- </script>
- <style scoped lang="scss">
- </style>
|