mall-laonong/unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map

1 line
22 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"version":3,"sources":["uni-app:///main.js","webpack:///D:/老农商城/mall-laonong/pages/index/index.vue?feb1","webpack:///D:/老农商城/mall-laonong/pages/index/index.vue?5923","webpack:///D:/老农商城/mall-laonong/pages/index/index.vue?7e71","webpack:///D:/老农商城/mall-laonong/pages/index/index.vue?2431","uni-app:///pages/index/index.vue"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,4F,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,cAAD,CAAV,C;;;;;;;;;;;;;ACLA;AAAA;AAAA;AAAA;AAAA;AAAkH;AAClH;AACyD;AACL;;;AAGpD;AACoL;AACpL,gBAAgB,2LAAU;AAC1B,EAAE,2EAAM;AACR,EAAE,gFAAM;AACR,EAAE,yFAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,oFAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACtBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,4KAEN;AACP;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjCA;AAAA;AAAA;AAAA;AAAurB,CAAgB,qrBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACA;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,KAvLA;;AAyLA;AACA,eA1LA,yBA0LA;AACA;AACA;AACA;AACA,KA9LA,EAxFA,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-app开发版/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-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/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-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/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-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index.vue?vue&type=script&lang=js&\"","<template>\r\n\t<view>\r\n\t\t<view class=\"index-page pad-x190 border-box\" v-if=\"isLoading\">\r\n\t\t\t<!-- 顶部背景 -->\r\n\t\t\t<view class=\"index-top\">\r\n\t\t\t\t<image :src=\"indexBackground\" mode=\"widthFix\"></image>\r\n\t\t\t</view>\r\n\t\t\t<view class=\"index-content background-white\">\r\n\t\t\t\t<!-- 搜索 -->\r\n\t\t\t\t<view class=\"pull-search-bg background-white radius20 pad-sx30 border-box\">\r\n\t\t\t\t\t<view class=\"pull-search radius20 flex\" v-if=\"isShow\">\r\n\t\t\t\t\t\t<image class=\"img\" src=\"/static/icon/icon-search.png\" mode=\"widthFix\"></image>\r\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\">\r\n\t\t\t\t\t</view>\r\n\t\t\t\t</view>\r\n\t\t\t\t<!-- 商品分类 -->\r\n\t\t\t\t<view class=\"index-cate-bg pad-zy20 background-white\" :class=\"!isShow?'show':''\" id=\"index-cate-bg\">\r\n\t\t\t\t\t<view class=\"index-cate pad-zy20 border-box\" :class=\"!isShow?'show':''\">\r\n\t\t\t\t\t\t<view class=\"pull-title\">\r\n\t\t\t\t\t\t\t<view class=\"txt font32 pad-sx10\" v-if=\"isShow\">商品</view>\r\n\t\t\t\t\t\t\t<view class=\"line background-orange\" v-if=\"isShow\"></view>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t<view class=\"cate-list-bg\">\r\n\t\t\t\t\t\t\t<scroll-view scroll-x=\"true\" :scroll-left=\"tabsScrollLeft\" @scroll=\"scroll\">\r\n\t\t\t\t\t\t\t\t<view class=\"cate-list flex\" id=\"tab_list\" :style=\"{width:cateWidth}\">\r\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)\">\r\n\t\t\t\t\t\t\t\t\t\t<view class=\"img mar-sx20\"><image :src=\"item.cover\" mode=\"widthFix\"></image></view>\r\n\t\t\t\t\t\t\t\t\t\t<view class=\"txt font24\">{{item.title}}</view>\r\n\t\t\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t\t</scroll-view>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t</view>\r\n\t\t\t\t<!-- 商品列表 -->\r\n\t\t\t\t<view class=\"commodity pad-zy20 border-box flex\">\r\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)\">\r\n\t\t\t\t\t\t<view class=\"img\">\r\n\t\t\t\t\t\t\t<image :src=\"item.cover\" mode=\"widthFix\"></image>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t<view class=\"txt pad-all20\">\r\n\t\t\t\t\t\t\t<view class=\"title fon30 clips2\">{{item.name}}</view>\r\n\t\t\t\t\t\t\t<view class=\"price font30 mar-sx10\">¥{{item.price}}</view>\r\n\t\t\t\t\t\t\t<view class=\"bottom flex\">\r\n\t\t\t\t\t\t\t\t<view class=\"sold font24 color-99\">{{item.amount>=100?'99+':item.amount}}件已售</view>\r\n\t\t\t\t\t\t\t\t<view class=\"btn font24 background-orange flex\" @tap.stop=\"joinCart(index)\">加入购物车</view>\r\n\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t</view>\r\n\t\t\t\t<!-- 到底啦 -->\r\n\t\t\t\t<view class=\"no-more font24\" v-if=\"noMore\"><text>—— 到底啦 ——</text></view>\r\n\t\t\t</view>\r\n\t\t</view>\r\n\t\t<!-- 搜索结果 -->\r\n\t\t<view class=\"pull-bg\" v-if=\"showSearch\"></view>\r\n\t\t<view class=\"search-box border-box\" v-if=\"showSearch\" @tap.stop=\"closeSearch\">\r\n\t\t\t<view class=\"close-box\" :style=\"{height:statusHeight+50+'px'}\" @tap=\"closeSearch\"></view>\r\n\t\t\t<!-- 搜索 -->\r\n\t\t\t<view class=\"search-bg background-white pad-sx30 border-box\">\r\n\t\t\t\t<view class=\"search radius20 flex\">\r\n\t\t\t\t\t<image class=\"img\" src=\"/static/icon/icon-search.png\" mode=\"widthFix\"></image>\r\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\">\r\n\t\t\t\t</view>\r\n\t\t\t</view>\r\n\t\t\t<view class=\"keyword-txt background-white font30\">关键词:{{searchKeyword}}</view>\r\n\t\t\t<scroll-view scroll-y=\"true\" class=\"search-list background-white\">\r\n\t\t\t\t<!-- 搜索列表 -->\r\n\t\t\t\t<view class=\"commodity pad-zy20 border-box flex\">\r\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)\">\r\n\t\t\t\t\t\t<view class=\"img\">\r\n\t\t\t\t\t\t\t<image :src=\"item.cover\" mode=\"widthFix\"></image>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t<view class=\"txt pad-all20\">\r\n\t\t\t\t\t\t\t<view class=\"title fon30 clips2\">{{item.name}}</view>\r\n\t\t\t\t\t\t\t<view class=\"price font30 mar-sx10\">¥{{item.price}}</view>\r\n\t\t\t\t\t\t\t<view class=\"bottom flex\">\r\n\t\t\t\t\t\t\t\t<view class=\"sold font24 color-99\">{{item.stock>=100?'99+':item.stock}}件已售</view>\r\n\t\t\t\t\t\t\t\t<view class=\"btn font24 background-orange flex\" @tap.stop=\"joinCart(index)\">加入购物车</view>\r\n\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t</view>\r\n\t\t\t\t<!-- 没有相关结果 -->\r\n\t\t\t\t<view class=\"no-more font24\" v-if=\"searchList.length==0\"><text>—— 没有相关结果 ——</text></view>\r\n\t\t\t</scroll-view>\r\n\t\t</view>\r\n\t\t<!-- 尾部 -->\r\n\t\t<tabbar v-if=\"isLoading\"></tabbar>\r\n\t</view>\r\n</template>\r\n\r\n<script>\r\n\timport tabbar from '@/components/tabbar/tabbar';\r\n\timport {getCartInfo} from '@/jsFile/public-api.js';\r\n\timport {mapState} from 'vuex'//引入mapState\r\n\texport default {\r\n\t\tcomponents:{\r\n\t\t\ttabbar\r\n\t\t},\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tstatusHeight:uni.getSystemInfoSync().statusBarHeight,\r\n\t\t\t\tscrollTop:0, //分类距离顶部距离\r\n\t\t\t\tisShow: true, //显示\r\n\t\t\t\t//分类导航\r\n\t\t\t\tcurrentIndex:0, \r\n\t\t\t\tscrollLeft:0, \r\n\t\t\t\ttabsScrollLeft:0,\r\n\t\t\t\tcateWidth:'',\r\n\t\t\t\tindexBackground:'', //背景图\r\n\t\t\t\tkeyword:'', //关键词\r\n\t\t\t\tcateList:[], //商品分类\r\n\t\t\t\tcommodityList:[], //商品列表\r\n\t\t\t\tifLoading:true,\r\n\t\t\t\tpage:1, //分页\r\n\t\t\t\tsize:10, //条数\r\n\t\t\t\ttotal:0, //总数\r\n\t\t\t\tnoMore:false, //没有更多\r\n\t\t\t\tvip_level:0, //是否是会员\r\n\t\t\t\tkeyword:'', //关键词\r\n\t\t\t\tsearchKeyword:'', //搜索关键词\r\n\t\t\t\tsearchList:[], //搜索结果\r\n\t\t\t\tshowSearch:false, //显示搜索结果\r\n\t\t\t\tisLoading:false,\r\n\t\t\t}\r\n\t\t},\r\n\t\tonLoad() {\r\n\t\t\t// 获取用户信息\r\n\t\t\tthis.getUserInfo();\r\n\t\t\t// 获取头部背景\r\n\t\t\tthis.getTabbarEv();\r\n\t\t\t// 获取分类列表\r\n\t\t\tthis.getCateEv();\r\n\t\t},\r\n\t\tonShow() {\r\n\t\t\t// 刷新购物车信息\r\n\t\t\tgetCartInfo();\r\n\t\t\t\r\n\t\t\tthis.playTimer = setTimeout(()=>{\r\n\t\t\t\tthis.isplay = true;\r\n\t\t\t},2000)\r\n\t\t\tthis.vip_level = uni.getStorageSync('vip_level');\r\n\t\t},\r\n\t\tonReady() {\r\n\t\t\t\r\n\t\t},\r\n\t\tonHide() {\r\n\t\t\tclearTimeout(this.playTimer);\r\n\t\t\tthis.isplay =false;\r\n\t\t},\r\n\t\tonPageScroll(object){\r\n\t\t\tthis.setTop();\r\n\t\t\tif(object.scrollTop>this.scrollTop){\r\n\t\t\t\tthis.isShow = false;\r\n\t\t\t}else{\r\n\t\t\t\tthis.isShow = true;\r\n\t\t\t}\r\n\t\t},\r\n\t\t// 分享到微信\r\n\t\tonShareAppMessage(res) {\r\n\t\t\t\r\n\t\t},\r\n\t\t// 分享到朋友圈\r\n\t\tonShareTimeline(res){\r\n\t\t\t\r\n\t\t},\r\n\t\t// 触底\r\n\t\tonReachBottom(e) {\r\n\t\t\tif(!this.noMore){\r\n\t\t\t\tthis.page++;\r\n\t\t\t\t// 查询商品列表\r\n\t\t\t\tthis.getCommodityEv(this.cateList[this.currentIndex].id);\r\n\t\t\t}\r\n\t\t},\r\n\t\twatch: {\r\n\t\t\tlist() {\r\n\t\t\t\tthis.setTabList()\r\n\t\t\t},\r\n\t\t\tvalue() {\r\n\t\t\t\tthis.currentIndex = this.value\r\n\t\t\t\tthis.setTabList()\r\n\t\t\t}\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\t// 获取个人信息\r\n\t\t\tgetUserInfo(){\r\n\t\t\t\tthis.$requst.get('/api/user/info').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\tuni.setStorageSync('vip_level',res.data.vip_level);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t// 获取头部背景\r\n\t\t\tgetTabbarEv(){\r\n\t\t\t\tthis.$requst.get('/api/index/mini-program-setting').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\tthis.indexBackground = this.$hostHttp + res.data.indexBackground;\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t// 获取商品分类\r\n\t\t\tgetCateEv(){\r\n\t\t\t\tthis.$requst.get('/api/spu/category').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\tlet cateArr =[];\r\n\t\t\t\t\t\tres.data.forEach(item=>{\r\n\t\t\t\t\t\t\tlet obj = {\r\n\t\t\t\t\t\t\t\tid:item.id,\r\n\t\t\t\t\t\t\t\ttitle:item.title,\r\n\t\t\t\t\t\t\t\tcover:item.cover\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcateArr.push(obj);\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tthis.cateList = cateArr;\r\n\t\t\t\t\t\tthis.cateWidth = this.cateList.length*158 - 58 + 'rpx';\r\n\t\t\t\t\t\t// 查询商品列表\r\n\t\t\t\t\t\tthis.getCommodityEv(this.cateList[this.currentIndex].id);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 查询商品列表\r\n\t\t\tgetCommodityEv(id){\r\n\t\t\t\tuni.showLoading({\r\n\t\t\t\t\ttitle:'加载中'\r\n\t\t\t\t})\r\n\t\t\t\tlet params = {\r\n\t\t\t\t\tpage:this.page,\r\n\t\t\t\t\tsize:this.size,\r\n\t\t\t\t\tcategory_id:id\r\n\t\t\t\t}\r\n\t\t\t\tthis.$requst.get('/api/spu/list',params).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\tthis.total = res.data.total;\r\n\t\t\t\t\t\tlet commodityArr = [];\r\n\t\t\t\t\t\tres.data.list.forEach(item=>{\r\n\t\t\t\t\t\t\tlet obj = {\r\n\t\t\t\t\t\t\t\tid:item.id,\r\n\t\t\t\t\t\t\t\tcover:item.cover,\r\n\t\t\t\t\t\t\t\tname:item.name,\r\n\t\t\t\t\t\t\t\toriginal_price:item.original_price,\r\n\t\t\t\t\t\t\t\tprice:item.price,\r\n\t\t\t\t\t\t\t\ttag:item.tag,\r\n\t\t\t\t\t\t\t\tstock:item.stock,\r\n\t\t\t\t\t\t\t\tsku_id:item.default_sku.id,\r\n\t\t\t\t\t\t\t\tamount:item.amount,\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcommodityArr.push(obj)\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tthis.commodityList = this.commodityList.concat(commodityArr);\r\n\t\t\t\t\t\tif(this.commodityList.length==this.total){\r\n\t\t\t\t\t\t\tthis.noMore =true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tuni.hideLoading();\r\n\t\t\t\t\tthis.isLoading = true;\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 加入购物车\r\n\t\t\tjoinCart(index){\r\n\t\t\t\tif(this.$toolAll.tools.judgeAuth()) {\r\n\t\t\t\t\tthis.$requst.post('/api/order/shopping-cart-add',{sku_id:this.commodityList[index].sku_id,num:1}).then(res=>{\r\n\t\t\t\t\t\tif(res.code==0) {\r\n\t\t\t\t\t\t\tthis.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');\r\n\t\t\t\t\t\t\tgetCartInfo();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.$toolAll.tools.showToast(res.msg)\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\r\n\t\t\t// 去详情页\r\n\t\t\tgoDetail(id){\r\n\t\t\t\tuni.navigateTo({\r\n\t\t\t\t\turl:`/pagesB/shop-detail/shop-detail?id=${id}`\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 分类选择事件\r\n\t\t\tchangeCateEv(index) {\r\n\t\t\t\tif(this.currentIndex !== index){\r\n\t\t\t\t\tthis.currentIndex = index;\r\n\t\t\t\t\t// 获取商品列表\r\n\t\t\t\t\tthis.commodityList = [];\r\n\t\t\t\t\tthis.noMore = false;\r\n\t\t\t\t\tthis.getCommodityEv(this.cateList[index].id);\r\n\t\t\t\t\t// 分类切换效果\r\n\t\t\t\t\tthis.setTabList();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 分类切换效果\r\n\t\t\tsetTabList() {\r\n\t\t\t\tthis.$nextTick(() => {\r\n\t\t\t\t\tif (this.cateList.length > 0) {\r\n\t\t\t\t\t\t//计算左滑距离\r\n\t\t\t\t\t\tthis.setLeft()\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t//计算左滑距离\r\n\t\t\tsetLeft() {\r\n\t\t\t\tlet lineLeft = 0;\r\n\t\t\t\tthis.getElementData('#tab_list', (data) => {\r\n\t\t\t\t\tlet list = data[0];\r\n\t\t\t\t\tthis.getElementData('#tab_item', (res) => {\r\n\t\t\t\t\t\tlet el = res[this.currentIndex]\r\n\t\t\t\t\t\tlineLeft = el.width / 2 + (-list.left) + el.left - list.width / 2 - this.scrollLeft\r\n\t\t\t\t\t\tthis.tabsScrollLeft = this.scrollLeft + lineLeft\r\n\t\t\t\t\t})\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 计算顶部距离\r\n\t\t\tsetTop(){\r\n\t\t\t\tthis.getElementData('#index-cate-bg', (res) => {\r\n\t\t\t\t\tlet el = res[0];\r\n\t\t\t\t\tthis.scrollTop = el.top + el.height/4;\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 获取DOM距离\r\n\t\t\tgetElementData(el, callback) {\r\n\t\t\t\tuni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {\r\n\t\t\t\t\tcallback(data[0]);\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 滚动\r\n\t\t\tscroll(e) {\r\n\t\t\t\tthis.scrollLeft = e.detail.scrollLeft;\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 搜索结果\r\n\t\t\tdoSearch(){\r\n\t\t\t\tthis.showSearch = true;\r\n\t\t\t\tthis.searchKeyword = this.keyword;\r\n\t\t\t\tthis.keyword = '';\r\n\t\t\t\tthis.$requst.get('/api/spu/list',{keyword:this.searchKeyword}).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\tthis.total = res.data.total;\r\n\t\t\t\t\t\tlet searchArr = [];\r\n\t\t\t\t\t\tres.data.list.forEach(item=>{\r\n\t\t\t\t\t\t\tlet obj = {\r\n\t\t\t\t\t\t\t\tid:item.id,\r\n\t\t\t\t\t\t\t\tcover:item.cover,\r\n\t\t\t\t\t\t\t\tname:item.name,\r\n\t\t\t\t\t\t\t\toriginal_price:item.original_price,\r\n\t\t\t\t\t\t\t\tprice:item.price,\r\n\t\t\t\t\t\t\t\ttag:item.tag,\r\n\t\t\t\t\t\t\t\tstock:item.stock,\r\n\t\t\t\t\t\t\t\tsku_id:item.default_sku.id\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tsearchArr.push(obj)\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tthis.searchList = this.searchList.concat(searchArr);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 关闭搜索\r\n\t\t\tcloseSearch(){\r\n\t\t\t\tthis.showSearch = false;\r\n\t\t\t\tthis.searchKeyword = '';\r\n\t\t\t\tthis.searchList = [];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style>\r\n\t\r\n</style>\r\n"],"sourceRoot":""}