Browse Source

添加预报和订单界面

master
chenxuhui 7 years ago
parent
commit
ca1e53e9d0
40 changed files with 6309 additions and 56 deletions
  1. +5
    -3
      app.json
  2. BIN
      imgs/create.png
  3. +0
    -26
      pages/first/first.js
  4. +0
    -3
      pages/first/first.json
  5. +0
    -4
      pages/first/first.wxml
  6. +0
    -19
      pages/first/first.wxss
  7. +1
    -1
      pages/homePage/homePage.js
  8. +871
    -0
      pages/order/detail/detail.js
  9. +5
    -0
      pages/order/detail/detail.json
  10. +215
    -0
      pages/order/detail/detail.wxml
  11. +232
    -0
      pages/order/detail/detail.wxss
  12. +769
    -0
      pages/order/newBill/newBill.js
  13. +5
    -0
      pages/order/newBill/newBill.json
  14. +201
    -0
      pages/order/newBill/newBill.wxml
  15. +224
    -0
      pages/order/newBill/newBill.wxss
  16. +218
    -0
      pages/order/order.js
  17. +5
    -0
      pages/order/order.json
  18. +52
    -0
      pages/order/order.wxml
  19. +117
    -0
      pages/order/order.wxss
  20. +194
    -0
      pages/order/query/query.js
  21. +3
    -0
      pages/order/query/query.json
  22. +48
    -0
      pages/order/query/query.wxml
  23. +94
    -0
      pages/order/query/query.wxss
  24. +726
    -0
      pages/saleForecastList/Detail/Detail.js
  25. +5
    -0
      pages/saleForecastList/Detail/Detail.json
  26. +183
    -0
      pages/saleForecastList/Detail/Detail.wxml
  27. +229
    -0
      pages/saleForecastList/Detail/Detail.wxss
  28. +707
    -0
      pages/saleForecastList/newBill/newBill.js
  29. +5
    -0
      pages/saleForecastList/newBill/newBill.json
  30. +156
    -0
      pages/saleForecastList/newBill/newBill.wxml
  31. +220
    -0
      pages/saleForecastList/newBill/newBill.wxss
  32. +196
    -0
      pages/saleForecastList/query/query.js
  33. +3
    -0
      pages/saleForecastList/query/query.json
  34. +25
    -0
      pages/saleForecastList/query/query.wxml
  35. +94
    -0
      pages/saleForecastList/query/query.wxss
  36. +248
    -0
      pages/saleForecastList/saleForecastList.js
  37. +5
    -0
      pages/saleForecastList/saleForecastList.json
  38. +55
    -0
      pages/saleForecastList/saleForecastList.wxml
  39. +113
    -0
      pages/saleForecastList/saleForecastList.wxss
  40. +80
    -0
      utils/dateTimePicker.js

+ 5
- 3
app.json View File

@ -2,6 +2,10 @@
"pages": [
"pages/homePage/homePage",
"pages/login/login",
"pages/saleForecastList/saleForecastList",
"pages/saleForecastList/Detail/Detail",
"pages/saleForecastList/query/query",
"pages/saleForecastList/newBill/newBill",
"pages/sendCargo/sendCargo",
"pages/orderDetails/orderDetails",
"pages/orderInquiry/orderInquiry",
@ -10,9 +14,7 @@
"pages/my/my",
"pages/fenxiang/fenxiang",
"pages/saleOutStore/saleOutStore",
"pages/saleOutStore/outStoreDetail/outStoreDetail",
"pages/first/first"
"pages/saleOutStore/outStoreDetail/outStoreDetail"
],
"window": {
"backgroundTextStyle": "light",


BIN
imgs/create.png View File

Before After
Width: 266  |  Height: 266  |  Size: 12 KiB

+ 0
- 26
pages/first/first.js View File

@ -1,26 +0,0 @@
// pages/first/first.js
const app = getApp();
var network = require("../../utils/net.js");
var openid;
Page({
data: {
url:"",
},
onLoad: function(options) {
// var code = options.code;
var that = this;
wx.login({
success: function (res) {
var code = res.code;
var itemUrl = "https://miniprogram.food988.com/WeixinBindPhonePage.aspx?code=" + code + "&state=bindphone";
that.setData({
url: itemUrl,
})
}
});
},
})

+ 0
- 3
pages/first/first.json View File

@ -1,3 +0,0 @@
{
"navigationBarTitleText": "公众号绑定"
}

+ 0
- 4
pages/first/first.wxml View File

@ -1,4 +0,0 @@
<!--pages/first/first.wxml-->
<!-- <button class='testOne' catchtap='firstBtnClicked'>测试按钮1</button>
<button class='testTwo' catchtap='secondBtnClicked'>测试按钮2</button> -->
<web-view src="{{url}}"></web-view>

+ 0
- 19
pages/first/first.wxss View File

@ -1,19 +0,0 @@
/* pages/first/first.wxss */
.testOne{
color: #FFFFFF;
background: #2E8CF5;
margin-top: 20%;
margin-left: 5%;
width: 30%;
float: left;
}
.testTwo{
color: #FFFFFF;
background: #2E8CF5;
margin-top: 20%;
margin-right: 5%;
width: 30%;
float: right;
}

+ 1
- 1
pages/homePage/homePage.js View File

@ -43,7 +43,7 @@ Page({
switch (btnID) {
// 找司机
case "1":
transferURL = '/pages/sendCargo/sendCargo';
transferURL = '/pages/saleForecastList/saleForecastList';
break;
// 对账单
case "2":


+ 871
- 0
pages/order/detail/detail.js View File

@ -0,0 +1,871 @@
// 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<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,
employee:employeeOld,
store:storeOld,
takeGoodsType:takeGoodsTypeOld,
addrs: addrrrr,
remark: remark,
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;
},
getRemark: function (e) {
this.data.remark = 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, "")
} else if (x == "业务员") {
GetEmployee(that, "")
} else if (x == "仓库") {
GetStore(that, "")
} else if (x == "配送方式") {
GetTakeGoodsType(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
})
} else if (which == "业务员") {
that.setData({
empIndex: idx
})
} else if (which == "仓库") {
that.setData({
storeIndex: idx
})
} else if (which == "配送方式") {
that.setData({
takeGoodsTypeIndex: 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)
} else if (which == "业务员") {
GetEmployee(that, value)
} else if (which == "仓库") {
GetStore(that, value)
} else if (which == "配送方式") {
GetTakeGoodsType(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 employeeID = this.data.employee[this.data.empIndex].ID;
let storeID = this.data.store[this.data.storeIndex].ID;
let takeGoodsTypeName = this.data.takeGoodsType[this.data.takeGoodsTypeIndex].Name;
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 loadTime = "/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 (employeeID == 0) {
wx.showToast({
title: '请选择业务员',
})
return;
}
if (storeID == 0) {
wx.showToast({
title: '请选择仓库',
})
return;
}
if (saletypeID == 0) {
wx.showToast({
title: '请选择销售类型',
})
return;
}
if (takeGoodsTypeName == "") {
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": loadTime,
"AccountingUnit_ID": unitID,
"Department_ID": departmentID,
"SaleKind_ID": saletypeID,
"Employee_ID":employeeID,
"Store_ID":storeID,
"TakeGoods_Type":takeGoodsTypeName,
"DeliverAddress": this.data.addrs,
"Remark":this.data.remark,
"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
});
}
}
})

