You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

354 lines
9.1 KiB

//logs.js
const util = require('../../utils/util.js')
const common = require('../../utils/common.js');
// pages/loanDetails/loanDetails.js
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
title: "",
swiper_index: 0, //显示内容
tag_arr: [{
name: '全部',
id: 9
},
{
name: '审批中',
id: 0
},
{
name: '驳回',
id: 2
},
{
name: '已通过',
id: 1
},
{
name: '已拒绝',
id: 3
},
],
tag_id: 0,
order_arr: [],
examine: 9,
type: 1,
list: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
// 草稿
draft(e) {
let item = e.currentTarget.dataset.item
item.data_value = JSON.parse(item.data_value);
// item.data_value = Object.assign(item.data_value,item.data_value.detail)
let obj = JSON.stringify(item.data_value);
let type = item.type
console.log('item',item)
if (type == 1) {
wx.navigateTo({
url: `../../pages/toExamine/pages/first/first?id=${item.data_value.id}&title=${item.data_value.name}&type=${item.data_value.type}&det_type=5&obj=${obj}&number=${item.number}&form_type=${type}`,
})
} else if (type == 2) {
wx.navigateTo({
url: `../../pages/toExamine/pages/finalJudgment/finalJudgment?det_id=${item.id}&det_type=5&name=${item.lessee_name}&address=${item.data_value.household_address}&number=${item.number}&obj=${obj}&form_type=${type}`,
})
} else {
wx.navigateTo({
url: `../../pages/toExamine/pages/requestfunds/requestfunds?det_id=${item.id}&det_type=5&number=${item.number}&obj=${obj}&form_type=${type}`,
})
}
},
// 初审详情
firstDetails(e) {
console.log(e,e)
let det_type
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id;
if (e.currentTarget.dataset.type) {
det_type = e.currentTarget.dataset.type
} else if (this.data.order_arr[index].examine == 0 && (this.data.order_arr[index].examine_business == 0 || this.data.order_arr[index].examine_business == 1)) {
det_type = 0
} else if (this.data.order_arr[index].examine == 1 && this.data.order_arr[index].examine_business == 1) {
det_type = 1
} else if (this.data.order_arr[index].examine == 2 || this.data.order_arr[index].examine_business == 2) {
det_type = 2
} else {
det_type = 3
}
wx.navigateTo({
url: `../../pages/toExamine/pages/first/first?det_id=${id}&det_type=${det_type}`,
})
},
// 终审详情
endDetails(e) {
let det_type
let id = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index
if (e.currentTarget.dataset.type) {
det_type = e.currentTarget.dataset.type
} else if (this.data.order_arr[index].examine == 0 && (this.data.order_arr[index].examine_business == 0 || this.data.order_arr[index].examine_business == 1)) {
det_type = 0
} else if (this.data.order_arr[index].examine == 1 && this.data.order_arr[index].examine_business == 1) {
det_type = 1
} else if (this.data.order_arr[index].examine == 2 || this.data.order_arr[index].examine_business == 2) {
det_type = 2
} else {
det_type = 3
}
wx.navigateTo({
url: `../../pages/toExamine/pages/finalJudgment/finalJudgment?det_id=${id}&det_type=${det_type}`,
})
},
//请款详情
requestfunds(e) {
let det_type
let id = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index
if (this.data.order_arr[index].examine == 0 && (this.data.order_arr[index].examine_business == 0 || this.data.order_arr[index].examine_business == 1)) {
det_type = 0
} else if (this.data.order_arr[index].examine == 1 && this.data.order_arr[index].examine_business == 1) {
det_type = 1
} else if (this.data.order_arr[index].examine == 2 || this.data.order_arr[index].examine_business == 2) {
det_type = 2
} else {
det_type = 3
}
wx.navigateTo({
url: `../../pages/toExamine/pages/requestfunds/requestfunds?det_id=${id}&det_type=${det_type}`,
})
},
// 跳转到终审
end(e) {
let number = e.currentTarget.dataset.number
let address = e.currentTarget.dataset.address
let name = e.currentTarget.dataset.name
let type = e.currentTarget.dataset.type;
let id = e.currentTarget.dataset.id
if (type == 1) {
wx.navigateTo({
url: `../../pages/toExamine/pages/finalJudgment/finalJudgment?det_id=${id}&det_type=4&name=${name}&address=${address}&number=${number}`,
})
}
},
// 跳转到请款
request(e) {
let number = e.currentTarget.dataset.number
let type = e.currentTarget.dataset.type;
let id = e.currentTarget.dataset.id
if (type == 1) {
wx.navigateTo({
url: `../../pages/toExamine/pages/requestfunds/requestfunds?det_id=${id}&det_type=4&number=${number}`,
})
}
},
getData() {
if (this.data.page === 1) {
this.setData({
order_arr: []
})
}
let url = `api/order-lists?page=${this.data.page}&limit=10&search=${this.data.title}&salesman_id=${wx.getStorageSync("userInfo").id}&examine=${this.data.examine}&type=${this.data.type}`
util.httpRequest(url).then((res) => {
wx.hideLoading()
if (this.data.swiper_index == 0) {
res.data.map(item => {
item.classA = 1
item.classB = 0
item.classC = 0
})
}
if (this.data.swiper_index == 1) {
res.data.map(item => {
item.classA = 1
item.classB = 1
item.classC = 0
})
}
if (this.data.swiper_index == 2) {
res.data.map(item => {
item.classA = 1
item.classB = 1
item.classC = 1
})
}
if (res.code == '200') {
// console.log(res)
res.data.map(item => {
item.car_model = item.car_model.split(",")
})
this.setData({
order_arr: this.data.order_arr.concat(res.data)
})
} else {
common.showClickModal(res.msg)
}
})
},
// 滑动到底部
scrollBottom(e) {
console.log(e)
this.setData({
page: this.data.page + 1
})
this.getData()
},
// 搜索输入
search(e) {
this.setData({
title: e.detail.value
})
if (this.data.title == '') {
this.setData({
page: 1,
tag_id: 0,
examine: 9
})
this.getData()
}
},
// 搜索按钮
button_search() {
wx.showLoading({
title: '搜索中...',
mask: true
})
this.setData({
page: 1
})
this.getData()
},
getList() {
let url = 'api/form-value-draft'
let data = {
salesman_id: wx.getStorageSync('userInfo').id
}
util.httpRequest(url, data, 'post').then((res) => {
console.log(res)
if (res.code == '200') {
this.setData({
list: res.data
})
}
})
},
// 审核状态
bidirectional(e) {
let index = e.currentTarget.dataset.index;
this.setData({
tag_id: 0,
examine: 9,
swiper_index: index,
type: Number(index) + 1,
page: 1
})
if (this.data.swiper_index == 3) {
this.getList()
} else if (this.data.swiper_index == 0 || this.data.swiper_index == 1 || this.data.swiper_index == 2) {
this.getData()
}
},
// 订单类型
tag(e) {
let index = e.currentTarget.dataset.index;
let id = e.currentTarget.dataset.id;
this.setData({
examine: id,
tag_id: index,
page: 1
})
this.getData()
},
swiperFun(e) { //切换事件
this.setData({
swiper_index: e.detail.current,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
console.log('123')
},
onPageScroll: function(e) {
// console.log(e);{scrollTop:99}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
if (!wx.getStorageSync("userInfo")) {
wx.showModal({
title: '提示',
content: '前去登录',
success(res) {
if (res.confirm) {
wx.switchTab({
url: `../../pages/my/my`,
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
} else {
if (this.data.swiper_index == 0 || this.data.swiper_index == 1 || this.data.swiper_index == 2) {
this.getData()
} else if (this.data.swiper_index == 3) {
this.getList()
}
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
this.setData({
page: 1
})
this.getData()
setTimeout(() => {
wx.stopPullDownRefresh({});
}, 1000)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})