This commit is contained in:
Vinjor 2024-10-31 19:05:38 +08:00
parent 704fd7c309
commit 0ecaa68ae1
3 changed files with 189 additions and 15 deletions

81
App.vue
View File

@ -1,8 +1,85 @@
<script>
import config from '@/config'
import request from '@/utils/request';
export default {
onLaunch: function() {
console.log('App Launch')
console.log('app lunch');
let version = config.appInfo.version
request({
url:'/admin-api/system/config/configKey/repairVersion',
method: 'get',
params:''
}).then(res => {
console.log(res,1444);
if (res.code == 200 && res.data &&res.data != version){
uni.showModal({
title:'版本升级',
content:'新版本上线了,根据您自己的选择是否升级',
showCancel: true,
confirmText:'升级',
success: res => {
if (res.cancel) return;
let waiting = plus.nativeUI.showWaiting("正在下载 - 0%");
// uni.showLoading({
// title: ''
// });
// wgt
const downloadTask = uni.downloadFile({
url:'http://159.75.168.143:88/apk/repairWorker.apk',
success: res => {
if (res.statusCode !== 200) {
console.error('下载安装包失败', err);
return;
}
//
plus.runtime.install(res.tempFilePath, {
force: false
}, () => {
uni.hideLoading()
if (is_mandatory) {
//app
plus.runtime.restart();
return;
}
uni.showModal({
title: '安装成功是否重启?',
success: res => {
if (res.confirm) {
//app
plus.runtime.restart();
}
}
});
}, err => {
uni.hideLoading()
uni.showModal({
title: '更新失败',
content: err.message,
showCancel: false
});
});
},
//
complete: ()=>{
uni.hideLoading();
downloadTask.offProgressUpdate();//
}
});
//
downloadTask.onProgressUpdate(res => {
// state.percent = res.progress;
waiting.setTitle("正在下载 - "+res.progress+"%");
// console.log(':' + res.progress); //
// console.log(':' + res.totalBytesWritten); // Bytes
// console.log(':' + res.totalBytesExpectedToWrite); // Bytes
});
}
});
}
})
},
onShow: function() {
console.log('App Show')

View File

@ -125,7 +125,16 @@
<text>{{ item.itemName }}</text>
<text v-if="canSeeMoney" class="projAmount">{{ item.itemMoney }}</text>
</view>
<view class="projBaseInfo" v-if="loginUser.roleCodes.includes('weixiu') || loginUser.roleCodes.includes('service_advisor')||loginUser.roleCodes.includes('general_inspection')" >
<view class="projBaseInfo" v-if="(loginUser.roleCodes.includes('weixiu') || loginUser.roleCodes.includes('service_advisor')||loginUser.roleCodes.includes('general_inspection')) && isDetail == '0'" >
<!-- 可编辑-->
<view v-if="canSeeMoney">售价<input @input="onKeyInput('sj',item)" style="background: white;padding: 0 10rpx" type="decimal" placeholder="请输入售价" v-model="item.itemPrice" /></view>
<view>数量<input @input="onKeyInput('sl',item)" style="background: white;padding: 0 10rpx" type="number" placeholder="请输入数量" v-model="item.itemCount" /></view>
<!-- <view>单位{{ item.itemUnit}}</view>-->
<view v-if="canSeeMoney">折扣<input @input="onKeyInput('zk',item)" style="background: white;padding: 0 10rpx" type="decimal" placeholder="请输入折扣0-1" v-model="item.itemDiscount" /></view>
<view v-if="canSeeMoney">金额<input type="number" disabled placeholder="请输入售价" v-model="item.itemMoney" /></view>
</view>
<view v-else class="projBaseInfo" v-if="(loginUser.roleCodes.includes('weixiu') || loginUser.roleCodes.includes('service_advisor')||loginUser.roleCodes.includes('general_inspection')) && isDetail != '0'" >
<!-- 只读 -->
<view v-if="canSeeMoney">售价{{ item.itemPrice || "" }}</view>
<view>数量{{ item.itemCount || "" }}</view>
<!-- <view>单位{{ item.itemUnit}}</view>-->
@ -399,6 +408,26 @@ export default {
this.waresByTicket()
},
methods: {
/**
* 监听输入框
*/
onKeyInput(type,item){
this.$nextTick(()=>{
if("zk"==type && (item.itemDiscount<0 || item.itemDiscount>1)){
uni.showToast({
title: '请输入正确的折扣数字0-1',
icon: 'none'
})
item.itemDiscount=1
return
}
if((item.itemPrice && item.itemPrice>0) && (item.itemCount && item.itemCount>0) && (item.itemDiscount && item.itemDiscount>0 && item.itemDiscount<=1)){
//
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
}
})
console.log(item,"item")
},
/**
* 预览图片
*/
@ -413,9 +442,74 @@ export default {
});
},
submit (){
let canSubmit = true
//
if(this.ticketInfo.projects && this.ticketInfo.projects.length>0){
this.ticketInfo.projects.map((item)=>{
if(!item.repairIds || item.repairIds==null || item.repairIds==''){
//
canSubmit=false
uni.showToast({
title: '维修项目'+item.itemName+'请选择施工人员!',
icon: 'none'
})
return
}
if((item.itemPrice && item.itemPrice>0) && (item.itemCount && item.itemCount>0) && (item.itemDiscount && item.itemDiscount>0 && item.itemDiscount<=1)){
//
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
}else{
canSubmit=false
uni.showToast({
title: '维修项目'+item.itemName+'价格有误!',
icon: 'none'
})
return
}
})
}
//APP--
// if(this.ticketInfo.wares && this.ticketInfo.wares.length>0){
// this.ticketInfo.wares.map((item)=>{
// if((item.itemPrice && item.itemPrice>0) && (item.itemCount && item.itemCount>0) && (item.itemDiscount && item.itemDiscount>0 && item.itemDiscount<=1)){
// //
// item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
// }else{
// canSubmit=false
// uni.showToast({
// title: ''+item.itemName+'',
// icon: 'none'
// })
// return
// }
// })
// }
if(canSubmit){
//
request({
url: '/admin-api/repair/titem/updateRepairItem',
method: 'PUT',
data:this.ticketInfo.projects
}).then((res) => {
if(res.code==200){
uni.showToast({
title: '操作成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateTo({
url: '/pages-home/home/home'
})
},700)
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
}
},
afterRead(file) {
for (let i = 0; i < file.tempFilePaths.length; i++) {

View File

@ -50,6 +50,7 @@
import {
setToken,
setTenantId,
getTenantId,
setUserInfo,
setJSONData,
setStrData
@ -132,7 +133,8 @@
phone: this.tel,
code: this.yzm,
type: 1,
sysCode:this.sysCode
sysCode:this.sysCode,
tenantId:getTenantId()
}
} else {
//
@ -140,11 +142,12 @@
username: this.tel,
password: this.wrod,
type: 0,
sysCode:this.sysCode
sysCode:this.sysCode,
tenantId:getTenantId()
}
}
request({
url: '/app-api/company/staff/loginApp',
url: '/admin-api/company/staff/loginApp',
method: 'post',
data: data
}).then((res) => {