274 lines
5.8 KiB
JavaScript
274 lines
5.8 KiB
JavaScript
|
var myRequest = require("../../utils/api.js");
|
||
|
const innerAudioContext = wx.createInnerAudioContext({
|
||
|
useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
|
||
|
})
|
||
|
// pages/mainprogress/index.js
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
autosize:{
|
||
|
minHeight: 70
|
||
|
},
|
||
|
orderStatus:'',
|
||
|
filePath:'',
|
||
|
isPlay:false,
|
||
|
playText:'播放',
|
||
|
orderName:'',
|
||
|
orderNameDict:{
|
||
|
1:{
|
||
|
btnName:'开始接单',
|
||
|
titleName:'待师傅接单',
|
||
|
titleTip:'用户已提交 ,等待师傅接单'
|
||
|
},
|
||
|
2:{
|
||
|
btnName:'开始签到',
|
||
|
titleName:'待师傅签到',
|
||
|
titleTip:'师傅已接单,等待上门维修'
|
||
|
},
|
||
|
3:{
|
||
|
btnName:'开始维修',
|
||
|
titleName:'待师傅维修',
|
||
|
titleTip:'师傅已上门,维修中'
|
||
|
},
|
||
|
4:{
|
||
|
btnName:'维修完成',
|
||
|
titleName:'维修完成',
|
||
|
titleTip:'以维修完成,等待客户确认'
|
||
|
},
|
||
|
5:{
|
||
|
|
||
|
titleName:'客户已确认',
|
||
|
titleTip:'客户确认成功,等待主管确认'
|
||
|
},
|
||
|
6:{
|
||
|
|
||
|
titleName:'主管已确认',
|
||
|
titleTip:'主管确认成功,等待财务打款'
|
||
|
},
|
||
|
7:{
|
||
|
|
||
|
titleName:'财务已打款',
|
||
|
titleTip:'财务已打款,请查收'
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
userInfo:{
|
||
|
contactName:'',
|
||
|
contactPhone:'',
|
||
|
faultDesc:''
|
||
|
},
|
||
|
orderId:'',
|
||
|
device:{
|
||
|
name:'',
|
||
|
address:'',
|
||
|
},
|
||
|
actionTime:'',
|
||
|
actionAddress:'',
|
||
|
completedata:{},
|
||
|
bankReceiptData:{}
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(options) {
|
||
|
|
||
|
this.setData({
|
||
|
orderId:options.id
|
||
|
})
|
||
|
this.init()
|
||
|
this.getActionList()
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
//播放声音
|
||
|
playCorder: function () {
|
||
|
|
||
|
if(!this.data.filePath){
|
||
|
wx.showToast({
|
||
|
title: '请录音后播放!',
|
||
|
icon: 'none',
|
||
|
duration: 1500
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
if(this.data.isPlay){
|
||
|
wx.showToast({
|
||
|
title: '播放中。。。。',
|
||
|
icon: 'none',
|
||
|
duration: 1500
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
|
||
|
innerAudioContext.src = this.data.filePath,
|
||
|
innerAudioContext.play()
|
||
|
innerAudioContext.onPlay(() => {
|
||
|
console.log('开始播放')
|
||
|
this.setData({
|
||
|
playText:'播放中。。。',
|
||
|
|
||
|
isPlay:true,
|
||
|
})
|
||
|
|
||
|
})
|
||
|
innerAudioContext.onEnded(()=>{
|
||
|
clearInterval(this.data.timer);
|
||
|
this.setData({
|
||
|
isPlay:false,
|
||
|
playText:'播放',
|
||
|
})
|
||
|
|
||
|
console.log('结束播放')
|
||
|
})
|
||
|
innerAudioContext.onError((res) => {
|
||
|
console.log(res.errMsg)
|
||
|
console.log(res.errCode)
|
||
|
})
|
||
|
},
|
||
|
getActionList(){
|
||
|
let that =this;
|
||
|
myRequest.myRequest('deviceRepairOrder/action/list/'+this.data.orderId,{
|
||
|
},'get').then(res=>{
|
||
|
let signdata ,completedata ,bankReceiptData
|
||
|
res.data.forEach(item=>{
|
||
|
if(item.actionType==3){
|
||
|
signdata = item
|
||
|
}else if(item.actionType ==4){
|
||
|
completedata =item.actionInfo
|
||
|
}else if(item.actionType ==7){
|
||
|
bankReceiptData = item.actionInfo
|
||
|
|
||
|
}
|
||
|
|
||
|
})
|
||
|
|
||
|
that.setData({
|
||
|
actionTime:signdata?.actionTime,
|
||
|
actionAddress:signdata?.actionInfo?.location,
|
||
|
completedata:completedata,
|
||
|
bankReceiptData:bankReceiptData
|
||
|
})
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
})
|
||
|
},
|
||
|
init(){
|
||
|
myRequest.myRequest('deviceRepairOrder/supporter/orderDetail/'+this.data.orderId,{
|
||
|
},'get').then(res=>{
|
||
|
let info = res.data
|
||
|
let address=info.device.provinceName+info.device.cityName+info.device.areaName+info.device.townName+info.device.community
|
||
|
this.setData({
|
||
|
userInfo:info,
|
||
|
orderStatus:info.orderStatus,
|
||
|
filePath:info.faultVoice,
|
||
|
device:{
|
||
|
name:info.device.name,
|
||
|
address,
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
btnClick(){
|
||
|
if(this.data.orderStatus==1){
|
||
|
wx.showModal({
|
||
|
title: '提示',
|
||
|
content: '确定是否接单',
|
||
|
complete: (res) => {
|
||
|
if (res.cancel) {
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
if (res.confirm) {
|
||
|
myRequest.myRequest('deviceRepairOrder/supporter/accept/'+this.data.userInfo.orderId,{
|
||
|
},'post').then(res=>{
|
||
|
wx.showToast({
|
||
|
title: '接单成功',
|
||
|
icon:'none'
|
||
|
})
|
||
|
|
||
|
this.init()
|
||
|
})
|
||
|
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
}else if(this.data.orderStatus==2){
|
||
|
wx.navigateTo({
|
||
|
url: '../sign/index?item='+JSON.stringify(this.data.userInfo),
|
||
|
})
|
||
|
}else if(this.data.orderStatus==3){
|
||
|
wx.navigateTo({
|
||
|
url: '../maintenance/index?item='+JSON.stringify(this.data.userInfo),
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
|
||
|
gotoSing(){
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage() {
|
||
|
|
||
|
}
|
||
|
})
|