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-bargain-goods-index.7...

2 lines
13 KiB

11 months ago
import{o as e,c as s,r as a,z as o,Z as t,v as l,x 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 _,l as h,U as k,y as x,j as S}from"./index-4ddb689d.js";import{_ as v}from"./mp-html.2b6407c3.js";import{r as y}from"./uni-app.es.24af5d4f.js";import{_ as C}from"./u-modal.9219359e.js";import{W as w}from"./wxofficial.956096a5.js";import{S as b,a as I,C as P}from"./Comment.8cab973f.js";import{C as T}from"./index.cdfc996d.js";import{h as B}from"./color.813a9497.js";import{p as j,b as L,d as V}from"./task.812dd4ac.js";import{G as N}from"./index.0d19d98b.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import{C as D}from"./index.994d85b2.js";import{d as R}from"./index.85d62ccb.js";import{t as $}from"./cart.86d426b5.js";import"./u-loading.7bd69747.js";import"./u-popup.37b3343e.js";import"./u-icon.e981d1c2.js";import"./comment.083546cf.js";import"./index.1169d7d7.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){j({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:L,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)=>{V(e.activeId).then((a=>{e.active=a.data.active,e.setting=a.data.set