index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <template-page
  3. v-if="showTableBool"
  4. ref="pageRef"
  5. :get-list="getList"
  6. :table-attributes="tableAttributes"
  7. :table-events="tableEvents"
  8. :options-evens-group="optionsEvensGroup"
  9. :moreParameters="moreParameters"
  10. :column-parsing="columnParsing"
  11. :exportList="exportList"
  12. >
  13. <div slot="moreSearch">
  14. <div style="margin-bottom: 10px">
  15. <span
  16. style="
  17. font-size: 12px;
  18. font-weight: 400;
  19. text-align: left;
  20. color: #666;
  21. line-height: 28px;
  22. margin-right: 10px;
  23. "
  24. >选择范围</span
  25. >
  26. <el-date-picker
  27. size="mini"
  28. v-model="value1"
  29. value-format="yyyy-MM-dd"
  30. type="daterange"
  31. align="right"
  32. unlink-panels
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. :picker-options="pickerOptions"
  37. >
  38. </el-date-picker>
  39. </div>
  40. </div>
  41. </template-page>
  42. </template>
  43. <script>
  44. import TemplatePage from '@/components/template/template-page-1.vue'
  45. import import_mixin from '@/components/template/import_mixin.js'
  46. import operation_mixin from '@/components/template/operation_mixin.js'
  47. import { settlementOrderNewListPageV3, settlementOrderNewPageV3Export } from '@/api/masterElectronicPaymentQuiry.js'
  48. export default {
  49. components: { TemplatePage },
  50. mixins: [import_mixin, operation_mixin],
  51. data() {
  52. return {
  53. // 表格属性
  54. tableAttributes: {
  55. // 启用勾选列
  56. selectColumn: false
  57. },
  58. // 表格事件
  59. tableEvents: {
  60. 'selection-change': this.selectionChange
  61. },
  62. // 勾选选中行
  63. recordSelected: [],
  64. value1: [],
  65. pickerOptions: {
  66. shortcuts: [
  67. {
  68. text: '最近一周',
  69. onClick(picker) {
  70. const end = new Date()
  71. const start = new Date()
  72. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  73. picker.$emit('pick', [start, end])
  74. }
  75. },
  76. {
  77. text: '最近一个月',
  78. onClick(picker) {
  79. const end = new Date()
  80. const start = new Date()
  81. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  82. picker.$emit('pick', [start, end])
  83. }
  84. }
  85. ],
  86. onPick: obj => {
  87. this.pickerMinDate = new Date(obj.minDate).getTime()
  88. },
  89. disabledDate: time => {
  90. if (this.pickerMinDate) {
  91. const day1 = 31 * 24 * 3600 * 1000
  92. let maxTime = this.pickerMinDate + day1
  93. let minTime = this.pickerMinDate - day1
  94. return time.getTime() > maxTime || time.getTime() < minTime
  95. }
  96. }
  97. },
  98. pickerMinDate: null,
  99. showTableBool: true
  100. }
  101. },
  102. watch: {
  103. value1() {
  104. if (!this.value1) {
  105. this.pickerMinDate = null
  106. }
  107. this.showTableBool = false
  108. this.$nextTick(() => {
  109. this.showTableBool = true
  110. })
  111. }
  112. },
  113. computed: {
  114. // 事件组合
  115. optionsEvensGroup() {
  116. return []
  117. },
  118. // 更多参数
  119. moreParameters() {
  120. return []
  121. }
  122. },
  123. methods: {
  124. // 列表请求函数
  125. getList(p, cb) {
  126. var pam = JSON.parse(JSON.stringify(p))
  127. try {
  128. if (this.value1 && this.value1.length) {
  129. pam.overTime = `${this.value1?.[0]} 00:00:00`
  130. pam.overEndTime = `${this.value1?.[1]} 23:59:59`
  131. pam.params.push({ param: 'a.pay_time', compare: '>=', value: pam.overTime })
  132. pam.params.push({ param: 'a.pay_time', compare: '<=', value: pam.overEndTime })
  133. cb && cb(pam)
  134. return settlementOrderNewListPageV3(pam)
  135. }
  136. } catch (err) {}
  137. },
  138. // 列表导出函数
  139. exportList(...p) {
  140. if (this.value1) {
  141. return settlementOrderNewPageV3Export(...p)
  142. }
  143. },
  144. // 表格列解析渲染数据更改
  145. columnParsing(item, defaultData) {
  146. return defaultData
  147. },
  148. // 监听勾选变化
  149. selectionChange(data) {
  150. this.recordSelected = data
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped></style>