payment-history.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <view class="info-card">
  4. <view class="content-title">
  5. <view v-t="'Home.page_customer.item4'"></view>
  6. </view>
  7. <view class="search-bar">
  8. <cwg-combox v-model:value="search.type" :options="typeMap" :placeholder="t('placeholder.choose')" />
  9. <cwg-combox v-model:value="search.orderStatus" :options="orderStatusMap"
  10. :placeholder="t('Custom.PaymentHistory.StatusPlaceholder')" />
  11. <uni-easyinput v-model="search.login" :placeholder="t('placeholder.login')" />
  12. <uni-datetime-picker type="daterange" v-model="search.date"
  13. :placeholder="t('placeholder.Start') + ' - ' + t('placeholder.End')" />
  14. </view>
  15. <cwg-tabel ref="tableRef" :columns="columns" :queryParams="search" :api="listApi" :show-operation="false"
  16. :showPagination="false">
  17. <template #avatar="{ row }">
  18. <image :src="row.avatar" class="avatar" mode="widthFix" />
  19. <cwg-file :path="row.path" />
  20. </template>
  21. <template #type="{ row }">
  22. <view class="status-badge">{{typeMap.find(item => item.value === row.type)?.text}}
  23. </view>
  24. </template>
  25. <template #status="{ row }">
  26. <OrderStatusMachineCell :row="row" @cancel="handleOrderCancel" @action="handleOrderAction" />
  27. </template>
  28. <template #btn="{ row }">
  29. <text :class="['operation-btn', row.status !== 4 ? 'disabled' : '']" @click="openAddFile(row)">
  30. <cwg-icon name="crm-image" :size="16" color="#1d293d" />
  31. <text v-t="'State.Again'" />
  32. </text>
  33. </template>
  34. </cwg-tabel>
  35. </view>
  36. </cwg-page-wrapper>
  37. </template>
  38. <script setup lang="ts">
  39. import { computed, ref, onMounted } from 'vue';
  40. import { useI18n } from 'vue-i18n';
  41. const { t, locale } = useI18n();
  42. import { financialApi } from '@/service/financial';
  43. import OrderStatusMachineCell from './components/OrderStatusMachineCell.vue'
  44. const search = ref({})
  45. const typeMap = computed(() => ([
  46. { value: null, text: t('Custom.PaymentHistory.All') },
  47. { value: 1, text: t('Custom.PaymentHistory.Deposit') },
  48. { value: 2, text: t('Custom.PaymentHistory.Withdrawals') }
  49. ]));
  50. const orderStatusMap = computed(() => ([
  51. { value: null, text: t('Custom.PaymentHistory.All') },
  52. { value: 1, text: t('State.ToBeProcessed') },
  53. { value: 2, text: t('State.Completed') },
  54. { value: 3, text: t('State.InTheProcessing') },
  55. { value: 4, text: t('State.Refused') },
  56. { value: 5, text: t('State.expireTime') },
  57. { value: 6, text: t('State.Cancelled') },
  58. ]));
  59. const handleOrderCancel = (row) => {
  60. console.log('取消订单:', row)
  61. // 处理取消逻辑
  62. }
  63. const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value));
  64. // 表格列配置
  65. const columns = ref([
  66. {
  67. prop: 'serial',
  68. label: t('Custom.PaymentHistory.Serial'),
  69. align: 'left'
  70. },
  71. {
  72. prop: 'login',
  73. label: t('Custom.PaymentHistory.TradingAccount'),
  74. align: 'left'
  75. },
  76. {
  77. prop: 'type',
  78. label: t('Custom.PaymentHistory.payType'),
  79. align: 'left',
  80. slot: 'type'
  81. },
  82. {
  83. prop: 'channelName',
  84. label: t('Custom.PaymentHistory.PaymentMethod'),
  85. formatter: ({ row }) => isZh.value ? row.channelName : row.channelEnName,
  86. align: 'left'
  87. },
  88. {
  89. prop: 'amount',
  90. label: t('Custom.PaymentHistory.Amount'),
  91. formatter: ({ row }) => row.amount + ' ' + row.currency,
  92. align: 'left'
  93. },
  94. {
  95. prop: 'addTime',
  96. label: t('Custom.PaymentHistory.ApplicationDate'),
  97. type: 'date',
  98. dateFormat: 'YYYY-MM-DD HH:mm',
  99. align: 'left'
  100. },
  101. {
  102. prop: 'status',
  103. label: t('Custom.PaymentHistory.Status'),
  104. slot: 'status',
  105. align: 'left'
  106. },
  107. {
  108. prop: 'note',
  109. label: t('Custom.Recording.Note'),
  110. formatter: ({ row }) => row.note || '--',
  111. align: 'left'
  112. }
  113. ])
  114. const addFileDialog = ref(null);
  115. const listApi = ref(null)
  116. listApi.value = financialApi.BalanceList
  117. </script>
  118. <style scoped lang="scss">
  119. @import "@/uni.scss";
  120. .avatar {
  121. width: px2rpx(60);
  122. height: px2rpx(60);
  123. border-radius: 4px;
  124. }
  125. .content-title {
  126. display: flex;
  127. justify-content: space-between;
  128. align-items: center;
  129. font-size: px2rpx(20);
  130. font-weight: 500;
  131. .content-title-btns {
  132. margin: px2rpx(8) 0;
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. gap: px2rpx(12);
  137. .btn-primary {
  138. min-width: px2rpx(120);
  139. background-color: var(--color-error);
  140. color: white;
  141. padding: 0 px2rpx(12);
  142. border: none;
  143. font-size: px2rpx(14);
  144. text-align: center;
  145. cursor: pointer;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. gap: px2rpx(8);
  150. }
  151. .btn-primary:active {
  152. background-color: var(--color-navy-700);
  153. }
  154. }
  155. }
  156. .operation-btn {
  157. :deep(span) {
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. gap: px2rpx(4);
  162. cursor: pointer;
  163. background-color: var(--color-slate-150);
  164. padding: px2rpx(8) 0;
  165. }
  166. }
  167. .operation-btn.disabled {
  168. cursor: not-allowed;
  169. opacity: 0.5;
  170. }
  171. .search-bar {
  172. display: flex;
  173. align-items: center;
  174. justify-content: flex-start;
  175. flex-wrap: wrap;
  176. gap: px2rpx(16);
  177. margin: px2rpx(16) 0;
  178. .cwg-combox,
  179. .uni-easyinput,
  180. .uni-date {
  181. width: px2rpx(240) !important;
  182. flex: none;
  183. }
  184. }
  185. </style>