diff --git a/pages/saleForecastList/Detail/Detail.js b/pages/saleForecastList/Detail/Detail.js index 0bdaa5d..6715b78 100644 --- a/pages/saleForecastList/Detail/Detail.js +++ b/pages/saleForecastList/Detail/Detail.js @@ -1,4 +1,4 @@ -// pages/orderinfo/orderinfo.js +// pages/saleForecastList/Detail/Detail.js var app = getApp() var network = require("../../../utils/net.js") var dateTimePicker = require('../../../utils/dateTimePicker.js'); @@ -9,597 +9,432 @@ var orderID = 0; var getAccountingUnit = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit"; var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer"; var getDept = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment"; -var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; +// var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; +var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoods"; +var getGoodsDetail = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsDetailWithPrice" var getSaleKind = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetSaleKind" var load = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Load"; let update = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Update'; -function setTime(that) { // 获取完整的年月日 时分秒,以及默认显示的数组 - var obj1 = dateTimePicker.dateTimePicker(that.data.startYear, that.data.endYear, that.data.loadTime); // 精确到分的处理,将数组的秒去掉 - var lastArray = obj1.dateTimeArray.pop(); - var lastTime = obj1.dateTime.pop(); - +function setTime(that) { + var obj1 = dateTimePicker.dateTimePicker(2018, 2030, that.data.dmo.Date); + var lastArray =obj1.dateTimeArray.pop(); + var lastTime =obj1.dateTime.pop(); that.setData({ dateTimeArray1: obj1.dateTimeArray, dateTime1: obj1.dateTime }); + that.timeConversion(); } -function GetAccountingUnit(that, inputValue) { - let method = 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: "会计单位" - }) -} - -function GetCustomer(that, inputValue) { - let method = 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: "购货客户" - }) -} - -function GetDepartment(that, inputValue) { - let method = getDept; - let params = [{ - "InputValue": inputValue, - "PageIndex": 0, - "PageSize": 100 - }]; +function GetBaseInfoList(that, method, params) { network.transfer_request(method, params, function (res) { that.setData({ - currency: res.result, - department: res.result - }) - }) - that.setData({ - which: "部门" - }) + currency: res.result + }); + }); } -function GetSaleKind(that, v) { - let method = getSaleKind; - let params = [{ - "InputValue": v, - "PageIndex": 0, - "PageSize": 100 - }]; - network.transfer_request(method, params, function (res) { +function GetGoodsInfo(that, dmo, detail) { + var params = [{ + "Goods_ID": detail.SaleGoods_ID, + "Customer_ID": dmo.Customer_ID, + "AccountingUnit_ID": dmo.AccountingUnit_ID, + "Date": dmo.Date, + }] + network.transfer_request(getGoodsDetail, params, function (res) { + detail.Goods_SecondUnit = res.result.Goods_SecondUnit; + detail.Goods_UnitConvertDirection = res.result.Goods_UnitConvertDirection; + detail.Goods_MainUnitRatio = res.result.Goods_MainUnitRatio; + detail.Goods_SecondUnitRatio = res.result.Goods_SecondUnitRatio; + detail.Unit = res.result.Unit; + detail.LeftRatio = res.result.LeftRatio; + detail.RightRatio = res.result.RightRatio; + if (res.result.RightRatio == null) { + detail.RightRatio = Number(1) + } + if (res.result.LeftRatio == null) { + detail.LeftRatio = Number(1) + } + detail.Price = res.result.Price; + detail.PolicyPrice = res.result.PolicyPrice; that.setData({ - currency: res.result, - saletype: res.result - }) - }) - that.setData({ - which: "销售类型" - }) + dmo: dmo + }); + }); } -function GetGoodsWithUnitPrice(that, v, date) { - let unitID = that.data.unit[that.data.isUnit].ID; - let customerID = that.data.customer[that.data.customerIndex].ID; - let method = getGoods; - let params = [{ - "Input": v, - "PageIndex": 0, - "PageSize": 100, - "Customer_ID": customerID, - "AccountingUnit_ID": unitID, - "Date": date - }]; - network.transfer_request(method, params, function (res) { +function GetCustomerInfo(that, dmo) { + var params = [dmo.Customer_ID, ["Department_ID", "Department_Name", "Employee_ID", "Employee_Name", "TakeGoods_Type", "Address"]] + network.transfer_request(getCustomerInfo, params, function (res) { + var obj = JSON.parse(res.result); + dmo.Department_ID = obj.Department_ID; + dmo.Department_Name = obj.Department_Name; + dmo.Employee_ID = obj.Employee_ID; + dmo.Employee_Name = obj.Employee_Name; + dmo.TakeGoods_Type = obj.TakeGoods_Type; + dmo.DeliverAddress = obj.Address; that.setData({ - goods: res.result, - }) - }) + dmo: dmo + }); + }); } Page({ - - /** - * 页面的初始数据 - */ data: { - /** - * 页面配置 - */ - which: "", - winWidth: 0, - winHeight: app.globalData.winHeight, - // tab切换 currentTab: 0, - obj: [], - goods: [], - idx: 0, - currency: [], - saletypeIndex: 0, - saletype: [{ - ID: 0, - Name: "请选择销售类型" - }], - departmentIndex: 0, - department: [{ - ID: 0, - Name: "请选择销售部门" - }], - customerIndex: 0, - customer: [{ - ID: 0, - Name: "请选择客户" - }], - isUnit: 0, - unit: [{ - ID: 0, - Name: "请选择会计单位" - }], - addrs: "", + winHeight: app.globalData.winHeight, + which: '', + rowIdx: -1, + dmo: {}, dateTimeArray1: null, - dateTime1: null, - startYear: 2018, - endYear: 2030, - loadTime: "" + dateTime1: null }, - /** - * 生命周期函数--监听页面加载 - */ onLoad: function (options) { var that = this; - let ID = Number(options.ID); - orderID = ID; - - let method = load; - let params = [ID]; - network.transfer_request(method, params, function (res) { - let customerOld = [{ - ID: res.result.Customer_ID, - Name: res.result.Customer_Name - }] - - let unitOld = [{ - ID: res.result.AccountingUnit_ID, - Name: res.result.AccountingUnit_Name - }] - - let departmentOld = [{ - ID: res.result.Department_ID, - Name: res.result.Department_Name - }] - - let saletypeOld = [{ - ID: res.result.SaleKind_ID, - Name: res.result.SaleKind_Name - }] - - let addrrrr = res.result.DeliverAddress - let loadtimee = timechage.formatTimeTwo(res.result.Date.substring(6, 19), 'Y-M-D h:m') - - let details = []; - - for (var i = 0; i < res.result.Details.length; i++) { - if (res.result.Details[i].RightRatio == null) { - var rightRatio = 1 - } - if (res.result.Details[i].LeftRatio == null) { - var leftRatio = 1 - } - var dmo = { - "Goods_Name": res.result.Details[i].Goods_Name, - "SaleGoods_ID": res.result.Details[i].SaleGoods_ID, - "goodsNum": res.result.Details[i].UnitNum, - "goodsSecondNum": res.result.Details[i].SecondNumber, - "Price": res.result.Details[i].Price, - "PolicyPrice": res.result.Details[i].PolicyPrice, - "Goods_MainUnitRatio": res.result.Details[i].Goods_MainUnitRatio, - "Goods_SecondUnitRatio": res.result.Details[i].Goods_SecondUnitRatio, - "Goods_UnitConvertDirection": res.result.Details[i].Goods_UnitConvertDirection, - "RightRatio": rightRatio, - "LeftRatio": leftRatio, - "ID": res.result.Details[i].ID - } - details.push(dmo) - } - + network.transfer_request(load, [Number(options.ID)], function (res) { + res.result.Date = timechage.formatTimeTwo(res.result.Date.substring(6, 19), 'Y-M-D h:m'); + console.log(res.result); that.setData({ - customer: customerOld, - unit: unitOld, - department: departmentOld, - saletype: saletypeOld, - addrs: addrrrr, - loadTime: loadtimee, - obj: details - }) - setTime(that) - + dmo: res.result + }); + setTime(that); }) }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, /** * 滑动切换tab */ bindChange: function (e) { - - var that = this; - that.setData({ + this.setData({ currentTab: e.detail.current }); - }, /** * 点击tab切换 */ swichNav: function (e) { - - var that = this; - if (this.data.currentTab === e.target.dataset.current) { return false; } else { - that.setData({ + this.setData({ currentTab: e.target.dataset.current }) } }, - getAddrs: function (e) { - this.data.addrs = e.detail.value; + changeDateTime1: function (e) { + this.setData({ + dateTime1: e.detail.value, + }); + this.timeConversion(); }, - add: function (e) { - - let newobj = { - Goods_Name: "请选择存货" - }; - - this.data.obj.push(newobj) - - let aaa = this.data.obj; + // 添加一个时间转换 + timeConversion: function () { + let year = this.data.dateTimeArray1[0][this.data.dateTime1[0]] + let month = this.data.dateTimeArray1[1][this.data.dateTime1[1]] + let date = this.data.dateTimeArray1[2][this.data.dateTime1[2]] + let hour = this.data.dateTimeArray1[3][this.data.dateTime1[3]] + let minu = this.data.dateTimeArray1[4][this.data.dateTime1[4]] + let stringTime = year + "/" + month + "/" + date + " " + hour + ":" + minu + ":00" + let timestamp = Date.parse(new Date(stringTime)); + let loadTime = "/Date(" + timestamp + "+0800)/"; + this.data.dmo.Date = loadTime; this.setData({ - obj: aaa, + dmo: this.data.dmo, }) }, - deleteItem: function (e) { - let idx = e.target.dataset.idx; - let deleteobj = this.data.obj; - deleteobj.splice(idx, 1) + + getAddrs: function (e) { + this.data.dmo.DeliverAddress = e.detail.value; this.setData({ - obj: deleteobj - }) + dmo: this.data.dmo + }); }, - getGoodsNum: function (e) { - //值: - //e.detail.value - //设置的id - //e.target.dataset.index - let value = e.detail.value; - let idx = e.target.dataset.idx; - - let end = value.charAt(value.length - 1) - if (end != ".") { - - this.data.obj[idx].goodsNum = Number(value); - - let Goods_MainUnitRatio = this.data.obj[idx].Goods_MainUnitRatio - let Goods_SecondUnitRatio = this.data.obj[idx].Goods_SecondUnitRatio - let Goods_UnitConvertDirection = this.data.obj[idx].Goods_UnitConvertDirection - let RightRatio = this.data.obj[idx].RightRatio - let LeftRatio = this.data.obj[idx].LeftRatio - - var numberNumber = Number(value) / RightRatio * LeftRatio; - if (Goods_UnitConvertDirection == 0 || Goods_UnitConvertDirection == 1) { - let secondNumber = numberNumber / (Goods_MainUnitRatio) * (Goods_SecondUnitRatio); - this.data.obj[idx].goodsSecondNum = Number(secondNumber) - this.setData({ - obj: this.data.obj - }) + powerDrawer: function (e) { + let x = e.currentTarget.dataset.x; + if (x == "存货") { + var dmo = this.data.dmo; + if (dmo.AccountingUnit_ID == null || dmo.Customer_ID == null || dmo.Date == null) { + wx.showModal({ + title: '提示', + content: '请先选择客户及会计单位', + }); + return; } } - + let idx = e.currentTarget.dataset.idx; + if (idx == undefined) + idx = -1; + this.showDialog(x, ''); + this.setData({ + which: x, + rowIdx: idx + }); + this.util(); }, - getSecondNum: function (e) { - let value = e.detail.value; - let idx = e.target.dataset.idx; - let end = value.charAt(value.length - 1) - if (end != ".") { - this.data.obj[idx].goodsSecondNum = Number(value); - - let Goods_MainUnitRatio = this.data.obj[idx].Goods_MainUnitRatio - let Goods_SecondUnitRatio = this.data.obj[idx].Goods_SecondUnitRatio - let Goods_UnitConvertDirection = this.data.obj[idx].Goods_UnitConvertDirection - let RightRatio = this.data.obj[idx].RightRatio - let LeftRatio = this.data.obj[idx].LeftRatio - - var numberNumber = Number(value) / LeftRatio * RightRatio; - if (Goods_UnitConvertDirection == 0 || Goods_UnitConvertDirection == 2) { - let unitnumber = numberNumber / (Goods_SecondUnitRatio) * (Goods_MainUnitRatio); - this.data.obj[idx].goodsNum = Number(unitnumber) - this.setData({ - obj: this.data.obj - }) - } - } - }, - getPrice: function (e) { - let value = e.detail.value; - let idx = e.target.dataset.idx; - this.data.obj[idx].Price = Number(value); + select: function (e) { + var value = e.detail.value; + var x = this.data.which; + this.showDialog(x, 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, "") + + showDialog: function (x, value) { + var method = null; + let params = [{ + "InputValue": value, + "PageIndex": 0, + "PageSize": 100 + }]; + switch (x) { + case "购货客户": + method = getCustomer; + break; + case "会计部门": + method = getAccountingUnit; + break; + case "部门": + method = getDept; + break; + case "销售类型": + method = getSaleKind; + break; + case "存货": + method = getGoods; + break; } - let currentStatu = e.currentTarget.dataset.statu; - this.util(currentStatu) + GetBaseInfoList(this, method, params); }, - powerDrawer1: function (e) { - let that = this; - let currentStatu = e.currentTarget.dataset.statu; - let timestamp = Date.parse(new Date()); - let date = "/Date(" + timestamp + "+0800)/"; - GetGoodsWithUnitPrice(that, "", date) + dialogClose: function (e) { + this.util(); + }, - if (e.currentTarget.dataset.idx != null) { - let idxx = e.currentTarget.dataset.idx; + util: function () { + /* 动画部分 */ + // 第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({ - idx: idxx + animationData: animation }) - } - this.util1(currentStatu) + + //关闭 + this.setData({ + showModalStatus: !this.data.showModalStatus, + }); + }.bind(this), 200) }, - 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({ - isUnit: idx - }) - } else if (which == "购货客户") { - that.setData({ - customerIndex: idx - }) - } else if (which == "部门") { - that.setData({ - departmentIndex: idx - }) - } else if (which == "销售类型") { - that.setData({ - saletypeIndex: idx - }) + itemclick: function (e) { + var flag = true; + var x = this.data.which; + var item = e.currentTarget.dataset.item; + var dmo = this.data.dmo; + switch (x) { + case "购货客户": + dmo.Customer_ID = item.ID; + dmo.Customer_Name = item.Name; + flag = false; + GetCustomerInfo(this, dmo); + break; + case "会计部门": + dmo.AccountingUnit_ID = item.ID; + dmo.AccountingUnit_Name = item.Name; + break; + case "部门": + dmo.Department_ID = item.ID; + dmo.Department_Name = item.Name; + break; + case "销售类型": + dmo.SaleKind_ID = item.ID; + dmo.SaleKind_Name = item.Name; + break; + case "存货": + var idx = this.data.rowIdx; + var detail = dmo.Details[idx]; + detail.SaleGoods_ID = item.ID; + detail.Goods_Name = item.Name; + flag = false; + GetGoodsInfo(this, dmo, detail); + break; } + if (flag) { + this.setData({ + dmo: dmo + }); + } + + this.util(); + }, + + getGoodsNum: function (e) { + let idx = e.target.dataset.idx; + var detail = this.data.dmo.Details[idx]; + let value = Number(e.detail.value); + if (isNaN(value)) { + wx.showModal({ + title: '提示', + content: '输入格式不正确', + }); + } else { + detail.UnitNum = value; + var numberNumber = detail.UnitNum / detail.RightRatio * detail.LeftRatio; + if (detail.Goods_UnitConvertDirection == 0 || detail.Goods_UnitConvertDirection == 1) { + detail.SecondNumber = numberNumber / (detail.Goods_MainUnitRatio) * (detail.Goods_SecondUnitRatio); + } + } this.setData({ - showModalStatus: false, + dmo: this.data.dmo }) }, - itemclick1: function (e) { - var that = this; - var name = e.currentTarget.dataset.name; - var id = e.currentTarget.dataset.data.SaleGoods_ID; - var pp = e.currentTarget.dataset.policyprice; - var price = e.currentTarget.dataset.data.Price; - var Goods_MainUnitRatio = e.currentTarget.dataset.data.Goods_MainUnitRatio - var Goods_SecondUnitRatio = e.currentTarget.dataset.data.Goods_SecondUnitRatio - var Goods_UnitConvertDirection = e.currentTarget.dataset.data.Goods_UnitConvertDirection - - if (e.currentTarget.dataset.data.RightRatio == null) { - this.data.obj[this.data.idx].RightRatio = Number(1) - } - if (e.currentTarget.dataset.data.LeftRatio == null) { - this.data.obj[this.data.idx].LeftRatio = Number(1) + + getSecondNum: function (e) { + let idx = e.target.dataset.idx; + var detail = this.data.dmo.Details[idx]; + let value = Number(e.detail.value); + if (isNaN(value)) { + wx.showModal({ + title: '提示', + content: '输入格式不正确', + }); + } else { + detail.SecondNumber = value; + + var numberNumber = detail.SecondNumber / detail.LeftRatio * detail.RightRatio; + if (detail.Goods_UnitConvertDirection == 0 || detail.Goods_UnitConvertDirection == 2) { + detail.UnitNum = numberNumber / (Goods_SecondUnitRatio) * (Goods_MainUnitRatio); + } } - this.data.obj[this.data.idx].Goods_MainUnitRatio = Number(Goods_MainUnitRatio) - this.data.obj[this.data.idx].Goods_SecondUnitRatio = Number(Goods_SecondUnitRatio) - this.data.obj[this.data.idx].SaleGoods_ID = Number(id); - this.data.obj[this.data.idx].Goods_Name = name; - this.data.obj[this.data.idx].Price = Number(price) - this.data.obj[this.data.idx].PolicyPrice = Number(pp); - this.data.obj[this.data.idx].Goods_UnitConvertDirection = Number(Goods_UnitConvertDirection) this.setData({ - showModalStatus1: false, - obj: that.data.obj + dmo: this.data.dmo }) }, - 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) - } + + getPrice: function (e) { + let idx = e.target.dataset.idx; + let value = Number(e.detail.value); + if (isNaN(value)) { + wx.showToast({ + title: '提示', + content: '输入格式不正确', + }) + } else + this.data.dmo.Details[idx].Price = value; + this.setData({ + dmo: this.data.dmo + }) }, - select1: function (e) { - var that = this; - var value = e.detail.value; - let timestamp = Date.parse(new Date()); - let date = "/Date(" + timestamp + "+0800)/"; - GetGoodsWithUnitPrice(that, value, date) + + deleteItem: function (e) { + let idx = e.target.dataset.idx; + this.data.dmo.Details.splice(idx, 1) + this.setData({ + dmo: this.data.dmo + }) }, - submitForm: function () { - let unitID = this.data.unit[this.data.isUnit].ID; - let customerID = this.data.customer[this.data.customerIndex].ID; - let departmentID = this.data.department[this.data.departmentIndex].ID; - let saletypeID = this.data.saletype[this.data.saletypeIndex].ID; - let year = this.data.dateTimeArray1[0][this.data.dateTime1[0]] - let month = this.data.dateTimeArray1[1][this.data.dateTime1[1]] - let date = this.data.dateTimeArray1[2][this.data.dateTime1[2]] - let hour = this.data.dateTimeArray1[3][this.data.dateTime1[3]] - let minu = this.data.dateTimeArray1[4][this.data.dateTime1[4]] + add: function (e) { + let newobj = {}; + this.data.dmo.Details.push(newobj); + this.setData({ + dmo: this.data.dmo + }) + }, - let stringTime = year + "/" + month + "/" + date + " " + hour + ":" + minu + ":00" - let timestamp2 = Date.parse(new Date(stringTime)); - let update = "/Date(" + timestamp2 + "+0800)/"; + submitForm: function () { + var dmo = this.data.dmo; - if (customerID == 0) { + if (dmo.Customer_ID == null) { wx.showToast({ title: '请选择购货客户' }) return; } - if (unitID == 0) { + if (dmo.AccountingUnit_ID == null) { wx.showToast({ title: '请选择会计单位' }) return; } - if (departmentID == 0) { + if (dmo.Department_ID == null) { wx.showToast({ title: '请选择销售部门', }) return; } - if (saletypeID == 0) { + if (dmo.SaleKind_ID == null) { wx.showToast({ title: '请选择销售类型', }) return; } - if (this.data.addrs == "") { + + if (dmo.DeliverAddress == "") { wx.showToast({ title: '请填写送货地址', }) return; } - let detailsArray = []; - - for (var i = 0; i < this.data.obj.length; i++) { - if (this.data.obj[i].Goods_Name == "请选择存货") { + for (var i = 0; i < dmo.Details.length; i++) { + if (dmo.Details[i].SaleGoods_ID == null) { wx.showToast({ title: '存货不能为空', }) return; } - if (this.data.obj[i].goodsNum == null) { + if (dmo.Details[i].UnitNum == null) { wx.showToast({ title: '报货数量不能为空', }) return; } - if (this.data.obj[i].goodsSecondNum == null) { + if (dmo.Details[i].SecondNumber == null) { wx.showToast({ title: '辅数量不能为空', }) return; } - var olddID = 0; - if (this.data.obj[i].ID == null) { - olddID = 0 - } else { - olddID = Number(this.data.obj[i].ID) - } - var dmo = { - SaleGoods_ID: this.data.obj[i].SaleGoods_ID, - UnitNum: this.data.obj[i].goodsNum, - SecondNumber: this.data.obj[i].goodsSecondNum, - Price: this.data.obj[i].Price, - PolicyPrice: this.data.obj[i].PolicyPrice, - ID: olddID - } - detailsArray.push(dmo) } - let method = update; let params = [{ - "Customer_ID": customerID, - "LoadTime": update, - "AccountingUnit_ID": unitID, - "Department_ID": departmentID, - "SaleKind_ID": saletypeID, - "DeliverAddress": this.data.addrs, - "Details": detailsArray, - "ID": orderID + "Customer_ID": dmo.Customer_ID, + "Date": dmo.Date, + "AccountingUnit_ID": dmo.AccountingUnit_ID, + "Department_ID": dmo.Department_ID, + "SaleKind_ID": dmo.SaleKind_ID, + "DeliverAddress": dmo.DeliverAddress, + "Details": dmo.Details, + "ID": dmo.ID }]; network.transfer_request(method, params, function (res) { @@ -608,8 +443,7 @@ Page({ title: '提示', content: '修改成功,是否返回上级列表', success: function (res) { - if (res.cancel) { - } else { + if (res.cancel) { } else { wx.navigateBack({ delta: 1 }) @@ -621,106 +455,4 @@ Page({ }) }, - changeDateTime1(e) { - this.setData({ - dateTime1: e.detail.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()参数,返回值是日期和时间 - // 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/saleForecastList/Detail/Detail.wxml b/pages/saleForecastList/Detail/Detail.wxml index 2e818b9..73d6ffc 100644 --- a/pages/saleForecastList/Detail/Detail.wxml +++ b/pages/saleForecastList/Detail/Detail.wxml @@ -1,9 +1,4 @@ - - - + 基本信息 预报详细 @@ -14,18 +9,15 @@ + 购货客户 - - - {{customer[customerIndex].Name}} + + {{dmo.Customer_Name?dmo.Customer_Name:"请选择客户"}} - 发货时间 @@ -36,36 +28,26 @@ - 会计单位 - - - - {{unit[isUnit].Name}} + + {{dmo.AccountingUnit_Name?dmo.AccountingUnit_Name:"请选择会计单位"}} 销售部门 - - - {{department[departmentIndex].Name}} + + {{dmo.Department_Name?dmo.Department_Name:"请选择销售部门"}} - 销售类型 - - - {{saletype[saletypeIndex].Name}} + + {{dmo.SaleKind_Name?dmo.SaleKind_Name:"请选择销售类型"}} @@ -76,78 +58,51 @@ - - - - - - - - - - - - - - - - - {{item.Name}} - - - - 取消 - - - - + - 存货名称 - - {{obj[idx].Goods_Name}} - + 存货名称 + + {{item.Goods_Name?item.Goods_Name:"请选择存货"}} - + + - - 报货数量 - - - + + 报货数量 + + + - - 辅 数 量 - - - - - 单 价 - - - + + 辅 数 量 + + + - - 政策单价 - {{obj[idx].PolicyPrice}} - - + + 单 价 + - 删除 + + 政策单价 + {{item.PolicyPrice}} + + + + + 删除 @@ -155,29 +110,23 @@ - - - - - - - - - - - - - - - {{item.Goods_Name}} - - - - 取消 - - \ No newline at end of file + + + + + + + + + + + + {{item.Name}} + + + + 取消 + \ No newline at end of file diff --git a/pages/saleForecastList/Detail/Detail.wxss b/pages/saleForecastList/Detail/Detail.wxss index c35ca30..3049cc7 100644 --- a/pages/saleForecastList/Detail/Detail.wxss +++ b/pages/saleForecastList/Detail/Detail.wxss @@ -1,5 +1,4 @@ -/* pages/orderinfo/orderinfo.wxss */ - +/* pages/saleForecastList/Detail/Detail.wxss */ page { background: #EAF1F8; height: calc(100%-10px); diff --git a/pages/saleForecastList/Detail1/Detail.js b/pages/saleForecastList/Detail1/Detail.js new file mode 100644 index 0000000..0bdaa5d --- /dev/null +++ b/pages/saleForecastList/Detail1/Detail.js @@ -0,0 +1,726 @@ +// pages/orderinfo/orderinfo.js +var app = getApp() +var network = require("../../../utils/net.js") +var dateTimePicker = require('../../../utils/dateTimePicker.js'); +var utilll = require('../../../utils/util.js'); +var timechage = require("../../../utils/dateTimeUtil.js") +var orderID = 0; + +var getAccountingUnit = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit"; +var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer"; +var getDept = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment"; +var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; +var getSaleKind = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetSaleKind" + +var load = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Load"; +let update = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Update'; + +function setTime(that) { + // 获取完整的年月日 时分秒,以及默认显示的数组 + var obj1 = dateTimePicker.dateTimePicker(that.data.startYear, that.data.endYear, that.data.loadTime); + // 精确到分的处理,将数组的秒去掉 + var lastArray = obj1.dateTimeArray.pop(); + var lastTime = obj1.dateTime.pop(); + + that.setData({ + dateTimeArray1: obj1.dateTimeArray, + dateTime1: obj1.dateTime + }); +} + +function GetAccountingUnit(that, inputValue) { + let method = 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: "会计单位" + }) +} + +function GetCustomer(that, inputValue) { + let method = 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: "购货客户" + }) +} + +function GetDepartment(that, inputValue) { + let method = getDept; + let params = [{ + "InputValue": inputValue, + "PageIndex": 0, + "PageSize": 100 + }]; + network.transfer_request(method, params, function (res) { + that.setData({ + currency: res.result, + department: res.result + }) + }) + that.setData({ + which: "部门" + }) +} + +function GetSaleKind(that, v) { + let method = getSaleKind; + let params = [{ + "InputValue": v, + "PageIndex": 0, + "PageSize": 100 + }]; + network.transfer_request(method, params, function (res) { + that.setData({ + currency: res.result, + saletype: res.result + }) + }) + that.setData({ + which: "销售类型" + }) +} + +function GetGoodsWithUnitPrice(that, v, date) { + let unitID = that.data.unit[that.data.isUnit].ID; + let customerID = that.data.customer[that.data.customerIndex].ID; + let method = getGoods; + let params = [{ + "Input": v, + "PageIndex": 0, + "PageSize": 100, + "Customer_ID": customerID, + "AccountingUnit_ID": unitID, + "Date": date + }]; + network.transfer_request(method, params, function (res) { + that.setData({ + goods: res.result, + }) + }) +} + +Page({ + + /** + * 页面的初始数据 + */ + data: { + /** + * 页面配置 + */ + which: "", + winWidth: 0, + winHeight: app.globalData.winHeight, + // tab切换 + currentTab: 0, + obj: [], + goods: [], + idx: 0, + currency: [], + saletypeIndex: 0, + saletype: [{ + ID: 0, + Name: "请选择销售类型" + }], + departmentIndex: 0, + department: [{ + ID: 0, + Name: "请选择销售部门" + }], + customerIndex: 0, + customer: [{ + ID: 0, + Name: "请选择客户" + }], + isUnit: 0, + unit: [{ + ID: 0, + Name: "请选择会计单位" + }], + addrs: "", + dateTimeArray1: null, + dateTime1: null, + startYear: 2018, + endYear: 2030, + loadTime: "" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + let ID = Number(options.ID); + orderID = ID; + + let method = load; + let params = [ID]; + network.transfer_request(method, params, function (res) { + let customerOld = [{ + ID: res.result.Customer_ID, + Name: res.result.Customer_Name + }] + + let unitOld = [{ + ID: res.result.AccountingUnit_ID, + Name: res.result.AccountingUnit_Name + }] + + let departmentOld = [{ + ID: res.result.Department_ID, + Name: res.result.Department_Name + }] + + let saletypeOld = [{ + ID: res.result.SaleKind_ID, + Name: res.result.SaleKind_Name + }] + + let addrrrr = res.result.DeliverAddress + let loadtimee = timechage.formatTimeTwo(res.result.Date.substring(6, 19), 'Y-M-D h:m') + + let details = []; + + for (var i = 0; i < res.result.Details.length; i++) { + if (res.result.Details[i].RightRatio == null) { + var rightRatio = 1 + } + if (res.result.Details[i].LeftRatio == null) { + var leftRatio = 1 + } + var dmo = { + "Goods_Name": res.result.Details[i].Goods_Name, + "SaleGoods_ID": res.result.Details[i].SaleGoods_ID, + "goodsNum": res.result.Details[i].UnitNum, + "goodsSecondNum": res.result.Details[i].SecondNumber, + "Price": res.result.Details[i].Price, + "PolicyPrice": res.result.Details[i].PolicyPrice, + "Goods_MainUnitRatio": res.result.Details[i].Goods_MainUnitRatio, + "Goods_SecondUnitRatio": res.result.Details[i].Goods_SecondUnitRatio, + "Goods_UnitConvertDirection": res.result.Details[i].Goods_UnitConvertDirection, + "RightRatio": rightRatio, + "LeftRatio": leftRatio, + "ID": res.result.Details[i].ID + } + details.push(dmo) + } + + that.setData({ + customer: customerOld, + unit: unitOld, + department: departmentOld, + saletype: saletypeOld, + addrs: addrrrr, + loadTime: loadtimee, + obj: details + }) + setTime(that) + + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + /** + * 滑动切换tab + */ + bindChange: function (e) { + + var that = this; + that.setData({ + currentTab: e.detail.current + }); + + }, + /** + * 点击tab切换 + */ + swichNav: function (e) { + + var that = this; + + if (this.data.currentTab === e.target.dataset.current) { + return false; + } else { + that.setData({ + currentTab: e.target.dataset.current + }) + } + }, + + getAddrs: function (e) { + this.data.addrs = e.detail.value; + }, + add: function (e) { + + let newobj = { + Goods_Name: "请选择存货" + }; + + this.data.obj.push(newobj) + + let aaa = this.data.obj; + + this.setData({ + obj: aaa, + }) + }, + deleteItem: function (e) { + let idx = e.target.dataset.idx; + let deleteobj = this.data.obj; + deleteobj.splice(idx, 1) + this.setData({ + obj: deleteobj + }) + }, + + getGoodsNum: function (e) { + //值: + //e.detail.value + //设置的id + //e.target.dataset.index + let value = e.detail.value; + let idx = e.target.dataset.idx; + + let end = value.charAt(value.length - 1) + if (end != ".") { + + this.data.obj[idx].goodsNum = Number(value); + + let Goods_MainUnitRatio = this.data.obj[idx].Goods_MainUnitRatio + let Goods_SecondUnitRatio = this.data.obj[idx].Goods_SecondUnitRatio + let Goods_UnitConvertDirection = this.data.obj[idx].Goods_UnitConvertDirection + let RightRatio = this.data.obj[idx].RightRatio + let LeftRatio = this.data.obj[idx].LeftRatio + + var numberNumber = Number(value) / RightRatio * LeftRatio; + if (Goods_UnitConvertDirection == 0 || Goods_UnitConvertDirection == 1) { + let secondNumber = numberNumber / (Goods_MainUnitRatio) * (Goods_SecondUnitRatio); + this.data.obj[idx].goodsSecondNum = Number(secondNumber) + this.setData({ + obj: this.data.obj + }) + } + } + + }, + getSecondNum: function (e) { + let value = e.detail.value; + let idx = e.target.dataset.idx; + + let end = value.charAt(value.length - 1) + if (end != ".") { + this.data.obj[idx].goodsSecondNum = Number(value); + + let Goods_MainUnitRatio = this.data.obj[idx].Goods_MainUnitRatio + let Goods_SecondUnitRatio = this.data.obj[idx].Goods_SecondUnitRatio + let Goods_UnitConvertDirection = this.data.obj[idx].Goods_UnitConvertDirection + let RightRatio = this.data.obj[idx].RightRatio + let LeftRatio = this.data.obj[idx].LeftRatio + + var numberNumber = Number(value) / LeftRatio * RightRatio; + if (Goods_UnitConvertDirection == 0 || Goods_UnitConvertDirection == 2) { + let unitnumber = numberNumber / (Goods_SecondUnitRatio) * (Goods_MainUnitRatio); + this.data.obj[idx].goodsNum = Number(unitnumber) + this.setData({ + obj: this.data.obj + }) + } + } + }, + getPrice: function (e) { + let value = e.detail.value; + let idx = e.target.dataset.idx; + this.data.obj[idx].Price = Number(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) + }, + powerDrawer1: function (e) { + let that = this; + let currentStatu = e.currentTarget.dataset.statu; + + let timestamp = Date.parse(new Date()); + let date = "/Date(" + timestamp + "+0800)/"; + GetGoodsWithUnitPrice(that, "", date) + + if (e.currentTarget.dataset.idx != null) { + let idxx = e.currentTarget.dataset.idx; + this.setData({ + idx: idxx + }) + } + this.util1(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({ + isUnit: idx + }) + } else if (which == "购货客户") { + that.setData({ + customerIndex: idx + }) + } else if (which == "部门") { + that.setData({ + departmentIndex: idx + }) + } else if (which == "销售类型") { + that.setData({ + saletypeIndex: idx + }) + } + + this.setData({ + showModalStatus: false, + }) + }, + itemclick1: function (e) { + var that = this; + var name = e.currentTarget.dataset.name; + var id = e.currentTarget.dataset.data.SaleGoods_ID; + var pp = e.currentTarget.dataset.policyprice; + var price = e.currentTarget.dataset.data.Price; + var Goods_MainUnitRatio = e.currentTarget.dataset.data.Goods_MainUnitRatio + var Goods_SecondUnitRatio = e.currentTarget.dataset.data.Goods_SecondUnitRatio + var Goods_UnitConvertDirection = e.currentTarget.dataset.data.Goods_UnitConvertDirection + + if (e.currentTarget.dataset.data.RightRatio == null) { + this.data.obj[this.data.idx].RightRatio = Number(1) + } + if (e.currentTarget.dataset.data.LeftRatio == null) { + this.data.obj[this.data.idx].LeftRatio = Number(1) + } + this.data.obj[this.data.idx].Goods_MainUnitRatio = Number(Goods_MainUnitRatio) + this.data.obj[this.data.idx].Goods_SecondUnitRatio = Number(Goods_SecondUnitRatio) + this.data.obj[this.data.idx].SaleGoods_ID = Number(id); + this.data.obj[this.data.idx].Goods_Name = name; + this.data.obj[this.data.idx].Price = Number(price) + this.data.obj[this.data.idx].PolicyPrice = Number(pp); + this.data.obj[this.data.idx].Goods_UnitConvertDirection = Number(Goods_UnitConvertDirection) + this.setData({ + showModalStatus1: false, + obj: that.data.obj + }) + }, + 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) + } + }, + select1: function (e) { + var that = this; + var value = e.detail.value; + let timestamp = Date.parse(new Date()); + let date = "/Date(" + timestamp + "+0800)/"; + GetGoodsWithUnitPrice(that, value, date) + }, + submitForm: function () { + let unitID = this.data.unit[this.data.isUnit].ID; + let customerID = this.data.customer[this.data.customerIndex].ID; + let departmentID = this.data.department[this.data.departmentIndex].ID; + let saletypeID = this.data.saletype[this.data.saletypeIndex].ID; + + let year = this.data.dateTimeArray1[0][this.data.dateTime1[0]] + let month = this.data.dateTimeArray1[1][this.data.dateTime1[1]] + let date = this.data.dateTimeArray1[2][this.data.dateTime1[2]] + let hour = this.data.dateTimeArray1[3][this.data.dateTime1[3]] + let minu = this.data.dateTimeArray1[4][this.data.dateTime1[4]] + + let stringTime = year + "/" + month + "/" + date + " " + hour + ":" + minu + ":00" + let timestamp2 = Date.parse(new Date(stringTime)); + let update = "/Date(" + timestamp2 + "+0800)/"; + + if (customerID == 0) { + wx.showToast({ + title: '请选择购货客户' + }) + return; + } + if (unitID == 0) { + wx.showToast({ + title: '请选择会计单位' + }) + return; + } + + if (departmentID == 0) { + wx.showToast({ + title: '请选择销售部门', + }) + return; + } + + if (saletypeID == 0) { + wx.showToast({ + title: '请选择销售类型', + }) + return; + } + if (this.data.addrs == "") { + wx.showToast({ + title: '请填写送货地址', + }) + return; + } + + let detailsArray = []; + + for (var i = 0; i < this.data.obj.length; i++) { + if (this.data.obj[i].Goods_Name == "请选择存货") { + wx.showToast({ + title: '存货不能为空', + }) + return; + } + if (this.data.obj[i].goodsNum == null) { + wx.showToast({ + title: '报货数量不能为空', + }) + return; + } + if (this.data.obj[i].goodsSecondNum == null) { + wx.showToast({ + title: '辅数量不能为空', + }) + return; + } + var olddID = 0; + if (this.data.obj[i].ID == null) { + olddID = 0 + } else { + olddID = Number(this.data.obj[i].ID) + } + var dmo = { + SaleGoods_ID: this.data.obj[i].SaleGoods_ID, + UnitNum: this.data.obj[i].goodsNum, + SecondNumber: this.data.obj[i].goodsSecondNum, + Price: this.data.obj[i].Price, + PolicyPrice: this.data.obj[i].PolicyPrice, + ID: olddID + } + detailsArray.push(dmo) + } + + + let method = update; + let params = [{ + "Customer_ID": customerID, + "LoadTime": update, + "AccountingUnit_ID": unitID, + "Department_ID": departmentID, + "SaleKind_ID": saletypeID, + "DeliverAddress": this.data.addrs, + "Details": detailsArray, + "ID": orderID + }]; + + network.transfer_request(method, params, function (res) { + if (res.result == null) { + wx.showModal({ + title: '提示', + content: '修改成功,是否返回上级列表', + success: function (res) { + if (res.cancel) { + } else { + wx.navigateBack({ + delta: 1 + }) + } + }, + fail: function (res) { } + }) + } + }) + + }, + changeDateTime1(e) { + this.setData({ + dateTime1: e.detail.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()参数,返回值是日期和时间 + // 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/saleForecastList/Detail1/Detail.json b/pages/saleForecastList/Detail1/Detail.json new file mode 100644 index 0000000..3ee66ef --- /dev/null +++ b/pages/saleForecastList/Detail1/Detail.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "white", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "预报详情" +} \ No newline at end of file diff --git a/pages/saleForecastList/Detail1/Detail.wxml b/pages/saleForecastList/Detail1/Detail.wxml new file mode 100644 index 0000000..2e818b9 --- /dev/null +++ b/pages/saleForecastList/Detail1/Detail.wxml @@ -0,0 +1,183 @@ + + + + + 基本信息 + 预报详细 + + + + + + + + + 购货客户 + + + {{customer[customerIndex].Name}} + + + + + + + 发货时间 + + + {{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}} + + + + + + + + 会计单位 + + + + {{unit[isUnit].Name}} + + + + + + 销售部门 + + + {{department[departmentIndex].Name}} + + + + + + + 销售类型 + + + {{saletype[saletypeIndex].Name}} + + + + + + 送货地址 + + + + + + + + + + + + + + + + + + + + + + + {{item.Name}} + + + + 取消 + + + + + + + + + + + + + 存货名称 + + {{obj[idx].Goods_Name}} + + + + + + 报货数量 + + + + + + 辅 数 量 + + + + + + 单 价 + + + + + + 政策单价 + {{obj[idx].PolicyPrice}} + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.Goods_Name}} + + + + 取消 + + + \ No newline at end of file diff --git a/pages/saleForecastList/Detail1/Detail.wxss b/pages/saleForecastList/Detail1/Detail.wxss new file mode 100644 index 0000000..c35ca30 --- /dev/null +++ b/pages/saleForecastList/Detail1/Detail.wxss @@ -0,0 +1,229 @@ +/* pages/orderinfo/orderinfo.wxss */ + +page { + background: #EAF1F8; + height: calc(100%-10px); +} +.swiper-tab { + /* height: 30px; */ + margin: 10px 20px; + text-align: center; + line-height: 30px; + background: white; + display: flex; + flex-direction: row; + border-radius: 5px; + border: 1px solid#2E8CF5; + overflow: hidden; +} + +.swiper-tab-list { + height: 100%; + width: 50%; + font-size: 30rpx; + color: #777; +} + +.on { + background-color:#2E8CF5 ; + color: white; +} + + +.swiper-box { + display: block; + width: 100%; + overflow: hidden; +} + +.swiper-items1 { + height: 100%; +} + +.swiper-items2 { + height: 100%; +} + +.scroll-views { + height: 100%; +} + +.backGroundContainer{ + background: #fff; +} + +.baseitem { + height: 60rpx; + background: #fff; + /* border-bottom: 0.1px solid #dbdbdb; */ + display: flex; + flex-direction: row; + align-items: center; + padding: 20rpx 20rpx; + font-size: 30rpx; + +} + +.horizontallineView { + height: 1rpx; + background-color: #dbdbdb; + margin-left: 20rpx; + margin-right: 0rpx; +} + +.baseitem_key { + color: #666; + width: 30%; + /* margin-left: 20rpx; */ +} + +.baseitem_value { + color: rgb(48, 48, 48); + /* margin-left: 20rpx; + margin-right: 20rpx; */ + width: 70%; + text-align: right; +} + +.baseitem_key2 { + color: #666; + width: 30%; + /* margin-left: 20rpx; */ +} + +.baseitem_value2 { + color: rgb(48, 48, 48); + /* margin-left: 20rpx; + margin-right: 20rpx; */ + width: 70%; + text-align: right; +} + +.baseitem_key1 { + color: #666; + width: 30%; + margin-left: 20rpx; +} + +.baseitem_value1 { + color: rgb(48, 48, 48); + /* margin-left: 20rpx; + margin-right: 20rpx; */ + width: 70%; + text-align: right; +} + +.add { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + border-left: none; + background: #fff; + width: 100%; + margin-top: 20rpx; + border-top: 0.5px solid #e0e0e0; + border-bottom: 0.5px solid #e0e0e0; + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.ico { + height: 42rpx; + width: 42rpx; +} + +.delete { + width: 100%; + padding-top: 20rpx; + padding-bottom: 20rpx; + color: red; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + background: #fff; + font-size: 30rpx; +} + +.itemView { + margin-top: 20rpx; + background: #fff; +} + +.submit { + margin-left: 5%; + margin-top: 10%; + width: 90%; + margin-right: 5%; + color: #fff; + background: linear-gradient(to right, #39c4fd, #539eef); +} + +.drawer_screen { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + z-index: 1000; + background: #000; + opacity: 0.5; + overflow: hidden; +} + +.sousuo { + /* margin-right: 10%; + margin-left: 10%; */ + text-align: center; + background: #d6d8da; + height: 40px; + font-size: 28rpx; +} + + +.drawer_content { + height: 500rpx; + overflow-y: scroll; /*超出父盒子高度可滚动*/ +} + +.drawer_box { + width: 650rpx; + overflow: hidden; + position: fixed; + top: 50%; + left: 0; + z-index: 1001; + background: #fafafa; + margin: -150px 50rpx 0 50rpx; + border-radius: 3px; +} + +.btn_ok { + padding: 10px; + font: 20px "microsoft yahei"; + text-align: center; + border-top: 1px solid #e8e8ea; + color: #2E8CF5; +} + +.top { + height: 20%; + justify-content: center; + align-items: center; +} + +.grid1 { + width: 100%; + border-bottom: 1px solid #c3c3c3; + /* padding-top: 5px; + padding-bottom: 10px; */ + padding-top: 16rpx; + padding-bottom: 16rpx; + text-align: center; +} + +.text3 { + font-size: 18px; + color: rgb(48, 48, 48); +} \ No newline at end of file