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

@ -63,11 +63,19 @@ 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'){
if(this.data.threeList[event.detail.value].default_type=='forest_management'){
this.setData({ this.setData({
isShif:true, isShif:true,
isXiangm:true, isXiangm:true,
senIndex: 1, senIndex: 1,
}) })
} else {
this.setData({
isShif:false,
isXiangm:true,
senIndex: 0,
})
}
} else { } else {
this.setData({ this.setData({
isShif:false, isShif: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: [],
@ -290,37 +296,39 @@ Page({
'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);
// if(arr[0].type=='forest_management'){
// that.setData({
// isShif:true,
// isXiangm:false,
// senIndex:1
// })
// }
// that.setData({
// senList:arr
// })
that.setData({ that.setData({
isShif:true, threeList: dataList,
isXiangm:false, cases_position_id: dataList[that.data.curCaseIndex].address[that.data.addressIndex].id,
senIndex:1 newDo_type:that.data.senList[0].type,
})
}
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,
//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,