// 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 getEmployee = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetEmployee"; var getStore = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetStore" var getTakeGoodsType = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetTakeGoods_Type" var load = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/Load"; let update = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/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 GetEmployee(that, v) { let method = getEmployee; let params = [{ "InputValue": v, "PageIndex": 0, "PageSize": 100 }]; network.transfer_request(method, params, function (res) { that.setData({ currency: res.result, employee: res.result }) }) that.setData({ which: "业务员" }) } function GetStore(that, v) { let method = getStore; let params = [{ "InputValue": v, "PageIndex": 0, "PageSize": 100 }]; network.transfer_request(method, params, function (res) { that.setData({ currency: res.result, store: res.result }) }) that.setData({ which: "仓库" }) } function GetTakeGoodsType(that, v) { let method = getTakeGoodsType; let params = []; network.transfer_request(method, params, function (res) { console.log(res); that.setData({ currency: res.result, takeGoodsType: 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: "请选择会计单位" }], empIndex: 0, employee: [{ ID: 0, Name: "请选择业务员" }], storeIndex: 0, store: [{ ID: 0, Name: "请选择仓库" }], takeGoodsTypeIndex: 0, takeGoodsType: [{ ID: 0, Name: "请选择配送方式" }], addrs: "", remark: "", 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 employeeOld = [{ ID: res.result.Employee_ID, Name: res.result.Employee_Name }] let storeOld = [{ ID: res.result.Store_ID, Name: res.result.Store_Name }] let takeGoodsTypeOld = [{ Name: res.result.TakeGoods_Type }] let addrrrr = res.result.DeliverAddress let remark=res.result.Remark let loadtimee = timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), 'Y-M-D h:m') let details=[]; for(var i =0;i