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

292 lines
6.1 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// pages/processDetail/index.js
const app = getApp();
import dateUtil from "../../utils/dateUtil";
Page({
/**
* 页面的初始数据
*/
data: {
dataLoading:false,
phoneDialog: false,
downShow: true,
loading: false,
orderStatusArray: [],
orderStatusArray0: [{
value: '-1',
name: '跟进',
checked: true,
},
{
value: '20',
name: '推工作',
checked: false,
},
],
orderStatusArray1: [{
value: '-1',
name: '跟进',
checked: true,
},
{
value: '60',
name: '在职中',
checked: false,
},
{
value: '90',
name: '不求职',
checked: false,
},
],
orderStatusArray2: [{
value: '-1',
name: '跟进',
checked: true,
},
{
value: '80',
name: '已离职',
checked: false,
},
{
value: '20',
name: '推工作',
checked: false,
},
],
workOrderId: '',
searchTag: '',
},
getDetailById: function () {
var that = this;
wx.request({
url: app.globalData.ip + '/workorder/getDetailById',
data: {
workOrderId: that.data.workOrderId
},
header: app.globalData.header,
method: "GET",
success: function (res) {
console.log(res.data);
if (res.data.status == 200) {
if (res.data.data.serveRecordList != null && res.data.data.serveRecordList.length > 0) {
res.data.data.serveRecordList.forEach(item => {
item['createTimeStr'] = dateUtil.timeShowXXX(item.createTime);
});
}
res.data.data.serveRecordList.forEach((item,index)=>{
item.desp = item.desp.replace(/「/g, "<span style='color:#4DB54B;margin-right:4px;'>").replace(/」/g, "</span>");
})
that.setData({
workOrderDetail: res.data.data,
});
} else {
app.showTips(that, res.data.msg);
}
wx.hideLoading({
success: (res) => {},
})
that.setData({
dataLoading: true,
});
},
fail: function (res) {
console.log(res);
wx.hideLoading({
success: (res) => {},
})
},
})
},
markHasRead: function () {
var that = this;
wx.request({
url: app.globalData.ip + '/workorder/markHasRead',
data: {
workOrderId: that.data.workOrderId
},
header: app.globalData.header,
method: "GET",
success: function (res) {
},
fail: function (res) {
console.log(res);
}
})
},
showAll() {
this.setData({
downShow: !this.data.downShow
})
},
radioChange(e) {
console.log('radio发生change事件携带value值为', e.detail.value)
/*const items = this.data.orderStatusArray
for (let i = 0, len = items.length; i < len; ++i) {
items[i].checked = items[i].value === e.detail.value
}*/
/*this.setData({
items
})*/
},
formSubmit(e) {
console.log('form发生了submit事件携带数据为1', e.detail.value);
var that = this;
that.setData({
loading:true
})
var paramData = e.detail.value;
paramData['workOrderId'] = that.data.workOrderDetail.id;
paramData['searchTag'] = that.data.searchTag;
console.log('form发生了submit事件携带数据为2', paramData);
wx.request({
url: app.globalData.ip + '/workorder/changeOrderStatus',
data: paramData,
header: app.globalData.header,
method: "POST",
success: function (res) {
console.log(res.data);
if (res.data.status == 200) {
wx.showToast({
title: '登录成功',
icon: 'success',
duration: 2000
})
wx.navigateBack({
delta: 1
})
} else {
app.showTips(that, res.data.msg);
that.setData({
loading:false
})
}
},
fail: function (res) {
console.log(res);
that.setData({
loading:false
})
},
})
},
close: function () {
this.setData({
phoneDialog: false,
})
},
makePhoneCall: function (e) {
var that = this;
wx.makePhoneCall({
phoneNumber: that.data.phone
});
},
makePhone: function (e) {
var that = this;
console.log(e);
that.setData({
phoneDialog: true,
phone: e.currentTarget.dataset.phone
})
// wx.makePhoneCall({
// phoneNumber: e.currentTarget.dataset.phone
// });
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '加载中',
mask: true,
success: (res) => {},
fail: (res) => {},
complete: (res) => {},
})
this.data.workOrderId = options.workOrderId;
this.data.searchTag = options.searchTag;
if (this.data.searchTag == 0) {
this.data.orderStatusArray = this.data.orderStatusArray0;
} else if (this.data.searchTag == 1) {
this.data.orderStatusArray = this.data.orderStatusArray1;
} else if (this.data.searchTag == 2) {
this.data.orderStatusArray = this.data.orderStatusArray2;
}
this.setData({
orderStatusArray: this.data.orderStatusArray
});
this.getDetailById();
this.markHasRead();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})