123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <template>
- <view class="content">
- <image src="../../static/img/wh-bg.png" mode="" class="to-bg"></image>
- <view class="top-tit">
- {{gooditem.state}}
- </view>
- <view class="top-time" v-if="gooditem.time">
- {{gooditem.time + ' ' + '~' + ' '}}{{gooditem.stop | time}}
- </view>
- <view class="center-btn flex" @click="navto('/pages/user/myWholesale')">
- <image src="../../static/icon/pf-logo.png" mode="" class="center-logo"></image>
- <view class="center-tit">
- <view class="tit-top">
- 批发订单
- </view>
- <view class="">
- 查看我购买的批发订单
- </view>
- </view>
- <image src="../../static/img/img74.png" mode="" class="look-more"></image>
- </view>
- <scroll-view scroll-y="true" class="swiper-box" :style="{'height': height}" @scrolltolower="getWholeList()">
- <view class="good-wrap">
- <template v-if="userInfo && userInfo.is_whole == 0">
- <!-- <template> -->
- <view class="good" v-for="itemt in newlist" @click="navto('/pages/product/wholesaleDetail?id=' + itemt.id + '&time=' + itemt.time_id + '&status=' + itemt.status + '&is_new=' + is_new)">
- <image :src="itemt.image" mode="" class="goo-img"></image>
- <view class="xrlb">
- 新人礼包
- </view>
- <view class="good-tit clamp">
- {{itemt.title}}
- </view>
- <view class="good-price flex">
- <view class="new-price">
- ¥{{itemt.price}}
- </view>
- </view>
- </view>
- </template>
-
- <view class="good" v-for="item in list" @click="gotoDetail(item)">
- <image :src="item.whole.image" mode="" class="goo-img"></image>
- <view class="good-tit clamp">
- {{item.whole.title}}
- </view>
- <view class="good-price flex">
- <view class="new-price">
- ¥{{item.price}}
- </view>
- <!-- <view class="old-price">
- ¥{{item.}}
- </view> -->
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- timeComputed
- } from '@/utils/rocessor.js'
- import {
- getWholeList,
- getNewList,
- getWholeTimeArea,
- } from '@/api/whole.js'
- import {
- getUserInfo
- } from '@/api/user.js'
- import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
- import empty from '@/components/empty';
- export default {
- components: {
- empty,
- uniCountdown
- },
- data() {
- return {
- newlist: [],
- height: '',
- list: [],
- page: 1,
- limit: 10,
- loadingType: 'more',
- loaded: false,
- bin: '',
- stop: '',
- status: '',
- state: '',
- stopTimeH: '',
- stopTimeM: '',
- stopTimeS: '',
- timer: '',
- wid: '',
- time_id: 0,
- gooditem: {},
- is_new: 'non',
- userInfo: {}
- }
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', obj.height);
- });
- },
- fail: res => {}
- });
- },
- onLoad(opt) {
- let obj = this
- obj.bin = decodeURI(opt.bin)
- obj.stop = opt.stp
- obj.status = opt.status
- obj.state = opt.state
- obj.wid = opt.wid
- obj.getNewList()
- console.log(obj.bin, obj.stop, obj.status)
- },
- onShow() {
- let obj = this
- obj.getUserInfo()
- obj.getTimeArea()
- },
- filters: {
- time(val) {
- let str = ''
- if(val) {
- let date = new Date(val*1000)
- let m = date.getHours() > 9 ? date.getHours() : ( '0'+ date.getHours())
- let s = date.getMinutes() > 9 ? date.getMinutes() : ( '0'+ date.getMinutes())
- str = m + ':' + s
- }
- return str
- }
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
- getUserInfo() {
- getUserInfo().then(res => {
- console.log(res)
- this.setUserInfo(res.data);
- this.userInfo = res.data
- this.is_new = res.data.is_whole == 0? 'isn': 'non'
- })
- },
- getTimeArea() {
- let obj = this
- getWholeTimeArea().then(({
- data
- }) => {
-
- // this.list = data.seckillTime
- console.log(data.seckillTime[0])
- data.seckillTime.forEach(item => {
- if(obj.wid == item.id) {
- obj.gooditem = item
- }
- })
- // this.gooditem = data.seckillTime[0]
- // this.wid = this.gooditem.id
- console.log('时间获取成功',this.gooditem.id)
- this.getWholeList()
- // this.list.forEach(item => {
-
- // })
- })
- },
- getNewList() {
- getNewList({
- page: 1,
- limit: 100,
- time_id: this.wid
- }).then(res => {
- console.log(res, 'getNewList')
- this.newlist = res.data
- })
- },
- gotoDetail(item) {
- let obj = this
- obj.navto('/pages/product/realyWhole?id=' + item.id + '&time=' + item.time_id)
- },
- navto(url) {
- uni.navigateTo({
- url: url
- })
- },
- // // 获取剩余时间
- // getSyTime() {
- // let obj = this
- // let stopTime = timeComputed(obj.stop * 1000)
- // console.log(stopTime, 'stopTime')
- // obj.stopTimeH = stopTime.hours
- // obj.stopTimeM = stopTime.minutes >= 10 ? stopTime.minutes : ('0' + stopTime.minutes)
- // obj.stopTimeS = stopTime.seconds >= 10 ? stopTime.seconds : ('0' + stopTime.seconds)
- // if (stopTime.hours == 0 && stopTime.minutes == 0 && stopTime.seconds == 0) {
- // obj.status = 0
- // }
- // if (!obj.timer) {
- // if (obj.status == 1) {
- // obj.timer = setTimeout(this.getSyTime, 1000)
- // }
- // } else {
- // clearTimeout(obj.timer)
- // if (obj.status == 1) {
- // obj.timer = setTimeout(this.getSyTime, 1000)
- // }
- // }
- // // console.log(obj.stopTimeH + ':' + obj.stopTimeM + ':' + obj.stopTimeS)
- // },
- getWholeList() {
- let obj = this
- console.log('开始加载')
- // obj.loadingType == 'loading'
- if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
- return
- }
- obj.loadingType = 'loading'
- getWholeList({
- page: obj.page,
- limit: obj.limit
- }, obj.wid).then(({
- data
- }) => {
- console.log('结束')
- obj.list = obj.list.concat(data.data)
- obj.page++
- if(data.data.length == obj.limit) {
- obj.loadingType = 'more'
- }else {
- obj.loadingType = 'noMore'
- }
- })
- },
- loadmore() {
- console.log('加载更多')
- }
- }
- }
- </script>
- <style lang="scss">
- .to-bg {
- width: 750rpx;
- height: 427rpx;
- background-color: #fff;
- }
- .top-tit {
- position: absolute;
- top: 170rpx;
- left: 0;
- right: 0;
- margin: auto;
- text-align: center;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- }
- .top-time {
- position: absolute;
- top: 240rpx;
- left: 0;
- right: 0;
- margin: auto;
- font-size: 83rpx;
- text-align: center;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- }
- .center-btn {
- padding: 20rpx 32rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- .center-logo {
- width: 83rpx;
- height: 106rpx;
- flex-shrink: 0;
- background-color: #eee;
- }
- .center-tit {
- padding-left: 30rpx;
- flex-grow: 1;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1.5;
- .tit-top {
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- }
- .look-more {
- width: 16rpx;
- height: 30rpx;
- flex-shrink: 0;
- }
- }
- .swiper-box {
- // background-color: red;
- // position: relative;
- }
- .good-wrap {
- display: flex;
- // padding: 0 0 20rpx 20rpx;
- padding-left: 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;
- position: relative;
- .xrlb {
- position: absolute;
- display: inline-block;
- padding: 5rpx 10rpx;
- background-color: #FF4C4C;
- color: #fff;
- text-align: center;
- border-radius: 0 10rpx 10rpx 0;
- // width: 100rpx;
- top: 0;
- left: 0;
- }
- .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>
|