提交 dfb0ec43 authored 作者: 彭涛's avatar 彭涛

tao

上级 7fb5c188
...@@ -31,14 +31,16 @@ ...@@ -31,14 +31,16 @@
</view> </view>
<view class="LssueContracts_item"> <view class="LssueContracts_item">
合同开始时间 合同开始时间
<picker class="picker" mode="date" fields="month" :start="startDate" :end="endDate" @change="bindStartDateChange"> <picker class="picker" mode="date" fields="month" :start="startDate" :end="endDate"
@change="bindStartDateChange">
<view class="uni-input">{{contractStartTime ? contractStartTime : '请选择开始时间'}}</view> <view class="uni-input">{{contractStartTime ? contractStartTime : '请选择开始时间'}}</view>
<image src="../../../static/images/right.png" mode=""></image> <image src="../../../static/images/right.png" mode=""></image>
</picker> </picker>
</view> </view>
<view class="LssueContracts_item"> <view class="LssueContracts_item">
合同结束时间 合同结束时间
<picker class="picker" mode="date" fields="year" :start="startDate" :end="endDate" @change="bindEndDateChange"> <picker class="picker" mode="date" fields="year" :start="startDate" :end="endDate"
@change="bindEndDateChange">
<view class="uni-input">{{contractEndTime ? contractEndTime : '请选择结束时间'}}</view> <view class="uni-input">{{contractEndTime ? contractEndTime : '请选择结束时间'}}</view>
<image src="../../../static/images/right.png" mode=""></image> <image src="../../../static/images/right.png" mode=""></image>
</picker> </picker>
...@@ -62,38 +64,20 @@ ...@@ -62,38 +64,20 @@
} from '@/static/util/fun.js' } from '@/static/util/fun.js'
export default { export default {
onLoad(options) { onLoad(options) {
this.contractId = options.id let that = this
if (this.contractId) { that.contractId = options.id
// 编辑合同的数据回显 // 售电公司列表
get(api.issueContract, { get(api.electricitySalesCompaniesList).then(res => {
id: this.contractId if (res.code == 200) {
}).then(res => { console.log('获取售电公司列表')
console.log(res.data) that.companys = res.data
if (res.code == 200) { that.companyOptions = res.data.map(item => item.eName)
this.contractA = res.data.contractA console.log(that.companys)
this.companyValue = res.data.ename if (that.contractId) {
// console.log(this.companys) that.datashow()
let arr = this.companys.filter(item => {
if (item.eName == this.companyValue) {
return item.userId
}
})
console.log(arr)
this.userId = arr[0].userId
this.electricity = res.data.electricity
this.contractStartTime = res.data.contractStartTime.replace(new RegExp('-', 'g'), '/')
this.contractEndTime = res.data.contractEndTime.replace(new RegExp('-', 'g'), '/')
this.contractType = res.data.contractType
if (this.contractType == 1) {
this.typeValue = '固定价差'
this.fixedSpread = res.data.fixedSpread
} else {
this.typeValue = '月竞分成'
this.shareRatio = res.data.shareRatio
}
} }
}) }
} })
}, },
created() { created() {
this.electricId = uni.getStorageSync('user').electricId this.electricId = uni.getStorageSync('user').electricId
...@@ -141,9 +125,43 @@ ...@@ -141,9 +125,43 @@
let year = new Date().getFullYear() + 10 let year = new Date().getFullYear() + 10
return year + '-12-31' return year + '-12-31'
} }
}, },
methods: { methods: {
//数据回显
datashow() {
let that = this
// 编辑合同的数据回显
get(api.issueContract, {
id: that.contractId
}).then(res => {
console.log('获取合同信息')
console.log(res.data)
if (res.code == 200) {
that.contractA = res.data.contractA
that.companyValue = res.data.ename
// console.log(that.companys)
for (let i = 0; i < that.companys.length; i++) {
if (that.companys[i].eName == that.companyValue) {
console.log(that.companys[i].userId)
that.userId = that.companys[i].userId
}
}
console.log(that.userId)
that.electricity = res.data.electricity
that.contractStartTime = res.data.contractStartTime.replace(new RegExp('-', 'g'), '/')
that.contractEndTime = res.data.contractEndTime.replace(new RegExp('-', 'g'), '/')
that.contractType = res.data.contractType
if (that.contractType == 1) {
that.typeValue = '固定价差'
that.fixedSpread = res.data.fixedSpread
} else {
that.typeValue = '月竞分成'
that.shareRatio = res.data.shareRatio
}
}
})
},
//选择合同类型 //选择合同类型
bindTypeChange(event) { bindTypeChange(event) {
// console.log(event) // console.log(event)
...@@ -178,12 +196,12 @@ ...@@ -178,12 +196,12 @@
}, },
//选择合同结束时间 //选择合同结束时间
bindEndDateChange(e) { bindEndDateChange(e) {
if(this.contractStartTime.split('/')[0]>e.detail.value){ if (this.contractStartTime.split('/')[0] > e.detail.value) {
uni.showToast({ uni.showToast({
title:'合同开始时间不能大于合同结束时间', title: '合同开始时间不能大于合同结束时间',
icon:'none' icon: 'none'
}) })
}else{ } else {
this.contractEndTime = e.detail.value + '/12/31' this.contractEndTime = e.detail.value + '/12/31'
} }
}, },
...@@ -269,8 +287,8 @@ ...@@ -269,8 +287,8 @@
}, 500) }, 500)
} else { } else {
uni.showToast({ uni.showToast({
title:res.msg, title: res.msg,
icon:'none' icon: 'none'
}) })
this.flag = true this.flag = true
} }
...@@ -293,7 +311,7 @@ ...@@ -293,7 +311,7 @@
return '请输入合同的甲方' return '请输入合同的甲方'
} else if (arr[2] == '') { } else if (arr[2] == '') {
return '请选择合同的乙方' return '请选择合同的乙方'
} else if (arr[3] == ''|| isNaN(arr[3])) { } else if (arr[3] == '' || isNaN(arr[3])) {
return '请输入合同的电量' return '请输入合同的电量'
} else if (arr[4] == '') { } else if (arr[4] == '') {
return '请选择合同的开始时间' return '请选择合同的开始时间'
...@@ -378,6 +396,7 @@ ...@@ -378,6 +396,7 @@
background-color: #1989fa; background-color: #1989fa;
border-radius: 16rpx; border-radius: 16rpx;
} }
.addContracts_btn { .addContracts_btn {
position: absolute; position: absolute;
left: 50%; left: 50%;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论