+ 5
- 0
pages/order/detail/detail.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "订单详细"
}

+ 215
- 0
pages/order/detail/detail.wxml View File

@ -0,0 +1,215 @@
<!--pages/orderinfo/orderinfo.wxml-->
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">订单明细</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 55}}px" bindchange="bindChange">
<!-- 基本信息 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='main-body'>
<view class='baseitem'>
<text class='baseitem_key'>购货客户</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseCustomer' value='{{customerIndex}}' range-key="name" range='{{customer}}'>
<text>{{customer[customerIndex].name}}</text>
</picker> -->
<view class='baseitem_value' data-x='购货客户' data-item='{{which}}'>
{{customer[customerIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>发货时间</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" range="{{dateTimeArray1}}">
<view class="tui-picker-detail">
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
</view>
</picker>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>会计单位</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseUnit' value='{{isUnit}}' range-key="Name" range='{{unit}}'>
<text>{{unit[isUnit].Name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='会计部门' data-item='{{which}}'>
{{unit[isUnit].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>销售部门</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseDepartment' value='{{departmentIndex}}' range-key="name" range='{{department}}'>
<text>{{department[departmentIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='部门' data-item='{{which}}'>
{{department[departmentIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>业务员</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='业务员' data-item='{{which}}'>
{{employee[empIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>仓库</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='仓库' data-item='{{which}}'>
{{store[storeIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>销售类型</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='销售类型' data-item='{{which}}'>
{{saletype[saletypeIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>配送方式</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='配送方式' data-item='{{which}}'>
{{takeGoodsType[takeGoodsTypeIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>送货地址</text>
<input class='baseitem_value' bindinput='getAddrs' placeholder='请输入送货地址' placeholder-style='color:rgb(202, 202, 202)' value="{{addrs}}"></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>摘要</text>
<input class='baseitem_value' bindinput='getRemark' value="{{remark}}"></input>
</view>
<view class='horizontallineView'></view>
<!-- <button class='submit' catchtap='submitForm'>保存</button> -->
<!-- <view class='baseitem'>
<text class='baseitem_key' space="emsp">摘 要</text>
<input class='baseitem_value' bindinput='getRemark' placeholder='请输入摘要' placeholder-style='color:rgb(202, 202, 202)'></input>
</view> -->
</view>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>
</swiper-item>
<!-- 订单详细 -->
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<!-- <view class='main-body'> -->
<block wx:for="{{obj}}" wx:key="item" wx:for-index="idx">
<!-- <template is="fodder" data="{{...item}}"></template> -->
<view class='itemView'>
<view class='baseitem'>
<text class='baseitem_key2'>存货名称</text>
<view class='baseitem_value2' bindtap="powerDrawer1" data-statu="open" data-idx='{{idx}}'>
{{obj[idx].Goods_Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1'>报货数量</text>
<input class='baseitem_value1' bindinput='getGoodsNum' placeholder='请输入报货数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsNum}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1' space='ensp'>辅 数 量</text>
<input class='baseitem_value1' bindinput='getSecondNum' placeholder='请输入辅数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsSecondNum}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1' space='emsp'>单 价</text>
<input class='baseitem_value1' type='digit' bindinput='getPrice' placeholder='请输入单价' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].Price}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1'>政策单价</text>
<text class='baseitem_value1' data-idx='{{idx}}'>{{obj[idx].PolicyPrice}}</text>
</view>
<view class='horizontallineView'></view>
</view>
<view class='delete' catchtap='deleteItem' data-idx='{{idx}}'>删除</view>
</block>
<view class='add' catchtap='add'>
<image class="ico" src="/imgs/tianjia.png"></image>
</view>
<!-- </view> -->
<!-- <template name='fodder'>
</template> -->
<button class='submit' catchtap='submitForm'>保存</button>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer1" data-statu="close" wx:if="{{showModalStatus1}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus1}}">
<!--drawer content-->
<view class='top'>
<input input class="sousuo" bindinput="select1" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{goods}}" wx:key="item">
<view class="grid1" catchtap='itemclick1' data-idx='{{idx}}' data-Name='{{item.Goods_Name}}' data-policyprice='{{item.PolicyPrice}}' data-data='{{item}}'>
<text class='text3'>{{item.Goods_Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer1" data-statu="close">取消</view>
</view>
</swiper-item>
</swiper>

+ 232
- 0
pages/order/detail/detail.wxss View File

@ -0,0 +1,232 @@
/* 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;
height: 100%;
width: 100%;
overflow: hidden;
}
.swiper-items1 {
height: 100%;
padding-top: 3%;
}
.swiper-items2 {
height: 100%;
}
.scroll-views {
height: 100%;
}
.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-color: #fff;
}
.main-body{
background-color: #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: #2788f8;
}
.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);
}

+ 769
- 0
pages/order/newBill/newBill.js View File

@ -0,0 +1,769 @@
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 GetEmployee(that, inputValue) {
let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetEmployee";
let params = [{
"InputValue": inputValue,
"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, inputValue) {
let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetStore";
let params = [{
"InputValue": inputValue,
"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, inputValue) {
let method = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetTakeGoods_Type";
let params = [];
network.transfer_request(method, params, function (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 = "/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: 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:"",
dateTimeArray: null,
dateTime: null,
dateTimeArray1: null,
dateTime1: null,
startYear: 2018,
endYear: 2030
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
// 获取完整的年月日 时分秒,以及默认显示的数组
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
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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;
},
getRemark: function (e) {
this.data.remark = 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, "")
} else if (x == "业务员") {
GetEmployee(that, "")
} else if (x == "仓库") {
GetStore(that, "")
} else if (x == "配送方式") {
GetTakeGoodsType(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
})
} else if (which == "业务员") {
that.setData({
empIndex: idx
})
} else if (which == "仓库") {
that.setData({
storeIndex: idx
})
} else if (which == "配送方式") {
that.setData({
takeGoodsTypeIndex: 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;
if(!pp)
pp='';
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 = 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)
} else if (which == "业务员") {
GetEmployee(that, value)
} else if (which == "仓库") {
GetStore(that, value)
} else if (which == "配送方式") {
GetTakeGoodsType(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 employeeID = this.data.employee[this.data.empIndex].ID;
let storeID = this.data.store[this.data.storeIndex].ID;
let takeGoodsTypeName = this.data.takeGoodsType[this.data.takeGoodsTypeIndex].Name;
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 (employeeID == 0) {
wx.showToast({
title: '请选择业务员',
})
return;
}
if (storeID == 0) {
wx.showToast({
title: '请选择仓库',
})
return;
}
if (saletypeID == 0) {
wx.showToast({
title: '请选择销售类型',
})
return;
}
if (takeGoodsTypeName == "") {
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;
}
if (this.data.obj[i].PolicyPrice=='')
this.data.obj[i].PolicyPrice=NaN;
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
}
detailsArray.push(dmo)
}
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/Insert';
let params = [{
"Customer_ID": customerID,
"LoadTime": update,
"AccountingUnit_ID": unitID,
"Department_ID": departmentID,
"SaleKind_ID": saletypeID,
"Employee_ID": employeeID,
"Store_ID": storeID,
"TakeGoods_Type": takeGoodsTypeName,
"DeliverAddress": this.data.addrs,
"Remark":this.data.remark,
"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
});
}
}
})

+ 5
- 0
pages/order/newBill/newBill.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "销售订单"
}

+ 201
- 0
pages/order/newBill/newBill.wxml View File

@ -0,0 +1,201 @@
<!--pages/saleforecast/saleforecast.wxml-->
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">订单明细</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 55}}px" bindchange="bindChange">
<!-- 基本信息 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='baseitem'>
<text class='baseitem_key'>购货客户</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseCustomer' value='{{customerIndex}}' range-key="name" range='{{customer}}'>
<text>{{customer[customerIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='购货客户' data-item='{{which}}'>
{{customer[customerIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>发货时间</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" range="{{dateTimeArray1}}">
<view class="tui-picker-detail">
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
</view>
</picker>
</view>
<view class='baseitem'>
<text class='baseitem_key'>会计单位</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseUnit' value='{{isUnit}}' range-key="Name" range='{{unit}}'>
<text>{{unit[isUnit].Name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='会计部门' data-item='{{which}}'>
{{unit[isUnit].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>销售部门</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseDepartment' value='{{departmentIndex}}' range-key="name" range='{{department}}'>
<text>{{department[departmentIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='部门' data-item='{{which}}'>
{{department[departmentIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>业务员</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='业务员' data-item='{{which}}'>
{{employee[empIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>仓库</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='仓库' data-item='{{which}}'>
{{store[storeIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>销售类型</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='销售类型' data-item='{{which}}'>
{{saletype[saletypeIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>配送方式</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='配送方式' data-item='{{which}}'>
{{takeGoodsType[takeGoodsTypeIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>送货地址</text>
<input class='baseitem_value' bindinput='getAddrs' placeholder='请输入送货地址' placeholder-style='color:rgb(202, 202, 202)'></input>
</view>
<view class='baseitem'>
<text class='baseitem_key'>摘要</text>
<input class='baseitem_value' bindinput='getRemark'></input>
</view>
<!-- <view class='baseitem'>
<text class='baseitem_key' space="emsp">摘 要</text>
<input class='baseitem_value' bindinput='getRemark' placeholder='请输入摘要' placeholder-style='color:rgb(202, 202, 202)'></input>
</view> -->
<!-- <button class='submit' catchtap='submitForm'>提交</button> -->
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>
</swiper-item>
<!-- 订单详细 -->
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='main-body'>
<block wx:for="{{obj}}" wx:key="item" wx:for-index="idx">
<!-- <template is="fodder" data="{{...item}}"></template> -->
<view class='itemView'>
<view class='baseitem'>
<text class='baseitem_key2'>存货名称</text>
<view class='baseitem_value2' bindtap="powerDrawer1" data-statu="open" data-idx='{{idx}}'>
{{obj[idx].Goods_Name}}
</view>
</view>
<view class='twogroup'>
<view class='baseitem'>
<text class='baseitem_key1'>报货数量</text>
<input class='baseitem_value1' bindinput='getGoodsNum' placeholder='请输入报货数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsNum}}'></input>
</view>
<view class='baseitem'>
<text class='baseitem_key1' space='ensp'>辅 数 量</text>
<input class='baseitem_value1' bindinput='getSecondNum' placeholder='请输入辅数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsSecondNum}}'></input>
</view>
</view>
<view class='twogroup'>
<view class='baseitem'>
<text class='baseitem_key1' space='emsp'>单 价</text>
<input class='baseitem_value1' type='digit' bindinput='getPrice' placeholder='请输入单价' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].Price}}'></input>
</view>
<view class='baseitem'>
<text class='baseitem_key1'>政策单价</text>
<text class='baseitem_value1' data-idx='{{idx}}'>{{obj[idx].PolicyPrice}}</text>
</view>
</view>
<view class='delete' catchtap='deleteItem' data-idx='{{idx}}'>删除</view>
</view>
</block>
<view class='add' catchtap='add'>
<image class="ico" src="/imgs/tianjia.png"></image>
</view>
</view>
<!-- <template name='fodder'>
</template> -->
<button class='submit' catchtap='submitForm'>提交</button>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer1" data-statu="close" wx:if="{{showModalStatus1}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus1}}">
<!--drawer content-->
<view class='top'>
<input input class="sousuo" bindinput="select1" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{goods}}" wx:key="item">
<view class="grid1" catchtap='itemclick1' data-idx='{{idx}}' data-Name='{{item.Goods_Name}}' data-policyprice='{{item.PolicyPrice}}' data-data='{{item}}'>
<text class='text3'>{{item.Goods_Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer1" data-statu="close">取消</view>
</view>
</swiper-item>
</swiper>

+ 224
- 0
pages/order/newBill/newBill.wxss View File

@ -0,0 +1,224 @@
/* pages/saleforecast/saleforecast.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;
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;
font-size: 30rpx;
}
.baseitem_key {
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key2 {
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value2 {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key1 {
color: #666;
width: 100%;
margin-left: 20rpx;
}
.baseitem_value1 {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 100%;
text-align: right;
}
::-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-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: #2788f8;
}
.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);
}

+ 218
- 0
pages/order/order.js View File

@ -0,0 +1,218 @@
// pages/order/order.js
const app = getApp();
var network = require("../../utils/net.js");
var timechage = require("../../utils/dateTimeUtil.js");
var PageSize = 10
var UnCheckPageIndex = 0
var CheckedPageIndex = 0
var getListPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/GetList'
var deleteItem = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/Delete"
// 未审核订单列表
function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successaction) {
let getArr = [];
let method = getListPath;
let params = [{
"BillState": 0,
"StartLoadTime": app.globalData.selectStartDate,
"EndLoadTime": app.globalData.selectEndDate,
"Customer_ID": app.globalData.selectCustomer_ID,
"PageIndex": UnCheckPageIndex,
"PageSize": PageSize,
}];
network.transfer_request(method, params, function (res) {
successaction();
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 = {
orderState: true,
workFlowName: array[i].DepartmentWorkFlow_Detail_Name,
orderID: array[i].ID,
Customer_Name: array[i].Customer_Name,
time: timechage.formatTimeTwo(array[i].LoadTime.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 = getListPath;
let params = [{
"BillState": 20,
"StartLoadTime": app.globalData.selectStartDate,
"EndLoadTime": app.globalData.selectEndDate,
"Customer_ID": app.globalData.selectCustomer_ID,
"PageIndex": CheckedPageIndex,
"PageSize": PageSize,
}];
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,
workFlowName: array[i].DepartmentWorkFlow_Detail_Name,
orderID: array[i].ID,
Customer_Name: array[i].Customer_Name,
time: timechage.formatTimeTwo(array[i].LoadTime.substring(6, 19),'Y/M/D')
}
getArr.push(dmo);
}
let arrLast = that.data.checkedDataArr.concat(getArr);
that.setData({
checkedDataArr: arrLast,
})
})
}
Page({
data: {
checkedDataArr: [],
unCheckDataArr: [],
winHeight: app.globalData.winHeight,
currentTab: 0,
},
/**
* 滑动切换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
})
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
checkedDataArr: [],
unCheckDataArr: [],
})
var that = this;
UnCheckPageIndex = 0;
CheckedPageIndex = 0;
getUnCheckOrderList(that, UnCheckPageIndex, PageSize, function (res) {
getCheckedOrderList(that, CheckedPageIndex, PageSize);
});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
PageSize = 10
app.globalData.selectCustomer_ID = null
app.globalData.selectStartDate = null
app.globalData.selectEndDate = null
},
//未审核订单滑动到底部加载
unCheckedScrollLower: function (event) {
var that = this;
UnCheckPageIndex = UnCheckPageIndex + 1;
getUnCheckOrderList(that, UnCheckPageIndex, PageSize, function (res) {
});
},
//已审核订单滑动到底部加载
checkedScrollLower: function (event) {
var that = this;
CheckedPageIndex = CheckedPageIndex + 1;
getCheckedOrderList(that, CheckedPageIndex, PageSize);
},
// 进入订单详情
itemclick: function(e) {
wx.navigateTo({
url: 'detail/detail?ID=' + e.currentTarget.dataset.orderid,
})
},
// 长按删除一条单据
longPressDelete: function (event) {
var that = this;
var itemID = event.currentTarget.dataset.orderid;
wx.showModal({
title: '提示',
content: '确定要删除' + itemID + '号单据吗?',
success: function (res) {
if (res.confirm) {
var params = [itemID];
network.transfer_request(deleteItem, params, function (res) {
wx.showToast({
title: '操作成功',
})
that.onShow();
})
} else if (res.cancel) {
console.log('点击取消了');
return false;
}
}
})
},
createNew: function(e) {
wx.navigateTo({
url: 'newBill/newBill',
})
},
chose: function(e) {
wx.navigateTo({
url: 'query/query',
})
},
// 该方法绑定了页面滚动时的事件
scroll: function(event) {
this.setData({
scrollTop: event.detail.scrollTop
});
},
})

+ 5
- 0
pages/order/order.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "订单列表"
}

+ 52
- 0
pages/order/order.wxml View File

@ -0,0 +1,52 @@
<!--pages/order/order.wxml-->
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">未审核</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">已审核</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" style='height:{{winHeight -95}}px' duration="300" bindchange="bindChange">
<!-- 未审核 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-y="true" class='scroll-views' style='height:{{winHeight -43}}px' bindscrolltolower="unCheckedScrollLower">
<view class="custmer_list_view_main" wx:for="{{unCheckDataArr}}" wx:key="item">
<view class='custmer_list_view' catchtap='itemclick' bindlongpress="longPressDelete" data-orderid='{{item.orderID}}'>
<view class='phone_h'>
<text class='text_name'>{{item.Customer_Name}}</text>
<text style='color:{{item.color}}' class='text_state'>流程状态:{{item.workFlowName}}</text>
</view>
<view class='phone_h'>
<text class='text_id'>No.{{item.orderID}}</text>
<text class='text_time'>发货时间:{{item.time}}</text>
</view>
</view>
<view class='view_line_main'>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-items2">
<scroll-view scroll-y="true" class='scroll-views' style='height:{{winHeight -43}}px' bindscrolltolower="checkedScrollLower">
<view class="custmer_list_view_main" wx:for="{{checkedDataArr}}" wx:key="item">
<view class='custmer_list_view' catchtap='itemclick' data-orderid='{{item.orderID}}'>
<view class='phone_h'>
<text class='text_name'>{{item.Customer_Name}}</text>
<text style='color:{{item.color}}' class='text_state'>流程状态:{{item.workFlowName}}</text>
</view>
<view class='phone_h'>
<text class='text_id'>No.{{item.orderID}}</text>
<text class='text_time'>发货时间:{{item.time}}</text>
</view>
</view>
<view class='view_line_main'>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<image class='xinjian' bindtap="createNew" src="/imgs/create.png"></image>
<button class='chose' catchtap='chose'>筛选</button>

+ 117
- 0
pages/order/order.wxss View File

@ -0,0 +1,117 @@
/* pages/order/order.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 {
width: 100%;
display: block;
overflow: hidden;
}
.custmer_list_view_main{
background-color: #fff;
}
.scroll-views {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.custmer_list{
margin-bottom: 10%;
}
.custmer_list_view{
display: flex;
flex-direction: column;
padding-left: 5%;
padding-top: 16rpx;
background: white;
}
.phone_h{
display: flex;
flex-direction: row;
justify-content: space-between;
padding-top: 12rpx;
padding-right: 5%;
padding-bottom: 10rpx;
}
.text_name{
font-size: 32rpx;
color: rgb(48, 48, 48);
}
.text_state{
font-size: 28rpx;
}
.text_id{
font-size: 28rpx;
color: rgb(136, 136, 136);
}
.text_time{
font-size: 28rpx;
color: rgb(136, 136, 136);
}
.view_line_main{
height: 1rpx;
background-color: #dbdbdb;
margin-left: 20rpx;
margin-right: 0rpx;
}
.view_line{
height: 1rpx;
margin-left: 20rpx;
margin-right: 0rpx;
background: #dbdbdb;
}
.chose{
width: 100%;
height: 40px;
position: fixed;
bottom: 0rpx;
}
.xinjian{
width: 160rpx;
height: 160rpx;
position: fixed;
bottom: 60rpx;
right: 20rpx;
}

+ 194
- 0
pages/order/query/query.js View File

@ -0,0 +1,194 @@
// pages/orderSearch/orderSearch.js
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.selectStartDate = sDate;
app.globalData.selectEndDate = 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,
});
}
}
})

+ 3
- 0
pages/order/query/query.json View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "订单筛选"
}

+ 48
- 0
pages/order/query/query.wxml View File

@ -0,0 +1,48 @@
<!--pages/orderSearch/orderSearch.wxml-->
<view class='twoitem'>
<text>购货客户</text>
<text class='item_value' bindtap="powerDrawer" data-statu="open" data-x='购货客户' data-item='{{which}}'>{{customer[customerIndex].Name}}</text>
</view>
<view class='twoitem'>
<text>开始日期</text>
<picker class='item_value' mode="date" value="{{Sdate}}" start="2018-01-01" end="2037-12-31" bindchange="bindSDateChange">
<view class="picker">
{{Sdate}}
</view>
</picker>
</view>
<view class='twoitem'>
<text>结束日期</text>
<picker class='item_value' mode="date" value="{{Edate}}" start="2018-01-01" end="2037-12-31" bindchange="bindEDateChange">
<view class="picker">
{{Edate}}
</view>
</picker>
</view>
<button class='submit' catchtap='submitForm'>提交</button>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>

+ 94
- 0
pages/order/query/query.wxss View File

@ -0,0 +1,94 @@
/* pages/orderSearch/orderSearch.wxss */
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;
}
.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: #2788f8;
}
.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);
}

+ 726
- 0
pages/saleForecastList/Detail/Detail.js View File

@ -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
});
}
}
})

+ 5
- 0
pages/saleForecastList/Detail/Detail.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "预报详情"
}

+ 183
- 0
pages/saleForecastList/Detail/Detail.wxml View File

@ -0,0 +1,183 @@
<!--pages/orderinfo/orderinfo.wxml-->
<!-- <view class="swiper-tab">
<view class="swiper-tab-list tab1 {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>
<view class="swiper-tab-list tab2 {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">预报详细</view>
</view> -->
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">预报详细</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 55}}px" bindchange="bindChange">
<!-- 基本信息 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='backGroundContainer'>
<view class='baseitem'>
<text class='baseitem_key'>购货客户</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseCustomer' value='{{customerIndex}}' range-key="name" range='{{customer}}'>
<text>{{customer[customerIndex].name}}</text>
</picker> -->
<view class='baseitem_value' data-x='购货客户' data-item='{{which}}'>
{{customer[customerIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>发货时间</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" range="{{dateTimeArray1}}">
<view class="tui-picker-detail">
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
</view>
</picker>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>会计单位</text>
<!-- 详情单据内会计单位是否不可编辑 -->
<!-- bindtap="powerDrawer" data-statu="open" data-x='会计部门' data-item='{{which}}' -->
<view class='baseitem_value'>
{{unit[isUnit].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>销售部门</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseDepartment' value='{{departmentIndex}}' range-key="name" range='{{department}}'>
<text>{{department[departmentIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='部门' data-item='{{which}}'>
{{department[departmentIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>销售类型</text>
<!-- <picker class='baseitem_value' mode='selector' bindchange='choseSaletype' value='{{saletypeIndex}}' range-key="name" range='{{saletype}}'>
<text>{{saletype[saletypeIndex].name}}</text>
</picker> -->
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='销售类型' data-item='{{which}}'>
{{saletype[saletypeIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>送货地址</text>
<input class='baseitem_value' bindinput='getAddrs' placeholder='请输入送货地址' placeholder-style='color:rgb(202, 202, 202)' value="{{addrs}}"></input>
</view>
<view class='horizontallineView'></view>
<!-- <view class='baseitem'>
<text class='baseitem_key' space="emsp">摘 要</text>
<input class='baseitem_value' bindinput='getRemark' placeholder='请输入摘要' placeholder-style='color:rgb(202, 202, 202)'></input>
</view> -->
<!-- <button class='submit' catchtap='submitForm'>保存</button> -->
</view>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>
</swiper-item>
<!-- 订单详细 -->
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='main-body'>
<block wx:for="{{obj}}" wx:key="item" wx:for-index="idx">
<!-- <template is="fodder" data="{{...item}}"></template> -->
<!-- <view class='backGroundContainer'> -->
<view class='itemView'>
<view class='baseitem'>
<text class='baseitem_key1'>存货名称</text>
<view class='baseitem_value1' bindtap="powerDrawer1" data-statu="open" data-idx='{{idx}}'>
{{obj[idx].Goods_Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1'>报货数量</text>
<input class='baseitem_value1' bindinput='getGoodsNum' placeholder='请输入报货数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsNum}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1' space='ensp'>辅 数 量</text>
<input class='baseitem_value1' bindinput='getSecondNum' placeholder='请输入辅数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsSecondNum}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1' space='emsp'>单 价</text>
<input class='baseitem_value1' type='digit' bindinput='getPrice' placeholder='请输入单价' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].Price}}'></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key1'>政策单价</text>
<text class='baseitem_value1' data-idx='{{idx}}'>{{obj[idx].PolicyPrice}}</text>
</view>
<view class='horizontallineView'></view>
</view>
<view class='delete' catchtap='deleteItem' data-idx='{{idx}}'>删除</view>
<view class='horizontallineView'></view>
</block>
<view class='add' catchtap='add'>
<image class="ico" src="/imgs/tianjia.png"></image>
</view>
</view>
<!-- <template name='fodder'>
</template> -->
<button class='submit' catchtap='submitForm'>保存</button>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer1" data-statu="close" wx:if="{{showModalStatus1}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus1}}">
<!--drawer content-->
<view class='top'>
<input input class="sousuo" bindinput="select1" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{goods}}" wx:key="item">
<view class="grid1" catchtap='itemclick1' data-idx='{{idx}}' data-Name='{{item.Goods_Name}}' data-policyprice='{{item.PolicyPrice}}' data-data='{{item}}'>
<text class='text3'>{{item.Goods_Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer1" data-statu="close">取消</view>
</view>
</swiper-item>
</swiper>

+ 229
- 0
pages/saleForecastList/Detail/Detail.wxss View File

@ -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);
}

+ 707
- 0
pages/saleForecastList/newBill/newBill.js View File

@ -0,0 +1,707 @@
var app = getApp()
var network = require("../../../utils/net.js")
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 getDept = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment";
var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice";
var getSaleKind = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetSaleKind"
var insert = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Insert';
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 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: "",
winHeight: app.globalData.winHeight,
// 从哪个页面返回当前页面
backPage: "",
// 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
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
var that = this;
if (that.data.backPage == "customerChoosePage") {
// 返回的用户只能是一条,所以index只能为0
var customerArr = app.globalData.customerArray;
if (customerArr.length > 0) {
that.setData({
customer: customerArr,
customerIndex: 0,
})
}
}
if (that.data.backPage == "goodsNameChoosePage") {
// 获取存货 加载完成后计算价格政策
var goodsArr = app.globalData.goodsNameArray;
if (goodsArr.length > 0) {
let backGoodsArr = [];
for (var i = 0; i < goodsArr.length; i++) {
var name = goodsArr[i].Goods_Name;
var id = goodsArr[i].SaleGoods_ID;
var pp = goodsArr[i].PolicyPrice;
var price = goodsArr[i].Price;
var mainUnitRatio = goodsArr[i].Goods_MainUnitRatio;
var secondUnitRatio = goodsArr[i].Goods_SecondUnitRatio;
var unitConvertDirection = goodsArr[i].Goods_UnitConvertDirection;
var rightRatio = goodsArr[i].RightRatio;
var leftRatio = goodsArr[i].LeftRatio;
if (pp == null) {
pp = Number(0);
}
if (rightRatio == null) {
rightRatio = Number(1);
}
if (leftRatio == null) {
leftRatio = Number(1);
}
let goodsNameObj = {
Goods_MainUnitRatio: Number(mainUnitRatio),
Goods_SecondUnitRatio: Number(secondUnitRatio),
SaleGoods_ID: Number(id),
Goods_Name: name,
Price: Number(price),
PolicyPrice: Number(pp),
Goods_UnitConvertDirection: Number(unitConvertDirection),
RightRatio: rightRatio,
LeftRatio: leftRatio,
}
backGoodsArr.push(goodsNameObj)
}
that.setData({
obj: backGoodsArr,
})
}
}
},
// 原有请求客户的方法,已经废弃
GetCustomer: function() {
wx.navigateTo({
url: '../../customerChooseTemplate/customerChooseTemplate?fromePage=newForecast',
})
// 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: "购货客户"
// })
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
app.globalData.goodsNameArray = [];
app.globalData.customerArray = [];
},
/**
* 滑动切换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) {
var that = this;
let unitID = that.data.unit[that.data.isUnit].ID;
let customerID = that.data.customer[that.data.customerIndex].ID;
if (unitID && customerID) {
wx.navigateTo({
url: '../../goodaNameChooseTemplate/goodaNameChooseTemplate?unitID=' + unitID + '&customerID' + customerID,
})
} else {
wx.showModal({
title: '提示',
content: '请先选择客户及会计单位',
})
}
},
// 添加购货客户 跳转客户选择页面
getCustomerItem: function() {
wx.navigateTo({
url: '../../customerChooseTemplate/customerChooseTemplate?fromePage=newForecast',
})
},
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 = 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
});
}
}
})

+ 5
- 0
pages/saleForecastList/newBill/newBill.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "预报新建"
}

+ 156
- 0
pages/saleForecastList/newBill/newBill.wxml View File

@ -0,0 +1,156 @@
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">预报详细</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 55}}px" bindchange="bindChange">
<!-- 基本信息 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='baseitem'>
<text class='baseitem_key'>购货客户</text>
<view class='baseitem_value' bindtap="getCustomerItem">
{{customer[customerIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>发货时间</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" range="{{dateTimeArray1}}">
<view class="tui-picker-detail">
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
</view>
</picker>
</view>
<view class='baseitem'>
<text class='baseitem_key'>会计单位</text>
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='会计部门' data-item='{{which}}'>
{{unit[isUnit].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>销售部门</text>
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='部门' data-item='{{which}}'>
{{department[departmentIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>销售类型</text>
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='销售类型' data-item='{{which}}'>
{{saletype[saletypeIndex].Name}}
</view>
</view>
<view class='baseitem'>
<text class='baseitem_key'>送货地址</text>
<input class='baseitem_value' bindinput='getAddrs' placeholder='请输入送货地址' placeholder-style='color:rgb(202, 202, 202)'></input>
</view>
<!-- <button class='submit' catchtap='submitForm'>提交</button> -->
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>
</swiper-item>
<!-- 订单详细 -->
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='main-body'>
<block wx:for="{{obj}}" wx:key="item" wx:for-index="idx">
<view class='itemView'>
<view class='baseitem'>
<text class='baseitem_key2'>存货名称</text>
<view class='baseitem_value2'>
{{obj[idx].Goods_Name}}
</view>
</view>
<view class='twogroup'>
<view class='baseitem'>
<text class='baseitem_key1'>报货数量</text>
<input class='baseitem_value1' bindinput='getGoodsNum' placeholder='请输入报货数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsNum}}'></input>
</view>
<view class='baseitem'>
<text class='baseitem_key1' space='ensp'>辅 数 量</text>
<input class='baseitem_value1' bindinput='getSecondNum' placeholder='请输入辅数量' type='digit' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].goodsSecondNum}}'></input>
</view>
</view>
<view class='twogroup'>
<view class='baseitem'>
<text class='baseitem_key1' space='emsp'>单 价</text>
<input class='baseitem_value1' type='digit' bindinput='getPrice' placeholder='请输入单价' placeholder-style='color:rgb(202, 202, 202)' data-idx='{{idx}}' value='{{obj[idx].Price}}'></input>
</view>
<view class='baseitem'>
<text class='baseitem_key1'>政策单价</text>
<text class='baseitem_value1' data-idx='{{idx}}'>{{obj[idx].PolicyPrice}}</text>
</view>
</view>
<view class='delete' catchtap='deleteItem' data-idx='{{idx}}'>删除</view>
</view>
</block>
<view class='add' catchtap='add'>
选择存货
<!-- <image class="ico" src="/imgs/tianjia.png"></image> -->
</view>
</view>
<!-- <template name='fodder'>
</template> -->
<button class='submit' catchtap='submitForm'>提交</button>
</scroll-view>
<view class="drawer_screen" bindtap="powerDrawer1" data-statu="close" wx:if="{{showModalStatus1}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus1}}">
<!--drawer content-->
<view class='top'>
<input input class="sousuo" bindinput="select1" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{goods}}" wx:key="item">
<view class="grid1" catchtap='itemclick1' data-idx='{{idx}}' data-Name='{{item.Goods_Name}}' data-policyprice='{{item.PolicyPrice}}' data-data='{{item}}'>
<text class='text3'>{{item.Goods_Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer1" data-statu="close">取消</view>
</view>
</swiper-item>
</swiper>

+ 220
- 0
pages/saleForecastList/newBill/newBill.wxss View File

@ -0,0 +1,220 @@
/* pages/saleForecastList/saleForecastCreatNew/saleForecastCreatNew.wxss */
page {
background: rgb(240, 239, 245);
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;
margin-top: 3px;
}
.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;
font-size: 30rpx;
}
.baseitem_key {
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key2 {
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value2 {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key1 {
color: #666;
width: 100%;
margin-left: 20rpx;
}
.baseitem_value1 {
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 100%;
text-align: right;
}
::-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; */
padding-top: 16rpx;
padding-bottom: 16rpx;
text-align: center;
}
.text3 {
font-size: 18px;
color: rgb(48, 48, 48);
}

+ 196
- 0
pages/saleForecastList/query/query.js View File

@ -0,0 +1,196 @@
var network = require("../../../utils/net.js")
var timechage = require("../../../utils/dateTimeUtil.js")
var app = getApp()
var getCustomer= "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer";
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: "购货客户"
})
}
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,
});
}
}
})

+ 3
- 0
pages/saleForecastList/query/query.json View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "筛选"
}

+ 25
- 0
pages/saleForecastList/query/query.wxml View File

@ -0,0 +1,25 @@
<view class='twoitem'>
<text>购货客户</text>
<text class='item_value' bindtap="powerDrawer" data-statu="open" data-x='购货客户' data-item='{{which}}'>{{customer[customerIndex].Name}}</text>
</view>
<button class='submit' catchtap='submitForm'>查询</button>
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" data-item='{{which}}' class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class='top' data-item='{{which}}'>
<input data-item='{{which}}' class="sousuo" bindinput="select" placeholder='请输入搜索'>
</input>
</view>
<view class="drawer_content">
<block wx:for="{{currency}}" wx:key="item" wx:for-index="idx">
<view class="grid1" data-item='{{which}}' catchtap='itemclick' data-idx='{{idx}}' data-ID="{{item.ID}}" data-Name='{{item.Name}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>

+ 94
- 0
pages/saleForecastList/query/query.wxss View File

@ -0,0 +1,94 @@
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;
}
.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);
}

+ 248
- 0
pages/saleForecastList/saleForecastList.js View File

@ -0,0 +1,248 @@
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 getList = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/GetList'
var deleteItem = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/Delete"
// 未审核订单列表
function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successaction) {
let getArr = [];
let method = getList;
let params = [{
"BillState": 0,
"Customer_ID": that.data.Customer_ID,
"PageIndex": UnCheckPageIndex,
"PageSize": UnCheckPageSize,
}];
network.transfer_request(method, params, function(res) {
successaction();
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'),
workFlowName: array[i].DepartmentWorkFlow_Detail_Name,
}
getArr.push(dmo);
}
let arrLast = that.data.unCheckDataArr.concat(getArr);
that.setData({
unCheckDataArr: arrLast,
})
})
}
// 已审核订单列表
function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
let getArr = [];
let method = getList;
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'),
workFlowName: array[i].DepartmentWorkFlow_Detail_Name,
}
getArr.push(dmo);
}
let arrLast = that.data.checkedDataArr.concat(getArr);
that.setData({
checkedDataArr: arrLast,
})
})
}
Page({
data: {
checkedDataArr: [],
unCheckDataArr: [],
currentTab: 0,
winHeight: app.globalData.winHeight,
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,
})
},
// 长按删除一条单据
longPressDelete: function(event) {
var that =this;
var itemID = event.currentTarget.dataset.detailitemid;
var state = event.currentTarget.dataset.detailitemstate;
if (!state) {
wx.showModal({
title: '提示',
content: '不能操作已审核单据',
})
return;
}
wx.showModal({
title: '提示',
content: '确定要删除'+ itemID +'号单据吗?',
success: function(res) {
if (res.confirm) {
var params = [itemID];
network.transfer_request(deleteItem, params, function(res) {
wx.showToast({
title: '操作成功',
})
that.onShow();
})
} else if (res.cancel) {
console.log('点击取消了');
return false;
}
}
})
},
//点击进入筛选页面
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;
UnCheckPageIndex = 0;
CheckedPageIndex = 0;
getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, function(res) {
getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize);
});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
app.globalData.selectCustomer_ID = null
app.globalData.selectStartDate = null
app.globalData.selectEndDate = null
app.globalData.selectBillState = 0
},
//未审核订单滑动到底部加载
unCheckedScrollLower: function(event) {
var that = this;
UnCheckPageIndex = UnCheckPageIndex + 1;
getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, function(res) {
});
},
//已审核订单滑动到底部加载
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);
// }
// },
})

