This commit is contained in:
SelfRidicule 2024-08-15 16:02:52 +08:00
parent f5b21e6bba
commit 938741f5c8
2 changed files with 59 additions and 7 deletions

View File

@ -17,12 +17,20 @@ Page({
data: { data: {
IMG_NAME: app.IMG_NAME, IMG_NAME: app.IMG_NAME,
title: '详情', title: '详情',
userDetail: {},
id: '', id: '',
detail: {}, detail: {},
files: {}, files: {},
currentLog: {}, currentLog: {},
innerAudioContext: null, // 音频对象 innerAudioContext: null, // 音频对象
innerAudioContextIsPlay: false, // 音频对象-是否播放 innerAudioContextIsPlay: false, // 音频对象-是否播放
operatorBtn: {
invalid: false, //无效申请
affirm: false, // 确认损坏
feedback: false, // 提交反馈
again: false, // 重新派单
evaluate: false, // 评价
}
}, },
/** /**
@ -31,8 +39,11 @@ Page({
onLoad(options) { onLoad(options) {
console.log('onLoad', options); console.log('onLoad', options);
let _this = this let _this = this
let userDetail = wx.getStorageSync('user')
_this.setData({ _this.setData({
...options ...options,
userDetail
}) })
_this.getDetail(options.id) _this.getDetail(options.id)
}, },
@ -85,11 +96,52 @@ Page({
} else { } else {
detail.visibleImg = app.IMG_NAME + '/profile/static/repair/index/noneImg.png' detail.visibleImg = app.IMG_NAME + '/profile/static/repair/index/noneImg.png'
} }
//
_this.setData({ _this.setData({
detail, detail,
files files
}) })
// 初始化按钮
_this.initOperatorBtn()
})
},
// 初始化按钮
initOperatorBtn() {
console.log('initOperatorBtn', 111);
let _this = this
let userDetail = _this.data.userDetail
let detail = _this.data.detail
let operatorBtn = _this.data.operatorBtn
// 登录用户id
let loginUserId = userDetail.id
// 订单状态
let status = detail.status
// 角色类型
let dataType = userDetail.dataType
//
// 角色类型 1.普通用户3派单员5维修工7管理员
// 订单状态 1 待派单,3 重新派单,5 已派单,7 处理中, 9已完成 待评价, 11 已关闭 13 已评价
//
if (status == 1) { // 1 待派单
if ((dataType == 3) || dataType == 7) { // 派单员 or 管理员
operatorBtn.invalid = true //无效申请
operatorBtn.affirm = true // 确认损坏
operatorBtn.feedback = true // 提交反馈
}
}
if (status == 3) { // 3 重新派单
if (dataType == 7) { // 管理员
operatorBtn.again = true //重新派单
}
}
if (status == 9) { // 9已完成 待评价
if (loginUserId == detail.createBy) { // 创建报修单的人才能评价
operatorBtn.evaluate = true //评价
}
}
_this.setData({
operatorBtn
}) })
}, },

View File

@ -156,14 +156,14 @@
</view> </view>
<view class="bottomFixView"> <view class="bottomFixView">
<view class="btn red" bind:tap="jumpInvalid">无效申请</view> <view class="btn red" bind:tap="jumpInvalid" wx:if="{{operatorBtn.invalid}}">无效申请</view>
<view class="btn" bind:tap="jumpAffirm">确认损坏</view> <view class="btn" bind:tap="jumpAffirm" wx:if="{{operatorBtn.affirm}}">确认损坏</view>
<view class="btn" bind:tap="jumpFeedback">提交反馈</view> <view class="btn" bind:tap="jumpFeedback" wx:if="{{operatorBtn.feedback}}">提交反馈</view>
<view class="btn" bind:tap="jumpAgain">重新派单</view> <view class="btn" bind:tap="jumpAgain" wx:if="{{operatorBtn.again}}">重新派单</view>
<view class="btn">分享 <view class="btn">分享
<button catch class="shareBtn" open-type="share" data-obj="{{item}}">转发</button> <button catch class="shareBtn" open-type="share" data-obj="{{item}}">转发</button>
</view> </view>
<view class="btn red" bind:tap="jumpEvaluate">评价</view> <view class="btn red" bind:tap="jumpEvaluate" wx:if="{{operatorBtn.evaluate}}">评价</view>
</view> </view>
</view> </view>