1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
{"version":3,"file":"goods-log.js","sources":["../../../../../../src/modules/mall/user/goods-log.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXHVzZXJcZ29vZHMtbG9nLnZ1ZQ"],"sourcesContent":["<!-- 商品浏览记录 -->\r\n<template>\r\n <s-layout title=\"我的足迹\" :bgStyle=\"{ color: '#f2f2f2' }\">\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\">\r\n {{ state.pagination.total }}\r\n </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.selectedSpuIdList.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 :skuText=\"item.introduction\"\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 ></s-goods-item>\r\n </view>\r\n </view>\r\n </view>\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 ss-flex\">\r\n <button\r\n :class=\"[\r\n 'ss-reset-button pay-btn ss-font-28 ',\r\n {\r\n 'ui-BG-Main-Gradient': state.selectedSpuIdList.length > 0,\r\n 'ui-Shadow-Main': state.selectedSpuIdList.length > 0,\r\n },\r\n ]\"\r\n @tap=\"onDelete\"\r\n >\r\n 删除足迹\r\n </button>\r\n <button\r\n class=\"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main ml-2\"\r\n @tap=\"onClean\"\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\r\n v-if=\"state.pagination.total === 0\"\r\n text=\"暂无浏览记录\"\r\n icon=\"/static/collect-empty.png\"\r\n />\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 SpuHistoryApi from '@/sheep/api/product/history'\r\nimport { cloneDeep } from '@/sheep/helper/utils'\r\n\r\nconst sys_navBar = sheep.$platform.navbar\r\nconst pagination = {\r\n list: [],\r\n pageNo: 1,\r\n total: 1,\r\n pageSize: 10,\r\n}\r\nconst state = reactive({\r\n pagination: cloneDeep(pagination),\r\n loadStatus: '',\r\n editMode: false,\r\n selectedSpuIdList: [],\r\n selectAll: false,\r\n})\r\n\r\nasync function getList() {\r\n state.loadStatus = 'loading'\r\n const { code, data } = await SpuHistoryApi.getBrowseHistoryPage({\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\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 = (id) => {\r\n if (!state.selectedSpuIdList.includes(id)) {\r\n state.selectedSpuIdList.push(id)\r\n } else {\r\n state.selectedSpuIdList.splice(state.selectedSpuIdList.indexOf(id), 1)\r\n }\r\n state.selectAll = state.selectedSpuIdList.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.selectedSpuIdList = []\r\n } else {\r\n state.pagination.list.forEach((item) => {\r\n if (state.selectedSpuIdList.includes(item.spuId)) {\r\n state.selectedSpuIdList.splice(state.selectedSpuIdList.indexOf(item.spuId), 1)\r\n }\r\n state.selectedSpuIdList.push(item.spuId)\r\n })\r\n }\r\n}\r\n\r\n// 删除足迹\r\nasync function onDelete() {\r\n if (state.selectedSpuIdList.length <= 0) {\r\n return\r\n }\r\n\r\n const { code } = await SpuHistoryApi.deleteBrowseHistory(state.selectedSpuIdList)\r\n if (code === 0) {\r\n reload()\r\n }\r\n}\r\n\r\n// 清空\r\nasync function onClean() {\r\n const { code } = await SpuHistoryApi.cleanBrowseHistory()\r\n if (code === 0) {\r\n reload()\r\n }\r\n}\r\n\r\nfunction reload() {\r\n state.editMode = false\r\n state.selectedSpuIdList = []\r\n state.selectAll = false\r\n state.pagination = pagination\r\n getList()\r\n}\r\n\r\n// 加载更多\r\nfunction loadMore() {\r\n if (state.loadStatus !== 'noMore') {\r\n state.pagination.pageNo += 1\r\n getList()\r\n }\r\n}\r\n\r\nonReachBottom(() => {\r\n loadMore()\r\n})\r\n\r\nonLoad(() => {\r\n getList()\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\r\n.title-card {\r\n padding: 36rpx 0 46rpx 20rpx;\r\n\r\n .img-box {\r\n width: 164rpx;\r\n height: 164rpx;\r\n\r\n .order-img {\r\n width: 164rpx;\r\n height: 164rpx;\r\n }\r\n }\r\n\r\n .check-box {\r\n height: 100%;\r\n }\r\n\r\n .title-text {\r\n font-size: 28rpx;\r\n font-weight: 500;\r\n color: #333333;\r\n }\r\n\r\n .params-box {\r\n .params-title {\r\n height: 38rpx;\r\n font-size: 24rpx;\r\n font-weight: 400;\r\n color: #666666;\r\n background: #f4f4f4;\r\n border-radius: 2rpx;\r\n }\r\n }\r\n\r\n .price-text {\r\n font-family: OPPOSANS;\r\n color: $red;\r\n }\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/modules/mall/user/goods-log.vue'\nwx.createPage(MiniProgramPage)"],"names":["sheep","reactive","cloneDeep","SpuHistoryApi","_","onReachBottom","onLoad"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+HA,UAAA,aAAAA,YAAAA,MAAA,UAAA;AACA,UAAA,aAAA;AAAA,MACA,MAAA,CAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,IACA;AACA,UAAA,QAAAC,cAAAA,SAAA;AAAA,MACA,YAAAC,mBAAA,UAAA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,UAAA;AAAA,MACA,mBAAA,CAAA;AAAA,MACA,WAAA;AAAA,IACA,CAAA;AAEA,aAAA,UAAA;AAAA;AACA,cAAA,aAAA;AACA,cAAA,EAAA,MAAA,KAAA,IAAA,MAAAC,0BAAAA,cAAA,qBAAA;AAAA,UACA,QAAA,MAAA,WAAA;AAAA,UACA,UAAA,MAAA,WAAA;AAAA,QACA,CAAA;AACA,YAAA,SAAA,GAAA;AACA;AAAA,QACA;AAEA,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,OAAA;AACA,UAAA,CAAA,MAAA,kBAAA,SAAA,EAAA,GAAA;AACA,cAAA,kBAAA,KAAA,EAAA;AAAA,MACA,OAAA;AACA,cAAA,kBAAA,OAAA,MAAA,kBAAA,QAAA,EAAA,GAAA,CAAA;AAAA,MACA;AACA,YAAA,YAAA,MAAA,kBAAA,WAAA,MAAA,WAAA,KAAA;AAA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