| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861 |
- <template>
- <scroll-view class="container" :scroll-y="scrollY" @scrolltolower="scrolltolower">
- <view class="top_bg" v-if="dataList.length"></view>
- <view class="body" v-if="dataList.length">
- <!-- 每一个订单区域 -->
- <view class="body_item" :class="{ body_events: isClick }" v-for="item in dataList" :key="item.id" @click="handleGoDetail(item)">
- <!-- 工单编号 -->
- <view class="item_title">
- <img src="../../static/images/repairsImg/order.png" />
- <view class="title_info">工单编号:{{ item.recordNo }}</view>
- </view>
- <!-- 报修时间 -->
- <view class="item_time">
- <view class="time_msg">
- 报修时间:
- <text>{{ item.reportTime }}</text>
- </view>
- <view class="time_type">{{ 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">
- <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.description">
- <view class="box_key">故障描述:</view>
- <view class="box_value">{{ item.description }}</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_btn">
- <img src="../../static/images/repairsImg/close.png" @click.stop="handleClose(item)" />
- <!-- <view class="btn_box type" v-if="btns.includes('延时')" @click.stop="handleDelay(item)">延时</view> -->
- <view class="btn_box type" v-if="btns.includes('接单')" @click.stop="handleOrderReceiving(item)">接单</view>
- <view class="btn_box type2" v-if="btns.includes('派单')" @click.stop="handleSendOrder(item)">派单</view>
- </view>
- </view>
- <!-- 关闭按钮弹窗 -->
- <uni-popup ref="popup_close" :is-mask-click="false">
- <view class="popup_close">
- <view class="close_reason">
- 关单原因:
- <picker @change="bindPickerChange" :value="activeIndex" :range="closeList" range-key="name">
- <view class="picker_input">
- {{ closeList[activeIndex].name }}
- <img src="../../static/images/repairsImg/bottom.png" />
- </view>
- </picker>
- </view>
- <view class="close_note">备注(二选一):</view>
- <view class="close_voice">
- <view class="voice_box" v-if="!recordingPath" @click="handleRecording">
- <img src="../../static/images/repairsImg/voice.png" />
- </view>
- <view v-if="!recordingPath" @click="handleRecording">点击录音</view>
- <view class="item_recording" v-if="recordingPath" @click="handlePlayRecordingPop">
- <img :src="recordingImg" />
- {{ recordingTime }}″
- </view>
- <view class="recording_icon" v-if="recordingPath" @click="handleDeleteRecording">×</view>
- </view>
- <textarea class="close_input" placeholder-style="color:#CCCCCC" placeholder="请输入备注" v-model="closeNote"></textarea>
- <view class="close_btn">
- <view class="btn_box cancel" @click="handleCloseCancel">取消</view>
- <view class="btn_box confirm" @click="handleCloseConfirm">确定</view>
- </view>
- </view>
- </uni-popup>
- <!-- 录音弹窗区域 -->
- <uni-popup :safe-area="true" background-color="#fff" ref="popup_recording">
- <view class="popup_recording">
- <recording @getTempFilePath="getTempFilePath" />
- </view>
- </uni-popup>
- </view>
- <!-- 没有数据时展示的图片 -->
- <view class="no_data" v-if="dataList.length === 0">
- <img src="../../pagesClockIn/static/imgs/nodata.png" />
- <view>暂无数据</view>
- </view>
- </scroll-view>
- </template>
- <script>
- import recording from '../components/recording.vue'
- const innerAudioContext = uni.createInnerAudioContext()
- export default {
- components: {
- recording
- },
- data() {
- return {
- scrollY: true,
- // 按钮权限
- btns: [],
- // 关闭按钮弹窗当前索引
- activeIndex: 0,
- // 关闭按钮弹窗选项数组
- closeList: [],
- // 工单数据数组
- dataList: [],
- // 当前页
- currentPage: 1,
- // 每页多少条
- pageCount: 4,
- // 总条数
- total: null,
- // 用户ID
- userId: '',
- // 订单id
- orderId: '',
- // 校区Id
- schoolId: '',
- // 每一个订单点击时是否触发事件 true 不触发 false 触发
- isClick: false,
- // 关闭订单备注
- closeNote: '',
- // 录音文件路径
- recordingPath: '',
- // 录音时长
- recordingTime: 0,
- // 录音图片地址
- recordingImg: '../../static/images/repairsImg/recording.jpg',
- // 播放状态
- playStatus: false,
- // 定时器标识
- timer: null
- }
- },
- mounted() {
- const repairsUserInfo = uni.getStorageSync('repairsUserInfo')
- this.userId = repairsUserInfo.userId
- this.btns = repairsUserInfo.btns
- this.schoolId = repairsUserInfo.schoolId
- this.getData()
- this.getCloseList()
- },
- methods: {
- // 滚动到底部触发回调
- scrolltolower() {
- if (this.total > this.dataList.length) {
- this.currentPage++
- this.getData()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- },
- // 获取关闭订单原因数组
- async getCloseList() {
- const res = await this.$myRequest_repairs({
- url: '/repairClose/queryRepairCloses'
- })
- // console.log(res)
- if (res.code === '200') {
- this.closeList = res.data
- }
- },
- // 获取待处理订单数据
- async getData() {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/queryPendingOrder',
- data: {
- currentPage: this.currentPage,
- pageCount: this.pageCount,
- schoolId: this.schoolId
- }
- })
- // console.log(res)
- if (res.code === '200') {
- this.total = res.data.totalCount
- res.data.list.forEach((ele) => {
- return (ele.status = false)
- })
- this.dataList = [...this.dataList, ...res.data.list]
- }
- },
- // 接单按钮回调
- handleOrderReceiving(item) {
- uni.showModal({
- content: '确定接单吗?',
- title: '提示',
- success: async (res) => {
- if (res.confirm) {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/receiveOrders',
- data: {
- recordId: item.id,
- userId: this.userId
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '接单成功',
- icon: 'success',
- mask: true
- })
- setTimeout(() => {
- this.dataList = []
- this.currentPage = 1
- this.getData()
- }, 1500)
- }
- }
- }
- })
- },
- // 关闭图标点击回调
- handleClose(item) {
- this.isClick = true
- this.orderId = item.id
- this.$refs.popup_close.open('center')
- },
- // 关闭弹窗确定按钮回调
- handleCloseConfirm() {
- if (this.closeNote && this.recordingPath) {
- uni.showToast({
- title: '录音和备注二选一,不能同时选择',
- icon: 'none',
- mask: true
- })
- return
- }
- if (!this.closeNote && !this.recordingPath) {
- uni.showToast({
- title: '请录音或者输入备注,二选一',
- icon: 'none',
- mask: true
- })
- return
- }
- uni.showModal({
- title: '提示',
- content: '确定关闭订单吗?',
- success: async (res) => {
- if (res.confirm) {
- const res = await this.$myRequest_repairs({
- url: '/repairRecord/closeOrder',
- data: {
- recordId: this.orderId,
- userId: this.userId,
- reason: this.closeList[this.activeIndex].name,
- remark: this.recordingPath ? this.recordingPath : this.closeNote,
- voiceLength: this.recordingPath ? this.recordingTime : ''
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '关单成功',
- icon: 'success',
- mask: true
- })
- this.handleCloseCancel()
- setTimeout(() => {
- this.dataList = []
- this.currentPage = 1
- this.getData()
- }, 1500)
- }
- this.isClick = false
- }
- }
- })
- },
- // 关闭按钮弹窗选中按钮时回调
- handleChangeItem(val) {
- this.activeIndex = val
- },
- // 延时按钮回调
- handleDelay(item) {
- uni.navigateTo({
- url: `/pagesRepairs/delay/delay?id=${item.id}`
- })
- },
- // 派单按钮回调
- handleSendOrder(item) {
- uni.navigateTo({
- url: `/pagesRepairs/helpPeople/helpPeople?type=1&id=${item.id}`
- })
- },
- // 点击电话号码回调
- handleCallPhone(phone) {
- // console.log(phone)
- uni.makePhoneCall({
- phoneNumber: phone
- })
- },
- // 点击图片回调
- handleLookImgs(img) {
- // console.log(img)
- uni.previewImage({
- urls: img
- })
- },
- // 点击录音播放回调
- handlePlayRecording(item) {
- this.dataList.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()
- }
- },
- // 点击每一个订单回调
- handleGoDetail(item) {
- uni.navigateTo({
- url: `/pagesRepairs/repairDetails/repairDetails?id=${item.id}`
- })
- },
- // 关闭按钮弹窗选中按钮时回调
- bindPickerChange(e) {
- this.activeIndex = e.detail.value
- },
- // 点击录音按钮回调
- handleRecording() {
- uni.getSetting({
- success: (res) => {
- if (!res.authSetting['scope.record']) {
- uni.authorize({
- scope: 'scope.record',
- success(res) {
- // 授权成功
- uni.showToast({
- title: '授权成功',
- icon: 'none'
- })
- },
- fail() {
- uni.showModal({
- content: '检测到您没打开麦克风权限,是否去设置打开?',
- confirmText: '确认',
- cancelText: '取消',
- success: (res) => {
- if (res.confirm) {
- uni.openSetting({
- success: (res) => {}
- })
- } else {
- uni.showToast({
- title: '获取麦克风权限失败',
- icon: 'none'
- })
- }
- }
- })
- }
- })
- } else {
- this.$refs.popup_recording.open('bottom')
- }
- },
- fail() {
- uni.showToast({
- title: '获取麦克风权限失败',
- icon: 'none'
- })
- }
- })
- },
- // 点击录音播放回调
- handlePlayRecordingPop() {
- innerAudioContext.src = this.recordingPath
- if (!this.playStatus) {
- this.playStatus = true
- innerAudioContext.play()
- this.timer = setInterval(() => {
- if (this.recordingImg == '../../static/images/repairsImg/recording.jpg') {
- this.recordingImg = '../../static/images/repairsImg/recording2.jpg'
- } else if (this.recordingImg == '../../static/images/repairsImg/recording2.jpg') {
- this.recordingImg = '../../static/images/repairsImg/recording3.jpg'
- } else if (this.recordingImg == '../../static/images/repairsImg/recording3.jpg') {
- this.recordingImg = '../../static/images/repairsImg/recording.jpg'
- }
- }, 300)
- //播放结束
- innerAudioContext.onEnded(() => {
- clearInterval(this.timer)
- this.timer = null
- this.recordingImg = '../../static/images/repairsImg/recording.jpg'
- this.playStatus = false
- })
- } else {
- clearInterval(this.timer)
- this.recordingImg = '../../static/images/repairsImg/recording.jpg'
- this.playStatus = false
- innerAudioContext.stop()
- }
- },
- // 删除录音回调
- handleDeleteRecording() {
- if (this.playStatus) {
- uni.showToast({
- title: '播放中不能删除',
- icon: 'none',
- mask: true
- })
- } else {
- uni.showModal({
- title: '提示',
- content: '确定删除录音吗?',
- success: (res) => {
- if (res.confirm) {
- this.recordingPath = ''
- this.recordingTime = 0
- }
- }
- })
- }
- },
- // 关闭弹窗取消按钮回调
- handleCloseCancel() {
- this.isClick = false
- this.activeIndex = 0
- this.recordingPath = ''
- this.recordingTime = 0
- this.closeNote = ''
- this.$refs.popup_close.close()
- },
- // 自定义事件回调,获取录音文件路径
- getTempFilePath(path, time) {
- this.recordingPath = path
- this.recordingTime = time
- this.$refs.popup_recording.close()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100vw;
- height: calc(100vh - 152rpx);
- font-size: 32rpx;
- overflow-y: auto;
- .top_bg {
- height: 165rpx;
- background-color: #6fb6b8;
- }
- .body {
- box-sizing: border-box;
- margin: auto;
- margin-top: -100rpx;
- padding: 2rpx;
- width: 690rpx;
- border-radius: 11rpx 11rpx 0 0;
- background-color: #fff;
- overflow-y: auto;
- .body_item {
- margin-bottom: 20rpx;
- padding-bottom: 35rpx;
- 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;
- }
- }
- .item_time {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- height: 79rpx;
- .time_msg {
- color: #808080;
- text {
- color: #000000;
- }
- }
- .time_type {
- font-size: 32rpx;
- color: #ff5733;
- }
- }
- .item_box {
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- line-height: 60rpx;
- .box_key {
- width: 160rpx;
- color: #808080;
- }
- .box_value {
- flex: 1;
- max-width: calc(100% - 160rpx);
- display: flex;
- align-items: center;
- img {
- margin-left: 10rpx;
- width: 45rpx;
- height: 45rpx;
- }
- .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;
- }
- }
- }
- .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;
- margin-top: 35rpx;
- img {
- margin-right: auto;
- width: 56rpx;
- height: 56rpx;
- }
- .btn_box {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 16rpx;
- width: 174rpx;
- height: 68rpx;
- border-radius: 11rpx;
- }
- .type {
- color: #fff;
- background-color: #6fb6b8;
- }
- .type2 {
- color: #6fb6b8;
- background-color: #fff;
- border: 1rpx solid #6fb6b8;
- }
- }
- }
- .popup_close {
- // width: 690rpx;
- // border-radius: 19rpx;
- // background-color: #fff;
- // .close_box {
- // height: 100rpx;
- // line-height: 100rpx;
- // text-align: center;
- // font-size: 32rpx;
- // border: 1rpx solid #e6e6e6;
- // }
- // .radius {
- // border-radius: 19rpx 19rpx 0 0;
- // }
- // .active {
- // color: #fff;
- // background-color: #6fb6b8;
- // }
- // .close_btn {
- // display: flex;
- // align-items: center;
- // justify-content: space-evenly;
- // margin-top: 100rpx;
- // 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;
- // }
- // }
- width: 690rpx;
- border-radius: 19rpx;
- background-color: #fff;
- .close_reason {
- padding-top: 50rpx;
- margin-left: 80rpx;
- display: flex;
- align-items: center;
- .picker_input {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10rpx 20rpx;
- width: 300rpx;
- border-radius: 14rpx;
- border: 1rpx solid #e6e6e6;
- img {
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- .close_note {
- margin: 20rpx 0 20rpx 80rpx;
- }
- .close_voice {
- display: flex;
- align-items: center;
- margin-top: 30rpx;
- margin-left: 80rpx;
- width: 500rpx;
- height: 94rpx;
- font-size: 32rpx;
- color: #cccccc;
- border-radius: 10rpx;
- border: 1rpx solid #cccccc;
- .voice_box {
- display: flex;
- justify-content: center;
- align-items: center;
- margin: 0 38rpx 0 33rpx;
- width: 101rpx;
- height: 47rpx;
- border-radius: 33rpx;
- box-shadow: 0px 0px 4rpx rgba(0, 0, 0, 0.25);
- img {
- width: 33rpx;
- height: 33rpx;
- }
- }
- .item_recording {
- margin-left: 35rpx;
- display: flex;
- align-items: center;
- width: 230rpx;
- height: 65rpx;
- color: #000;
- border-radius: 100rpx;
- border: 1rpx solid #cccccc;
- img {
- margin: 0 12rpx;
- width: 40rpx;
- height: 40rpx;
- }
- }
- .recording_icon {
- margin-left: auto;
- margin-right: 35rpx;
- font-size: 40rpx;
- }
- }
- .close_input {
- box-sizing: border-box;
- margin: 35rpx 40rpx 35rpx 80rpx;
- padding: 20rpx;
- width: 520rpx;
- height: 312rpx;
- border-radius: 14rpx;
- border: 1rpx solid #e6e6e6;
- }
- .close_btn {
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- margin-top: 100rpx;
- 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;
- }
- }
- }
- .popup_recording {
- width: 100%;
- height: 460rpx;
- background-color: #fff;
- }
- .body_events {
- pointer-events: none;
- }
- }
- .no_data {
- text-align: center;
- color: #b3b3b3;
- font-size: 24rpx;
- img {
- margin: 215rpx auto 0;
- width: 480rpx;
- height: 508rpx;
- }
- }
- }
- </style>
|