newPeople.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="newPeople">
  3. <!-- <view class="header">
  4. <view class="inputSearch" @click="clickSearch">
  5. <image src="@/static/img/search.png"></image>
  6. 请输入关键词
  7. </view>
  8. </view> -->
  9. <!-- <data-list :data='data'></data-list> -->
  10. <view class="good-wrap">
  11. <view class="good" v-for="item in list"
  12. @click="navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status + '&is_new=' + is_new)">
  13. <image :src="item.image" mode="" class="goo-img"></image>
  14. <view class="good-tit clamp">
  15. {{item.title}}
  16. </view>
  17. <view class="good-price flex">
  18. <view class="new-price">
  19. ¥{{item.price}}
  20. </view>
  21. <view class="old-price">
  22. ¥{{item.ot_price}}
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. mapState,
  32. mapMutations
  33. } from 'vuex';
  34. import {
  35. loadIndexs
  36. } from '@/api/index.js';
  37. import {
  38. getUserInfo
  39. } from '@/api/user.js'
  40. import dataList from '@/components/datalist.vue'
  41. import {
  42. getNewList
  43. } from '@/api/whole.js'
  44. export default {
  45. data() {
  46. return {
  47. list: [],
  48. is_new: 1,
  49. // data: {
  50. // page: 1,
  51. // limit: 10,
  52. // sum: 0,
  53. // loadingType: 'loadmore',
  54. // data: []
  55. // }
  56. }
  57. },
  58. components: {
  59. dataList
  60. },
  61. onLoad() {
  62. this.getNewList()
  63. this.getUserInfo()
  64. },
  65. // mounted() {
  66. // this.init()
  67. // },
  68. methods: {
  69. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  70. getUserInfo() {
  71. getUserInfo().then(res => {
  72. console.log(res)
  73. this.setUserInfo(res.data);
  74. this.is_new = res.data.is_whole
  75. })
  76. },
  77. navto(url) {
  78. uni.navigateTo({
  79. url: url
  80. })
  81. },
  82. // 點擊搜索框
  83. clickSearch() {
  84. uni.navigateTo({
  85. url: '/pages/product/search'
  86. });
  87. },
  88. init() {
  89. this.getData()
  90. },
  91. getNewList() {
  92. getNewList().then(res => {
  93. console.log(res, 'getNewList')
  94. this.list = res.data
  95. })
  96. },
  97. getData() {
  98. loadIndexs().then(res => {
  99. this.data = res.data.info.bastList
  100. this.loadingType = 'nomore'
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. $grey: #95A0B1;
  108. $text: #333333;
  109. $red: #FF4C4C;
  110. .newPeople {
  111. .header {
  112. background-color: #fff;
  113. padding: 30rpx;
  114. .inputSearch {
  115. line-height: 35rpx;
  116. text-align: center;
  117. color: $grey;
  118. padding: 10rpx 20rpx;
  119. border-radius: 50rpx;
  120. background-color: $page-color-base;
  121. image {
  122. width: 32rpx;
  123. height: 32rpx;
  124. margin: 0 20rpx;
  125. margin-bottom: -3rpx;
  126. }
  127. }
  128. }
  129. .list {
  130. padding: 20rpx;
  131. display: flex;
  132. justify-content: space-between;
  133. flex-wrap: wrap;
  134. .item {
  135. background-color: #fff;
  136. border-radius: 10rpx;
  137. overflow: hidden;
  138. // box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
  139. margin: 10rpx 0;
  140. width: 48%;
  141. height: 0;
  142. padding-bottom: calc(48% + 120rpx);
  143. .img {
  144. border-radius: 10rpx;
  145. overflow: hidden;
  146. width: 100%;
  147. height: 0;
  148. padding-bottom: 100%;
  149. image {
  150. width: 100%;
  151. height: 100%;
  152. }
  153. }
  154. .name {
  155. margin: 0 10rpx;
  156. font-size: 30rpx;
  157. font-weight: bold;
  158. }
  159. .allprice {
  160. padding: 20rpx 0;
  161. .price {
  162. color: $red;
  163. }
  164. .ot-price {
  165. color: $grey;
  166. text-decoration: line-through;
  167. font-size: 26rpx;
  168. }
  169. }
  170. }
  171. }
  172. .load {
  173. text-align: center;
  174. color: $grey;
  175. font-size: 28rpx;
  176. }
  177. }
  178. .good-wrap {
  179. display: flex;
  180. // padding: 0 0 20rpx 20rpx;
  181. padding-left: 20rpx;
  182. padding-top: 20rpx;
  183. flex-wrap: wrap;
  184. }
  185. .good {
  186. width: 345rpx;
  187. height: 480rpx;
  188. margin-right: 20rpx;
  189. margin-bottom: 20rpx;
  190. background: #FFFFFF;
  191. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  192. border-radius: 10rpx;
  193. .goo-img {
  194. width: 345rpx;
  195. height: 345rpx;
  196. border-radius: 10rpx 10rpx 0 0;
  197. background-color: #bfa;
  198. }
  199. .good-tit {
  200. padding: 15rpx 20rpx;
  201. font-size: 30rpx;
  202. font-family: PingFang SC;
  203. font-weight: bold;
  204. color: #333333;
  205. // line-height: 35rpx;
  206. }
  207. .good-price {
  208. padding-left: 20rpx;
  209. justify-content: flex-start;
  210. .new-price {
  211. font-size: 36rpx;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: #FF4C4C;
  215. }
  216. .old-price {
  217. padding-left: 8rpx;
  218. font-size: 26rpx;
  219. font-family: PingFang SC;
  220. font-weight: bold;
  221. text-decoration: line-through;
  222. color: #999999;
  223. }
  224. }
  225. }
  226. </style>