goods.js 10 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/pt/goods/goods"],{"0887":function(t,e,n){"use strict";(function(t){n("8748");o(n("66fd"));var e=o(n("7f79"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},"4a18":function(t,e,n){"use strict";var o=n("e185"),i=n.n(o);i.a},6540:function(t,e,n){"use strict";var o,i=function(){var t=this,e=t.$createElement,n=(t._self._c,Number(110));t.$mp.data=Object.assign({},{$root:{m0:n}})},r=[];n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return o}))},"7f79":function(t,e,n){"use strict";n.r(e);var o=n("6540"),i=n("8266");for(var r in i)"default"!==r&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n("4a18");var a,s=n("f0c5"),p=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,"45959c2f",null,!1,o["a"],a);e["default"]=p.exports},8266:function(t,e,n){"use strict";n.r(e);var o=n("aa66"),i=n.n(o);for(var r in o)"default"!==r&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=i.a},aa66:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=r(n("4795")),i=n("2f62");function r(t){return t&&t.__esModule?t:{default:t}}function a(t,e,n,o,i,r,a){try{var s=t[r](a),p=s.value}catch(c){return void n(c)}s.done?e(p):Promise.resolve(p).then(o,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var r=t.apply(e,n);function s(t){a(r,o,i,s,p,"next",t)}function p(t){a(r,o,i,s,p,"throw",t)}s(void 0)}))}}function p(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 c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?p(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var l=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-banner")]).then(function(){return resolve(n("de38"))}.bind(null,n)).catch(n.oe)},d=function(){n.e("plugins/pt/components/app-pt-time").then(function(){return resolve(n("99f2"))}.bind(null,n)).catch(n.oe)},h=function(){n.e("plugins/pt/components/app-price-title-share").then(function(){return resolve(n("42f1"))}.bind(null,n)).catch(n.oe)},m=function(){n.e("components/page-component/app-join-member/app-join-member").then(function(){return resolve(n("af6d"))}.bind(null,n)).catch(n.oe)},f=function(){n.e("plugins/pt/components/app-merchant-guarantee").then(function(){return resolve(n("aeea"))}.bind(null,n)).catch(n.oe)},g=function(){n.e("components/page-component/goods/app-goods-attr").then(function(){return resolve(n("e7a9"))}.bind(null,n)).catch(n.oe)},_=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-attr/app-attr")]).then(function(){return resolve(n("4761"))}.bind(null,n)).catch(n.oe)},v=function(){n.e("plugins/pt/components/app-buttom-button").then(function(){return resolve(n("4e0b"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("plugins/pt/components/app-pt-attr").then(function(){return resolve(n("ec10"))}.bind(null,n)).catch(n.oe)},w=function(){n.e("plugins/pt/components/app-participant").then(function(){return resolve(n("5703"))}.bind(null,n)).catch(n.oe)},A=function(){n.e("components/page-component/app-related-suggestion-product/app-related-suggestion-product").then(function(){return resolve(n("f0d4"))}.bind(null,n)).catch(n.oe)},y=function(){n.e("components/page-component/goods/app-goods-detail").then(function(){return resolve(n("04ea"))}.bind(null,n)).catch(n.oe)},O=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-quick-navigation/app-quick-navigation")]).then(function(){return resolve(n("cf64"))}.bind(null,n)).catch(n.oe)},j=function(){n.e("components/page-component/app-iphonex-bottom/app-iphonex-bottom").then(function(){return resolve(n("152d"))}.bind(null,n)).catch(n.oe)},P=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-iphone-x/app-iphone-x")]).then(function(){return resolve(n("bd7b"))}.bind(null,n)).catch(n.oe)},I=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-empty-bottom/app-empty-bottom")]).then(function(){return resolve(n("51dc"))}.bind(null,n)).catch(n.oe)},q=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-service")]).then(function(){return resolve(n("be7d"))}.bind(null,n)).catch(n.oe)},k=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-vip-card/app-vip-card")]).then(function(){return resolve(n("744f"))}.bind(null,n)).catch(n.oe)},$=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-marketing")]).then(function(){return resolve(n("b3c0"))}.bind(null,n)).catch(n.oe)},x={name:"goods",data:function(){return{goods_id:0,item:{name:"",pintuan_groups:[]},url:"",isCart:!1,selectAttr:{},show:0,pt:!1,selectGroupAttrId:0,pintuan_list:[],list:[],appAttr:{},cartShow:!1,price:"",time:null,day:"00",hour:"00",minute:"00",second:"00",is_vip_card_user:0,discount:null,is_vip:!1,loading:!1}},computed:c({},(0,i.mapState)("gConfig",{iphone:function(t){return t.iphone},iphoneHeight:function(t){return t.iphoneHeight}}),{},(0,i.mapState)({mall:function(t){return t.mallConfig.mall}})),onLoad:function(t){var e=this;this.goods_id=t.goods_id,this.$request({url:this.$api.goods.new_recommend}).then((function(t){0===t.code&&(e.list=t.data.list)})),this.$nextTick((function(){e.request(0).then((function(){e.selectGroupAttrId=e.item.pintuan_groups[0].id,e.getTime(e.item.pintuanGoods.end_time)}))}))},onShareAppMessage:function(){return this.$shareAppMessage({path:"/plugins/pt/goods/goods",title:this.item.app_share_title?this.item.app_share_title:this.item.name,imageUrl:this.item.app_share_pic?this.item.app_share_pic:"",params:{goods_id:this.item.id}})},methods:{attr:function(t){this.appAttr=t},attrTap:function(t){null!==t?(this.selectAttr=t,this.price=t.price):this.selectAttr={}},request:function(e){var n=this;return s(o.default.mark((function i(){var r;return o.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.prev=0,t.showLoading({title:"加载中"}),o.next=4,n.$request({url:n.$api.pt.detail,data:{id:n.goods_id,group_id:e}});case 4:r=o.sent,t.hideLoading(),0===r.code&&(n.item=r.data.detail,n.pintuan_list=r.data.pintuan_list,n.url="".concat(n.$api.pt.poster,"&goods_id=").concat(n.item.id),n.price=r.data.detail.price,n.item.vip_card_appoint.discount>0&&(n.is_vip=!0,n.discount=n.item.vip_card_appoint.discount),n.is_vip_card_user=n.item.vip_card_appoint.is_vip_card_user,n.loading=!0),o.next=13;break;case 9:throw o.prev=9,o.t0=o["catch"](0),t.hideLoading(),new Error(o.t0);case 13:case"end":return o.stop()}}),i,null,[[0,9]])})))()},shop:function(e){if("none"===this.appAttr.display)!1===e?(this.pt=!1,this.request(0)):(this.pt=!0,this.request(this.selectGroupAttrId)),this.show=Math.random();else if(!1===e&&!0===this.pt)this.pt=!1,this.selectAttr={},this.request(0);else if(!0===e&&!1===this.pt)this.pt=!0,this.selectAttr={},this.request(this.selectGroupAttrId);else if(!1===e&&!1===this.pt)this.buy();else if(!0===e&&!0===this.pt)if(0===Object.keys(this.selectAttr).length)t.showToast({title:"请选择规格",icon:"none"});else{for(var n=this.item.mch_id,o=[],i={id:this.item.id,attr:[],num:this.appAttr.number,goods_attr_id:this.selectAttr.id,cart_id:0},r=0;r<this.selectAttr.attr_list.length;r++){var a={attr_id:this.selectAttr.attr_list[r].attr_id,attr_group_id:this.selectAttr.attr_list[r].attr_group_id};i.attr.push(a)}o.push({mch_id:n,pintuan_order_id:0,pintuan_group_id:this.selectGroupAttrId,goods_list:[i]}),this.$jump({open_type:"navigate",url:"/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(o),"&preview_url=").concat(encodeURIComponent(this.$api.pt.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.pt.order_submit),"&order_page_url=/plugins/pt/order/order&plugin=pt")})}},setGroupAttrID:function(t){this.selectGroupAttrId=t,this.selectAttr={},this.request(t)},defaultRequest:function(){this.pt=!0,this.request(this.selectGroupAttrId)},buy:function(){if(!this.submit())return!1;if(0!==Object.keys(this.selectAttr).length){var e=this.item,n=this.appAttr.number,o=this.selectAttr,i=o.id,r=[];for(var a in o.attr_list)r.push({attr_id:o.attr_list[a].attr_id,attr_group_id:o.attr_list[a].attr_group_id});var s=[],p={mch_id:e.mch_id?e.mch_id:0,goods_list:[]};p.goods_list.push({id:e.id,attr:r,num:n,cat_id:0,goods_attr_id:i}),s.push(p),t.navigateTo({url:"/pages/order-submit/order-submit?mch_list="+JSON.stringify(s)})}else t.showToast({title:"请选择规格",icon:"none"})},submit:function(){var e=this.item,n=this.appAttr.number,o=this.selectAttr;return o?n<=0?(t.showModal({title:"提示",content:"商品数量不能为0",showCancel:!1}),!1):!!e:(t.showModal({title:"提示",content:"请先选择规格",showCancel:!1}),!1)},getTime:function(t){var e=this,n=new Date(t.replace(/-/g,"/"));this.time=setInterval((function(){var t=new Date,o=n.getTime()-t.getTime(),i=parseInt(o/36e5/24),r=parseInt(o/1e3/60/60%24),a=parseInt(o/1e3/60%60),s=parseInt(o/1e3%60);e.day=i<10?"0".concat(i):i,e.hour=r<10?"0".concat(r):r,e.minute=a<10?"0".concat(a):a,e.second=s<10?"0".concat(s):s}),1e3)}},components:{"app-goods-banner":l,"app-pt-time":d,"app-price-title-share":h,"app-join-member":m,"app-merchant-guarantee":f,"app-goods-attr":g,"app-attr":_,"app-button-button":v,"app-pt-attr":b,"app-participant":w,"app-related-suggestion-product":A,"app-goods-detail":y,"app-quick-navigation":O,"app-iphone-bottom":j,"app-iphone-x":P,"app-empty-bottom":I,"app-goods-service":q,"app-vip-card":k,"app-goods-marketing":$},onShow:function(){},onHide:function(){clearInterval(this.time)},onUnload:function(){clearInterval(this.time)}};e.default=x}).call(this,n("543d")["default"])},e185:function(t,e,n){}},[["0887","common/runtime","common/vendor"]]]);