add
yj
2024-12-05 a160d838f9c0a79dfc2f18e7cd46bdd4faa59c6d
1
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/product/detail"],{4277:function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"c",(function(){return a})),i.d(e,"a",(function(){return c}));var c={uParse:function(){return Promise.all([i.e("common/vendor"),i.e("components/u-parse/u-parse")]).then(i.bind(null,"787f"))}},s=function(){var t=this,e=t.$createElement,i=(t._self._c,t.style(600)),c=!t.product.priceTag&&(t.isVip?t.selectedSku.vipPrice?t.selectedSku.vipPrice:t.product.vipPrice:t.selectedSku.price?t.selectedSku.price:t.product.price)<(t.selectedSku.price?t.selectedSku.originalPrice:t.product.originalPrice)?parseInt((t.isVip?t.selectedSku.vipPrice?t.selectedSku.vipPrice:t.product.vipPrice:t.selectedSku.price?t.selectedSku.price:t.product.price)/(t.selectedSku.originalPrice?t.selectedSku.originalPrice:t.product.originalPrice)*100):null,s=t.couponList.length,a=t.product.appraisePage&&t.product.appraisePage.items.length>0,o=t.product.img?t.style(200):null;t.$mp.data=Object.assign({},{$root:{m0:i,m1:c,g0:s,g1:a,m2:o}})},a=[]},"57b2":function(t,e,i){"use strict";i.r(e);var c=i("b63b"),s=i.n(c);for(var a in c)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return c[t]}))}(a);e["default"]=s.a},"6caa":function(t,e,i){"use strict";(function(t,e){var c=i("47a9");i("a346");c(i("3240"));var s=c(i("a381"));t.__webpack_require_UNI_MP_PLUGIN__=i,e(s.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},"8c91":function(t,e,i){"use strict";var c=i("beab"),s=i.n(c);s.a},a381:function(t,e,i){"use strict";i.r(e);var c=i("4277"),s=i("57b2");for(var a in s)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(a);i("8c91");var o=i("828b"),u=Object(o["a"])(s["default"],c["b"],c["c"],!1,null,null,null,!1,c["a"],void 0);e["default"]=u.exports},b63b:function(t,e,i){"use strict";(function(t){var c=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=c(i("7eb4")),a=c(i("ee10")),o={components:{uParse:function(){Promise.all([i.e("common/vendor"),i.e("components/u-parse/u-parse")]).then(function(){return resolve(i("787f"))}.bind(null,i)).catch(i.oe)},uniNumberBox:function(){i.e("components/uni-number-box").then(function(){return resolve(i("d538"))}.bind(null,i)).catch(i.oe)}},data:function(){return{style:this.$api.style,spuId:void 0,product:{freightTemplate:void 0,skuList:[],categoryList:[],appraisePage:void 0},isVip:!1,specClass:"none",specSelected:[],buyNum:1,selectedSku:{},selectedSkuIndex:-1,toggleCallback:void 0,maskState:0,couponList:[],submiting:!1,activityType:void 0,activityId:void 0,activity:void 0}},onShow:function(){this.isVip=this.$api.isVip()},onLoad:function(t){this.spuId=t.id,this.loadData()},onShareAppMessage:function(){return{title:(1===this.activityType?"立即拼团-":"好货分享-")+this.product.title,imageUrl:this.product.img,path:"/pages/product/detail?id="+this.product.id+(this.product.groupShop?"&gid="+this.product.groupShop.id:"")}},methods:{loadData:function(){var e=this;return(0,a.default)(s.default.mark((function i(){var c;return s.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:c=e,t.showLoading({title:"正在加载"}),c.$api.request("product","getProduct",{spuId:c.spuId},(function(e){t.hideLoading(),c.$api.msg(e.errmsg)})).then((function(e){for(var i=0,s=e.data.skuList,a=0;a<s.length;a++){i+=s[a].stock;for(var o=s[a].specification.split(","),u=0;u<o.length;u++)for(var r=o[u].split("_"),n=r[0],p=0;p<e.data.specificationList.length;p++)e.data.specificationList[p].title===n&&(e.data.specificationList[p].values?e.data.specificationList[p].values.indexOf(r[1])<0&&e.data.specificationList[p].values.push(r[1]):e.data.specificationList[p].values=[r[1]])}e.data.stock=i;var d=e.data.activityType,l=e.data.activity,h=e.timestamp;if(d&&l&&l.gmtStart<h&&l.gmtEnd>h&&1===d){c.activityType=d,c.activityId=e.data.activityId,c.activity=l,e.data.priceTag="团购价";for(var f=s[0].price,g=0;g<s.length;g++){s[g].priceTag="团购价";for(var v=0;v<l.groupShopSkuDTOList.length;v++){var k=l.groupShopSkuDTOList[v];k.skuId===s[g].id&&(s[g].price=k.skuGroupShopPrice,s[g].vipPrice=k.skuGroupShopPrice,s[g].price<f&&(f=s[g].price))}}e.data.price=f,e.data.vipPrice=f}c.product=JSON.parse(JSON.stringify(e.data)),t.hideLoading()})),c.$api.request("coupon","getObtainableCoupon").then((function(t){c.couponList=t.data}));case 4:case"end":return i.stop()}}),i)})))()},obtainCoupon:function(t){var e=this;e.$api.request("coupon","obtainCoupon",{couponId:e.couponList[t].id}).then((function(i){e.$api.msg("领取成功"),e.couponList[t].nowCount++,e.toggleMask()}))},toggleSpec:function(){var t=this;if("show"===t.specClass)t.specClass="hide",setTimeout((function(){t.specClass="none",t.toggleCallback&&(t.toggleCallback(),t.toggleCallback=void 0)}),150);else if("none"===t.specClass){t.specClass="show";for(var e=0;e<t.product.specificationList.length;e++)e!==t.product.specificationList.length-1?t.product.specificationList[e].selectedIndex=0:t.selectSpec(e,0)}},selectSpec:function(t,e){this.product.specificationList[t].selectedIndex=e;for(var i="",c=0;c<this.product.specificationList.length;c++){var s=this.product.specificationList[c];i+=s.title+"_"+s.values[s.selectedIndex],c!==this.product.specificationList.length-1&&(i+=",")}for(var a=0;a<this.product.skuList.length;a++)if(this.product.skuList[a].specification===i){this.selectedSku=this.product.skuList[a];break}this.$forceUpdate()},addCart:function(){var t=this;t.selectedSku.id?t.$api.request("cart","addCartItem",{skuId:t.selectedSku.id,num:t.buyNum?t.buyNum:1}).then((function(e){t.product.groupShop?t.$api.msg("从购物车结算不会参加团购"):t.$api.msg("添加购物车成功")})):(t.specClass="none",t.toggleSpec(),t.toggleCallback=t.addCart)},likeIt:function(){this.product.favorite?(this.product.favorite=!1,this.$api.request("favorite","delete",{spuId:this.product.id}).then((function(t){}))):(this.product.favorite=!0,this.$api.request("favorite","create",{spuId:this.product.id}))},buy:function(){if(this.selectedSku.id){var e={skuId:this.selectedSku.id,num:this.buyNum,title:this.product.title,freightTemplateId:this.product.freightTemplateId,originalPrice:this.selectedSku.originalPrice,price:this.selectedSku.price,vipPrice:this.selectedSku.vipPrice,skuTitle:this.selectedSku.title,spuImg:this.product.img,skuImg:this.selectedSku.img,stock:this.selectedSku.stock,spuId:this.product.id,categoryId:this.product.categoryId,categoryIdList:this.product.categoryIds,weight:this.selectedSku.weight};this.product.groupShop&&(e["groupShopId"]=this.product.groupShop.id);var i=[1];i[0]=e,this.$api.globalData.skuList=i,t.navigateTo({url:"/pages/order/create?takeway=buy"})}else this.specClass="none",this.toggleSpec(),this.toggleCallback=this.buy},navAppraisePage:function(){t.navigateTo({url:"/pages/product/appraise?spuid=".concat(this.product.id)})},stopPrevent:function(){},numberChange:function(t){this.buyNum=t.number},toggleMask:function(t){var e=this,i="show"===t?10:300,c="show"===t?1:0;this.maskState=2,setTimeout((function(){e.maskState=c}),i)},closeSpec:function(){this.toggleCallback=void 0,this.toggleSpec()}}};e.default=o}).call(this,i("df3c")["default"])},beab:function(t,e,i){}},[["6caa","common/runtime","common/vendor"]]]);