"use strict"; const common_vendor = require("../common/vendor.js"); const api_live = require("../api/live.js"); const common_assets = require("../common/assets.js"); const _sfc_main = { data() { return { tabList: [{ name: "推荐" }, { name: "分类" }], products: [], liveId: null, storeId: null, statusBarHeight: common_vendor.index.getWindowInfo().statusBarHeight, // 右侧的胶囊距离右侧屏幕距离-px menuRight: common_vendor.index.getStorageSync("menuInfo").menuRight, // 右侧的胶囊宽度-px menuWidth: common_vendor.index.getStorageSync("menuInfo").menuWidth, opacity: 0, opacityTxt: 0, tabbar: [{ name: "商品" }, { name: "商家" }], current: 0, storeInfo: {}, // logoUrl: "/static/images/adfd21c004854c9b8997d371d7a0ce8c.jpg", // 商家资质图片 // licenseImagesList: ["/static/images/sjzz.jpg"], divHeight: "0px", allCates: [], cates: [], subCates: [], // 选中药品分类 cateSelect: 0, // 轮播图 advs: [], // 'company'表示销售管理的进来的 from: "" }; }, onLoad(options) { console.log("接收到的options:", options); if (options.liveId) { this.liveId = options.liveId; this.getliveStore(); console.log("接收到的liveId:", this.liveId); } this.storeId = options.storeId || ""; this.getSearchStore(); }, onShow() { this.divHeight = `calc(100vh - 44px - 88rpx - ${this.statusBarHeight}px)`; }, onPageScroll(e) { if (e.scrollTop <= 44) { this.opacityTxt = 0; this.opacity = e.scrollTop > this.statusBarHeight ? 0.6 : 0; } else if (e.scrollTop > 50) { this.opacity = 1; this.opacityTxt = 1; } }, methods: { getPureDecimal(num, precision = 6) { const decimalPart = Math.abs(num).toFixed(precision).split(".")[1]; return (decimalPart == null ? void 0 : decimalPart.replace(/0+$/, "")) || ""; }, //店铺展示 getliveStore() { let data = { pageSize: 10, page: 1 }; api_live.liveStore(this.liveId, data).then( (res) => { if (res.code == 200) { console.log("小黄车 店铺展示>>>>", res); this.products = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { } ); }, //查询店铺 getSearchStore() { console.log("查询店铺", this.storeId); api_live.searchStore(this.storeId).then( (res) => { if (res.code == 200) { console.log("查询店铺>>>>", res); } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { } ); }, rightClick() { common_vendor.index.navigateBack(); }, clickTab(item) { this.current = item.index; }, // 预览图片 previewImage(index) { common_vendor.index.previewImage({ current: index, urls: this.licenseImagesList }); }, // getStoreInfo() { // getStoreById({ // storeId: this.storeId // }).then( // res => { // if (res.code == 200) { // this.storeInfo = res.data || {} // // this.licenseImagesList = this.storeInfo.licenseImages ? this.storeInfo.licenseImages.split(',') : [] // } else { // uni.showToast({ // icon: 'none', // title: res.msg, // }); // } // }, // rej => {} // ); // }, toSearch() { if (this.from == "company") { common_vendor.index.navigateTo({ url: "/pages_company/order/productList?storeId=" + this.storeId || "" }); } else { common_vendor.index.navigateTo({ url: "/pages/home/productSearch?storeId=" + this.storeId || "" }); } }, handleAdvClick(item) { if (item.showType == 1) { common_vendor.index.setStorageSync("url", item.advUrl); common_vendor.index.navigateTo({ url: "/pages/home/h5?storeId=" + this.storeId || "" }); } else if (item.showType == 2) { common_vendor.index.navigateTo({ url: item.advUrl }); } else if (item.showType == 3) { common_vendor.index.setStorageSync("content", item.content); common_vendor.index.navigateTo({ url: "/pages/home/content?storeId=" + this.storeId || "" }); } }, // getAdv() { // let data = { // advType: 2 // }; // getAdv(data).then( // res => { // if (res.code == 200) { // this.advs = res.data; // } // }, // rej => {} // ); // }, // getProductCate() { // let data = {}; // getProductCate(data).then( // res => { // if (res.code == 200) { // this.allCates = res.data; // this.cates = this.allCates.filter(function(item) { // return item.pid == 0 // }); // if (this.cates != null && this.cates.length > 0) { // this.cateSelect = this.cates[0].cateId; // this.getSubCate() // } // } else { // uni.showToast({ // icon: 'none', // title: "请求失败", // }); // } // }, // rej => {} // ); // }, // 药品分类选择 choseCate(item) { this.cateSelect = item.cateId; this.getSubCate(); }, getSubCate() { var that = this; this.subCates = this.allCates.filter(function(item) { return item.pid == that.cateSelect; }); }, // 查看药品详情 showProductList(item) { common_vendor.index.navigateTo({ url: "/pages/shopping/productList?cateId=" + item.cateId + "&pid=" + item.pid + "&storeId=" + this.storeId + "&from=" + this.from }); } } }; if (!Array) { const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); const _easycom_u_image2 = common_vendor.resolveComponent("u-image"); const _easycom_u_tabs2 = common_vendor.resolveComponent("u-tabs"); (_easycom_u_icon2 + _easycom_u_image2 + _easycom_u_tabs2)(); } const _easycom_u_icon = () => "../uni_modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_u_image = () => "../uni_modules/uview-plus/components/u-image/u-image.js"; const _easycom_u_tabs = () => "../uni_modules/uview-plus/components/u-tabs/u-tabs.js"; if (!Math) { (_easycom_u_icon + _easycom_u_image + _easycom_u_tabs)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: $data.statusBarHeight + "px", b: common_vendor.o($options.rightClick), c: common_vendor.p({ name: "arrow-left", color: "#ffffff", size: "20" }), d: common_assets._imports_0$9, e: $data.opacity >= 0.6 ? "#6b4d40" : "#6b4d40", f: common_vendor.o((...args) => $options.toSearch && $options.toSearch(...args)), g: `rgba(58, 17, 1,1)`, h: common_vendor.p({ shape: "square", src: $data.storeInfo.logoUrl || _ctx.logoUrl, width: "100rpx", height: "100rpx", radius: "6" }), i: common_vendor.t($data.storeInfo.storeName || ""), j: common_vendor.t($data.storeInfo.salesCount), k: $data.storeInfo.storeName, l: common_vendor.o(_ctx.selectTabList), m: common_vendor.p({ list: $data.tabList, lineColor: "linear-gradient( 90deg, #FE8227 0%, #FE4E12 100%)", activeStyle: { color: "#222222", fontWeight: "600", fontSize: "28rpx" }, inactiveStyle: { color: "#757575", fontSize: "28rpx", fontWeight: "400" } }), n: common_vendor.f($data.products, (subItem, index, i0) => { return { a: subItem.imgUrl, b: common_vendor.t(subItem.productName), c: common_vendor.t(Math.trunc(subItem.price)), d: common_vendor.t($options.getPureDecimal(subItem.price) ? $options.getPureDecimal(subItem.price) : "00"), e: index, f: common_vendor.o(($event) => $options.showProductList(subItem), index) }; }), o: common_vendor.p({ name: "map", color: "#ccc", size: "18" }), p: common_vendor.t($data.storeInfo.address || "--"), q: $data.storeInfo.phone }, $data.storeInfo.phone ? { r: common_vendor.p({ name: "phone", color: "#ccc", size: "18" }), s: common_vendor.t($data.storeInfo.phone || "--") } : {}, { t: $data.storeInfo.descs }, $data.storeInfo.descs ? { v: common_vendor.p({ name: "volume", color: "#ccc", size: "18" }), w: common_vendor.t($data.storeInfo.descs || "--") } : {}, { x: common_vendor.p({ name: "file-text", color: "#ccc", size: "18" }), y: common_vendor.f(_ctx.licenseImagesList, (img, i, i0) => { return { a: common_vendor.o(($event) => $options.previewImage(i), i), b: "dd5fc6f3-7-" + i0, c: common_vendor.p({ shape: "square", lazyLoad: true, src: img, width: "100%", mode: "widthFix", radius: "6" }), d: i }; }), z: $data.divHeight, A: $data.current == 1 }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-dd5fc6f3"]]); _sfc_main.__runtimeHooks = 1; wx.createPage(MiniProgramPage);