product.js 9.8 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/product/product"],{"1bc5":function(e,o,t){"use strict";t.r(o);var n=t("1cec"),c=t.n(n);for(var s in n)["default"].indexOf(s)<0&&function(e){t.d(o,e,(function(){return n[e]}))}(s);o["default"]=c.a},"1cec":function(e,o,t){"use strict";(function(e){var n=t("4ea4");Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var c=n(t("2eee")),s=n(t("9523")),i=n(t("c973")),r=t("1d73"),a=t("26cb"),u=(n(t("1c10")),t("8878")),d=t("c1d5");function p(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,n)}return t}var l={components:{guessLike:function(){t.e("pages/product/common/guessLike").then(function(){return resolve(t("15d4"))}.bind(null,t)).catch(t.oe)},topSwiper:function(){t.e("pages/product/common/topSwiper").then(function(){return resolve(t("7fa6"))}.bind(null,t)).catch(t.oe)},productContent:function(){t.e("pages/product/common/productContent").then(function(){return resolve(t("0f79"))}.bind(null,t)).catch(t.oe)},discounts:function(){t.e("pages/product/common/discounts").then(function(){return resolve(t("5a30"))}.bind(null,t)).catch(t.oe)},freshDetail:function(){t.e("pages/product/common/freshDetail").then(function(){return resolve(t("0def"))}.bind(null,t)).catch(t.oe)},contentText:function(){t.e("pages/product/common/contentText").then(function(){return resolve(t("5a07"))}.bind(null,t)).catch(t.oe)},productBottom:function(){t.e("pages/product/common/productBottom").then(function(){return resolve(t("b0c6"))}.bind(null,t)).catch(t.oe)},estimate:function(){t.e("pages/product/common/estimate").then(function(){return resolve(t("1afd"))}.bind(null,t)).catch(t.oe)}},data:function(){return{video:"",shareShow:!1,shareImage:"",isSckill:!1,goodsStore:0,specList:[],buys_show:!0,buys_shows:!1,specSelected:[],specClass:"none",many:1,reply:"",option:"",opt:"",list:"",type:1,goodsType:0,goodsNumber:1,goodsid:"",description:"",goodsObjact:{percent:1},imgList:[],actionPrice:0,actionImage:"",good_list:"",goodsNumberMax:0,seckillObj:{stopTime:0,stop:!1,stopTimeH:0,stopTimeM:0,stopTimeS:0,stopTimeD:0,upTime:0},pink:{id:"",uid:"",people:"",price:"",stop_time:"",nickname:"",avatar:"",count:"",h:"",i:"",s:""},userInfo:""}},filters:{parseIntTo:function(e){return e=100*+e,e%1===0||(e=e.toFixed(1)),e}},onLoad:function(o){var t=this;return(0,i.default)(c.default.mark((function n(){var s,i,r;return c.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:s=t,s.userInfo=e.getStorageSync("userInfo"),o.scene?"string"==typeof o.scene&&(i=("{"+o.scene+"}").replace("qr%26","").replace(/%3D/g,":").replace(/%26/g,",").replace("pid",'"pid"').replace("type",'"type"').replace("id",'"id"').replace("sid",'"sid"'),r=JSON.parse(i),t.opt=r,t.goodsid=r.id,r.pid&&e.setStorageSync("spread",r.pid),r.type&&(t.goodsType=r.type)):(console.log(o.id),t.goodsid=o.id,o.type&&(t.goodsType=o.type)),1==o.type&&(s.isSckill=!0),o.spread&&e.setStorageSync("spread",o.spread),(0,d.saveUrl)(),t.goodsDetail();case 7:case"end":return n.stop()}}),n)})))()},computed:function(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{};o%2?p(Object(t),!0).forEach((function(o){(0,s.default)(e,o,t[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}))}return e}({},(0,a.mapState)(["weichatObj","baseURL","urlFile"])),onShareAppMessage:function(e){var o=getCurrentPages(),t=o[o.length-1],n=t.route,c=t.options,s={title:this.goodsObjact.store_name+" 价格:"+this.goodsObjact.price,path:n+"?id="+c.id+"&spread="+this.userInfo.uid,imageUrl:this.goodsObjact.image,success:function(e){e.errMsg},fail:function(){"shareAppMessage:fail cancel"==res.errMsg||res.errMsg}};return s},methods:{selectSpec:function(e,o,t){o.attr_value.forEach((function(e){e.check=!1})),e.check=!0;var n=this;n.specSelected[t]=e.attr;var c=n.specSelected.join(",");n.productValue[c]?(n.buys_show=!0,n.buys_shows=!1,n.actionPrice=n.productValue[c].price,n.goodsNumberMax=n.productValue[c].stock,n.actionImage=n.productValue[c].image,n.uniqueId=n.productValue[c].unique,n.goodsStore=n.productValue[c].stock):(n.buys_show=!1,n.buys_shows=!0),0==n.goodsStore&&(n.buys_show=!1,n.buys_shows=!0),n.specSelected[t]=e.attr},specOPne:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,o=this;o.specClass="show",o.type=e},toggleSpec:function(e){var o=this;"show"===this.specClass?(this.specClass="hide",setTimeout((function(){o.specClass="none"}),250)):"none"===this.specClass&&(this.specClass="show"),this.type=e},Getcoupon:function(){e.navigateTo({url:"/pages/coupon/getcoupon"})},navToDetailPage:function(o){var t=o.id;e.navigateTo({url:"/pages/product/product?id="+t})},shareToFriend:function(){var o=this,t=this;e.showLoading({title:"Loading...",mask:!0});console.log(t.goodsid,"id"),(0,r.poster)({productId:t.goodsid,from:"routine"}).then((function(n){var c=n.data;t.shareImage=c.url,console.log(t.shareImage,"123456"),e.hideLoading(),o.$refs.popupshare.open()})).catch((function(o){e.hideLoading()}))},navTo:function(o){e.navigateTo({url:"/pages/product/reply?id="+this.goodsid})},Addcar:function(o){var t=this;(0,r.cartAdd)({cartNum:"1",uniqueId:"",new:0,mer_id:"",productId:o.id}).then((function(o){e.showToast({title:"成功加入购物车",type:"top",duration:500,icon:"none"}),t.goodsDetail()})).catch((function(e){console.log(e)}))},goodsDetail:function(){var e=this;0==e.goodsType&&(0,r.goodsDetail)({},this.goodsid).then((function(o){var t=o.data;e.list=t,e.good_list=t.good_list,e.reply=t.reply;var n=t.storeInfo;if(e.goodsObjact=n,console.log(n,"123456789"),null!=e.goodsObjact.description&&(e.description=e.goodsObjact.description.replace(/\<img/gi,'<img class="rich-img"')),e.imgList=n.slider_image,n.video_link&&(e.video=n.video_link),e.specList=t.productAttr,1!=Array.isArray(t.productValue)){e.many=2,e.specList=t.productAttr,e.productValue=t.productValue,e.specSelected=[];for(var c=0;c<e.specList.length;c++){var s=e.specList[c].attr_value[0];s.check=!0,e.specSelected.push(s.attr)}var i=e.specSelected.join(",");console.log(i,"str"),e.actionPrice=e.productValue[i].price,e.goodsNumberMax=e.productValue[i].stock,e.actionImage=e.productValue[i].image,e.uniqueId=e.productValue[i].unique,e.goodsStore=e.productValue[i].stock}else e.many=1,e.productValue=t.productValue,e.actionPrice=n.price,e.actionImage=n.image_base,e.goodsNumberMax=n.stock;e.shopId=t.mer_id})),1==e.goodsType&&(0,r.seckillGoods)({},this.goodsid).then((function(o){var t=o.data;e.list=t,console.log(e.list,"秒杀商品数据++++++++++"),e.reply=t.reply;var n=t.storeInfo;e.goodsNumberMax=n.num;var c=(0,u.timeComputed)(1e3*n.stop_time);if(e.seckillObj={stop:c.tpye,stopTimeH:c.hours+24*c.day,stopTimeM:c.minutes,stopTimeS:c.seconds},console.log(e.seckillObj,"数据"),e.goodsObjact=n,null!=e.goodsObjact.description&&(e.description=e.goodsObjact.description.replace(/\<img/gi,'<img class="rich-img"')),e.imgList=n.images,e.specList=t.productAttr,1!=Array.isArray(t.productValue)){console.log("多规格+++++++++++++"),e.many=2,e.specList=t.productAttr,e.productValue=t.productValue,e.specSelected=[];for(var s=0;s<e.specList.length;s++){var i=e.specList[s].attr_value[0];i.check=!0,e.specSelected.push(i.attr)}var r=e.specSelected.join(",");console.log(r,"str"),e.actionPrice=e.productValue[r].price,e.actionImage=e.productValue[r].image,e.uniqueId=e.productValue[r].unique,e.goodsStore=e.productValue[r].stock}else console.log("单规格+++++++++++++"),e.many=1,e.productValue=t.productValue,e.actionPrice=n.price,e.actionImage=n.image_base,console.log(e.goodsNumberMax,"obj.goodsNumberMax---------------"),e.shopId=t.mer_id}))},shareLink:function(e){console.log("dainjideniang"),this.shareShow=!0},cancel:function(){this.shareShow=!1},saveImg:function(o){console.log(o);e.downloadFile({url:this.shareImage,success:function(o){console.log(o.tempFilePath),e.saveImageToPhotosAlbum({filePath:o.tempFilePath,success:function(o){e.showToast({title:"保存成功",icon:"none"})}})}})},buy:function(){var o=this,t={productId:o.goodsid,cartNum:o.goodsNumber,uniqueId:o.uniqueId,new:0,secKillId:"",integralId:"",free_check:0};2==o.type?(console.log("加入购物车"),t.new=0):1==o.type&&(t.new=1),console.log(o.goodsType,"obj.goodsType77777777777777777777"),1==o.goodsType&&(t.secKillId=o.goodsObjact.id,t.new=1),2==o.goodsType&&(t.new=1,t.integralId=o.goodsObjact.id),3==o.goodsType&&(t.new=1,t.free_check=1),(0,r.cartAdd)(t).then((function(t){var n=t.data;1==o.type&&(console.log(o.goodsType,"this.goodsType456444444444444444"),e.navigateTo({url:"/pages/order/createOrder?id="+n.cartId+"&goodsType="+o.goodsType})),2==o.type&&(e.showToast({title:"成功加入购物车",type:"top",duration:2e3,icon:"none"}),o.goodsDetail()),o.toggleSpec()})).catch((function(e){console.log(e)}))},stopPrevent:function(){}}};o.default=l}).call(this,t("543d")["default"])},"3fae":function(e,o,t){"use strict";t.d(o,"b",(function(){return c})),t.d(o,"c",(function(){return s})),t.d(o,"a",(function(){return n}));var n={uniPopup:function(){return t.e("components/uni-popup/uni-popup").then(t.bind(null,"1808"))}},c=function(){var e=this.$createElement;this._self._c},s=[]},"5a16":function(e,o,t){},"8eec":function(e,o,t){"use strict";t.r(o);var n=t("3fae"),c=t("1bc5");for(var s in c)["default"].indexOf(s)<0&&function(e){t.d(o,e,(function(){return c[e]}))}(s);t("c00d");var i=t("f0c5"),r=Object(i["a"])(c["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],void 0);o["default"]=r.exports},a8a4:function(e,o,t){"use strict";(function(e,o){var n=t("4ea4");t("d1cd");n(t("66fd"));var c=n(t("8eec"));e.__webpack_require_UNI_MP_PLUGIN__=t,o(c.default)}).call(this,t("bc2e")["default"],t("543d")["createPage"])},c00d:function(e,o,t){"use strict";var n=t("5a16"),c=t.n(n);c.a}},[["a8a4","common/runtime","common/vendor"]]]);