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