quick-shop.js 7.5 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/quick-shop/quick-shop"],{"0cfd":function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return o})),i.d(e,"c",(function(){return r})),i.d(e,"a",(function(){return n}));var o=function(){var t=this,e=t.$createElement;t._self._c},r=[]},"20b5":function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(i("a34a")),o=i("2f62");function r(t){return t&&t.__esModule?t:{default:t}}function a(t,e,i,n,o,r,a){try{var c=t[r](a),s=c.value}catch(u){return void i(u)}c.done?e(s):Promise.resolve(s).then(n,o)}function c(t){return function(){var e=this,i=arguments;return new Promise((function(n,o){var r=t.apply(e,i);function c(t){a(r,n,o,c,s,"next",t)}function s(t){a(r,n,o,c,s,"throw",t)}c(void 0)}))}}function s(t){return f(t)||d(t)||l(t)||u()}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(t,e){if(t){if("string"===typeof t)return h(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?h(t,e):void 0}}function d(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function f(t){if(Array.isArray(t))return h(t)}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function m(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function v(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var g=function(){i.e("pages/quick-shop/components/app-add-subtract/app-add-subtract").then(function(){return resolve(i("b21c"))}.bind(null,i)).catch(i.oe)},b=function(){Promise.all([i.e("common/vendor"),i.e("components/page-component/app-attr/app-attr")]).then(function(){return resolve(i("8b0c"))}.bind(null,i)).catch(i.oe)},_=function(){Promise.all([i.e("common/vendor"),i.e("components/page-component/goods/u-attr")]).then(function(){return resolve(i("338d"))}.bind(null,i)).catch(i.oe)},y={name:"quick-shop",components:{"app-add-subtract":g,"app-attr":b,uAttr:_},computed:m(m(m({},(0,o.mapState)({tabBarNavs:function(t){return t.mallConfig.navbar.navs},appSetting:function(t){return t.mallConfig.mall.setting},appImg:function(t){return t.mallConfig.__wxapp_img.mall},isListUnderlinePrice:function(t){return t.mallConfig.mall.setting.is_list_underline_price},platform:function(t){return t.gConfig.systemInfo.platform}})),(0,o.mapGetters)("iPhoneX",{botHeight:"getBotHeight"})),(0,o.mapGetters)("mallConfig",{getTheme:"getTheme",getVideo:"getVideo"})),data:function(){return{activeNum:"",classification:[],activeIndex:0,activeName:"",list:[],coverPic:"",spec:!0,goodsNum:0,item:{use_attr:0},selectAttr:{},checked:null,show:!1,page:1,over:!1,tabbarbool:!1,currentRoute:this.$platDiff.route(),activeId:"0",scrollTop:0,old:{scrollTop:0}}},methods:{onAttr:function(t){var e=t.item;this.checked=e},request:function(){var t=this;this.$request({url:"".concat(this.$api.quick.goods_list,"&page=").concat(this.page,"&cat_id=").concat(this.activeId,"is_sell_well=0 ")}).then((function(e){0===e.code&&(e.data.list.length>0?t.list=[].concat(s(t.list),s(e.data.list)):t.over=!0)}))},active:function(t,e){var i=this;this.scrollTop=1,this.$nextTick((function(){i.scrollTop=0})),this.activeIndex=e,this.activeName=t.name,this.activeId=t.id,this.over=!1,this.page=1,this.pushSelectProduct().then((function(){i.$request({url:"".concat(i.$api.quick.goods_list,"&page=").concat(i.page,"&cat_id=").concat(t.id,"is_sell_well=0 ")}).then((function(t){i.list=t.data.list}))}))},specification:function(t){this.checked=null,this.item=t,this.show=!0},selectNumber:function(t,e){for(var i=0;i<this.list.length;i++)this.list[i].id===t.goods_id&&(this.list[i].total_num+=e,this.activeNum=Number(this.activeNum)+Number(e))},pushSelectProduct:function(){var t=this;return c(n.default.mark((function e(){var i,o;return n.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:for(o in i=[],t.selectAttr)i.push(t.selectAttr[o]);t.$request({url:t.$api.quick.cart,method:"post",data:{list:JSON.stringify(i)}});case 3:case"end":return e.stop()}}),e)})))()},add:function(t){for(var e=0;e<this.list.length;e++)this.list[e].id===t.id&&(this.list[e].total_num+=1,this.activeNum=Number(this.activeNum)+1,this.selectAttr[t.attr[0].id]={attr:t.attr[0].id,num:this.list[e].total_num,goods_id:t.id})},subtract:function(t){for(var e=0;e<this.list.length;e++)this.list[e].id===t.id&&(this.list[e].total_num-=1,this.activeNum=Number(this.activeNum)-1,this.selectAttr[t.attr[0].id]={attr:t.attr[0].id,num:this.list[e].total_num,goods_id:t.id})},changeNum:function(t,e){for(var i=0;i<this.list.length;i++)this.list[i].id===t.id&&(this.activeNum=Number(this.activeNum)-this.list[i].total_num,this.activeNum=Number(this.activeNum)+e,this.list[i].total_num=e,this.selectAttr[t.attr[0].id]={attr:t.attr[0].id,num:this.list[i].total_num,goods_id:t.id})},jumpGo:function(e){e.video_url&&1==this.getVideo?t.navigateTo({url:"/pages/goods/video?goods_id=".concat(e.id)}):t.navigateTo({url:"/pages/goods/goods?id=".concat(e.id)})},scrolltolower:function(){this.over||(this.page++,this.request())},b:function(){for(var t=this.currentRoute,e=0;e<this.tabBarNavs.length;e++)if(t.includes(this.tabBarNavs[e].url.split("?")[0]))return this.tabbarbool=!0;return this.tabbarbool=!1}},onLoad:function(){var t=this;this.$commonLoad.onload(),this.$request({url:this.$api.quick.index}).then((function(e){t.activeNum="".concat(e.data.count);var i=e.data.cats_list[t.activeIndex],n=i.name,o=i.id;t.activeName=n,t.activeId=o,t.classification=e.data.cats_list,t.$request({url:t.$api.quick.index}).then((function(e){t.activeNum="".concat(e.data.count)})),t.$request({url:"".concat(t.$api.quick.goods_list,"&page=").concat(t.page,"&cat_id=").concat(o,"is_sell_well=0 ")}).then((function(e){t.list=e.data.list}))}))},onHide:function(){this.pushSelectProduct()},onUnload:function(){this.pushSelectProduct()},onShareAppMessage:function(){return this.$shareAppMessage({path:"/pages/quick-shop/quick-shop",title:this.$children[0].navigationBarTitle})},watch:{tabBarNavs:{handler:function(){this.b()},immediate:!0}}};e.default=y}).call(this,i("543d")["default"])},"2d2d":function(t,e,i){},"2e56":function(t,e,i){"use strict";i.r(e);var n=i("20b5"),o=i.n(n);for(var r in n)"default"!==r&&function(t){i.d(e,t,(function(){return n[t]}))}(r);e["default"]=o.a},"37ab":function(t,e,i){"use strict";var n=i("2d2d"),o=i.n(n);o.a},9858:function(t,e,i){"use strict";(function(t){i("2d0a");n(i("66fd"));var e=n(i("d3a4"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,i("543d")["createPage"])},d3a4:function(t,e,i){"use strict";i.r(e);var n=i("0cfd"),o=i("2e56");for(var r in o)"default"!==r&&function(t){i.d(e,t,(function(){return o[t]}))}(r);i("37ab");var a,c=i("f0c5"),s=Object(c["a"])(o["default"],n["b"],n["c"],!1,null,"30df9c09",null,!1,n["a"],a);e["default"]=s.exports}},[["9858","common/runtime","common/vendor"]]]);