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-sharp-goods-index.4bb...

2 lines
11 KiB

11 months ago
import{o,c as e,r as s,z as a,Z as t,v as i,x as l,w as d,n,i as u,e as c,a as r,f as m,t as p,b as f,d as g,F as _,l as h,U as S,y as k}from"./index-4ddb689d.js";import{_ as v}from"./mp-html.2b6407c3.js";import{r as T}from"./uni-app.es.24af5d4f.js";import{W as x}from"./wxofficial.956096a5.js";import{S as C,a as y,C as w}from"./Comment.8cab973f.js";import{C as I}from"./index.cdfc996d.js";import{h as b}from"./color.813a9497.js";import{G as B}from"./index.0d19d98b.js";import{_ as P}from"./_plugin-vue_export-helper.1b428a4d.js";import{C as G}from"./index.994d85b2.js";import{p as N,d as A}from"./goods.d51b766f.js";import{t as E}from"./cart.86d426b5.js";import{A as L,G as j}from"./GoodsStatus.54b07d63.js";import"./u-popup.37b3343e.js";import"./u-icon.e981d1c2.js";import"./comment.083546cf.js";import"./index.1169d7d7.js";const V=P({components:{ShareSheet:C,CustomerBtn:I,SlideImage:y,SkuPopup:P({components:{GoodsSkuPopup:B},emits:["update:modelValue"],props:{modelValue:{Type:Boolean,default:!1},skuMode:{type:Number,default:1},active:{type:Object,default:{}},noStockText:{Type:String,default:"该商品已抢完"},goods:{type:Object,default:{}}},data:()=>({goodsInfo:{}}),computed:{activedBtnBackgroundColor(){return b(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()}},methods:{onChangeValue(o){this.$emit("update:modelValue",o)},findGoodsInfo:()=>new Promise(((o,e)=>{o(goodsInfo)})),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.seckill_price,stock:a.seckill_stock,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:"默认"}]}]},openSkuPopup(){},closeSkuPopup(){},buyNow(o){const e=this;e.$navTo("pages/checkout/index",{mode:"sharp",activeTimeId:e.active.active_time_id,sharpGoodsId:e.goods.sharp_goods_id,goodsSkuId:o.goods_sku_id,goodsNum:o.buy_num}),e.onChangeValue(!1)}}},[["render",function(a,t,i,l,d,n){const u=s("goods-sku-popup");return o(),e(u,{modelValue:i.modelValue,onInput:n.onChangeValue,"border-radius":"20",localdata:d.goodsInfo,mode:i.skuMode,maskCloseAble:!0,priceColor:a.appTheme.mainBg,buyNowBackgroundColor:a.appTheme.mainBg,addCartColor:a.appTheme.viceText,addCartBackgroundColor:a.appTheme.viceBg,activedStyle:{color:a.appTheme.mainBg,borderColor:a.appTheme.mainBg,backgroundColor:n.activedBtnBackgroundColor},onOpen:n.openSkuPopup,onClose:n.closeSkuPopup,onBuyNow:n.buyNow,buyNowText:"立即购买",maxBuyNum:i.goods.limit_num,noStockText:i.noStockText},null,8,["modelValue","onInput","localdata","mode","priceColor","buyNowBackgroundColor","addCartColor","addCartBackgroundColor","activedStyle","onOpen","onClose","onBuyNow","maxBuyNum","noStockText"])}]]),Comment:w,CountDown:G},mixins:[x],data:()=>({isLoading:!0,ActiveStatusEnum:L,GoodsStatusEnum:j,showSkuPopup:!1,skuMode:3,noStockText:"该商品已抢完",showShareSheet:!1,posterApiCall:N,activeTimeId:null,sharpGoodsId:null,active:{},goods:{},cartTotal:0,isShowCustomerBtn:!1}),async onLoad(o){this.onRecordQuery(o),this.onRefreshPage(),this.isShowCustomerBtn=await a.isShowCustomerBtn()},methods:{onRecordQuery(o){const e=t(o);this.activeTimeId=o.activeTimeId?parseInt(o.activeTimeId):parseInt(e.aid),this.sharpGoodsId=o.sharpGoodsId?parseInt(o.sharpGoodsId):parseInt(e.gid)},onRefreshPage(){const o=this;o.isLoading=!0,Promise.all([o.getActiveDetail(),o.getCartTotal()]).then((()=>{cons