index.vue 7.1 KB

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