mineFollow.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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(item)">
  78. {{ i18n.see }}
  79. </button>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 关注团长列表 -->
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. follow: 0,
  91. commodityList: [],
  92. teamList: [],
  93. };
  94. },
  95. computed: {
  96. i18n() {
  97. return this.$t("index");
  98. },
  99. },
  100. methods: {
  101. tabSwitch(num) {
  102. this.follow = num;
  103. this.getInfoList(num);
  104. },
  105. rightClick() {
  106. console.log(111);
  107. },
  108. toHomepage(item) {
  109. uni.navigateTo({
  110. url: `/pageD/homepage/homepage?merchant_id=${item.merchant.id}`,
  111. });
  112. },
  113. toDetail(item) {
  114. uni.navigateTo({
  115. url: `/pageA/productdetails?id=${item.merchant_goods.id}`,
  116. });
  117. },
  118. getInfoList(num) {
  119. uni.$u.http.get(`api/interest/list?interest_type=${num}`).then((res) => {
  120. if (num) {
  121. this.teamList = res.data;
  122. } else {
  123. this.commodityList = res.data;
  124. }
  125. });
  126. },
  127. },
  128. mounted() {
  129. this.getInfoList(0);
  130. },
  131. };
  132. </script>
  133. <style scoped lang="scss">
  134. .page {
  135. background-color: #fff;
  136. height: 100vh;
  137. position: relative;
  138. .tab {
  139. display: flex;
  140. justify-content: space-between;
  141. width: 240rpx;
  142. // margin: 0 auto;
  143. font-size: 36rpx;
  144. // margin-right: 60rpx;
  145. .commodity {
  146. position: relative;
  147. font-weight: 600;
  148. }
  149. .commodity::before {
  150. content: "";
  151. display: block;
  152. height: 8rpx;
  153. width: 100%;
  154. background: linear-gradient(to right, #f83224, #fff);
  155. position: absolute;
  156. bottom: 5rpx;
  157. opacity: 0.8;
  158. }
  159. }
  160. .content {
  161. position: absolute;
  162. top: 190rpx;
  163. .team-content {
  164. display: flex;
  165. height: 168rpx;
  166. align-items: center;
  167. width: 702rpx;
  168. border-top: 2rpx solid rgba(151, 151, 151, 0.2);
  169. margin-left: 24rpx;
  170. .team-right {
  171. display: flex;
  172. justify-content: space-between;
  173. width: 96%;
  174. align-items: center;
  175. .name {
  176. font-size: 30rpx;
  177. font-weight: 600;
  178. margin-bottom: 14rpx;
  179. }
  180. .score {
  181. width: 210rpx;
  182. height: 28rpx;
  183. background-color: rgba(255, 27, 0, 0.1);
  184. display: flex;
  185. border-radius: 12rpx;
  186. justify-content: space-around;
  187. .num {
  188. font-size: 22rpx;
  189. color: #ff1515;
  190. font-weight: 600;
  191. }
  192. ::v-deep .u-icon__icon {
  193. color: #f83224 !important;
  194. }
  195. }
  196. .check {
  197. width: 164rpx;
  198. height: 60rpx;
  199. border: 2rpx solid #f83224;
  200. color: #f83224;
  201. background-color: #fff;
  202. border-radius: 38rpx;
  203. font-size: 26rpx;
  204. margin: 0;
  205. padding: 0;
  206. text-align: center;
  207. line-height: 60rpx;
  208. }
  209. }
  210. }
  211. .header-img {
  212. width: 96rpx;
  213. height: 96rpx;
  214. border-radius: 50%;
  215. margin-right: 20rpx;
  216. }
  217. .commodity-detail {
  218. display: flex;
  219. padding: 0 24rpx;
  220. margin: 16rpx auto;
  221. .commodity-img {
  222. width: 204rpx;
  223. height: 204rpx;
  224. border-radius: 16rpx;
  225. margin-right: 20rpx;
  226. }
  227. .commodity-right {
  228. width: 466rpx;
  229. }
  230. .commodity-title {
  231. color: #222;
  232. font-size: 28rpx;
  233. font-weight: 600;
  234. margin-bottom: 12rpx;
  235. // min-height: 78rpx;
  236. overflow: hidden;
  237. text-overflow: ellipsis;
  238. display: -webkit-box;
  239. -webkit-line-clamp: 2;
  240. -webkit-box-orient: vertical;
  241. }
  242. .commodity-follow {
  243. color: #777;
  244. font-size: 28rpx;
  245. margin-bottom: 14rpx;
  246. }
  247. .commodity-price {
  248. color: #f83224;
  249. font-weight: 600;
  250. margin-top: 20rpx;
  251. }
  252. .symbol,
  253. .decimal {
  254. font-size: 28rpx;
  255. }
  256. .integer {
  257. font-size: 36rpx;
  258. }
  259. }
  260. }
  261. }
  262. </style>