master
chen 2022-08-18 11:30:41 +08:00
parent b74e21e741
commit 3f8d558c04
1 changed files with 43 additions and 35 deletions

View File

@ -61,14 +61,22 @@ Page({
})
}
},
casesChange(event) {
if(this.data.threeList[event.detail.value].type=='forest_management'){
this.setData({
isShif:true,
isXiangm:true,
senIndex: 1,
})
} else {
casesChange(event) {
if(this.data.threeList[event.detail.value].type=='forest_management'){
if(this.data.threeList[event.detail.value].default_type=='forest_management'){
this.setData({
isShif:true,
isXiangm:true,
senIndex: 1,
})
} else {
this.setData({
isShif:false,
isXiangm:true,
senIndex: 0,
})
}
} else {
this.setData({
isShif:false,
isXiangm:false,
@ -77,8 +85,6 @@ Page({
}
this.setData({
curCaseIndex: event.detail.value,
isShif: this.data.threeList[event.detail.value].type=='forest_management'?true:false,
senIndex: this.data.threeList[event.detail.value].type=='forest_management'?1:0,
addressIndex:0,
priceList: {},
curThreeCode: [],
@ -87,7 +93,7 @@ Page({
flag:true,
carbon_neutralization: 0,
carbon_efficiency: "0.00",
})
})
if(this.data.senList[event.detail.value].name=='补植补造'){
this.setData({
newDo_type:'afforestation',
@ -289,38 +295,40 @@ Page({
id: id,
'openid': wx.getStorageSync('openid')
},
success(res) {
success(res) {
console.log(JSON.parse(res.data.data),777777777);
if (res.data.result == 'success') {
var threeList = JSON.parse(res.data.data).cases;
if(threeList[0].type=='forest_management'){
var dataList = JSON.parse(res.data.data).cases;
if(dataList[0].type=='forest_management'){
that.setData({
isShif:true,
isXiangm:true,
senIndex:1
})
}
let arr = that.data.senList
arr.forEach((item,index)=>{
if(item.type == threeList[that.data.curCaseIndex].default_type){
let obj = arr[index];
arr.splice(index,1)
arr.unshift(obj)
}
})
if(arr[0].type=='forest_management'){
that.setData({
isShif:true,
isXiangm:false,
senIndex:1
})
}
that.setData({
senList:arr
})
// let arr = that.data.senList
// arr.forEach((item,index)=>{
// if(item.type == dataList[that.data.curCaseIndex].default_type){
// let obj = arr[index];
// arr.splice(index,1)
// arr.unshift(obj)
// }
// })
// console.log(arr,666666);
// if(arr[0].type=='forest_management'){
// that.setData({
// isShif:true,
// isXiangm:false,
// senIndex:1
// })
// }
// that.setData({
// senList:arr
// })
that.setData({
threeList: threeList,
cases_position_id: threeList[that.data.curCaseIndex].address[that.data.addressIndex].id,
newDo_type:arr[0].type,
threeList: dataList,
cases_position_id: dataList[that.data.curCaseIndex].address[that.data.addressIndex].id,
newDo_type:that.data.senList[0].type,
//TODO 这里赋值应该用数组
// curThreeCode: [JSON.parse(res.data.data).trees[0].coding],
// carbon:JSON.parse(res.data.data).trees[0].carbon_base,