123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- <template>
- <view class="digitShelf-pagesCons">
- <view class="tab-body">
- <view>
- <u-tabs-swiper ref="uTabs" :list="tabList" :offset="[5,40]" bar-width='100' active-color="#1283d4" name="dispName" :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" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, indexs) in tabList" :key="indexs">
- <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
- <view
- class="check-order-list"
- v-for="(item,index) in 10"
- :key="item"
- >
- <view>
- <view class="dio dio-left"></view>
- <view class="dio dio-right"></view>
- <view class="check-order-left" :class="'imgbg-'+current">
- ¥<text>100</text>
- </view>
- <view class="check-order-right">
- <view class="check-order-title">满1000减100</view>
- <view class="check-order-subtitle">箭冠轮胎,五一大福利。</view>
- <view class="check-order-date">
- <view v-if="current!=1">2024.07.22 13:00:00 至</view>
- <view v-if="current!=1">2024.08.22 13:00:00 到期 </view>
- <view class="use-date" v-if="current==1">使用时间:2021-12-31</view>
- </view>
- </view>
- </view>
- <view>
- <view class="check-order-desc" :class="'border-'+current" @click="item.showDesc = !item.showDesc">
- <text>使用说明:</text>
- <u-icon name="arrow-down"></u-icon>
- </view>
- <view class="check-order-desc-content">
- 仅限箭冠产品,轮胎类,满1000,才能使用。
- </view>
- </view>
- </view>
- <view style="padding: 20upx;">
- <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
- <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- import carNo from '@/components/carNo.vue'
- import { getShelfTempBillList, shelfTempTotalWaitQty } from '@/api/shelf.js'
- import moment from 'moment'
- export default {
- components: {carNo},
- data() {
- return {
- theme:'',
- status: 'loading',
- noDataText: '暂无数据',
- tabList: [
- {
- dispName: '未使用',
- typeId: 1,
- count: 0
- },
- {
- dispName: '已使用',
- typeId: 2,
- count: 0
- },
- {
- dispName: '已过期',
- typeId: 3,
- count: 0
- },
- ],
- current: 0,
- swiperCurrent: 0,
- // 查询条件
- pageNo: 1,
- pageSize: 10,
- list: [],
- total: 0,
- }
- },
- onLoad() {
- let _this = this
- _this.pageInit()
- _this.theme = getApp().globalData.theme
- uni.$on('refreshOrder',function(data){
- _this.list = []
- _this.status = "loading"
- _this.pageInit()
- })
- },
- methods:{
- // 复制
- copyVin(vin){
- uni.setClipboardData({
- data: vin||'',
- })
- },
- message(title){
- uni.showToast({
- icon:'none',
- title: title
- })
- },
- pageInit(){
- this.total = 0
- this.pageNo = 1
- this.getRow()
- // 获取总条数
- this.getWaitTotal()
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(event){
- console.log(event.detail)
- this.list = []
- 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;
- if(current != this.current){
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.pageInit()
- }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- console.log(this.list.length, this.total)
- if(this.list.length < this.total){
- this.pageNo += 1
- this.getRow()
- }else{
- this.status = "nomore"
- }
- },
- checkNums (states, i){
- if(states){
- let arr = states.split(',')
- return arr[i]
- }
- return 0
- },
- // 查询列表
- getRow (pageNo) {
- let _this = this
- if (pageNo) {
- this.pageNo = pageNo
- }
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- }
- // 状态条件
- if(this.swiperCurrent == 1){
- params.billStateList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
- }
- if(this.swiperCurrent == 2){
- params.billStateList = ['FINISH']
- }
- this.status = "loading"
- getShelfTempBillList(params).then(res => {
- if (res.code == 200 || res.status == 204 || res.status == 200) {
- if(_this.pageNo>1){
- _this.list = _this.list.concat(res.data.list || [])
- }else{
- _this.list = res.data.list || []
- }
- _this.total = res.data.count || 0
- } else {
- _this.list = []
- _this.total = 0
- _this.noDataText = res.message
- }
- _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
- })
- },
- // 获取待拿货数量
- async getWaitTotal(){
- const ret = await shelfTempTotalWaitQty({billStateList:['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']}).then(res => res.data)
- this.tabList[1].count = ret || 0
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- }
- .digitShelf-pagesCons{
- height: 100%;
- display: flex;
- flex-direction: column;
- .tab-body{
- .check-list{
- height: calc(100vh - 44px);
- }
- .check-order-list{
- background: #ffffff;
- margin: 25upx;
- border-radius: 30upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- > view{
- &:first-child{
- position: relative;
- display: flex;
- align-items: center;
- justify-content: space-around;
- }
- }
- .dio{
- width: 30rpx;
- height: 30rpx;
- background: #f8f8f8;
- border-radius: 100rpx;
- position: absolute;
- z-index: 1000;
- }
- .dio-left{
- left: -15rpx;
- top: 85rpx;
- }
- .dio-right{
- right: -15rpx;
- top: 85rpx;
- }
- .check-order-left{
- width: 30%;
- height: 200rpx;
- display: flex;
- align-items: center;
- justify-content:center;
- font-size: 30rpx;
- text{
- font-size: 65rpx;
- }
- color: #fff;
- }
- .imgbg-0{
- background: #2196F3;
- }
- .imgbg-1{
- background: #f7e7b8;
- color: #FF9800;
- }
- .imgbg-2{
- background: #d2d1d1;
- }
- .check-order-right{
- width: 70%;
- padding: 0 25rpx;
- .check-order-title{
- font-size: 32rpx;
- }
- .check-order-subtitle{
- font-size: 28rpx;
- color: #666;
- margin: 10rpx 0;
- }
- .check-order-date{
- font-size: 24rpx;
- color: #666;
- .use-date{
- color: #ff5500;
- }
- }
- }
- .check-order-desc{
- font-size: 24rpx;
- color: #666;
- padding: 10rpx 20rpx;
- border-top: 1rpx solid #2196F3;
- display: flex;
- justify-content: space-between;
- }
- .border-0{
- border-top: 1rpx solid #eee;
- }
- .border-1{
- border-top: 1rpx solid #f7e7b8;
- }
- .border-2{
- border-top: 1rpx solid #d2d1d1;
- }
- .check-order-desc-content{
- padding: 5rpx 25rpx 25rpx 25rpx;
- font-size: 24rpx;
- }
- }
- }
- }
- </style>
|