mineFollow.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="page">
  3. <u-navbar @leftClick="rightClick" :autoBack="true">
  4. <view class="tab" slot="center">
  5. <view
  6. class=""
  7. :class="{ commodity: follow == 0 }"
  8. @click="tabSwitch(0)"
  9. >
  10. {{ i18n.mineCommodity }}
  11. </view>
  12. <view :class="{ commodity: follow == 1 }" @click="tabSwitch(1)">
  13. {{ i18n.team }}
  14. </view>
  15. </view>
  16. </u-navbar>
  17. <!-- 关注商品列表 -->
  18. <view class="content" v-if="follow == 0">
  19. <view
  20. class="commodity-detail"
  21. v-for="item in commodityList"
  22. @click="toDetail(item)"
  23. >
  24. <image
  25. :src="item.merchant_goods.goods.image"
  26. class="commodity-img"
  27. mode=""
  28. ></image>
  29. <view class="commodity-right">
  30. <view class="commodity-title">
  31. {{ item.merchant_goods.goods.name_cn }}
  32. </view>
  33. <view class="commodity-follow">
  34. <text v-show="item.interest_num <= 1000"
  35. >{{ item.interest_num }}
  36. </text>
  37. <text v-show="item.interest_num > 1000">1000+</text
  38. >{{ i18n.people }}
  39. </view>
  40. <view class="commodity-price">
  41. <text class="symbol"></text>
  42. <text class="integer">{{
  43. item.merchant_goods.goods.price.split(".")[0]
  44. }}</text
  45. >.
  46. <text class="decimal">{{
  47. item.merchant_goods.goods.price.split(".")[1]
  48. }}</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 关注商品列表 -->
  54. <!-- 关注团长列表 -->
  55. <view class="content" v-if="follow == 1">
  56. <view class="team-content" v-for="item in teamList">
  57. <image :src="item.merchant.image" class="header-img" mode=""></image>
  58. <view class="team-right">
  59. <view class="">
  60. <view class="name">
  61. {{ item.merchant.merchant_name }}
  62. </view>
  63. <view class="score">
  64. <u-rate
  65. count="5"
  66. disabled
  67. :allowHalf="true"
  68. :gutter="1"
  69. inactiveColor="#ffacab"
  70. activeColor="#FF1515"
  71. v-model="item.merchant.score"
  72. :size="14"
  73. ></u-rate>
  74. <text class="num">{{ item.merchant.score }}</text>
  75. </view>
  76. </view>
  77. <button class="check" @click="toHomepage">{{ i18n.see }}</button>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 关注团长列表 -->
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. follow: 0,
  89. commodityList: [],
  90. teamList: [],
  91. };
  92. },
  93. computed: {
  94. i18n() {
  95. return this.$t("index");
  96. },
  97. },
  98. methods: {
  99. tabSwitch(num) {
  100. this.follow = num;
  101. this.getInfoList(num);
  102. },
  103. rightClick() {
  104. console.log(111);
  105. },
  106. toHomepage() {
  107. uni.navigateTo({
  108. url: "/pageD/homepage/homepage",
  109. });
  110. },
  111. toDetail(item) {
  112. uni.navigateTo({
  113. url: `/pageA/productdetails?id=${item.merchant_goods.id}`,
  114. });
  115. },
  116. getInfoList(num) {
  117. uni.$u.http.get(`api/interest/list?interest_type=${num}`).then((res) => {
  118. if (num) {
  119. this.teamList = res.data;
  120. } else {
  121. this.commodityList = res.data;
  122. }
  123. });
  124. },
  125. },
  126. mounted() {
  127. this.getInfoList(0);
  128. },
  129. };
  130. </script>
  131. <style scoped lang="scss">
  132. .page {
  133. background-color: #fff;
  134. height: 100vh;
  135. position: relative;
  136. .tab {
  137. display: flex;
  138. justify-content: space-between;
  139. width: 240rpx;
  140. // margin: 0 auto;
  141. font-size: 36rpx;
  142. // margin-right: 60rpx;
  143. .commodity {
  144. position: relative;
  145. font-weight: 600;
  146. }
  147. .commodity::before {
  148. content: "";
  149. display: block;
  150. height: 8rpx;
  151. width: 100%;
  152. background: linear-gradient(to right, #f83224, #fff);
  153. position: absolute;
  154. bottom: 5rpx;
  155. opacity: 0.8;
  156. }
  157. }
  158. .content {
  159. position: absolute;
  160. top: 190rpx;
  161. .team-content {
  162. display: flex;
  163. height: 168rpx;
  164. align-items: center;
  165. width: 702rpx;
  166. border-top: 2rpx solid rgba(151, 151, 151, 0.2);
  167. margin-left: 24rpx;
  168. .team-right {
  169. display: flex;
  170. justify-content: space-between;
  171. width: 96%;
  172. align-items: center;
  173. .name {
  174. font-size: 30rpx;
  175. font-weight: 600;
  176. margin-bottom: 14rpx;
  177. }
  178. .score {
  179. width: 210rpx;
  180. height: 28rpx;
  181. background-color: rgba(255, 27, 0, 0.1);
  182. display: flex;
  183. border-radius: 12rpx;
  184. justify-content: space-around;
  185. .num {
  186. font-size: 22rpx;
  187. color: #ff1515;
  188. font-weight: 600;
  189. }
  190. ::v-deep .u-icon__icon {
  191. color: #f83224 !important;
  192. }
  193. }
  194. .check {
  195. width: 164rpx;
  196. height: 60rpx;
  197. border: 2rpx solid #f83224;
  198. color: #f83224;
  199. background-color: #fff;
  200. border-radius: 38rpx;
  201. font-size: 26rpx;
  202. margin: 0;
  203. padding: 0;
  204. text-align: center;
  205. line-height: 60rpx;
  206. }
  207. }
  208. }
  209. .header-img {
  210. width: 96rpx;
  211. height: 96rpx;
  212. border-radius: 50%;
  213. margin-right: 20rpx;
  214. }
  215. .commodity-detail {
  216. display: flex;
  217. padding: 0 24rpx;
  218. margin: 16rpx auto;
  219. .commodity-img {
  220. width: 204rpx;
  221. height: 204rpx;
  222. border-radius: 16rpx;
  223. margin-right: 20rpx;
  224. }
  225. .commodity-right {
  226. width: 466rpx;
  227. }
  228. .commodity-title {
  229. color: #222;
  230. font-size: 28rpx;
  231. font-weight: 600;
  232. margin-bottom: 12rpx;
  233. // min-height: 78rpx;
  234. overflow: hidden;
  235. text-overflow: ellipsis;
  236. display: -webkit-box;
  237. -webkit-line-clamp: 2;
  238. -webkit-box-orient: vertical;
  239. }
  240. .commodity-follow {
  241. color: #777;
  242. font-size: 28rpx;
  243. margin-bottom: 14rpx;
  244. }
  245. .commodity-price {
  246. color: #f83224;
  247. font-weight: 600;
  248. margin-top: 20rpx;
  249. }
  250. .symbol,
  251. .decimal {
  252. font-size: 28rpx;
  253. }
  254. .integer {
  255. font-size: 36rpx;
  256. }
  257. }
  258. }
  259. }
  260. </style>