+ 5
- 0
pages/saleForecastList/saleForecastList.json View File

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "销售预报"
}

+ 55
- 0
pages/saleForecastList/saleForecastList.wxml View File

@ -0,0 +1,55 @@
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">未审核</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">已审核</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" style='height:{{winHeight -95}}px' duration="300" bindchange="bindChange">
<!-- 未审核 -->
<swiper-item class="swiper-items1">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views' bindscrolltolower="unCheckedScrollLower">
<view class='backGroundContainer'>
<block wx:for="{{unCheckDataArr}}" wx:for-item="item" wx:key="item">
<template is="outStoreOrderTemplate" data="{{item}}" />
</block>
</view>
</scroll-view>
</swiper-item>
<!-- 已审核 -->
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views' bindscrolltolower="CheckedScrollLower">
<view class='backGroundContainer'>
<block wx:for="{{checkedDataArr}}" wx:for-item="item" wx:key="item">
<template is="outStoreOrderTemplate" data="{{item}}" />
</block>
</view>
</scroll-view>
</swiper-item>
</swiper>
<image class='xinjian' bindtap="createNew" src="/imgs/create.png"></image>
<button class='chose' catchtap='chose'>筛选</button>
<template name="outStoreOrderTemplate">
<view class='listItem' catchtap='transToOrderDetail' bindlongpress="longPressDelete" data-detailitemid='{{item.orderID}}' data-detailitemstate='{{item.orderState}}'>
<view class='bottomView'>
<view class='goodsNum'>
<text class='goodsIDText'>NO:{{item.orderID}}</text>
</view>
<view class='goodsMoney'>
<text class='goodsMoneyText'>流程状态:{{item.workFlowName}}</text>
</view>
</view>
<view class='bottomView'>
<view class='goodsNum'>
<text class='goodsNumText'>{{item.Customer_Name}}</text>
</view>
<view class='goodsMoney'>
<text class='goodsMoneyText'>发货日期:{{item.time}}</text>
</view>
</view>
</view>
<view class='horizontallineView'></view>
</template>

