index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="page-wrapper history" :data-theme="theme">
  3. <view class="history_count" style="padding-top: 20rpx;">
  4. <scroll-view scroll-y refresher-enabled :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh"
  5. @scrolltolower="onLoadMore">
  6. <!-- 数据列表 -->
  7. <view class="his-item" v-for="item in list" @click="toStore(item)">
  8. <img :src="item.avatar" alt="" />
  9. <view class="item-info-box">
  10. <view class="item-name">
  11. <text>{{item.merName}}</text>
  12. <text class="buy-count">买过{{item.buyCount}}次</text>
  13. </view>
  14. <view class="item-info">
  15. <text class="mr10 score">⭐️ {{item.starLevel}}分</text><text class="mr10">{{lastBrowseTag[item.lastBrowseTag]}}</text><text class="mr10">|</text><text class="mr10">{{item.distance}}km</text>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 加载提示 -->
  20. <view style="text-align: center;" v-if="isEnd">没有更多了...</view>
  21. <view style="text-align: center;" v-if="loading">加载中...</view>
  22. <block v-if="(list.length==0 && !loading ) ">
  23. <emptyPage title="暂无浏览记录~" :imgSrc="urlDomain+'crmebimage/presets/noJilu.png'"></emptyPage>
  24. </block>
  25. </scroll-view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. // +----------------------------------------------------------------------
  31. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  32. // +----------------------------------------------------------------------
  33. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  34. // +----------------------------------------------------------------------
  35. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  36. // +----------------------------------------------------------------------
  37. // | Author: CRMEB Team <admin@crmeb.com>
  38. // +----------------------------------------------------------------------
  39. import emptyPage from '@/components/emptyPage.vue'
  40. import {
  41. browseRecordApiv2,
  42. historyDelete,
  43. historyBatchDelete,
  44. historyBatchCollect
  45. } from '@/api/user.js'
  46. import {
  47. goProductDetail
  48. } from '@/libs/order.js'
  49. import {
  50. mapGetters
  51. } from "vuex";
  52. import animationType from '@/utils/animationType.js'
  53. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  54. let app = getApp();
  55. export default {
  56. components: {
  57. emptyPage,
  58. easyLoadimage
  59. },
  60. computed: mapGetters(['uid', 'globalData']),
  61. data() {
  62. return {
  63. urlDomain: this.$Cache.get("imgHost"),
  64. list: [],
  65. allArr: [],
  66. total: 0,
  67. theme: app.globalData.theme,
  68. loading: true,
  69. isRefreshing: false,
  70. page: 1,
  71. isEnd:false,
  72. lastBrowseTag:{
  73. 1:'刚刚浏览',
  74. 2:'一天前测览',
  75. 3:'三天前浏览',
  76. 4:'一周前浏览',
  77. 5:'一个月前浏览',
  78. 6:'一年前浏览'
  79. }
  80. }
  81. },
  82. onLoad() {
  83. // this.getList();
  84. this.getData(() => this.loading = false);
  85. },
  86. methods: {
  87. toStore(item) {
  88. uni.navigateTo({
  89. url: `/pages/merchant/home/index?merId=${item.merId}`
  90. // url: `/pages/goods_cate/index?id=${item.id}`
  91. })
  92. },
  93. onRefresh() { // 下拉刷新
  94. this.isRefreshing = true;
  95. this.page = 1;
  96. this.isEnd = false
  97. this.list = [];
  98. this.getData(() => this.isRefreshing = false);
  99. },
  100. onLoadMore() { // 上拉加载
  101. if (this.loading || this.isEnd) return;
  102. this.loading = true;
  103. this.page++;
  104. this.getData(() => this.loading = false);
  105. },
  106. getData(callback) {
  107. const send = {
  108. latitude: uni.getStorageSync('user_latitude'),
  109. longitude: uni.getStorageSync('user_longitude'),
  110. limit: 20,
  111. page: this.page
  112. }
  113. browseRecordApiv2(send).then(({data}) => {
  114. this.list.push(...data.list);
  115. if(this.list.length >= data.total) {
  116. this.isEnd = true
  117. }
  118. callback()
  119. })
  120. },
  121. getList() {
  122. this.list = [];
  123. browseRecordApiv2().then(({
  124. data
  125. }) => {
  126. this.list = data;
  127. data.map(item => {
  128. this.total += item.list.length;
  129. item.date = item.date.slice(5, 7) + '月' + item.date.slice(8, 10) + '日';
  130. })
  131. this.loading = false;
  132. }).catch(err => {
  133. this.loading = false;
  134. return this.$util.Tips({
  135. title: err
  136. });
  137. });
  138. },
  139. goPage(item) {
  140. if (!item.isShow) return;
  141. goProductDetail(item.productId, 0, '');
  142. }
  143. },
  144. // 滚动监听
  145. onPageScroll(e) {
  146. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  147. uni.$emit('scroll');
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .pictrue {
  153. position: relative;
  154. }
  155. page {
  156. background: #ffffff;
  157. }
  158. .history {
  159. margin-bottom: 96rpx;
  160. .history_count {
  161. padding: 0 30rpx;
  162. }
  163. .history_header {
  164. justify-content: space-between;
  165. margin: 30rpx 0;
  166. text {
  167. font-size: 26rpx;
  168. color: #666666;
  169. }
  170. .text {
  171. color: var(--view-theme);
  172. }
  173. }
  174. .list {
  175. margin-top: 20rpx;
  176. .item_time {
  177. font-size: 36rpx;
  178. color: #282828;
  179. font-weight: bold;
  180. display: flex;
  181. align-items: center;
  182. }
  183. .item_main {
  184. margin-top: 30rpx;
  185. }
  186. }
  187. .item {
  188. width: 217rpx;
  189. border-radius: 16rpx;
  190. margin: 0 20rpx 20rpx 0;
  191. position: relative;
  192. &:nth-child(3n) {
  193. margin-right: 0;
  194. }
  195. /deep/image,
  196. /deep/.easy-loadimage,
  197. uni-image {
  198. width: 217rpx;
  199. height: 217rpx;
  200. border-radius: 16rpx;
  201. }
  202. .info {
  203. margin-top: 20rpx;
  204. color: var(--view-priceColor);
  205. font-size: 24rpx;
  206. }
  207. }
  208. }
  209. /deep/.loadfail-img,
  210. .easy-img {
  211. width: 217rpx;
  212. height: 217rpx;
  213. border-radius: 16rpx;
  214. display: block;
  215. }
  216. .item_time .checkbox .iconfont {
  217. font-size: 38rpx;
  218. color: #999999;
  219. margin-right: 10rpx;
  220. &.icon-xuanzhong1 {
  221. color: var(--view-theme);
  222. }
  223. }
  224. .item_main .checkbox .iconfont {
  225. font-size: 40rpx;
  226. color: #DEDEDE;
  227. position: absolute;
  228. right: 12rpx;
  229. top: 12rpx;
  230. z-index: 10;
  231. border-radius: 100%;
  232. &.icon-weixuanzhong {
  233. &::after {
  234. content: "";
  235. display: block;
  236. width: 36rpx;
  237. height: 36rpx;
  238. background: rgba(0, 0, 0, .38);
  239. position: absolute;
  240. top: 2rpx;
  241. left: 2rpx;
  242. border-radius: 100%;
  243. border: 1rpx solid #DEDEDE;
  244. }
  245. }
  246. }
  247. .history .item .icon-xuanzhong1 {
  248. color: var(--view-theme);
  249. }
  250. .history .footer {
  251. z-index: 99;
  252. width: 100%;
  253. height: 96rpx;
  254. background-color: #ffffff;
  255. position: fixed;
  256. padding: 0 20rpx;
  257. box-sizing: border-box;
  258. border-top: 1rpx solid #eee;
  259. bottom: var(--window-bottom);
  260. }
  261. .area-edit {
  262. justify-content: center;
  263. .area-item {
  264. width: 50%;
  265. text-align: center;
  266. position: relative;
  267. align-items: center;
  268. color: #333333;
  269. .text {
  270. position: relative;
  271. top: -1px;
  272. }
  273. .iconfont {
  274. color: #333333;
  275. }
  276. &:nth-child(1) {
  277. &::after {
  278. content: '';
  279. display: inline-block;
  280. width: 2rpx;
  281. height: 42rpx;
  282. background: #CCCCCC;
  283. position: absolute;
  284. top: 0;
  285. right: 0;
  286. }
  287. }
  288. }
  289. }
  290. .history .footer .checkAll {
  291. font-size: 28rpx;
  292. color: #282828;
  293. margin-left: 16rpx;
  294. }
  295. .allcheckbox .iconfont {
  296. margin-right: 11px;
  297. font-size: 40rpx;
  298. color: #cccccc;
  299. }
  300. .allcheckbox .icon-xuanzhong1 {
  301. color: var(--view-theme);
  302. }
  303. .history .footer .button .bnt {
  304. font-size: 28rpx;
  305. color: #999;
  306. border-radius: 50rpx;
  307. border: 1px solid #999;
  308. width: 160rpx;
  309. height: 60rpx;
  310. text-align: center;
  311. line-height: 60rpx;
  312. &.collect_btn {
  313. color: var(--view-theme);
  314. border-color: var(--view-theme);
  315. }
  316. }
  317. .empty-box {
  318. margin-top: 60%;
  319. }
  320. .his-item{
  321. display: flex;
  322. align-items: center;
  323. padding: 20rpx;
  324. margin-bottom: 20rpx;
  325. img {
  326. width: 80rpx;
  327. height: 80rpx;
  328. padding-right: 20rpx;
  329. }
  330. .item-info-box{
  331. width: 100%;
  332. .item-name {
  333. font-size: 38rpx;
  334. display: flex;
  335. justify-content: space-between;
  336. align-items: flex-start;
  337. }
  338. .buy-count{
  339. font-size: 23rpx;
  340. margin-top: 5rpx;
  341. padding: 0 5rpx;
  342. border: 1rpx solid orange;
  343. color: coral;
  344. }
  345. .score{
  346. color: coral;
  347. }
  348. .item-info{
  349. font-size: 25rpx
  350. }
  351. }
  352. }
  353. .mr10{
  354. margin-right: 10rpx;
  355. }
  356. </style>