CommercePartMs.vue 3.5 KB

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