mineFollow.vue 6.6 KB

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