"use strict"; const common_vendor = require("../common/vendor.js"); const api_order = require("../api/order.js"); const api_live = require("../api/live.js"); const common_assets = require("../common/assets.js"); const popupBottom = () => "../components/px-popup-bottom/px-popup-bottom.js"; const _sfc_main = { components: { popupBottom }, data() { return { totalNum: 1, orderKey: null, type: null, liveOrderList: [], //下订单的 不在这个页面 liveId: null, // storeId:uni.setStorageSync("storeId"), serviceList: ["免邮发货", "药师服务", "隐私保护"], editShow: false, productId: null, goosDetail: {}, //商品详情 loadding: true, buyText: "立即购买", showStorePicker: false, goodsNum: 0, //商品选择数量 productValueSelect: { price: 0, serviceFee: 0 }, attrs: [], values: [], stores: [], storeNames: [], storeIdx: 0, storeName: "", product: { price: 0, otPrice: 0 }, showModal: false, // 当前轮播的图片 activeBanner: 1, // 购物车数量 cartCount: 0, // 规格弹窗 specVisible: false, // 规格数量 specNum: 1, config: null, showServiceFee: false, selectVal: "", // 链接带的storeId urlStoreId: void 0, // 所选规格门店店铺价格 storePriceList: [], // 所选店铺 storeSelectInfo: {}, // 保存选的规格 choseSpecSubIndex: 0, choseSpecIndex: 0 }; }, onLoad(options) { if (options.productId) { this.productId = options.productId; console.log("接收到的productId:", this.productId); } this.liveId = options.liveId; }, mounted() { this.getliveGoods(); var userInfo = common_vendor.index.getStorageSync("userInfo"); console.log("之前的数据在这里", userInfo); }, onShow() { }, methods: { // 获得key getKey() { api_order.liveOrderKey().then( (res) => { if (res.code == 200) { console.log("下订单的key>>>>", res); this.orderKey = res.orderKey; console.log("key>>>>", this.orderKey); common_vendor.index.navigateTo({ url: "/pages_shop/confirmCreateOrder?orderKey=" + this.orderKey + "&liveId=" + this.liveId + "&productId=" + this.productId + "&totalNum=" + this.totalNum + "&price=" + this.goosDetail.price }); } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { } ); }, // 点击取消/支付订单 operateOrder(type) { let orderId = this.liveOrderList; console.log("orderId>>", orderId); }, // 选择商品数量 goodsNumChange(e) { console.log("当前选择商品数量为: " + e.value); this.totalNum = e.value; }, // 提交 submit() { this.specVisible = false; this.getKey(); }, // 加入购物车 addCart(type) { this.type = type; this.specVisible = true; }, // doAddCart(type) { // if (this.specNum == 0) { // uni.showToast({ // icon: 'none', // title: "库存不足", // }); // return; // } // var isBuy = type == "buy" ? 1 : 0; // let data = { // isBuy: isBuy, // cartNum: this.specNum, // productId: this.productValueSelect.productId, // attrValueId: this.productValueSelect.id // }; // addCart(data).then( // res => { // if (res.code == 200) { // if (type == "buy") { // const selectCarts = [{ // storeId: this.storeId, // data: { // type: this.type, // cartIds: res.id, // } // }] // uni.navigateTo({ // url: '/pages/shopping/confirmOrder?type=' + this.type + '&orderType=' + // this.orderType + '&confirmParam=' + encodeURIComponent(JSON.stringify( // selectCarts)) // }) // } else { // this.getCartCount() // uni.showToast({ // icon: 'success', // title: "添加成功", // }); // } // } else { // uni.showToast({ // icon: 'none', // title: res.msg, // }); // this.getProductDetails() // } // }, // rej => {} // ); // }, // 跳转页面 navgetTo(url) { console.log("跳转"); common_vendor.index.navigateTo({ url }); }, openEditMoney() { this.editShow = true; }, //商品详情 getliveGoods() { api_live.liveGoodsDetail(this.productId).then( (res) => { if (res.code == 200) { console.log("小黄车 商品详情>>>>", res); this.goosDetail = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { } ); } } }; if (!Array) { const _component_uni_badge = common_vendor.resolveComponent("uni-badge"); const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup"); const _easycom_u_number_box2 = common_vendor.resolveComponent("u-number-box"); const _component_popupBottom = common_vendor.resolveComponent("popupBottom"); (_component_uni_badge + _easycom_u_icon2 + _easycom_u_popup2 + _easycom_u_number_box2 + _component_popupBottom)(); } const _easycom_u_icon = () => "../uni_modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_u_popup = () => "../uni_modules/uview-plus/components/u-popup/u-popup.js"; const _easycom_u_number_box = () => "../uni_modules/uview-plus/components/u-number-box/u-number-box.js"; if (!Math) { (_easycom_u_icon + _easycom_u_popup + _easycom_u_number_box)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { var _a; return common_vendor.e({ a: $data.goosDetail.imgUrl, b: $data.product.productType == 2 }, $data.product.productType == 2 ? {} : {}, { c: common_vendor.t($data.goosDetail.price), d: common_vendor.t($data.goosDetail.otPrice), e: common_vendor.t($data.goosDetail.sales), f: common_vendor.f($data.serviceList, (item, index, i0) => { return { a: common_vendor.t(item), b: index }; }), g: common_assets._imports_0$9, h: common_assets._imports_1$6, i: common_vendor.o(($event) => $options.openEditMoney()), j: $data.editShow }, $data.editShow ? { k: common_vendor.o(($event) => _ctx.cancelEditMoney()), l: common_vendor.o(($event) => _ctx.cancelEditMoney()), m: common_vendor.o(($event) => _ctx.cancelEditMoney()) } : {}, { n: common_vendor.t(), o: common_vendor.o(($event) => $options.navgetTo("/pages_shop/store?liveId=" + $data.liveId)), p: $data.product.description, q: common_assets._imports_2$5, r: common_vendor.o(($event) => $options.navgetTo("./store")), s: common_assets._imports_3$1, t: common_vendor.p({ size: "small", text: $data.cartCount, absolute: "rightTop", type: "error" }), v: common_vendor.o(($event) => $options.navgetTo("./cart")), w: common_vendor.o(($event) => $options.addCart("cart")), x: common_vendor.t($data.buyText), y: common_vendor.o(($event) => $options.addCart("buy")), z: ((_a = $data.goosDetail) == null ? void 0 : _a.imgUrl) || _ctx.$img.img, A: common_vendor.t($data.goosDetail.productName), B: common_vendor.t($data.goosDetail.price ? $data.goosDetail.price.toFixed(2) : "0.00"), C: common_vendor.t($data.goosDetail.sales), D: common_vendor.f($data.storePriceList, (item, index, i0) => { return { a: common_vendor.t(item.price.toFixed(2)), b: common_vendor.t(_ctx.utils.formatSalesNum(item.sales)), c: common_vendor.t(item.storeName), d: "14e5f6c8-3-" + i0 + ",14e5f6c8-2", e: index, f: common_vendor.n($data.productValueSelect.storeId == item.storeId ? "item hover" : "item"), g: common_vendor.o(($event) => _ctx.pickerStore(item, index), index) }; }), E: common_vendor.p({ name: "arrow-right", color: "#000", size: "14" }), F: common_vendor.p({ show: $data.showStorePicker, round: 16, mode: "bottom" }), G: common_vendor.o($options.goodsNumChange), H: common_vendor.o(($event) => $data.goodsNum = $event), I: common_vendor.p({ bgColor: "#ececec", modelValue: $data.goodsNum }), J: common_vendor.o((...args) => $options.submit && $options.submit(...args)), K: common_vendor.sr("popup", "14e5f6c8-1"), L: common_vendor.p({ visible: $data.specVisible, title: " ", radius: "32", maxHeight: "800" }) }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createPage(MiniProgramPage);