goods.js 9.2 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/exchange/goods/goods"],{"195d":function(e,t,o){"use strict";var n;o.d(t,"b",(function(){return i})),o.d(t,"c",(function(){return s})),o.d(t,"a",(function(){return n}));var i=function(){var e=this,t=e.$createElement;e._self._c},s=[]},"3ae6":function(e,t,o){"use strict";var n=o("9370"),i=o.n(n);i.a},4265:function(e,t,o){"use strict";o.r(t);var n=o("a2c7"),i=o.n(n);for(var s in n)"default"!==s&&function(e){o.d(t,e,(function(){return n[e]}))}(s);t["default"]=i.a},"616b":function(e,t,o){"use strict";o.r(t);var n=o("195d"),i=o("4265");for(var s in i)"default"!==s&&function(e){o.d(t,e,(function(){return i[e]}))}(s);o("3ae6");var r,a=o("f0c5"),c=Object(a["a"])(i["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],r);t["default"]=c.exports},9370:function(e,t,o){},a2c7:function(e,t,o){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(o("a34a")),i=o("2f62"),s=r(o("e829"));function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t,o,n,i,s,r){try{var a=e[s](r),c=a.value}catch(u){return void o(u)}a.done?t(c):Promise.resolve(c).then(n,i)}function c(e){return function(){var t=this,o=arguments;return new Promise((function(n,i){var s=e.apply(t,o);function r(e){a(s,n,i,r,c,"next",e)}function c(e){a(s,n,i,r,c,"throw",e)}r(void 0)}))}}function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(Object(o),!0).forEach((function(t){l(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function l(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var h=function(){o.e("components/page-component/goods/app-goods-banner").then(function(){return resolve(o("d9fb"))}.bind(null,o)).catch(o.oe)},p=function(){o.e("components/page-component/goods/app-goods-full-reduce").then(function(){return resolve(o("bc5a"))}.bind(null,o)).catch(o.oe)},g=function(){o.e("components/basic-component/app-close/app-close").then(function(){return resolve(o("1653"))}.bind(null,o)).catch(o.oe)},f=function(){o.e("components/page-component/goods/bd-info").then(function(){return resolve(o("543b"))}.bind(null,o)).catch(o.oe)},_=function(){Promise.all([o.e("common/vendor"),o.e("components/page-component/goods/bd-coupon")]).then(function(){return resolve(o("fb44"))}.bind(null,o)).catch(o.oe)},m=function(){o.e("components/page-component/goods/bd-xbc").then(function(){return resolve(o("48be"))}.bind(null,o)).catch(o.oe)},b=function(){o.e("components/page-component/goods/bd-kb").then(function(){return resolve(o("f02b"))}.bind(null,o)).catch(o.oe)},v=function(){o.e("components/page-component/goods/bd-hc").then(function(){return resolve(o("7eb9"))}.bind(null,o)).catch(o.oe)},w=function(){o.e("components/page-component/goods/bd-detail").then(function(){return resolve(o("7e0d"))}.bind(null,o)).catch(o.oe)},y=function(){o.e("components/page-component/goods/bd-comments").then(function(){return resolve(o("66eb"))}.bind(null,o)).catch(o.oe)},T=function(){o.e("components/page-component/goods/app-sell-tip").then(function(){return resolve(o("f3ad"))}.bind(null,o)).catch(o.oe)},x={name:"goods",mixins:[s.default],data:function(){return{showClose:!1,is_open:!1,goods:{id:"",name:"",cover_pic:"",price:""},posterConfig:this.$api.exchange.poster_config,posterGenerate:this.$api.exchange.poster_generate,url:"",is_vip:!1,is_vip_card_user:0,show:!1,list:[],goods_id:-1,loading:!1,first:!0,discount:null,flash_sale:null,full_reduce:null,disable:"disable"}},onLoad:function(e){var t=this;this.$commonLoad.onload(e),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]}),this.goods_id=+e.goods_id,this.posterConfig=this.posterConfig+"&goods_id="+this.goods_id,this.posterGenerate=this.posterGenerate+"&goods_id="+this.goods_id,this.$showLoading({type:"global",text:"加载中..."}),this.request({url:this.$api.exchange.detail,data:{id:this.goods_id}}).then((function(e){if(e){t.first=!1;var o=e.goods;t.goods=o,t.loading=!0,t.url="".concat(t.$api.goods.poster,"&goods_id=").concat(t.goods.id),t.goods.vip_card_appoint.discount&&(t.is_vip=!0,t.discount=t.goods.vip_card_appoint.discount),t.full_reduce=o.goods_activity.full_reduce,t.flash_sale=t.goods.plugin_extra.flash_sale,t.is_vip_card_user=t.goods.vip_card_appoint.is_vip_card_user,t.$hideLoading()}}))},onShow:function(){var e=this;if(this.showClose=!1,setTimeout((function(){e.showClose=!0})),this.first)return!1;this.$showLoading(),this.$nextTick((function(){e.request({url:e.$api.exchange.detail,data:{id:e.goods_id}}).then((function(t){var o=t.goods;e.goods=o,e.loading=!0,e.full_reduce=o.goods_activity.full_reduce,e.url="".concat(e.$api.goods.poster,"&goods_id=").concat(e.goods.id),e.goods.vip_card_appoint.discount&&(e.is_vip=!0,e.discount=e.goods.vip_card_appoint.discount),e.flash_sale=e.goods.plugin_extra.flash_sale,e.is_vip_card_user=e.goods.vip_card_appoint.is_vip_card_user,e.$hideLoading()}))}))},computed:d(d(d(d({},(0,i.mapState)("gConfig",{iphone:function(e){return e.iphone},iphoneHeight:function(e){return e.iphoneHeight}})),(0,i.mapGetters)("mallConfig",{getTheme:"getTheme"})),(0,i.mapState)({mall:function(e){return e.mallConfig.mall},userInfo:function(e){return e.user.info},isTip:function(e){return e.mallConfig.mall.setting.is_remind_sell_time}})),{},{themeObject:function(){return{back:this.getTheme+"-m-back "+this.getTheme,backO:this.getTheme+"-m-back-o "+this.getTheme,theme:this.getTheme,color:this.getTheme+"-m-text "+this.getTheme,sBack:this.getTheme+"-s-back "+this.getTheme}},buyBtn:function(){return!this.goods||this.goods.buy_goods_auth?this.getTheme+"-m-gradient-o "+this.getTheme:this.disable+"-m-back "+this.disable},uBottomHeight:function(){return this.full_reduce&&this.goods.sell_time>0?"u-bottom-height-2":this.full_reduce||this.goods.sell_time>0?"u-bottom-height-1":"u-bottom-height-0"},leftTip:function(){var e="";return e=0==this.isTip&&this.goods.sell_time>0?"box-grow-1":"bd-btn-left bd-btn-half",this.goods&&"goods"===this.goods.type?e:""},disableBtn:function(){return this.goods.is_finish_sell||this.goods.sell_time>0?"btn-finish-sell":"bd-oversell-btn"},disableBtnText:function(){return this.goods.is_finish_sell?"商品已下架":this.goods.sell_time>0?"商品未开售":"已售罄"},remindParams:function(){return{sell_time:this.goods.sell_time,goods_id:this.goods.id,template_message_list:this.goods.template_message_list,buy_text:"立即购买"}}}),onShareTimeline:function(){return this.$shareTimeline({title:this.goods.app_share_title?this.goods.app_share_title:this.goods.name,imageUrl:this.goods.pic_url[0].pic_url,query:{goods_id:this.goods.id}})},onShareAppMessage:function(){return this.hShareAppMessage()},methods:{hShareAppMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$shareAppMessage({path:"/plugins/exchange/goods/goods",title:this.goods.app_share_title?this.goods.app_share_title:this.goods.name,imageUrl:this.goods.app_share_pic?this.goods.app_share_pic:this.goods.pic_url[0].pic_url,desc:this.goods.subtitle,params:{goods_id:this.goods.id}},e)},getMall:function(e){this.is_open=1==e.is_open},toExchange:function(){if(this.goods.buy_goods_auth)if(this.goods.sell_time>0)this.rightTip();else{if("undefined"!==typeof this.goods.limit_buy&&1==this.goods.limit_buy.status&&this.goods.limit_buy.rest_number<1)return this.$tips.showToast({title:this.goods.limit_buy.text,icon:"none"}),!1;var t=[];for(var o in this.goods.attr[0].attr_list)t.push({attr_id:this.goods.attr[0].attr_list[o].attr_id,attr_group_id:this.goods.attr[0].attr_list[o].attr_group_id});var n=[{mch_id:0,goods_list:[{id:this.goods.id,attr:t,num:1,cat_id:0,goods_attr_id:this.goods.attr[0].id}]}],i="/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(n));i+="&preview_url=".concat(encodeURIComponent(this.$api.exchange.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.exchange.order_submit),"&plugin=exchange"),e.navigateTo({url:i})}else this.$tips.showToast({title:"您暂无权限购买该商品",icon:"none"})},request:function(t){var o=this;return c(n.default.mark((function i(){var s,r,a;return n.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return s=t.url,r=t.data,n.next=3,o.$request({url:s,data:r});case 3:if(a=n.sent,0!==a.code){n.next=8;break}return n.abrupt("return",a.data);case 8:e.showModal({title:"提示",content:a.msg,showCancel:!1,success:function(t){e.navigateBack()}});case 9:case"end":return n.stop()}}),i)})))()},setCoupon:function(e){this.$set(this.goods.goods_coupon_center[e],"is_receive",1)},changeTime:function(e){this.goods.sell_time=e}},components:{"app-banner":h,appClose:g,appGoodsFullReduce:p,bdInfo:f,bdCoupon:_,bdXbc:m,bdKb:b,bdHc:v,bdDetail:w,bdComments:y,appSellTip:T}};t.default=x}).call(this,o("543d")["default"])},f7119:function(e,t,o){"use strict";(function(e){o("2d0a");n(o("66fd"));var t=n(o("616b"));function n(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,o("543d")["createPage"])}},[["f7119","common/runtime","common/vendor"]]]);