1 line
23 KiB
Plaintext
1 line
23 KiB
Plaintext
{"version":3,"sources":["uni-app:///main.js","webpack:///D:/Lee/mall-laonong/pages/index/index.vue?dfb0","webpack:///D:/Lee/mall-laonong/pages/index/index.vue?f790","webpack:///D:/Lee/mall-laonong/pages/index/index.vue?8761","webpack:///D:/Lee/mall-laonong/pages/index/index.vue?05a5","uni-app:///pages/index/index.vue"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":"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UA,mCAVA;;AAYA;AACA,WAdA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OA3BA;AA4BA,KAjFA;;AAmFA;AACA,YApFA,oBAoFA,KApFA,EAoFA;AACA;AACA;AACA;AACA;AACA;AACA,WAHA,MAGA;AACA;AACA;AACA,SAPA;AAQA;AACA,KA/FA;;AAiGA;AACA,YAlGA,oBAkGA,EAlGA,EAkGA;AACA;AACA,6DADA;;AAGA,KAtGA;;AAwGA;AACA,gBAzGA,wBAyGA,KAzGA,EAyGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KApHA;;AAsHA;AACA,cAvHA,wBAuHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAPA;AAQA,KAhIA;;AAkIA;AACA,WAnIA,qBAmIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAJA;AAKA,OAPA;AAQA,KA7IA;;AA+IA;AACA,UAhJA,oBAgJA;AACA;AACA;AACA;AACA;AACA;AACA,SAFA,MAEA;AACA;AACA;AACA,OARA;AASA,KA1JA;;AA4JA;AACA,kBA7JA,0BA6JA,EA7JA,EA6JA,QA7JA,EA6JA;AACA;AACA;AACA,OAFA;AAGA,KAjKA;;AAmKA;AACA,UApKA,kBAoKA,CApKA,EAoKA;AACA;AACA,KAtKA;;AAwKA;AACA,YAzKA,sBAyKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBADA;AAEA,+BAFA;AAGA,6BAHA;AAIA,iDAJA;AAKA,+BALA;AAMA,2BANA;AAOA,+BAPA;AAQA,yCARA;;AAUA;AACA,WAZA;AAaA;AACA;AACA,OApBA;AAqBA,KAnMA;;AAqMA;AACA,eAtMA,yBAsMA;AACA;AACA;AACA;AACA,KA1MA,EA1GA,E","file":"pages/index/index.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/index/index.vue'\ncreatePage(Page)","import { render, staticRenderFns, recyclableRender, components } from \"./index.vue?vue&type=template&id=57280228&\"\nvar renderjs\nimport script from \"./index.vue?vue&type=script&lang=js&\"\nexport * from \"./index.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"pages/index/index.vue\"\nexport default component.exports","export * from \"-!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index.vue?vue&type=template&id=57280228&\"","var components\ntry {\n components = {\n tabbar: function() {\n return import(\n /* webpackChunkName: \"components/tabbar/tabbar\" */ \"@/components/tabbar/tabbar.vue\"\n )\n }\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index.vue?vue&type=script&lang=js&\"","<template>\n\t<view>\n\t\t<view class=\"index-page pad-x190 border-box\" v-if=\"isLoading\">\r\n\t\t\t<!-- 轮播 -->\n\t\t\t<view class=\"index-top\">\r\n\t\t\t\t<swiper-pu newRadius=\"0\" :bannerList=\"bannerList\" newHeight=\"500rpx\" :isplay='isplay' :isDot=\"false\"></swiper-pu>\n\t\t\t</view>\n\t\t\t<view class=\"index-content background-white\">\r\n\t\t\t\t<view class=\"index-statis-bg background-white\" :style=\"{height:statusHeight+90+'px'}\" v-if=\"!isShow\"></view>\n\t\t\t\t<!-- 搜索 -->\n\t\t\t\t<view class=\"pull-search-bg background-white radius20 pad-sx30 border-box\" v-if=\"isShow\">\n\t\t\t\t\t<view class=\"pull-search radius20 flex\">\n\t\t\t\t\t\t<image class=\"img\" src=\"/static/icon/icon-search.png\" mode=\"widthFix\"></image>\n\t\t\t\t\t\t<input class=\"input pad-zy15 border-box font30\" v-model=\"keyword\" type=\"text\" placeholder=\"搜索\" confirm-type=\"search\" @confirm=\"doSearch\" placeholder-style=\"color: #666666\">\n\t\t\t\t\t</view>\n\t\t\t\t</view>\n\t\t\t\t<!-- 商品分类 -->\n\t\t\t\t<view class=\"index-cate-bg pad-zy20 background-white\" :class=\"!isShow?'show':''\" id=\"index-cate-bg\" :style=\"{top:statusHeight+35+'px'}\">\n\t\t\t\t\t<view class=\"index-cate pad-zy20 border-box\" :class=\"!isShow?'show':''\">\n\t\t\t\t\t\t<view class=\"pull-title\" v-if=\"isShow\">\n\t\t\t\t\t\t\t<view class=\"txt font32 pad-sx10\">商品</view>\n\t\t\t\t\t\t\t<view class=\"line background-orange\"></view>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t\t<view class=\"cate-list-bg\">\n\t\t\t\t\t\t\t<scroll-view scroll-x=\"true\" :scroll-left=\"tabsScrollLeft\" @scroll=\"scroll\">\n\t\t\t\t\t\t\t\t<view class=\"cate-list flex\" id=\"tab_list\" :style=\"{width:cateWidth}\">\n\t\t\t\t\t\t\t\t\t<view class=\"cate-item\" :class=\"index==currentIndex?'color-orange':''\" id=\"tab_item\" v-for=\"(item,index) in cateList\" :key=\"index\" @tap=\"changeCateEv(index)\">\n\t\t\t\t\t\t\t\t\t\t<view class=\"img mar-sx20\"><image :src=\"item.cover\" mode=\"widthFix\"></image></view>\n\t\t\t\t\t\t\t\t\t\t<view class=\"txt font24\">{{item.title}}</view>\n\t\t\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t\t</scroll-view>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t</view>\n\t\t\t\t</view>\n\t\t\t\t<!-- 商品列表 -->\n\t\t\t\t<view class=\"commodity pad-zy20 border-box flex\">\n\t\t\t\t\t<view class=\"item mar-s40 radius20\" v-for=\"(item,index) in commodityList\" :key=\"index\" @tap.stop=\"goDetail(item.id)\">\n\t\t\t\t\t\t<view class=\"img\">\n\t\t\t\t\t\t\t<image :src=\"item.cover\" mode=\"widthFix\"></image>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t\t<view class=\"txt pad-all20\">\n\t\t\t\t\t\t\t<view class=\"title fon30 clips2\">{{item.name}}</view>\n\t\t\t\t\t\t\t<view class=\"price font30 mar-sx10\">¥{{item.price}}</view>\n\t\t\t\t\t\t\t<view class=\"bottom flex\">\n\t\t\t\t\t\t\t\t<view class=\"sold font24 color-99\">\r\n\t\t\t\t\t\t\t\t\t<text>{{item.amount>=1000?'999+':item.amount}}件已售</text>\r\n\t\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t\t\t<view class=\"btn font24 background-orange flex\" @tap.stop=\"joinCart(index)\" v-if=\"item.is_over==0\">加入购物车</view>\r\n\t\t\t\t\t\t\t\t<view class=\"btn font24 color-99 flex border-box\" style=\"border: 2rpx solid #f4f5f6;\" v-if=\"item.is_over==1\">商品已售罄</view>\n\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t</view>\n\t\t\t\t</view>\n\t\t\t\t<!-- 到底啦 -->\n\t\t\t\t<view class=\"no-more font24\" v-if=\"noMore\"><text>—— 到底啦 ——</text></view>\n\t\t\t</view>\n\t\t</view>\n\t\t<!-- 搜索结果 -->\n\t\t<view class=\"pull-bg\" v-if=\"showSearch\" @tap=\"closeSearch\"></view>\n\t\t<view class=\"search-box border-box\" v-if=\"showSearch\" :style=\"{height:screenHeight-statusHeight-50+'px',top:statusHeight+50+'px'}\" >\n\t\t\t<!-- 搜索 -->\n\t\t\t<view class=\"search-bg background-white pad-sx30 border-box\">\n\t\t\t\t<view class=\"search radius20 flex\">\n\t\t\t\t\t<image class=\"img\" src=\"/static/icon/icon-search.png\" mode=\"widthFix\"></image>\n\t\t\t\t\t<input class=\"input pad-zy15 border-box font30\" v-model=\"keyword\" type=\"text\" placeholder=\"搜索\" confirm-type=\"search\" @confirm=\"doSearch\" placeholder-style=\"color: #666666\">\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t\t<view class=\"keyword-txt background-white font30\">关键词:{{searchKeyword}}</view>\n\t\t\t<scroll-view scroll-y=\"true\" class=\"search-list background-white\">\n\t\t\t\t<!-- 搜索列表 -->\n\t\t\t\t<view class=\"commodity pad-zy20 border-box flex\">\n\t\t\t\t\t<view class=\"item mar-s40 radius20\" v-for=\"(item,index) in searchList\" :key=\"index\" @tap.stop=\"goDetail(item.id)\">\n\t\t\t\t\t\t<view class=\"img\">\n\t\t\t\t\t\t\t<image :src=\"item.cover\" mode=\"widthFix\"></image>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t\t<view class=\"txt pad-all20\">\n\t\t\t\t\t\t\t<view class=\"title fon30 clips2\">{{item.name}}</view>\n\t\t\t\t\t\t\t<view class=\"price font30 mar-sx10\">¥{{item.price}}</view>\n\t\t\t\t\t\t\t<view class=\"bottom flex\">\n\t\t\t\t\t\t\t\t<view class=\"sold font24 color-99\">\r\n\t\t\t\t\t\t\t\t\t<text>{{item.amount>=1000?'999+':item.amount}}件已售</text>\r\n\t\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t\t\t<view class=\"btn font24 background-orange flex\" @tap.stop=\"joinCart(index)\" v-if=\"item.is_over==0\">加入购物车</view>\r\n\t\t\t\t\t\t\t\t<view class=\"btn font24 color-99 flex border-box\" style=\"border: 2rpx solid #f4f5f6;\" v-if=\"item.is_over==1\">商品已售罄</view>\n\t\t\t\t\t\t\t</view>\n\t\t\t\t\t\t</view>\n\t\t\t\t\t</view>\n\t\t\t\t</view>\n\t\t\t\t<!-- 没有相关结果 -->\n\t\t\t\t<view class=\"no-more font24 pad-sx25\" style=\"margin: 0;\" v-if=\"searchList.length==0\"><text>—— 没有相关结果 ——</text></view>\n\t\t\t</scroll-view>\n\t\t</view>\n\t\t<!-- 尾部 -->\n\t\t<tabbar v-if=\"isLoading\"></tabbar>\n\t</view>\n</template>\n<script>\r\n\timport swiperPu from '@/components/swipers/swiper-pu';\n\timport tabbar from '@/components/tabbar/tabbar';\n\timport {getCartInfo} from '@/jsFile/public-api.js';\n\timport {mapState} from 'vuex'//引入mapState\n\texport default {\n\t\tcomponents:{\r\n\t\t\tswiperPu,\n\t\t\ttabbar\n\t\t},\n\t\tdata() {\n\t\t\treturn {\r\n\t\t\t\tscreenHeight:uni.getSystemInfoSync().screenHeight,\n\t\t\t\tstatusHeight:uni.getSystemInfoSync().statusBarHeight,\n\t\t\t\tscrollTop:0, //分类距离顶部距离\n\t\t\t\tisShow: true, //显示\r\n\t\t\t\tbannerList:[], //轮播图列表\r\n\t\t\t\tisplay:false, //是否自动轮播\r\n\t\t\t\tplayTimer:null, //间隔时间\n\t\t\t\t//分类导航\n\t\t\t\tcurrentIndex:0, \n\t\t\t\tscrollLeft:0, \n\t\t\t\ttabsScrollLeft:0,\n\t\t\t\tcateWidth:'',\n\t\t\t\tkeyword:'', //关键词\n\t\t\t\tcateList:[], //商品分类\n\t\t\t\tcommodityList:[], //商品列表\n\t\t\t\tifLoading:true,\n\t\t\t\tpage:1, //分页\n\t\t\t\tsize:10, //条数\n\t\t\t\ttotal:0, //总数\n\t\t\t\tnoMore:false, //没有更多\n\t\t\t\tvip_level:0, //是否是会员\n\t\t\t\tkeyword:'', //关键词\n\t\t\t\tsearchKeyword:'', //搜索关键词\n\t\t\t\tsearchList:[], //搜索结果\n\t\t\t\tshowSearch:false, //显示搜索结果\n\t\t\t\tisLoading:false,\r\n\t\t\t}\n\t\t},\n\t\tonLoad(op) {\r\n\t\t\tif(op.invite_code){\r\n\t\t\t\t// 缓存invite_code\r\n\t\t\t\tuni.setStorageSync('inviteCode',op.invite_code);\r\n\t\t\t}\n\t\t\t// 获取banner列表\n\t\t\tthis.getBannerList();\n\t\t\t// 获取分类列表\n\t\t\tthis.getCateEv();\n\t\t},\n\t\tonShow() {\n\t\t\t// 刷新购物车信息\n\t\t\tgetCartInfo();\n\t\t\tthis.playTimer = setTimeout(()=>{\n\t\t\t\tthis.isplay = true;\n\t\t\t},2000)\n\t\t\tthis.vip_level = uni.getStorageSync('vip_level');\n\t\t},\n\t\tonReady() {\n\t\t\t\n\t\t},\n\t\tonHide() {\n\t\t\tclearTimeout(this.playTimer);\n\t\t\tthis.isplay =false;\n\t\t},\n\t\tonPageScroll(object){\r\n\t\t\tif(object.scrollTop >= this.statusHeight+150){\r\n\t\t\t\tthis.isShow = false;\r\n\t\t\t}\r\n\t\t\tif(object.scrollTop <= this.statusHeight+120){\r\n\t\t\t\tthis.isShow = true;\r\n\t\t\t}\r\n\t\t},\n\t\t// 分享到微信\n\t\tonShareAppMessage(res) {\r\n\t\t\tlet shareObj = {\r\n\t\t\t\ttitle:'老农极鲜',\r\n\t\t\t\tpath: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),\r\n\t\t\t\timageUrl:'/static/img/shear-index.jpg',\r\n\t\t\t}\r\n\t\t\t// 返回shareObj\r\n\t\t\treturn shareObj;\n\t\t},\r\n\t\t// 分享到朋友圈\r\n\t\tonShareTimeline(res){\r\n\t\t\tlet shareObj = {\r\n\t\t\t\ttitle:'老农极鲜',\r\n\t\t\t\tquery: '?invite_code='+uni.getStorageSync('invite_code'),\r\n\t\t\t\tpath: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),\r\n\t\t\t\timageUrl:'/static/img/shear-index.jpg',\r\n\t\t\t}\r\n\t\t\t// 返回shareObj\r\n\t\t\treturn shareObj;\r\n\t\t},\n\t\t// 触底\n\t\tonReachBottom(e) {\n\t\t\tif(!this.noMore){\n\t\t\t\tthis.page++;\n\t\t\t\t// 查询商品列表\n\t\t\t\tthis.getCommodityEv(this.cateList[this.currentIndex].id);\n\t\t\t}\n\t\t},\n\t\twatch: {\n\t\t\tlist() {\n\t\t\t\tthis.setTabList()\n\t\t\t},\n\t\t\tvalue() {\n\t\t\t\tthis.currentIndex = this.value\n\t\t\t\tthis.setTabList()\n\t\t\t}\n\t\t},\n\t\tmethods: {\r\n\t\t\t// 获取轮播图事件\r\n\t\t\tgetBannerList(){\r\n\t\t\t\tthis.$requst.get('/api/common/slides').then(res=>{\r\n\t\t\t\t\tif(res.code==0){\r\n\t\t\t\t\t\tconsole.log(res,'轮播图列表')\r\n\t\t\t\t\t\tres.data.forEach(item=>{\r\n\t\t\t\t\t\t\tlet isVideo = false\r\n\t\t\t\t\t\t\tif(item.type!='img') isVideo = true;\r\n\t\t\t\t\t\t\tlet banObj = {\r\n\t\t\t\t\t\t\t\timgSrc:this.$hostHttp + item.src,\r\n\t\t\t\t\t\t\t\turl:item.url,\r\n\t\t\t\t\t\t\t\tisVideo:isVideo,\r\n\t\t\t\t\t\t\t\tposter:item.src,\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.bannerList.push(banObj)\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\n\t\t\t// 获取商品分类\n\t\t\tgetCateEv(){\n\t\t\t\tthis.$requst.get('/api/spu/category').then(res=>{\n\t\t\t\t\tif(res.code == 0){\n\t\t\t\t\t\tconsole.log(res,'商品分类')\n\t\t\t\t\t\tlet cateArr =[];\n\t\t\t\t\t\tres.data.forEach(item=>{\n\t\t\t\t\t\t\tlet obj = {\n\t\t\t\t\t\t\t\tid:item.id,\n\t\t\t\t\t\t\t\ttitle:item.title,\n\t\t\t\t\t\t\t\tcover:item.cover\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcateArr.push(obj);\n\t\t\t\t\t\t})\n\t\t\t\t\t\tthis.cateList = cateArr;\n\t\t\t\t\t\tthis.cateWidth = this.cateList.length*158 - 58 + 'rpx';\n\t\t\t\t\t\t// 查询商品列表\n\t\t\t\t\t\tthis.getCommodityEv(this.cateList[this.currentIndex].id);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t// 查询商品列表\n\t\t\tgetCommodityEv(id){\n\t\t\t\tuni.showLoading({\n\t\t\t\t\ttitle:'加载中'\n\t\t\t\t})\n\t\t\t\tlet params = {\n\t\t\t\t\tpage:this.page,\n\t\t\t\t\tsize:this.size,\n\t\t\t\t\tcategory_id:id\n\t\t\t\t}\n\t\t\t\tthis.$requst.get('/api/spu/list',params).then(res=>{\n\t\t\t\t\tif(res.code == 0){\n\t\t\t\t\t\tconsole.log(res,'商品列表')\n\t\t\t\t\t\tthis.total = res.data.total;\n\t\t\t\t\t\tlet commodityArr = [];\n\t\t\t\t\t\tres.data.list.forEach(item=>{\n\t\t\t\t\t\t\tlet obj = {\n\t\t\t\t\t\t\t\tid:item.id,\n\t\t\t\t\t\t\t\tcover:item.cover,\n\t\t\t\t\t\t\t\tname:item.name,\n\t\t\t\t\t\t\t\toriginal_price:item.original_price,\n\t\t\t\t\t\t\t\tprice:item.price,\n\t\t\t\t\t\t\t\ttag:item.tag,\n\t\t\t\t\t\t\t\tstock:item.stock,\n\t\t\t\t\t\t\t\tsku_id:item.default_sku.id,\n\t\t\t\t\t\t\t\tamount:item.amount,\r\n\t\t\t\t\t\t\t\tis_over:item.is_over,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcommodityArr.push(obj)\n\t\t\t\t\t\t})\n\t\t\t\t\t\tthis.commodityList = this.commodityList.concat(commodityArr);\n\t\t\t\t\t\tif(this.commodityList.length==this.total){\n\t\t\t\t\t\t\tthis.noMore =true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tuni.hideLoading();\n\t\t\t\t\tthis.isLoading = true;\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t// 加入购物车\n\t\t\tjoinCart(index){\n\t\t\t\tif(this.$toolAll.tools.judgeAuth()) {\n\t\t\t\t\tthis.$requst.post('/api/order/shopping-cart-add',{sku_id:this.commodityList[index].sku_id,num:1}).then(res=>{\n\t\t\t\t\t\tif(res.code==0) {\n\t\t\t\t\t\t\tthis.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');\n\t\t\t\t\t\t\tgetCartInfo();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.$toolAll.tools.showToast(res.msg)\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\t\n\t\t\t// 去详情页\n\t\t\tgoDetail(id){\n\t\t\t\tuni.navigateTo({\n\t\t\t\t\turl:`/pagesB/shop-detail/shop-detail?id=${id}`\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t// 分类选择事件\n\t\t\tchangeCateEv(index) {\n\t\t\t\tif(index !== this.currentIndex){\r\n\t\t\t\t\tthis.isShow = true;\n\t\t\t\t\tthis.currentIndex = index;\n\t\t\t\t\t// 获取商品列表\n\t\t\t\t\tthis.commodityList = [];\n\t\t\t\t\tthis.noMore = false;\n\t\t\t\t\tthis.getCommodityEv(this.cateList[index].id);\n\t\t\t\t\t// 分类切换效果\n\t\t\t\t\tthis.setTabList();\n\t\t\t\t}\n\t\t\t},\n\t\t\t\r\n\t\t\t// 分类切换效果\n\t\t\tsetTabList() {\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tif (this.cateList.length > 0) {\n\t\t\t\t\t\t//计算左滑距离\n\t\t\t\t\t\tthis.setLeft()\r\n\t\t\t\t\t\t// 计算顶部距离\r\n\t\t\t\t\t\tthis.setTop();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t//计算左滑距离\n\t\t\tsetLeft() {\n\t\t\t\tlet lineLeft = 0;\n\t\t\t\tthis.getElementData('#tab_list', (data) => {\n\t\t\t\t\tlet list = data[0];\n\t\t\t\t\tthis.getElementData('#tab_item', (res) => {\n\t\t\t\t\t\tlet el = res[this.currentIndex]\n\t\t\t\t\t\tlineLeft = el.width / 2 + (-list.left) + el.left - list.width / 2 - this.scrollLeft\n\t\t\t\t\t\tthis.tabsScrollLeft = this.scrollLeft + lineLeft\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t// 计算顶部距离\n\t\t\tsetTop(){\n\t\t\t\tthis.getElementData('#index-cate-bg', (res) => {\n\t\t\t\t\tlet el = res[0];\n\t\t\t\t\tthis.scrollTop = el.top;\r\n\t\t\t\t\tif(this.scrollTop==this.statusHeight+35){\r\n\t\t\t\t\t\tthis.isShow = false;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tthis.isShow = true;\r\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\r\n\t\t\t\n\t\t\t// 获取DOM距离\n\t\t\tgetElementData(el, callback) {\n\t\t\t\tuni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {\n\t\t\t\t\tcallback(data[0]);\n\t\t\t\t});\n\t\t\t},\n\t\t\t\n\t\t\t// 滚动\n\t\t\tscroll(e) {\n\t\t\t\tthis.scrollLeft = e.detail.scrollLeft;\n\t\t\t},\n\t\t\t\n\t\t\t// 搜索结果\n\t\t\tdoSearch(){\n\t\t\t\tthis.showSearch = true;\r\n\t\t\t\tthis.searchList = [];\n\t\t\t\tthis.searchKeyword = this.keyword;\n\t\t\t\tthis.keyword = '';\n\t\t\t\tthis.$requst.get('/api/spu/list',{keyword:this.searchKeyword}).then(res=>{\n\t\t\t\t\tif(res.code == 0){\n\t\t\t\t\t\tconsole.log(res,'搜索列表')\n\t\t\t\t\t\tthis.total = res.data.total;\n\t\t\t\t\t\tlet searchArr = [];\n\t\t\t\t\t\tres.data.list.forEach(item=>{\n\t\t\t\t\t\t\tlet obj = {\n\t\t\t\t\t\t\t\tid:item.id,\n\t\t\t\t\t\t\t\tcover:item.cover,\n\t\t\t\t\t\t\t\tname:item.name,\n\t\t\t\t\t\t\t\toriginal_price:item.original_price,\n\t\t\t\t\t\t\t\tprice:item.price,\n\t\t\t\t\t\t\t\ttag:item.tag,\n\t\t\t\t\t\t\t\tstock:item.stock,\n\t\t\t\t\t\t\t\tsku_id:item.default_sku.id\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsearchArr.push(obj)\n\t\t\t\t\t\t})\n\t\t\t\t\t\tthis.searchList = this.searchList.concat(searchArr);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t\n\t\t\t// 关闭搜索\n\t\t\tcloseSearch(){\n\t\t\t\tthis.showSearch = false;\n\t\t\t\tthis.searchKeyword = '';\n\t\t\t\tthis.searchList = [];\n\t\t\t}\n\t\t}\n\t}\n</script>\n<style>\n\t\n</style>"],"sourceRoot":""} |