123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <view class="newPeople">
- <!-- <view class="header">
- <view class="inputSearch" @click="clickSearch">
- <image src="@/static/img/search.png"></image>
- 请输入关键词
- </view>
- </view> -->
- <!-- <data-list :data='data'></data-list> -->
- <view class="good-wrap">
- <view class="good" v-for="item in list"
- @click="tobuy(item)">
- <image :src="item.image" mode="" class="goo-img"></image>
- <view class="good-tit clamp">
- {{item.title}}
- </view>
- <view class="good-price flex">
- <view class="new-price">
- ¥{{item.price}}
- </view>
- <view class="old-price">
- ¥{{item.ot_price}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- loadIndexs
- } from '@/api/index.js';
- import {
- getUserInfo
- } from '@/api/user.js'
- import dataList from '@/components/datalist.vue'
- import {
- getNewList
- } from '@/api/whole.js'
- export default {
- data() {
- return {
- list: [],
- is_new: 1,
- // data: {
- // page: 1,
- // limit: 10,
- // sum: 0,
- // loadingType: 'loadmore',
- // data: []
- // }
- }
- },
- components: {
- dataList
- },
- onLoad() {
- this.getNewList()
- },
- onShow() {
- this.getUserInfo()
- },
- // mounted() {
- // this.init()
- // },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
- tobuy(item) {
- if(this.is_new == 'isn') {
- this.navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status + '&is_new=' + this.is_new)
- }else {
- this.$api.msg('您已不是新人,无法预约新人专区商品')
- }
-
- },
- getUserInfo() {
- getUserInfo().then(res => {
- console.log(res)
- this.setUserInfo(res.data);
- this.is_new = res.data.is_whole == 0? 'isn': 'non'
- })
- },
- navto(url) {
- uni.navigateTo({
- url: url
- })
- },
- // 點擊搜索框
- clickSearch() {
- uni.navigateTo({
- url: '/pages/product/search'
- });
- },
- init() {
- this.getData()
- },
- getNewList() {
- getNewList().then(res => {
- console.log(res, 'getNewList')
- this.list = res.data
- })
- },
- getData() {
- loadIndexs().then(res => {
- this.data = res.data.info.bastList
- this.loadingType = 'nomore'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- $grey: #95A0B1;
- $text: #333333;
- $red: #FF4C4C;
- .newPeople {
- .header {
- background-color: #fff;
- padding: 30rpx;
- .inputSearch {
- line-height: 35rpx;
- text-align: center;
- color: $grey;
- padding: 10rpx 20rpx;
- border-radius: 50rpx;
- background-color: $page-color-base;
- image {
- width: 32rpx;
- height: 32rpx;
- margin: 0 20rpx;
- margin-bottom: -3rpx;
- }
- }
- }
- .list {
- padding: 20rpx;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- .item {
- background-color: #fff;
- border-radius: 10rpx;
- overflow: hidden;
- // box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
- margin: 10rpx 0;
- width: 48%;
- height: 0;
- padding-bottom: calc(48% + 120rpx);
- .img {
- border-radius: 10rpx;
- overflow: hidden;
- width: 100%;
- height: 0;
- padding-bottom: 100%;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .name {
- margin: 0 10rpx;
- font-size: 30rpx;
- font-weight: bold;
- }
- .allprice {
- padding: 20rpx 0;
- .price {
- color: $red;
- }
- .ot-price {
- color: $grey;
- text-decoration: line-through;
- font-size: 26rpx;
- }
- }
- }
- }
- .load {
- text-align: center;
- color: $grey;
- font-size: 28rpx;
- }
- }
- .good-wrap {
- display: flex;
- // padding: 0 0 20rpx 20rpx;
- padding-left: 20rpx;
- padding-top: 20rpx;
- flex-wrap: wrap;
- }
- .good {
- width: 345rpx;
- height: 480rpx;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 10rpx;
- .goo-img {
- width: 345rpx;
- height: 345rpx;
- border-radius: 10rpx 10rpx 0 0;
- // background-color: #bfa;
- }
- .good-tit {
- padding: 15rpx 20rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- // line-height: 35rpx;
- }
- .good-price {
- padding-left: 20rpx;
- justify-content: flex-start;
- .new-price {
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF4C4C;
- }
- .old-price {
- padding-left: 8rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- text-decoration: line-through;
- color: #999999;
- }
- }
- }
- </style>
|