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
13 KiB
2 lines
13 KiB
11 months ago
|
import{o as e,c as s,r as a,y as o,Z as t,u as l,v as i,w as d,n,i as c,e as u,a as r,f,t as m,b as p,d as g,F as _,k as h,V as k,x,S}from"./index-ae8bbb19.js";import{_ as v}from"./mp-html.c15e78a1.js";import{r as y}from"./uni-app.es.ee1d5b08.js";import{_ as C}from"./u-modal.b5d074c6.js";import{W as w}from"./wxofficial.cfa745b7.js";import{S as b,a as I,C as P}from"./Comment.4c49b5d2.js";import{C as T}from"./index.88bc1a11.js";import{h as B}from"./color.813a9497.js";import{p as V,b as j,d as L}from"./task.dfabb3d7.js";import{G as N}from"./index.f13fd87d.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import{C as D}from"./index.002ef29d.js";import{d as R}from"./index.c0835ba6.js";import{t as $}from"./cart.414ee15f.js";import"./u-loading.01f91c7b.js";import"./u-popup.d74d5514.js";import"./u-icon.b463ad8a.js";import"./comment.92b0fbb1.js";import"./index.0c0be40a.js";const M=A({components:{ShareSheet:b,CustomerBtn:T,SlideImage:I,SkuPopup:A({components:{GoodsSkuPopup:N},emits:["update:modelValue"],props:{modelValue:{Type:Boolean,default:!1},skuMode:{type:Number,default:1},active:{type:Object,default:{}},goods:{type:Object,default:{}}},data:()=>({goodsInfo:{}}),computed:{activedBtnBackgroundColor(){return B(this.appTheme.mainBg,.1)}},created(){const e=this,{goods:s}=e;e.goodsInfo={_id:s.goods_id,name:s.goods_name,goods_thumb:s.goods_image,sku_list:e.getSkuList(),spec_list:e.getSpecList()}},methods:{onChangeValue(e){this.$emit("update:modelValue",e)},getSkuList(){const e=this,{goods:{goods_name:s,goods_image:a,skuList:o}}=e,t=[];return o.forEach((o=>{t.push({_id:o.id,goods_sku_id:o.goods_sku_id,goods_id:o.goods_id,goods_name:s,image:o.image_url?o.image_url:a,price:100*o.goods_price,stock:o.stock_num,spec_value_ids:o.spec_value_ids,sku_name_arr:e.getSkuNameArr(o.spec_value_ids)})})),t},getSkuNameArr(e){const s=this,a=[];return e&&e.forEach(((e,o)=>{const t=s.getSpecValueName(e,o);a.push(t)})),a.length?a:["默认"]},getSpecValueName(e,s){const{goods:{specList:a}}=this;return a[s].valueList.find((s=>s.spec_value_id==e)).spec_value},getSpecList(){const{goods:{specList:e}}=this,s=[];return e.forEach((e=>{const a=[];e.valueList.forEach((e=>{a.push({name:e.spec_value})})),s.push({name:e.spec_name,list:a})})),s.length?s:[{name:"默认",list:[{name:"默认"}]}]},openSkuPopup(){},closeSkuPopup(){},buyNow(e){V({activeId:this.active.active_id,goodsSkuId:e.goods_sku_id}).then((e=>{const s=e.data.taskId;this.$navTo("pages/bargain/task",{taskId:s})})),this.onChangeValue(!1)}}},[["render",function(o,t,l,i,d,n){const c=a("goods-sku-popup");return e(),s(c,{modelValue:l.modelValue,onInput:n.onChangeValue,"border-radius":"20",localdata:d.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,onBuyNow:n.buyNow,buyNowText:"立即砍价",maxBuyNum:1},null,8,["modelValue","onInput","localdata","mode","priceColor","buyNowBackgroundColor","addCartColor","addCartBackgroundColor","activedStyle","onOpen","onClose","onBuyNow"])}]]),Comment:P,CountDown:D},mixins:[w],data:()=>({isLoading:!0,showSkuPopup:!1,skuMode:3,showShareSheet:!1,showRules:!1,posterApiCall:j,activeId:null,goodsId:null,active:{},goods:{},setting:null,isPartake:null,taskId:null,cartTotal:0,isShowCustomerBtn:!1}),async onLoad(e){this.onRecordQuery(e),this.onRefreshPage(),this.isShowCustomerBtn=await o.isShowCustomerBtn()},methods:{onRecordQuery(e){const s=t(e);this.activeId=e.activeId?parseInt(e.activeId):parseInt(s.aid),this.goodsId=e.goodsId?parseInt(e.goodsId):parseInt(s.gid)},onRefreshPage(){const e=this;e.isLoading=!0,Promise.all([e.getActiveDetail(),e.getGoodsDetail(),e.getCartTotal()]).then((()=>e.setWxofficialShareData())).then((()=>e.isLoading=!1))},getActiveDetail(){const e=this;return new Promise(((s,a)=>{L(e.activeId).then((a=>{e.active=a.data.active,e.setting=a.data.setting,e.isP
|