shopDetaile.js 6.5 KB
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
  const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  const _easycom_u_swiper2 = common_vendor.resolveComponent("u-swiper");
  const _easycom_u_badge2 = common_vendor.resolveComponent("u-badge");
  (_easycom_u_navbar2 + _easycom_u_swiper2 + _easycom_u_badge2)();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
const _easycom_u_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
const _easycom_u_badge = () => "../../uni_modules/uview-plus/components/u-badge/u-badge.js";
if (!Math) {
  (_easycom_u_navbar + _easycom_u_swiper + shopInfo + comment + _easycom_u_badge + popPay)();
}
const shopInfo = () => "../../componets/shopInfo.js";
const comment = () => "../../componets/comment.js";
const popPay = () => "../../componets/popPay.js";
const _sfc_main = {
  setup(__props) {
    common_vendor.onLoad((e) => {
      console.log("\u5546\u54C1id", e.id);
      getShopDetailes(e.id);
    });
    common_vendor.onHide(() => {
      payPopShow.value = false;
    });
    const currentNum = common_vendor.ref(0);
    common_vendor.reactive(["https://cdn.uviewui.com/uview/swiper/swiper2.png", "https://cdn.uviewui.com/uview/swiper/swiper3.png", "https://cdn.uviewui.com/uview/swiper/swiper1.png"]);
    const icList = common_vendor.reactive([
      { id: 1, name: "\u5E97\u94FA", icon: "/static/indexIc/shopIc.png" },
      { id: 2, name: "\u5BA2\u670D", icon: "/static/indexIc/service.png" },
      { id: 3, name: "\u8D2D\u7269\u8F66", icon: "/static/tabbarsIc/shopCar.png" }
    ]);
    const value = common_vendor.ref("1");
    const seeAll = () => {
      common_vendor.index.navigateTo({
        url: "/pages/index/allComment"
      });
    };
    let btnType = common_vendor.ref(0);
    let payPopShow = common_vendor.ref(false);
    const toOrder = (type) => {
      btnType.value = type;
      payPopShow.value = true;
    };
    const btns = (index) => {
      switch (index) {
        case 0:
          console.log("\u5E97\u94FA");
          common_vendor.index.switchTab({ url: "/pages/index/index" });
          break;
        case 2:
          console.log("\u8D2D\u7269\u8F66");
          common_vendor.index.switchTab({ url: "/pages/shopCar/shopCar" });
          break;
      }
    };
    let detaileList = common_vendor.ref({});
    let specList = common_vendor.ref({});
    let swiperList = common_vendor.ref([]);
    let commentList = common_vendor.ref([]);
    let moreSpec = common_vendor.ref({});
    let shopType = common_vendor.ref(1);
    const getShopDetailes = async (id) => {
      try {
        const res = await api_index.getShopDetaile(id);
        detaileList.value = res.detail;
        specList.value = res.detail.spec[0];
        swiperList.value = res.detail.images;
        commentList.value = res.pinglun;
        moreSpec.value = res.specData;
        shopType.value = res.detail.goodstatus;
        value.value = res.cartNum;
        console.log("getShopDetaile", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("", err);
      }
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          bgColor: "transparent",
          autoBack: true
        }),
        b: common_vendor.unref(shopType) != 3
      }, common_vendor.unref(shopType) != 3 ? {
        c: common_vendor.t(currentNum.value + 1),
        d: common_vendor.t(common_vendor.unref(swiperList).length)
      } : {}, {
        e: common_vendor.o((e) => currentNum.value = e.current),
        f: common_vendor.p({
          height: "375",
          list: common_vendor.unref(swiperList),
          autoplay: false,
          indicatorStyle: "right: 20px"
        }),
        g: common_vendor.p({
          info: common_vendor.unref(detaileList)
        }),
        h: common_vendor.unref(shopType) == 1
      }, common_vendor.unref(shopType) == 1 ? common_vendor.e({
        i: common_vendor.t(common_vendor.unref(commentList).length),
        j: common_vendor.unref(commentList).length > 0
      }, common_vendor.unref(commentList).length > 0 ? {
        k: common_vendor.o(seeAll)
      } : {}, {
        l: common_vendor.unref(commentList).length > 0
      }, common_vendor.unref(commentList).length > 0 ? {
        m: common_vendor.p({
          commentList: common_vendor.unref(commentList)
        })
      } : {}) : {}, {
        n: common_vendor.unref(shopType) !== 3
      }, common_vendor.unref(shopType) !== 3 ? {
        o: common_vendor.unref(detaileList).content
      } : {}, {
        p: common_vendor.unref(shopType) == 3
      }, common_vendor.unref(shopType) == 3 ? {} : {}, {
        q: common_vendor.f(common_vendor.unref(icList), (item, index, i0) => {
          return common_vendor.e({
            a: item.icon,
            b: index == 2
          }, index == 2 ? {
            c: "1a35f0c9-4-" + i0,
            d: common_vendor.p({
              absolute: true,
              offset: [-6, -6],
              color: "#fff",
              bgColor: "#F63D3A",
              max: "99",
              value: value.value
            })
          } : {}, {
            e: index != 1
          }, index != 1 ? {
            f: common_vendor.t(item.name)
          } : {}, {
            g: index == 1
          }, index == 1 ? {
            h: common_vendor.t(item.name)
          } : {}, {
            i: item.id,
            j: common_vendor.o(($event) => btns(index), item.id)
          });
        }),
        r: common_vendor.unref(shopType) != 3
      }, common_vendor.unref(shopType) != 3 ? {
        s: common_vendor.o(($event) => toOrder(0)),
        t: common_vendor.o(($event) => toOrder(1))
      } : {
        v: common_vendor.o(($event) => toOrder(3))
      }, {
        w: common_vendor.o(($event) => common_vendor.isRef(payPopShow) ? payPopShow.value = false : payPopShow = false),
        x: common_vendor.p({
          moreSpec: common_vendor.unref(moreSpec),
          shopDetail: common_vendor.unref(detaileList),
          shopType: common_vendor.unref(shopType),
          btnType: common_vendor.unref(btnType),
          payPopShow: common_vendor.unref(payPopShow)
        })
      });
    };
  }
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/index/shopDetaile.vue"]]);
wx.createPage(MiniProgramPage);