| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892 |
- <template>
- <scroll-view class="container" :scroll-y="scrollY" @scrolltolower="scrolltolower">
- <!-- 顶部分段器区域 -->
- <view class="control">
- <view class="control_item" :class="{ active: current === index }" v-for="(item, index) in items" :key="index" @click="onClickItem(index)">{{ item }}</view>
- </view>
- <!-- 主体内容区域 -->
- <view class="body">
- <!-- 每一个记录区域 -->
- <view class="body_item" :class="{ body_events: isClick }" v-for="item in list" :key="item.id" @click="handleLookDetail(item)">
- <!-- 工单编号 -->
- <view class="item_title">
- <img src="../../static/images/repairsImg/order.png" />
- <view class="title_info">工单编号:{{ item.recordNo }}</view>
- <view class="title_type" v-if="item.timeoutStr">{{ item.timeoutStr }}</view>
- </view>
- <!-- 报修时间 -->
- <view class="item_time">
- <view class="time_msg">
- 报修时间:
- <text>{{ item.reportTime }}</text>
- </view>
- <view class="time_type" v-if="item.state === '待接单'">待接单</view>
- <view class="time_type color_type" v-if="item.state === '维修中'">维修中</view>
- <view class="time_type color_type" v-if="item.state === '转后勤'">转后勤</view>
- <view class="time_type color_type" v-if="item.state === '转单待审核'">转单待审核</view>
- <view class="time_type color_type" v-if="item.state === '协作待审核'">协作待审核</view>
- <view class="time_type color_type" v-if="item.state === '转线下'">转线下</view>
- <view class="time_type color_type" v-if="item.state === '转线下待审核'">转线下待审核</view>
- <view class="time_type" v-if="item.state === '待支付'">待支付</view>
- <view class="time_type color_type2" v-if="item.state === '已完成'">已完成</view>
- <view class="time_type" v-if="item.state === '已取消'">已取消</view>
- <view class="time_type color_type3" v-if="item.state === '已关单'">已关单</view>
- </view>
- <!-- 报修姓名 -->
- <view class="item_box">
- <view class="box_key">报修姓名:</view>
- <view class="box_value">{{ item.userName }}</view>
- </view>
- <!-- 部门 -->
- <view class="item_box" v-if="item.userClass">
- <view class="box_key">部门:</view>
- <view class="box_value">{{ item.userClass }}</view>
- </view>
- <!-- 报修电话 -->
- <view class="item_box">
- <view class="box_key">报修电话:</view>
- <view class="box_value phone" @click.stop="handleCallPhone(item.userPhone)">
- {{ item.userPhone }}
- <img src="../../static/images/repairsImg/phone.png" />
- </view>
- </view>
- <!-- 报修区域 -->
- <view class="item_box">
- <view class="box_key">报修区域:</view>
- <view class="box_value">{{ item.areaName }}</view>
- </view>
- <!-- 详细地址 -->
- <view class="item_box">
- <view class="box_key">详细地址:</view>
- <view class="box_value">{{ item.address }}</view>
- </view>
- <!-- 报修物品 -->
- <view class="item_box">
- <view class="box_key">报修物品:</view>
- <view class="box_value">{{ item.articleName }}</view>
- </view>
- <!-- 故障描述 -->
- <view class="item_box" v-if="item.descript">
- <view class="box_key">故障描述:</view>
- <view class="box_value">{{ item.descript }}</view>
- </view>
- <!-- 报修录音 -->
- <view class="item_box" v-if="item.voice">
- <view class="box_key">报修录音:</view>
- <view class="box_value">
- <view class="recording" @click.stop="handlePlayRecording(item)">
- <img class="voiceImg" :src="item.status ? '../../static/images/repairsImg/play_active.png' : '../../static/images/repairsImg/play.png'" />
- {{ item.voiceLength }}″
- </view>
- </view>
- </view>
- <!-- 上传图片 -->
- <view class="item_img">
- <view class="img_key">上传图片:</view>
- <img class="img_value" mode="aspectFill" :src="item.images[0]" @click.stop="handleLookImgs(item.images)" />
- </view>
- <!-- 维修师傅 -->
- <view class="item_time" v-if="item.maintenancerName">
- <view class="time_msg">
- 维修师傅:
- <text>{{ item.maintenancerName }}</text>
- </view>
- </view>
- <!-- 师傅电话 -->
- <view class="item_box" v-if="item.maintenancerPhone">
- <view class="box_key">师傅电话:</view>
- <view class="box_value phone" @click.stop="handleCallPhone(item.maintenancerPhone)">
- {{ item.maintenancerPhone }}
- <img src="../../static/images/repairsImg/phone.png" />
- </view>
- </view>
- <!-- 维修费用 -->
- <view class="item_box" v-if="item.price">
- <view class="box_key">维修费用:</view>
- <view class="box_value2 phone" @click.stop="checkFeeDetail(item)">
- {{ item.price }}元
- <img src="../../static/images/repairsImg/eye.png" />
- </view>
- </view>
- <!-- 按钮 -->
- <view class="item_btn" v-if="item.state !== '已取消' && item.state !== '已关单'">
- <view
- class="btn_box type"
- v-if="item.state === '待接单' || item.state === '维修中' || item.state === '转单审核' || item.state === '协作审核'"
- @click.stop="handleExpedite(item.id)"
- >
- 催单
- </view>
- <view class="btn_box type" v-if="item.state === '待支付'" @click.stop="handleBackOffice(item)">转后勤</view>
- <view class="btn_box type" v-if="item.state === '待支付'" @click.stop="handlePay(item)">支付</view>
- <view class="btn_box type2" v-if="item.state === '待接单' || item.state === '待支付'" @click.stop="handleRepeal(item.id)">撤销</view>
- <view class="btn_box type" v-if="item.state === '已完成' && item.evaluate === 1" @click.stop="handleEvaluate(item)">去评价</view>
- <view class="btn_box type3" v-if="item.state === '已完成' && item.evaluate === 0" @click.stop="">已评价</view>
- </view>
- <view class="item_btn2" v-else></view>
- </view>
- <!-- 维修费用弹窗 -->
- <uni-popup :is-mask-click="false" ref="popup_fee">
- <view class="pop_fee" @click.stop="">
- <view class="fee_title">
- 维修费用
- <text
- @click="
- $refs.popup_fee.close()
- isClick = false
- "
- >
- ×
- </text>
- </view>
- <view class="fee_list">
- <view class="fee_item" v-for="ele in consumables" :key="ele.id">
- <view class="fee_box">
- 耗材:
- <text>{{ ele.consumeName }}</text>
- </view>
- <view class="fee_box">
- 耗材单价:
- <text>{{ ele.price }}元</text>
- </view>
- <view class="fee_box">
- 耗材数量:
- <text>{{ ele.number }}</text>
- </view>
- <view class="fee_box">
- 耗材费用:
- <text>{{ ele.totalPrice }}元</text>
- </view>
- </view>
- </view>
- </view>
- </uni-popup>
- <!-- 转后勤弹窗 -->
- <uni-popup ref="popup_logistics" :is-mask-click="false">
- <view class="pop_logistics" @click.stop="">
- <view class="logistics_title">转后勤</view>
- <view class="logistics_body">
- <textarea placeholder-style="color:#CCCCCC" placeholder="请输入您宝贵的留言" v-model="logisticsValue"></textarea>
- </view>
- <view class="logistics_btn">
- <view
- class="btn_box cancel"
- @click="
- $refs.popup_logistics.close()
- isClick = false
- "
- >
- 取消
- </view>
- <view class="btn_box confirm" @click="handleLogisticsConfirm">确定</view>
- </view>
- </view>
- </uni-popup>
- <!-- 没有数据时展示的图片 -->
- <view class="body_no_data" v-if="list.length === 0">
- <img src="../../pagesClockIn/static/imgs/nodata.png" />
- <view>暂无数据</view>
- </view>
- </view>
- </scroll-view>
- </template>
- <script>
- const innerAudioContext = uni.createInnerAudioContext()
- export default {
- data() {
- return {
- // 每一个订单点击时是否触发事件 true 不触发 false 触发
- isClick: false,
- // 后勤弹窗输入框绑定数据
- logisticsValue: '',
- // 顶部分段器数组
- items: ['未完成(0)', '待支付(0)', '已完成(0)'],
- // 分段器数组当前索引
- current: 0,
- // 订单列表
- list: [],
- // 是否可以Y轴滚动
- scrollY: true,
- // 用户id,请求接口时的参数
- userId: '',
- // 当前页
- currentPage: 1,
- // 每页多少条数据
- pageCount: 5,
- // 列表总数据
- total: 0,
- // 维修费用耗材明细列表
- consumables: [],
- // 当前操作的记录Id
- recordId: ''
- }
- },
- mounted() {
- this.userId = uni.getStorageSync('repairsUserInfo').userId
- this.getRepairCount()
- this.getRepairList()
- },
- methods: {
- // 获取每个状态的订单总数量
- async getRepairCount() {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/getRepairRecordCountByUserId',
- data: {
- userId: this.userId
- }
- })
- // console.log(res)
- if (res.code === '200') {
- this.items = [`未完成(${res.data.incomplete})`, `待支付(${res.data.confirmed})`, `已完成(${res.data.finished})`]
- }
- },
- // 获取订单列表数据
- async getRepairList() {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/getRepairRecordsByUserId',
- data: {
- userId: this.userId,
- currentPage: this.currentPage,
- pageCount: this.pageCount,
- state: this.current - 0 + 1
- }
- })
- // console.log(res)
- if (res.code === '200') {
- res.data.list.forEach((ele) => {
- return (ele.status = false)
- })
- this.list = [...this.list, ...res.data.list]
- this.total = res.data.totalCount
- // 当页面没有数据时,页面禁止滚动
- if (this.list.length === 0) {
- this.scrollY = false
- } else {
- this.scrollY = true
- }
- } else {
- // 请求数据失败页面禁止滚动
- this.scrollY = false
- }
- },
- // 滚动到底部触发回调
- scrolltolower() {
- if (this.total > this.list.length) {
- this.currentPage++
- this.getRepairList()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- },
- // 分段器切换回调
- onClickItem(index) {
- // 清空数组
- this.list = []
- // 重置当前页面可以滚动
- this.scrollY = true
- // 重置请求数据当前页参数
- this.currentPage = 1
- // 改变分段器索引
- this.current = index
- this.getRepairList()
- this.getRepairCount()
- },
- // 转后勤弹窗确定按钮回调
- async handleLogisticsConfirm() {
- if (!this.logisticsValue) {
- uni.showToast({
- title: '留言不能为空',
- icon: 'none'
- })
- return
- }
- const res = await this.$myRequest_repairs({
- url: '/repairLeaveMessage/transferToLogistics',
- method: 'post',
- data: {
- recordId: this.recordId,
- userId: this.userId,
- content: this.logisticsValue
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '转后勤成功',
- icon: 'success',
- mask: true
- })
- this.$refs.popup_logistics.close()
- this.isClick = false
- } else {
- uni.showToast({
- title: res.message,
- icon: 'fail'
- })
- }
- },
- // 催单按钮回调
- handleExpedite(id) {
- uni.showModal({
- title: '提示',
- content: '确定催单吗?',
- success: async (res) => {
- if (res.confirm) {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/repairRecordReminder',
- data: {
- recordId: id
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '催单成功',
- icon: 'success',
- mask: true
- })
- }
- }
- }
- })
- },
- // 撤销按钮回调
- handleRepeal(id) {
- uni.showModal({
- title: '提示',
- content: '确定撤销吗?',
- success: async (res) => {
- if (res.confirm) {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/revokeRepairRecordById',
- method: 'get',
- data: {
- id
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '撤销成功',
- icon: 'success',
- mask: true
- })
- setTimeout(() => {
- this.list = []
- this.currentPage = 1
- this.getRepairList()
- }, 1500)
- }
- }
- }
- })
- },
- // 查看维修费用回调
- checkFeeDetail(item) {
- this.$refs.popup_fee.open('center')
- this.consumables = item.consumables
- this.isClick = true
- },
- // 转后勤按钮回调
- handleBackOffice(item) {
- this.recordId = item.id
- this.isClick = true
- this.$refs.popup_logistics.open('center')
- },
- // 去评价按钮回调
- handleEvaluate(item) {
- let recordId = item.id
- uni.navigateTo({
- url: `/pagesRepairs/evaluate/evaluate?recordId=${recordId}`
- })
- },
- // 点击工单编号区域回调
- handleLookDetail(item) {
- uni.navigateTo({
- url: `/pagesRepairs/repairDetails/repairDetails?id=${item.id}`
- })
- },
- // 点击电话号码回调
- handleCallPhone(phone) {
- uni.makePhoneCall({
- phoneNumber: phone
- })
- },
- // 点击图片回调
- handleLookImgs(img) {
- uni.previewImage({
- urls: img
- })
- },
- // 点击支付按钮回调
- async handlePay(item) {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/pay',
- method: 'post',
- data: {
- recordId: item.id,
- openid: uni.getStorageSync('openId'),
- totalPrice: item.price
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: res.data.timeStamp,
- nonceStr: res.data.nonceStr,
- package: 'prepay_id=' + res.data.prepay_id,
- signType: res.data.signType,
- paySign: res.data.paySign,
- success: (res) => {
- if (res.errMsg == 'requestPayment:ok') {
- uni.showToast({
- title: '支付成功',
- icon: 'success',
- mask: true
- })
- setTimeout(() => {
- // 清空数组
- this.list = []
- // 重置当前页面可以滚动
- this.scrollY = true
- // 重置请求数据当前页参数
- this.currentPage = 1
- this.getRepairList()
- this.getRepairCount()
- }, 1500)
- } else {
- uni.showToast({
- title: '支付失败',
- icon: 'error',
- mask: true
- })
- }
- },
- fail: (err) => {
- if (err.errMsg === 'requestPayment:fail cancel') {
- uni.showToast({
- title: '支付已取消',
- icon: 'none',
- mask: true
- })
- }
- }
- })
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none',
- mask: true
- })
- }
- },
- // 点击录音播放回调
- handlePlayRecording(item) {
- this.list.forEach((ele) => {
- if (ele.id !== item.id) {
- ele.status = false
- }
- })
- innerAudioContext.src = item.voice
- if (!item.status) {
- item.status = true
- innerAudioContext.play()
- //播放结束
- innerAudioContext.onEnded(() => {
- item.status = false
- })
- } else {
- item.status = false
- innerAudioContext.stop()
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- padding: 0 30rpx;
- width: 100vw;
- height: calc(100vh - 152rpx);
- overflow-y: auto;
- // 隐藏滚动条
- ::-webkit-scrollbar {
- width: 0;
- height: 0;
- color: transparent;
- }
- .control {
- display: flex;
- box-sizing: border-box;
- margin: 26rpx 0 29rpx;
- padding: 6rpx;
- width: 100%;
- height: 88rpx;
- border-radius: 18rpx;
- background-color: #f2f2f2;
- .control_item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 76rpx;
- font-size: 32rpx;
- }
- .active {
- border-radius: 18rpx;
- background-color: #fff;
- }
- }
- .body {
- // height: calc(100vh - 190rpx);
- // overflow-y: auto;
- padding-bottom: 25rpx;
- .body_item {
- margin: 10rpx 10rpx 30rpx;
- // height: 799rpx;
- border-radius: 11rpx;
- box-shadow: 0 0 8rpx #d9d9d9;
- .item_title {
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- height: 87rpx;
- border-bottom: 1rpx solid #e6e6e6;
- img {
- width: 30rpx;
- height: 30rpx;
- }
- .title_info {
- margin: 0 21rpx 0 13rpx;
- font-size: 28rpx;
- }
- .title_type {
- width: 137rpx;
- height: 47rpx;
- line-height: 47rpx;
- text-align: center;
- border-radius: 136rpx;
- color: #ff5733;
- font-size: 24rpx;
- border: 1rpx solid #ff5733;
- }
- }
- .item_time {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- height: 79rpx;
- .time_msg {
- font-size: 28rpx;
- color: #808080;
- text {
- color: #000000;
- }
- }
- .time_type {
- font-size: 32rpx;
- color: #ff5733;
- }
- .color_type {
- color: #1e7dfb;
- }
- .color_type2 {
- color: #6fb6b8;
- }
- .color_type3 {
- color: #cccccc;
- }
- }
- .item_box {
- display: flex;
- padding: 0 30rpx;
- line-height: 60rpx;
- font-size: 28rpx;
- .box_key {
- // width: 145rpx;
- color: #808080;
- }
- .box_value {
- max-width: calc(100% - 145rpx);
- display: flex;
- align-items: center;
- img {
- margin-top: 5rpx;
- margin-left: 10rpx;
- width: 28rpx;
- height: 28rpx;
- }
- .recording {
- display: flex;
- align-items: center;
- margin: 15rpx 0;
- width: 130rpx;
- height: 40rpx;
- color: #000;
- border-radius: 100rpx;
- border: 1rpx solid #cccccc;
- .voiceImg {
- margin: 0 12rpx;
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- .box_value2 {
- display: flex;
- align-items: center;
- img {
- margin-top: -2rpx;
- margin-left: 14rpx;
- width: 46rpx;
- height: 46rpx;
- }
- }
- .phone {
- color: #6fb6b8;
- }
- }
- .item_img {
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- height: 120rpx;
- color: #808080;
- font-size: 28rpx;
- .img_key {
- }
- .img_value {
- width: 120rpx;
- height: 120rpx;
- border-radius: 14rpx;
- }
- }
- .item_btn {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding: 0 30rpx;
- height: 153rpx;
- .btn_box {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 16rpx;
- width: 174rpx;
- height: 68rpx;
- font-size: 28rpx;
- border-radius: 11rpx;
- }
- .type {
- color: #fff;
- background-color: #6fb6b8;
- }
- .type2 {
- color: #6fb6b8;
- background-color: #fff;
- border: 1rpx solid #6fb6b8;
- }
- .type3 {
- color: #6fb6b8;
- background-color: #eee;
- }
- }
- .item_btn2 {
- height: 50rpx;
- }
- }
- .pop_fee {
- padding-bottom: 10rpx;
- border-radius: 19rpx;
- background-color: #fff;
- .fee_title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- padding: 0 31rpx 0 42rpx;
- width: 690rpx;
- height: 110rpx;
- font-size: 32rpx;
- font-weight: bold;
- border-radius: 19rpx 19rpx 0 0;
- border-bottom: 1rpx solid #e6e6e6;
- text {
- font-size: 45rpx;
- font-weight: 400;
- color: #808080;
- }
- }
- .fee_list {
- max-height: 50vh;
- overflow-y: auto;
- .fee_item {
- border-bottom: 1rpx solid #e6e6e6;
- .fee_box {
- display: flex;
- align-items: center;
- padding-left: 42rpx;
- height: 80rpx;
- font-size: 28rpx;
- color: #808080;
- text {
- color: #000000;
- }
- }
- }
- }
- }
- .pop_logistics {
- border-radius: 19rpx;
- background-color: #fff;
- .logistics_title {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 690rpx;
- height: 110rpx;
- font-size: 32rpx;
- font-weight: bold;
- border-radius: 19rpx 19rpx 0 0;
- border-bottom: 1rpx solid #e6e6e6;
- }
- .logistics_body {
- height: 440rpx;
- border-bottom: 1rpx solid #e6e6e6;
- textarea {
- box-sizing: border-box;
- margin: 35rpx 40rpx;
- padding: 20rpx;
- width: 610rpx;
- height: 370rpx;
- font-size: 28rpx;
- border-radius: 14rpx;
- border: 1rpx solid #e6e6e6;
- }
- }
- .logistics_btn {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- height: 121rpx;
- .btn_box {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 203rpx;
- height: 72rpx;
- border-radius: 9rpx;
- font-size: 32rpx;
- }
- .cancel {
- background-color: #e5e5e5;
- color: #6fb6b8;
- }
- .confirm {
- background-color: #6fb6b8;
- color: #fff;
- }
- }
- }
- .body_events {
- pointer-events: none;
- }
- .body_no_data {
- text-align: center;
- color: #b3b3b3;
- font-size: 24rpx;
- img {
- margin: 150rpx auto 50rpx;
- width: 480rpx;
- height: 508rpx;
- }
- }
- }
- }
- </style>
|