PaymentInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="payment-info">
  3. <InfoCard title="回款概览">
  4. <div class="payment-info-content">
  5. <div class="payment-info-item">
  6. 回款状态:{{ returnStatus || '-' }}
  7. </div>
  8. <div class="payment-info-item">
  9. 已回款金额:{{'¥' + returnAmount(returnRes?.returnMoney) || '-'}}
  10. </div>
  11. <div class="payment-info-item">
  12. 未回款金额:{{ '¥' + returnAmount(returnRes?.remainingMoney) || '-' }}
  13. </div>
  14. </div>
  15. </InfoCard>
  16. <InfoCard title="回款交易详情" :length="paymentDetailList.length || 0" :is-show-length="true">
  17. <div class="payment-info-content">
  18. <TableCard
  19. class="payment-info-content-table"
  20. :table-data="paymentDetailList"
  21. :columns="paymentDetailColumns"
  22. width="1108px"
  23. >
  24. <template v-slot:return_voucher_url="{ row }">
  25. <span v-if="row.row.return_voucher_url" @click="vouched(row.row.return_voucher_url)" class="column-cell">点击查看</span>
  26. <span v-else>-</span>
  27. </template>
  28. </TableCard>
  29. </div>
  30. </InfoCard>
  31. <InfoCard v-if="orderTransfer.length" title="用户自助下单对公转账">
  32. <div class="payment-info-content">
  33. <TableCard
  34. class="payment-info-content-table"
  35. :table-data="orderTransfer"
  36. :columns="transerColumns"
  37. width="1108px"
  38. >
  39. <template v-slot:voucher="{ row }">
  40. <span @click="vouched(row.row.voucher)" class="column-cell">点击查看</span>
  41. </template>
  42. <template v-slot:action="{ row }">
  43. <span v-if="row.row.state !== 1 && row.row.state !== 2" @click="payShenHe" class="column-cell">审核</span>
  44. <span v-else>-</span>
  45. </template>
  46. </TableCard>
  47. </div>
  48. </InfoCard>
  49. <newDetailModel
  50. ref="paymentDetailModel"
  51. :order-detail="orderData"
  52. @refresh="doRefresh"
  53. ></newDetailModel>
  54. </div>
  55. </template>
  56. <script>
  57. import InfoCard from '../../ui/InfoCard.vue';
  58. import TableCard from '../../ui/TableCard.vue';
  59. import newDetailModel from '../newDetailModel.vue';
  60. import { mapState } from 'vuex';
  61. export default {
  62. name: 'PaymentInfo',
  63. components: {
  64. InfoCard,
  65. TableCard,
  66. newDetailModel
  67. },
  68. data() {
  69. const defaultRender = (val) => val || '-';
  70. return {
  71. paymentDetailColumns: [
  72. {
  73. label: '回款时间',
  74. prop: 'return_time',
  75. width: '112',
  76. render: (row) => {
  77. return this.isBackstageOrder === 1 ? this.formatDate(row.return_time) : defaultRender(row.pay_time)
  78. }
  79. },
  80. {
  81. label: '回款金额',
  82. prop: 'return_money',
  83. width: '90',
  84. render: (row) => {
  85. if(this.isBackstageOrder === 1) {
  86. return row.return_money ? '¥' + this.returnAmount(row.return_money) : this.returnAmount(0)
  87. } else {
  88. return row.pay_money ? '¥' + this.returnAmount(row.pay_money) : this.returnAmount(0)
  89. }
  90. }
  91. },
  92. {
  93. label: '支付方式',
  94. prop: 'return_type',
  95. width: '90',
  96. render (row) {
  97. const payCashStatus = [
  98. { v: '1', n: '微信支付' },
  99. { v: '2', n: '支付宝支付' },
  100. { v: '3', n: '对公转账' },
  101. { v: '4', n: '第三方平台' }
  102. ]
  103. if(row?.return_type) {
  104. return payCashStatus.find(item => item.v === String(row.return_type))?.n || '-'
  105. } else {
  106. return row.pay_way || '-'
  107. }
  108. }
  109. },
  110. {
  111. label: '手续费',
  112. prop: 'procedures_money',
  113. width: '90',
  114. render: (row) => {
  115. return row.procedures_money ? '¥' + this.returnAmount(row.procedures_money) : this.returnAmount(0)
  116. }
  117. },
  118. {
  119. label: '回款银行',
  120. prop: 'bank_name',
  121. width: '120',
  122. render (row) {
  123. return defaultRender(row.bank_name)
  124. }
  125. },
  126. {
  127. label: '支付单号/银行流水号',
  128. prop: 'return_code',
  129. width: '112',
  130. render (row) {
  131. return row.bank_flow || row.return_code
  132. }
  133. },
  134. {
  135. label: '支付户名',
  136. prop: 'pay_account_name',
  137. width: '90',
  138. render (row) {
  139. return defaultRender(row.pay_account_name)
  140. }
  141. },
  142. {
  143. label: '流水金额',
  144. prop: 'flow_money',
  145. width: '90',
  146. render: (row) => {
  147. return row.flow_money ? '¥' + this.returnAmount(row.flow_money) : this.returnAmount(0)
  148. }
  149. },
  150. {
  151. label: '支付凭证',
  152. prop: 'return_voucher_url',
  153. width: '90'
  154. },
  155. {
  156. label: '操作时间',
  157. prop: 'operate_time',
  158. width: '112',
  159. render: (row) => {
  160. return defaultRender(row.operate_time)
  161. }
  162. },
  163. {
  164. label: '操作人',
  165. prop: 'operate_person',
  166. width: '90',
  167. render: (row) => {
  168. return defaultRender(row.operate_person)
  169. }
  170. },
  171. {
  172. label: '回款说明',
  173. prop: 'return_remark',
  174. width: '202',
  175. render (row) {
  176. return defaultRender(row.return_remark)
  177. }
  178. }
  179. ],
  180. paymentDetailList_: [
  181. {
  182. return_time: '2023-12-31 13:21:32',
  183. paymoney: '点击查看',
  184. return_type: '微信支付',
  185. // commission: '¥100.00',
  186. bank_name: '广发银行北京顺义支行',
  187. bank_flow: '094640260820',
  188. pay_account_name: '张三',
  189. flow_money: '¥2,000.00',
  190. operate_time: '2023-12-31 13:21:32',
  191. operate_person: '张三',
  192. return_remark: '备注'
  193. }
  194. ],
  195. transerColumns: [
  196. {
  197. label: '提交时间',
  198. prop: 'create_time',
  199. render (row) {
  200. return defaultRender(row.create_time)
  201. }
  202. },
  203. {
  204. label: '支付凭证',
  205. prop: 'voucher',
  206. },
  207. {
  208. label: '审核状态',
  209. prop: 'state',
  210. render (row) {
  211. if(row.state == 1) {
  212. return '审核通过'
  213. } else if(row.state == 2) {
  214. return '审核失败'
  215. } else {
  216. return '待审核'
  217. }
  218. }
  219. },
  220. {
  221. label: '审核时间',
  222. prop: 'update_time',
  223. render (row) {
  224. return defaultRender(row.update_time)
  225. }
  226. },
  227. {
  228. label: '操作人',
  229. prop: 'audit_person',
  230. render (row) {
  231. return defaultRender(row.audit_person)
  232. }
  233. },
  234. {
  235. label: '操作',
  236. prop: 'action'
  237. }
  238. ],
  239. orderTransfer_: [
  240. {
  241. create_time: '2023-12-31 13:21:32',
  242. voucher: '点击查看',
  243. state: '审核通过',
  244. update_time: '2023-12-31 13:21:32',
  245. audit_person: '张三',
  246. action: '审核',
  247. }
  248. ],
  249. }
  250. },
  251. computed: {
  252. ...mapState({
  253. orderDetail: state => state.order.orderDetail
  254. }),
  255. // 是否是管理后台创建的订单 1为是 0不是
  256. isBackstageOrder () {
  257. return this.orderData?.is_backstage_order || 0;
  258. },
  259. returnStatus() {
  260. const val = this.orderData?.return_status || 0;
  261. if (val == 0) {
  262. return '未回款'
  263. } else if (val == 1) {
  264. return '全额回款'
  265. } else if (val == 2) {
  266. return '部分回款'
  267. } else {
  268. return '未回款'
  269. }
  270. },
  271. returnRes () {
  272. return this.orderDetail?.returnRes || {};
  273. },
  274. orderData() {
  275. return this.orderDetail?.orderData || {};
  276. },
  277. paymentDetailList() {
  278. const list = this.returnRes?.returnInfo || [];
  279. const orderData = this.orderData || {};
  280. const { pay_time, pay_money, order_status, pay_way, procedures_money } = orderData;
  281. if (!this.isBackstageOrder) {
  282. // 构建基础支付信息对象
  283. const baseInfo = {
  284. pay_time: pay_time ?? '-',
  285. pay_money: pay_money ?? '-',
  286. order_status: order_status ?? '-',
  287. pay_way: pay_way ?? '-',
  288. procedures_money
  289. };
  290. if (list.length) {
  291. // 返回新对象,避免修改原始 list 中的对象
  292. return [{
  293. ...list[0],
  294. ...baseInfo
  295. }];
  296. }
  297. return [baseInfo];
  298. }
  299. return list;
  300. },
  301. orderTransfer () {
  302. return this.orderDetail?.orderTransfer || [];
  303. }
  304. },
  305. methods: {
  306. returnAmount(val) {
  307. if (!val) return 0;
  308. val = Number(val)
  309. const amount = (val / 100).toFixed(2) || 0;
  310. return amount;
  311. },
  312. formatDate(timeString) {
  313. if (!timeString) return '-';
  314. // 只取空格前的日期部分
  315. return timeString.split(' ')[0];
  316. },
  317. setReturnType(val) {
  318. if (val === 1) {
  319. return '微信支付'
  320. } else if(val === 2) {
  321. return '支付宝支付'
  322. } else if(val === 3) {
  323. return '对公转账'
  324. } else {
  325. return '未回款'
  326. }
  327. },
  328. payShenHe() {
  329. this.$refs.paymentDetailModel.sShow = true;
  330. },
  331. vouched(val) {
  332. if (val) {
  333. const urls = location.origin + val;
  334. window.open(urls, '_blank')
  335. }
  336. },
  337. doRefresh(type) {
  338. this.$emit('refresh', type)
  339. }
  340. }
  341. }
  342. </script>
  343. <style lang="scss" scoped>
  344. .payment-info {
  345. background: #F2F2F4;
  346. ::v-deep {
  347. .info-card {
  348. margin-bottom: 16px;
  349. }
  350. }
  351. .payment-info-content {
  352. width: 1108px;
  353. display: flex;
  354. align-items: center;
  355. flex-wrap: wrap;
  356. }
  357. .payment-info-item{
  358. margin-right: 32px;
  359. min-width: 255px;
  360. font-size: 14px;
  361. line-height: 22px;
  362. color: $gray_10;
  363. }
  364. .payment-info-content-table {
  365. border-radius: 4px;
  366. ::v-deep {
  367. .el-table__body-wrapper {
  368. &::-webkit-scrollbar {
  369. display: block; /* 强制显示滚动条 */
  370. height: 8px;
  371. }
  372. &::-webkit-scrollbar-thumb {
  373. background-color: rgba(0, 0, 0, 0.2);
  374. border-radius: 4px;
  375. }
  376. }
  377. .cell {
  378. text-align: center;
  379. font-size: 14px;
  380. color: $gray_10;
  381. font-weight: 400;
  382. }
  383. .has-gutter {
  384. th {
  385. background: #F9FAFB;
  386. .cell {
  387. padding: 0;
  388. color: #686868;
  389. }
  390. }
  391. }
  392. .column-cell {
  393. color: $color_main;
  394. cursor: pointer;
  395. }
  396. }
  397. }
  398. .num-active {
  399. color: $color_main;
  400. }
  401. }
  402. </style>