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

536 lines
28 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:/老农商城/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:/老农商城/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_app_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-app开发版/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_app_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:/老农商城/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_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___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../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??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??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& */ 21);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recyclableRender", function() { return _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___WEBPACK_IMPORTED_MODULE_0__["recyclableRender"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _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___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:/老农商城/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 */ 144))
}
}
} 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:/老农商城/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_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___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??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??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& */ 23);
/* harmony import */ var _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___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_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___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _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___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _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___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony default export */ __webpack_exports__["default"] = (_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___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:/老农商城/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 tabbar = function tabbar() {__webpack_require__.e(/*! require.ensure | components/tabbar/tabbar */ "components/tabbar/tabbar").then((function () {return resolve(__webpack_require__(/*! @/components/tabbar/tabbar */ 144));}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);}; //引入mapState
var _default = {
components: {
tabbar: tabbar },
data: function data() {var _ref;
return _ref = {
statusHeight: uni.getSystemInfoSync().statusBarHeight,
scrollTop: 0, //分类距离顶部距离
isShow: true, //显示
//分类导航
currentIndex: 0,
scrollLeft: 0,
tabsScrollLeft: 0,
cateWidth: '',
indexBackground: '', //背景图
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() {
// 获取用户信息
this.getUserInfo();
// 获取头部背景
this.getTabbarEv();
// 获取分类列表
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) {
this.setTop();
if (object.scrollTop > this.scrollTop) {
this.isShow = false;
} else {
this.isShow = true;
}
},
// 分享到微信
onShareAppMessage: function onShareAppMessage(res) {
},
// 分享到朋友圈
onShareTimeline: function onShareTimeline(res) {
},
// 触底
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: {
// 获取个人信息
getUserInfo: function getUserInfo() {
this.$requst.get('/api/user/info').then(function (res) {
if (res.code == 0) {
console.log(res, '个人信息');
uni.setStorageSync('vip_level', res.data.vip_level);
}
});
},
// 获取头部背景
getTabbarEv: function getTabbarEv() {var _this2 = this;
this.$requst.get('/api/index/mini-program-setting').then(function (res) {
if (res.code == 0) {
console.log(res, '个性装扮');
_this2.indexBackground = _this2.$hostHttp + res.data.indexBackground;
}
});
},
// 获取商品分类
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 (this.currentIndex !== index) {
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();
}
});
},
//计算左滑距离
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 + el.height / 4;
});
},
// 获取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.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