1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/index"],{2265:function(t,e,n){"use strict";(function(t){var o=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o(n("9523")),c=n("8a83"),r=n("a767");function s(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 a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){(0,i.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var u=n("4785"),l=new u({key:"KX5BZ-B64RC-RO62W-AMWAZ-VVTC3-YAFXF"}),d={data:function(){return{background:!1,loading:!1,userId:"",city:"定位中",status:"more",current:0,bannerList:["https://alipic.lanhuapp.com/XDSlicePNGMAX2f4cb415a269b2e935c7a97da9077db4d78ddb8306ac44ec1e10274387048a22.png","https://alipic.lanhuapp.com/XDSlicePNGMAX2f4cb415a269b2e935c7a97da9077db4d78ddb8306ac44ec1e10274387048a22.png"],discountsList:[],advList:[],advList1:[],list:[],list1:[],query:{queryName:"","location.lat":0,"location.lon":0,pageCurrent:1,pageSize:10}}},methods:{swiperChange:function(t){this.current=t.target.current},jump:function(e){t.reLaunch({url:e})},handleSearch:function(){if(!t.getStorageSync("token"))return t.showModal({title:"请登录",confirmText:"去登录",success:function(e){console.log(e),e.confirm&&t.navigateTo({url:"/login/login/login?redirect=/pages/index/index"})}});t.reLaunch({url:"./search"})},getCity:function(){var e=this;return new Promise((function(n,o){t.getLocation({type:"gcj02",success:function(o){e.query["location.lat"]=o.latitude,e.query["location.lon"]=o.longitude,t.setStorageSync("location",JSON.stringify({latitude:o.latitude,longitude:o.longitude})),l.reverseGeocoder({location:{latitude:o.latitude,longitude:o.longitude},success:function(o){e.city=o.result.address_component.city,console.log(9999,e.city,o),t.setStorageSync("districtList")&&t.getStorageSync("city")==e.city||(t.setStorageSync("city",o.result.address_component.city),l.getDistrictByCityId({id:o.result.ad_info.city_code.substr(3),success:function(e){console.log("对应城市ID下的区县数据:",e.result[0]);var n=e.result[0];n.map((function(t){t.label=t.fullname})),t.setStorageSync("districtList",JSON.stringify(n))},fail:function(t){console.error(t)},complete:function(t){console.log(t)}}),n())},fail:function(t){e.city="定位失败"}})},fail:function(){console.log("获取经纬度失败")}})}))},goDetail:function(e,n,o,i){t.navigateTo({url:"".concat(e,"?id=").concat(n,"&title=").concat(i),success:function(t){t.eventChannel.emit("banner",o)}})},goGoodsDetail:function(e){t.setStorageSync("shopInfo",JSON.stringify(e)),t.reLaunch({url:"../../detail/goodsDetail/index?id=".concat(e.goodsVos[0].goodsId)})},handleMore:function(){t.reLaunch({url:"../../combo/combo/combo"})},getUserDetail:function(){(0,c.getUserDetail)().then((function(e){t.setStorageSync("userInfo",JSON.stringify(e.content))}))},loadMore:function(){this.query["location.lat"]&&this.query["location.lon"]&&this.search()},search:function(){var t=this;"noMore"!=this.status&&(this.status="loading",(0,r.search)(this.query).then((function(e){if("Success"==e.state){t.loading=!1;var n=[],o=[],i=e.content.records;i.map((function(t,e){e%2==0?n.push(t):o.push(t)})),t.list=t.list.concat(n),t.list1=t.list1.concat(o),t.query.pageCurrent==e.content.pages?t.status="noMore":(t.status="more",t.query.pageCurrent++),t.advList1.length?t.advList1.map((function(e){e.showSort<=t.list.length+t.list1.length&&((e.showSort-1)%2==0?t.list.splice(Math.ceil(e.showSort/2)-1,0,a({isAdv:!0},e)):t.list1.splice(Math.ceil(e.showSort/2)-1,0,a({isAdv:!0},e)))})):t.getGoodsAdv().then((function(){t.advList1.map((function(e){e.showSort<=t.list.length+t.list1.length&&((e.showSort-1)%2==0?t.list.splice(Math.ceil(e.showSort/2)-1,0,a({isAdv:!0},e)):t.list1.splice(Math.ceil(e.showSort/2)-1,0,a({isAdv:!0},e)))}))}))}})))},getMenu:function(){var t=this;return new Promise((function(e,n){(0,c.getMenu)({currentPage:1,pageSize:10,status:2}).then((function(n){"Success"==n.state&&(t.discountsList=n.content.records,e(1))}))}))},getAdv:function(){var t=this;return new Promise((function(e,n){(0,c.getAdv)({currentPage:1,pageSize:99,advertsType:1,status:1}).then((function(n){"Success"==n.state&&(t.advList=n.content.records,e(2))}))}))},getGoodsAdv:function(){var t=this;return new Promise((function(e,n){(0,c.getAdv)({currentPage:1,pageSize:99,advertsType:2,status:1}).then((function(n){"Success"==n.state&&(t.advList1=n.content.records,e(2))}))}))}},onPageScroll:function(t){t.scrollTop>=50?this.background=!0:this.background=!1},onShow:function(){t.getStorageSync("token")&&!t.getStorageSync("userInfo")&&this.getUserDetail()},onHide:function(){},onLoad:function(e){t.setStorageSync("inviteCode",decodeURIComponent(e.scene))},created:function(){var t=this;this.loading=!0,Promise.all([this.getMenu(),this.getAdv(),this.getCity()]).then((function(e){t.search()}))}};e.default=d}).call(this,n("543d")["default"])},"5c49":function(t,e,n){"use strict";(function(t,e){var o=n("4ea4");n("b7d7");o(n("66fd"));var i=o(n("d1ff"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(i.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"5de8":function(t,e,n){"use strict";var o=n("ea97"),i=n.n(o);i.a},"920d":function(t,e,n){"use strict";n.r(e);var o=n("2265"),i=n.n(o);for(var c in o)["default"].indexOf(c)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(c);e["default"]=i.a},d1ff:function(t,e,n){"use strict";n.r(e);var o=n("f48d"),i=n("920d");for(var c in i)["default"].indexOf(c)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(c);n("5de8");var r=n("f0c5"),s=Object(r["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);e["default"]=s.exports},ea97:function(t,e,n){},f48d:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return c})),n.d(e,"a",(function(){return o}));var o={zsSkeleton:function(){return n.e("components/zs-skeleton/index").then(n.bind(null,"32b9"))},zsBanner:function(){return n.e("components/zs-banner/index").then(n.bind(null,"e1ed"))},zsList:function(){return n.e("components/zs-list/index").then(n.bind(null,"7636"))},zsImg:function(){return Promise.all([n.e("common/vendor"),n.e("components/zs-img/index")]).then(n.bind(null,"3acd"))}},i=function(){var t=this.$createElement,e=(this._self._c,this.advList.length);this.$mp.data=Object.assign({},{$root:{g0:e}})},c=[]}},[["5c49","common/runtime","common/vendor"]]]);
|