CommercePart.vue 3.8 KB

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