index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="page-wrapper history" :data-theme="theme">
  3. <view class="history_count">
  4. <block v-if="list.length>0">
  5. <view class="history_header acea-row">
  6. <text>共{{total}}条,最多为您保存100条</text>
  7. </view>
  8. <view class="list" v-for="(item,index) in list">
  9. <view class="item_time">
  10. <view>{{item.date}}</view>
  11. </view>
  12. <view class="item_main acea-row">
  13. <view class="item acea-row" :class="{gary :(!itemn.isDel && itemn.isShow ==1) }"
  14. v-for="(itemn,indexn) in item.list">
  15. <view class="item item_count" @click="goPage(itemn)">
  16. <view class="pictrue">
  17. <easy-loadimage class="easy-img" mode="widthFix" :image-src="itemn.image">
  18. </easy-loadimage>
  19. <view v-if="item.activityStyle" :style="{ backgroundImage: `url(${item.activityStyle})` }" class="border-picture"></view>
  20. </view>
  21. <view class="info">
  22. <view class="msg">
  23. <block v-if="!itemn.isDel && itemn.isShow">
  24. <view class="price line2"><text></text>¥{{itemn.price}}</view>
  25. </block>
  26. <block v-else-if="itemn.isDel">
  27. <view class="tips">该商品已删除</view>
  28. </block>
  29. <block v-else>
  30. <view class="tips">该商品已下架</view>
  31. </block>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. <block v-if="(list.length==0 && !loading ) " >
  40. <emptyPage title="暂无浏览记录~" :imgSrc="urlDomain+'crmebimage/presets/noJilu.png'"></emptyPage>
  41. </block>
  42. <view class='loadingicon acea-row row-center-wrapper'>
  43. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. // +----------------------------------------------------------------------
  50. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  51. // +----------------------------------------------------------------------
  52. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  53. // +----------------------------------------------------------------------
  54. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  55. // +----------------------------------------------------------------------
  56. // | Author: CRMEB Team <admin@crmeb.com>
  57. // +----------------------------------------------------------------------
  58. import emptyPage from '@/components/emptyPage.vue'
  59. import {
  60. browseRecordApi,
  61. historyDelete,
  62. historyBatchDelete,
  63. historyBatchCollect
  64. } from '@/api/user.js'
  65. import {
  66. goProductDetail
  67. } from '@/libs/order.js'
  68. import {
  69. mapGetters
  70. } from "vuex";
  71. import animationType from '@/utils/animationType.js'
  72. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  73. let app = getApp();
  74. export default {
  75. components: {
  76. emptyPage,
  77. easyLoadimage
  78. },
  79. computed: mapGetters(['uid', 'globalData']),
  80. data() {
  81. return {
  82. urlDomain: this.$Cache.get("imgHost"),
  83. list: [],
  84. allArr: [],
  85. total: 0,
  86. theme: app.globalData.theme,
  87. loading: true
  88. }
  89. },
  90. onLoad() {
  91. this.getList();
  92. },
  93. methods: {
  94. getList() {
  95. this.list = [];
  96. browseRecordApi().then(({
  97. data
  98. }) => {
  99. this.list = data;
  100. data.map(item => {
  101. this.total += item.list.length;
  102. item.date = item.date.slice(5, 7)+'月'+item.date.slice(8, 10)+'日' ;
  103. })
  104. this.loading = false;
  105. }).catch(err => {
  106. this.loading = false;
  107. return this.$util.Tips({
  108. title: err
  109. });
  110. });
  111. },
  112. goPage(item) {
  113. if(!item.isShow) return;
  114. goProductDetail(item.productId, 0,'');
  115. }
  116. },
  117. // 滚动监听
  118. onPageScroll(e) {
  119. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  120. uni.$emit('scroll');
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .pictrue{
  126. position: relative;
  127. }
  128. page {
  129. background: #ffffff;
  130. }
  131. .history {
  132. margin-bottom: 96rpx;
  133. .history_count {
  134. padding: 0 30rpx;
  135. }
  136. .history_header {
  137. justify-content: space-between;
  138. margin: 30rpx 0;
  139. text {
  140. font-size: 26rpx;
  141. color: #666666;
  142. }
  143. .text {
  144. color: var(--view-theme);
  145. }
  146. }
  147. .list {
  148. margin-top: 20rpx;
  149. .item_time {
  150. font-size: 36rpx;
  151. color: #282828;
  152. font-weight: bold;
  153. display: flex;
  154. align-items: center;
  155. }
  156. .item_main {
  157. margin-top: 30rpx;
  158. }
  159. }
  160. .item {
  161. width: 217rpx;
  162. border-radius: 16rpx;
  163. margin: 0 20rpx 20rpx 0;
  164. position: relative;
  165. &:nth-child(3n) {
  166. margin-right: 0;
  167. }
  168. /deep/image,
  169. /deep/.easy-loadimage,
  170. uni-image {
  171. width: 217rpx;
  172. height: 217rpx;
  173. border-radius: 16rpx;
  174. }
  175. .info {
  176. margin-top: 20rpx;
  177. color: var(--view-priceColor);
  178. font-size: 24rpx;
  179. }
  180. }
  181. }
  182. /deep/.loadfail-img,
  183. .easy-img {
  184. width: 217rpx;
  185. height: 217rpx;
  186. border-radius: 16rpx;
  187. display: block;
  188. }
  189. .item_time .checkbox .iconfont {
  190. font-size: 38rpx;
  191. color: #999999;
  192. margin-right: 10rpx;
  193. &.icon-xuanzhong1 {
  194. color: var(--view-theme);
  195. }
  196. }
  197. .item_main .checkbox .iconfont {
  198. font-size: 40rpx;
  199. color: #DEDEDE;
  200. position: absolute;
  201. right: 12rpx;
  202. top: 12rpx;
  203. z-index: 10;
  204. border-radius: 100%;
  205. &.icon-weixuanzhong {
  206. &::after {
  207. content: "";
  208. display: block;
  209. width: 36rpx;
  210. height: 36rpx;
  211. background: rgba(0, 0, 0, .38);
  212. position: absolute;
  213. top: 2rpx;
  214. left: 2rpx;
  215. border-radius: 100%;
  216. border: 1rpx solid #DEDEDE;
  217. }
  218. }
  219. }
  220. .history .item .icon-xuanzhong1 {
  221. color: var(--view-theme);
  222. }
  223. .history .footer {
  224. z-index: 99;
  225. width: 100%;
  226. height: 96rpx;
  227. background-color: #ffffff;
  228. position: fixed;
  229. padding: 0 20rpx;
  230. box-sizing: border-box;
  231. border-top: 1rpx solid #eee;
  232. bottom: var(--window-bottom);
  233. }
  234. .area-edit {
  235. justify-content: center;
  236. .area-item {
  237. width: 50%;
  238. text-align: center;
  239. position: relative;
  240. align-items: center;
  241. color: #333333;
  242. .text {
  243. position: relative;
  244. top: -1px;
  245. }
  246. .iconfont {
  247. color: #333333;
  248. }
  249. &:nth-child(1) {
  250. &::after {
  251. content: '';
  252. display: inline-block;
  253. width: 2rpx;
  254. height: 42rpx;
  255. background: #CCCCCC;
  256. position: absolute;
  257. top: 0;
  258. right: 0;
  259. }
  260. }
  261. }
  262. }
  263. .history .footer .checkAll {
  264. font-size: 28rpx;
  265. color: #282828;
  266. margin-left: 16rpx;
  267. }
  268. .allcheckbox .iconfont {
  269. margin-right: 11px;
  270. font-size: 40rpx;
  271. color: #cccccc;
  272. }
  273. .allcheckbox .icon-xuanzhong1 {
  274. color: var(--view-theme);
  275. }
  276. .history .footer .button .bnt {
  277. font-size: 28rpx;
  278. color: #999;
  279. border-radius: 50rpx;
  280. border: 1px solid #999;
  281. width: 160rpx;
  282. height: 60rpx;
  283. text-align: center;
  284. line-height: 60rpx;
  285. &.collect_btn {
  286. color: var(--view-theme);
  287. border-color: var(--view-theme);
  288. }
  289. }
  290. .empty-box {
  291. margin-top: 60%;
  292. }
  293. </style>