service.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import request from '../../service/request'; // 查询订单状态
  2. function payDetail(data) {
  3. return request.post('/miniProRequest.pay.payDetail', data);
  4. }
  5. /**
  6. * 获取医保缴费字段
  7. * @param {object} obj
  8. */
  9. function getYbParams(obj) {
  10. if (!obj || !obj.insUploadFeeResp) return {};
  11. const list = obj.insUploadFeeResp.split(":");
  12. const params = {};
  13. // 总额:feeSumamt
  14. // 医保支付:fundPay
  15. // 个人支付:psnAcctPay
  16. // 现金支付:ownPayAmt
  17. list.map((i, index) => {
  18. if (i.includes("feeSumamt")) {
  19. let innerList = i.split(",");
  20. let value = "";
  21. if (innerList[0].includes("feeSumamt")) {
  22. value = innerList[1];
  23. } else {
  24. value = list[index + 1].split(",")[0];
  25. }
  26. params.feeSumamt = value
  27. .replaceAll('"', "")
  28. .replaceAll("}", "")
  29. .replaceAll("{", "")
  30. .replaceAll("\\", "");
  31. }
  32. if (i.includes("fundPay")) {
  33. let innerList = i.split(",");
  34. let value = "";
  35. if (innerList[0].includes("fundPay")) {
  36. value = innerList[1];
  37. } else {
  38. value = list[index + 1].split(",")[0];
  39. }
  40. params.fundPay = value
  41. .replaceAll('"', "")
  42. .replaceAll("}", "")
  43. .replaceAll("{", "")
  44. .replaceAll("\\", "");
  45. }
  46. if (i.includes("ownPayAmt")) {
  47. let innerList = i.split(",");
  48. let value = "";
  49. if (innerList[0].includes("ownPayAmt")) {
  50. value = innerList[1];
  51. } else {
  52. value = list[index + 1].split(",")[0];
  53. }
  54. params.ownPayAmt = value
  55. .replaceAll('"', "")
  56. .replaceAll("}", "")
  57. .replaceAll("{", "")
  58. .replaceAll("\\", "");
  59. }
  60. if (i.includes("psnAcctPay")) {
  61. let innerList = i.split(",");
  62. let value = "";
  63. if (innerList[0].includes("psnAcctPay")) {
  64. value = innerList[1];
  65. } else {
  66. value = list[index + 1].split(",")[0];
  67. }
  68. params.psnAcctPay = value
  69. .replaceAll('"', "")
  70. .replaceAll("}", "")
  71. .replaceAll("{", "")
  72. .replaceAll("\\", "");
  73. }
  74. });
  75. return params;
  76. }
  77. function generateRandomFourDigitNumber() {
  78. return Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
  79. }
  80. export default {
  81. payDetail,
  82. getYbParams,
  83. generateRandomFourDigitNumber
  84. };