CommercePart.vue 4.2 KB

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