123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- import Api from "../../../api/index.js"
- import { requestFnc } from "../../../utils/request.js"
- import { getStore } from "../../../utils/index.js"
- let timeInterVal = null
- Page({
- data: {
- vehicle_code_info: "",
- cpuInfo: {},
- obus: {},
- imgCode: "",
- identitys: {
- number: getStore("mobile"),
- imgCode: "",
- },
- disabled: false,
- notifyMsg: "",
- showNotify: false,
- isLoading: false,
- cpuInfo: {},
- obus: {},
- smsName: "获取验证码",
- carType: getStore("carType"),
- orderNo: "",
- steps:["注销申请","注销审核","注销确认"],
- stepsIndex:2
- },
- onLoad: function (options) {
- let { afterOrderNo = "" } = options
- this.setData({
- orderNo: afterOrderNo,
- })
- this.getCode()
- },
- onUnload: function () {
- timeInterVal && clearInterval(timeInterVal)
- },
- // 获取签信息
- getObuInfo() {
- let params = {
- filename: Api.getObuInfo.filename,
- data: {
- plateNum: getStore("plateNum"),
- plateColor: getStore("plateColor"),
- accountId: getStore("accountId"),
- },
- }
- requestFnc(
- Api.getObuInfo.url,
- params,
- (res) => {
- let { data = [] } = res
- let { obuId = "" } = data[0]
-
- this.setData({
- obus: {
- obuId,
- },
- })
- },
- (error) => {
- this.setData({
- obus: {
- obuId: "",
- },
- })
- }
- )
- },
- // 获取卡信息
- getCpuInfo() {
- let params = {
- data: {
- plateNum: getStore("plateNum"),
- plateColor: getStore("plateColor"),
- accountId: getStore("accountId"),
- },
- filename: Api.getCpuInfo.filename,
- }
- requestFnc(
- Api.getCpuInfo.url,
- params,
- (res) => {
- let { data = [] } = res
- let { cardId = "", status } = data[0]
-
- this.setData({
- cpuInfo: {
- cardId,
- },
- })
- },
- (error) => {
- this.setData({
- cpuInfo: {
- cardId: "",
- },
- })
- }
- )
- },
- onSubmitAction() {
- const { identitys = {} } = this.data
- let { code = "" } = identitys
-
- let msg = ""
- if (!code) {
- msg = "请输入手机验证码"
- }
- if (msg) {
- this.setData({
- notifyMsg: msg,
- showNotify: true,
- })
- setTimeout(() => {
- this.setData({
- showNotify: false,
- })
- }, 2 * 1000)
-
- return
- }
- this.aftersalesWriteoffReq()
- },
- aftersalesWriteoffReq() {
- this.setData({
- isLoading: true,
- })
-
- let params = {
- filename: Api.aftersalesWriteoffReq.filename,
- data: {
- accountId: getStore("accountId"),
- openId: getStore("openId"),
- code: this.data.identitys.code,
- orderNo: this.data.orderNo,
- },
- }
-
- requestFnc(
- Api.aftersalesWriteoffReq.url,
- params,
- (res) => {
- wx.redirectTo({
- url: "plugin://issuer-plugin/logOffResult",
- })
- },
- () => {
- this.setData({
- isLoading: false,
- })
- }
- )
- },
- // 获取图形验证码
- getCode() {
- let params = {
- filename: Api.getImgCode.filename,
- data: {
- mobile: this.data.identitys.number,
- },
- }
- requestFnc(Api.getImgCode.url, params, (res) => {
- console.log("获取图形验证码res", res)
- this.setData({
- imgCode: res.authCode,
- })
- })
- },
- onSend() {
- console.log("this.data", this.data)
- if (!this.data.disabled) this.getSsoSendlossmsgReq()
- },
- getSsoSendlossmsgReq() {
- let params = {
- filename: Api.getSsoSendlossmsgReq.filename,
- data: {
- accountId: getStore("accountId"),
- authCode: this.data.identitys.imgCode,
- },
- }
-
- requestFnc(Api.getSsoSendlossmsgReq.url, params, (res) => {
- let countdown = 60
- timeInterVal = setInterval(() => {
- countdown = countdown - 1
- console.log("countdown", countdown, countdown === 0)
- this.setData({
- smsName: `重新获取(${countdown}s)`,
- })
- if (countdown === 0) {
- clearInterval(timeInterVal)
- timeInterVal = null
- this.setData({
- disabled: false,
- smsName: "获取验证码",
- })
- }
- }, 1000)
- this.setData({
- disabled: true,
- })
- })
- },
- changeInput(e) {
- let key = e.currentTarget.dataset.type
- this.data.identitys[key] = e.detail
- this.setData({
- identitys: {
- ...this.data.identitys,
- },
- })
- },
- })
|