"use strict";
const common_vendor = require("../../common/vendor.js");
const gen_Apis = require("../../gen/Apis.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const INDEX_release_items_model = require("./model.js");
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
const common_libraries_day = require("../../common/libraries/day.js");
const getShow = (data) => {
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.GoodsReleases.GoodsReleases.Show, data).then((res) => {
    var _a, _b;
    INDEX_release_items_model.useModel.showData.value = res == null ? void 0 : res.data;
    if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.passed_time) {
      INDEX_release_items_model.useModel.isExpired.value = common_libraries_day.isDatePassed((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.passed_time);
    }
    console.log(res);
  });
};
const method = {
  getShow,
  handleSubmit() {
    common_vendor.index.showModal({
      title: "提示",
      content: "确定放行？",
      success: function(res) {
        var _a;
        if (res.confirm) {
          common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.GoodsReleases.GoodsReleases.ScanRelease, {
            code: (_a = INDEX_release_items_model.useModel.showData.value) == null ? void 0 : _a.code
          }).then((res2) => {
            var _a2, _b;
            common_libraries_naviHelper.showToast("放行成功！");
            getShow((_b = (_a2 = INDEX_release_items_model.useModel) == null ? void 0 : _a2.showData) == null ? void 0 : _b.value);
            console.log(res2);
          });
          console.log("用户点击确定");
        } else if (res.cancel) {
          console.log("用户点击取消");
        }
      }
    });
  }
};
exports.method = method;
