Browse Source

特价申请新建完成

master
chenxuhui 7 years ago
parent
commit
b84c48c2d8
4 changed files with 217 additions and 70 deletions
  1. +2
    -2
      pages/customerChooseTemplate/customerChooseTemplate.js
  2. +191
    -50
      pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js
  3. +20
    -15
      pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml
  4. +4
    -3
      pages/specialOrderApplication/specialOrderApplication.js

+ 2
- 2
pages/customerChooseTemplate/customerChooseTemplate.js View File

@ -7,7 +7,7 @@ var utilll = require('../../utils/util.js');
var fromPage = '';
var getAccountingUnit = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetAccountingUnit";
var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomer";
var getCustomer = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetCustomerExt";
Page({
@ -31,7 +31,7 @@ Page({
"InputValue": inputValue,
"PageIndex": 0,
"PageSize": 100
}];
}, ["CustomerCatalog_Name"]];
network.transfer_request(method, params, function(res) {
that.setData({
customerArray: res.result


+ 191
- 50
pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js View File

@ -7,6 +7,8 @@ var timechage = require("../../../utils/dateTimeUtil.js")
var getDept = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetDepartment";
var getSaleKind = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetSaleKind"
var getPrice = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsPirce";
var insert = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/MarketingActivityRpc/Insert';
function GetSaleKind(that, v) {
let method = getSaleKind;
@ -15,7 +17,7 @@ function GetSaleKind(that, v) {
"PageIndex": 0,
"PageSize": 100
}];
network.transfer_request(method, params, function (res) {
network.transfer_request(method, params, function(res) {
that.setData({
currency: res.result,
saletype: res.result
@ -33,7 +35,7 @@ function GetDepartment(that, inputValue) {
"PageIndex": 0,
"PageSize": 100
}];
network.transfer_request(method, params, function (res) {
network.transfer_request(method, params, function(res) {
that.setData({
currency: res.result,
department: res.result
@ -51,7 +53,7 @@ function GetAccountingUnit(that, inputValue) {
"PageIndex": 0,
"PageSize": 100
}];
network.transfer_request(method, params, function (res) {
network.transfer_request(method, params, function(res) {
that.setData({
currency: res.result,
unit: res.result
@ -74,9 +76,9 @@ Page({
startYear: 2018,
endYear: 2030,
// 用户数组
customerArr:[],
customerArr: [],
// 存货数组
goodsNameArr:[],
goodsNameArr: [],
which: "",
idx: 0,
currency: [],
@ -85,26 +87,32 @@ Page({
ID: 0,
Name: "请选择销售类型"
}],
customerIndex: 0,
customer: [{
ID: 0,
Name: "请选择客户"
}],
isUnit: 0,
unit: [],//会计单位
unit: [], //会计单位
departmentIndex: 0,
department: [],//销售部门
addrs: "",
department: [], //销售部门
name: "",
remark:'',
},
// 添加名称
getName: function(e) {
this.data.name = e.detail.value;
},
// 添加地址
getAddrs: function (e) {
this.data.addrs = e.detail.value;
// 添加摘要
getRemark: function (e) {
this.data.remark = e.detail.value;
},
// 获取输入框值进行保存
getInputValue:function (e){
getInputValue: function(e) {
var style = e.currentTarget.dataset.datastyle
var itemIndex = e.currentTarget.dataset.index;
var array = this.data.goodsNameArr;
@ -115,14 +123,14 @@ Page({
},
// 获取存货时间变化进行保存
bindTimeChange: function (e) {
bindTimeChange: function(e) {
var style = e.currentTarget.dataset.datastyle
var itemIndex = e.currentTarget.dataset.index;
var itemIndex = e.currentTarget.dataset.index;
var array = this.data.goodsNameArr;
array[itemIndex][style]= e.detail.value,
this.setData({
goodsNameArr: array,
})
array[itemIndex][style] = e.detail.value,
this.setData({
goodsNameArr: array,
})
},
// 基本信息日期
@ -134,23 +142,34 @@ Page({
},
// 添加客户
addCustomer: function(){
addCustomer: function() {
wx.navigateTo({
url: '../../customerChooseTemplate/customerChooseTemplate?fromePage=specialOrder',
})
},
// 添加存货
addGoodsName: function(){
wx.navigateTo({
url: '../../goodaNameChooseTemplate/goodaNameChooseTemplate',
})
addGoodsName: function() {
var that = this;
let unitID = that.data.unit[that.data.isUnit].ID;
var customerArr = that.data.customerArr;
if (unitID && customerArr.length > 0) {
let customerID = customerArr[0].ID;
wx.navigateTo({
url: '../../goodaNameChooseTemplate/goodaNameChooseTemplate?unitID=' + unitID + '&customerID' + customerID,
})
} else {
wx.showModal({
title: '提示',
content: '请先选择客户及会计单位',
})
}
},
/**
* 滑动切换tab
*/
bindChange: function (e) {
bindChange: function(e) {
var that = this;
that.setData({
currentTab: e.detail.current
@ -159,7 +178,7 @@ Page({
/**
* 点击tab切换
*/
swichNav: function (e) {
swichNav: function(e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
@ -171,7 +190,7 @@ Page({
},
// 遮罩的搜索框事件
select: function (e) {
select: function(e) {
var that = this;
// 自定义的类型
var which = e.currentTarget.dataset.item;
@ -189,7 +208,7 @@ Page({
},
// 判断条件进行遮罩内容选取
powerDrawer: function (e) {
powerDrawer: function(e) {
let that = this;
let x = e.currentTarget.dataset.x;
if (x == "会计部门") {
@ -207,7 +226,7 @@ Page({
},
// 遮罩层点击选中具体条目
itemclick: function (e) {
itemclick: function(e) {
var that = this;
var which = e.currentTarget.dataset.item;
var idx = e.currentTarget.dataset.idx;
@ -238,10 +257,10 @@ Page({
/**
* 存货明细保存按钮 点击新建单据 内部做逻辑判断 存储值是否都已经加载
*/
creatNewSpecialOrder:function (){
var that =this;
// 会计单位
submitOrder: function() {
var that = this;
let unitID = this.data.unit[this.data.isUnit].ID;
let departmentID = this.data.department[this.data.departmentIndex].ID;
let year = this.data.dateTimeArray[0][this.data.dateTime[0]]
let month = this.data.dateTimeArray[1][this.data.dateTime[1]]
@ -251,19 +270,111 @@ Page({
let stringTime = year + "/" + month + "/" + date + " " + hour + ":" + minu + ":00"
let timestamp2 = Date.parse(new Date(stringTime));
// 基本信息时间转换
let update = "/Date(" + timestamp2 + "+0800)/";
//应该是从存货数组中获取对应的时间
if (unitID == 0) {
wx.showToast({
title: '请选择会计单位'
})
return;
}
if (departmentID == 0) {
wx.showToast({
title: '请选择销售部门',
})
return;
}
if (this.data.customerArr.length <= 0) {
wx.showToast({
title: '客户不能为空',
})
return;
}
let customerDetailsArray = [];
var customerArray = this.data.customerArr;
for (var i = 0; i < customerArray.length; i++) {
var dmo = {
Customer_ID: customerArray[i].ID,
// CustomerCatalog_Name: customerArray[i].CustomerCatalog_Name,
}
customerDetailsArray.push(dmo)
}
if (this.data.goodsNameArr.length <=0 ) {
wx.showToast({
title: '存货不能为空',
})
return;
}
let goodsDetailsArray = [];
var goodsNameArray = this.data.goodsNameArr;
for (var i = 0; i < goodsNameArray.length; i++) {
if (goodsNameArray[i].applicationPrice == "") {
wx.showToast({
title: '特价价格不能为空',
})
return;
}
if (goodsNameArray[i].applicationNum == '') {
wx.showToast({
title: '申请数量不能为空',
})
return;
}
let beginTime = timechage.formatymdERTDate(goodsNameArray[i].applicationStartTime);
let endTime = timechage.formatymdERTDate(goodsNameArray[i].applicationEndTime);
var dmo = {
SaleGoods_ID: goodsNameArray[i].SaleGoods_ID,
LastPrice: goodsNameArray[i].Price,
Price: goodsNameArray[i].applicationPrice,
BeginTime: beginTime,
EndTime: endTime,
Number: goodsNameArray[i].applicationNum,
Unit: goodsNameArray[i].applicationUnit,
}
goodsDetailsArray.push(dmo)
}
// 存货明细起止时间转换
let guaranteeDate = timechage.formatymdERTDate(this.data.starTime);
let payDate = timechage.formatymdERTDate(this.data.endTime);
let method = insert;
let params = [{
"Name":this.data.name,
"MarketingActivityDate": update,
"AccountingUnit_ID": unitID,
"Department_ID": departmentID,
"Remark":this.data.remark,
"GoodsDetails": goodsDetailsArray,
"CustomerDetails": customerDetailsArray,
}];
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) {}
})
}
})
},
// 删除客户明细
deleteCustomerItem: function (event) {
deleteCustomerItem: function(event) {
var id = event.target.dataset.idx;
var array = this.data.customerArr;
array.splice(id, 1);
@ -273,16 +384,16 @@ Page({
},
// 删除存货明细
deleteGoodsItem:function(event){
deleteGoodsItem: function(event) {
var id = event.target.dataset.id;
var array = this.data.goodsNameArr;
array.splice(id, 1);
this.setData({
goodsNameArr:array,
goodsNameArr: array,
})
},
onLoad: function (options) {
onLoad: function(options) {
// 获取完整的年月日 时分秒,以及默认显示的数组
var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
// 精确到分的处理,将数组的秒去掉
@ -303,10 +414,34 @@ Page({
});
},
onShow: function () {
GetGoodsPrice: function(Goods_ID, Unit, index) {
var that = this;
let timestamp = Date.parse(new Date());
let date = "/Date(" + timestamp + "+0800)/";
let unitID = that.data.unit[that.data.isUnit].ID;
let customerID = that.data.customerArr[0].ID;
let method = getPrice;
let params = [{
"Goods_ID": Goods_ID, //请求货物接口后返回的字段
"Unit": Unit, //请求货物接口后返回的字段
"Customer_ID": parseInt(customerID),
"AccountingUnit_ID": parseInt(unitID),
"Date": date
}];
network.transfer_request(method, params, function(res) {
var array = that.data.goodsNameArr;
array[index].Price = res.result.Price;
that.setData({
goodsNameArr: array,
})
})
},
onShow: function() {
var that = this;
if (this.data.backPage == "customerChoosePage"){
if (this.data.backPage == "customerChoosePage") {
// 返回的用户只能是一条,所以index只能为0
var currentCustomerArr = app.globalData.customerArray;
if (currentCustomerArr.length > 0) {
@ -314,18 +449,21 @@ Page({
customerArr: currentCustomerArr,
})
}
}
}
if (this.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;
// 存货ID
var id = goodsArr[i].SaleGoods_ID;
// 获取价格
var unit = goodsArr[i].Unit;
// 原单价
var infoprice = goodsArr[i].Price;
if (infoprice == null) {
@ -348,9 +486,12 @@ Page({
applicationStartTime: infoStartTime,
applicationEndTime: infoEndTime,
applicationNum: infoNum,
applicationUnit: unit,
}
backGoodsArr.push(goodsNameObj)
// 获取原单价
that.GetGoodsPrice(id, unit, i);
}
this.setData({
@ -365,12 +506,12 @@ Page({
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
app.globalData.goodsNameArray = [];
app.globalData.customerArray = [];
},
util: function (currentStatu) {
util: function(currentStatu) {
/* 动画部分 */
// 第1步:创建动画实例
var animation = wx.createAnimation({
@ -391,7 +532,7 @@ Page({
})
// 第5步:设置定时器到指定时候后,执行第二组动画
setTimeout(function () {
setTimeout(function() {
// 执行第二组动画
animation.opacity(1).rotateX(0).step();
// 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
@ -418,7 +559,7 @@ Page({
});
}
},
util1: function (currentStatu) {
util1: function(currentStatu) {
/* 动画部分 */
// 第1步:创建动画实例
var animation = wx.createAnimation({
@ -439,7 +580,7 @@ Page({
})
// 第5步:设置定时器到指定时候后,执行第二组动画
setTimeout(function () {
setTimeout(function() {
// 执行第二组动画
animation.opacity(1).rotateX(0).step();
// 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象


+ 20
- 15
pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml View File

@ -11,7 +11,13 @@
<view class='backGroundContainer'>
<view class='baseitem'>
<text class='baseitem_key'>发货时间</text>
<text class='baseitem_key'>名称</text>
<input class='baseitem_value' bindinput='getName' placeholder='请输入单据名称' placeholder-style='color:rgb(202, 202, 202)' value="{{name}}"></input>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>日期</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime}}" bindchange="changeDateTime" range="{{dateTimeArray}}">
<view class="tui-picker-detail">
{{dateTimeArray[0][dateTime[0]]}}-{{dateTimeArray[1][dateTime[1]]}}-{{dateTimeArray[2][dateTime[2]]}} {{dateTimeArray[3][dateTime[3]]}}:{{dateTimeArray[4][dateTime[4]]}}
@ -38,22 +44,21 @@
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>摘要</text>
<input class='baseitem_value' bindinput='getRemark' placeholder='请输入摘要信息' placeholder-style='color:rgb(202, 202, 202)' value="{{remark}}"></input>
</view>
<view class='horizontallineView'></view>
<!-- <view class='baseitem'>
<text class='baseitem_key'>销售类型</text>
<view class="baseitem_value {{saletype.length <=1 ? 'viewPlaceHolder' : 'viewSelected'}}" bindtap="powerDrawer" data-statu="open" data-x='销售类型' data-item='{{which}}'>
{{saletype[saletypeIndex].Name}}
</view>
</view>
<view class='horizontallineView'></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>
<!-- 遮罩 -->
@ -113,7 +118,7 @@
</image>
</view>
<view class='imageViewNoMargin' catchtap='creatNewSpecialOrder'>
<view class='imageViewNoMargin' catchtap='submitOrder'>
<image class='currentImage' src="/imgs/longBlueBtn.png">
<view class='btnTextView'>
<text class='btnText'>保存</text>
@ -141,7 +146,7 @@
<view class='baseitem'>
<text class='baseitem_key'>客户类型</text>
<view class='baseitem_value'>
{{customerName}}
{{item.CustomerCatalog_Name}}
</view>
</view>
<view class='horizontallineView'></view>
@ -167,9 +172,9 @@
<view class='baseitem'>
<text class='baseitem_key'>原单价</text>
<view class='baseitem_value'>
<input class='inputItem' type='digit' value='{{item.Price}}' placeholder='请输入原单价价格' placeholder-style='color:rgb(202, 202, 202)' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='Price'>
</input>
<view class='baseitem_value'>{{item.Price}}
<!-- <input class='inputItem' type='digit' value='{{item.Price}}' placeholder='请输入原单价价格' placeholder-style='color:rgb(202, 202, 202)' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='Price'>
</input> -->
</view>
</view>
<view class='horizontallineView'></view>
@ -177,7 +182,7 @@
<view class='baseitem'>
<text class='baseitem_key'>特价</text>
<view class='baseitem_value'>
<input class='inputItem' type='digit' value='{{item.applicationPrice}}' placeholder='请输入申请特价价格' placeholder-style='color:rgb(202, 202, 202)' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='applicationPrice'>
<input class='inputItem' type='digit' value='{{item.applicationPrice}}' placeholder='请输入申请特价价格' placeholder-style='color:rgb(202, 202, 202)' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='applicationPrice'>
</input>
</view>
</view>


+ 4
- 3
pages/specialOrderApplication/specialOrderApplication.js View File

@ -11,17 +11,17 @@ var deleteItem = "/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/MarketingActivity
// 未审核订单列表
function getUnCheckOrderList(that, UnCheckPageIndex, pageSize, activityDate, successaction) {
let getArr = [];
let method = getList;
let params = [{
"BillState": 0,
"MarketingActivityDate": activityDate,
"PageIndex": UnCheckPageIndex,
"PageIndex": pageSize,
"PageSize": pageSize,
}];
network.transfer_request(method, params, function(res) {
successaction();
let getArr = [];
var array = res.result;
if (array.length <= 0) {
wx.showToast({
@ -30,6 +30,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, pageSize, activityDate, suc
UnCheckPageIndex = UnCheckPageIndex - 1;
return;
}
for (var i = 0; i < array.length; i++) {
var dmo = {
//添加单据状态的传递,在详情页面判断此值,进行是否允许提交的操作 true : 可提交
@ -50,7 +51,6 @@ function getUnCheckOrderList(that, UnCheckPageIndex, pageSize, activityDate, suc
// 已审核订单列表
function getCheckedOrderList(that, CheckedPageIndex, pageSize, activityDate) {
let getArr = [];
let method = getList;
let params = [{
"BillState": 20,
@ -59,6 +59,7 @@ function getCheckedOrderList(that, CheckedPageIndex, pageSize, activityDate) {
"PageSize": pageSize,
}];
network.transfer_request(method, params, function(res) {
let getArr = [];
var array = res.result;
if (array.length <= 0) {
wx.showToast({


Loading…
Cancel
Save