123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_live = require("../api/live.js");
- require("../common/request.js");
- const _sfc_main = {
- data() {
- return {
- products: [],
- liveId: null,
- statusBarHeight: common_vendor.index.getWindowInfo().statusBarHeight,
- menuRight: common_vendor.index.getStorageSync("menuInfo").menuRight,
- menuWidth: common_vendor.index.getStorageSync("menuInfo").menuWidth,
- opacity: 0,
- opacityTxt: 0,
- tabbar: [{
- name: "\u5546\u54C1"
- }, {
- name: "\u5546\u5BB6"
- }],
- current: 0,
- storeInfo: {},
- divHeight: "0px",
- allCates: [],
- cates: [],
- subCates: [],
- cateSelect: 0,
- advs: [],
- from: ""
- };
- },
- onLoad(options) {
- if (options.liveId) {
- this.liveId = options.liveId;
- console.log("\u63A5\u6536\u5230\u7684liveId:", this.liveId);
- }
- this.storeId = options.storeId || "";
- this.from = options.from || "";
- if (this.storeId) {
- this.getStoreInfo();
- this.getProductCate();
- } else {
- common_vendor.index.showToast({
- title: "storeId\u4E0D\u5B58\u5728~",
- 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("\u5C0F\u9EC4\u8F66 \u5E97\u94FA\u5C55\u793A>>>>", 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 || ""
- });
- }
- },
- 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: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (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: "#333",
- size: "20"
- }),
- d: $data.opacity >= 0.6 ? "#f7f7f7" : "#fff",
- e: common_vendor.o((...args) => $options.toSearch && $options.toSearch(...args)),
- f: `calc(100vw - 100rpx - ${$data.menuRight} - ${$data.menuWidth})`,
- g: `rgba(58, 17, 1,${$data.opacity})`,
- 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($options.clickTab),
- m: common_vendor.p({
- list: $data.tabbar,
- current: $data.current
- }),
- n: common_vendor.p({
- bgColor: "#fff",
- ["offset-top"]: $data.statusBarHeight + 44
- }),
- o: 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)
- };
- }),
- p: common_vendor.f($data.advs, (item, index, i0) => {
- return {
- a: item.imageUrl,
- b: index,
- c: common_vendor.o(($event) => $options.handleAdvClick(item), index)
- };
- }),
- q: 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)
- };
- }),
- r: $data.divHeight,
- s: $data.current == 0 ? "flex" : "none",
- t: common_vendor.p({
- name: "map",
- color: "#ccc",
- size: "18"
- }),
- v: common_vendor.t($data.storeInfo.address || "--"),
- w: $data.storeInfo.phone
- }, $data.storeInfo.phone ? {
- x: common_vendor.p({
- name: "phone",
- color: "#ccc",
- size: "18"
- }),
- y: common_vendor.t($data.storeInfo.phone || "--")
- } : {}, {
- z: $data.storeInfo.descs
- }, $data.storeInfo.descs ? {
- A: common_vendor.p({
- name: "volume",
- color: "#ccc",
- size: "18"
- }),
- B: common_vendor.t($data.storeInfo.descs || "--")
- } : {}, {
- C: common_vendor.p({
- name: "file-text",
- color: "#ccc",
- size: "18"
- }),
- D: common_vendor.f(_ctx.licenseImagesList, (img, i, i0) => {
- return {
- a: common_vendor.o(($event) => $options.previewImage(i)),
- b: "f7aaac1e-8-" + i0,
- c: common_vendor.p({
- shape: "square",
- lazyLoad: true,
- src: img,
- width: "100%",
- mode: "widthFix",
- radius: "6"
- }),
- d: i
- };
- }),
- E: $data.divHeight,
- F: $data.current == 1
- });
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f7aaac1e"], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages_shop/store.vue"]]);
- _sfc_main.__runtimeHooks = 1;
- wx.createPage(MiniProgramPage);
|