您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import {
  2. getStore,
  3. setStore
  4. } from "./index.js"
  5. import {
  6. requestEtcFnc,
  7. } from './requestEtc'
  8. import Api from '../api/etc-api'
  9. export async function etcWxSign() {
  10. const {
  11. orderId = '',
  12. openId = '',
  13. } = arguments[0] || {}
  14. const accessToken = getStore("etc-accessToken") || "token"
  15. let myWxOpenId = getStore("myWxOpenId")
  16. const params = {
  17. subOpenId: myWxOpenId,
  18. orderId,
  19. openId,
  20. accessToken: accessToken,
  21. loginSource: "69af303ba2eb4608a099163f0d2a5dbd"
  22. }
  23. const res = await requestEtcFnc(Api.userSignQuery, {
  24. data: params,
  25. })
  26. return res
  27. }
  28. export async function apiIssueApply() {
  29. const {
  30. orderId,
  31. cardId,
  32. obuId,
  33. } = arguments[0]
  34. const params = {
  35. orderId,
  36. agentId: "52010106004",
  37. loginSource: "69af303ba2eb4608a099163f0d2a5dbd",
  38. channelId: "5201010200601130001",
  39. channelType: 1,
  40. issueType: 1,
  41. cardId,
  42. obuId,
  43. }
  44. const res = await requestEtcFnc(Api.issueApply, {
  45. data: params,
  46. isNeedAuth: false,
  47. })
  48. return res
  49. }
  50. export async function apiIssueCallback() {
  51. const {
  52. transOrderId,
  53. cmd,
  54. cmdResult,
  55. stepNo,
  56. } = arguments[0]
  57. const params = {
  58. transOrderId,
  59. // openId,
  60. agentId: "52010106004",
  61. loginSource: "69af303ba2eb4608a099163f0d2a5dbd",
  62. channelId: "5201010200601130001",
  63. channelType: 1,
  64. cmd,
  65. cmdResult,
  66. stepNo,
  67. staffId: "54623263cb4d4a289dccbc983b22a4af",
  68. }
  69. const res = await requestEtcFnc(Api.issueCallback, {
  70. data: params,
  71. isNeedAuth: false,
  72. })
  73. return res
  74. }
  75. export async function repaetGetOpenId(jsCode) {
  76. const res = await requestEtcFnc(Api.getOpenId, {
  77. data: {
  78. jsCode: jsCode
  79. },
  80. isNeedAuth: false,
  81. })
  82. if (res.code == 0) {
  83. const data = res.data.data
  84. if (data) {
  85. const info = JSON.parse(data)
  86. console.log(info);
  87. const openId = info.openId;
  88. setStore("myWxOpenId", openId)
  89. }
  90. } else {
  91. wx.hideLoading()
  92. wx.showToast({
  93. title: res.message || "登录失败,请稍后重试",
  94. icon: false,
  95. });
  96. }
  97. return res.code;
  98. }
  99. export async function repeatLogin() {
  100. const openId = getStore('etc-openId')
  101. const accessToken = getStore("etc-accessToken") || "token"
  102. const params = {
  103. openId,
  104. accessToken,
  105. }
  106. const res = await requestEtcFnc(Api.phoneLogin, {
  107. data: params,
  108. isNeedAuth: false,
  109. })
  110. if (res.code == 0) {
  111. const {
  112. accessToken,
  113. openId,
  114. } = res.data
  115. setStore('etc-accessToken', accessToken)
  116. setStore('etc-openId', openId)
  117. }
  118. return res
  119. }
  120. export async function contractQuery() {
  121. const {
  122. orderId,
  123. } = arguments[0]
  124. const res = await requestEtcFnc(Api.contractQuery, {
  125. data: {
  126. orderId,
  127. },
  128. isNeedAuth: false,
  129. })
  130. return res
  131. }
  132. export async function accountSign() {
  133. const {
  134. orderId,
  135. } = arguments[0]
  136. const res = await requestEtcFnc(Api.accountSign, {
  137. data: {
  138. orderId,
  139. orderSource: "CHANNEL"
  140. },
  141. isNeedAuth: false,
  142. })
  143. return res
  144. }