index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
  4. <!-- 搜索区 tableSearch -->
  5. <template #tableSearch>
  6. <a-col :sm="6" :xs="24">
  7. <a-form-item label="游戏" field="game_id">
  8. <game-select v-model="searchForm.game_id" multiple />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :sm="6" :xs="24">
  12. <a-form-item label="日期" field="pay_time">
  13. <a-range-picker v-model="searchForm.pay_time" :show-time="false" mode="date" style="width: 100%" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="6" :xs="24">
  17. <a-form-item label="账号" field="user_name">
  18. <a-input v-model="searchForm.user_name" placeholder="请输入账号" allow-clear />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="6" :xs="24">
  22. <a-form-item label="角色ID" field="role_id">
  23. <a-input v-model="searchForm.role_id" placeholder="请输入角色ID" allow-clear />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :sm="6" :xs="24">
  27. <a-form-item label="订单号" field="order_id">
  28. <a-input v-model="searchForm.order_id" placeholder="请输入订单号" allow-clear />
  29. </a-form-item>
  30. </a-col>
  31. <a-col :sm="6" :xs="24">
  32. <a-form-item label="交易订单号" field="trade_id">
  33. <a-input v-model="searchForm.trade_id" placeholder="请输入交易订单号" allow-clear />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :sm="6" :xs="24">
  37. <a-form-item label="支付状态" field="sync_status">
  38. <a-select v-model="searchForm.sync_status" placeholder="请选择支付状态">
  39. <a-option value="1">已支付</a-option>
  40. <a-option value="2">异常回调</a-option>
  41. <a-option value="0">未支付</a-option>
  42. </a-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :sm="6" :xs="24">
  46. <a-form-item label="发货状态" field="send_status">
  47. <a-select v-model="searchForm.send_status" placeholder="请选择发货状态">
  48. <a-option value="1">已发货</a-option>
  49. <a-option value="0">未发货</a-option>
  50. </a-select>
  51. </a-form-item>
  52. </a-col>
  53. </template>
  54. <!-- Table 自定义渲染 -->
  55. <template #game_id="{ record }"> [{{ record.game_id }}] {{ record.game_name }} </template>
  56. <template #sync_status="{ record }">
  57. <!-- 支付回调状态 0未支付, 1已支付, 2异常回调 -->
  58. <a-tag :color="record.sync_status === 1 ? 'green' : record.sync_status === 2 ? 'red' : 'blue'">
  59. {{ record.sync_status === 1 ? '已支付' : record.sync_status === 2 ? '异常回调' : '未支付' }}
  60. </a-tag>
  61. </template>
  62. <template #send_status="{ record }">
  63. <!-- 发货状态 0未发货, 1已发货 -->
  64. <a-tag :color="record.send_status === 1 ? 'green' : 'red'">
  65. {{ record.send_status === 1 ? '已发货' : '未发货' }}
  66. </a-tag>
  67. </template>
  68. <template #operationCell="{ record }">
  69. <a-button
  70. type="primary"
  71. v-if="record?.send_status === 0 && record?.sync_status === 1"
  72. @click="handleSend(record)"
  73. >补发</a-button
  74. >
  75. </template>
  76. </sa-table>
  77. <!-- 编辑表单 -->
  78. <edit-form ref="editRef" @success="refresh" />
  79. </div>
  80. </template>
  81. <script setup>
  82. import { onMounted, ref, reactive } from 'vue'
  83. import { Message, Modal } from '@arco-design/web-vue'
  84. import EditForm from './edit.vue'
  85. import api from '../../api/customer/sdkOrder'
  86. import GameSelect from '@/components/game-select/index.vue'
  87. // 引用定义
  88. const crudRef = ref()
  89. const editRef = ref()
  90. // 搜索表单
  91. const searchForm = ref({
  92. order_id: '',
  93. trade_id: '',
  94. game_id: '',
  95. user_name: '',
  96. role_id: '',
  97. pay_time: [],
  98. })
  99. // SaTable 基础配置
  100. const options = reactive({
  101. api: api.getPageList,
  102. showSummary: true,
  103. summary: [
  104. {
  105. action: 'totalRow',
  106. dataIndex: 'money',
  107. },
  108. ],
  109. add: {
  110. show: false,
  111. auth: ['/v1/customer/SdkOrder/save'],
  112. func: async () => {
  113. editRef.value?.open()
  114. },
  115. },
  116. edit: {
  117. show: false,
  118. auth: ['/v1/customer/SdkOrder/update'],
  119. func: async (record) => {
  120. editRef.value?.open('edit')
  121. editRef.value?.setFormData(record)
  122. },
  123. },
  124. delete: {
  125. show: false,
  126. auth: ['/v1/customer/SdkOrder/destroy'],
  127. func: async (params) => {
  128. const resp = await api.destroy(params)
  129. if (resp.code === 200) {
  130. Message.success(`删除成功!`)
  131. crudRef.value?.refresh()
  132. }
  133. },
  134. },
  135. })
  136. // SaTable 列配置
  137. const columns = reactive([
  138. { title: '充值账号', dataIndex: 'user_name', width: 180 },
  139. { title: '充值IP', dataIndex: 'user_ip', width: 180 },
  140. { title: '订单号', dataIndex: 'order_id', width: 180 },
  141. { title: '交易订单号', dataIndex: 'trade_id', width: 180 },
  142. { title: '研发订单号', dataIndex: 'cp_order_id', width: 180 },
  143. { title: '支付时间', dataIndex: 'pay_date', width: 180 },
  144. {
  145. title: '金额',
  146. dataIndex: 'money',
  147. width: 180,
  148. },
  149. { title: '充值游戏', dataIndex: 'game_id', width: 180 },
  150. { title: '充值区服', dataIndex: 'server_name', width: 180 },
  151. { title: '角色ID', dataIndex: 'role_id', width: 180 },
  152. { title: '角色名', dataIndex: 'role_name', width: 180 },
  153. { title: '支付状态', dataIndex: 'sync_status', width: 180 },
  154. { title: '发货状态', dataIndex: 'send_status', width: 180 },
  155. { title: '充值方式', dataIndex: 'pay_channel_name', width: 180 },
  156. { title: '支付返回值', dataIndex: 'sync_result', width: 180 },
  157. { title: '回调信息', dataIndex: 'sync_data', width: 180 },
  158. { title: 'SDK版本', dataIndex: 'sdk_version', width: 180 },
  159. ])
  160. // 页面数据初始化
  161. const initPage = async () => {}
  162. // 补发
  163. const handleSend = async (record) => {
  164. console.log(record)
  165. Modal.info({
  166. title: '补发',
  167. content: '确定要补发吗?',
  168. okText: '确定',
  169. cancelText: '取消',
  170. onOk: async () => {
  171. const resp = await api.send(record.order_id)
  172. if (resp.code === 200) {
  173. Message.success(`操作成功,请稍后刷新`)
  174. crudRef.value?.refresh()
  175. }
  176. },
  177. })
  178. }
  179. // SaTable 数据请求
  180. const refresh = async () => {
  181. crudRef.value?.refresh()
  182. }
  183. // 页面加载完成执行
  184. onMounted(async () => {
  185. initPage()
  186. refresh()
  187. })
  188. </script>
  189. <script>
  190. export default { name: 'v1/customer/sdkOrder' }
  191. </script>