CommercePart.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="commerce-part">
  3. <view class="main-content">
  4. <view v-if="false" class="not-login-box">
  5. <u-empty text="暂无搜索内容哦~"> </u-empty>
  6. </view>
  7. <view v-else class="activity-box">
  8. <view class="activity-list" v-for="(item, index) in data" :key="index" @click="toDetail(item)">
  9. <image style="width: 100%; height: 344rpx; border-radius: 20rpx 20rpx 0 0" :src="item.cover"
  10. mode="aspectFill">
  11. </image>
  12. <view class="list-content text-overflow2">
  13. <view class="text-overflow-single mb10">{{item.goods_name}}</view>
  14. <view class="display-flex-between">
  15. <text class="fs13 fw600 color-red">¥{{item.price_selling}}</text>
  16. <text class="text-through fs12 color-ca">¥{{item.price_market}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view style="width: 100%">
  21. <!-- <u-loadmore :status="status" @loadmore="loadmoreClick" :load-text="loadText" /> -->
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. name: "CommercePart",
  30. props: {
  31. type: {
  32. type: String,
  33. default: "common",
  34. },
  35. data: {
  36. type: Array,
  37. default: () => {
  38. return [];
  39. },
  40. },
  41. },
  42. data() {
  43. return {
  44. imageUrl: this.$C.imageUrl,
  45. cateList: [],
  46. cateCurrent: "",
  47. sortCurrent: "",
  48. };
  49. },
  50. watch: {
  51. type: {
  52. handler() {
  53. if (this.type == "list") {
  54. this.getCateList();
  55. }
  56. },
  57. immediate: true,
  58. },
  59. },
  60. mounted() {
  61. if (this.$refs.cateItem) {
  62. this.$refs.cateItem.top = "50px";
  63. this.$refs.sortItem.top = "50px";
  64. }
  65. },
  66. methods: {
  67. cateChange(item, key) {
  68. this[key] = item.id;
  69. this.$refs.cateItem.show = false;
  70. this.$refs.cateItem.setContentAnimate(0);
  71. this.$refs.sortItem.show = false;
  72. this.$refs.sortItem.setContentAnimate(0);
  73. this.$emit("filterChange", {
  74. cateids: this.cateCurrent,
  75. sort: this.sortCurrent,
  76. });
  77. },
  78. getCateList() {
  79. uni.showLoading({
  80. title: "加载中",
  81. });
  82. this.$api
  83. .getGoodsCate()
  84. .then((res) => {
  85. uni.hideLoading();
  86. if (res.code == 1) {
  87. this.cateList = res.data;
  88. }
  89. })
  90. .catch(() => {
  91. uni.hideLoading();
  92. });
  93. },
  94. toDetail(item) {
  95. uni.navigateTo({
  96. url: `../../subPages/goodsDetail/goodsDetail?code=${item.code}&type=${this.type}`
  97. });
  98. },
  99. },
  100. };
  101. </script>
  102. <style lang="scss" scoped>
  103. .title-box {
  104. padding: 30rpx 0;
  105. display: flex;
  106. justify-content: center;
  107. align-items: center;
  108. }
  109. .tabs-box {
  110. height: 90rpx;
  111. background-color: #fff;
  112. margin-bottom: 20rpx;
  113. ::v-deep {
  114. .u-dropdown__menu__item {
  115. justify-content: flex-start;
  116. }
  117. }
  118. }
  119. .sort-content {
  120. .sort-list {
  121. height: 82rpx;
  122. align-items: center;
  123. padding: 0 20rpx;
  124. border-top: 1rpx solid #e6e6e6;
  125. font-size: 28rpx;
  126. color: #595959;
  127. &-active {
  128. color: #7856ff;
  129. font-weight: bold;
  130. }
  131. }
  132. }
  133. .main-content {
  134. // height: calc(100vh - 420rpx);
  135. // overflow-y: auto;
  136. // padding: 0 20rpx;
  137. .activity-box {
  138. display: flex;
  139. flex-wrap: wrap;
  140. justify-content: space-between;
  141. .activity-list {
  142. width: calc(50% - 11rpx);
  143. background-color: #fff;
  144. border-radius: 20rpx;
  145. margin-bottom: 22rpx;
  146. padding-bottom: 30rpx;
  147. font-size: 24rpx;
  148. .list-title {
  149. font-size: 30rpx;
  150. padding: 0 16rpx 8rpx;
  151. }
  152. .list-content {
  153. color: #2c2c2c;
  154. padding: 10rpx 16rpx 0;
  155. // display: flex;
  156. }
  157. }
  158. }
  159. }
  160. </style>