acdr-ui/dist/dev/mp-weixin/modules/mall/user/goods-collect.js.map

1 line
8.7 KiB
Plaintext

{"version":3,"file":"goods-collect.js","sources":["../../../../../../src/modules/mall/user/goods-collect.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXHVzZXJcZ29vZHMtY29sbGVjdC52dWU"],"sourcesContent":["<!-- 我的商品收藏 -->\r\n<template>\r\n <s-layout title=\"商品收藏\">\r\n <view class=\"cart-box ss-flex ss-flex-col ss-row-between\">\r\n <!-- 头部 -->\r\n <view class=\"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30\">\r\n <view class=\"header-left ss-flex ss-col-center ss-font-26\">\r\n 共\r\n <text class=\"goods-number ui-TC-Main ss-flex\">{{ state.pagination.total }}</text>\r\n 件商品\r\n </view>\r\n <view class=\"header-right\">\r\n <button\r\n v-if=\"state.editMode && state.pagination.total\"\r\n class=\"ss-reset-button\"\r\n @tap=\"state.editMode = false\"\r\n >\r\n 取消\r\n </button>\r\n <button\r\n v-if=\"!state.editMode && state.pagination.total\"\r\n class=\"ss-reset-button ui-TC-Main\"\r\n @tap=\"state.editMode = true\"\r\n >\r\n 编辑\r\n </button>\r\n </view>\r\n </view>\r\n <!-- 内容 -->\r\n <view class=\"cart-content\">\r\n <view\r\n class=\"goods-box ss-r-10 ss-m-b-14\"\r\n v-for=\"item in state.pagination.list\"\r\n :key=\"item.id\"\r\n >\r\n <view class=\"ss-flex ss-col-center\">\r\n <label\r\n class=\"check-box ss-flex ss-col-center ss-p-l-10\"\r\n v-if=\"state.editMode\"\r\n @tap=\"onSelect(item.spuId)\"\r\n >\r\n <radio\r\n :checked=\"state.selectedCollectList.includes(item.spuId)\"\r\n color=\"var(--ui-BG-Main)\"\r\n style=\"transform: scale(0.8)\"\r\n @tap.stop=\"onSelect(item.spuId)\"\r\n />\r\n </label>\r\n <s-goods-item\r\n :title=\"item.spuName\"\r\n :img=\"item.picUrl\"\r\n :price=\"item.price\"\r\n priceColor=\"#FF3000\"\r\n :titleWidth=\"400\"\r\n @tap=\"\r\n sheep.$router.go('/modules/mall/goods/index', {\r\n id: item.spuId,\r\n })\r\n \"\r\n />\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <!-- 底部 -->\r\n <su-fixed bottom :val=\"0\" placeholder v-show=\"state.editMode\">\r\n <view class=\"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom\">\r\n <view class=\"footer-left ss-flex ss-col-center\">\r\n <label class=\"check-box ss-flex ss-col-center ss-p-r-30\" @tap=\"onSelectAll\">\r\n <radio\r\n :checked=\"state.selectAll\"\r\n color=\"var(--ui-BG-Main)\"\r\n style=\"transform: scale(0.7)\"\r\n @tap.stop=\"onSelectAll\"\r\n />\r\n <view>全选</view>\r\n </label>\r\n </view>\r\n <view class=\"footer-right\">\r\n <button\r\n class=\"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main\"\r\n @tap=\"onCancel\"\r\n >\r\n 取消收藏\r\n </button>\r\n </view>\r\n </view>\r\n </su-fixed>\r\n </view>\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-empty v-if=\"state.pagination.total === 0\" text=\"暂无收藏\" icon=\"/static/collect-empty.png\" />\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport sheep from '@/sheep'\r\nimport { reactive } from 'vue'\r\nimport { onLoad, onReachBottom } from '@dcloudio/uni-app'\r\nimport _ from 'lodash-es'\r\nimport FavoriteApi from '@/sheep/api/product/favorite'\r\nimport { resetPagination } from '@/sheep/util'\r\n\r\nconst sys_navBar = sheep.$platform.navbar\r\n\r\nconst state = reactive({\r\n pagination: {\r\n list: [],\r\n total: 0,\r\n pageNo: 1,\r\n pageSize: 6,\r\n },\r\n loadStatus: '',\r\n\r\n editMode: false,\r\n selectedCollectList: [], // 选中的 SPU 数组\r\n selectAll: false,\r\n})\r\n\r\nasync function getData() {\r\n state.loadStatus = 'loading'\r\n const { code, data } = await FavoriteApi.getFavoritePage({\r\n pageNo: state.pagination.pageNo,\r\n pageSize: state.pagination.pageSize,\r\n })\r\n if (code !== 0) {\r\n return\r\n }\r\n state.pagination.list = _.concat(state.pagination.list, data.list)\r\n state.pagination.total = data.total\r\n state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'\r\n}\r\n\r\n// 单选选中\r\nconst onSelect = (spuId) => {\r\n if (!state.selectedCollectList.includes(spuId)) {\r\n state.selectedCollectList.push(spuId)\r\n } else {\r\n state.selectedCollectList.splice(state.selectedCollectList.indexOf(spuId), 1)\r\n }\r\n state.selectAll = state.selectedCollectList.length === state.pagination.list.length\r\n}\r\n\r\n// 全选\r\nconst onSelectAll = () => {\r\n state.selectAll = !state.selectAll\r\n if (!state.selectAll) {\r\n state.selectedCollectList = []\r\n } else {\r\n state.selectedCollectList = state.pagination.list.map((item) => item.spuId)\r\n }\r\n}\r\n\r\nasync function onCancel() {\r\n if (!state.selectedCollectList) {\r\n return\r\n }\r\n // 取消收藏\r\n for (const spuId of state.selectedCollectList) {\r\n await FavoriteApi.deleteFavorite(spuId)\r\n }\r\n\r\n // 清空选择 + 重新加载\r\n state.editMode = false\r\n state.selectedCollectList = []\r\n state.selectAll = false\r\n resetPagination(state.pagination)\r\n await getData()\r\n}\r\n\r\n// 加载更多\r\nfunction loadMore() {\r\n if (state.loadStatus === 'noMore') {\r\n return\r\n }\r\n state.pagination.pageNo++\r\n getData()\r\n}\r\n\r\nonReachBottom(() => {\r\n loadMore()\r\n})\r\n\r\nonLoad(() => {\r\n getData()\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n.cart-box {\r\n .cart-header {\r\n position: fixed;\r\n top: v-bind('sys_navBar') rpx;\r\n left: 0;\r\n z-index: 1000;\r\n box-sizing: border-box;\r\n width: 100%;\r\n height: 70rpx;\r\n background-color: #f6f6f6;\r\n }\r\n\r\n .cart-footer {\r\n height: 100rpx;\r\n background-color: #fff;\r\n\r\n .pay-btn {\r\n min-width: 200rpx;\r\n height: 80rpx;\r\n padding: 0 40rpx;\r\n line-height: 80rpx;\r\n border-radius: 40rpx;\r\n }\r\n }\r\n\r\n .cart-content {\r\n box-sizing: border-box;\r\n width: 100%;\r\n padding: 0 20rpx;\r\n margin-top: 70rpx;\r\n .goods-box {\r\n background-color: #fff;\r\n &:last-child {\r\n margin-bottom: 40rpx;\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/modules/mall/user/goods-collect.vue'\nwx.createPage(MiniProgramPage)"],"names":["sheep","reactive","FavoriteApi","_","resetPagination","onReachBottom","onLoad"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,UAAA,aAAAA,YAAAA,MAAA,UAAA;AAEA,UAAA,QAAAC,cAAAA,SAAA;AAAA,MACA,YAAA;AAAA,QACA,MAAA,CAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA;AAAA,MACA;AAAA,MACA,YAAA;AAAA,MAEA,UAAA;AAAA,MACA,qBAAA,CAAA;AAAA;AAAA,MACA,WAAA;AAAA,IACA,CAAA;AAEA,aAAA,UAAA;AAAA;AACA,cAAA,aAAA;AACA,cAAA,EAAA,MAAA,KAAA,IAAA,MAAAC,2BAAAA,YAAA,gBAAA;AAAA,UACA,QAAA,MAAA,WAAA;AAAA,UACA,UAAA,MAAA,WAAA;AAAA,QACA,CAAA;AACA,YAAA,SAAA,GAAA;AACA;AAAA,QACA;AACA,cAAA,WAAA,OAAAC,qBAAA,OAAA,MAAA,WAAA,MAAA,KAAA,IAAA;AACA,cAAA,WAAA,QAAA,KAAA;AACA,cAAA,aAAA,MAAA,WAAA,KAAA,SAAA,MAAA,WAAA,QAAA,SAAA;AAAA,MACA;AAAA;AAGA,UAAA,WAAA,CAAA,UA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