goods.js 9.9 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/community/goods/goods"],{2366:function(t,e,o){"use strict";o.r(e);var n=o("4ba6"),i=o.n(n);for(var s in n)"default"!==s&&function(t){o.d(e,t,(function(){return n[t]}))}(s);e["default"]=i.a},"4ba6":function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=s(o("a34a")),i=o("2f62");function s(t){return t&&t.__esModule?t:{default:t}}function r(t,e,o,n,i,s,r){try{var a=t[s](r),d=a.value}catch(u){return void o(u)}a.done?e(d):Promise.resolve(d).then(n,i)}function a(t){return function(){var e=this,o=arguments;return new Promise((function(n,i){var s=t.apply(e,o);function a(t){r(s,n,i,a,d,"next",t)}function d(t){r(s,n,i,a,d,"throw",t)}a(void 0)}))}}function d(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function u(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?d(Object(o),!0).forEach((function(e){c(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function c(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var l=function(){o.e("components/page-component/goods/app-goods-banner").then(function(){return resolve(o("d9fb"))}.bind(null,o)).catch(o.oe)},h=function(){o.e("plugins/community/components/app-goods-time").then(function(){return resolve(o("54ff"))}.bind(null,o)).catch(o.oe)},m=function(){o.e("components/page-component/app-share-qr-code-poster/app-share-qr-code-poster").then(function(){return resolve(o("c169"))}.bind(null,o)).catch(o.oe)},p=function(){Promise.all([o.e("common/vendor"),o.e("components/page-component/goods/u-attr")]).then(function(){return resolve(o("338d"))}.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(){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)},b=function(){o.e("components/page-component/goods/bd-xbc").then(function(){return resolve(o("48be"))}.bind(null,o)).catch(o.oe)},_=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)},y=function(){o.e("components/page-component/goods/bd-detail").then(function(){return resolve(o("7e0d"))}.bind(null,o)).catch(o.oe)},w=function(){o.e("components/page-component/goods/bd-comments").then(function(){return resolve(o("66eb"))}.bind(null,o)).catch(o.oe)},$=function(){o.e("components/page-component/goods/bd-info-extra").then(function(){return resolve(o("fd84"))}.bind(null,o)).catch(o.oe)},T={name:"goods",data:function(){return{showClose:!1,is_open:0,goods:{id:"",name:"",cover_pic:"",price:""},middleman:{},activity:{},hasPosterNav:!0,posterConfig:this.$api.community.goods_config,posterGenerate:this.$api.community.goods_generate,isShowBuy:!1,shareShow:!1,checked:null,url:"",show:!1,list:[],goods_id:-1,hour:0,minute:0,second:0,longitude:0,latitude:0,day:0,loading:!1,first:!0,middleman_id:0,disable:"disable"}},onLoad:function(e){this.$commonLoad.onload(e);var o=this;wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]}),o.goods_id=e.goods_id,o.posterConfig=o.posterConfig+"&goods_id="+o.goods_id,o.posterGenerate=o.posterGenerate+"&goods_id="+o.goods_id,e.middleman_id>0?(o.middleman_id=e.middleman_id,o.$showLoading({type:"global",text:"加载中..."}),o.request({url:o.$api.community.goods_detail,data:{goods_id:o.goods_id,middleman_id:o.middleman_id}}).then((function(t){o.first=!1;var e=t.goods,n=t.activity,i=t.middleman;o.goods=e,o.goods.price=o.goods.price.toString(),o.activity=n,o.middleman=i,o.loading=!0,o.url="".concat(o.$api.goods.poster,"&goods_id=").concat(o.goods.id),n.time>0&&o.getTime(n.time),o.$hideLoading()}))):t.getLocation({success:function(e){t.hideLoading(),o.longitude=e.longitude,o.latitude=e.latitude,o.$showLoading({type:"global",text:"加载中..."}),o.request({url:o.$api.community.goods_detail,data:{goods_id:o.goods_id,longitude:o.longitude,latitude:o.latitude}}).then((function(t){o.first=!1;var e=t.goods,n=t.activity,i=t.middleman;o.goods=e,o.activity=n,o.middleman=i,o.loading=!0,o.url="".concat(o.$api.goods.poster,"&goods_id=").concat(o.goods.id),n.time>0&&o.getTime(n.time),o.$hideLoading()}))},fail:function(){t.hideLoading(),t.showModal({title:"提示",content:"获取位置信息失败,需要授权获取您的位置信息",showCancel:!1,confirmText:"打开授权",success:function(e){e.confirm&&t.openSetting({})}})}})},onShow:function(){var t=this;if(this.showClose=!1,setTimeout((function(){t.showClose=!0})),this.first)return!1;this.$showLoading(),this.$nextTick((function(){t.request({url:t.$api.community.goods_detail,data:{goods_id:t.goods_id,middleman_id:t.middleman_id,longitude:t.longitude,latitude:t.latitude}}).then((function(e){var o=e.goods,n=e.activity,i=e.middleman;t.goods=o,t.activity=n,t.middleman=i,t.loading=!0,t.url="".concat(t.$api.goods.poster,"&goods_id=").concat(t.goods.id),n.time>0&&t.getTime(n.time),t.$hideLoading()}))}))},onHide:function(){clearInterval(this.time)},onUnload:function(){clearInterval(this.time)},computed:u(u({},(0,i.mapGetters)("mallConfig",{getTheme:"getTheme"})),(0,i.mapState)({mall:function(t){return t.mallConfig.mall},userInfo:function(t){return t.user.info}})),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,user_id:this.userInfo.options.user_id}})},onShareAppMessage:function(){return this.hShareAppMessage()},methods:{hShareAppMessage:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.goods,o=e.app_share_title,n=e.app_share_pic,i=e.name,s=e.id,r=e.pic_url,a=e.subtitle;return this.$shareAppMessage({path:"/plugins/community/goods/goods",title:o||i,imageUrl:n||r[0].pic_url,desc:a,params:{goods_id:s,user_id:this.userInfo.options.user_id}},t)},getMall:function(t){this.is_open=t.is_open},request:function(e){var o=this;return a(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=e.url,r=e.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:if(t.showToast({title:a.msg,icon:"none",duration:1e3}),"所选活动已下架"!==a.msg&&"所选活动不存在"!==a.msg||setTimeout((function(){t.navigateBack({})}),1e3),"所选商品不在活动中"!=a.msg){n.next=14;break}return t.showToast({title:a.msg,icon:"none",duration:1e3}),setTimeout((function(){t.redirectTo({url:"/plugins/community/list/list"})}),1e3),n.abrupt("return",!1);case 14:case"end":return n.stop()}}),i)})))()},check:function(t){var e=t.item;this.checked=e},back:function(){t.redirectTo({url:"/plugins/community/list/list"})},rightFunc:function(t){var e=this,o=t.goods_list[0],n=o.id,i=o.goods_attr_id,s=o.num;this.$request({url:this.$api.community.cart_add,data:{activity_id:this.activity.id,goods_id:n,goods_attr_id:i,num:s},method:"post"}).then((function(t){0===t.code&&e.addResult(t.data.queue_id,t.data.token)}))},joinCart:function(){this.goods.buy_goods_auth?this.show=!0:this.$tips.showToast({title:"您暂无权限购买该商品",icon:"none"})},addResult:function(e,o){var n=this;this.$request({url:this.$api.community.cart_result,method:"post",data:{queue_id:e,token:o}}).then((function(i){0===i.code?i.data&&1===i.data.retry?setTimeout((function(){n.addResult(e,o)}),1e3):(n.attrShow=0,t.hideLoading(),t.showToast({title:"添加成功",duration:1e3})):(t.hideLoading(),t.showToast({title:i.msg,icon:"none",duration:1e3}))}))},getTime:function(t){var e=this;t-=1,this.day=parseInt(t/3600/24),this.hour=parseInt(t/3600%24),this.hour<10?this.hour="0"+this.hour:this.hour=this.hour.toString(),this.minute=parseInt(t/60%60),this.minute<10?this.minute="0"+this.minute:this.minute=this.minute.toString(),this.second=parseInt(t%60),this.second<10?this.second="0"+this.second:this.second=this.second.toString(),clearInterval(this.time),this.time=setInterval((function(){t-=1,t<0&&clearInterval(e.time),e.day=parseInt(t/3600/24),e.hour=parseInt(t/3600%24),e.hour<10?e.hour="0"+e.hour:e.hour=e.hour.toString(),e.minute=parseInt(t/60%60),e.minute<10?e.minute="0"+e.minute:e.minute=e.minute.toString(),e.second=parseInt(t%60),e.second<10?e.second="0"+e.second:e.second=e.second.toString()}),1e3)},setCoupon:function(t){this.$set(this.goods.goods_coupon_center[t],"is_receive",1)}},components:{"app-banner":l,"app-goods-time":h,"app-share-qr-code":m,appClose:g,uAttr:p,bdCoupon:f,bdXbc:b,bdKb:_,bdHc:v,bdDetail:y,bdComments:w,bdInfoExtra:$}};e.default=T}).call(this,o("543d")["default"])},"71b6":function(t,e,o){"use strict";(function(t){o("2d0a");n(o("66fd"));var e=n(o("f39f"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,o("543d")["createPage"])},7814:function(t,e,o){},"8a22":function(t,e,o){"use strict";var n=o("7814"),i=o.n(n);i.a},d32f:function(t,e,o){"use strict";var n;o.d(e,"b",(function(){return i})),o.d(e,"c",(function(){return s})),o.d(e,"a",(function(){return n}));var i=function(){var t=this,e=t.$createElement;t._self._c;t._isMounted||(t.e0=function(e){t.shareShow=!0})},s=[]},f39f:function(t,e,o){"use strict";o.r(e);var n=o("d32f"),i=o("2366");for(var s in i)"default"!==s&&function(t){o.d(e,t,(function(){return i[t]}))}(s);o("8a22");var r,a=o("f0c5"),d=Object(a["a"])(i["default"],n["b"],n["c"],!1,null,"044f4468",null,!1,n["a"],r);e["default"]=d.exports}},[["71b6","common/runtime","common/vendor"]]]);