"use strict";
const common_http = require("../../common/http.js");
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  data() {
    return { settings: { hideZeroStock: false, hidePurchasePrice: false } };
  },
  onLoad() {
    this.load();
  },
  methods: {
    async load() {
      try {
        const res = await common_http.get("/api/product-settings");
        this.settings = { hideZeroStock: !!(res == null ? void 0 : res.hideZeroStock), hidePurchasePrice: !!(res == null ? void 0 : res.hidePurchasePrice) };
      } catch (_) {
      }
    },
    async update(key, val) {
      const next = { ...this.settings, [key]: val };
      this.settings = next;
      try {
        await common_http.put("/api/product-settings", next);
      } catch (_) {
      }
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: $data.settings.hideZeroStock,
    b: common_vendor.o((e) => $options.update("hideZeroStock", e.detail.value)),
    c: $data.settings.hidePurchasePrice,
    d: common_vendor.o((e) => $options.update("hidePurchasePrice", e.detail.value))
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/product/settings.js.map
