newVip.vue 4.9 KB

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