Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

deviceLogOff.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. import Api from "../../../api/index.js"
  2. import { requestFnc } from "../../../utils/request.js"
  3. import { getStore } from "../../../utils/index.js"
  4. let timeInterVal = null
  5. Page({
  6. data: {
  7. vehicle_code_info: "",
  8. cpuInfo: {},
  9. obus: {},
  10. imgCode: "",
  11. identitys: {
  12. number: getStore("mobile"),
  13. imgCode: "",
  14. },
  15. disabled: false,
  16. notifyMsg: "",
  17. showNotify: false,
  18. isLoading: false,
  19. cpuInfo: {},
  20. obus: {},
  21. smsName: "获取验证码",
  22. carType: getStore("carType"),
  23. orderNo: "",
  24. steps:["注销申请","注销审核","注销确认"],
  25. stepsIndex:2
  26. },
  27. onLoad: function (options) {
  28. let { afterOrderNo = "" } = options
  29. this.setData({
  30. orderNo: afterOrderNo,
  31. })
  32. this.getCode()
  33. },
  34. onUnload: function () {
  35. timeInterVal && clearInterval(timeInterVal)
  36. },
  37. // 获取签信息
  38. getObuInfo() {
  39. let params = {
  40. filename: Api.getObuInfo.filename,
  41. data: {
  42. plateNum: getStore("plateNum"),
  43. plateColor: getStore("plateColor"),
  44. accountId: getStore("accountId"),
  45. },
  46. }
  47. requestFnc(
  48. Api.getObuInfo.url,
  49. params,
  50. (res) => {
  51. let { data = [] } = res
  52. let { obuId = "" } = data[0]
  53. this.setData({
  54. obus: {
  55. obuId,
  56. },
  57. })
  58. },
  59. (error) => {
  60. this.setData({
  61. obus: {
  62. obuId: "",
  63. },
  64. })
  65. }
  66. )
  67. },
  68. // 获取卡信息
  69. getCpuInfo() {
  70. let params = {
  71. data: {
  72. plateNum: getStore("plateNum"),
  73. plateColor: getStore("plateColor"),
  74. accountId: getStore("accountId"),
  75. },
  76. filename: Api.getCpuInfo.filename,
  77. }
  78. requestFnc(
  79. Api.getCpuInfo.url,
  80. params,
  81. (res) => {
  82. let { data = [] } = res
  83. let { cardId = "", status } = data[0]
  84. this.setData({
  85. cpuInfo: {
  86. cardId,
  87. },
  88. })
  89. },
  90. (error) => {
  91. this.setData({
  92. cpuInfo: {
  93. cardId: "",
  94. },
  95. })
  96. }
  97. )
  98. },
  99. onSubmitAction() {
  100. const { identitys = {} } = this.data
  101. let { code = "" } = identitys
  102. let msg = ""
  103. if (!code) {
  104. msg = "请输入手机验证码"
  105. }
  106. if (msg) {
  107. this.setData({
  108. notifyMsg: msg,
  109. showNotify: true,
  110. })
  111. setTimeout(() => {
  112. this.setData({
  113. showNotify: false,
  114. })
  115. }, 2 * 1000)
  116. return
  117. }
  118. this.aftersalesWriteoffReq()
  119. },
  120. aftersalesWriteoffReq() {
  121. this.setData({
  122. isLoading: true,
  123. })
  124. let params = {
  125. filename: Api.aftersalesWriteoffReq.filename,
  126. data: {
  127. accountId: getStore("accountId"),
  128. openId: getStore("openId"),
  129. code: this.data.identitys.code,
  130. orderNo: this.data.orderNo,
  131. },
  132. }
  133. requestFnc(
  134. Api.aftersalesWriteoffReq.url,
  135. params,
  136. (res) => {
  137. wx.redirectTo({
  138. url: "plugin://issuer-plugin/logOffResult",
  139. })
  140. },
  141. () => {
  142. this.setData({
  143. isLoading: false,
  144. })
  145. }
  146. )
  147. },
  148. // 获取图形验证码
  149. getCode() {
  150. let params = {
  151. filename: Api.getImgCode.filename,
  152. data: {
  153. mobile: this.data.identitys.number,
  154. },
  155. }
  156. requestFnc(Api.getImgCode.url, params, (res) => {
  157. console.log("获取图形验证码res", res)
  158. this.setData({
  159. imgCode: res.authCode,
  160. })
  161. })
  162. },
  163. onSend() {
  164. console.log("this.data", this.data)
  165. if (!this.data.disabled) this.getSsoSendlossmsgReq()
  166. },
  167. getSsoSendlossmsgReq() {
  168. let params = {
  169. filename: Api.getSsoSendlossmsgReq.filename,
  170. data: {
  171. accountId: getStore("accountId"),
  172. authCode: this.data.identitys.imgCode,
  173. },
  174. }
  175. requestFnc(Api.getSsoSendlossmsgReq.url, params, (res) => {
  176. let countdown = 60
  177. timeInterVal = setInterval(() => {
  178. countdown = countdown - 1
  179. console.log("countdown", countdown, countdown === 0)
  180. this.setData({
  181. smsName: `重新获取(${countdown}s)`,
  182. })
  183. if (countdown === 0) {
  184. clearInterval(timeInterVal)
  185. timeInterVal = null
  186. this.setData({
  187. disabled: false,
  188. smsName: "获取验证码",
  189. })
  190. }
  191. }, 1000)
  192. this.setData({
  193. disabled: true,
  194. })
  195. })
  196. },
  197. changeInput(e) {
  198. let key = e.currentTarget.dataset.type
  199. this.data.identitys[key] = e.detail
  200. this.setData({
  201. identitys: {
  202. ...this.data.identitys,
  203. },
  204. })
  205. },
  206. })