123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
- <template>
- <view class="myShopTour-wrap">
- <!-- 自定义标题 -->
- <u-navbar :is-back="false" :border-bottom="false" :background="background" id="navbar">
- <view class="slot-wrap">
- <view class="back-icon" @click="goBack">
- <u-icon name="arrow-left" color="#fff" size="32"></u-icon>
- </view>
- <view class="left-icon">我的巡店</view>
- <view class="right-icon">
- <u-icon name="more-dot-fill" color="#fff" size="28" @click="openScreenFun"></u-icon>
- </view>
- </view>
- </u-navbar>
- <!-- 内容 -->
- <view class="myShopTour-con">
- <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
- <swiper class="data-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
- <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
- <scroll-view scroll-y class="scroll-con" @scrolltolower="onreachBottom">
- <view class="record-con">
- <view v-show="searchForm.creatTime.length != 0" class="alert-tips">
- <text>{{searchForm.creatTime[0]}} ~ {{searchForm.creatTime[1]}}</text>
- </view>
- <view class="record-item" v-for="(item,index) in list" :key="index">
- <view class="item-head">
- <text class="item-c-tit">{{item.name}}</text>
- <u-tag class="item-c-type" :text="item.orderStatus" type="primary" />
- </view>
- <view class="item-main">
- <text class="item-tit">创建时间:</text>
- <text class="item-val">{{item.creatTime}}</text>
- </view>
- <view class="item-main">
- <text class="item-tit">完成时间:</text>
- <text class="item-val">{{item.completionTime}}</text>
- </view>
- <view class="item-main">
- <text class="item-tit">巡店耗时:</text>
- <text class="item-val">{{item.timeConsuming}}</text>
- </view>
- <u-grid class="item-grid" :col="4" hover-class="none">
- <u-grid-item>
- <text class="grid-num text-blue">18</text>
- <text class="grid-text">检查项</text>
- </u-grid-item>
- <u-grid-item>
- <text class="grid-num text-green">13</text>
- <text class="grid-text">合格</text>
- </u-grid-item>
- <u-grid-item>
- <text class="grid-num text-red">3</text>
- <text class="grid-text">不合格</text>
- </u-grid-item>
- <u-grid-item>
- <text class="grid-num text-yellow">2</text>
- <text class="grid-text">不适用</text>
- </u-grid-item>
- </u-grid>
- </view>
- </view>
- <u-empty text="暂无数据" img-width="120" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
- <u-loadmore bg-color="#f8f8f8" v-if="list.length < total || status == 'loading'" :status="status" class="loadmore" />
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <!-- 筛选弹框 -->
- <u-popup v-model="openScreen" mode="right" length="80%" class="screenModel-wrap">
- <!-- 条件项 -->
- <view class="condition-con">
- <view class="screen-module">
- <text class="screen-tit">创建时间:</text>
- <view class="screen-time-val">
- <text @click="onShowDatePicker('range')">{{ range.length == 0 ? '请选择' : range[0] + '~' + range[1] }}</text>
- <u-icon v-show="range.length != 0" name="close-circle-fill" color="#c8c0cc" size="32" class="close-circle" @click="range=[]"></u-icon>
- </view>
- </view>
- <view class="screen-module">
- <text class="screen-tit">门店:</text>
- <view class="screen-inp-val">
- <u-input class="screen-inp" v-model="storeName" :height="52" placeholder="请输入" type="text" :border="true" />
- </view>
- </view>
- </view>
- <!-- 按钮 -->
- <view class="btns">
- <u-button type="warning" shape="circle" size="mini" class="btn reset-btn" @click="resetF">重置</u-button>
- <u-button type="error" shape="circle" size="mini" class="btn ok-btn" @click="submitF">确定</u-button>
- </view>
- </u-popup>
- <!-- 选择创建时间 -->
- <mx-date-picker class="choose-date-wrap" :show="showPicker" :type="type" :value="searchForm.creatTime" :show-tips="true" :begin-text="'开始'" :end-text="'结束'" :show-seconds="true" @confirm="onSelected" @cancel="onSelected" />
- </view>
- </template>
- <script>
- import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue"
- export default {
- components: { MxDatePicker },
- data() {
- return {
- background: {
- // 渐变色
- backgroundImage: 'linear-gradient(45deg, rgb(85, 170, 255), rgb(21, 102, 223))'
- },
- tabList: [ // tab切换 类型
- { dispName: '全部', code:'' },
- { dispName: '待处理', code:'0' },
- { dispName: '进行中', code:'1' },
- { dispName: '已完成', code:'2' },
- { dispName: '已过期', code:'3' }
- ],
- current: 0, // tabs组件的current值,表示当前活动的tab选项
- swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
- pageNo: 1, // 当前页码
- pageSize: 15, // 一页多少条
- total: 0, // 总条数
- // status: 'loading', // 加载状态
- status: 'loadmore', // 加载状态
- noDataText: '暂无数据', // 列表数据为空时提示文字
- list: [ // 数据列表
- { name: '常青二店', creatTime: '2020-09-08 09:16', orderStatus: 'haveInHand', completionTime: '2020-09-08 09:16', timeConsuming: '5小时18分钟', inspectionItems: 18, qualified: 14, unqualified: 2, notApplicable: 2 },
- { name: '常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店常青二店', creatTime: '2020-09-08 09:16', orderStatus: 'completed', completionTime: '2020-09-08 09:16', timeConsuming: '5小时18分钟', inspectionItems: 18, qualified: 14, unqualified: 2, notApplicable: 2 },
- { name: '常青二店', creatTime: '2020-09-08 09:16', orderStatus: 'invalid', completionTime: '2020-09-08 09:16', timeConsuming: '5小时18分钟', inspectionItems: 18, qualified: 14, unqualified: 2, notApplicable: 2 },
- { name: '常青二店', creatTime: '2020-09-08 09:16', orderStatus: 'haveInHand', completionTime: '2020-09-08 09:16', timeConsuming: '5小时18分钟', inspectionItems: 18, qualified: 14, unqualified: 2, notApplicable: 2 },
- { name: '常青二店', creatTime: '2020-09-08 09:16', orderStatus: 'completed', completionTime: '2020-09-08 09:16', timeConsuming: '5小时18分钟', inspectionItems: 18, qualified: 14, unqualified: 2, notApplicable: 2 },
- ],
- openScreen: false, // 是否打开筛选
- dateMode: 'range', // date单个日期 range日期范围
- searchForm: { // 查询条件
- creatTime: [], // 创建时间默认筛选近7天
- store: ''
- },
- showPicker: false, // 是否选择创建时间
- range: [], // 筛选创建时间的默认值
- type: 'range', // 日期时间类型
- storeName: '', // 筛选的门店名称
- }
- },
- onLoad() {
- this.pageInit()
- },
- methods: {
- // 返回
- goBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- pageInit(){
- this.range = [ this.get7day(-6), this.get7day(0) ]
- this.searchForm.creatTime = [ this.get7day(-6), this.get7day(0) ]
- this.total = 0
- this.pageNo = 1
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index
- this.list = []
- this.status = "loading"
- },
- swiperChange(event){
- 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() {
- if(this.list.length < this.total){
- this.pageNo += 1
- this.pageInit()
- }else{
- this.status = "nomore"
- }
- },
- // 显示日期选择
- onShowDatePicker(type){
- this.type = type
- this.showPicker = true
- this.searchForm.creatTime = this[type]
- },
- // 日期选择
- onSelected(e) {
- this.showPicker = false
- if(e) {
- this[this.type] = e.value
- }
- },
- // 获取近几天的数据
- get7day(day){
- let today = new Date()
- let targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day
- today.setTime(targetday_milliseconds) //注意,这行是关键代码
- let tYear = today.getFullYear()
- let tMonth = today.getMonth()
- let tDate = today.getDate()
- tMonth = this.doHandleMonth(tMonth + 1)
- tDate = this.doHandleMonth(tDate)
- return tYear + "-" + tMonth + "-" + tDate
- },
- // 月份
- doHandleMonth(month){
- let m = month
- if(month.toString().length == 1){
- m = "0" + month
- }
- return m
- },
- // 打开筛选条件
- openScreenFun(){
- this.openScreen = true
- },
- // 重置筛选条件
- resetF(){
- this.range = this.searchForm.creatTime
- this.storeName = this.searchForm.store
- },
- // 确定筛选
- submitF(){
- this.searchForm.creatTime = this.range
- this.searchForm.store = this.storeName
- this.openScreen = false
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #f8f8f8;
- height: calc(100vh - 44px);
- }
- .myShopTour-wrap {
- height: 100%;
- /* 自定义导航栏样式 */
- .slot-wrap {
- display: flex;
- align-items: center;
- /* 如果您想让slot内容占满整个导航栏的宽度 */
- flex: 1;
- /* 如果您想让slot内容与导航栏左右有空隙 */
- padding: 0 30rpx;
- color: #fff;
- font-size: 28upx;
- .left-icon {
- flex-grow: 1;
- font-size: 32upx;
- margin-right: 10upx;
- text-align: center;
- }
- .right-icon {
- padding-left: 50upx;
- }
- .uni-icons {
- margin-right: 10upx;
- }
- }
- // 内容
- .myShopTour-con{
- .data-list{
- height: calc(100vh - 84px);
- .swiper-item{
- .scroll-con{
- height: 100%;
- // 列表
- .record-con{
- padding-top: 74upx;
- position: relative;
- .alert-tips{
- position: fixed;
- top: 0upx;
- left: 0;
- width: 100%;
- z-index: 3;
- padding: 20upx 30upx 10upx;
- background-color: #fff;
- text{
- display: block;
- font-size: 24upx;
- padding: 4upx 10upx;
- border: 1upx solid #fcbd71;
- background-color: #fdf6ec;
- border-radius: 6upx;
- }
- }
- .record-item{
- background-color: #fff;
- margin: 20upx 30upx 20upx;
- padding: 14upx 30upx 20upx;
- border-radius: 12upx;
- .item-head{
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10upx 0;
- .item-c-tit{
- flex-grow: 1;
- padding-right: 18upx;
- font-weight: bold;
- }
- .item-c-type{
- flex-shrink: 0;
- }
- }
- .item-main{
- font-size: 26upx;
- line-height: 48upx;
- padding: 6upx 0;
- position: relative;
- .item-tit{
- display: inline-block;
- position: absolute;
- left: 0;
- top: 8upx;
- }
- .item-val{
- display: inline-block;
- padding-left: 150upx;
- }
- }
- .item-grid{
- margin-top: 10upx;
- .text-blue{
- color: #2979ff;
- }
- .text-green{
- color: #19be6b;
- }
- .text-red{
- color: #fa3534;
- }
- .text-yellow{
- color: #ff9900;
- }
- .grid-num{
- font-weight: bold;
- }
- .grid-text{
- font-size: 26upx;
- padding-top: 10upx;
- color: #666;
- }
- }
- }
- }
- .loadmore{
- padding: 30upx;
- }
- }
- }
- }
- }
- .screenModel-wrap{
- padding-bottom: 80upx;
- .condition-con{
- padding: 20upx 30upx;
- .screen-module{
- margin: 0 0 20upx;
- .screen-tit{
- color: #464646;
- font-size: 26upx;
- }
- .screen-time-val{
- font-size: 26upx;
- background-color: #f4f4f4;
- border-radius: 12upx;
- padding: 10upx 14upx;
- margin: 10upx 0;
- text-align: center;
- text{
- display: inline-block;
- width: 85%;
- }
- .close-circle{
- display: inline-block;
- padding-left: 3%;
- vertical-align: bottom;
- }
- }
- .screen-inp-val{
- margin: 10upx 0;
- .screen-inp{
- color: #464646;
- font-size: 26upx;
- }
- }
- }
- }
- .btns{
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- background-color: rgba(0,0,0,.025);
- .btn{
- width: 40%;
- margin: 20upx 5%;
- padding: 30upx 0;
- }
- }
- }
- .choose-date-wrap{
- z-index: 999999;
- }
- }
- </style>
|