Commit 652548b9 authored by Morson's avatar Morson

转移文件

parent 79c94119
<template>
<view class="study">
<u-navbar :is-back="false" background="{background: transparent}" :border-bottom="false" :is-fixed="false">
<text class="title-view">学习</text>
</u-navbar>
<image :src="bannerImage" mode="" class="banner"></image>
<view>
<u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs"
:current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"
style="height: 755rpx;padding-top: 30rpx;">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height:796rpx;width:100%;" @scrolltolower="onreachBottom">
<view class="currency-class" :style="{'background-image':'url(/static/photo/jianbian@3x.png)'}">
<view class="class1" @click="goToPrint">
<image class="img" :src="rule.pic" mode=""></image>
<view class="right u-margin-left-30 u-padding-top-10 u-padding-bottom-14 width-360">
<view class="u-font-32 font-bold">
充电桩交付规范
</view>
<view class="u-font-24">
请点击学习
</view>
</view>
<view class="line-percent">
<text class="font-default-color">去查看</text>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom">
<view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)">
<view class="n-head">
《{{item.title}}》
</view>
<view class="news" v-html="item.body">
<u-parse :html="item.body"></u-parse>
</view>
<u-line color="#F4F5F7" class="content-line"/>
</view>
<view v-shou="isLoadMore">
<u-loadmore :status="loadStatus" />
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height:100%;width:100%;">
<view class="lean">
<view class="top">
<view class="title u-margin-top-10 u-margin-bottom-30">通用课程</view>
<view class="currency-class">
<view class="class1" @click=ccc(courselist[0].sectionId)>
<image class="img" :src="courselist[0].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ courselist[0].title }}
</view>
<view class="u-font-24">
{{ courselist[0].desc }}
</view>
<view class="line-percent">
<u-line-progress active-color="#2979ff" :percent="courselist[0].percent"
:show-percent="false">
</u-line-progress>
<text class="font-default-color"
:class="{'font-active-color':courselist[0].percent}"
v-text="courselist[0].status"></text>
</view>
</view>
</view>
<view class="class1 u-margin-top-40" @click=ccc(courselist[1].sectionId)>
<image class="img" :src="courselist[1].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ courselist[1].title }}
</view>
<view class="u-font-24">
{{ courselist[1].desc }}
</view>
<view class="line-percent">
<u-line-progress active-color="#2979ff" :percent="courselist[1].percent"
:show-percent="false">
</u-line-progress>
<text class="font-default-color"
:class="{'font-active-color':courselist[1].percent}"
v-text="courselist[1].status"></text>
</view>
</view>
</view>
</view>
<view class="title u-margin-top-50 u-margin-bottom-30">技能课程</view>
<view class="currency-class">
<view class="class1" @click=ccc(courselist[2].sectionId)>
<image class="img" :src="courselist[2].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ courselist[2].title }}
</view>
<view class="u-font-24">
{{ courselist[2].desc }}
</view>
<view class="line-percent" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="courselist[2].percent"
:show-percent="false">
</u-line-progress>
<text class="font-default-color"
:class="{'font-active-color':courselist[2].percent}"
v-text="courselist[2].status"></text>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom">
<view class="lean">
<view class="top">
<view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view>
<view class="currency-class">
<view class="class1" @click="aaa(0)">
<image class="img" :src="examList[0].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ examList[0].title }}
</view>
<view class="u-font-24">
{{ examList[0].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[0].condition }}</text>
<text class="font-default-exam-color"
:class="{'font-active-color':examList[0].isComplete}">
{{ examList[0].status }}
</text>
</view>
</view>
</view>
<view class="class1 u-margin-top-40" @click="aaa(1)">
<image class="img" :src="examList[1].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{examList[1].title}}
</view>
<view class="u-font-24">
{{ examList[1].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[1].condition }}</text>
<text class="font-default-exam-color"
:class="{'font-active-color':examList[1].isComplete}">
{{ examList[1].status }}</text>
</view>
</view>
</view>
</view>
<view class="title u-margin-top-50 u-margin-bottom-30">技能认证</view>
<view class="currency-class">
<view class="class1" @click="aaa(2)">
<image class="img" :src="examList[2].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ examList[2].title }}
</view>
<view class="u-font-24">
{{ examList[2].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[2].condition }}</text>
<text class="font-default-exam-color"
:class="{'font-active-color':examList[2].isComplete}">
{{ examList[2].status }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
data() {
return {
msg: "赣南吴彦祖",
tabs: [{
name: "交付规范",
},
{
name: "培训通知",
},
{
name: "在线学习",
},
{
name: "考核认证",
},
],
current: 0,
swiperCurrent: 0,
params: {
start: 0,
},
list: [],
rule: {
pic: process.uniEnv.qn_base_url + "guifan1@3x.png"
},
courselist: [{
title: '服务规范',
desc: '为用户提供更好服务,自己赚更多钱',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 173,
sectionId: ''
},
{
title: '接单操作',
desc: '快速学习,使用APP 接单、抢单',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 173,
sectionId: ''
},
{
title: '从0-1学习充电桩安装服务',
desc: '让你全面了解充电桩市场及服务规范',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 173,
sectionId: ''
}
],
examList: [{
title: '服务规范',
desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
},
{
title: '接单操作',
desc: '快速认证,是否具备接单操作能力',
condition: '随机20题,及格16题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
},
{
title: '从0-1学习充电桩安装服务',
desc: '通过本认证后,可接充电桩业务单',
condition: '随机30题,及格25题',
status: '',
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
}
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中
course_id: "course_id_=173",
exam: null,
};
},
onLoad() {
// this.getList();
// this.getCourseList();
// this.getUserExamInfo();
},
computed: {
bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx@3x.png";
},
},
methods: {
getList() {
this.$u.api
.getTrainingNoticeList(this.params)
.then((res) => {
if (res.code == 200) {
if (res.data) {
this.list = this.list.concat(res.data);
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true;
this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
}
} else {
this.isLoadMore = true;
this.loadStatus = "nomore";
}
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
});
},
getTypeName(percent) {
if (percent == 0) {
return '未开始';
} else if (percent == '100') {
return '已完成';
} else {
return '继续';
}
},
//在线学习通用课程信息
getCourseList() {
let courseLength = this.courselist.length;
for (let i = 0; i < courseLength; i++) {
let param = {
course_id: this.courselist[i].id
};
this.$u.api
.CourseList(param)
.then((res) => {
if (res.code == 200) {
if (res.data) {
res.data.learnedInfo.learnPercent *= 100;
this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
this.courselist[i].percent = res.data.learnedInfo.learnPercent;
this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId;
}
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
});
}
},
//tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
switch (index) {
case 1:
this.params.start = 0;
this.list = [];
this.getList();
break;
case 2:
this.getCourseList();
console.log('重新加载学习进度');
break;
case 3:
this.getUserExamInfo();
break;
}
},
//swiper-item左右移动,通知tabs的滑块跟随移动
transition(e) {
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
animationfinish(e) {
let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
//跳转到assessment页面
aaa(index) {
var examInfo = this.examList[index];
if (examInfo.examStatus == 0) {
console.log("这是申请的考试id", examInfo.examId);
wx.navigateTo({
url: "./answer?userExamId=" + examInfo.examId,
});
} else if (examInfo.examStatus == 1) {
wx.navigateTo({
url: "./result?userExamId=" + examInfo.examId,
});
} else if (examInfo.examStatus == 2) {
wx.navigateTo({
url: "./assessment",
});
}
},
//跳转到课程介绍
ccc(id) {
uni.navigateTo({
url: "./section?section_id=" + 288,
});
},
//跳转到
bbb(e) {
var news = {
body: e.body,
id: e.id,
level: e.level,
title: e.title,
};
// console.log(news)
uni.navigateTo({
url: "./news-details",
});
setTimeout(() => {
uni.$emit("news", news), console.log("发送数据");
}, 500);
console.log("跳转结束11111111");
},
//scroll-view到底部加载更多
onreachBottom() {
console.log("上拉触底函数");
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
this.params.start += 5;
if (this.loadStatus !== "nomore") {
this.getList();
}
}
},
//跳转到拍照小程序首页
goToPrint() {
console.log("111111");
uni.navigateToMiniProgram({
appId: "wxd1d6eede324b0465",
success(res) {
//打开成功
console.log("success", res);
},
fail(err) {
console.log("err", err);
},
});
},
//考核认证,通用认证,考试通过or未通过查询接口请求
getUserExamInfo() {
uni.showLoading({
title: "请稍候",
});
let that = this;
let token = that.vuex_token;
let length = this.examList.length;
for (let i = 0; i < length; i++) {
let examId = this.examList[i].id;
this.$u.api
.getExamResult(examId)
.then((res) => {
if (res.code == 200) {
this.examList[i].examId = res.data.id;
this.examList[i].examStatus = res.data.examStatus;
let examResult = res.data.examLevelResult;
this.examList[i].status = examResult != '' ? examResult : '未通过';
// examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data;
console.log(that.exam);
if (res.data.examStatus == 2) {
console.log("examStatus " + i + " 2");
return;
}
if (res.data.examStatus == 1) {
console.log("examStatus " + i + " 1");
that.examList[i].isComplete = true;
that.examScore = res.data.examScore;
return;
}
if (res.data.examStatus == 0) {
console.log("examStatus " + i + " 0");
that.userExamId = res.data.id;
// that.getNext();
}
} else {
console.log('getUserExamInfo 200 err');
uni.showToast({
icon: "none",
title: '获取考试信息失败',
});
}
})
.catch((err) => {
console.log('getUserExamInfo err' + err);
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
});
}
}
},
};
</script>
<style>
.study {
height: 100vh;
background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx;
}
.title-view {
color: #333333;
font-weight: bold;
font-size: 40rpx;
}
.banner {
width: 690rpx;
height: 240rpx;
margin-top: 10rpx;
}
/* //交付规范 */
.standard {
width: 690rpx;
height: 180rpx;
display: flex;
justify-content: space-between;
/* border-bottom: 1rpx solid #82848a; */
/* padding: 0 34rpx; */
/* margin: 72rpx auto; */
border-radius: 12rpx;
padding: 30rpx;
margin-top: 30rpx;
background-color: #FFFFFF;
}
/* //培训通知 */
.notice {
/* border: #808080 solid 2rpx; */
width: 100%;
height: 400rpx;
margin-top: 36rpx;
overflow: hidden;
background-color: #ffffff;
border-radius: 12rpx;
padding: 30rpx;
}
.n-head {
text-align: left;
}
.news {
height: 168rpx;
overflow: hidden;
margin-top: 30rpx;
/* margin-top: 30rpx;
margin-left: 30rpx;
margin-right: 30rpx;
margin-bottom: 0; */
}
/* //在线学习 */
.currency-class {
width: 100%;
/* height: 340rpx; */
background: #ffffff;
padding: 30rpx;
/* margin-bottom: 11px; */
border-radius: 12rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
font-family: PingFang-SC-Bold, PingFang-SC;
}
.class1 {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.img {
width: 160rpx;
height: 120rpx;
/* display: block; */
/* margin-right: 0rpx; */
}
.right {
width: 434rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.intro {
color: #9999a6;
}
.tab {
background: #fff;
height: 82rpx;
margin: 0 0;
}
.text {
margin: 0 40rpx;
line-height: 82rpx;
color: #667eb5;
}
.content {
margin: 5px 0;
height: 485rpx;
background: #fff;
}
swiper {
height: 691rpx;
}
.line-percent {
display: flex;
justify-content: space-between;
line-height: 24rpx;
font-size: 24rpx;
color: #999999;
}
.u-progress {
width: 280rpx !important;
height: 12rpx !important;
background-color: #ececec;
}
.font-bold {
font-weight: bold;
}
.font-default-color {
color: #999999;
}
.font-default-exam-color {
color: #FA5A49;
}
.font-active-color {
color: #2272FF;
}
.font-color-999999 {
color: #99999;
}
.content-line {
margin-top: 30rpx;
}
.standard {
}
.standard-img {
width: 160rpx;
height: 120rpx;
}
.standard-body {
height: 120rpx;
display: flex;
}
.standard-body-title {
font-size: 32rpx;
font-weight: bold;
}
.width-360 {
width: 360rpx;
}
.rule-back {
background-image: process.uniEnv.qn_base_url + "banner-xx@3x.png";
}
/* <view class="standard" @click="goToPrint">
<!-- <text>充电桩交付规范</text>
<text>></text> -->
<view class="standard-img"></view>
<view class="standard-body">
<view class="standard-body-title">
充电桩交付规范
</view>
<view class="standard-body-title">
请点击学习
</view>
</view>
<view cl ass="standard-go-look-look">去查看</view>*/
</style>
<template>
<view>
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
<view v-if="!takeStatus">
<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
<view class="u-m-r-10">
<u-avatar :src="pic" size="140"></u-avatar>
</view>
<view class="u-flex-1">
<view class="u-font-18 u-p-b-20">uView ui</view>
<view class="u-font-14 u-tips-color">微信号:helang_uView</view>
</view>
</view>
<view class="u-m-t-20">
<u-cell-group>
<u-cell-item v-for="(item, index) in items" :title="item.title" :value="item.value" :key="index">
<u-icon slot="icon" size="32" name="search"></u-icon>
</u-cell-item>
</u-cell-group>
</view>
<view class="u-m-t-20">
<u-cell-group>
<u-cell-item icon="setting" title="设置"></u-cell-item>
</u-cell-group>
</view>
<view class="u-m-t-20" @click="take">
<u-cell-group>
<u-cell-item icon="setting" title="相机组件测试"></u-cell-item>
</u-cell-group>
</view>
</view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
</view>
</template>
<script>
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
pic:'https://uviewui.com/common/logo.png',
show:true,
takeStatus: false,
testData: {
_id: '1', // 规格ID
system_id: '2', // 系统ID
brand_id: '3', // 品牌ID
classify_id: '4', // 分类ID
images: [ // 拍照要求示意图
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png'
],
main_point: [] // 要点
}
}
},
computed: {
items() {
return [
{title: '我的钱包', value: '', icon: ''},
{title: '我的质保金', value: '', icon: ''},
{title: '我的合同', value: '', icon: ''},
{title: '我的证件', value: '', icon: ''},
{title: '我的收货地址', value: '', icon: ''},
{title: '我的仓库', value: '', icon: ''},
{title: '联系客服', value: '6666666', icon: ''}]
}
},
onLoad() {
},
methods: {
take() {
uni.hideTabBar()
this.takeStatus = true
},
closeTake(img) {
console.log(img)
this.takeStatus = false
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<TabBarPage title="订单" :fixed="true">
<!-- <view class="wrap"> -->
<view class="tools-box">
<view class="search-sub">
<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72"
bold>
</u-subsection>
</view>
<view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4"
bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs>
</view>
<view class="tab-view">
<!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort">
<NoOrder v-if="noMore" customStyle="margin-top: 100rpx;background-color: #F4F5F7" />
<template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)"
@action="handleAction(item)"> </OrderCell>
</view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</template>
</scroll-view>
<!-- </swiper-item> -->
</view>
<!-- </view> -->
<PopView title="aaaa" message="bbbb" :visible="visibale" />
</TabBarPage>
</template>
<script>
import TabBarPage from "@/components/tabBarList/index.vue"
import OrderCell from "@/components/order/index.vue"
import NoOrder from "@/components/order/noOrder.vue"
export default {
components: {
TabBarPage,
OrderCell,
NoOrder
},
data() {
return {
visibale: false,
showSview: true,
curNow: 0,
pageNumber: 0,
pageSize: 100,
orderList: [],
list: [{
name: '待预约',
total: 0,
},
{
name: '待签到',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '审核中',
total: 0,
},
{
name: '异常单',
total: 0,
}
],
current: 0,
loadStatus: 'loading',
dataValue: [],
loaded: false,
triggered: false,
_freshing: false,
};
},
onLoad() {
this._freshing = false;
this.getLocation();
// this.getOrderCount();
// this.getOrderList(0);
},
onShow() {
this.getOrderCount()
this.getOrderList(this.currentIndex);
},
computed: {
subList() {
return ['待受理', '已完工']
},
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() {
return this.indexStatus[this.currentIndex]
},
currentIndex() {
return this.curNow == 0 ? this.current : 5
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
},
types() {
return {
'waitAppointment': 0, // 待预约、
'waitCheckIn': 1, // 待签到、
'waitFinish': 2, // 待完工、
'audit': 3, // 审核中、
'exception': 4, // 异常单、
'finish': 5, //已完工
}
},
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() {
return {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'audit',
4: 'exception',
5: 'finish'
}
},
noMore() {
console.log('nomore:', this.orderList.length == 0 && this.pageNumber != 0)
return this.orderList.length == 0 && this.loaded
}
},
methods: {
sectionChange(index) {
this.curNow = index;
this.pageNumber = 0
this.orderList = []
this.loadStatus = 'loading'
this.getOrderList(this.currentIndex)
},
// tab栏切换
change(index) {
this.current = index;
this.pageNumber = 0
this.orderList = []
this.loadStatus = 'loading'
this.getOrderList(index);
},
/**
* 获取当前位置的经纬度
*/
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
},
fail(err) {
}
});
},
reachBottom(e) {
console.log('-------底部-------', this.loadStatus)
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
},
// 页面数据
getOrderList(index) {
// 状态处理
this.pageNumber += 1
this.loaded = false
var param = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.indexStatus[index]
}
var self = this;
self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) {
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/
// res.data.type = self.orderType
// if (res.data.list) {
// if (res.data.list.length == 0 && res.data.total > 0) {
// res.data.total = 15
// res.data.list = [{
// orderServiceType: '安装', // 服务类型:安装、维修
// categoryName: '充电桩', // 品类:充电桩
// orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
// orderNumber: 'OR2021041809827', // 工单编号
// contactName: '郭小清', // 客户信息
// contactPhone: '13631612077', // 联系方式
// contactAddress: '湾街道荔枝花园D座125号', // 详细地址
// contactAddressLatitud: '116.3896', // 联系人地址经度
// contactAddressLongitud: '39.91917', // 联系人地址纬度
// orderStatus: 0, // 工单状态
// appointmentDatetime: '', // 预约时间
// currentWillOverTime: 10000, // 剩余时间
// currentOverTime: new Date().getTime() + 10000, // 超过时间点
// auditDatetime: '2021.04.19 12:45:09', // 审核时间
// submissionTime: '2021.04.19 16:24:48', // 提交时间
// auditResults: {}, // 审核结果
// orderBusinessType: 'R', // 业务类型 R 为抢单
// orderId: '1100000216'
// }]
// res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data
// .list,
// ...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ...
// res
// .data.list, ...res.data.list
// ]
// }
// }
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回type,防止数据返回延迟期间点击了其他的tab
if (res.data.type != self.orderType) return
self.triggered = false;
self._freshing = false;
if (res.data.list) {
self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) {
self.list[self.types[res.data.type]].total = res.data.total
}
self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
}
} else {
console.log(res.message, "获取订单数量失败!");
}
this.loaded = true
});
},
// 获取订单数量
getOrderCount() {
var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
console.log("===", res.data)
if (res.data) {
self.list.forEach(item => {
if (item.name === '待预约') {
item.total = res.data.toAppointmentCount
} else if (item.name === '待签到') {
item.total = res.data.toCheckinCount
} else if (item.name === '待完工') {
item.total = res.data.toFinishCount
} else if (item.name === '审核中') {
item.total = res.data.reviewingCount
} else if (item.name === '异常单') {
item.total = res.data.exceptionCount
}
})
var count = 0
for (var i in res.data) {
count += res.data[i]
}
// 修改tab总数
if (count > 0) {
uni.setTabBarBadge({
index: 1,
text: String(count)
})
} else {
uni.removeTabBarBadge({
index: 1
})
}
}
} else {
console.log(res.message, "获取订单数量失败!");
}
});
},
viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({
url: 'pages/order/detail?id=' + orderId
})
},
handleClick(item) {
if(item.orderStatus===86 || item.orderStatus===88){
this.filish(item)
return
}
console.log('click cell')
this.viewOderItem(item.orderId)
},
filish(item){
// 去完工
uni.navigateTo({
url: 'pages/order/complete?orderId='+item.orderId
+ "&categoryId=" + item.categoryId
+ "&orderServiceType=" + item.orderServiceType
+ "&inGuaranteePeriod=" + item.inGuaranteePeriod
})
},
handleAction(item) {
console.log('click button')
if(item.orderStatus===86 || item.orderStatus===88){
this.filish(item)
return
}
this.viewOderItem(item.orderId)
},
handleClickSearch() {
uni.navigateTo({
url: 'pages/order/search'
})
},
onPulling(e) {
console.log("onpulling", e);
},
onRefresh() {
if (this._freshing) return;
this._freshing = true;
this.pageNumber = 0
this.orderList = []
this.loadStatus = 'loading'
this.getOrderCount();
this.getOrderList(this.currentIndex);
},
onRestore() {
this.triggered = 'restore'; // 需要重置
console.log("onRestore");
},
onAbort() {
console.log("onAbort");
}
}
};
</script>
<style>
/* #ifndef H5 */
page {
height: 100%;
background-color: #f2f2f2;
}
/* #endif */
</style>
<style lang="scss" scoped>
.u-tabs-box {
margin-bottom: 30rpx;
}
.order {
// width: 710rpx;
// background-color: #ffffff;
// margin: 20rpx auto;
// border-radius: 20rpx;
// box-sizing: border-box;
// padding: 20rpx;
// font-size: 28rpx;
.top {
display: flex;
justify-content: space-between;
align-items: center;
.left {
display: flex;
align-items: center;
.tag {
text-align: center;
width: 84rpx;
height: 40rpx;
background: linear-gradient(270deg, #47ABFF 0%, #2272FF 100%);
border-radius: 8rpx;
font-size: 22rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 40rpx;
}
.store {
margin: 0 10rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
line-height: 36px;
}
}
.right {
height: 40rpx;
background: #F4F5F7;
border-radius: 22rpx;
padding: 8rpx 16rpx 8rpx 16rpx;
font-size: 22rpx;
line-height: 24rpx;
font-weight: 400;
color: #333333;
}
}
.item {
display: flex;
flex-direction: column;
margin: 20rpx 0 0;
.content {
.title {
font-size: 26rpx;
font-weight: 400;
color: #333333;
line-height: 52rpx;
}
}
.address {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 52rpx;
.left {}
.right {}
}
}
.total {
margin-top: 20rpx;
text-align: right;
font-size: 24rpx;
.total-price {
font-size: 32rpx;
}
}
.bottom {
display: flex;
margin-top: 30rpx;
padding: 0 10rpx;
justify-content: space-between;
align-items: center;
.left {
display: flex;
align-items: center;
justify-content: space-between;
.tag {
text-align: center;
width: 54rpx;
height: 54rpx;
background: #FF930D;
font-size: 26rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 54rpx;
border-radius: 50%;
margin-right: 20rpx;
}
}
.right-btn {
text-align: center;
width: 200rpx;
height: 80rpx;
background: #2272FF;
border-radius: 40rpx;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
line-height: 80rpx;
font-family: PingFangSC-Semibold, PingFang SC;
}
}
}
.centre {
text-align: center;
margin: 200rpx auto;
font-size: 32rpx;
image {
width: 164rpx;
height: 164rpx;
border-radius: 50%;
margin-bottom: 20rpx;
}
.tips {
font-size: 24rpx;
color: #999999;
margin-top: 20rpx;
}
.btn {
margin: 80rpx auto;
width: 200rpx;
border-radius: 32rpx;
line-height: 64rpx;
color: #ffffff;
font-size: 26rpx;
background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
}
}
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.tab-view {
height: 100%;
overflow: auto;
padding-bottom: 20rpx;
}
// .swiper-box {
// flex: 1;
// }
// .swiper-item {
// height: 100%;
// .page-box {
// padding-bottom: 20rpx;
// }
// }
.tools-box {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-bottom: 20rpx;
.search-sub {
height: 72rpx;
width: 320rpx;
}
.search-btn {
height: 72rpx;
width: 220rpx;
background-color: #ffffff;
border-radius: 36rpx;
color: #999999;
display: flex;
justify-content: center;
align-items: center;
.search-image {
width: 36rpx;
height: 32rpx;
flex-shrink: 0;
margin-right: 24rpx;
}
.search-btn-text {
line-height: 36rpx;
font-weight: 400;
font-size: 26rpx;
}
}
}
.order-taps {
height: 80rpx;
padding: 8rpx 30rpx 20rpx 30rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
.order-taps-item {
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 20px;
.taps-count {
position: absolute;
font-size: 16rpx;
font-weight: 400;
line-height: 16rpx;
width: 36rpx;
height: 24rpx;
background: #FFFFFF;
border-radius: 16rpx;
border: 2rpx solid #FA5A49;
text-align: center;
color: #FA5A49;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment