"use strict";
const common_vendor = require("../../common/vendor.js");
const api = require("../../api.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = common_vendor.defineComponent({
  data() {
    return {
      ServiceName: "",
      title: "北京汽车有限公司",
      isshow: false,
      isshow_1: false,
      newListData: [],
      textcontent: []
    };
  },
  mounted() {
    api.isToken();
    api.getStoreName().then((res = null) => {
      getApp().allMsg = res.result;
      this.textcontent = res.result;
      this.title = res.result[0].storeName;
      getApp().storeName = res.result[0].storeName;
    });
  },
  methods: {
    change_text() {
      if (this.isshow) {
        this.isshow = false;
      } else {
        this.isshow = true;
        common_vendor.index.__f__("log", "at pages/home/home.uvue:80", "111");
      }
    },
    orderEntry() {
      common_vendor.index.__f__("log", "at pages/home/home.uvue:84", "111");
      common_vendor.index.navigateTo({ url: "/pages/views/dingDanCreate" });
    },
    // 搜索城市名字
    searchName() {
      if (this.ServiceName) {
        this.textcontent = [];
        getApp().allMsg.map((item = null) => {
          if (item.storeName.indexOf(this.ServiceName) !== -1) {
            this.textcontent.push(item);
          }
        });
      } else {
        this.textcontent = [];
        this.textcontent = getApp().allMsg;
      }
    },
    change_city(name = null) {
      this.title = name;
      this.change_text();
      this.isshow_1 = true;
      getApp().storeName = this.title;
    },
    close_view() {
      this.isshow_1 = false;
    },
    // 模糊匹配
    // 右上角搜索框--模糊查询
    handleSearch(event = null) {
      common_vendor.index.__f__("log", "at pages/home/home.uvue:115", event);
      if (event) {
        this.textcontent = [];
        getApp().allMsg.map((item = null) => {
          if (item.storeName.indexOf(event) !== -1) {
            this.textcontent.push(item);
          }
        });
      } else {
        this.textcontent = [];
        this.textcontent = getApp().allMsg;
      }
    }
  }
});
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
if (!Math) {
  (_easycom_uni_icons + _easycom_uni_easyinput)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: common_vendor.t($data.title),
    b: $data.title,
    c: common_vendor.p({
      type: "right",
      size: "30",
      color: "#c2d4de"
    }),
    d: common_vendor.o((...args) => $options.change_text && $options.change_text(...args)),
    e: common_assets._imports_0$1,
    f: common_assets._imports_1,
    g: common_vendor.p({
      type: "right",
      size: 25,
      color: "#306e91"
    }),
    h: common_vendor.o((...args) => $options.orderEntry && $options.orderEntry(...args)),
    i: $data.isshow
  }, $data.isshow ? {
    j: common_vendor.p({
      type: "search",
      size: 20
    }),
    k: common_vendor.o($options.handleSearch),
    l: common_vendor.o(($event) => $data.ServiceName = $event),
    m: common_vendor.p({
      inputBorder: false,
      placeholder: "请输入服务名称",
      modelValue: $data.ServiceName
    }),
    n: common_vendor.o((...args) => $options.searchName && $options.searchName(...args)),
    o: common_vendor.f($data.textcontent, (item, index, i0) => {
      return {
        a: common_vendor.t(item.storeName),
        b: index,
        c: common_vendor.o(($event) => $options.change_city(item.storeName), index)
      };
    })
  } : {}, {
    p: $data.isshow_1
  }, $data.isshow_1 ? {
    q: common_assets._imports_2,
    r: common_vendor.t($data.title),
    s: common_vendor.o((...args) => $options.close_view && $options.close_view(...args))
  } : {}, {
    t: common_vendor.sei(_ctx.virtualHostId, "view")
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/home/home.js.map
