CommercePartRow.vue 3.9 KB

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