"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_file = require("../../utils/file.js");
const store_user = require("../../store/user.js");
if (!Math) {
  (LoginModal + TabBar)();
}
const TabBar = () => "../../components/TabBar.js";
const LoginModal = () => "../components/LoginModal.js";
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const userStore = store_user.useUserStore();
    const showLoginModal = common_vendor.ref(false);
    const foodList = common_vendor.ref([
      {
        image: "/static/demo.png",
        name: "川派辣卤牛杂川派辣卤牛杂煲川派辣卤牛杂煲川派辣卤牛杂煲煲",
        sales: 160,
        tags: [
          { text: "招牌", type: "signature" },
          { text: "中辣", type: "spicy" }
        ],
        description: "香煎 M9 和牛粒是将澳洲顶级 M9 和牛切成均匀小粒,以高温快煎方式锁住肉汁。",
        price: "49.8"
      },
      {
        image: "/static/demo.png",
        name: "川派辣卤牛杂煲",
        sales: 160,
        tags: [
          { text: "招牌", type: "signature" },
          { text: "中辣", type: "spicy" }
        ],
        description: "香煎 M9 和牛粒是将澳洲顶级 M9 和牛切成均匀小粒,以高温快煎方式锁住肉汁。",
        price: "49.8"
      }
    ]);
    const getPriceMain = (price) => {
      if (!price)
        return "";
      const priceStr = String(price);
      const dotIndex = priceStr.indexOf(".");
      return dotIndex > -1 ? priceStr.substring(0, dotIndex) : priceStr;
    };
    const getPriceDecimal = (price) => {
      if (!price)
        return "";
      const priceStr = String(price);
      const dotIndex = priceStr.indexOf(".");
      return dotIndex > -1 ? priceStr.substring(dotIndex + 1) : "";
    };
    const handleLoginSuccess = (res) => {
      common_vendor.index.__f__("log", "at pages/index/index.vue:137", "登录成功:", res);
    };
    const handleLoginCancel = () => {
      common_vendor.index.__f__("log", "at pages/index/index.vue:142", "用户取消登录");
    };
    common_vendor.onLoad((e) => {
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(utils_file.getFileUrl)("/static/demo.png"),
        b: common_vendor.unref(utils_file.getFileUrl)("img/icon/shop.png"),
        c: !common_vendor.unref(userStore).getToken
      }, !common_vendor.unref(userStore).getToken ? {
        d: common_vendor.o(($event) => showLoginModal.value = true),
        e: common_vendor.unref(utils_file.getFileUrl)("img/icon/welcom.png")
      } : {}, {
        f: common_vendor.unref(utils_file.getFileUrl)("img/icon/zptj.png"),
        g: common_vendor.f(foodList.value, (item, index, i0) => {
          return {
            a: common_vendor.unref(utils_file.getFileUrl)(item.image),
            b: common_vendor.t(item.name),
            c: common_vendor.t(item.sales),
            d: common_vendor.t(getPriceMain(item.price)),
            e: common_vendor.t(getPriceDecimal(item.price)),
            f: common_vendor.f(item.tags, (tag, tagIndex, i1) => {
              return {
                a: common_vendor.t(tag.text),
                b: tagIndex,
                c: common_vendor.n(tag.type)
              };
            }),
            g: common_vendor.t(item.description),
            h: index
          };
        }),
        h: common_vendor.unref(utils_file.getFileUrl)("img/icon/star.png"),
        i: common_vendor.o(handleLoginSuccess),
        j: common_vendor.o(handleLoginCancel),
        k: common_vendor.o(($event) => showLoginModal.value = $event),
        l: common_vendor.p({
          open: showLoginModal.value
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map
