From 1dfcb7b6ae74943b88d827de38849d1239d616eb Mon Sep 17 00:00:00 2001 From: chenxuhui Date: Fri, 14 Dec 2018 15:49:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=A6=81=E7=94=A8=E5=88=B0=E7=9A=84=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=202=E3=80=81=E6=B7=BB=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=95=8C=E9=9D=A2=E6=8E=A5=E5=8F=A3=EF=BC=9A=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=AE=A2=E6=88=B7=E5=AF=B9=E5=BA=94=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E5=91=98=E5=8F=96=E4=BB=93=E5=BA=93=E5=8F=8A=E9=94=80=E5=94=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 26 +++++++---- pages/homePage/homePage.js | 13 +++++- pages/login/login.js | 1 + pages/order/newBill/newBill.js | 79 ++++++++++++++++++---------------- pages/order/order.js | 7 +-- 5 files changed, 74 insertions(+), 52 deletions(-) diff --git a/app.js b/app.js index 7bd998f..e0da38c 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,23 @@ App({ } }); }, + onShow: function (options) { + var that = this; + var path = options.path; + if (options.query.id) { + wx.reLaunch({ + url: '/pages/login/login', + complete: function (res) { + that.globalData.shareInPath = path; + that.globalData.shareInParameter = options.query; + }, + }); + } + }, globalData: { + shareInPath: "", + shareInParameter: {}, + shareInState: 1, winHeight:0, cookie: "", decryptCookie: '', @@ -20,13 +36,7 @@ App({ openID: "", appID: "wx0b897783b2588147", userID:"", - - // Phone: "", - // OpenId: "", - // AppName: "WeChat", - // AppId: "wx0b897783b2588147", - // BaseUrl: "https://miniprogram.food988.com/Rest.aspx", - // TranferBaseUrl:"https://miniprogram.food988.com/RequestTransfer.aspx", - // CustomerId:"", + selectStartDate:null, + selectEndDate:null, }, }) \ No newline at end of file diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js index bce7e42..c3044cd 100644 --- a/pages/homePage/homePage.js +++ b/pages/homePage/homePage.js @@ -1,5 +1,5 @@ // pages/homePage/homePage.js - +var app = getApp() var network = require("../../utils/net.js") var timechage = require("../../utils/dateTimeUtil.js") @@ -21,12 +21,21 @@ Page({ var that = this; // 添加接口请求当前余额 GetUserProfile(function(res) { - console.log(res); if (res != null) { that.setData({ balance: res.result }); } + var shareURL = app.globalData.shareInPath; + if (shareURL) { + app.globalData.shareInState = 0, + wx.navigateTo({ + url: "../../" + shareURL, + complete: function (res) { + + }, + }) + } }); }, diff --git a/pages/login/login.js b/pages/login/login.js index e9ebbbe..d4ce37d 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -78,6 +78,7 @@ function setCurrentCustomerID (){ let method = getCurrentID; let params = []; network.transfer_request(method, params, function (res) { + console.log("当前客户信息==" + res.result); app.globalData.userID = res.result; }) } diff --git a/pages/order/newBill/newBill.js b/pages/order/newBill/newBill.js index 40115dd..e39b719 100644 --- a/pages/order/newBill/newBill.js +++ b/pages/order/newBill/newBill.js @@ -15,11 +15,9 @@ var getStore = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetStore" var getTakeGoodsType = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetTakeGoods_Type" var getGoodsDetail = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsDetailWithPrice" var getCustomerInfo = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/GetCustomerRefDto" - let insert = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/Insert' - var getUserPrifile = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/GetUserPrifile" - +var getEmployeePrifile = "/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountRpc/GetEmployeePrifile" // 获取完整的年月日 时分秒,以及默认显示的数组' function setTime(that) { // 精确到分的处理,将数组的秒去掉 @@ -36,7 +34,7 @@ function setTime(that) { } function GetBaseInfoList(that, method, params) { - network.transfer_request(method, params, function (res) { + network.transfer_request(method, params, function(res) { that.setData({ currency: res.result }); @@ -50,7 +48,7 @@ function GetGoodsInfo(that, dmo, detail) { "AccountingUnit_ID": dmo.AccountingUnit_ID, "Date": dmo.LoadTime, }] - network.transfer_request(getGoodsDetail, params, function (res) { + 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; @@ -72,9 +70,9 @@ function GetGoodsInfo(that, dmo, detail) { }); } -function GetCustomerInfo(that, dmo) { - var params = [app.globalData.userID, ["Name","Department_ID", "Department_Name", "Employee_ID", "Employee_Name", "AccountingUnit_ID", "AccountingUnit_Name", "TakeGoods_Type", "Address"]] - network.transfer_request(getCustomerInfo, params, function (res) { +function GetCustomerInfo(that, dmo, succession) { + var params = [app.globalData.userID, ["Name", "Department_ID", "Department_Name", "Employee_ID", "Employee_Name", "AccountingUnit_ID", "AccountingUnit_Name", "TakeGoods_Type", "Address"]] + network.transfer_request(getCustomerInfo, params, function(res) { var obj = JSON.parse(res.result); dmo.Customer_ID = app.globalData.userID; dmo.Customer_Name = obj.Name; @@ -92,6 +90,7 @@ function GetCustomerInfo(that, dmo) { that.setData({ dmo: dmo }); + succession(); }); } @@ -110,19 +109,18 @@ Page({ backPage: "", }, - onLoad: function (options) { + onLoad: function(options) { var that = this; var dmo = this.data.dmo; setTime(that); - this.getUserPrifile(function(res){ - GetCustomerInfo(that, dmo); + GetCustomerInfo(that, dmo, function(res) { + that.getEmployeePrifile(); }); }, - getUserPrifile: function (succession) { + getEmployeePrifile: function() { var that = this; - network.transfer_request(getUserPrifile, [], function (res) { - succession(); + network.transfer_request(getEmployeePrifile, [this.data.dmo.Employee_ID], function(res) { that.data.dmo.SaleKind_ID = res.result.Order_SaleKind_ID; that.data.dmo.SaleKind_Name = res.result.Order_SaleKind_Name; that.data.dmo.Store_ID = res.result.Order_Store_ID; @@ -133,7 +131,7 @@ Page({ }); }, - onShow: function () { + onShow: function() { var that = this; if (this.data.backPage == "goodsNameChoosePage") { var goodsArr = app.globalData.goodsNameArray; @@ -156,7 +154,7 @@ Page({ /** * 滑动切换tab */ - bindChange: function (e) { + bindChange: function(e) { this.setData({ currentTab: e.detail.current }); @@ -164,7 +162,7 @@ Page({ /** * 点击tab切换 */ - swichNav: function (e) { + swichNav: function(e) { if (this.data.currentTab === e.target.dataset.current) { return false; } else { @@ -182,7 +180,7 @@ Page({ }, // 添加一个时间转换 - timeConversion: function () { + 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]] @@ -196,21 +194,21 @@ Page({ dmo: this.data.dmo, }) }, - getAddrs: function (e) { + getAddrs: function(e) { this.data.dmo.DeliverAddress = e.detail.value; this.setData({ dmo: this.data.dmo }); }, - getRemark: function (e) { + getRemark: function(e) { this.data.dmo.Remark = e.detail.value; this.setData({ dmo: this.data.dmo }); }, - powerDrawer: function (e) { + powerDrawer: function(e) { let x = e.currentTarget.dataset.x; if (x == "存货") { var dmo = this.data.dmo; @@ -234,13 +232,13 @@ Page({ }, // 遮罩存货输入框 - select: function (e) { + select: function(e) { var value = e.detail.value; var x = this.data.which; this.showDialog(x, value); }, - showDialog: function (x, value) { + showDialog: function(x, value) { var method = null; let params = [{ "InputValue": value, @@ -277,11 +275,11 @@ Page({ GetBaseInfoList(this, method, params); }, - dialogClose: function (e) { + dialogClose: function(e) { this.util(); }, - itemclick: function (e) { + itemclick: function(e) { var flag = true; var x = this.data.which; var item = e.currentTarget.dataset.item; @@ -333,7 +331,7 @@ Page({ this.util(); }, - getGoodsNum: function (e) { + getGoodsNum: function(e) { let idx = e.target.dataset.idx; var detail = this.data.dmo.Details[idx]; let value = Number(e.detail.value); @@ -355,7 +353,7 @@ Page({ }) }, - getSecondNum: function (e) { + getSecondNum: function(e) { let idx = e.target.dataset.idx; var detail = this.data.dmo.Details[idx]; let value = Number(e.detail.value); @@ -378,7 +376,7 @@ Page({ }, // - getPrice: function (e) { + getPrice: function(e) { let idx = e.target.dataset.idx; let value = Number(e.detail.value); if (isNaN(value)) { @@ -394,7 +392,7 @@ Page({ }, // 删除 - deleteItem: function (e) { + deleteItem: function(e) { let idx = e.target.dataset.idx; this.data.dmo.Details.splice(idx, 1) this.setData({ @@ -403,7 +401,7 @@ Page({ }, // 点击添加存货 - add: function (e) { + add: function(e) { // 新增获取存货 var dmo = this.data.dmo; if (dmo.Customer_ID == null) { @@ -424,7 +422,7 @@ Page({ }, // 提交 - submitForm: function () { + submitForm: function() { var dmo = this.data.dmo; if (dmo.Customer_ID == null) { wx.showToast({ @@ -475,7 +473,7 @@ Page({ return; } */ - + // if (dmo.DeliverAddress == "") { // wx.showToast({ // title: '请填写送货地址', @@ -483,6 +481,13 @@ Page({ // return; // } + if (dmo.Details.length <= 0) { + wx.showToast({ + title: '存货不能为空', + }) + return; + } + for (var i = 0; i < dmo.Details.length; i++) { if (dmo.Details[i].SaleGoods_ID == null) { wx.showToast({ @@ -515,25 +520,25 @@ Page({ "ID": dmo.ID }]; - network.transfer_request(method, params, function (res) { + network.transfer_request(method, params, function(res) { if (res.result != null) { wx.showModal({ title: '新建订单No.' + res.result, content: '新建成功,是否返回首页', - success: function (res) { + success: function(res) { if (res.confirm) { wx.navigateBack({ delta: 1 }) } }, - fail: function (res) { } + fail: function(res) {} }) } }) }, - util: function () { + util: function() { /* 动画部分 */ // 第1步:创建动画实例 var animation = wx.createAnimation({ @@ -550,7 +555,7 @@ Page({ animationData: animation.export() }) // 第5步:设置定时器到指定时候后,执行第二组动画 - setTimeout(function () { + setTimeout(function() { // 执行第二组动画 animation.opacity(1).rotateX(0).step(); // 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象 diff --git a/pages/order/order.js b/pages/order/order.js index bec0c2a..928513f 100644 --- a/pages/order/order.js +++ b/pages/order/order.js @@ -9,7 +9,7 @@ var getListPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/GetList var deleteItem = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/Delete" // 未审核订单列表 -function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successaction) { +function getUnCheckOrderList(that, UnCheckPageIndex, PageSize, successaction) { let getArr = []; let method = getListPath; let params = [{ @@ -49,7 +49,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successact } // 已审核订单列表 -function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) { +function getCheckedOrderList(that, CheckedPageIndex, PageSize) { let getArr = []; let method = getListPath; @@ -144,9 +144,6 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function() { - - PageSize = 10 - app.globalData.selectCustomer_ID = null app.globalData.selectStartDate = null app.globalData.selectEndDate = null