index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view>
  3. <!-- #ifdef H5 -->
  4. <view class="bg-top h-644" :style="{'background-image' : headerBg}">
  5. <!-- #endif -->
  6. <!-- #ifndef H5 -->
  7. <view class="bg-top" :style="{'height': 282 + sysHeight + 'px', 'background-image' : headerBg}">
  8. <!-- #endif -->
  9. <view class="w-full bg-opacity" :style="{'padding-top': sysHeight + 'px'}">
  10. <view class="w-full px-20 pl-20 h-80 flex-between-center">
  11. <text class="iconfont icon-ic_leftarrow fs-40" @tap="goPage('',3)"></text>
  12. <text class="fs-34 fw-500">新人礼</text>
  13. <text></text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="px-20">
  18. <view class="bg--w111-fff rd-24rpx pt-32 pr-24 pb-32 pl-24 relative top200"
  19. v-if="info.register_give_coupon ? info.register_give_coupon.length : false">
  20. <view class="flex-center">
  21. <image src="../static/new_person_star.png" class="star"></image>
  22. <text class="fs-32 lh-44rpx fw-500 px-16">新人优惠券</text>
  23. <image src="../static/new_person_star.png" class="star star-right"></image>
  24. </view>
  25. <view class="grid-column-3 grid-gap-38rpx mt-36">
  26. <view class="coupon-item flex-col flex-between-center"
  27. v-for="(item,index) in showMore ? info.register_give_coupon : info.register_give_coupon.slice(0,6)" :key="index">
  28. <view class="flex-col flex-center">
  29. <baseMoney :money="item.coupon_price" symbolSize="28" integerSize="44"
  30. decimalSize="28" color="#e93323" weight v-if="item.coupon_type==1"></baseMoney>
  31. <view v-else class="font-red fs-32 flex-y-center"><text class="SemiBold fs-44">{{parseFloat(item.coupon_price)/10}}</text>折</view>
  32. <text class="fs-20 lh-28rpx font-red pt-6">{{item.applicable_type | typeFilter}}</text>
  33. </view>
  34. <view class="fs-24 lh-34rpx text--w111-fff" v-if="item.use_min_price > 0">满{{item.use_min_price}}可用</view>
  35. <view class="fs-24 lh-34rpx text--w111-fff" v-else>无门槛</view>
  36. </view>
  37. </view>
  38. <view class="w-full mt-24 flex-center fs-24 text--w111-999"
  39. v-if="info.register_give_coupon.length > 6" @tap="showMoreChange">
  40. <text>{{showMore ? '点击收起' : '点击展开'}}</text>
  41. <text class="iconfont fs-24" :class="showMore ? 'icon-ic_uparrow' : 'icon-ic_downarrow'"></text>
  42. </view>
  43. <view class="w-full h-88 rd-44rpx flex-center bg-jianbian text--w111-fff fs-28 mt-32"
  44. @tap="goPage('/pages/users/user_coupon/index',1)">查看优惠券</view>
  45. </view>
  46. <view class="bg--w111-fff rd-24rpx pt-32 pr-24 pl-24 relative top200 mt-20">
  47. <view class="flex-center">
  48. <image src="../static/new_person_star.png" class="star"></image>
  49. <text class="fs-32 lh-44rpx fw-500 px-16">新人福利</text>
  50. <image src="../static/new_person_star.png" class="star star-right"></image>
  51. </view>
  52. <view class="mt-10">
  53. <view class="cell flex-between-center py-32" v-if="info.register_give_integral > 0">
  54. <view class="flex-y-center">
  55. <image :src="imgHost + '/statics/images/newcomer/integral_icon.png'" class="w-72 h-72"></image>
  56. <view class="flex-col ml-24">
  57. <text class="fs-28 fw-500 lh-40rpx">新人赠送积分</text>
  58. <text class="fs-22 text--w111-999 lh-30rpx pt-6">新人即可获得{{info.register_give_integral}}积分</text>
  59. </view>
  60. </view>
  61. <view class="w-120 h-56 rd-28rpx flex-center bg-jianbian text--w111-fff fs-24"
  62. @tap="goPage('/pages/users/user_integral/index',1)">去查看</view>
  63. </view>
  64. <view class="cell flex-between-center py-32" v-if="info.register_give_money > 0">
  65. <view class="flex-y-center">
  66. <image :src="imgHost + '/statics/images/newcomer/money_icon.png'" class="w-72 h-72"></image>
  67. <view class="flex-col ml-24">
  68. <text class="fs-28 fw-500 lh-40rpx">新人赠送余额</text>
  69. <text class="fs-22 text--w111-999 lh-30rpx pt-6">新人即可获得{{info.register_give_money}}余额</text>
  70. </view>
  71. </view>
  72. <view class="w-120 h-56 rd-28rpx flex-center bg-jianbian text--w111-fff fs-24"
  73. @tap="goPage('/pages/users/user_money/index',1)">去查看</view>
  74. </view>
  75. <view class="cell flex-between-center py-32" v-if="info.first_order_status">
  76. <view class="flex-y-center">
  77. <image :src="imgHost + '/statics/images/newcomer/coupon_icon.png'" class="w-72 h-72"></image>
  78. <view class="flex-col ml-24">
  79. <text class="fs-28 fw-500 lh-40rpx">新人下单享首单优惠</text>
  80. <text class="fs-22 text--w111-999 lh-30rpx pt-6">首次下单享{{parseFloat(info.first_order_discount)/10 || 10}}折优惠哦~</text>
  81. </view>
  82. </view>
  83. <view class="w-120 h-56 rd-28rpx flex-center bg-jianbian text--w111-fff fs-24"
  84. @tap="goPage('/pages/goods/goods_list/index',1)">去查看</view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="bg--w111-fff rd-24rpx pt-32 pr-24 pb-32 pl-24 relative top200 mt-20"
  89. v-if="newList.length">
  90. <view class="flex-center">
  91. <image src="../static/new_person_star.png" class="star"></image>
  92. <text class="fs-32 lh-44rpx fw-500 px-16">新人商品专区</text>
  93. <image src="../static/new_person_star.png" class="star star-right"></image>
  94. </view>
  95. <view class="grid-column-3 grid-gap-20rpx mt-36">
  96. <view class="" v-for="(item,index) in newList" :key="index"
  97. @click="goPage(`/pages/activity/goods_details/index?id=${item.id}&type=7`,1)">
  98. <image class="w-full h-210 rd-16rpx" :src="item.image" mode="aspectFill"></image>
  99. <view class="w-full line2 fs-28 lh-40rpx fw-500 mt-24 mb-14">{{item.store_name}}</view>
  100. <baseMoney :money="item.price" symbolSize="24" integerSize="40"
  101. decimalSize="24" color="#e93323" weight></baseMoney>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  110. import countDown from '@/components/countDown';
  111. import {
  112. newcomerInfo,
  113. newcomerList
  114. } from '@/api/activity.js';
  115. import {HTTP_REQUEST_URL} from '@/config/app';
  116. export default {
  117. components: {
  118. countDown,
  119. },
  120. data() {
  121. return {
  122. sysHeight:sysHeight,
  123. imgHost:HTTP_REQUEST_URL,
  124. info: {
  125. // register_give_coupon:[
  126. // {coupon_price: 20,type:1,coupon_type:1},
  127. // {coupon_price: 20,type:1,coupon_type:1},
  128. // {coupon_price: 20,type:1,coupon_type:1},
  129. // ]
  130. },
  131. newList:[],
  132. loading: false,
  133. loadend: false,
  134. loadTitle: '加载更多',
  135. page: 1,
  136. limit: 9,
  137. showMore: false
  138. };
  139. },
  140. filters:{
  141. typeFilter(val){
  142. let obj = {
  143. 0: '通用券',
  144. 1: '品类券',
  145. 2: '商品券',
  146. 3: '品牌券',
  147. };
  148. return obj[val]
  149. }
  150. },
  151. computed:{
  152. headerBg(){
  153. return 'url('+this.imgHost+'/statics/images/newcomer/header.png'+')'
  154. }
  155. },
  156. onLoad() {
  157. this.getNewcomerInfo();
  158. this.productList();
  159. },
  160. methods: {
  161. getNewcomerInfo() {
  162. newcomerInfo().then(res => {
  163. res.data.last_time = parseInt(res.data.last_time);
  164. this.info = res.data;
  165. }).catch(err => {
  166. this.$util.Tips({
  167. title: err
  168. });
  169. })
  170. },
  171. productList() {
  172. let that = this;
  173. if (that.loading) return;
  174. if (that.loadend) return;
  175. that.loading = true;
  176. that.loadTitle = '';
  177. newcomerList({
  178. page: that.page,
  179. limit: that.limit
  180. }).then(res=>{
  181. let list = res.data;
  182. let loadend = list.length < that.limit;
  183. that.newList = that.$util.SplitArray(list, that.newList);
  184. that.$set(that, 'newList', that.newList);
  185. that.loadend = loadend;
  186. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  187. that.page = that.page + 1;
  188. that.loading = false;
  189. }).catch(err=>{
  190. that.loading = false;
  191. that.loadTitle = '加载更多';
  192. this.$util.Tips({
  193. title: err
  194. });
  195. })
  196. },
  197. goPage(url, type){
  198. if(type == 1){
  199. uni.navigateTo({
  200. url
  201. })
  202. }else if(type == 3){
  203. uni.navigateBack()
  204. }
  205. },
  206. showMoreChange(){
  207. this.showMore = !this.showMore;
  208. }
  209. },
  210. onReachBottom() {
  211. this.productList();
  212. }
  213. }
  214. </script>
  215. <style lang="scss">
  216. .SemiBold {
  217. font-family: 'SemiBold';
  218. }
  219. .bg-top{
  220. background-size: cover;
  221. }
  222. .bg-opacity{
  223. background: transparent;
  224. }
  225. .top200{
  226. top: -200rpx;
  227. }
  228. .star{
  229. width: 54rpx;
  230. height: 24rpx;
  231. }
  232. .star-right{
  233. display: block;
  234. transform: scaleX(-1);
  235. }
  236. .coupon-item{
  237. height: 186rpx;
  238. padding: 20rpx 0 18rpx;
  239. background-image: url('../static/coupon_item_bg.png');
  240. background-size: cover;
  241. }
  242. .font-red{
  243. color: #E93323;
  244. }
  245. .bg-jianbian{
  246. background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
  247. }
  248. .cell ~ .cell{
  249. border-top: 1px solid #eee;
  250. }
  251. </style>