ProfitShareReceiver.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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="1" />
  18. <el-option label="已通过" value="2" />
  19. <el-option label="已拒绝" value="3" />
  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="120" />
  44. <el-table-column prop="acct_name" label="账户名称" min-width="120" />
  45. <el-table-column prop="acct_no" label="账户号码" min-width="180" />
  46. <el-table-column prop="acct_type_code" label="账户类型" width="100">
  47. <template #default="{ row }">
  48. {{ getAccountTypeText(row.acct_type_code) }}
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="contact_mobile" label="联系电话" width="120" />
  52. <el-table-column prop="status_text" label="状态" width="100" />
  53. <el-table-column prop="create_time" label="申请时间" width="180" />
  54. <el-table-column label="操作" width="150" fixed="right">
  55. <template #default="{ row }">
  56. <el-button type="primary" size="small" @click="handleView(row)">详情</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <!-- 分页 -->
  61. <el-pagination
  62. v-model:current-page="pagination.page"
  63. v-model:page-size="pagination.limit"
  64. :total="pagination.total"
  65. :page-sizes="[10, 20, 50, 100]"
  66. layout="total, sizes, prev, pager, next, jumper"
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentChange"
  69. class="pagination"
  70. />
  71. </el-card>
  72. </div>
  73. </template>
  74. <script>
  75. export default {
  76. name: 'ProfitShareReceiver',
  77. props: {
  78. axiosInstance: {
  79. type: Object,
  80. default: null
  81. }
  82. },
  83. data() {
  84. return {
  85. loading: false,
  86. searchForm: {
  87. order_no: '',
  88. status: ''
  89. },
  90. tableData: [],
  91. pagination: {
  92. page: 1,
  93. limit: 10,
  94. total: 0
  95. }
  96. }
  97. },
  98. async created() {
  99. this.fetchData()
  100. },
  101. methods: {
  102. // 获取账户类型文本
  103. getAccountTypeText(code) {
  104. const accountTypes = {
  105. '58': '对私',
  106. '59': '对公'
  107. }
  108. return accountTypes[code] || code
  109. },
  110. // 获取列表数据
  111. async fetchData() {
  112. // 优先使用通过props传递的axios实例
  113. if (!this.axiosInstance) {
  114. this.$message.error('无法获取请求实例')
  115. return
  116. }
  117. this.loading = true
  118. try {
  119. const params = {
  120. page: this.pagination.page,
  121. limit: this.pagination.limit,
  122. order_no: this.searchForm.order_no,
  123. status: this.searchForm.status
  124. }
  125. const res = await this.axiosInstance.get('/lakala/profit_share_receiver', { params })
  126. if (res.code === 200) {
  127. // 根据接口返回结构调整数据处理
  128. this.tableData = res.page.data
  129. this.pagination.total = res.page.total
  130. this.pagination.limit = res.page.per_page
  131. } else {
  132. this.$message.error(res.msg || res.message || '获取数据失败')
  133. }
  134. } catch (error) {
  135. console.error('获取分账接收方列表失败:', error)
  136. this.$message.error('获取数据失败: ' + (error.message || '未知错误'))
  137. } finally {
  138. this.loading = false
  139. }
  140. },
  141. // 查询
  142. handleSearch() {
  143. this.pagination.page = 1
  144. this.fetchData()
  145. },
  146. // 重置
  147. handleReset() {
  148. this.searchForm = {
  149. order_no: '',
  150. status: ''
  151. }
  152. this.pagination.page = 1
  153. this.fetchData()
  154. },
  155. // 查看详情
  156. handleView(row) {
  157. this.$message.info('查看详情功能待实现')
  158. },
  159. // 分页相关
  160. handleSizeChange(val) {
  161. this.pagination.limit = val
  162. this.pagination.page = 1
  163. this.fetchData()
  164. },
  165. handleCurrentChange(val) {
  166. this.pagination.page = val
  167. this.fetchData()
  168. }
  169. }
  170. }
  171. </script>
  172. <style scoped>
  173. .profit-share-receiver {
  174. padding: 20px;
  175. }
  176. .search-card {
  177. margin-bottom: 20px;
  178. }
  179. .table-card {
  180. margin-bottom: 20px;
  181. }
  182. .table-header {
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. }
  187. .header-title {
  188. font-size: 16px;
  189. font-weight: bold;
  190. }
  191. .pagination {
  192. margin-top: 20px;
  193. text-align: right;
  194. }
  195. </style>