Browse Source

1、首页添加关联会计单位和销售部门的关联

2、基本信息页面添加了会计单位的选择
3、存货信息界面添加了时间的选择
master
chenxuhui 7 years ago
parent
commit
34001f97f8
4 changed files with 393 additions and 53 deletions
  1. +23
    -8
      pages/homePage/homePage.js
  2. +239
    -14
      pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js
  3. +61
    -31
      pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml
  4. +70
    -0
      pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxss

+ 23
- 8
pages/homePage/homePage.js View File

@ -1,18 +1,33 @@
// pages/homePage/homePage.js
Page({
/**
* 页面的初始数据
*/
var network = require("../../utils/net.js")
function GetUserProfile(successtion) {
let method = '/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetUserProfile';
let params = [];
network.transfer_request(method, params, function (res) {
successtion();
if (res.result.AccountingUnit_ID != null) {
app.globalData.accountingUnit_ID = res.result.AccountingUnit_ID;
app.globalData.accountingUnit_Name = res.result.AccountingUnit_Name
}
if (res.result.Department_ID != null) {
app.globalData.department_ID = res.result.Department_ID;
app.globalData.department_Name = res.result.Department_Name
}
})
}
Page({
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
GetUserProfile(function (res) {
});
},
/**


+ 239
- 14
pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.js View File

@ -5,6 +5,24 @@ const app = getApp();
var dateTimePicker = require('../../../utils/dateTimePicker.js');
var timechage = require("../../../utils/dateTimeUtil.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: "会计部门"
})
}
Page({
data: {
@ -18,24 +36,51 @@ Page({
dateTime: null,
startYear: 2018,
endYear: 2030,
// 用户数组
customerArr:[],
// 存货数组
goodsNameArr:[],
which: "",
idx: 0,
currency: [],
saletypeIndex: 0,
saletype: [{
ID: 0,
Name: "请选择销售类型"
}],
customerIndex: 0,
customer: [{
ID: 0,
Name: "请选择客户"
}],
isUnit: 0,
unit: [],//会计单位
departmentIndex: 0,
department: [],//销售部门
addrs: "",
},
// 存货特价开始时间
bindStartTimeChange: function (e) {
var itemIndex = e.currentTarget.dataset.index;
var array = this.data.goodsNameArr;
array[itemIndex]["applicationStartTime"]= e.detail.value,
this.setData({
starTime: e.detail.value,
goodsNameArr: array,
})
},
// 存货特价结束时间
bindEndTimeChange: function (e) {
this.setData({
endTime: e.detail.value,
})
var itemIndex = e.currentTarget.dataset.index;
var array = this.data.goodsNameArr;
array[itemIndex]["applicationEndTime"] = e.detail.value,
this.setData({
goodsNameArr: array,
})
},
// 基本信息日期
@ -83,10 +128,79 @@ Page({
}
},
// 遮罩的搜索框事件
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)
}
},
// 判断条件进行遮罩内容选取
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)
},
// 遮罩层点击选中具体条目
itemclick: function (e) {
var that = this;
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
})
GetSpecifiedCustomer(that, idx)
} else if (which == "部门") {
that.setData({
departmentIndex: idx
})
} else if (which == "销售类型") {
that.setData({
saletypeIndex: idx
})
}
this.setData({
showModalStatus: false,
})
},
/**
* 存货明细保存按钮 点击新建单据 内部做逻辑判断 存储值是否都已经加载
*/
creatNewSpecialOrder:function (){
var that =this;
// 会计单位
let unitID = this.data.unit[this.data.isUnit].ID;
let year = this.data.dateTimeArray[0][this.data.dateTime[0]]
let month = this.data.dateTimeArray[1][this.data.dateTime[1]]
let date = this.data.dateTimeArray[2][this.data.dateTime[2]]
@ -107,17 +221,25 @@ Page({
},
// 删除客户明细
deleteCustomerItem: function () {
deleteCustomerItem: function (event) {
var id = event.target.dataset.idx;
var array = this.data.customerArr;
array.splice(id, 1);
this.setData({
customerArr: array,
})
},
// 删除存货明细
deleteGoodsItem:function(){
deleteGoodsItem:function(event){
var id = event.target.dataset.id;
var array = this.data.goodsNameArr;
array.splice(id, 1);
this.setData({
goodsNameArr:array,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 获取完整的年月日 时分秒,以及默认显示的数组
var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
@ -128,12 +250,17 @@ Page({
this.setData({
dateTimeArray: obj1.dateTimeArray,
dateTime: obj1.dateTime,
unit: [{
ID: app.globalData.accountingUnit_ID,
Name: app.globalData.accountingUnit_Name
}],
department: [{
ID: app.globalData.department_ID,
Name: app.globalData.department_Name
}],
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
var that = this;
@ -198,4 +325,102 @@ Page({
app.globalData.customerArray = [];
},
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
});
}
}
})

+ 61
- 31
pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxml View File

@ -9,52 +9,83 @@
<!-- 基本信息 -->
<swiper-item class="swiper-items1">
<view class='backGroundContainer'>
<view class='baseitem'>
<text class='baseitem_key'>名称</text>
<view class='baseitem_value'>
{{customerName}}基本信息
<text class='baseitem_key'>购货客户</text>
<view class='baseitem_value' bindtap="powerDrawer" data-statu="open" data-x='购货客户' data-item='{{which}}'>
{{customer[customerIndex].Name}}
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>日期</text>
<text class='baseitem_key'>发货时间</text>
<picker class='baseitem_value' mode="multiSelector" value="{{dateTime}}" bindchange="changeDateTime" range="{{dateTimeArray}}">
<view>
<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]]}}
</view>
</picker>
<!-- <view class='baseitem_value'>
{{customerName}}
</view> -->
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>会计单位</text>
<view class='baseitem_value'>
{{customerName}}
<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>
<view class='baseitem_value'>
{{customerName}}
<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>
<view class='baseitem_value'>
{{customerName}}
<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='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>
<!-- 遮罩 -->
<view class="drawer_screen" bindtap="powerDrawer" data-item='{{which}}' data-statu="close" wx:if="{{showModalStatus}}"></view>
<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}}'>
<text class='text3'>{{item.Name}}</text>
</view>
</block>
</view>
<view class="btn_ok" bindtap="powerDrawer" data-statu="close">取消</view>
</view>
</swiper-item>
<!-- 客户明细 -->
@ -62,7 +93,7 @@
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='detaileListContainer'>
<block wx:for="{{customerArr}}" wx:key="item" wx:for-index="idx">
<template is="customerInfoTemplate" data="{{item}}" data="{{idx}}" />
<template is="customerInfoTemplate" data="{{item,idx}}" />
</block>
</view>
<view class='imageView' catchtap='addCustomer'>
@ -80,8 +111,8 @@
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
<view class='detaileListContainer'>
<block wx:for="{{goodsNameArr}}" wx:for-item="item" wx:for-index="idx">
<template is="goodsInfoTemplate" data="{{item,idx}}"/>
<block wx:for="{{goodsNameArr}}" wx:for-item="item" wx:key="item" wx:for-index="idx">
<template is="goodsInfoTemplate" data="{{item,idx}}" />
</block>
</view>
@ -156,28 +187,28 @@
<view class='baseitem'>
<text class='baseitem_key'>特价</text>
<view class='baseitem_value'>
<input class='inputItem' style='text' value='{{item.applicationPrice}}' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='goodsname'>
</input>
<input class='inputItem' style='text' value='{{item.applicationPrice}}' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='goodsname'>
</input>
</view>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>开始时间</text>
<picker class='timePicker' mode="date" value="{{starTime}}" start="2018-01-01" end="2037-12-31" bindchange="bindStartTimeChange">
<view class='baseitem_value'>
{{item.applicationStartTime}}
</view>
<picker class='baseitem_value' mode="date" value="{{starTime}}" start="2018-01-01" end="2037-12-31" bindchange="bindStartTimeChange" data-index='{{idx}}'>
<view>
{{item.applicationStartTime}}
</view>
</picker>
</view>
<view class='horizontallineView'></view>
<view class='baseitem'>
<text class='baseitem_key'>结束时间</text>
<picker class='timePicker' mode="date" value="{{endTime}}" start="2018-01-01" end="2037-12-31" bindchange="bindEndTimeChange">
<view class='baseitem_value'>
{{item.applicationEndTime}}
</view>
<picker class='baseitem_value' mode="date" value="{{endTime}}" start="2018-01-01" end="2037-12-31" bindchange="bindEndTimeChange" data-index='{{idx}}'>
<view>
{{item.applicationEndTime}}
</view>
</picker>
</view>
<view class='horizontallineView'></view>
@ -186,13 +217,12 @@
<text class='baseitem_key'>申请数量</text>
<view class='baseitem_value'>
<input class='inputItem' style='text' value='{{item.applicationNum}}' bindinput='getInputValue' data-index='{{idx}}' data-datastyle='goodsname'>
</input>
</input>
</view>
</view>
<view class='horizontallineView'></view>
<view class='delete' catchtap='deleteGoodsItem' data-idx='{{idx}}'>删除</view>
<view class='delete' catchtap='deleteGoodsItem' data-id='{{idx}}'>删除</view>
<view class='horizontallineView'></view>
</template>

+ 70
- 0
pages/specialOrderApplication/creatNewSpecialOrder/creatNewSpecialOrder.wxss View File

@ -209,3 +209,73 @@ page {
color: white;
font-size: 20px;
}
/* ---------------------------- */
/* 遮罩筛选 */
.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);
}

Loading…
Cancel
Save