+ 113
- 0
pages/saleForecastList/saleForecastList.wxss View File

@ -0,0 +1,113 @@
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 {
width: 100%;
display: block;
overflow: hidden;
}
.scroll-views {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
.backGroundContainer{
background: #fff;
}
.listItem{
height: 100rpx;
display: flex;
flex-direction: column;
padding: 20rpx 20rpx;
/* border-bottom: 1rpx solid #ddd; */
}
.horizontallineView {
height: 1rpx;
background-color: #dbdbdb;
margin-left: 20rpx;
margin-right: 0rpx;
}
.orderID{
height: 50%;
width: 100%;
}
.bottomView{
height: 50%;
width: 100%;
display: flex;
flex-direction: row;
}
.goodsNum{
height: 100%;
width: 50%;
}
.goodsMoney{
height: 100%;
width: 50%;
text-align: right;
}
.goodsIDText{
font-size: 16px;
}
.goodsNumText{
font-size: 14px;
color: #666;
}
.goodsMoneyText{
font-size: 14px;
color: #666;
}
.xinjian{
width: 160rpx;
height: 160rpx;
position: fixed;
bottom: 60rpx;
right: 20rpx;
}
.chose{
width: 100%;
height: 40px;
position: fixed;
bottom: 0rpx;
}

+ 80
- 0
utils/dateTimePicker.js View File

@ -0,0 +1,80 @@
function withData(param) {
return param < 10 ? '0' + param : '' + param;
}
function getLoopArray(start, end) {
var start = start || 0;
var end = end || 1;
var array = [];
for (var i = start; i <= end; i++) {
array.push(withData(i));
}
return array;
}
function getMonthDay(year, month) {
var flag = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0), array = null;
switch (month) {
case '01':
case '03':
case '05':
case '07':
case '08':
case '10':
case '12':
array = getLoopArray(1, 31)
break;
case '04':
case '06':
case '09':
case '11':
array = getLoopArray(1, 30)
break;
case '02':
array = flag ? getLoopArray(1, 29) : getLoopArray(1, 28)
break;
default:
array = '月份格式不正确,请重新输入!'
}
return array;
}
function getNewDateArry() {
// 当前时间的处理
var newDate = new Date();
var year = withData(newDate.getFullYear()),
mont = withData(newDate.getMonth() + 1),
date = withData(newDate.getDate()),
hour = withData(newDate.getHours()),
minu = withData(newDate.getMinutes()),
seco = withData(newDate.getSeconds());
return [year, mont, date, hour, minu, seco];
}
function dateTimePicker(startYear, endYear, date) {
// 返回默认显示的数组和联动数组的声明
var dateTime = [], dateTimeArray = [[], [], [], [], [], []];
var start = startYear || 1978;
var end = endYear || 2100;
// 默认开始显示数据
var defaultDate = date ? [...date.split(' ')[0].split('-'), ...date.split(' ')[1].split(':')] : getNewDateArry();
// 处理联动列表数据
/*年月日 时分秒*/
dateTimeArray[0] = getLoopArray(start, end);
dateTimeArray[1] = getLoopArray(1, 12);
dateTimeArray[2] = getMonthDay(defaultDate[0], defaultDate[1]);
dateTimeArray[3] = getLoopArray(0, 23);
dateTimeArray[4] = getLoopArray(0, 59);
dateTimeArray[5] = getLoopArray(0, 59);
dateTimeArray.forEach((current, index) => {
dateTime.push(current.indexOf(defaultDate[index]));
});
return {
dateTimeArray: dateTimeArray,
dateTime: dateTime
}
}
module.exports = {
dateTimePicker: dateTimePicker,
getMonthDay: getMonthDay
}

Loading…
Cancel
Save