nccSubmitIndex.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div>
  3. <el-form ref="form" :model="form" style="width: 100%;padding: 5px" :rules="rules">
  4. <el-row>
  5. <el-col style="padding-bottom: 10px">
  6. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  7. <el-row>
  8. <el-col :span="5" class="col-txt"><span>请选择导出时段</span></el-col>
  9. <el-col :span="18" class="col-input">
  10. <el-form-item>
  11. <el-date-picker
  12. v-model="datePicker"
  13. type="daterange"
  14. range-separator="-"
  15. value-format="yyyy-MM-dd"
  16. start-placeholder="开始日期"
  17. end-placeholder="结束日期"
  18. @change="dateChange"
  19. />
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. </el-card>
  24. </el-col>
  25. </el-row>
  26. </el-form>
  27. <div slot="footer" style="text-align: right">
  28. <el-button @click="handleClose">关 闭</el-button>
  29. <el-button type="primary" :loading="loading" @click.native="confirmSubmit()">提 交</el-button>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. export default {
  35. name: 'NccSubmitIndex',
  36. data() {
  37. return {
  38. loading: false,
  39. form: {
  40. collectionDateFrom: '',
  41. collectionDateTo: ''
  42. },
  43. rules: {
  44. dateStart: [{ required: true, message: '请选择导出时段', trigger: 'change' }]
  45. },
  46. datePicker: []
  47. }
  48. },
  49. methods: {
  50. initData(data) {
  51. console.log('提交类型', data)
  52. this.form.type = data
  53. },
  54. handleClose() {
  55. this.$emit('editClose')
  56. },
  57. dateChange() {
  58. if (this.datePicker && this.datePicker.length) {
  59. this.form.collectionDateFrom = this.datePicker[0]
  60. this.form.collectionDateTo = this.datePicker[1]
  61. } else {
  62. this.form.collectionDateFrom = ''
  63. this.form.collectionDateTo = ''
  64. }
  65. },
  66. confirmSubmit() {
  67. const _this = this
  68. if (!this.form.collectionDateFrom || !this.form.collectionDateTo) {
  69. _this.$message({
  70. message: '请选择时间段',
  71. type: 'warning'
  72. })
  73. return
  74. }
  75. let soaUrl = ''
  76. if (_this.form.type === '收款') {
  77. soaUrl = 'collectionRecordSubmit'
  78. }
  79. if (_this.form.type === '退款') {
  80. soaUrl = 'refundRecordSubmit'
  81. }
  82. if (_this.form.type === '转换') {
  83. soaUrl = 'convertRecordSubmit'
  84. }
  85. _this.loading = true
  86. const postData = Object.assign({}, _this.form)
  87. this.baseRequest(soaUrl, postData).then(res => {
  88. if (res.data.code === 200) {
  89. _this.$message({
  90. message: '提交成功',
  91. type: 'success'
  92. })
  93. _this.handleClose()
  94. } else {
  95. _this.$message({
  96. message: res.msg,
  97. type: 'warning'
  98. })
  99. }
  100. _this.loading = false
  101. }).catch(err => {
  102. _this.$message({
  103. message: err,
  104. type: 'warning'
  105. })
  106. _this.loading = false
  107. })
  108. },
  109. baseRequest(opUrl, postData) {
  110. return this.$channel.globeRequest('TransactionRecordController', opUrl, postData, 'project')
  111. }
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. </style>