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

565 lines
29 KiB
JavaScript
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.

(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/index/index"],{
/***/ 18:
/*!********************************************************************!*\
!*** D:/Lee/mall-laonong/main.js?{"page":"pages%2Findex%2Findex"} ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(createPage) {__webpack_require__(/*! uni-pages */ 5);
var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));
var _index = _interopRequireDefault(__webpack_require__(/*! ./pages/index/index.vue */ 19));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} // @ts-ignore
wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;createPage(_index.default);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["createPage"]))
/***/ }),
/***/ 19:
/*!*************************************************!*\
!*** D:/Lee/mall-laonong/pages/index/index.vue ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _index_vue_vue_type_template_id_57280228___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.vue?vue&type=template&id=57280228& */ 20);
/* harmony import */ var _index_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.vue?vue&type=script&lang=js& */ 22);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _index_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _index_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _HbuilderX_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 11);
var renderjs
/* normalize component */
var component = Object(_HbuilderX_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_index_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_index_vue_vue_type_template_id_57280228___WEBPACK_IMPORTED_MODULE_0__["render"],
_index_vue_vue_type_template_id_57280228___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
null,
false,
_index_vue_vue_type_template_id_57280228___WEBPACK_IMPORTED_MODULE_0__["components"],
renderjs
)
component.options.__file = "pages/index/index.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ 20:
/*!********************************************************************************!*\
!*** D:/Lee/mall-laonong/pages/index/index.vue?vue&type=template&id=57280228& ***!
\********************************************************************************/
/*! exports provided: render, staticRenderFns, recyclableRender, components */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _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___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../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??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??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& */ 21);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recyclableRender", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["recyclableRender"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["components"]; });
/***/ }),
/***/ 21:
/*!********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--16-0!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/Lee/mall-laonong/pages/index/index.vue?vue&type=template&id=57280228& ***!
\********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns, recyclableRender, components */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recyclableRender", function() { return recyclableRender; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "components", function() { return components; });
var components
try {
components = {
tabbar: function() {
return __webpack_require__.e(/*! import() | components/tabbar/tabbar */ "components/tabbar/tabbar").then(__webpack_require__.bind(null, /*! @/components/tabbar/tabbar.vue */ 150))
}
}
} catch (e) {
if (
e.message.indexOf("Cannot find module") !== -1 &&
e.message.indexOf(".vue") !== -1
) {
console.error(e.message)
console.error("1. 排查组件名称拼写是否正确")
console.error(
"2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"
)
console.error(
"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件"
)
} else {
throw e
}
}
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
}
var recyclableRender = false
var staticRenderFns = []
render._withStripped = true
/***/ }),
/***/ 22:
/*!**************************************************************************!*\
!*** D:/Lee/mall-laonong/pages/index/index.vue?vue&type=script&lang=js& ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _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___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib!../../../../HbuilderX/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??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??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& */ 23);
/* harmony import */ var _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___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_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___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _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___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _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___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony default export */ __webpack_exports__["default"] = (_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___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ 23:
/*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/Lee/mall-laonong/pages/index/index.vue?vue&type=script&lang=js& ***!
\*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
var _publicApi = __webpack_require__(/*! @/jsFile/public-api.js */ 24);
var _vuex = __webpack_require__(/*! vuex */ 13);function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}var swiperPu = function swiperPu() {__webpack_require__.e(/*! require.ensure | components/swipers/swiper-pu */ "components/swipers/swiper-pu").then((function () {return resolve(__webpack_require__(/*! @/components/swipers/swiper-pu */ 157));}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);};var tabbar = function tabbar() {__webpack_require__.e(/*! require.ensure | components/tabbar/tabbar */ "components/tabbar/tabbar").then((function () {return resolve(__webpack_require__(/*! @/components/tabbar/tabbar */ 150));}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);}; //引入mapState
var _default = {
components: {
swiperPu: swiperPu,
tabbar: tabbar },
data: function data() {var _ref;
return _ref = {
screenHeight: uni.getSystemInfoSync().screenHeight,
statusHeight: uni.getSystemInfoSync().statusBarHeight,
scrollTop: 0, //分类距离顶部距离
isShow: true, //显示
bannerList: [], //轮播图列表
isplay: false, //是否自动轮播
playTimer: null, //间隔时间
//分类导航
currentIndex: 0,
scrollLeft: 0,
tabsScrollLeft: 0,
cateWidth: '',
keyword: '', //关键词
cateList: [], //商品分类
commodityList: [], //商品列表
ifLoading: true,
page: 1, //分页
size: 10, //条数
total: 0, //总数
noMore: false, //没有更多
vip_level: 0 }, _defineProperty(_ref, "keyword",
''), _defineProperty(_ref, "searchKeyword",
''), _defineProperty(_ref, "searchList",
[]), _defineProperty(_ref, "showSearch",
false), _defineProperty(_ref, "isLoading",
false), _ref;
},
onLoad: function onLoad(op) {
if (op.invite_code) {
// 缓存invite_code
uni.setStorageSync('inviteCode', op.invite_code);
}
// 获取banner列表
this.getBannerList();
// 获取分类列表
this.getCateEv();
},
onShow: function onShow() {var _this = this;
// 刷新购物车信息
(0, _publicApi.getCartInfo)();
this.playTimer = setTimeout(function () {
_this.isplay = true;
}, 2000);
this.vip_level = uni.getStorageSync('vip_level');
},
onReady: function onReady() {
},
onHide: function onHide() {
clearTimeout(this.playTimer);
this.isplay = false;
},
onPageScroll: function onPageScroll(object) {
if (object.scrollTop >= this.statusHeight + 150) {
this.isShow = false;
}
if (object.scrollTop <= this.statusHeight + 120) {
this.isShow = true;
}
},
// 分享到微信
onShareAppMessage: function onShareAppMessage(res) {
var shareObj = {
title: '老农极鲜',
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
// 分享到朋友圈
onShareTimeline: function onShareTimeline(res) {
var shareObj = {
title: '老农极鲜',
query: '?invite_code=' + uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
// 触底
onReachBottom: function onReachBottom(e) {
if (!this.noMore) {
this.page++;
// 查询商品列表
this.getCommodityEv(this.cateList[this.currentIndex].id);
}
},
watch: {
list: function list() {
this.setTabList();
},
value: function value() {
this.currentIndex = this.value;
this.setTabList();
} },
methods: {
// 获取轮播图事件
getBannerList: function getBannerList() {var _this2 = this;
this.$requst.get('/api/common/slides').then(function (res) {
if (res.code == 0) {
console.log(res, '轮播图列表');
res.data.forEach(function (item) {
var isVideo = false;
if (item.type != 'img') isVideo = true;
var banObj = {
imgSrc: _this2.$hostHttp + item.src,
url: item.url,
isVideo: isVideo,
poster: item.src };
_this2.bannerList.push(banObj);
});
}
});
},
// 获取商品分类
getCateEv: function getCateEv() {var _this3 = this;
this.$requst.get('/api/spu/category').then(function (res) {
if (res.code == 0) {
console.log(res, '商品分类');
var cateArr = [];
res.data.forEach(function (item) {
var obj = {
id: item.id,
title: item.title,
cover: item.cover };
cateArr.push(obj);
});
_this3.cateList = cateArr;
_this3.cateWidth = _this3.cateList.length * 158 - 58 + 'rpx';
// 查询商品列表
_this3.getCommodityEv(_this3.cateList[_this3.currentIndex].id);
}
});
},
// 查询商品列表
getCommodityEv: function getCommodityEv(id) {var _this4 = this;
uni.showLoading({
title: '加载中' });
var params = {
page: this.page,
size: this.size,
category_id: id };
this.$requst.get('/api/spu/list', params).then(function (res) {
if (res.code == 0) {
console.log(res, '商品列表');
_this4.total = res.data.total;
var commodityArr = [];
res.data.list.forEach(function (item) {
var obj = {
id: item.id,
cover: item.cover,
name: item.name,
original_price: item.original_price,
price: item.price,
tag: item.tag,
stock: item.stock,
sku_id: item.default_sku.id,
amount: item.amount };
commodityArr.push(obj);
});
_this4.commodityList = _this4.commodityList.concat(commodityArr);
if (_this4.commodityList.length == _this4.total) {
_this4.noMore = true;
}
}
uni.hideLoading();
_this4.isLoading = true;
});
},
// 加入购物车
joinCart: function joinCart(index) {var _this5 = this;
if (this.$toolAll.tools.judgeAuth()) {
this.$requst.post('/api/order/shopping-cart-add', { sku_id: this.commodityList[index].sku_id, num: 1 }).then(function (res) {
if (res.code == 0) {
_this5.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');
(0, _publicApi.getCartInfo)();
} else {
_this5.$toolAll.tools.showToast(res.msg);
}
});
}
},
// 去详情页
goDetail: function goDetail(id) {
uni.navigateTo({
url: "/pagesB/shop-detail/shop-detail?id=".concat(id) });
},
// 分类选择事件
changeCateEv: function changeCateEv(index) {
if (index !== this.currentIndex) {
this.isShow = true;
this.currentIndex = index;
// 获取商品列表
this.commodityList = [];
this.noMore = false;
this.getCommodityEv(this.cateList[index].id);
// 分类切换效果
this.setTabList();
}
},
// 分类切换效果
setTabList: function setTabList() {var _this6 = this;
this.$nextTick(function () {
if (_this6.cateList.length > 0) {
//计算左滑距离
_this6.setLeft();
// 计算顶部距离
_this6.setTop();
}
});
},
//计算左滑距离
setLeft: function setLeft() {var _this7 = this;
var lineLeft = 0;
this.getElementData('#tab_list', function (data) {
var list = data[0];
_this7.getElementData('#tab_item', function (res) {
var el = res[_this7.currentIndex];
lineLeft = el.width / 2 + -list.left + el.left - list.width / 2 - _this7.scrollLeft;
_this7.tabsScrollLeft = _this7.scrollLeft + lineLeft;
});
});
},
// 计算顶部距离
setTop: function setTop() {var _this8 = this;
this.getElementData('#index-cate-bg', function (res) {
var el = res[0];
_this8.scrollTop = el.top;
if (_this8.scrollTop == _this8.statusHeight + 35) {
_this8.isShow = false;
} else {
_this8.isShow = true;
}
});
},
// 获取DOM距离
getElementData: function getElementData(el, callback) {
uni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec(function (data) {
callback(data[0]);
});
},
// 滚动
scroll: function scroll(e) {
this.scrollLeft = e.detail.scrollLeft;
},
// 搜索结果
doSearch: function doSearch() {var _this9 = this;
this.showSearch = true;
this.searchList = [];
this.searchKeyword = this.keyword;
this.keyword = '';
this.$requst.get('/api/spu/list', { keyword: this.searchKeyword }).then(function (res) {
if (res.code == 0) {
console.log(res, '搜索列表');
_this9.total = res.data.total;
var searchArr = [];
res.data.list.forEach(function (item) {
var obj = {
id: item.id,
cover: item.cover,
name: item.name,
original_price: item.original_price,
price: item.price,
tag: item.tag,
stock: item.stock,
sku_id: item.default_sku.id };
searchArr.push(obj);
});
_this9.searchList = _this9.searchList.concat(searchArr);
}
});
},
// 关闭搜索
closeSearch: function closeSearch() {
this.showSearch = false;
this.searchKeyword = '';
this.searchList = [];
} } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
/***/ })
},[[18,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map