mineFollow.vue 6.8 KB

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