commit 3d495a593dc0e8bde469da370e656b01deed2cb1 Author: robin <3504557@qq.com> Date: Mon Nov 5 18:25:30 2018 +0800 init diff --git a/app.js b/app.js new file mode 100644 index 0000000..0d282d8 --- /dev/null +++ b/app.js @@ -0,0 +1,20 @@ +//app.js +App({ + onLaunch: function() { + + }, + globalData: { + PhoneNum: "", + OpenId: "", + AppName: "WeChat", + AppId: "wx1a89a89a80318160", + Cookie: "", + DecryptCookie:'', + UserInfo: null, + BaseUrl: "https://miniprogram.food988.com/Rest.aspx", + LoginPath: "/MainSystem/MainSystem/Auth/WeixinLogin", + TransferUrl:'https://miniprogram.food988.com/RequestTransfer.aspx', + CustomerId:0, + SelectCustomer_ID:null + } +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..a35c8e1 --- /dev/null +++ b/app.json @@ -0,0 +1,38 @@ +{ + "pages": [ + "pages/selectCustomer/selctCustomer", + "pages/index/index", + "pages/logs/logs", + "pages/main/main", + "pages/my/my", + "pages/saleForecastList/saleForecastList", + "pages/saleForecastList/Detail/Detail", + "pages/saleForecastList/query/query", + "pages/saleForecastList/newBill/newBill" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#2589f8", + "navigationBarTitleText": "业务易", + "navigationBarTextStyle": "#FFFFFF", + "disableScroll": true + }, + "tabBar": { + "selectedColor": "#00C7B3", + "color": "#CFCFCF", + "list": [ + { + "pagePath": "pages/main/main", + "text": "主页", + "iconPath": "/imgs/main1.png", + "selectedIconPath": "/imgs/main.png" + }, + { + "pagePath": "pages/my/my", + "text": "我的", + "iconPath": "/imgs/my1.png", + "selectedIconPath": "/imgs/my.png" + } + ] + } +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/imgs/create.png b/imgs/create.png new file mode 100644 index 0000000..0656ecd Binary files /dev/null and b/imgs/create.png differ diff --git a/imgs/main-bg.jpg b/imgs/main-bg.jpg new file mode 100644 index 0000000..acc5782 Binary files /dev/null and b/imgs/main-bg.jpg differ diff --git a/imgs/main.png b/imgs/main.png new file mode 100755 index 0000000..b6af6ee Binary files /dev/null and b/imgs/main.png differ diff --git a/imgs/main1.png b/imgs/main1.png new file mode 100755 index 0000000..e15b272 Binary files /dev/null and b/imgs/main1.png differ diff --git a/imgs/my.png b/imgs/my.png new file mode 100755 index 0000000..eee6ac4 Binary files /dev/null and b/imgs/my.png differ diff --git a/imgs/my1.png b/imgs/my1.png new file mode 100755 index 0000000..5ce2436 Binary files /dev/null and b/imgs/my1.png differ diff --git a/imgs/saleForecast.png b/imgs/saleForecast.png new file mode 100755 index 0000000..8fcc314 Binary files /dev/null and b/imgs/saleForecast.png differ diff --git a/imgs/tianjia.png b/imgs/tianjia.png new file mode 100755 index 0000000..e3e0615 Binary files /dev/null and b/imgs/tianjia.png differ diff --git a/imgs/tuceng.png b/imgs/tuceng.png new file mode 100644 index 0000000..d8e2102 Binary files /dev/null and b/imgs/tuceng.png differ diff --git a/imgs/zhuye.png b/imgs/zhuye.png new file mode 100644 index 0000000..6d9fbce Binary files /dev/null and b/imgs/zhuye.png differ diff --git a/imgs/zhuye1.png b/imgs/zhuye1.png new file mode 100644 index 0000000..816a877 Binary files /dev/null and b/imgs/zhuye1.png differ diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..bb74b41 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,179 @@ +//index.js +const app = getApp(); + +var network = require("../../utils/net.js"); + +var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/IsBinded'; +var isBindByPhone = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/XuBindByPhone'; + +var isBindWeixinPath = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWeixinMP'; +var getOpenIdByCode = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode'; +var bindPath = "/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind"; +var getBindCustomer = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer'; + +function WeixinLogin() { + let method = app.globalData.LoginPath; + let params = [app.globalData.AppId, app.globalData.OpenId]; + + network.transfer_request(method, params, function(res) { + app.globalData.DecryptCookie = res.result; + }) +} + +function IsBinded() { + let method = isBindedPath + let params = [app.globalData.OpenId]; + network.transfer_request(method, params, function(res) { + if (res.result != "") { + app.globalData.PhoneNum = res.result; + IsBindWeixinMP(app.globalData.PhoneNum) + } + }) +} + +function IsBindWeixinMP(phone) { + + let method = isBindWeixinPath + let params = [phone]; + network.requestLoading(method, params, function(res) { + res.result = true; + if (res.result == true) { + wx.switchTab({ + url: '/pages/main/main', + }) + } else { + wx.showModal({ + title: '提示', + content: '请关注公众号', + showCancel: false, + }) + } + }) +} + +function Bind(page) { + let userInfos = app.globalData.UserInfo + let method = bindPath; + let params = [{ + "AppId": app.globalData.AppId, + "OpenId": app.globalData.OpenId, + "Phone": page.data.phoneNum, + "NickName": userInfos.nickName, + "Sex": userInfos.gender, + "Province": userInfos.province, + "City": userInfos.city, + "Country": userInfos.country, + "HeadImgUrl": userInfos.avatarUrl, + "UnionId": "", + "CustomerId": app.globalData.CustomerId + }]; + network.requestLoading(method, params, function (res) { + if (res.result == true) { + IsBindWeixinMP(app.globalData.PhoneNum) + } + }) + +} + +Page({ + data: { + userInfo: "", //用户信息 + phoneNum: "" + }, + + getPhoneNum: function(e) { + let val = e.detail.value; + this.data.phoneNum = val; + }, + + onLoad: function(options) { + + }, + + onShow: function() { + + //未进行中转服务器绑定 + if (app.globalData.PhoneNum == '') { + + } else { + WeixinLogin() + IsBinded() + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + var that = this; + var shareObj = { + title: "", // 默认是小程序的名称(可以写slogan等) + path: '/pages/index/index', // 默认是当前页面,必须是以‘/’开头的完整路径 + imgUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 + success: function(res) {    + if (res.errMsg == 'shareAppMessage:ok') { + + } + }, + fail: function() { // 转发失败之后的回调        + if (res.errMsg == 'shareAppMessage:fail cancel') { // 用户取消转发 + wx.showToast({ + title: '取消转发', + }) + } else if (res.errMsg == 'shareAppMessage:fail') { // 转发失败,其中 detail message 为详细失败信息 + wx.showToast({ + title: '转发失败,重新分享', + }) + } + }, + complete: function() { + + } + }; + return shareObj; + }, + + getUserInfo: function(e) { + var that = this; + if (e.detail.userInfo != null) { + app.globalData.UserInfo = e.detail.userInfo + + if (this.data.phoneNum == "") { + wx.showToast({ + title: '请输入手机号码', + }) + return false; + } else if (!(/^1[34578]\d{9}$/.test(this.data.phoneNum))) { + wx.showToast({ + title: '号码不正确', + }) + return false; + } + let userInfos = app.globalData.UserInfo + + let method = isBindByPhone; + let params = [{ + "OpenId": app.globalData.OpenId, + "Phone": this.data.phoneNum, + "NickName": userInfos.nickName, + "Sex": userInfos.gender, + "Province": userInfos.province, + "City": userInfos.city, + "Country": userInfos.country, + "HeadImgUrl": userInfos.avatarUrl, + "UnionId": "" + }]; + + network.transfer_request(method, params, function(res) { + app.globalData.PhoneNum = that.data.PhoneNum; + Bind(that) + }) + } else { + wx.showModal({ + title: '授权提示', + content: '请给予权限,不涉及个人隐私', + showCancel: false + }) + } + } +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..d2a3e93 --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..ddb1f82 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,54 @@ +/**index.wxss**/ + +page { + background: #fff; +} + +.img1 { + margin-left: 35%; + height: 150px; + width: 150px; + margin-top: 20%; +} + +.view1 { + color: #fff; + font-size: 25px; + margin-top: -10%; + margin-left: 30%; + margin-bottom: 10%; +} + +.view2 { + border-top: 1px solid #fafafa; + border-right: 1px solid #fafafa; + border-left: 1px solid #fafafa; + border-bottom: 1px solid #fafafa; + width: 90%; + height: 40px; + margin-left: 5%; + margin-right: 5%; + border-radius: 0.2em; + margin-top: 10%; +} + +.input { + text-align: center; + height: 40px; + background: #fafafa; +} + +.denglu { + margin-left: 5%; + margin-top: 10%; + width: 90%; + margin-right: 5%; + color: #fff; + background: linear-gradient(to right, #39c4fd, #539eef); +} + +.wxmp { + position: fixed; + bottom: 0rpx; + width: 100%; +} diff --git a/pages/logs/logs.js b/pages/logs/logs.js new file mode 100644 index 0000000..b2b967d --- /dev/null +++ b/pages/logs/logs.js @@ -0,0 +1,15 @@ +//logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad: function () { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return util.formatTime(new Date(log)) + }) + }) + } +}) diff --git a/pages/logs/logs.json b/pages/logs/logs.json new file mode 100644 index 0000000..28379bc --- /dev/null +++ b/pages/logs/logs.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "查看启动日志" +} \ No newline at end of file diff --git a/pages/logs/logs.wxml b/pages/logs/logs.wxml new file mode 100644 index 0000000..b5a85ac --- /dev/null +++ b/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log}} + + diff --git a/pages/logs/logs.wxss b/pages/logs/logs.wxss new file mode 100644 index 0000000..94d4b88 --- /dev/null +++ b/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/pages/main/main.js b/pages/main/main.js new file mode 100644 index 0000000..64c9d27 --- /dev/null +++ b/pages/main/main.js @@ -0,0 +1,84 @@ +// pages/main/main.js +// pages/indexL/indexL.js +var network = require("../../utils/net.js") +var app = getApp() + +function WeixinLogin() { + let method = app.globalData.LoginPath; + let params = [app.globalData.AppId, app.globalData.OpenId]; + + network.transfer_request(method, params, function(res) { + app.globalData.Cookie = res.result; + }) +} + +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + }, + saleForecast: function(e) { + wx.navigateTo({ + url: '/pages/saleForecastList/saleForecastList', + }) + }, +}) \ No newline at end of file diff --git a/pages/main/main.json b/pages/main/main.json new file mode 100644 index 0000000..acc0770 --- /dev/null +++ b/pages/main/main.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "首页" +} \ No newline at end of file diff --git a/pages/main/main.wxml b/pages/main/main.wxml new file mode 100644 index 0000000..661bc78 --- /dev/null +++ b/pages/main/main.wxml @@ -0,0 +1,10 @@ + + + + + + + 销售预报 + + + diff --git a/pages/main/main.wxss b/pages/main/main.wxss new file mode 100644 index 0000000..ee35668 --- /dev/null +++ b/pages/main/main.wxss @@ -0,0 +1,33 @@ +/* pages/main/main.wxss */ +page{ + background: rgb(240, 239, 245) +} +.index_img{ + width: 100%; +} + +.body-box { + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + background: white; + padding-top: 20rpx; + padding-bottom: 20rpx; +} +.ico { + width: 25%; + display: flex; + flex-direction: column; + align-items: center; + font-size: 12px; + box-sizing: border-box; + padding-bottom: 10px; + padding-top: 10px; +} + +.ico image { + width: 90rpx; + height: 90rpx; + margin-bottom: 10rpx; +} \ No newline at end of file diff --git a/pages/my/my.js b/pages/my/my.js new file mode 100644 index 0000000..2a8cba2 --- /dev/null +++ b/pages/my/my.js @@ -0,0 +1,66 @@ +// pages/my/my.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/my/my.json b/pages/my/my.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/my/my.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/my/my.wxml b/pages/my/my.wxml new file mode 100644 index 0000000..2447d83 --- /dev/null +++ b/pages/my/my.wxml @@ -0,0 +1,2 @@ + +pages/my/my.wxml diff --git a/pages/my/my.wxss b/pages/my/my.wxss new file mode 100644 index 0000000..1c3fe88 --- /dev/null +++ b/pages/my/my.wxss @@ -0,0 +1 @@ +/* pages/my/my.wxss */ \ No newline at end of file diff --git a/pages/saleForecastList/Detail/Detail.js b/pages/saleForecastList/Detail/Detail.js new file mode 100644 index 0000000..e3be8f6 --- /dev/null +++ b/pages/saleForecastList/Detail/Detail.js @@ -0,0 +1,730 @@ +// 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; +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 = "/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: "会计部门" + }) +} + +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: "购货客户" + }) +} + +function GetDepartment(that, inputValue) { + let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment"; + 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 = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/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 = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; + 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: 0, + // 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 = "/MainSystem/B3MiniProgramRpc/Rpcs/EmployeeRpc/SaleForecastRpc/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) + + }) + + /** + * 获取系统信息 + */ + wx.getSystemInfo({ + + success: function (res) { + that.setData({ + winWidth: res.windowWidth, + winHeight: res.windowHeight + }); + } + + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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 = '/MainSystem/B3MiniProgramRpc/Rpcs/ManagerRpc/OrderRpc/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/Detail/Detail.json b/pages/saleForecastList/Detail/Detail.json new file mode 100644 index 0000000..603eeda --- /dev/null +++ b/pages/saleForecastList/Detail/Detail.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "预报详情" +} \ No newline at end of file diff --git a/pages/saleForecastList/Detail/Detail.wxml b/pages/saleForecastList/Detail/Detail.wxml new file mode 100644 index 0000000..cb49fcf --- /dev/null +++ b/pages/saleForecastList/Detail/Detail.wxml @@ -0,0 +1,168 @@ + + + 基本信息 + 订单详细 + + + + + + + + 购货客户 + + + {{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}} + + + + 取消 + + + diff --git a/pages/saleForecastList/Detail/Detail.wxss b/pages/saleForecastList/Detail/Detail.wxss new file mode 100644 index 0000000..d8de5f9 --- /dev/null +++ b/pages/saleForecastList/Detail/Detail.wxss @@ -0,0 +1,214 @@ +/* pages/orderinfo/orderinfo.wxss */ + +page { + background: rgb(240, 239, 245); +} + +.swiper-tab { + width: 100%; + text-align: center; + line-height: 80rpx; + background: white; + display: flex; + flex-direction: row; + justify-content: space-around; + border-bottom: 0.2rpx solid rgb(223, 218, 218); +} + +.swiper-tab-list { + font-size: 30rpx; + /* display: inline-block; */ + width: 25%; + color: #777; +} + +.on { + color: #2788f8; + border-bottom: 2rpx solid #2788f8; +} + +.swiper-box { + display: block; + height: 100%; + width: 100%; + overflow: hidden; +} + +.swiper-items1 { + height: 100%; + padding-top: 3%; +} + +.swiper-items2 { + height: 100%; +} + +.scroll-views { + height: 100%; +} + +.baseitem { + background: #fff; + width: 100%; + border-bottom: 0.1px solid #dbdbdb; + display: flex; + flex-direction: row; + align-items: center; + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.twogroup { + display: flex; + flex-direction: row; +} + +.baseitem_key { + color: #666; + width: 20%; + margin-left: 5%; +} + +.baseitem_value { + margin-left: 5%; + width: 70%; + color: rgb(48, 48, 48); +} + +.baseitem_key2 { + color: #666; + width: 20%; + font-size: 30rpx; + margin-left: 10rpx; +} + +.baseitem_value2 { + color: rgb(48, 48, 48); + font-size: 30rpx; +} + +.baseitem_key1 { + color: #666; + width: 40%; + font-size: 30rpx; + margin-left: 10rpx; +} + +.baseitem_value1 { + color: rgb(48, 48, 48); + font-size: 30rpx; + margin-left: 20rpx; + width: 60%; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.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; +} + +.submit { + margin-top: 50rpx; + margin-bottom: 30rpx; +} + +.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: #3cc51f; +} + +.top { + height: 20%; + justify-content: center; + align-items: center; +} + +.grid1 { + width: 100%; + border-bottom: 1px solid #c3c3c3; + padding-top: 5px; + padding-bottom: 10px; +} + +.text3 { + font-size: 18px; + color: rgb(48, 48, 48); +} diff --git a/pages/saleForecastList/newBill/newBill.js b/pages/saleForecastList/newBill/newBill.js new file mode 100644 index 0000000..e0687fe --- /dev/null +++ b/pages/saleForecastList/newBill/newBill.js @@ -0,0 +1,628 @@ +var app = getApp() +var network = require("../../../utils/net.js") +var dateTimePicker = require('../../../utils/dateTimePicker.js'); +var utilll = require('../../../utils/util.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: "会计部门" + }) +} + +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: "购货客户" + }) +} + +function GetDepartment(that, inputValue) { + let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment"; + 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 = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/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 = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice"; + 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: 0, + // 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: "", + dateTimeArray: null, + dateTime: null, + dateTimeArray1: null, + dateTime1: null, + startYear: 2018, + endYear: 2030 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + + // 获取完整的年月日 时分秒,以及默认显示的数组 + var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear); + // 精确到分的处理,将数组的秒去掉 + var lastArray = obj1.dateTimeArray.pop(); + var lastTime = obj1.dateTime.pop(); + + this.setData({ + dateTimeArray: obj1.dateTimeArray, + dateTime: obj1.dateTime, + dateTimeArray1: obj1.dateTimeArray, + dateTime1: obj1.dateTime + }); + /** + * 获取系统信息 + */ + wx.getSystemInfo({ + + success: function (res) { + that.setData({ + winWidth: res.windowWidth, + winHeight: res.windowHeight + }); + } + + }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: 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; + // if (e.currentTarget.dataset.idx != null) { + // let idxx = e.currentTarget.dataset.idx; + // this.setData({ + // idx: idxx + // }) + // } + 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 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 + // PolicyPrice: 10 + } + detailsArray.push(dmo) + } + + + let method = '/MainSystem/B3MiniProgramRpc/Rpcs/EmployeeRpc/SaleForecastRpc/Insert'; + let params = [{ + "Customer_ID": customerID, + // "LoadTime": update, + "Date": update, + "DeliveryTime": update, + "AccountingUnit_ID": unitID, + "Department_ID": departmentID, + "SaleKind_ID": saletypeID, + "DeliverAddress": this.data.addrs, + "Details": detailsArray + + }]; + network.transfer_request(method, params, function (res) { + if (res.result != null) { + wx.showModal({ + title: '新建订单No.' + res.result, + 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/newBill/newBill.json b/pages/saleForecastList/newBill/newBill.json new file mode 100644 index 0000000..1e7f98e --- /dev/null +++ b/pages/saleForecastList/newBill/newBill.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "预报新建" +} \ No newline at end of file diff --git a/pages/saleForecastList/newBill/newBill.wxml b/pages/saleForecastList/newBill/newBill.wxml new file mode 100644 index 0000000..25f49f9 --- /dev/null +++ b/pages/saleForecastList/newBill/newBill.wxml @@ -0,0 +1,167 @@ + + 基本信息 + 订单详细 + + + + + + + + 购货客户 + + + {{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}} + + + + 取消 + + + diff --git a/pages/saleForecastList/newBill/newBill.wxss b/pages/saleForecastList/newBill/newBill.wxss new file mode 100644 index 0000000..9420370 --- /dev/null +++ b/pages/saleForecastList/newBill/newBill.wxss @@ -0,0 +1,209 @@ +page { + background: rgb(240, 239, 245); +} + +.swiper-tab { + width: 100%; + border-bottom: 2rpx solid #777; + text-align: center; + line-height: 80rpx; + background: white; +} + +.swiper-tab-list { + font-size: 30rpx; + display: inline-block; + width: 50%; + color: #777; +} + +.on { + color: #2788f8; + border-bottom: 2rpx solid #2788f8; +} + +.swiper-box { + display: block; + height: 100%; + width: 100%; + overflow: hidden; +} + +.swiper-items1 { + height: 100%; + padding-top: 3%; +} + +.swiper-items2 { + height: 100%; +} + +.scroll-views { + height: 100%; +} + +.baseitem { + background: #fff; + width: 100%; + border-bottom: 0.1px solid #dbdbdb; + display: flex; + flex-direction: row; + align-items: center; + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.twogroup { + display: flex; + flex-direction: row; +} + +.baseitem_key { + color: black; + width: 20%; + margin-left: 5%; +} + +.baseitem_value { + margin-left: 5%; + width: 70%; + color: rgb(48, 48, 48); +} + +.baseitem_key2 { + color: black; + width: 20%; + font-size: 30rpx; + margin-left: 10rpx; +} + +.baseitem_value2 { + color: rgb(48, 48, 48); + font-size: 30rpx; +} + +.baseitem_key1 { + color: black; + width: 40%; + font-size: 30rpx; + margin-left: 10rpx; +} + +.baseitem_value1 { + color: rgb(48, 48, 48); + font-size: 30rpx; + margin-left: 20rpx; + width: 60%; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.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; +} + +.submit { + margin-top: 50rpx; + margin-bottom: 30rpx; +} + +.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; +} + +.text3 { + font-size: 18px; + color: rgb(48, 48, 48); +} diff --git a/pages/saleForecastList/query/query.js b/pages/saleForecastList/query/query.js new file mode 100644 index 0000000..4c0e52b --- /dev/null +++ b/pages/saleForecastList/query/query.js @@ -0,0 +1,195 @@ +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'), + + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + 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.SaleOutStartDate = sDate; + app.globalData.SaleOutEndDate = eDate; + + 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, + }); + } + } +}) \ No newline at end of file diff --git a/pages/saleForecastList/query/query.json b/pages/saleForecastList/query/query.json new file mode 100644 index 0000000..94ff588 --- /dev/null +++ b/pages/saleForecastList/query/query.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "筛选" +} \ No newline at end of file diff --git a/pages/saleForecastList/query/query.wxml b/pages/saleForecastList/query/query.wxml new file mode 100644 index 0000000..6f8f3a8 --- /dev/null +++ b/pages/saleForecastList/query/query.wxml @@ -0,0 +1,25 @@ + + 购货客户 + {{customer[customerIndex].Name}} + + + + + + + + + + + + + + + + + {{item.Name}} + + + + 取消 + diff --git a/pages/saleForecastList/query/query.wxss b/pages/saleForecastList/query/query.wxss new file mode 100644 index 0000000..9e54210 --- /dev/null +++ b/pages/saleForecastList/query/query.wxss @@ -0,0 +1,93 @@ +page { + background: rgb(240, 239, 245); +} + +.twoitem{ + display: flex; + flex-direction: row; + justify-content: space-between; + padding-right: 5%; + padding-left: 5%; + background: #fff; + border-bottom: 1rpx solid #dbdbdb; + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.item_value{ + width: 70%; + text-align: right +} + +.submit { + margin-top: 50rpx; + margin-bottom: 30rpx; +} + + +.drawer_screen { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + z-index: 1000; + background: #000; + opacity: 0.5; + overflow: hidden; +} + +.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; +} + + +.top { + height: 20%; + justify-content: center; + align-items: center; +} + +.sousuo { + margin-right: 10%; + margin-left: 10%; + text-align: center; + background: #d6d8da; + height: 40px; + font-size: 28rpx; +} + +.drawer_content { + height: 500rpx; + overflow-y: scroll; /*超出父盒子高度可滚动*/ +} + + +.btn_ok { + padding: 10px; + font: 20px "microsoft yahei"; + text-align: center; + border-top: 1px solid #e8e8ea; + color: #2E8CF5; +} + + +.grid1 { + width: 100%; + border-bottom: 1px solid #c3c3c3; + padding-top: 5px; + padding-bottom: 10px; +} + +.text3 { + font-size: 18px; + color: rgb(48, 48, 48); +} \ No newline at end of file diff --git a/pages/saleForecastList/saleForecastList.js b/pages/saleForecastList/saleForecastList.js new file mode 100644 index 0000000..09b435d --- /dev/null +++ b/pages/saleForecastList/saleForecastList.js @@ -0,0 +1,206 @@ +const app = getApp(); +var network = require("../../utils/net.js"); +var timechage = require("../../utils/dateTimeUtil.js"); +var UnCheckPageIndex = 0 +var UnCheckPageSize = 10 +var CheckedPageIndex = 0 +var CheckedPageSize = 10 +var outStoreMethod = '/MainSystem/B3MiniProgramRpc/Rpcs/EmployeeRpc/SaleForecastRpc/GetList' +// 未审核订单列表 +function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize) { + let getArr = []; + let method = outStoreMethod; + let params = [{ + "BillState": 0, + "Customer_ID": that.data.Customer_ID, + "PageIndex": UnCheckPageIndex, + "PageSize": UnCheckPageSize, + }]; + // let params = [false, UnCheckPageIndex, UnCheckPageSize]; + network.transfer_request(method, params, function (res) { + var array = res.result; + if (array.length <= 0) { + wx.showToast({ + title: '无数据更新', + }) + UnCheckPageIndex = UnCheckPageIndex - 1; + return; + } + for (var i = 0; i < array.length; i++) { + var dmo = { + // BillState: "未审核" + // Customer_Name: "陈旭辉" + // Date: "/Date(1540453380000+0800)/" + // DepartmentWorkFlow_Detail_Name: "初始" + // DepartmentWorkFlow_ID: 2 + // ID: 4 + // Money: 143 + // Number: 1 + // billType: array[i].BillType_Name, + //添加单据状态的传递,在详情页面判断此值,进行是否允许提交的操作 true : 可提交 + orderState: true, + orderID: array[i].ID, + Customer_Name: array[i].Customer_Name, + time: timechage.formatTimeTwo(array[i].Date.substring(6, 19), 'Y/M/D') + } + getArr.push(dmo); + } + let arrLast = that.data.unCheckDataArr.concat(getArr); + that.setData({ + unCheckDataArr: arrLast, + }) + }) +} + +// 已审核订单列表 +function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) { + let getArr = []; + let method = outStoreMethod; + let params = [{ + "BillState": 20, + "Customer_ID": that.data.Customer_ID, + "PageIndex": CheckedPageIndex, + "PageSize": CheckedPageSize, + }]; + // let params = [true, CheckedPageIndex, CheckedPageSize]; + network.transfer_request(method, params, function (res) { + var array = res.result; + if (array.length <= 0) { + wx.showToast({ + title: '无数据更新', + }) + CheckedPageIndex = CheckedPageIndex - 1; + return; + } + for (var i = 0; i < array.length; i++) { + var dmo = { + //添加单据状态的传递,在详情页面判断此值,进行是否允许提交的操作 + orderState: false, + orderID: array[i].ID, + Customer_Name: array[i].Customer_Name, + time: timechage.formatTimeTwo(array[i].Date.substring(6, 19), 'Y/M/D') + } + getArr.push(dmo); + } + let arrLast = that.data.checkedDataArr.concat(getArr); + that.setData({ + checkedDataArr: arrLast, + }) + }) +} + +Page({ + data: { + checkedDataArr: [], + unCheckDataArr: [], + currentTab: 0, + winHeight: 0, + winWidth: 0, + Customer_ID: null, + }, + + createNew: function (e) { + wx.navigateTo({ + url: 'newBill/newBill', + }) + }, + + /** + * 滑动切换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 + }) + } + }, + //点击进入详情页面 + transToOrderDetail: function (event) { + var ID = event.currentTarget.dataset.detailitemid; + var State = event.currentTarget.dataset.detailitemstate; + wx.navigateTo({ + url: 'Detail/Detail?ID=' + ID + '&State=' + State, + }) + }, + + //点击进入筛选页面 + chose: function (e) { + wx.navigateTo({ + url: 'query/query', + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + onShow: function (options) { + this.setData({ + checkedDataArr: [], + unCheckDataArr: [], + Customer_ID: app.globalData.SelectCustomer_ID, + }) + var that = this; + wx.getSystemInfo({ + success: function (res) { + that.setData({ + winWidth: res.windowWidth, + winHeight: res.windowHeight + }); + } + }); + UnCheckPageIndex = 0; + CheckedPageIndex = 0; + getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize); + getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + //未审核订单滑动到底部加载 + unCheckedScrollLower: function (event) { + var that = this; + UnCheckPageIndex = UnCheckPageIndex + 1; + getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize); + }, + + //已审核订单滑动到底部加载 + CheckedScrollLower: function (event) { + var that = this; + CheckedPageIndex = CheckedPageIndex + 1; + getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); + }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + var that = this; + if (this.data.currentTab === 0) { + UnCheckPageIndex = UnCheckPageIndex + 1; + getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize); + } else { + CheckedPageIndex = CheckedPageIndex + 1; + getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); + } + }, +}) \ No newline at end of file diff --git a/pages/saleForecastList/saleForecastList.json b/pages/saleForecastList/saleForecastList.json new file mode 100644 index 0000000..292625b --- /dev/null +++ b/pages/saleForecastList/saleForecastList.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "销售预报" +} \ No newline at end of file diff --git a/pages/saleForecastList/saleForecastList.wxml b/pages/saleForecastList/saleForecastList.wxml new file mode 100644 index 0000000..7715556 --- /dev/null +++ b/pages/saleForecastList/saleForecastList.wxml @@ -0,0 +1,43 @@ + + 未审批 + 已审批 + + + + + + + +