123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- "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 {
- products: [],
- liveId: 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,
- // storeId: "",
- 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) {
- if (options.liveId) {
- this.liveId = options.liveId;
- console.log("接收到的liveId:", this.liveId);
- }
- this.storeId = options.storeId || "";
- this.from = options.from || "";
- if (this.storeId) {
- this.getStoreInfo();
- this.getProductCate();
- } else {
- common_vendor.index.showToast({
- title: "storeId不存在~",
- icon: "none"
- });
- }
- },
- mounted() {
- this.getliveStore();
- },
- 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: {
- //小黄车 店铺展示
- 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) => {
- }
- );
- },
- 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 || {};
- } else {
- common_vendor.index.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 {
- common_vendor.index.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");
- const _easycom_u_sticky2 = common_vendor.resolveComponent("u-sticky");
- (_easycom_u_icon2 + _easycom_u_image2 + _easycom_u_tabs2 + _easycom_u_sticky2)();
- }
- 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";
- const _easycom_u_sticky = () => "../uni_modules/uview-plus/components/u-sticky/u-sticky.js";
- if (!Math) {
- (_easycom_u_icon + _easycom_u_image + _easycom_u_tabs + _easycom_u_sticky)();
- }
- 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$1,
- e: $data.opacity >= 0.6 ? "#6b4d40" : "#fff",
- f: common_vendor.o((...args) => $options.toSearch && $options.toSearch(...args)),
- g: `calc(100vw - 100rpx - ${$data.menuRight} - ${$data.menuWidth})`,
- h: `rgba(58, 17, 1,${$data.opacity})`,
- i: common_vendor.p({
- shape: "square",
- src: $data.storeInfo.logoUrl || _ctx.logoUrl,
- width: "100rpx",
- height: "100rpx",
- radius: "6"
- }),
- j: common_vendor.t($data.storeInfo.storeName || ""),
- k: common_vendor.t($data.storeInfo.salesCount),
- l: $data.storeInfo.storeName,
- m: common_vendor.o($options.clickTab),
- n: common_vendor.p({
- list: $data.tabbar,
- current: $data.current
- }),
- o: common_vendor.p({
- bgColor: "#fff",
- ["offset-top"]: $data.statusBarHeight + 44
- }),
- p: common_vendor.f($data.cates, (item, index, i0) => {
- return {
- a: common_vendor.t(item.cateName),
- b: index,
- c: common_vendor.n($data.cateSelect == item.cateId ? "item active" : "item"),
- d: common_vendor.o(($event) => $options.choseCate(item), index)
- };
- }),
- q: common_vendor.f($data.advs, (item, index, i0) => {
- return {
- a: item.imageUrl,
- b: index,
- c: common_vendor.o(($event) => $options.handleAdvClick(item), index)
- };
- }),
- r: common_vendor.f($data.products, (subItem, index, i0) => {
- return {
- a: subItem.imgUrl,
- b: common_vendor.t(subItem.productName),
- c: index,
- d: common_vendor.o(($event) => $options.showProductList(subItem), index)
- };
- }),
- s: $data.divHeight,
- t: $data.current == 0 ? "flex" : "none",
- v: common_vendor.p({
- name: "map",
- color: "#ccc",
- size: "18"
- }),
- w: common_vendor.t($data.storeInfo.address || "--"),
- x: $data.storeInfo.phone
- }, $data.storeInfo.phone ? {
- y: common_vendor.p({
- name: "phone",
- color: "#ccc",
- size: "18"
- }),
- z: common_vendor.t($data.storeInfo.phone || "--")
- } : {}, {
- A: $data.storeInfo.descs
- }, $data.storeInfo.descs ? {
- B: common_vendor.p({
- name: "volume",
- color: "#ccc",
- size: "18"
- }),
- C: common_vendor.t($data.storeInfo.descs || "--")
- } : {}, {
- D: common_vendor.p({
- name: "file-text",
- color: "#ccc",
- size: "18"
- }),
- E: common_vendor.f(_ctx.licenseImagesList, (img, i, i0) => {
- return {
- a: common_vendor.o(($event) => $options.previewImage(i), i),
- b: "dd5fc6f3-8-" + i0,
- c: common_vendor.p({
- shape: "square",
- lazyLoad: true,
- src: img,
- width: "100%",
- mode: "widthFix",
- radius: "6"
- }),
- d: i
- };
- }),
- F: $data.divHeight,
- G: $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);
|