newVip.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="newVip" :class="{pageOn:itemStyle===0}" :style="{marginLeft:prConfig+'px',marginRight:prConfig+'px',marginTop:mbCongfig+'px',background: `linear-gradient(90deg,${bgColor[0].item} 0%,${bgColor[1].item} 100%)`}" v-show="!isSortType" v-if="list.length">
  3. <view class="header acea-row row-between-wrapper" :style="{color:textColor}">
  4. <view class="title" >新人专享</view>
  5. <view class="more" @click="goNewList">更多<text class="iconfont icon-xiangyou"></text></view>
  6. </view>
  7. <view class="list">
  8. <scroll-view scroll-x="true" class="scroll" show-scrollbar="false">
  9. <view class="item" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
  10. <view class="pictrue">
  11. <image :src="item.image"></image>
  12. <view class="label" :style="{color:textColor,background: `linear-gradient(90deg,${bgColor[0].item} 0%,${bgColor[1].item} 100%)`}" v-if="checkType.indexOf(0) != -1">新人价</view>
  13. </view>
  14. <view class="money" :style="{color:priceColor}">¥{{item.price}}</view>
  15. <view class="y_money" v-if="checkType.indexOf(1) != -1">¥{{item.ot_price}}</view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. newcomerList
  24. } from '@/api/api.js';
  25. import {
  26. toLogin
  27. } from '@/libs/login.js';
  28. import {
  29. mapGetters
  30. } from 'vuex';
  31. export default {
  32. computed: mapGetters(['isLogin']),
  33. name: 'userInfor',
  34. props: {
  35. dataConfig: {
  36. type: Object,
  37. default: () => {}
  38. },
  39. isSortType: {
  40. type: String | Number,
  41. default: 0
  42. }
  43. },
  44. data() {
  45. return {
  46. bgColor: this.dataConfig.bgColor.color,
  47. mbCongfig: this.dataConfig.mbCongfig.val*2,
  48. prConfig: this.dataConfig.prConfig.val*2, //背景边距
  49. itemStyle: this.dataConfig.itemStyle.type,
  50. checkType: this.dataConfig.checkboxInfo.type,
  51. textColor: this.dataConfig.textColor.color[0].item,
  52. priceColor: this.dataConfig.priceColor.color[0].item,
  53. numConfig: this.dataConfig.numConfig.val,
  54. list: []
  55. }
  56. },
  57. created() {
  58. this.getList();
  59. },
  60. mounted() {
  61. },
  62. methods: {
  63. goDetail(item){
  64. uni.navigateTo({
  65. url: `/pages/goods_details/index?id=${item.id}&fromPage='newVip'`
  66. });
  67. },
  68. goNewList(){
  69. uni.navigateTo({
  70. url: `/pages/store/newcomers/index`
  71. });
  72. },
  73. getList(){
  74. let limit = this.$config.LIMIT;
  75. let type = this.dataConfig.itemSort.type;
  76. newcomerList({
  77. page: 1,
  78. limit: this.numConfig >= limit ? limit : this.numConfig,
  79. priceOrder: type == 2 ? 'desc' : '',
  80. salesOrder: type == 1 ? 'desc' : ''
  81. }).then(res=>{
  82. this.list = res.data;
  83. }).catch(err=>{
  84. return this.$util.Tips({
  85. title: err.msg
  86. });
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .pageOn{
  94. border-radius: 16rpx;
  95. }
  96. .newVip{
  97. padding: 0 30rpx 22rpx 30rpx;
  98. .scroll {
  99. white-space: nowrap;
  100. display: flex;
  101. }
  102. .header{
  103. height: 78rpx;
  104. .title{
  105. font-size: 30rpx;
  106. }
  107. .more{
  108. font-size: 24rpx;
  109. .iconfont{
  110. font-size: 24rpx;
  111. margin-left: 4rpx;
  112. }
  113. }
  114. }
  115. .list{
  116. flex-wrap: nowrap;
  117. overflow: hidden;
  118. .item{
  119. display: inline-block;
  120. width: 172rpx;
  121. background: #FFFFFF;
  122. border-radius: 12rpx;
  123. padding: 12rpx 12rpx 6rpx 12rpx;
  124. margin-right: 12rpx;
  125. .pictrue{
  126. width: 148rpx;
  127. height: 148rpx;
  128. position: relative;
  129. image{
  130. width: 100%;
  131. height: 100%;
  132. }
  133. .label{
  134. width: 98rpx;
  135. height: 32rpx;
  136. background: #E93323;
  137. border-radius: 16rpx;
  138. position: absolute;
  139. bottom: 12rpx;
  140. left:50%;
  141. margin-left: -49rpx;
  142. font-size: 24rpx;
  143. color: #fff;
  144. text-align: center;
  145. line-height: 32rpx;
  146. }
  147. }
  148. .money{
  149. font-weight: 500;
  150. color: #E93323;
  151. font-size: 24rpx;
  152. margin-top: 6rpx;
  153. }
  154. .y_money{
  155. font-weight: 400;
  156. color: #CCCCCC;
  157. font-size: 20rpx;
  158. text-decoration: line-through;
  159. }
  160. }
  161. }
  162. }
  163. </style>