猎豆优选小程序

optimization.js 7.8KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/optimization/optimization"],{"182f":function(t,e,o){"use strict";o.d(e,"b",(function(){return n})),o.d(e,"c",(function(){return a})),o.d(e,"a",(function(){return i}));var i={uIcon:function(){return o.e("node-modules/uview-ui/components/u-icon/u-icon").then(o.bind(null,"edf6"))}},n=function(){var t=this,e=t.$createElement,o=(t._self._c,t.goodsList&&t.goodsList.length),i=o?t.__map(t.goodsList,(function(e,o){var i=t.__get_orig(e),n=t.loadLazyData.filter((function(t){return t==o})).length,a=n>0&&e.goods.volume>100?t.$NumberHandle({value:e.goods.volume,comma:!0}):null;return{$orig:i,g1:n,m0:a}})):null;t.$mp.data=Object.assign({},{$root:{g0:o,l0:i}})},a=[]},"61c1":function(t,e,o){"use strict";(function(t,e){var i=o("47a9");o("1f2f");i(o("3240"));var n=i(o("6704"));t.__webpack_require_UNI_MP_PLUGIN__=o,e(n.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},6704:function(t,e,o){"use strict";o.r(e);var i=o("182f"),n=o("e284");for(var a in n)["default"].indexOf(a)<0&&function(t){o.d(e,t,(function(){return n[t]}))}(a);o("87c5");var s=o("828b"),r=Object(s["a"])(n["default"],i["b"],i["c"],!1,null,"40022f8e",null,!1,i["a"],void 0);e["default"]=r.exports},"87c5":function(t,e,o){"use strict";var i=o("9aa4"),n=o.n(i);n.a},"903f":function(t,e,o){"use strict";(function(t,i){var n=o("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n(o("7eb4")),s=n(o("af34")),r=n(o("ee10")),d=getApp(),c={data:function(){return{statusBarHeight:d.globalData.statusBarHeight,navbarBackground:{backgroundColor:"transparent"},user_level:t.getStorageSync("userInfo")?t.getStorageSync("userInfo").user_level:"",filter:{page:1,page_size:20,nowTotal:0,hasNext:!0},goodsList:[],swiperHeight:"800",imgSwiperGoodsId:"",play:!1,loadLazyData:[-1,0,1],elite_id:2,isLogin:!1}},onShow:function(){var e=t.getStorageSync("userInfo")||"",o=t.getStorageSync("user_id")||"";this.user_level=t.getStorageSync("userInfo")?t.getStorageSync("userInfo").user_level:"",this.isLogin=!(!e||!o),t.getStorageSync("loginPageBack")&&(this.handleGetGoodsList(),t.setStorageSync("loginPageBack",!1))},onLoad:function(){this.swiperHeight="".concat(t.getSystemInfoSync().windowHeight),this.handleGetGoodsList()},methods:{onClickSearch:function(){t.navigateTo({url:"/pages/subPackages/home/search"})},onClickFYJGM:function(){t.navigateTo({url:"/pages/subPackages/login/loginPhone"})},onClickFXZQ:function(e){t.navigateTo({url:"/pages/subPackages/home/shareDetail?shop_type=".concat(e.shop_type,"&goods_id=").concat(encodeURIComponent(e.goods_id))})},onClickGWSQ:function(e){var o=this,n=e.index,a=e.goods_id;this.goodsList[n].goods.weChatShortLink?i.navigateToMiniProgram({shortLink:this.goodsList[n].goods.weChatShortLink}):this.handleGetgoodsItem(a).then((function(e){e.url_info&&e.url_info.weChatShortLink?(i.navigateToMiniProgram({shortLink:e.url_info.weChatShortLink}),o.goodsList[n].goods.goods_id==a&&(o.goodsList[n].goods.weChatShortLink=e.url_info.weChatShortLink)):t.showToast({title:"购买失败!",icon:"none"})})).catch((function(){t.showToast({title:"购买失败!",icon:"none"})}))},handleGetgoodsItem:function(e){var o=this;return new Promise(function(){var i=(0,r.default)(a.default.mark((function i(n,s){var r,d,c,u,l;return a.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.prev=0,t.showLoading({title:"加载中...",mask:!0}),r=o.$api_jd.goods_detail,d={goods_id:e.toString()},i.next=6,o.$postJSON(r,d);case 6:c=i.sent,u=c.data,l=void 0===u?{}:u,l&&0==l.errno&&l.rst.data?n(l.rst.data):(s(!1),t.showToast({title:l.err||"操作失败",icon:"none"})),i.next=15;break;case 12:i.prev=12,i.t0=i["catch"](0),s(!1);case 15:return i.prev=15,t.hideLoading(),i.finish(15);case 18:case"end":return i.stop()}}),i,null,[[0,12,15,18]])})));return function(t,e){return i.apply(this,arguments)}}())},onClickSetFavorites:function(e){var o=e.goodsItem,i=e.index;this.isLogin?this.handleSetFavorites({goodsItem:o,index:i}):t.navigateTo({url:"/pages/subPackages/login/loginPhone"})},handleSetFavorites:function(e){var o=this;return(0,r.default)(a.default.mark((function i(){var n,s,r,d,c,u,l,g,h,p,f,_,v,m,y;return a.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return n=e.goodsItem,s=e.index,r=n.goods_id,d=n.is_coupon,c=n.discount_price,u=n.price,l=n.coupon_price,g=n.commission_rate,h=n.coupon_end_time,p=n.coupon_start_time,f=n.shop_type,i.prev=2,t.showLoading({title:"加载中...",mask:!0}),_=o.$api.goodsItem_addFavorites,v={goods_id:r,is_coupon:d,discount_price:c,price:u,coupon_price:l,commission_rate:g,coupon_end_time:h,coupon_start_time:p,shop_type:f},i.next=8,o.$postJSON(_,v);case 8:m=i.sent,y=m.data,y&&0==y.errno?o.goodsList[s].goods.is_favorites=1==o.goodsList[s].goods.is_favorites?0:1:t.showToast({title:y.err||"操作失败",icon:"none"}),i.next=16;break;case 13:i.prev=13,i.t0=i["catch"](2),console.log("error => ",i.t0);case 16:return i.prev=16,t.hideLoading(),i.finish(16);case 19:case"end":return i.stop()}}),i,null,[[2,13,16,19]])})))()},onClickGoodsItem:function(e){try{d.categoryNew_countBuy({shop_type:e.shop_type,type:0,path:"jd_optimization",category_id:this.elite_id})}catch(o){}t.navigateTo({url:"/pages/subPackages/home/jdGoodsDetail?goods_id=".concat(encodeURIComponent(e.goods_id))})},change:function(e){var o=e.detail.currentItemId,i=e.detail.current;if(this.loadLazyData=[i-1,i,i+1],this.loadLazyData[2]==this.filter.nowTotal-1){if(!this.filter.hasNext)return t.showToast({title:"没有更多了",icon:"none"}),!1;this.filter.page++,this.handleGetGoodsList()}var n=t.createVideoContext("myVideo"+this.imgSwiperGoodsId,this);n&&n.pause&&n.pause(),this.play=!1,this.imgSwiperGoodsId=o.split("&&")[1],"video"==o.split("&&")[0]&&this.playVideo()},clickVideo:function(){this.play?this.pauseVideo():this.playthis()},playVideo:function(){var e=t.createVideoContext("myVideo"+this.imgSwiperGoodsId,this);!1===this.play&&(e.seek(0),e.play(),this.play=!0)},pauseVideo:function(){var e=t.createVideoContext("myVideo"+this.imgSwiperGoodsId,this);!0===this.play&&(e.pause(),this.play=!1)},playthis:function(){var e=t.createVideoContext("myVideo"+this.imgSwiperGoodsId,this);!1===this.play&&(e.play(),this.play=!0)},changePlay:function(){this.play=!0},handleGetGoodsList:function(){var e=this;return(0,r.default)(a.default.mark((function o(){var i,n,r,d,c,u;return a.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.filter.hasNext){o.next=2;break}return o.abrupt("return",!1);case 2:return o.prev=2,1==e.filter.page&&t.showLoading({title:"加载中...",mask:!0}),i=e.$api_jd.jd_goodsListByEliteId,n={elite_id:e.elite_id,page:e.filter.page,page_size:e.filter.page_size},o.next=8,e.$postJSON(i,n);case 8:if(r=o.sent,d=r.data,c=void 0===d?{}:d,!c||0!=c.errno||!Array.isArray(c.rst.data)){o.next=22;break}if(c.rst.data.length||(e.filter.hasNext=!1),Array.isArray(c.rst.data)){o.next=15;break}return o.abrupt("return");case 15:u=c.rst.data,u=u.filter((function(t){return t.goods})),e.goodsList=[].concat((0,s.default)(e.goodsList),(0,s.default)(u)),e.filter.nowTotal=e.goodsList.length,e.$nextTick((function(){if(Array.isArray(e.goodsList)&&!(e.goodsList.length<=0)&&1==e.filter.page){var t=e.goodsList[0].goods;e.imgSwiperGoodsId=t.goods_id,t&&t.video_list&&t.video_list[0]&&t.video_list[0].playUrl&&e.playthis()}})),o.next=23;break;case 22:t.showToast({title:c.err||"操作失败",icon:"none"});case 23:o.next=28;break;case 25:o.prev=25,o.t0=o["catch"](2),console.log("error => ",o.t0);case 28:return o.prev=28,t.hideLoading(),o.finish(28);case 31:case"end":return o.stop()}}),o,null,[[2,25,28,31]])})))()}}};e.default=c}).call(this,o("df3c")["default"],o("3223")["default"])},"9aa4":function(t,e,o){},e284:function(t,e,o){"use strict";o.r(e);var i=o("903f"),n=o.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){o.d(e,t,(function(){return i[t]}))}(a);e["default"]=n.a}},[["61c1","common/runtime","common/vendor"]]]);