newPeople.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="tobuy(item)">
  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. },
  64. onShow() {
  65. this.getUserInfo()
  66. },
  67. // mounted() {
  68. // this.init()
  69. // },
  70. methods: {
  71. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  72. tobuy(item) {
  73. if(this.is_new == 'isn') {
  74. this.navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status + '&is_new=' + this.is_new)
  75. }else {
  76. this.$api.msg('您已不是新人,无法预约新人专区商品')
  77. }
  78. },
  79. getUserInfo() {
  80. getUserInfo().then(res => {
  81. console.log(res)
  82. this.setUserInfo(res.data);
  83. this.is_new = res.data.is_whole == 0? 'isn': 'non'
  84. })
  85. },
  86. navto(url) {
  87. uni.navigateTo({
  88. url: url
  89. })
  90. },
  91. // 點擊搜索框
  92. clickSearch() {
  93. uni.navigateTo({
  94. url: '/pages/product/search'
  95. });
  96. },
  97. init() {
  98. this.getData()
  99. },
  100. getNewList() {
  101. getNewList().then(res => {
  102. console.log(res, 'getNewList')
  103. this.list = res.data
  104. })
  105. },
  106. getData() {
  107. loadIndexs().then(res => {
  108. this.data = res.data.info.bastList
  109. this.loadingType = 'nomore'
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. $grey: #95A0B1;
  117. $text: #333333;
  118. $red: #FF4C4C;
  119. .newPeople {
  120. .header {
  121. background-color: #fff;
  122. padding: 30rpx;
  123. .inputSearch {
  124. line-height: 35rpx;
  125. text-align: center;
  126. color: $grey;
  127. padding: 10rpx 20rpx;
  128. border-radius: 50rpx;
  129. background-color: $page-color-base;
  130. image {
  131. width: 32rpx;
  132. height: 32rpx;
  133. margin: 0 20rpx;
  134. margin-bottom: -3rpx;
  135. }
  136. }
  137. }
  138. .list {
  139. padding: 20rpx;
  140. display: flex;
  141. justify-content: space-between;
  142. flex-wrap: wrap;
  143. .item {
  144. background-color: #fff;
  145. border-radius: 10rpx;
  146. overflow: hidden;
  147. // box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
  148. margin: 10rpx 0;
  149. width: 48%;
  150. height: 0;
  151. padding-bottom: calc(48% + 120rpx);
  152. .img {
  153. border-radius: 10rpx;
  154. overflow: hidden;
  155. width: 100%;
  156. height: 0;
  157. padding-bottom: 100%;
  158. image {
  159. width: 100%;
  160. height: 100%;
  161. }
  162. }
  163. .name {
  164. margin: 0 10rpx;
  165. font-size: 30rpx;
  166. font-weight: bold;
  167. }
  168. .allprice {
  169. padding: 20rpx 0;
  170. .price {
  171. color: $red;
  172. }
  173. .ot-price {
  174. color: $grey;
  175. text-decoration: line-through;
  176. font-size: 26rpx;
  177. }
  178. }
  179. }
  180. }
  181. .load {
  182. text-align: center;
  183. color: $grey;
  184. font-size: 28rpx;
  185. }
  186. }
  187. .good-wrap {
  188. display: flex;
  189. // padding: 0 0 20rpx 20rpx;
  190. padding-left: 20rpx;
  191. padding-top: 20rpx;
  192. flex-wrap: wrap;
  193. }
  194. .good {
  195. width: 345rpx;
  196. height: 480rpx;
  197. margin-right: 20rpx;
  198. margin-bottom: 20rpx;
  199. background: #FFFFFF;
  200. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  201. border-radius: 10rpx;
  202. .goo-img {
  203. width: 345rpx;
  204. height: 345rpx;
  205. border-radius: 10rpx 10rpx 0 0;
  206. // background-color: #bfa;
  207. }
  208. .good-tit {
  209. padding: 15rpx 20rpx;
  210. font-size: 30rpx;
  211. font-family: PingFang SC;
  212. font-weight: bold;
  213. color: #333333;
  214. // line-height: 35rpx;
  215. }
  216. .good-price {
  217. padding-left: 20rpx;
  218. justify-content: flex-start;
  219. .new-price {
  220. font-size: 36rpx;
  221. font-family: PingFang SC;
  222. font-weight: bold;
  223. color: #FF4C4C;
  224. }
  225. .old-price {
  226. padding-left: 8rpx;
  227. font-size: 26rpx;
  228. font-family: PingFang SC;
  229. font-weight: bold;
  230. text-decoration: line-through;
  231. color: #999999;
  232. }
  233. }
  234. }
  235. </style>