// pages/orderSearch/orderSearch.js
|
|
var network = require("../../../utils/net.js")
|
|
var timechage = require("../../../utils/dateTimeUtil.js")
|
|
var app = getApp()
|
|
|
|
function GetCustomer(that, inputValue) {
|
|
let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer";
|
|
let params = [{
|
|
"InputValue": inputValue,
|
|
"PageIndex": 0,
|
|
"PageSize": 100
|
|
}];
|
|
network.transfer_request(method, params, function (res) {
|
|
that.setData({
|
|
currency: res.result,
|
|
customer: res.result
|
|
})
|
|
})
|
|
that.setData({
|
|
which: "购货客户"
|
|
})
|
|
}
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
customerIndex: 0,
|
|
customer: [{
|
|
ID: 0,
|
|
Name: "请选择购货客户"
|
|
}],
|
|
currency: [],
|
|
Sdate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y-M-D'),
|
|
Edate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y-M-D'),
|
|
billIndex:0,
|
|
billState:[
|
|
{
|
|
ID:0,
|
|
Name:"未审核"
|
|
},
|
|
{
|
|
ID: 20,
|
|
Name: "已审核"
|
|
}
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
choseBillState:function(e){
|
|
this.setData({
|
|
billIndex: e.detail.value
|
|
})
|
|
},
|
|
bindSDateChange: function (e) {
|
|
this.setData({
|
|
Sdate: e.detail.value
|
|
})
|
|
},
|
|
bindEDateChange: function (e) {
|
|
this.setData({
|
|
Edate: e.detail.value
|
|
})
|
|
},
|
|
submitForm: function (e) {
|
|
let customerID = this.data.customer[this.data.customerIndex].ID;
|
|
let sDate = timechage.formatymdERTDate(this.data.Sdate);
|
|
let eDate = timechage.formatymdERTDate(this.data.Edate);
|
|
if (customerID == 0) {
|
|
app.globalData.SelectCustomer_ID = null;
|
|
} else {
|
|
app.globalData.SelectCustomer_ID = customerID;
|
|
}
|
|
app.globalData.SelectStartDate = sDate;
|
|
app.globalData.SelectEndDate = eDate;
|
|
|
|
app.globalData.SelectBillState = this.data.billState[this.data.billIndex].ID
|
|
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
},
|
|
powerDrawer: function (e) {
|
|
let that = this;
|
|
let x = e.currentTarget.dataset.x;
|
|
if (x == "购货客户") {
|
|
GetCustomer(that, "")
|
|
}
|
|
let currentStatu = e.currentTarget.dataset.statu;
|
|
this.util(currentStatu)
|
|
},
|
|
itemclick: function (e) {
|
|
var that = this;
|
|
var name = e.currentTarget.dataset.name;
|
|
var id = e.currentTarget.dataset.id;
|
|
var which = e.currentTarget.dataset.item;
|
|
var idx = e.currentTarget.dataset.idx;
|
|
|
|
if (which == "购货客户") {
|
|
that.setData({
|
|
customerIndex: idx
|
|
})
|
|
}
|
|
|
|
this.setData({
|
|
showModalStatus: false,
|
|
})
|
|
},
|
|
select: function (e) {
|
|
var that = this;
|
|
var which = e.currentTarget.dataset.item;
|
|
var value = e.detail.value;
|
|
if (which == "购货客户") {
|
|
GetCustomer(that, value)
|
|
}
|
|
},
|
|
util: function (currentStatu) {
|
|
/* 动画部分 */
|
|
// 第1步:创建动画实例
|
|
var animation = wx.createAnimation({
|
|
duration: 200, //动画时长
|
|
timingFunction: "linear", //线性
|
|
delay: 0 //0则不延迟
|
|
});
|
|
|
|
// 第2步:这个动画实例赋给当前的动画实例
|
|
this.animation = animation;
|
|
|
|
// 第3步:执行第一组动画
|
|
animation.opacity(0).rotateX(-100).step();
|
|
|
|
// 第4步:导出动画对象赋给数据对象储存
|
|
this.setData({
|
|
animationData: animation.export()
|
|
})
|
|
|
|
// 第5步:设置定时器到指定时候后,执行第二组动画
|
|
setTimeout(function () {
|
|
// 执行第二组动画
|
|
animation.opacity(1).rotateX(0).step();
|
|
// 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
|
|
this.setData({
|
|
animationData: animation
|
|
})
|
|
|
|
//关闭
|
|
if (currentStatu == "close") {
|
|
this.setData({
|
|
showModalStatus: false,
|
|
});
|
|
}
|
|
}.bind(this), 200)
|
|
|
|
// 显示
|
|
if (currentStatu == "open") {
|
|
// 调用函数时,传入new Date()参数,返回值是日期和时间
|
|
// 再通过setData更改Page()里面的data,动态更新页面的数据
|
|
this.setData({
|
|
showModalStatus: true,
|
|
});
|
|
}
|
|
}
|
|
})
|