product.js 6.9 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/product/product"],{"0739":function(e,t,o){"use strict";o.r(t);var n=o("efc9"),s=o("f2c7");for(var i in s)["default"].indexOf(i)<0&&function(e){o.d(t,e,(function(){return s[e]}))}(i);o("3f83");var r=o("f0c5"),c=Object(r["a"])(s["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],void 0);t["default"]=c.exports},"284a":function(e,t,o){"use strict";(function(e,t){var n=o("4ea4");o("3e39");n(o("66fd"));var s=n(o("0739"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(s.default)}).call(this,o("bc2e")["default"],o("543d")["createPage"])},"3f83":function(e,t,o){"use strict";var n=o("a385"),s=o.n(n);s.a},"4c3b":function(e,t,o){"use strict";(function(e){var n=o("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=n(o("2eee")),i=n(o("9523")),r=n(o("c973")),c=o("9918"),a=o("26cb");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}var d={components:{uniNumberBox:function(){o.e("components/uni-number-box").then(function(){return resolve(o("4ed6"))}.bind(null,o)).catch(o.oe)},uniCountdown:function(){o.e("components/uni-countdown/uni-countdown").then(function(){return resolve(o("751c"))}.bind(null,o)).catch(o.oe)}},filters:{address:function(e){var t="";return e&&(t=e[0]+" "+e[1]),t}},data:function(){return{details:"",reply:"",type:1,goodsNumber:1,goodsid:"",specClass:"none",shareList:[],goodsObjact:{},storeObjact:{},imgList:[],specList:[],productValue:[],actionPrice:0,actionImage:"",uniqueId:"",specSelected:[],specSelectedName:"",goodsNumberMax:0,shopId:"",shopInfo:{logo:"",title:""},goodsType:0,seckillObj:{stopTime:0,stop:!1,stopTimeH:0,stopTimeM:0,stopTimeS:0},pink:{id:"",uid:"",people:"",price:"",stop_time:"",nickname:"",avatar:"",count:"",h:"",i:"",s:""},is_bk:0,is_xf:0,goodIntegral:0}},onLoad:function(t){var o=this;return(0,r.default)(s.default.mark((function n(){var i,r,c;return s.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(i=o,t.is_bk&&(i.is_bk=t.is_bk),t.is_xf&&(i.is_xf=t.is_xf),o.goodsid=t.id,t.spread&&e.setStorageSync("spread",t.spread),1!=t.type){n.next=13;break}return o.goodsType=1,o.seckillObj.stopTime=t.stoptime,r=1e3*t.stoptime,c=new Date,c.getTime()>r?o.seckillObj.stop=!0:o.timeComputed(r,o.seckillObj),o.seckillGoods(),n.abrupt("return");case 13:if(2!=t.type){n.next=17;break}return o.goodsType=2,o.groupGoods(),n.abrupt("return");case 17:0==o.goodsType&&o.goodsDetail();case 18:case"end":return n.stop()}}),n)})))()},computed:function(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){(0,i.default)(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}({},(0,a.mapState)("user",["userInfo","hasLogin"])),onShareAppMessage:function(e){var t=getCurrentPages(),o=t[t.length-1],n=o.route,s=o.options,i=this.goodsObjact.store_name||this.goodsObjact.title,r={title:i,path:n+"?id="+s.id+"&scene="+this.userInfo.uid+"&type="+this.goodsType,imageUrl:this.goodsObjact.image,success:function(e){console.log(r.path,"path+++++++++++++++++++"),e.errMsg},fail:function(){"shareAppMessage:fail cancel"==res.errMsg||res.errMsg}};return r},methods:{navTo:function(t){e.navigateTo({url:t})},moneyNum:function(e){return+e},navToProductGoods:function(){e.redirectTo({url:"/pages/product/product?id="+this.goodsObjact.product_id})},goodsDetail:function(){var e=this;(0,c.goodsDetail)({},this.goodsid).then((function(t){var o=t.data;e.details=o;var n=o.storeInfo,s=o.system_store;console.log(s),e.storeObjact=s,e.goodsObjact=n,null!=e.goodsObjact.description&&(e.goodsObjact.description=e.goodsObjact.description.replace(/\<img/gi,'<img class="rich-img"')),e.reply=o.reply,e.imgList=n.slider_image,e.specList=o.productAttr,console.log(o.productAttr),e.productValue=o.productValue,e.actionPrice=n.price,e.actionImage=n.image_base,e.goodsNumberMax=n.stock,e.shopId=o.mer_id,e.specSelected=[];for(var i=0;i<e.specList.length;i++){var r=e.specList[i].attr_value[0];r.check=!0,e.specSelected.push(r.attr)}var c=e.specSelected.join(",");e.actionImage=e.productValue[c].image,e.uniqueId=e.productValue[c].unique,e.goodIntegral=e.productValue[c].integral,1==e.is_xf&&(e.goodsNumberMax=1),console.log(e.goodIntegral,"obj.goodIntegral")}))},numberChange:function(e){this.goodsNumber=e.number},toggleSpec:function(e){var t=this;"show"===this.specClass?(this.specClass="hide",setTimeout((function(){t.specClass="none"}),250)):"none"===this.specClass&&(this.specClass="show"),this.type=e},selectSpec:function(e,t,o){t.attr_value.forEach((function(e){e.check=!1})),e.check=!0,this.specSelected[o]=e.attr;var n=this.specSelected.join(",");if(this.specSelectedName=this.specSelected.join(" "),this.productValue[n]){var s=this.productValue[n];this.actionPrice=s.price,this.goodsNumberMax=s.stock,this.actionImage=s.image,this.uniqueId=s.unique,this.goodIntegral=s.integral,console.log(this.goodIntegral,"xuanz")}1==this.is_xf&&(this.goodsNumberMax=1)},share:function(){this.$refs.share.toggleMask()},toFavorite:function(t){t.userCollect=!t.userCollect,t.userCollect?(0,c.collectAdd)({id:this.goodsid,category:"product"}).then((function(t){e.showToast({title:"成功加入收藏",type:"top",duration:1500})})):(0,c.collectDel)({id:this.goodsid,category:"product"}).then((function(t){e.showToast({title:"成功取消收藏",type:"top",duration:1500})}))},buy:function(){var t=this,o={cartNum:t.goodsNumber,uniqueId:t.uniqueId,new:"1",mer_id:t.shopId};2==t.type&&(o.new=0),0==t.goodsType&&(o.productId=t.goodsid),1==t.goodsType&&(o.secKillId=t.goodsid,o.productId=t.goodsObjact.product_id,t.seckillObj.stop)?e.showModal({title:"提示",content:"当前活动已经结束",showCancel:!1}):(2==t.goodsType&&(o.combinationId=t.goodsid,o.productId=t.goodsObjact.product_id),(0,c.cartAdd)(o).then((function(o){var n=o.data;1==t.type&&e.navigateTo({url:"/pages/order/createOrder?id="+n.cartId+"&goodsType="+t.goodsType+"&is_xf="+t.is_xf+"&is_bk="+t.is_bk}),2==t.type&&(e.showToast({title:"成功加入购物车",type:"top",duration:2e3}),t.toggleSpec())})).catch((function(e){console.log(e)})))},stopPrevent:function(){}}};t.default=d}).call(this,o("543d")["default"])},a385:function(e,t,o){},efc9:function(e,t,o){"use strict";o.d(t,"b",(function(){return s})),o.d(t,"c",(function(){return i})),o.d(t,"a",(function(){return n}));var n={uniCountdown:function(){return o.e("components/uni-countdown/uni-countdown").then(o.bind(null,"751c"))}},s=function(){var e=this.$createElement;this._self._c},i=[]},f2c7:function(e,t,o){"use strict";o.r(t);var n=o("4c3b"),s=o.n(n);for(var i in n)["default"].indexOf(i)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(i);t["default"]=s.a}},[["284a","common/runtime","common/vendor"]]]);