index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <view :style="colorStyle" class="pages">
  3. <view class="header">
  4. <view class="rule" @click="goRule(info)">规则</view>
  5. <image src="../static/newcomers.png" mode="" class="img"></image>
  6. <countDown :is-day="true" :tip-text="'剩余时间:'" :day-text="'天'" :hour-text="'时'" :minute-text="'分'"
  7. :second-text="''" :isSecond="false" :datatime="info.last_time" v-if="info.last_time"></countDown>
  8. <view class="list" :class="info.last_time?'':'marginList'">
  9. <view class="list-item">
  10. <image src="../static/order1.png" mode="" class="icon"></image>
  11. <text class="text">赠送积分</text>
  12. <text class="text">{{info.register_give_integral || 0}}</text>
  13. </view>
  14. <view class="list-item">
  15. <image src="../static/order2.png" mode="" class="icon"></image>
  16. <text class="text">赠送余额</text>
  17. <text class="text">{{info.register_give_money || 0}}</text>
  18. </view>
  19. <view class="list-item">
  20. <image src="../static/order3.png" mode="" class="icon"></image>
  21. <text class="text">优惠券</text>
  22. <text class="text">{{info.coupon_count || 0}}</text>
  23. </view>
  24. <view class="list-item">
  25. <image src="../static/order4.png" mode="" class="icon"></image>
  26. <text class="text">首单优惠</text>
  27. <text class="text">{{parseFloat(info.first_oder_discount)/10 || 10}}折</text>
  28. </view>
  29. <view class="list-item">
  30. <image src="../static/order5.png" mode="" class="icon"></image>
  31. <text class="text">新人商品</text>
  32. <text class="text">{{info.product_count || 0}}件</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="content" :class="info.last_time?'':'marginCon'">
  37. <!-- 新人红包 -->
  38. <view class="red-envelopes" v-if="info.register_give_coupon?info.register_give_coupon.length:false">
  39. <view class="title">
  40. <text class="red-text">新人红包</text>
  41. <text class="text">新人专享红包,优惠不容错过</text>
  42. </view>
  43. <scroll-view scroll-x="true" class="scroll" show-scrollbar="false">
  44. <!-- 优惠券列表 -->
  45. <view class="scroll-item" :class="item._type==0?'on':''" v-for="(item,index) in info.register_give_coupon" :key="index">
  46. <image src="../static/box-use.png" v-if="item._type==0" mode="" class="img" />
  47. <image src="../static/box.png" v-else mode="" class="img" />
  48. <view class="condition">
  49. <view class='money font-color'>
  50. <text v-if="item.coupon_type==1">¥</text>
  51. <text class='num'
  52. v-if="item.coupon_type==1">{{item.coupon_price.toString().split(".")[0]}}</text>
  53. <text class="nums"
  54. v-if="item.coupon_price.toString().split('.').length>1 && item.coupon_type==1">.{{item.coupon_price.toString().split(".")[1]}}</text>
  55. <text class='num' v-if="item.coupon_type==2">{{parseFloat(item.coupon_price)/10}}</text>
  56. <text v-if="item.coupon_type==2">折</text>
  57. </view>
  58. <view class="num2" v-if="item.use_min_price > 0">满{{item.use_min_price}}可用</view>
  59. <view class="num2" v-else>无门槛券</view>
  60. </view>
  61. <view class="use" v-if="item._type==0">
  62. {{item._msg}}
  63. </view>
  64. <view class="use" v-else @click="goGoodList">
  65. {{item._msg}}
  66. <text class="iconfont icon-xiangyou"></text>
  67. </view>
  68. </view>
  69. </scroll-view>
  70. </view>
  71. <!-- 首单优惠 -->
  72. <view class="first-order">
  73. <view class="title">
  74. <text class="red-text">首单优惠</text>
  75. <text class="text">优惠仅此一次,建议尽快使用</text>
  76. </view>
  77. <view class="order acea-row row-middle">
  78. <view class="pictrue acea-row row-center-wrapper">
  79. <text class="iconfont icon-shoudanyouhui"></text>
  80. </view>
  81. <view class="order-content">
  82. <view class="order-text">新人首单{{parseFloat(info.first_oder_discount)/10 || 10}}折</view>
  83. <view class="text">新人首次下单立享{{parseFloat(info.first_oder_discount)/10 || 10}}折优惠哦~</view>
  84. </view>
  85. <view class="btn" @click="goGoodList">
  86. 去逛逛
  87. </view>
  88. </view>
  89. </view>
  90. <!-- 新人专享价 -->
  91. <view class="exclusive" v-if="newList.length">
  92. <view class="title">
  93. <text class="red-text">新人专享价</text>
  94. <text class="text">新人专享特价商品,仅限购买一个</text>
  95. </view>
  96. <view class="box acea-row row-middle">
  97. <view class="list" v-for="(item,index) in newList" :key="index" @click="goDetail(item)">
  98. <view class="img">
  99. <lazyLoad :src="item.image" width="100%" height="100%"></lazyLoad>
  100. </view>
  101. <view class="name line1">
  102. {{item.store_name}}
  103. </view>
  104. <view class="price">¥{{item.price}}</view>
  105. <view class="y_price">¥{{item.ot_price}}</view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class='loadingicon acea-row row-center-wrapper' v-if="newList.length">
  110. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import lazyLoad from '@/components/muqian-lazyLoad/muqian-lazyLoad.vue'
  117. import countDown from '@/components/countDown';
  118. import colors from "@/mixins/color";
  119. import {
  120. newcomerInfo,
  121. newcomerList
  122. } from '@/api/new_store.js';
  123. export default {
  124. mixins: [colors],
  125. components: {
  126. countDown,
  127. lazyLoad
  128. },
  129. data() {
  130. return {
  131. info: {},
  132. newList:[],
  133. loading: false,
  134. loadend: false,
  135. loadTitle: '加载更多',
  136. page: 1,
  137. limit: 9,
  138. };
  139. },
  140. onLoad() {
  141. this.getNewcomerInfo();
  142. this.productList();
  143. },
  144. onReady() {
  145. },
  146. onShow() {
  147. },
  148. methods: {
  149. goDetail(item){
  150. uni.navigateTo({
  151. url: `/pages/goods_details/index?id=${item.id}&fromPage='newVip'`
  152. });
  153. },
  154. goRule(e){
  155. let that = this;
  156. uni.setStorageSync('infos', this.info.newcomer_agreement);
  157. uni.navigateTo({
  158. url: `/pages/store/ruleInfo/index`
  159. });
  160. },
  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. goGoodList(){
  198. uni.navigateTo({
  199. url: `/pages/goods/goods_list/index`
  200. });
  201. }
  202. },
  203. onReachBottom() {
  204. this.productList();
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. .marginCon{
  210. top: 410rpx !important;
  211. }
  212. .marginList{
  213. top: 170rpx !important;
  214. }
  215. .box {
  216. width: 640rpx;
  217. margin: 16rpx auto 0 auto;
  218. .list {
  219. margin-right: 10rpx;
  220. margin-top: 20rpx;
  221. &:nth-of-type(3n){
  222. margin-right: 0;
  223. }
  224. .img {
  225. width: 206rpx;
  226. height: 206rpx;
  227. border-radius: 11rpx 11rpx 0 0;
  228. }
  229. .name {
  230. margin-top: 6rpx;
  231. width: 178rpx;
  232. font-size: 20rpx;
  233. font-weight: 400;
  234. color: #333333;
  235. overflow: hidden;
  236. white-space: nowrap;
  237. text-overflow: ellipsis;
  238. -o-text-overflow: ellipsis;
  239. }
  240. .price {
  241. margin-top: 8rpx;
  242. font-size: 28rpx;
  243. font-weight: 500;
  244. color: var(--view-theme);
  245. }
  246. .y_price{
  247. font-weight: 400;
  248. color: #CCCCCC;
  249. font-size: 18rpx;
  250. text-decoration: line-through;
  251. }
  252. }
  253. }
  254. /deep/.time {
  255. .red {
  256. color: #fff;
  257. }
  258. .styleAll {
  259. width: 36rpx;
  260. height: 36rpx;
  261. text-align: center;
  262. line-height: 36rpx;
  263. background-color: #fff;
  264. border-radius: 4rpx;
  265. color: var(--view-theme);
  266. }
  267. .timeTxt {
  268. margin: 0 12rpx;
  269. }
  270. }
  271. .header {
  272. width: 100%;
  273. height: 580rpx;
  274. background-color: var(--view-theme);
  275. border-radius: 0rpx 0rpx 100rpx 100rpx;
  276. position: relative;
  277. .rule{
  278. position: absolute;
  279. background-color: rgba(0,0,0,0.15);
  280. width: 74rpx;
  281. height: 34rpx;
  282. top:20rpx;
  283. right: 0;
  284. color: #fff;
  285. font-size: 20rpx;
  286. border-radius: 17rpx 0 0 17rpx;
  287. text-align: center;
  288. line-height: 34rpx;
  289. z-index: 9;
  290. }
  291. .img {
  292. width: 100%;
  293. height: 580rpx;
  294. }
  295. .time {
  296. position: absolute;
  297. top: 150rpx;
  298. left: 188rpx;
  299. font-size: 26rpx;
  300. font-weight: 400;
  301. color: #FFFFFF;
  302. display: flex;
  303. .time-box {
  304. width: 36rpx;
  305. height: 36rpx;
  306. background: #FFFFFF;
  307. border-radius: 4rpx;
  308. color: var(--view-theme);
  309. text-align: center;
  310. line-height: 36rpx;
  311. margin: 0 12rpx;
  312. }
  313. }
  314. .list {
  315. position: absolute;
  316. top: 230rpx;
  317. left: 24rpx;
  318. width: 702rpx;
  319. height: 220rpx;
  320. background: #FFFFFF;
  321. border-radius: 12rpx;
  322. display: flex;
  323. justify-content: space-between;
  324. padding: 34rpx 38rpx;
  325. .list-item {
  326. display: flex;
  327. flex-direction: column;
  328. align-items: center;
  329. .icon {
  330. width: 86rpx;
  331. height: 86rpx;
  332. background: #FDE9BC;
  333. border-radius: 50%;
  334. margin-bottom: 10rpx;
  335. }
  336. .text {
  337. font-size: 22rpx;
  338. font-weight: 400;
  339. color: #C47C16;
  340. }
  341. }
  342. }
  343. }
  344. .content {
  345. position: absolute;
  346. top: 470rpx;
  347. width: 702rpx;
  348. background: #fff;
  349. border-radius: 12rpx;
  350. padding-top: 36rpx;
  351. padding-bottom: 20rpx;
  352. left:50%;
  353. margin-left: -351rpx;
  354. .title {
  355. padding: 0 30rpx;
  356. .red-text {
  357. font-size: 30rpx;
  358. font-weight: 600;
  359. color: var(--view-theme);
  360. }
  361. .text {
  362. margin-left: 12rpx;
  363. font-size: 22rpx;
  364. font-weight: 400;
  365. color: #999999;
  366. }
  367. }
  368. .red-envelopes {
  369. margin-bottom: 36rpx;
  370. .scroll {
  371. white-space: nowrap;
  372. margin-top: 20rpx;
  373. height: 150rpx;
  374. padding-left: 30rpx;
  375. .scroll-item {
  376. margin-top: 30rpx;
  377. display: inline-block;
  378. width: 174rpx;
  379. height: 112rpx;
  380. background: var(--view-theme);
  381. border-radius: 12px;
  382. margin-right: 10rpx;
  383. position: relative;
  384. text-align: center;
  385. &.on{
  386. background: #ccc;
  387. .condition{
  388. color: #ccc;
  389. .money{
  390. color: #ccc !important;
  391. }
  392. }
  393. }
  394. .img {
  395. width: 156rpx;
  396. height: 88rpx;
  397. position: absolute;
  398. left: 10rpx;
  399. top: -16rpx;
  400. }
  401. .condition {
  402. width: 156rpx;
  403. height: 88rpx;
  404. position: absolute;
  405. top: -13rpx;
  406. left: 10rpx;
  407. color: var(--view-theme);
  408. .money {
  409. font-size: 20rpx;
  410. }
  411. .num {
  412. font-size: 36rpx;
  413. font-weight: 600;
  414. }
  415. .num2 {
  416. font-size: 20rpx;
  417. font-weight: 400;
  418. }
  419. .nums {
  420. font-size: 20rpx;
  421. font-weight: 600;
  422. }
  423. }
  424. .use {
  425. margin-top: 75rpx;
  426. font-size: 20rpx;
  427. font-family: PingFangSC-Regular, PingFang SC;
  428. font-weight: 400;
  429. color: #FFFFFF;
  430. .icon-xiangyou {
  431. font-size: 12rpx;
  432. }
  433. }
  434. }
  435. .use-item {
  436. border-radius: 0 !important;
  437. background: none !important;
  438. margin-top: 30rpx !important;
  439. .imghh {
  440. width: 174rpx;
  441. height: 132rpx;
  442. }
  443. }
  444. }
  445. }
  446. .first-order {
  447. .order {
  448. width: 642rpx;
  449. height: 128rpx;
  450. background: linear-gradient(135deg, var(--view-minorColor) 0%, var(--view-theme) 30%);
  451. border-radius: 8rpx;
  452. display: flex;
  453. margin: 20rpx 30rpx 0 30rpx;
  454. .pictrue {
  455. width: 64rpx;
  456. height: 64rpx;
  457. background: #FFFFFF;
  458. border-radius: 50%;
  459. margin-left: 30rpx;
  460. .iconfont{
  461. font-size: 34rpx;
  462. color: var(--view-theme);
  463. }
  464. }
  465. .order-content {
  466. margin-left: 20rpx;
  467. color: #FFFFFF;
  468. .order-text {
  469. font-size: 28rpx;
  470. font-weight: 500;
  471. }
  472. .text {
  473. font-size: 22rpx;
  474. font-weight: 400;
  475. }
  476. }
  477. }
  478. .btn {
  479. width: 132rpx;
  480. height: 48rpx;
  481. background: #FFFFFF;
  482. border-radius: 24rpx;
  483. font-size: 26rpx;
  484. font-weight: 400;
  485. line-height: 48rpx;
  486. text-align: center;
  487. color: var(--view-theme);
  488. margin-left: 40rpx;
  489. }
  490. }
  491. // 新人专享
  492. .exclusive {
  493. margin-top: 36rpx;
  494. }
  495. }
  496. </style>