1
This commit is contained in:
parent
4346afe5ab
commit
05bf3832ab
@ -303,6 +303,7 @@ export default {
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
bus.$emit('choosePeople')
|
||||
}, 700)
|
||||
})
|
||||
}
|
||||
@ -332,6 +333,7 @@ export default {
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
bus.$emit('choosePeople')
|
||||
}, 700)
|
||||
})
|
||||
}
|
||||
|
@ -286,7 +286,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="isDetail == '0'" class="foot">
|
||||
<view v-if="isDetail == '0' && null!=ticketInfo" class="foot">
|
||||
<view class="submit" @click="submit">保存工单</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -334,7 +334,7 @@ import {bus} from "@/utils/eventBus";
|
||||
import request from '@/utils/request';
|
||||
import upload from '@/utils/upload'
|
||||
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
|
||||
import {getUserInfo,setJSONData,getJSONData,setStorageWithExpiry,getStorageWithExpiry} from '@/utils/auth'
|
||||
import {getToken,getUserInfo,setJSONData,getJSONData,setStorageWithExpiry,getStorageWithExpiry} from '@/utils/auth'
|
||||
import config from '@/config'
|
||||
export default {
|
||||
components: {
|
||||
@ -403,37 +403,47 @@ export default {
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// demo 是要深度监听的值
|
||||
ticketInfo: {
|
||||
handler(newVal, oldVal) {
|
||||
console.log(newVal, "有变化");
|
||||
setJSONData("projects",newVal.projects)
|
||||
},
|
||||
// 开启深度监听
|
||||
deep: true
|
||||
}
|
||||
// ticketInfo: {
|
||||
// handler(newVal, oldVal) {
|
||||
// console.log(newVal, "有变化");
|
||||
// setJSONData("projects",newVal.projects)
|
||||
// },
|
||||
// // 开启深度监听
|
||||
// deep: true
|
||||
// }
|
||||
},
|
||||
onLoad(data) {
|
||||
this.loginUser = getUserInfo()
|
||||
this.canSeeMoney = !this.loginUser.roleCodes.includes('repair_staff');
|
||||
console.log(this.loginUser,294)
|
||||
console.log(data)
|
||||
if (data.id) {
|
||||
this.ticketId = data.id
|
||||
}
|
||||
if (data.isDetail){
|
||||
this.isDetail = data.isDetail
|
||||
if(!getToken()){
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}else {
|
||||
this.loginUser = getUserInfo()
|
||||
this.canSeeMoney = !this.loginUser.roleCodes.includes('repair_staff');
|
||||
console.log(this.loginUser, 294)
|
||||
console.log(data)
|
||||
if (data.id) {
|
||||
this.ticketId = data.id
|
||||
}
|
||||
if (data.isDetail) {
|
||||
this.isDetail = data.isDetail
|
||||
}
|
||||
this.refreshData(false)
|
||||
}
|
||||
},
|
||||
onShow(){
|
||||
//获取订单详情
|
||||
this.getOrderDetail()
|
||||
//查维修进度记录
|
||||
this.getProjItem()
|
||||
//获取当前订单是否有审批的配件
|
||||
this.waresByTicket()
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* 刷新数据通用方法
|
||||
*/
|
||||
refreshData(cache){
|
||||
//获取订单详情
|
||||
this.getOrderDetail(cache)
|
||||
//查维修进度记录
|
||||
this.getProjItem()
|
||||
//获取当前订单是否有审批的配件
|
||||
this.waresByTicket()
|
||||
},
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
@ -516,28 +526,30 @@ export default {
|
||||
})
|
||||
}
|
||||
//修改配件的信息
|
||||
if(this.ticketInfo.wares && this.ticketInfo.wares.length>0){
|
||||
this.ticketInfo.wares.map((item)=>{
|
||||
//不校验项目金额、折扣、数量必填,但是为null的设置为0
|
||||
if(!item.itemPrice){
|
||||
item.itemPrice = 0
|
||||
}
|
||||
if(!item.itemCount){
|
||||
item.itemCount = 0
|
||||
}
|
||||
if(!item.itemDiscount){
|
||||
item.itemDiscount = 1
|
||||
}
|
||||
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
|
||||
let itemObj = {
|
||||
id:item.id,
|
||||
ticketId:item.ticketId,
|
||||
itemPrice:item.itemPrice,
|
||||
itemCount:item.itemCount,
|
||||
itemDiscount:item.itemDiscount,
|
||||
itemMoney:item.itemMoney,
|
||||
}
|
||||
itemList.push(itemObj)
|
||||
if(this.ticketInfo.waresGroupList && this.ticketInfo.waresGroupList.length>0){
|
||||
this.ticketInfo.waresGroupList.map((groupItem)=>{
|
||||
groupItem.wares.map((item)=>{
|
||||
//不校验项目金额、折扣、数量必填,但是为null的设置为0
|
||||
if(!item.itemPrice){
|
||||
item.itemPrice = 0
|
||||
}
|
||||
if(!item.itemCount){
|
||||
item.itemCount = 0
|
||||
}
|
||||
if(!item.itemDiscount){
|
||||
item.itemDiscount = 1
|
||||
}
|
||||
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
|
||||
let itemObj = {
|
||||
id:item.id,
|
||||
ticketId:item.ticketId,
|
||||
itemPrice:item.itemPrice,
|
||||
itemCount:item.itemCount,
|
||||
itemDiscount:item.itemDiscount,
|
||||
itemMoney:item.itemMoney,
|
||||
}
|
||||
itemList.push(itemObj)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@ -697,14 +709,16 @@ export default {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
},500)
|
||||
}
|
||||
if("other"==this.nowChooseOperate){
|
||||
}else if("other"==this.nowChooseOperate){
|
||||
//移交下一班组维修,需要指派下一个维修人
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url: '/pages-order/choosePeople/choosePeople?id=' + this.ticketInfo.id+'&itemId='+this.nowRepair.repairItemId +'&ifDetail=true'
|
||||
})
|
||||
},500)
|
||||
}else{
|
||||
//停留当前页面,刷新数据
|
||||
this.refreshData(false)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -899,7 +913,7 @@ export default {
|
||||
try {
|
||||
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
|
||||
//刷新数据
|
||||
this.getOrderDetail()
|
||||
this.refreshData(false)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
@ -955,7 +969,7 @@ export default {
|
||||
/**
|
||||
* 查看订单详情
|
||||
*/
|
||||
getOrderDetail(){
|
||||
getOrderDetail(cache){
|
||||
request({
|
||||
url: '/admin-api/repair/tickets/get',
|
||||
method: 'get',
|
||||
@ -994,25 +1008,27 @@ export default {
|
||||
item.createTime = formatTimestamp(item.createTime)
|
||||
})
|
||||
}
|
||||
//从缓存中获取项目的信息替换掉
|
||||
let projects = getJSONData("projects")
|
||||
let projectMap = new Map();
|
||||
if(projects){
|
||||
//转key value形式
|
||||
projects.map((item)=>{
|
||||
projectMap.set(item.id,item)
|
||||
})
|
||||
resultObj.projects = resultObj.projects.map((item)=>{
|
||||
if(projectMap.has(item.id)){
|
||||
console.log(projectMap.get(item.id))
|
||||
let localObj = projectMap.get(item.id)
|
||||
item.itemPrice = localObj.itemPrice
|
||||
item.itemCount = localObj.itemCount
|
||||
item.itemDiscount = localObj.itemDiscount
|
||||
item.itemMoney = localObj.itemMoney
|
||||
}
|
||||
return item
|
||||
})
|
||||
if(cache){
|
||||
//从缓存中获取项目的信息替换掉
|
||||
let projects = getJSONData("projects")
|
||||
let projectMap = new Map();
|
||||
if(projects){
|
||||
//转key value形式
|
||||
projects.map((item)=>{
|
||||
projectMap.set(item.id,item)
|
||||
})
|
||||
resultObj.projects = resultObj.projects.map((item)=>{
|
||||
if(projectMap.has(item.id)){
|
||||
console.log(projectMap.get(item.id))
|
||||
let localObj = projectMap.get(item.id)
|
||||
item.itemPrice = localObj.itemPrice
|
||||
item.itemCount = localObj.itemCount
|
||||
item.itemDiscount = localObj.itemDiscount
|
||||
item.itemMoney = localObj.itemMoney
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$nextTick(()=>{
|
||||
this.ticketInfo = resultObj
|
||||
@ -1060,16 +1076,13 @@ export default {
|
||||
})
|
||||
},
|
||||
editPeople(type, proj) {
|
||||
//需要选施工人员,记录缓存
|
||||
setJSONData("projects",this.ticketInfo.projects)
|
||||
bus.$off('choosePeople')
|
||||
bus.$on('choosePeople', (data) => {
|
||||
console.log('choosePeople', data)
|
||||
console.log('type', type)
|
||||
if (type === 'xs') {
|
||||
proj.salesman = data
|
||||
} else if (type === 'sg') {
|
||||
proj.constructor = data
|
||||
}
|
||||
console.log('proj', proj)
|
||||
//需要将缓存中的值取出来
|
||||
this.refreshData(true)
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}&projectId=${proj.projectId}`
|
||||
|
Loading…
Reference in New Issue
Block a user