"use strict";
const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
const store_index = require("../../store/index.js");
const utils_fun = require("../../utils/fun.js");
const uni_modules_wotDesignUni_components_composables_useCountDown = require("../../uni_modules/wot-design-uni/components/composables/useCountDown.js");
require("../../uni_modules/wot-design-uni/locale/index.js");
require("../../uni_modules/wot-design-uni/dayjs/index.js");
const _sfc_main = {
  __name: "zhaun",
  setup(__props) {
    let dataForm = common_vendor.ref({
      toPhone: "",
      smsCode: "",
      money: ""
    });
    const codeIngo = common_vendor.ref("获取验证码");
    const { start, pause, reset, current } = uni_modules_wotDesignUni_components_composables_useCountDown.useCountDown({
      time: 60 * 1e3,
      onChange(current2) {
      },
      onFinish() {
        codeIngo.value = "重新发送";
      }
    });
    const getCode = (e) => {
      if (!userInfo.value.mobile) {
        utils_fun.toast("请输入手机号");
        return;
      }
      if (current.value.seconds) {
        utils_fun.toast("请等待倒计时结束");
        return;
      }
      api_index.api.smsCode({
        mobile: userInfo.value.mobile,
        scene: 6
      }).then((res) => {
        start();
        utils_fun.toast("验证码发送成功");
      }).catch((err) => {
        common_vendor.index.__f__("log", "at pages/wallet/zhaun.vue:86", err);
        utils_fun.toast("验证码发送失败");
      });
    };
    const store = store_index.Store();
    const userInfo = common_vendor.computed(
      () => store.userInfo || {
        inviteCode: "",
        nickname: "",
        mobile: "",
        avatar: "",
        paywallet: {
          balance: 0
        }
      }
    );
    const confirm = () => {
      if (!dataForm.value.toPhone)
        return common_vendor.index.showToast({ title: "请输入划转手机号", icon: "none" });
      if (!dataForm.value.money)
        return common_vendor.index.showToast({ title: "请输入划转金额", icon: "none" });
      if (!dataForm.value.smsCode)
        return common_vendor.index.showToast({ title: "请输入验证码", icon: "none" });
      api_index.api.transfer2other(dataForm.value).then((res) => {
        common_vendor.index.showModal({
          title: "提示",
          content: "划转成功",
          showCancel: false,
          success: () => {
            common_vendor.index.reLaunch({
              url: "/pages/mine/mine"
            });
          }
        });
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.t(userInfo.value.money),
        b: common_vendor.unref(dataForm).money,
        c: common_vendor.o(($event) => common_vendor.unref(dataForm).money = $event.detail.value),
        d: common_vendor.unref(dataForm).toPhone,
        e: common_vendor.o(($event) => common_vendor.unref(dataForm).toPhone = $event.detail.value),
        f: userInfo.value.mobile,
        g: common_vendor.o(($event) => userInfo.value.mobile = $event.detail.value),
        h: common_vendor.unref(dataForm).smsCode,
        i: common_vendor.o(($event) => common_vendor.unref(dataForm).smsCode = $event.detail.value),
        j: common_vendor.t(common_vendor.unref(current).seconds || codeIngo.value),
        k: common_vendor.o(getCode),
        l: common_vendor.o(confirm)
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-711f8035"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/wallet/zhaun.js.map
