1 line
7.9 KiB
Plaintext
1 line
7.9 KiB
Plaintext
|
{"version":3,"file":"index.js","sources":["../../../../../../src/modules/mall/activity/index.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXGFjdGl2aXR5XGluZGV4LnZ1ZQ"],"sourcesContent":["<!-- 指定满减送的活动列表 -->\r\n<template>\r\n <s-layout class=\"activity-wrap\" :title=\"state.activityInfo.title\">\r\n <!-- 活动信息 -->\r\n <su-sticky bgColor=\"#fff\">\r\n <view class=\"ss-flex ss-col-top tip-box\">\r\n <view class=\"type-text ss-flex ss-row-center\">满减:</view>\r\n <view class=\"ss-flex-1\">\r\n <view class=\"tip-content\" v-for=\"item in state.activityInfo.rules\" :key=\"item\">\r\n {{ formatRewardActivityRule(state.activityInfo, item) }}\r\n </view>\r\n </view>\r\n <image class=\"activity-left-image\" src=\"/static/activity-left.png\" />\r\n <image class=\"activity-right-image\" src=\"/static/activity-right.png\" />\r\n </view>\r\n </su-sticky>\r\n\r\n <!-- 商品信息 -->\r\n <view class=\"ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top\">\r\n <view class=\"goods-list-box\">\r\n <view class=\"left-list\" v-for=\"item in state.leftGoodsList\" :key=\"item.id\">\r\n <s-goods-column\r\n class=\"goods-md-box\"\r\n size=\"md\"\r\n :data=\"item\"\r\n @click=\"sheep.$router.go('/modules/mall/goods/index', { id: item.id })\"\r\n @getHeight=\"mountMasonry($event, 'left')\"\r\n >\r\n <template v-slot:cart>\r\n <button class=\"ss-reset-button cart-btn\"></button>\r\n </template>\r\n </s-goods-column>\r\n </view>\r\n </view>\r\n <view class=\"goods-list-box\">\r\n <view class=\"right-list\" v-for=\"item in state.rightGoodsList\" :key=\"item.id\">\r\n <s-goods-column\r\n class=\"goods-md-box\"\r\n size=\"md\"\r\n :data=\"item\"\r\n @click=\"sheep.$router.go('/modules/mall/goods/index', { id: item.id })\"\r\n @getHeight=\"mountMasonry($event, 'right')\"\r\n >\r\n <template v-slot:cart>\r\n <button class=\"ss-reset-button cart-btn\" />\r\n </template>\r\n </s-goods-column>\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <uni-load-more\r\n v-if=\"state.pagination.total > 0\"\r\n :status=\"state.loadStatus\"\r\n :content-text=\"{\r\n contentdown: '上拉加载更多',\r\n }\"\r\n @tap=\"loadMore\"\r\n />\r\n </s-layout>\r\n</template>\r\n<script setup>\r\nimport { reactive } from 'vue'\r\nimport { onLoad, onReachBottom } from '@dcloudio/uni-app'\r\nimport sheep from '@/sheep'\r\nimport _ from 'lodash-es'\r\nimport RewardActivityApi from '@/sheep/api/promotion/rewardActivity'\r\nimport { formatRewardActivityRule } from '@/sheep/hooks/useGoods'\r\nimport SpuApi from '@/sheep/api/product/spu'\r\n\r\nconst state = reactive({\r\n activityId: 0, // 获得编号\r\n activityInfo: {}, // 获得信息\r\n\r\n pagination: {\r\n list: [],\r\n total: 1,\r\n pageNo: 1,\r\n pageSize: 8,\r\n },\r\n loadStatus: '',\r\n leftGoodsList: [],\r\n rightGoodsList: [],\r\n})\r\n\r\n// 加载瀑布流\r\nlet count = 0\r\nlet leftHeight = 0\r\nlet rightHeight = 0\r\n\r\nfunction mountMasonry(height = 0, where = 'left') {\r\n if (!state.pagination.list[count]) return\r\n\r\n if (where === 'left') {\r\n leftHeight += height\r\n } else {\r\n rightHeight += height\r\n }\r\n if (leftHeight <= rightHeight) {\r\n state.leftGoodsList.push(state.pagination.list[count])\r\n } else {\r\n state.rightGoodsList.push(state.pagination.list[count])\r\n }\r\n count++\r\n}\r\n\r\n// 加载商品信息\r\nasync function getList() {\r\n // 处理拓展参数\r\n const params = {}\r\n if (state.activityInfo.productScope === 2) {\r\n params.ids = state.activityInfo.productSpuIds.join(',')\r\n } else if (state.activityInfo.productScope === 3) {\r\n params.categoryIds = state.activityInfo.productSpuId
|