"use strict";const e=require("../common/vendor.js"),h=require("../api/live.js"),v=require("../api/order.js"),l=require("../common/assets.js"),I=()=>"../components/px-popup-bottom/px-popup-bottom.js",_={components:{popupBottom:I},data(){return{storeInfo:{},goodsId:null,totalNum:1,orderKey:null,type:null,liveOrderList:[],liveId:null,storeId:null,serviceList:["免邮发货","药师服务","隐私保护"],editShow:!1,productId:null,goosDetail:{},loadding:!0,buyText:"立即购买",showStorePicker:!1,goodsNum:0,attrs:[],values:[],stores:[],storeNames:[],storeIdx:0,storeName:"",product:{price:0,otPrice:0},showModal:!1,activeBanner:1,cartCount:0,specVisible:!1,config:null,showServiceFee:!1,selectVal:"",urlStoreId:void 0,storePriceList:[],storeSelectInfo:{},choseSpecSubIndex:0,choseSpecIndex:0}},onLoad(o){console.log("商品详情options",o),o.productId&&(this.productId=o.productId),this.liveId=o.liveId,this.goodsId=o.goodsId,o.storeId?this.storeId=o.storeId||"":e.index.showToast({title:"storeId不存在~",icon:"none"})},mounted(){this.getliveGoods(),e.index.getStorageSync("userInfo"),this.getSearchStore()},onShow(){},methods:{getSearchStore(){if(!this.storeId)return;h.store(this.storeId,"",this.liveId).then(s=>{s.code==200?(console.log("查询店铺>>>>",s),this.storeInfo=s.data):e.index.showToast({title:s.msg,icon:"none"})},s=>{})},getliveStore(){let o={pageSize:10,page:1};liveStore(this.liveId,o).then(s=>{s.code==200?(console.log("小黄车 店铺展示>>>>",s),this.products=s.data):e.index.showToast({title:s.msg,icon:"none"})},s=>{})},doAddCart(o){if(this.totalNum==0){e.index.showToast({icon:"none",title:"库存不足"});return}o=="buy"?this.getKey():(this.getCartCount(),e.index.showToast({icon:"success",title:"添加成功"}))},getCartCount(){let o={productId:this.productId,liveId:this.liveId,goodsId:this.goodsId||"",cartNum:this.totalNum};v.addLiveCart(o).then(s=>{s.code==200&&(console.log("加购物车啦",s),this.cartCount=s.data)},s=>{})},getKey(){v.liveOrderKey().then(o=>{o.code==200?(console.log("下订单的key>>>>",o),this.orderKey=o.orderKey,console.log("key>>>>",this.orderKey),e.index.navigateTo({url:"/pages_shop/confirmCreateOrder?type=goods&orderKey="+this.orderKey+"&liveId="+this.liveId+"&productId="+this.productId+"&totalNum="+this.totalNum+"&price="+this.goosDetail.price})):e.index.showToast({title:o.msg,icon:"none"})},o=>{})},operateOrder(o){let s=this.liveOrderList;console.log("orderId>>",s)},goodsNumChange(o){console.log("当前选择商品数量为: "+o.value),this.totalNum=o.value},submit(){this.specVisible=!1,this.doAddCart(this.type)},addCart(o){this.type=o,this.specVisible=!0},navgetTo(o){console.log("跳转"),e.index.navigateTo({url:o})},openEditMoney(){this.editShow=!0},cancelEditMoney(){this.editShow=!1},getliveGoods(){this.productId&&h.liveGoodsDetail(this.productId).then(o=>{o.code==200?(console.log("小黄车 商品详情>>>>",o),this.goosDetail=o.data):e.index.showToast({title:o.msg,icon:"none"})},o=>{})}}};if(!Array){const o=e.resolveComponent("uni-badge"),s=e.resolveComponent("u-icon"),c=e.resolveComponent("u-popup"),d=e.resolveComponent("u-number-box"),t=e.resolveComponent("popupBottom");(o+s+c+d+t)()}const f=()=>"../uni_modules/uview-plus/components/u-icon/u-icon.js",y=()=>"../uni_modules/uview-plus/components/u-popup/u-popup.js",b=()=>"../uni_modules/uview-plus/components/u-number-box/u-number-box.js";Math||(f+y+b)();function S(o,s,c,d,t,r){var u,p,a,g;return e.e({a:t.goosDetail.imgUrl,b:t.product.productType==2},t.product.productType==2?{}:{},{c:e.t(t.goosDetail.price),d:e.t(t.goosDetail.otPrice),e:e.t(t.goosDetail.sales),f:e.f(t.serviceList,(i,n,m)=>({a:e.t(i),b:n})),g:l._imports_0$7,h:l._imports_1$7,i:e.o(i=>r.openEditMoney()),j:t.editShow},t.editShow?{k:e.o(i=>r.cancelEditMoney()),l:e.o(i=>r.cancelEditMoney()),m:e.o(i=>r.cancelEditMoney())}:{},{n:t.storeInfo},t.storeInfo?{o:((u=t.storeInfo)==null?void 0:u.logoUrl)||o.$img.img,p:e.t((p=t.storeInfo)==null?void 0:p.storeName),q:e.t((a=t.storeInfo)==null?void 0:a.salesCount),r:e.o(i=>r.navgetTo("/pages_shop/store?liveId="+t.liveId+"&storeId="+t.storeId))}:{},{s:l._imports_2$4,t:e.o(i=>r.navgetTo("/pages_shop/store?liveId="+t.liveId+"&storeId="+t.storeId)),v:l._imports_3$1,w:e.o(i=>r.navgetTo("./storeOrderRefundList")),x:l._imports_4$1,y:e.p({size:"small",text:t.cartCount,absolute:"rightTop",type:"error"}),z:e.o(i=>r.navgetTo("./cart")),A:e.o(i=>r.addCart("cart")),B:e.t(t.buyText),C:e.o(i=>r.addCart("buy")),D:((g=t.goosDetail)==null?void 0:g.imgUrl)||o.$img.img,E:e.t(t.goosDetail.productName),F:e.t(t.goosDetail.price?t.goosDetail.price.toFixed(2):"0.00"),G:e.t(t.goosDetail.sales),H:e.f(t.storePriceList,(i,n,m)=>({a:e.t(i.price.toFixed(2)),b:e.t(o.utils.formatSalesNum(i.sales)),c:e.t(i.storeName),d:"14e5f6c8-3-"+m+",14e5f6c8-2",e:n,f:e.n(o.productValueSelect.storeId==i.storeId?"item hover":"item"),g:e.o(C=>o.pickerStore(i,n),n)})),I:e.p({name:"arrow-right",color:"#000",size:"14"}),J:e.p({show:t.showStorePicker,round:16,mode:"bottom"}),K:e.o(r.goodsNumChange),L:e.o(i=>t.goodsNum=i),M:e.p({bgColor:"#ececec",modelValue:t.goodsNum}),N:e.o((...i)=>r.submit&&r.submit(...i)),O:e.sr("popup","14e5f6c8-1"),P:e.p({visible:t.specVisible,title:" ",radius:"32",maxHeight:"800"})})}const w=e._export_sfc(_,[["render",S]]);wx.createPage(w);