goods.js 9.0 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/gift/goods/goods"],{"24d2":function(t,e,n){"use strict";n.r(e);var o=n("b7a2"),i=n.n(o);for(var s in o)"default"!==s&&function(t){n.d(e,t,(function(){return o[t]}))}(s);e["default"]=i.a},"6af0":function(t,e,n){},"9ae02":function(t,e,n){"use strict";var o=n("6af0"),i=n.n(o);i.a},b7a2:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=s(n("a34a")),i=n("2f62");function s(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e,n,o,i,s,r){try{var a=t[s](r),c=a.value}catch(u){return void n(u)}a.done?e(c):Promise.resolve(c).then(o,i)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var s=t.apply(e,n);function r(t){u(s,o,i,r,a,"next",t)}function a(t){u(s,o,i,r,a,"throw",t)}r(void 0)}))}}var l=function(){n.e("components/page-component/goods/app-goods-banner").then(function(){return resolve(n("d9fb"))}.bind(null,n)).catch(n.oe)},h=function(){n.e("components/page-component/app-related-suggestion-product/app-related-suggestion-product").then(function(){return resolve(n("41e0"))}.bind(null,n)).catch(n.oe)},p=function(){n.e("plugins/gift/components/goods/bottom-button").then(function(){return resolve(n("9950"))}.bind(null,n)).catch(n.oe)},f=function(){n.e("components/page-component/goods/app-goods-full-reduce").then(function(){return resolve(n("bc5a"))}.bind(null,n)).catch(n.oe)},g=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/u-attr")]).then(function(){return resolve(n("338d"))}.bind(null,n)).catch(n.oe)},_=function(){n.e("components/page-component/goods/bd-info").then(function(){return resolve(n("543b"))}.bind(null,n)).catch(n.oe)},m=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/bd-coupon")]).then(function(){return resolve(n("fb44"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("components/page-component/goods/bd-xbc").then(function(){return resolve(n("48be"))}.bind(null,n)).catch(n.oe)},v=function(){n.e("components/page-component/goods/bd-kb").then(function(){return resolve(n("f02b"))}.bind(null,n)).catch(n.oe)},w=function(){n.e("components/page-component/goods/bd-hc").then(function(){return resolve(n("7eb9"))}.bind(null,n)).catch(n.oe)},$=function(){n.e("components/page-component/goods/bd-detail").then(function(){return resolve(n("7e0d"))}.bind(null,n)).catch(n.oe)},y=function(){n.e("components/page-component/goods/bd-comments").then(function(){return resolve(n("66eb"))}.bind(null,n)).catch(n.oe)},S=function(){n.e("components/basic-component/app-close/app-close").then(function(){return resolve(n("1653"))}.bind(null,n)).catch(n.oe)},k={name:"goods",data:function(){return{showClose:!1,is_open:0,goods_id:-1,goods:null,full_reduce:null,goods_list:[],attr_bool:!1,select_data:{},select_str:"",number:1,getTheme:!1,ask_gift:"",webUrl:"",mch_id:-1,loading:!1,join_disabled:!0,is_share:0,is_search:0,selectAttr:{},attrShow:!1,flash_sale:null,is_vip:!1,is_vip_card_user:null,discount:null}},onLoad:function(t){var e=this;this.$commonLoad.onload(t),this.webUrl="/plugins/gift/goods/goods?id="+t.id,this.goods_id=t.id,t.mch_id&&(this.mch_id=t.mch_id),1==t.is_share&&(this.is_share=1),1==t.is_search&&(this.is_search=1),this.$store.dispatch("gift/getConfig",this.$api.gift.config),this.request(t.id).then((function(){e.requestList(),e.requestConfig()})),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]})},onShow:function(){var t=this;this.showClose=!1,setTimeout((function(){t.showClose=!0}))},onShareTimeline:function(){return this.$shareTimeline({title:this.ask_gift,query:{id:this.goods_id,is_share:1}})},onShareAppMessage:function(){return this.hShareAppMessage()},methods:{hShareAppMessage:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$shareAppMessage({path:"/plugins/gift/goods/goods",title:this.ask_gift,imageUrl:this.goods.app_share_pic?this.goods.app_share_pic:this.goods.pic_url[0].pic_url,desc:this.goods.subtitle,params:{id:this.goods_id,is_share:1}},t)},getMall:function(t){this.is_open=t.is_open},clickAttr:function(){this.attrShow=!0},onAttr:function(t){var e=t.item;this.selectAttr=e;for(var n="",o=0;o<e.attr_list.length;o++)n+="".concat(e.attr_list[o].attr_group_name,": ").concat(e.attr_list[o].attr_name," ");this.select_data={name:this.goods.name,price:e.price,attr:{id:e.id,attr_list:e.attr_list,stock:e.stock,goods_id:e.goods_id},attr_str:n,pic_url:e.pic_url?e.pic_url:this.goods.cover_pic}},request:function(t){var e=this;return d(o.default.mark((function n(){var i,s,r;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.$utils.showLoading(),n.prev=1,n.next=4,e.$request({url:e.$api.gift.goods,method:"get",data:{id:t}});case 4:if(i=n.sent,e.$utils.hideLoading(),0===i.code)for(e.goods=i.data.goods,e.flash_sale=i.data.goods.plugin_extra.flash_sale,e.goods.goods_activity&&(e.full_reduce=e.goods.goods_activity.full_reduce),e.goods.vip_card_appoint.discount&&(e.is_vip=!0,e.discount=e.goods.vip_card_appoint.discount),e.is_vip_card_user=e.goods.vip_card_appoint.is_vip_card_user,e.loading=!0,s=0;s<e.goods.attr_groups.length;s++)for(r=0;r<e.goods.attr_groups[s].attr_list.length;r++)e.goods.attr_groups[s].attr_list[r].active=0===r;n.next=13;break;case 9:throw n.prev=9,n.t0=n["catch"](1),e.$utils.hideLoading(),new Error(n.t0);case 13:case"end":return n.stop()}}),n,null,[[1,9]])})))()},requestConfig:function(){var e=this;return d(o.default.mark((function n(){var i;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.$utils.showLoading(),n.prev=1,n.next=4,e.$request({url:e.$api.gift.config,method:"get"});case 4:i=n.sent,e.$utils.hideLoading(),0===i.code?(e.ask_gift=i.data.ask_gift,e.getTheme=i.data.theme_color,e.$store.commit("gift/setTheme",Number(i.data.theme.id))):t.showModal({title:"提示",content:i.msg}),n.next=13;break;case 9:throw n.prev=9,n.t0=n["catch"](1),e.$utils.hideLoading(),new Error(n.t0);case 13:case"end":return n.stop()}}),n,null,[[1,9]])})))()},requestList:function(){var e=this;return d(o.default.mark((function n(){var i;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.$utils.showLoading(),n.prev=1,n.next=4,e.$request({url:e.$api.goods.new_recommend,method:"get",data:{goods_id:e.goods_id,type:"goods"}});case 4:i=n.sent,e.$utils.hideLoading(),0===i.code?e.goods_list=i.data.list:t.showModal({title:"提示",content:i.msg}),n.next=13;break;case 9:throw n.prev=9,n.t0=n["catch"](1),e.$utils.hideLoading(),new Error(n.t0);case 13:case"end":return n.stop()}}),n,null,[[1,9]])})))()},attrSwitch:function(t){this.attr_bool=t},pay:function(e){if(this.number=e.goods_list[0].num,this.$storage.getStorageSync("GIFT_CART")){for(var n=0,o=this.$storage.getStorageSync("GIFT_CART"),i=0;i<o.length;i++)o[i].attr.id===this.select_data.attr.id?o[i].number+=this.number:n+=1;if(n===o.length){var s=this.select_data;s.number=this.number,o.push(s)}this.$storage.setStorageSync("GIFT_CART",o)}else{var r=this.select_data;r.number=this.number,this.$storage.setStorageSync("GIFT_CART",[r])}1===this.is_share?t.navigateTo({url:"/plugins/gift/index/index"}):1===this.is_search?t.navigateBack({delta:3}):t.navigateBack({delta:2})},setCoupon:function(t){this.$set(this.goods.goods_coupon_center[t],"is_receive",1)}},computed:a(a({},(0,i.mapState)("gift",{theme:function(t){return t.theme},theme_id:function(t){return t.theme_id}})),(0,i.mapState)("mallConfig",{mall:function(t){return t.mall}})),components:{"app-goods-banner":l,"app-related-suggestion-product":h,"bottom-button":p,appGoodsFullReduce:f,uAttr:g,bdInfo:_,bdCoupon:m,bdXbc:b,bdKb:v,bdHc:w,bdDetail:$,bdComments:y,appClose:S}};e.default=k}).call(this,n("543d")["default"])},d3f7:function(t,e,n){"use strict";var o;n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"a",(function(){return o}));var i=function(){var t=this,e=t.$createElement;t._self._c},s=[]},e7fa:function(t,e,n){"use strict";n.r(e);var o=n("d3f7"),i=n("24d2");for(var s in i)"default"!==s&&function(t){n.d(e,t,(function(){return i[t]}))}(s);n("9ae02");var r,a=n("f0c5"),c=Object(a["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],r);e["default"]=c.exports},edce:function(t,e,n){"use strict";(function(t){n("2d0a");o(n("66fd"));var e=o(n("e7fa"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])}},[["edce","common/runtime","common/vendor"]]]);