diff --git a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js index 91fd30a..004ff43 100644 --- a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js +++ b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js @@ -5,33 +5,53 @@ var dateTimePicker = require('../../utils/dateTimePicker.js'); var utilll = require('../../utils/util.js'); var getAccountingUnit = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit"; -var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer"; +var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; Page({ data: { winHeight: app.globalData.winHeight, currentTab: 0, - customerCollectionArray:[], - customerArray:[], + CollectionArray:[], + goodsArray:[], checkBoxArray:[], }, - GetCustomer: function(inputValue) { + GetGoodsWithUnitPrice: function (unitID, customerID) { var that =this; - let method = getCustomer; + let timestamp = Date.parse(new Date()); + let date = "/Date(" + timestamp + "+0800)/"; + let method = getGoods; let params = [{ - "InputValue": inputValue, + "Input": "", "PageIndex": 0, - "PageSize": 100 + "PageSize": 100, + "Customer_ID": parseInt(customerID), + "AccountingUnit_ID": parseInt(unitID), + "Date": date }]; - network.transfer_request(method, params, function(res) { + network.transfer_request(method, params, function (res) { that.setData({ - customerArray: res.result + goodsArray: res.result, }) }) }, + // GetCustomer: function(inputValue) { + // var that =this; + // let method = getCustomer; + // let params = [{ + // "InputValue": inputValue, + // "PageIndex": 0, + // "PageSize": 100 + // }]; + // network.transfer_request(method, params, function(res) { + // that.setData({ + // customerArray: res.result + // }) + // }) + // }, + // 多选框数值变化 checkboxValueChange: function (e) { this.setData({ @@ -41,9 +61,21 @@ Page({ // 点击添加存货明细按钮 存数据进入global addGoodsName:function(){ - app.globalData.goodsNameArray = this.data.checkBoxArray; - console.log("存货明细数组 == " + app.globalData.goodsNameArray); + let choseCheck = [] + // 对比原有数组和选中的数组 存在,将数组包含的其他值也取出加载 + for (var i = 0; i < this.data.goodsArray.length; i++) { + for (var j = 0; j < this.data.checkBoxArray.length; j++) { + if (Number(this.data.goodsArray[i].SaleGoods_ID) == this.data.checkBoxArray[j]) { + choseCheck.push(this.data.goodsArray[i]) + } + } + } + app.globalData.goodsNameArray = choseCheck; + wx.navigateBack({ + delta: 1, + }) }, + /** * 滑动切换tab */ @@ -54,6 +86,7 @@ Page({ }); }, + /** * 点击tab切换 */ @@ -67,61 +100,15 @@ Page({ }) } }, + /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { + let unitID = options.unitID; + let customerID = options.customerID; + this.GetGoodsWithUnitPrice(unitID, customerID); - this.GetCustomer(); - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } }) \ No newline at end of file diff --git a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml index 2315653..3c1eabd 100644 --- a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml +++ b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml @@ -15,7 +15,7 @@ - +