You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/public/assets/pages-goods-detail.a58fb393.js

2 lines
12 KiB

11 months ago
import{m as o,o as e,c as s,r as a,$ as t,w as l,a as d,b as i,d as n,F as u,f as r,n as c,e as m,k as p,i as g,S as f,x as _,t as h,y as k,Z as S,u as C,v as y,V as w}from"./index-ae8bbb19.js";import{_ as x}from"./mp-html.c15e78a1.js";import{r as b}from"./uni-app.es.ee1d5b08.js";import{W as v}from"./wxofficial.cfa745b7.js";import{p as P,d as T}from"./index.c0835ba6.js";import{a as I,t as B}from"./cart.414ee15f.js";import{G as L}from"./SpecType.07403f22.js";import{R as V}from"./index.b9e5c444.js";import{S as N,a as j,C as A}from"./Comment.4c49b5d2.js";import{C as $}from"./index.88bc1a11.js";import{h as M}from"./color.813a9497.js";import{G as E}from"./index.f13fd87d.js";import{_ as U}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as R}from"./u-popup.d74d5514.js";import"./comment.92b0fbb1.js";import"./u-icon.b463ad8a.js";import"./index.0c0be40a.js";const D={components:{GoodsSkuPopup:E},emits:["update:modelValue"],props:{modelValue:{Type:Boolean,default:!1},skuMode:{type:Number,default:1},goods:{type:Object,default:{}}},data:()=>({goodsInfo:{},maxBuyNum:null}),computed:{activedBtnBackgroundColor(){return M(this.appTheme.mainBg,.1)}},created(){const o=this,{goods:e}=o;o.goodsInfo={_id:e.goods_id,name:e.goods_name,goods_thumb:e.goods_image,sku_list:o.getSkuList(),spec_list:o.getSpecList()},o.maxBuyNum=o.getMaxBuyNum()},methods:{onChangeValue(o){this.$emit("update:modelValue",o)},getSkuList(){const o=this,{goods:{goods_name:e,goods_image:s,skuList:a}}=o,t=[];return a.forEach((a=>{t.push({_id:a.id,goods_sku_id:a.goods_sku_id,goods_id:a.goods_id,goods_name:e,image:a.image_url?a.image_url:s,price:100*a.goods_price,stock:a.stock_num,spec_value_ids:a.spec_value_ids,sku_name_arr:o.getSkuNameArr(a.spec_value_ids)})})),t},getSkuNameArr(o){const e=this,s=[];return o&&o.forEach(((o,a)=>{const t=e.getSpecValueName(o,a);s.push(t)})),s.length?s:["默认"]},getSpecValueName(o,e){const{goods:{specList:s}}=this;return s[e].valueList.find((e=>e.spec_value_id==o)).spec_value},getSpecList(){const{goods:{specList:o}}=this,e=[];return o.forEach((o=>{const s=[];o.valueList.forEach((o=>{s.push({name:o.spec_value})})),e.push({name:o.spec_name,list:s})})),e.length?e:[{name:"默认",list:[{name:"默认"}]}]},getMaxBuyNum(){const{goods:o}=this;return o.is_restrict?o.restrict_single:null},openSkuPopup(){},closeSkuPopup(){},addCart(e){const s=this,{goods_id:a,goods_sku_id:t,buy_num:l}=e;I(a,t,l).then((e=>{s.$toast(e.message),s.onChangeValue(!1);const a=e.data.cartTotal;o(a),s.$emit("addCart",a)}))},buyNow(o){this.$navTo("pages/checkout/index",{mode:"buyNow",goodsId:o.goods_id,goodsSkuId:o.goods_sku_id,goodsNum:o.buy_num}),this.onChangeValue(!1)}}};const G="goods.service/list";const W=U({components:{Recommended:V,ShareSheet:N,CustomerBtn:$,SlideImage:j,SkuPopup:U(D,[["render",function(o,t,l,d,i,n){const u=a("goods-sku-popup");return e(),s(u,{modelValue:l.modelValue,onInput:n.onChangeValue,"border-radius":"20",localdata:i.goodsInfo,mode:l.skuMode,maskCloseAble:!0,priceColor:o.appTheme.mainBg,buyNowBackgroundColor:o.appTheme.mainBg,addCartColor:o.appTheme.viceText,addCartBackgroundColor:o.appTheme.viceBg,activedStyle:{color:o.appTheme.mainBg,borderColor:o.appTheme.mainBg,backgroundColor:n.activedBtnBackgroundColor},onOpen:n.openSkuPopup,onClose:n.closeSkuPopup,onAddCart:n.addCart,onBuyNow:n.buyNow,buyNowText:"立即购买",maxBuyNum:i.maxBuyNum},null,8,["modelValue","onInput","localdata","mode","priceColor","buyNowBackgroundColor","addCartColor","addCartBackgroundColor","activedStyle","onOpen","onClose","onAddCart","onBuyNow","maxBuyNum"])}]]),Comment:A,Service:U({props:{goodsId:{type:Number,default:null}},data:()=>({isLoading:!0,showPopup:!1,list:[]}),created(){this.getServiceList()},methods:{getServiceList(){const o=this;var e;o.isLoading=!0,(e=o.goodsId,t.get(G,{goodsId:e})).then((e=>o.list=e.data.list)).finally((()=>o.isLoading=!1))},handlePopup(){this.showPopup=!this.showPopup}}},[["render",function(o,a,t,k,S,C){const y=p,w=g,x=f,v=b(_("u-popup"),R);return S.list.length?(e(),s(w,{key:0,class:"service-wrapper",style:c(o.appThemeStyle)},{default: