good_list.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="sld_point_good">
  3. <view class="fixed_top_status_bar"></view>
  4. <view class="top_con" :style="{backgroundImage:'url('+top_bg1+')','height':type=='more'?'154rpx':'90rpx'}">
  5. <view class="top_title">
  6. <image class="return" :src="imgUrl+'point/return.png'" @click="back" mode=""></image>
  7. <view class="title">
  8. {{title}}
  9. </view>
  10. <image class="search" :src="imgUrl+'point/search.png'" @click="goSearch" mode=""></image>
  11. </view>
  12. <view class="top_cate">
  13. <view :class="{cate_item:true,active:current_index==index}" v-for="(item,index) in label_list" @click="changeLabel(index,item.labelId)"
  14. :key='index'>
  15.  {{item.labelName}}
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 积分商城搜索列表 -->
  20. <!-- #ifdef APP-PLUS -->
  21. <view class="recommend_list" :style="{'marginTop':type=='more'?'calc(170rpx + var(--status-bar-height))':'calc(110rpx + var(--status-bar-height))'}">
  22. <!-- #endif -->
  23. <!-- #ifndef APP-PLUS -->
  24. <view class="recommend_list" :style="{'marginTop':type=='more'?'170rpx':'110rpx'}">
  25. <!-- #endif -->
  26. <recommendGoods class='recommend_pre' v-for="(recommendItem,recommendIndex) in recommendedList" :goods_info="recommendItem"></recommendGoods>
  27. <loadingState v-if="loadingState == 'first_loading'||recommendedList.length > 0" :state='loadingState' />
  28. </view>
  29. <!-- 分类空页面 -->
  30. <view class="empty_sort_page" v-if="is_show_empty">
  31. <image :src="imgUrl+'index/empty.png'" mode="aspectFit" class="empty_img"></image>
  32. <view class="empty_text">{{$L('暂无数据')}}</view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapState,
  39. } from 'vuex';
  40. import recommendGoods from '../components/recommend_item_v.vue'
  41. import loadingState from "../components/loading-state.vue";
  42. export default {
  43. data() {
  44. return {
  45. imgUrl: getApp().globalData.imgUrl,
  46. loadingState: 'first_loading',
  47. current: 1,
  48. pageSize: 10,
  49. hasMore: false,
  50. is_show_empty: false,
  51. top_bg1: getApp().globalData.imgUrl + 'point/top_bg1.png',
  52. top_bg2: getApp().globalData.imgUrl + 'point/top_bg2.png',
  53. title: '',
  54. recommendedList: [],
  55. cate_index: 0,
  56. labelId: '',
  57. label_list: [],
  58. current_index: 0,
  59. type:''
  60. };
  61. },
  62. components: {
  63. recommendGoods,
  64. loadingState
  65. },
  66. computed: {
  67. ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
  68. },
  69. onLoad(options) {
  70. this.type=options.type
  71. if (options.labelId) {
  72. this.labelId = options.labelId
  73. this.label_id = options.labelId//用于搜索页
  74. }
  75. if (options.type == 'more') {
  76. this.title = '积分商城'
  77. this.getLabelList()
  78. } else {
  79. this.title = options.type
  80. this.getGoodList()
  81. }
  82. },
  83. onReachBottom() {
  84. if (this.hasMore) {
  85. this.getGoodList()
  86. }
  87. },
  88. methods: {
  89. goSearch(){
  90. uni.navigateTo({
  91. url:'/standard/point/search/search?labelId='+(this.type=='more'?this.label_id:this.labelId)
  92. })
  93. },
  94. back(){
  95. uni.navigateBack({
  96. delta:1
  97. })
  98. },
  99. changeLabel(index, labelId) {
  100. this.current_index = index
  101. this.labelId = labelId
  102. this.getGoodList()
  103. },
  104. getLabelList() {
  105. uni.showLoading()
  106. let param = {}
  107. param.data = {}
  108. param.data.labelId = this.labelId
  109. param.url = 'v3/integral/front/integral/mall/labelList'
  110. param.method = 'GET'
  111. this.$request(param).then(res => {
  112. if (res.state == 200) {
  113. this.label_list = res.data.list
  114. this.labelId=res.data.list[0].labelId
  115. this.getGoodList()
  116. uni.hideLoading()
  117. } else {
  118. uni.hideLoading()
  119. that.$api.msg(res.msg)
  120. }
  121. })
  122. },
  123. getGoodList() {
  124. uni.showLoading()
  125. let param = {}
  126. param.data = {}
  127. param.data.labelId = this.labelId
  128. param.url = 'v3/integral/front/integral/mall/goodsList'
  129. param.method = 'GET'
  130. this.$request(param).then(res => {
  131. if (res.state == 200) {
  132. this.recommendedList = res.data.list
  133. if (this.recommendedList.length == 0) {
  134. this.is_show_empty = true
  135. }else{
  136. this.is_show_empty = false
  137. }
  138. this.hasMore = this.$checkPaginationHasMore(res.data.pagination); //是否还有数据
  139. if (this.hasMore) {
  140. this.current++;
  141. this.loadingState = 'allow_loading_more';
  142. } else {
  143. this.loadingState = 'no_more_data';
  144. }
  145. uni.hideLoading()
  146. } else {
  147. uni.hideLoading()
  148. that.$api.msg(res.msg)
  149. }
  150. })
  151. }
  152. },
  153. }
  154. </script>
  155. <style lang="scss">
  156. .fixed_top_status_bar {
  157. position: fixed;
  158. /* #ifdef APP-PLUS */
  159. height: var(--status-bar-height);
  160. /* #endif */
  161. /* #ifndef APP-PLUS */
  162. height: 0;
  163. /* #endif */
  164. top: 0;
  165. left: 0;
  166. right: 0;
  167. z-index: 99;
  168. background: #fff;
  169. }
  170. page {
  171. background: #F5F5F5;
  172. width: 750rpx;
  173. margin: 0 auto;
  174. }
  175. .sld_point_good {
  176. .top_con {
  177. position: fixed;
  178. top: 0;
  179. // #ifdef APP-PLUS
  180. top: var(--status-bar-height);
  181. // #endif
  182. left: 0;
  183. right: 0;
  184. margin: 0 auto;
  185. width: 750rpx;
  186. // height: 154rpx;
  187. background-size: 100%;
  188. padding: 0 20rpx;
  189. box-sizing: border-box;
  190. // #ifdef H5 || APP-PLUS
  191. padding-top: 20rpx;
  192. // #endif
  193. overflow-y: hidden;
  194. .top_title {
  195. display: flex;
  196. align-items: center;
  197. .return {
  198. width: 17rpx;
  199. height: 29rpx;
  200. }
  201. .title {
  202. width: 663rpx;
  203. text-align: center;
  204. font-size: 36rpx;
  205. color: white;
  206. }
  207. .search {
  208. width: 30rpx;
  209. height: 30rpx;
  210. }
  211. }
  212. .top_cate {
  213. display: flex;
  214. align-items: start;
  215. margin-top: 30rpx;
  216. overflow-x: scroll;
  217. width: 100%;
  218. height: 66rpx;
  219. .cate_item {
  220. color: white;
  221. font-size: 32rpx;
  222. margin-right: 60rpx;
  223. min-width: fit-content;
  224. &.active {
  225. font-weight: bold;
  226. }
  227. &:last-child {
  228. margin-right: 0rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. .mp_search_box {
  235. display: flex;
  236. align-items: center;
  237. background-color: white;
  238. padding: 11rpx 0;
  239. .search_con {
  240. width: 631rpx;
  241. height: 65rpx;
  242. background: #F5F5F5;
  243. border-radius: 33rpx;
  244. padding: 18rpx 22rpx;
  245. display: flex;
  246. align-items: center;
  247. margin-left: 20rpx;
  248. .ser_input {
  249. padding-left: 20rpx;
  250. }
  251. .search_img {
  252. width: 30rpx;
  253. height: 30rpx;
  254. }
  255. .search_input {
  256. font-size: 28rpx;
  257. color: #999999;
  258. }
  259. }
  260. .search_btn {
  261. margin-left: 20rpx;
  262. font-size: 30rpx;
  263. color: #333333;
  264. }
  265. }
  266. .recommend_list {
  267. margin-top: 20rpx;
  268. display: flex;
  269. flex-wrap: wrap;
  270. padding: 0 20rpx;
  271. .recommend_pre {
  272. margin-right: 20rpx !important;
  273. &:nth-child(2n) {
  274. margin-right: 0 !important;
  275. }
  276. }
  277. }
  278. // 空页面
  279. .empty_sort_page {
  280. width: 100%;
  281. // height: 100vh;
  282. background: #F5F5F5;
  283. display: flex;
  284. flex-direction: column;
  285. align-items: center;
  286. padding-top: 228rpx;
  287. .empty_img {
  288. width: 210rpx;
  289. height: 210rpx;
  290. margin-bottom: 32rpx;
  291. }
  292. .empty_text {
  293. font-size: 26rpx;
  294. color: #999;
  295. }
  296. }
  297. </style>