goods.js 14 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/pt/goods/goods"],{"08aa":function(t,e,i){"use strict";i.r(e);var n=i("c618"),o=i.n(n);for(var s in n)"default"!==s&&function(t){i.d(e,t,(function(){return n[t]}))}(s);e["default"]=o.a},"84b8":function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return o})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){return n}));var o=function(){var t=this,e=t.$createElement;t._self._c},s=[]},"855f":function(t,e,i){"use strict";var n=i("b4c7"),o=i.n(n);o.a},9613:function(t,e,i){"use strict";(function(t){i("2d0a");n(i("66fd"));var e=n(i("97e6"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,i("543d")["createPage"])},"97e6":function(t,e,i){"use strict";i.r(e);var n=i("84b8"),o=i("08aa");for(var s in o)"default"!==s&&function(t){i.d(e,t,(function(){return o[t]}))}(s);i("855f");var r,a=i("f0c5"),c=Object(a["a"])(o["default"],n["b"],n["c"],!1,null,"199dd8f6",null,!1,n["a"],r);e["default"]=c.exports},b4c7:function(t,e,i){},c618:function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=s(i("a34a")),o=i("2f62");function s(t){return t&&t.__esModule?t:{default:t}}function r(t,e,i,n,o,s,r){try{var a=t[s](r),c=a.value}catch(u){return void i(u)}a.done?e(c):Promise.resolve(c).then(n,o)}function a(t){return function(){var e=this,i=arguments;return new Promise((function(n,o){var s=t.apply(e,i);function a(t){r(s,n,o,a,c,"next",t)}function c(t){r(s,n,o,a,c,"throw",t)}a(void 0)}))}}function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){l(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function l(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var d=function(){i.e("components/page-component/goods/app-goods-banner").then(function(){return resolve(i("d9fb"))}.bind(null,i)).catch(i.oe)},p=function(){i.e("plugins/pt/components/app-pt-time").then(function(){return resolve(i("a61c"))}.bind(null,i)).catch(i.oe)},h=function(){i.e("plugins/pt/components/app-merchant-guarantee").then(function(){return resolve(i("d171"))}.bind(null,i)).catch(i.oe)},m=function(){i.e("plugins/pt/components/app-buttom-button").then(function(){return resolve(i("4c99"))}.bind(null,i)).catch(i.oe)},_=function(){i.e("plugins/pt/components/app-pt-attr").then(function(){return resolve(i("23f5"))}.bind(null,i)).catch(i.oe)},f=function(){i.e("plugins/pt/components/app-participant").then(function(){return resolve(i("132d"))}.bind(null,i)).catch(i.oe)},g=function(){i.e("components/page-component/app-related-suggestion-product/app-related-suggestion-product").then(function(){return resolve(i("41e0"))}.bind(null,i)).catch(i.oe)},b=function(){i.e("components/page-component/app-quick-navigation/app-quick-navigation").then(function(){return resolve(i("d475"))}.bind(null,i)).catch(i.oe)},v=function(){i.e("components/page-component/goods/app-goods-full-reduce").then(function(){return resolve(i("bc5a"))}.bind(null,i)).catch(i.oe)},w=function(){Promise.all([i.e("common/vendor"),i.e("components/page-component/goods/u-attr")]).then(function(){return resolve(i("338d"))}.bind(null,i)).catch(i.oe)},$=function(){i.e("components/page-component/goods/bd-info").then(function(){return resolve(i("543b"))}.bind(null,i)).catch(i.oe)},A=function(){Promise.all([i.e("common/vendor"),i.e("components/page-component/goods/bd-coupon")]).then(function(){return resolve(i("fb44"))}.bind(null,i)).catch(i.oe)},y=function(){i.e("components/page-component/goods/bd-xbc").then(function(){return resolve(i("48be"))}.bind(null,i)).catch(i.oe)},T=function(){i.e("components/page-component/goods/bd-kb").then(function(){return resolve(i("f02b"))}.bind(null,i)).catch(i.oe)},I=function(){i.e("components/page-component/goods/bd-hc").then(function(){return resolve(i("7eb9"))}.bind(null,i)).catch(i.oe)},O=function(){i.e("components/page-component/goods/bd-detail").then(function(){return resolve(i("7e0d"))}.bind(null,i)).catch(i.oe)},P=function(){i.e("components/page-component/goods/bd-comments").then(function(){return resolve(i("66eb"))}.bind(null,i)).catch(i.oe)},S=function(){i.e("components/basic-component/app-close/app-close").then(function(){return resolve(i("1653"))}.bind(null,i)).catch(i.oe)},x={name:"goods",data:function(){return{showClose:!1,is_open:0,goods_id:0,detail:{goods_activity:{full_reduce:{}},groups:[]},full_reduce:null,loading:!1,share_url:"",time_str:{day:"00",hou:"00",min:"00",sec:"00"},down_time:0,discount:null,isVip:!1,goods:{},item:{name:"",pintuan_groups:[]},selectAttr:null,show:!1,pt:!1,selectGroupAttrId:0,pintuan_list:[],list:[],cartShow:!1,price:"",webUrl:"",time:null,is_vip_card_user:0,url:this.$api.pt.detail,poster_config:this.$api.pt.poster_config,poster_generate:this.$api.pt.poster_generate,aloneAttr:null,start_time:!1,pintuan_list_time:"",pt_time:null,number:1,group_price:"",again:0,flash_sale:null}},computed:u(u(u(u({},(0,o.mapState)("gConfig",{iphone:function(t){return t.iphone},iphoneHeight:function(t){return t.iphoneHeight}})),(0,o.mapState)({mall:function(t){return t.mallConfig.mall}})),(0,o.mapGetters)("mallConfig",{getTheme:"getTheme"})),{},{set_group_num:function(){for(var t=0;t<this.detail.groups.length;t++)if(this.detail.groups[t].groups.id==this.selectGroupAttrId)return t},groupPrice:function(){if(!this.$validation.isEmpty(this.selectAttr)){if(this.pt)return 1===this.detail.level_show?0===this.selectAttr.price_member?"免费":"¥".concat(this.selectAttr.price_member):0===Number(this.selectAttr.price)?"免费":"¥".concat(this.selectAttr.price);for(var t=this.detail.groups[this.set_group_num].attr,e=0;e<t.length;e++)if(t[e].sign_id===this.selectAttr.sign_id)return 1===this.detail.level_show?0===t[e].price_member?"免费":"¥".concat(t[e].price_member):0===Number(t[e].price)?"免费":"¥".concat(t[e].price)}},singlePrice:function(){if(this.$validation.isEmpty(this.selectAttr))return 1===this.detail.level_show?0===Number(this.detail.price_member_min)?"免费":"¥".concat(this.detail.price_member_min):0===Number(this.detail.price)?"免费":"¥".concat(this.detail.price);for(var t=0;t<this.aloneAttr.length;t++)if(this.aloneAttr[t].sign_id===this.selectAttr.sign_id)return 1===this.detail.level_show?0===Number(this.aloneAttr[t].price_member)?"免费":"¥".concat(this.aloneAttr[t].price_member):0===Number(this.aloneAttr[t].price)?"免费":"¥".concat(this.aloneAttr[t].price)},groupSparePrice:function(){return this.detail.groups.length>0?(this.detail.original_price-this.detail.groups[0].price_min).toFixed(2):this.detail.original_price}}),onShow:function(){var t=this;this.showClose=!1,setTimeout((function(){t.showClose=!0}))},onLoad:function(t){this.$commonLoad.onload(t),this.webUrl="/plugins/pt/goods/goods?goods_id="+t.goods_id,this.goods_id=t.goods_id,this.requestDetail(),this.newRecommend(),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]})},onShareTimeline:function(){return this.$shareTimeline({title:this.detail.app_share_title?this.detail.app_share_title:this.detail.name,query:{goods_id:this.goods_id}})},onShareAppMessage:function(){return this.hShareAppMessage()},methods:{hShareAppMessage:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$shareAppMessage({path:"/plugins/pt/goods/goods",title:this.detail.app_share_title?this.detail.app_share_title:this.detail.name,imageUrl:this.detail.app_share_pic?this.detail.app_share_pic:this.detail.pic_url[0].pic_url,desc:this.detail.subtitle,params:{goods_id:this.goods_id}},t)},getMall:function(t){this.is_open=t.is_open},goJoin:function(e){t.navigateTo({url:"/plugins/pt/detail/detail?id=".concat(e)})},requestDetail:function(){var e=this;return a(n.default.mark((function i(){var o,s,r,a,c,u,l;return n.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.next=2,e.$request({url:e.$api.pt.detail,method:"get",data:{id:e.goods_id}});case 2:o=i.sent,0===o.code?(e.loading=!0,s=o.data.detail,e.detail=s,e.price=s.price,e.aloneAttr=JSON.parse(JSON.stringify(s.attr)),r=s.groups,r.length>0&&(e.detail.attr=r[0].attr,e.selectGroupAttrId=r[0].groups.id),s.goods_activity&&(e.full_reduce=s.goods_activity.full_reduce),e.flash_sale=s.plugin_extra.flash_sale,e.share_url="".concat(e.$api.pt.poster,"&goods_id=").concat(e.detail.id),e.poster_config="".concat(e.poster_config,"&goods_id=").concat(e.detail.id),e.poster_generate="".concat(e.poster_generate,"&goods_id=").concat(e.detail.id),e.pintuan_list=o.data.pintuan_list,e.pintuan_list.length>0&&(a=new Date(e.pintuan_list[0].surplus_date_time.replace(/-/g,"/")),e.pt_time=setInterval((function(){var t=a.getTime()-(new Date).getTime();t<0&&clearInterval(e.pt_time);var i=parseInt(t/1e3/60/60/24%30),n=parseInt(t/1e3/60/60%24),o=parseInt(t/1e3/60%60),s=parseInt(t/1e3%60);e.pintuan_list_time=i>0?i+"天"+n+":"+(o<10?"0"+o:o)+":"+(s<10?"0"+s:s):n+":"+(o<10?"0"+o:o)+":"+(s<10?"0"+s:s)}),1e3)),s.vip_card_appoint.discount&&(e.isVip=!0,e.discount=s.vip_card_appoint.discount),e.is_vip_card_user=s.vip_card_appoint.is_vip_card_user,e.goods={attr:s.attr,cover_pic:s.cover_pic,level_show:s.level_show,price:s.price,mch_id:s.mch_id,name:s.name,id:s.id},"0000-00-00 00:00:00"!==s.pintuanGoods.end_time&&e.countdown(s.pintuanGoods.end_time),s.pintuanGoods.start_time&&(c=new Date(s.pintuanGoods.start_time.replace(/-/g,"/")),u=new Date,l=c.getTime()-u.getTime(),l>0?(e.start_time=!1,e.countdown(s.pintuanGoods.start_time)):e.start_time=!0)):t.showToast({title:o.msg,icon:"none"});case 4:case"end":return i.stop()}}),i)})))()},countdown:function(t){var e=this,i=new Date(t.replace(/-/g,"/")),n=new Date,o=i.getTime()-n.getTime(),s=parseInt(o/36e5/24),r=parseInt(o/1e3/60/60%24),a=parseInt(o/1e3/60%60),c=parseInt(o/1e3%60);this.time_str={day:s<10?"0".concat(s):s,hou:r<10?"0".concat(r):r,min:a<10?"0".concat(a):a,sec:c<10?"0".concat(c):c},this.down_time=setTimeout((function(){e.countdown(t)}),1e3)},newRecommend:function(){var t=this;return a(n.default.mark((function e(){var i;return n.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.$request({url:t.$api.goods.new_recommend});case 2:i=e.sent,0===i.code&&(t.list=i.data.list);case 4:case"end":return e.stop()}}),e)})))()},setCoupon:function(t){this.$set(this.detail.goods_coupon_center[t],"is_receive",1)},attrTap:function(t){for(var e=t.item,i=t.number,n=0;n<this.aloneAttr.length;n++)this.aloneAttr[n].sign_id===e.sign_id&&(this.price=this.aloneAttr[n].price);this.number=i,this.selectAttr=e},shop:function(t){var e=this;this.detail.buy_goods_auth?(!0===t?(this.$set(this,"pt",!0),this.detail.groups.forEach((function(t){e.selectGroupAttrId===t.groups.id&&(e.$set(e.detail,"attr",t.attr),e.$set(e.detail,"id",t.groups.goods_id))}))):(this.$set(this,"pt",!1),this.$set(this.detail,"attr",this.aloneAttr),this.$set(this.detail,"id",this.goods_id)),this.show=!0,this.$nextTick((function(){e.again=Math.random()}))):this.$tips.showToast({title:"您暂无权限购买该商品",icon:"none"})},setGroupAttrID:function(t){var e=this;this.selectGroupAttrId=t.groups.id,this.$set(this.detail,"attr",t.attr),this.$set(this.detail,"id",t.groups.goods_id),this.$nextTick((function(){e.again=Math.random()}))},defaultRequest:function(){this.$set(this,"pt",!0),this.detail.attr=this.detail.groups[0].attr,this.selectGroupAttrId=this.detail.groups[0].groups.id,this.detail.id=this.detail.groups[0].groups.goods_id},rightFunc:function(){var e=this;if(!1===this.pt&&!0===this.show)this.pt=!0,this.$set(this,"pt",!0),setTimeout((function(){e.show=!0}),500),this.detail.groups.forEach((function(t){e.selectGroupAttrId===t.groups.id&&(e.$set(e.detail,"attr",t.attr),e.$set(e.detail,"id",t.groups.goods_id))})),this.$nextTick((function(){e.again=Math.random()}));else{if(this.detail.min_number>this.number)return this.$tips.showToast({title:"该商品"+this.detail.min_number+this.detail.unit+"起售",icon:"none"}),!1;if("undefined"!==typeof this.detail.limit_buy&&1==this.detail.limit_buy.status&&this.detail.limit_buy.rest_number<this.number)return this.$tips.showToast({title:this.detail.limit_buy.text,icon:"none"}),!1;var i=[];this.selectAttr.attr_list.forEach((function(t){i.push({attr_id:t.attr_id,attr_group_id:t.attr_group_id})}));var n={pintuan_order_id:0,pintuan_group_id:this.selectGroupAttrId,mch_id:this.detail.mch_id?this.detail.mch_id:0,goods_list:[{id:this.detail.id,attrs:i,num:this.number,cat_id:0,goods_attr_id:this.selectAttr.id}]};t.navigateTo({url:"/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify([n]),"&preview_url=").concat(encodeURIComponent(this.$api.pt.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.pt.order_submit))})}},leftFunc:function(e){var i=this;if(!0===this.pt&&!0===this.show)this.$set(this,"pt",!1),setTimeout((function(){i.show=!0}),500),this.$set(this.detail,"attr",this.aloneAttr),this.$set(this.detail,"id",this.goods_id),this.$nextTick((function(){i.$refs.attr.firstSelect()}));else{if(this.detail.min_number>this.number)return this.$tips.showToast({title:"该商品"+this.detail.min_number+this.detail.unit+"起售",icon:"none"}),!1;if("undefined"!==typeof this.detail.limit_buy&&1==this.detail.limit_buy.status&&this.detail.limit_buy.rest_number<this.number)return this.$tips.showToast({title:this.detail.limit_buy.text,icon:"none"}),!1;var n=this.detail,o=this.selectAttr,s=[];for(var r in o.attr_list)s.push({attr_id:o.attr_list[r].attr_id,attr_group_id:o.attr_list[r].attr_group_id});var a=[{mch_id:n.mch_id?n.mch_id:0,pintuan_order_id:0,pintuan_group_id:0,goods_list:[{id:n.id,attr:s,num:e,cat_id:0,goods_attr_id:o.id}]}];t.navigateTo({url:"/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(a),"&preview_url=").concat(encodeURIComponent(this.$api.pt.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.pt.order_submit))})}}},components:{bdInfo:$,bdCoupon:A,bdXbc:y,bdKb:T,bdHc:I,bdDetail:O,bdComments:P,"app-goods-banner":d,"app-pt-time":p,"app-merchant-guarantee":h,"app-button-button":m,"app-pt-attr":_,"app-participant":f,"app-related-suggestion-product":g,"app-quick-navigation":b,uAttr:w,appGoodsFullReduce:v,appClose:S},onHide:function(){clearTimeout(this.down_time)},onUnload:function(){clearTimeout(this.down_time)}};e.default=x}).call(this,i("543d")["default"])}},[["9613","common/runtime","common/vendor"]]]);