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.
2 lines
12 KiB
2 lines
12 KiB
11 months ago
|
import{p 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,l as p,i as g,j as f,y as _,t as h,z as k,Z as S,v as C,x as y,U as w}from"./index-4ddb689d.js";import{_ as x}from"./mp-html.2b6407c3.js";import{r as b}from"./uni-app.es.24af5d4f.js";import{W as v}from"./wxofficial.956096a5.js";import{p as P,d as T}from"./index.85d62ccb.js";import{a as I,t as B}from"./cart.86d426b5.js";import{G as L}from"./SpecType.cb8615db.js";import{R as N}from"./index.5efbe1fd.js";import{S as V,a as j,C as A}from"./Comment.8cab973f.js";import{C as $}from"./index.cdfc996d.js";import{h as M}from"./color.813a9497.js";import{G as U}from"./index.0d19d98b.js";import{_ as E}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as R}from"./u-popup.37b3343e.js";import"./comment.083546cf.js";import"./u-icon.e981d1c2.js";import"./index.1169d7d7.js";const D={components:{GoodsSkuPopup:U},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=E({components:{Recommended:N,ShareSheet:V,CustomerBtn:$,SlideImage:j,SkuPopup:E(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:E({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:
|