diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js index 3517d72..776182a 100644 --- a/pages/homePage/homePage.js +++ b/pages/homePage/homePage.js @@ -1,18 +1,33 @@ // pages/homePage/homePage.js -Page({ - /** - * 页面的初始数据 - */ +var network = require("../../utils/net.js") +function GetUserProfile(successtion) { + let method = '/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetUserProfile'; + let params = []; + + network.transfer_request(method, params, function (res) { + successtion(); + if (res.result.AccountingUnit_ID != null) { + app.globalData.accountingUnit_ID = res.result.AccountingUnit_ID; + app.globalData.accountingUnit_Name = res.result.AccountingUnit_Name + } + + if (res.result.Department_ID != null) { + app.globalData.department_ID = res.result.Department_ID; + app.globalData.department_Name = res.result.Department_Name + } + }) +} + +Page({ data: { }, - /** - * 生命周期函数--监听页面加载 - */ onLoad: function (options) { - + GetUserProfile(function (res) { + + }); }, /** diff --git a/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js b/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js index 24d9784..6e5af21 100644 --- a/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js +++ b/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js @@ -5,6 +5,24 @@ const app = getApp(); var dateTimePicker = require('../../../utils/dateTimePicker.js'); var timechage = require("../../../utils/dateTimeUtil.js") +function GetAccountingUnit(that, inputValue) { + let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit"; + let params = [{ + "InputValue": inputValue, + "PageIndex": 0, + "PageSize": 100 + }]; + network.transfer_request(method, params, function (res) { + that.setData({ + currency: res.result, + unit: res.result + }) + }) + that.setData({ + which: "会计部门" + }) +} + Page({ data: { @@ -18,24 +36,51 @@ Page({ dateTime: null, startYear: 2018, endYear: 2030, + // 用户数组 customerArr:[], // 存货数组 goodsNameArr:[], + + which: "", + idx: 0, + currency: [], + saletypeIndex: 0, + saletype: [{ + ID: 0, + Name: "请选择销售类型" + }], + + customerIndex: 0, + customer: [{ + ID: 0, + Name: "请选择客户" + }], + isUnit: 0, + unit: [],//会计单位 + departmentIndex: 0, + department: [],//销售部门 + addrs: "", }, // 存货特价开始时间 bindStartTimeChange: function (e) { + var itemIndex = e.currentTarget.dataset.index; + var array = this.data.goodsNameArr; + array[itemIndex]["applicationStartTime"]= e.detail.value, this.setData({ - starTime: e.detail.value, + goodsNameArr: array, }) }, // 存货特价结束时间 bindEndTimeChange: function (e) { - this.setData({ - endTime: e.detail.value, - }) + var itemIndex = e.currentTarget.dataset.index; + var array = this.data.goodsNameArr; + array[itemIndex]["applicationEndTime"] = e.detail.value, + this.setData({ + goodsNameArr: array, + }) }, // 基本信息日期 @@ -83,10 +128,79 @@ Page({ } }, + // 遮罩的搜索框事件 + select: function (e) { + var that = this; + // 自定义的类型 + var which = e.currentTarget.dataset.item; + // 输入的值 + var value = e.detail.value; + if (which == "会计部门") { + GetAccountingUnit(that, value) + } else if (which == "购货客户") { + GetCustomer(that, value) + } else if (which == "部门") { + GetDepartment(that, value) + } else if (which == "销售类型") { + GetSaleKind(that, value) + } + }, + + // 判断条件进行遮罩内容选取 + powerDrawer: function (e) { + let that = this; + let x = e.currentTarget.dataset.x; + if (x == "会计部门") { + GetAccountingUnit(that, "") + } else if (x == "购货客户") { + GetCustomer(that, "") + } else if (x == "部门") { + GetDepartment(that, "") + } else if (x == "销售类型") { + GetSaleKind(that, "") + } + let currentStatu = e.currentTarget.dataset.statu; + // 添加动画打开遮罩 + this.util(currentStatu) + }, + + // 遮罩层点击选中具体条目 + itemclick: function (e) { + var that = this; + var which = e.currentTarget.dataset.item; + var idx = e.currentTarget.dataset.idx; + + if (which == "会计部门") { + that.setData({ + isUnit: idx + }) + } else if (which == "购货客户") { + that.setData({ + customerIndex: idx + }) + GetSpecifiedCustomer(that, idx) + } else if (which == "部门") { + that.setData({ + departmentIndex: idx + }) + } else if (which == "销售类型") { + that.setData({ + saletypeIndex: idx + }) + } + this.setData({ + showModalStatus: false, + }) + }, + /** * 存货明细保存按钮 点击新建单据 内部做逻辑判断 存储值是否都已经加载 */ creatNewSpecialOrder:function (){ + var that =this; + // 会计单位 + let unitID = this.data.unit[this.data.isUnit].ID; + let year = this.data.dateTimeArray[0][this.data.dateTime[0]] let month = this.data.dateTimeArray[1][this.data.dateTime[1]] let date = this.data.dateTimeArray[2][this.data.dateTime[2]] @@ -107,17 +221,25 @@ Page({ }, // 删除客户明细 - deleteCustomerItem: function () { - + deleteCustomerItem: function (event) { + var id = event.target.dataset.idx; + var array = this.data.customerArr; + array.splice(id, 1); + this.setData({ + customerArr: array, + }) }, // 删除存货明细 - deleteGoodsItem:function(){ - + deleteGoodsItem:function(event){ + var id = event.target.dataset.id; + var array = this.data.goodsNameArr; + array.splice(id, 1); + this.setData({ + goodsNameArr:array, + }) }, - /** - * 生命周期函数--监听页面加载 - */ + onLoad: function (options) { // 获取完整的年月日 时分秒,以及默认显示的数组 var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear); @@ -128,12 +250,17 @@ Page({ this.setData({ dateTimeArray: obj1.dateTimeArray, dateTime: obj1.dateTime, + unit: [{ + ID: app.globalData.accountingUnit_ID, + Name: app.globalData.accountingUnit_Name + }], + department: [{ + ID: app.globalData.department_ID, + Name: app.globalData.department_Name + }], }); }, - /** - * 生命周期函数--监听页面显示 - */ onShow: function () { var that = this; @@ -198,4 +325,102 @@ Page({ app.globalData.customerArray = []; }, + 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()参数,返回值是日期和时间 + // var timet = utilll.formatTime(new Date()); + // 再通过setData更改Page()里面的data,动态更新页面的数据 + this.setData({ + // time: timet, + showModalStatus: true, + }); + } + }, + util1: 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({ + showModalStatus1: false + }); + } + }.bind(this), 200) + + // 显示 + if (currentStatu == "open") { + // 调用函数时,传入new Date()参数,返回值是日期和时间 + // var timet = utilll.formatTime(new Date()); + // 再通过setData更改Page()里面的data,动态更新页面的数据 + this.setData({ + // time: timet, + showModalStatus1: true + }); + } + } + + }) \ No newline at end of file diff --git a/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml b/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml index 11bcb7e..05fc24f 100644 --- a/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml +++ b/pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml @@ -9,52 +9,83 @@ + + + - 名称 - - {{customerName}}基本信息 + 购货客户 + + {{customer[customerIndex].Name}} + - 日期 + 发货时间 - + {{dateTimeArray[0][dateTime[0]]}}-{{dateTimeArray[1][dateTime[1]]}}-{{dateTimeArray[2][dateTime[2]]}} {{dateTimeArray[3][dateTime[3]]}}:{{dateTimeArray[4][dateTime[4]]}} - + 会计单位 - - {{customerName}} + + {{unit[isUnit].Name}} + 销售部门 - - {{customerName}} + + {{department[departmentIndex].Name}} + - 摘要 - - {{customerName}} + 销售类型 + + {{saletype[saletypeIndex].Name}} + + + 送货地址 + + + + + + + + + + + + + + + + + + {{item.Name}} + + + + 取消 + + @@ -62,7 +93,7 @@ -