"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
const _sfc_main = {
  data() {
    return {
      balance: 0,
      dataFrom: {
        amount: "",
        refundReason: ""
      }
    };
  },
  onLoad(options) {
    if (options.balance) {
      this.balance = options.balance;
    }
  },
  methods: {
    refundTo() {
      if (!this.dataFrom.amount) {
        return common_vendor.index.showToast({
          title: "请输入退款金额",
          icon: "none"
        });
      }
      api_api.refund(this.dataFrom).then((res) => {
        common_vendor.index.showModal({
          title: "提示",
          content: "提交成功",
          showCancel: false,
          success: function(res2) {
            common_vendor.index.navigateBack();
          }
        });
      });
    }
  }
};
if (!Array) {
  const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
  const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
  (_easycom_up_textarea2 + _easycom_up_button2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
  (_easycom_up_textarea + _easycom_up_button)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: `可申请退款${$data.balance}元`,
    b: $data.dataFrom.amount,
    c: common_vendor.o(($event) => $data.dataFrom.amount = $event.detail.value),
    d: common_vendor.o(($event) => $data.dataFrom.amount = $data.balance),
    e: common_vendor.o(($event) => $data.dataFrom.refundReason = $event),
    f: common_vendor.p({
      placeholder: "请输入退款理由",
      modelValue: $data.dataFrom.refundReason
    }),
    g: common_vendor.p({
      openType: "contact",
      customStyle: {
        height: "80rpx"
      },
      text: "联系客服",
      shape: "circle"
    }),
    h: common_vendor.o($options.refundTo),
    i: common_vendor.p({
      customStyle: {
        height: "80rpx"
      },
      color: "#4879e6",
      text: "提交",
      shape: "circle"
    })
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createPage(MiniProgramPage);
