123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- <template>
- <view class="pagesCons">
- <view class="tab-body">
- <view class="uTabs">
- <u-tabs-swiper ref="uTabs" bar-width="80" :list="tabList" inactive-color="#9DA8B5" name="dispName" active-color="#4F88F7" :current="current" @change="tabsChange" :is-scroll="false"
- swiperWidth="750"></u-tabs-swiper>
- </view>
- <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
- <swiper-item class="swiper-item flex" v-for="(tabs, index) in tabList" :key="index">
- <!-- 左侧 -->
- <scroll-view scroll-y v-if="index==current" class="nav-left">
- <view :class="['nav-left-item', curType == item.id ? 'active' : '']" v-for="(item, index) in typeData" :key="index" @click="selType(item.id)">
- {{item.label}}
- </view>
- </scroll-view>
- <!-- 右侧 -->
- <scroll-view scroll-y class="nav-right flex_1" v-if="index==current" @scrolltolower="onreachBottom">
- <!-- 纸质 -->
- <view class="check-order-list"
- >
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_aper_yellow.png" ></u-image>
- <view class="item-cont">
- <view>黄纸</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_aper_flower.png" ></u-image>
- <view class="item-cont">
- <view>花纸</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_book.png" ></u-image>
- <view class="item-cont">
- <view>书纸</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_magazine.png" ></u-image>
- <view class="item-cont">
- <view>杂志</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_newspaper.png" ></u-image>
- <view class="item-cont">
- <view>报纸</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- <view class="list-item flex align_center">
- <u-image width="36" height="36" src="/static/price/icon_aper_miscellaneous.png" ></u-image>
- <view class="item-cont">
- <view>杂纸</view>
- <view>1.24元/kg</view>
- </view>
- </view>
- </view>
- <u-empty style="padding-top: 10vh;height: auto;" src="/static/img/def_result.png" :text="noDataText" img-width="252" img-height="176" v-if="list.length==0 && status!='loading'"
- mode="list"></u-empty>
- <view v-if="index==current" style="padding: 20upx;">
- <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- // import md5 from 'md5'
- export default {
- data() {
- return {
- status: 'loadmore',
- noDataText: '暂无数据',
- tabList: [
- {
- dispName: '上门回收价格',
- typeId: 1,
- queryLabel: ['WAIT_PAY'] // tab参数
- },
- {
- dispName: '工厂回收价格',
- typeId: 3,
- queryLabel: ['WAIT_SEND'] // tab参数
- },
- ],
- typeData: [
- {
- id: '1',
- label: '纸品类',
- },
- {
- id: '12',
- label: '衣物类',
- },
- {
- id: '13',
- label: '金属类',
- },
- {
- id: '16',
- label: '塑料类',
- }
- ], // 左侧类型数据
- curType: '', // 当前类型
- current: 0,
- swiperCurrent: 0,
- pageNo: 1,
- pageSize: 10,
- typeList: [{
- id: '122',
- createDate: '2021-05-10 15:22',
- orderStateDictValue: '待付款',
- storeName: '昆仑润滑·车领主 (西咸新区-...',
- location: '2.9km',
- orderState:'WAIT_PAY',
- isUp: true,
- orderGoodsList: [
- {
- id: '1',
- goodsImages: '',
- goodsName: '水蜡免擦洗车(轿车)',
- payGold: 200,
- buyQty: 2,
- goodsNum: 5,
- checked: false
- },
- {
- id: '12',
- goodsImages: '',
- goodsName: '水蜡免擦洗车(轿车)',
- payGold: 200,
- buyQty: 2,
- goodsNum: 5,
- checked: false
- },
- ],
- payGold: 450
-
- },{
- id: '156',
- createDate: '2021-05-10 15:22',
- orderStateDictValue: '待付款',
- storeName: '昆仑润滑·车领主 (西咸新区-...',
- location: '2.9km',
- orderState:'WAIT_PAY',
- isUp: false,
- orderGoodsList: [
- {
- id: '13',
- goodsImages: '',
- goodsName: '水蜡免擦洗车(轿车)',
- payGold: 200,
- buyQty: 2,
- goodsNum: 5,
- checked: false
- },
- {
- id: '15',
- goodsImages: '',
- goodsName: '水蜡免擦洗车(轿车)',
- payGold: 200,
- buyQty: 2,
- goodsNum: 5,
- checked: false
- },
- ],
- payGold: 450
-
- }],
- }
- },
- onLoad() {
- // this.pageInit()
- // 开启分享
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- },
- onUnload() {
- },
- onShow() {
- },
- // 下拉刷新
- onPullDownRefresh() {
- console.log('refresh')
- this.pageNo = 1
- this.getRow()
- setTimeout(function () {
- uni.stopPullDownRefresh()
- }, 200)
- },
- methods: {
- pageInit() {
- this.sortIndex = 1
- this.pageNo = 1
- this.getRow()
- },
- handleRefresh() {
- this.getRow()
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(event) {
- this.action = 'swiperChange'
- this.status = 'loading'
- },
- // swiper-item左右移动,通知tabs的滑块跟随移动
- transition(e) {
- let dx = e.detail.dx;
- this.$refs.uTabs.setDx(dx);
- },
- // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
- // swiper滑动结束,分别设置tabs和swiper的状态
- animationfinish(e) {
- let current = e.detail.current;
- let isCurtab = this.current == current
- if (this.status != "nomore") {
- let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
- if (loadData) {
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.resetPage();
- }
- }
- },
- // 单击左侧菜单
- selType (v) {
- this.partList = []
- this.curType = v
-
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- this.action = 'onreachBottom'
- if (this.list.length < this.total) {
- this.pageNo += 1
- this.getRow()
- } else {
- if(this.list.length) {
- uni.showToast({
- title: '已经到底了',
- icon: 'none'
- });
- }
- this.status = "nomore"
- }
- },
- // 查询列表
- getRow(pageNo) {
- this.status = "loadmore"
- if (pageNo) {
- this.pageNo = pageNo
- }
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- orderStateList: this.tabList[this.current].queryLabel, // tab分类
- }
- this.noDataText = '暂无数据'
- this.status = "loading"
- getOrderList(params).then(res => {
- if (res.status == 200) {
- if (this.pageNo > 1) {
- this.list = this.list.concat(res.data.list || [])
- } else {
- this.list = res.data.list || []
- }
- const date1 = moment().toArray() // 当前时间 数组形式
- this.list.map(item=>{
- const date2 = moment(item.orderTime).toDate() // 下单时间 日期格式
- const date3 = moment(date2).toArray() // 下单时间 数组形式
- const tt = 1800 - moment(date1).diff(moment(date3), 'seconds')// 距离30分钟支付 当前剩余秒数 = 1800秒 - 计算相差的秒数(当前时间-支付时间)
- item.leftTimeT = tt > 0 ? tt : 0
- })
- this.total = res.data.count || 0
- } else {
- this.list = []
- this.total = 0
- this.noDataText = res.message
- }
- this.status = "loadmore"
- })
- },
- resetPage() {
- this.status = 'loading';
- // 上划分页
- if (this.action == 'onreachBottom') {
- // this.getRow();
- }
- // 左右切换tab
- if (this.action == 'swiperChange') {
- this.list = [];
- // this.getRow(1);
- }
- },
- itemChange(item) {
- // item.isUp = !item.isUp
- this.$nextTick(function(){
- item.isUp = !item.isUp
- })
- },
- // 详细页
- viewRow(item) {
- console.log(item, '111111')
- // 已完成的
- uni.navigateTo({
- url: "/pages/order/orderDetail?id=" + item.id
- })
- },
- }
- }
- </script>
- <style lang="scss">
-
- .pagesCons {
- height: 100vh;
- width: 100%;
- background: #fff;
- display: flex;
- flex-direction: column;
- .text-right {
- float: right;
- }
- .tab-body {
- flex: 1;
- display: flex;
- flex-direction: column;
- .uTabs {
- border-bottom: 1px solid #EEEEEE;
- box-shadow: 1px 1px 3px #eeeeee;
- }
- .check-list {
- flex: 1;
- overflow-y: scroll;
- .swiper-item {
- width: 100%;
- height: 100%;
- overflow: hidden;
- .scroll-view {
- width: 100%;
- height: 100%;
- overflow: auto;
- }
- .nav-left{
- width: 220rpx;
- height: 100%;
- background-color: #F5F6F7;
- .nav-left-item{
- color: #303133;
- padding: 26upx 32upx;
- position: relative;
- font-size: 34rpx;
- color: #666E75;
- }
- .nav-left-item.active{
- color: #4F88F7;
- background: #fff;
- }
- .nav-left-item.active:after{
- content: '';
- display: block;
- width: 2px;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- background: #4F88F7;
- }
- }
- .nav-right{
- .check-order-list{
- width: 100%;
- height: 100%;
- padding: 30rpx 10rpx 30rpx 32rpx;
- .list-item{
- float: left;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
- width: 45%;
- height: 120rpx;
- border-radius: 12rpx;
- background-image: url(../../static/price/bg__book.png);
- background-repeat: no-repeat;
- padding-left: 20rpx;
- color: #fff;
- font-size: 24rpx;
- .item-cont{
- margin-left: 12rpx;
- view{
- line-height: 32rpx;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|