index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div class="page">
  3. <template-page
  4. v-show="!formDialog"
  5. ref="pageRef"
  6. :get-list="getList"
  7. :table-attributes="tableAttributes"
  8. :table-events="tableEvents"
  9. :options-evens-group="optionsEvensGroup"
  10. :moreParameters="moreParameters"
  11. :column-parsing="columnParsing"
  12. :operation="operation()"
  13. :exportList="exportList"
  14. >
  15. </template-page>
  16. <div class="detail" v-if="formDialog">
  17. <auxiliarySalesOrderDetail
  18. v-if="orderSource == 'M_SALES'"
  19. :id="id"
  20. @back="backList"
  21. :formType="2"
  22. title="辅材销售订单详情"
  23. >
  24. </auxiliarySalesOrderDetail>
  25. <attachmentSalesOrderDetail
  26. v-if="orderSource == 'P_SALES'"
  27. :id="id"
  28. @back="backList"
  29. :formType="2"
  30. title="配件销售订单详情"
  31. ></attachmentSalesOrderDetail>
  32. <auxiliarySalesReturnOrderDetail
  33. v-if="orderSource == 'SALES_RET'"
  34. :id="id"
  35. @back="backList"
  36. :formType="2"
  37. title="辅材销售退货单详情"
  38. ></auxiliarySalesReturnOrderDetail>
  39. <attachmentNewReturnDetail
  40. v-if="orderSource == 'NEW_PARTS_RET'"
  41. :id="id"
  42. @back="backList"
  43. :formType="2"
  44. title="配件新件返还详情"
  45. ></attachmentNewReturnDetail>
  46. <attachmentOldReturnDetail
  47. v-if="orderSource == 'OLD_PARTS_RET'"
  48. :id="id"
  49. @back="backList"
  50. :formType="2"
  51. title="配件旧件返还详情"
  52. ></attachmentOldReturnDetail>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import TemplatePage from '@/components/template/template-page-1.vue'
  58. import import_mixin from '@/components/template/import_mixin.js'
  59. import auxiliarySalesOrderDetail from '../components/auxiliarySalesOrderDetail.vue'
  60. import attachmentSalesOrderDetail from '../components/attachmentSalesOrderDetail.vue'
  61. import auxiliarySalesReturnOrderDetail from '../components/auxiliarySalesReturnOrderDetail.vue'
  62. import attachmentNewReturnDetail from '../components/attachmentNewReturnDetail.vue'
  63. import attachmentOldReturnDetail from '../components/attachmentOldReturnDetail.vue'
  64. import { downloadFiles } from '@/utils/util'
  65. import { listPageV2, pageExport, websitTradeTradeRefund } from '@/api/auxiliaryFittings/transaction'
  66. import operation_mixin from '@/components/template/operation_mixin.js'
  67. export default {
  68. components: {
  69. TemplatePage,
  70. auxiliarySalesOrderDetail,
  71. attachmentSalesOrderDetail,
  72. auxiliarySalesReturnOrderDetail,
  73. attachmentNewReturnDetail,
  74. attachmentOldReturnDetail
  75. },
  76. mixins: [import_mixin, operation_mixin],
  77. data() {
  78. return {
  79. // 事件组合
  80. optionsEvensGroup: [],
  81. // 表格属性
  82. tableAttributes: {
  83. // 启用勾选列
  84. selectColumn: true
  85. },
  86. // 表格事件
  87. tableEvents: {
  88. 'selection-change': this.selectionChange
  89. },
  90. // 勾选选中行
  91. recordSelected: [],
  92. /** 表单变量 */
  93. id: '',
  94. orderSource: '',
  95. formDialog: false
  96. }
  97. },
  98. computed: {
  99. // 更多参数
  100. moreParameters() {
  101. return []
  102. }
  103. },
  104. methods: {
  105. // 列表请求函数
  106. getList: listPageV2,
  107. // 列表导出函数
  108. exportList: pageExport,
  109. // 表格列解析渲染数据更改
  110. columnParsing(item, defaultData) {
  111. return defaultData
  112. },
  113. // 监听勾选变化
  114. selectionChange(data) {
  115. this.recordSelected = data
  116. },
  117. operation() {
  118. return this.operationBtn({
  119. detail: {
  120. click: ({ row, index, column }) => {
  121. this.id = row.orderId
  122. this.orderSource = row.orderSource
  123. if (row.orderSource) {
  124. this.formDialog = true
  125. } else {
  126. this.$message.warning('订单来源为空!')
  127. }
  128. }
  129. },
  130. refund: {
  131. conditions: ({ row, index, column }) => {
  132. return row.payValue > row.retValue
  133. },
  134. click: ({ row, index, column }) => {
  135. this.$prompt('退款金额', '退款', {
  136. confirmButtonText: '确定',
  137. cancelButtonText: '取消',
  138. inputPattern: /^\d+(\.\d+)?$/,
  139. inputErrorMessage: '请输入正确的金额'
  140. })
  141. .then(({ value }) => {
  142. websitTradeTradeRefund({
  143. id: row.id,
  144. retAmount: value
  145. }).then(res => {
  146. this.$message({
  147. message: '退款成功',
  148. type: 'success'
  149. })
  150. this.$refs.pageRef.refreshList()
  151. })
  152. })
  153. .catch(() => {})
  154. }
  155. }
  156. })
  157. },
  158. backList() {
  159. this.id = ''
  160. this.formDialog = false
  161. this.$refs.pageRef.refreshList()
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .page {
  168. height: 100%;
  169. }
  170. .tab {
  171. padding: 20px 20px 0 20px;
  172. }
  173. </style>