ProfitShareReceiver.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="profit-share-receiver">
  3. <!-- 搜索条件 -->
  4. <el-card class="search-card">
  5. <el-form :model="searchForm" label-width="100px" inline>
  6. <el-form-item label="订单号">
  7. <el-input
  8. v-model="searchForm.order_no"
  9. placeholder="请输入订单号"
  10. clearable
  11. @keyup.enter="handleSearch"
  12. />
  13. </el-form-item>
  14. <el-form-item label="状态">
  15. <el-select v-model="searchForm.status" placeholder="请选择状态" clearable>
  16. <el-option label="全部" value="" />
  17. <el-option label="待处理" value="pending" />
  18. <el-option label="已通过" value="approved" />
  19. <el-option label="已拒绝" value="rejected" />
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" @click="handleSearch">查询</el-button>
  24. <el-button @click="handleReset">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. </el-card>
  28. <!-- 列表数据 -->
  29. <el-card class="table-card">
  30. <template #header>
  31. <div class="table-header">
  32. <div class="header-title">分账接收方列表</div>
  33. </div>
  34. </template>
  35. <el-table
  36. v-loading="loading"
  37. :data="tableData"
  38. border
  39. stripe
  40. >
  41. <el-table-column prop="id" label="ID" width="80" />
  42. <el-table-column prop="order_no" label="订单号" min-width="180" />
  43. <el-table-column prop="receiver_name" label="接收方名称" min-width="150" />
  44. <el-table-column prop="receiver_account" label="接收方账户" min-width="180" />
  45. <el-table-column prop="amount" label="分账金额" width="120">
  46. <template #default="{ row }">
  47. ¥{{ row.amount }}
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="status" label="状态" width="100">
  51. <template #default="{ row }">
  52. <el-tag v-if="row.status === 'pending'" type="warning">待处理</el-tag>
  53. <el-tag v-else-if="row.status === 'approved'" type="success">已通过</el-tag>
  54. <el-tag v-else-if="row.status === 'rejected'" type="danger">已拒绝</el-tag>
  55. <el-tag v-else>{{ row.status }}</el-tag>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="create_time" label="申请时间" width="180" />
  59. <el-table-column label="操作" width="150" fixed="right">
  60. <template #default="{ row }">
  61. <el-button type="primary" size="small" @click="handleView(row)">详情</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <!-- 分页 -->
  66. <el-pagination
  67. v-model:current-page="pagination.page"
  68. v-model:page-size="pagination.limit"
  69. :total="pagination.total"
  70. :page-sizes="[10, 20, 50, 100]"
  71. layout="total, sizes, prev, pager, next, jumper"
  72. @size-change="handleSizeChange"
  73. @current-change="handleCurrentChange"
  74. class="pagination"
  75. />
  76. </el-card>
  77. </div>
  78. </template>
  79. <script>
  80. export default {
  81. name: 'ProfitShareReceiver',
  82. props: {
  83. axiosInstance: {
  84. type: Object,
  85. default: null
  86. }
  87. },
  88. data() {
  89. return {
  90. loading: false,
  91. searchForm: {
  92. order_no: '',
  93. status: ''
  94. },
  95. tableData: [],
  96. pagination: {
  97. page: 1,
  98. limit: 10,
  99. total: 0
  100. }
  101. }
  102. },
  103. async created() {
  104. this.fetchData()
  105. },
  106. methods: {
  107. // 获取列表数据
  108. async fetchData() {
  109. // 优先使用通过props传递的axios实例
  110. if (!this.axiosInstance) {
  111. this.$message.error('无法获取请求实例')
  112. return
  113. }
  114. this.loading = true
  115. try {
  116. const params = {
  117. page: this.pagination.page,
  118. limit: this.pagination.limit,
  119. order_no: this.searchForm.order_no,
  120. status: this.searchForm.status
  121. }
  122. const res = await this.axiosInstance.get('/lakala/profit_share_receiver', { params })
  123. if (res.code === 200) {
  124. this.tableData = res.data.list
  125. this.pagination.total = res.data.total
  126. } else {
  127. this.$message.error(res.message || '获取数据失败')
  128. }
  129. } catch (error) {
  130. console.error('获取分账接收方列表失败:', error)
  131. this.$message.error('获取数据失败: ' + (error.message || '未知错误'))
  132. } finally {
  133. this.loading = false
  134. }
  135. },
  136. // 查询
  137. handleSearch() {
  138. this.pagination.page = 1
  139. this.fetchData()
  140. },
  141. // 重置
  142. handleReset() {
  143. this.searchForm = {
  144. order_no: '',
  145. status: ''
  146. }
  147. this.pagination.page = 1
  148. this.fetchData()
  149. },
  150. // 查看详情
  151. handleView(row) {
  152. this.$message.info('查看详情功能待实现')
  153. },
  154. // 分页相关
  155. handleSizeChange(val) {
  156. this.pagination.limit = val
  157. this.pagination.page = 1
  158. this.fetchData()
  159. },
  160. handleCurrentChange(val) {
  161. this.pagination.page = val
  162. this.fetchData()
  163. }
  164. }
  165. }
  166. </script>
  167. <style scoped>
  168. .profit-share-receiver {
  169. padding: 20px;
  170. }
  171. .search-card {
  172. margin-bottom: 20px;
  173. }
  174. .table-card {
  175. margin-bottom: 20px;
  176. }
  177. .table-header {
  178. display: flex;
  179. justify-content: space-between;
  180. align-items: center;
  181. }
  182. .header-title {
  183. font-size: 16px;
  184. font-weight: bold;
  185. }
  186. .pagination {
  187. margin-top: 20px;
  188. text-align: right;
  189. }
  190. </style>