Browse Source

1、选择存货通用界面参数传递,及数据回调

master
chenxuhui 7 years ago
parent
commit
ad57a6e26a
6 changed files with 152 additions and 161 deletions
  1. +48
    -61
      pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js
  2. +4
    -4
      pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml
  3. +2
    -2
      pages/homePage/homePage.js
  4. +41
    -17
      pages/saleForecastList/newBill/newBill.js
  5. +15
    -20
      pages/saleForecastList/newBill/newBill.wxml
  6. +42
    -57
      pages/saleForecastList/newBill/newBill.wxss

+ 48
- 61
pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js View File

@ -5,33 +5,53 @@ 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 getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice";
Page({
data: {
winHeight: app.globalData.winHeight,
currentTab: 0,
customerCollectionArray:[],
customerArray:[],
CollectionArray:[],
goodsArray:[],
checkBoxArray:[],
},
GetCustomer: function(inputValue) {
GetGoodsWithUnitPrice: function (unitID>pan class="p">, customerID) {
var that =this;
let method = getCustomer;
let timestamp = Date.parse(new Date());
let date = "/Date(" + timestamp + "+0800)/";
let method = getGoods;
let params = [{
"InputValue": inputValue,
"Input": "",
"PageIndex": 0,
"PageSize": 100
"PageSize": 100,
"Customer_ID": parseInt(customerID),
"AccountingUnit_ID": parseInt(unitID),
"Date": date
}];
network.transfer_request(method, params, function(res) {
network.transfer_request(method, params, function (res) {
that.setData({
customerArray: res.result
goodsArray: res.result,
})
})
},
// GetCustomer: function(inputValue) {
// var that =this;
// let method = getCustomer;
// let params = [{
// "InputValue": inputValue,
// "PageIndex": 0,
// "PageSize": 100
// }];
// network.transfer_request(method, params, function(res) {
// that.setData({
// customerArray: res.result
// })
// })
// },
// 多选框数值变化
checkboxValueChange: function (e) {
this.setData({
@ -41,9 +61,21 @@ Page({
// 点击添加存货明细按钮 存数据进入global
addGoodsName:function(){
app.globalData.goodsNameArray = this.data.checkBoxArray;
console.log("存货明细数组 == " + app.globalData.goodsNameArray);
let choseCheck = []
// 对比原有数组和选中的数组 存在,将数组包含的其他值也取出加载
for (var i = 0; i < this.data.goodsArray.length; i++) {
for (var j = 0; j < this.data.checkBoxArray.length; j++) {
if (Number(this.data.goodsArray[i].SaleGoods_ID) == this.data.checkBoxArray[j]) {
choseCheck.push(this.data.goodsArray[i])
}
}
}
app.globalData.goodsNameArray = choseCheck;
wx.navigateBack({
delta: 1,
})
},
/**
* 滑动切换tab
*/
@ -54,6 +86,7 @@ Page({
});
},
/**
* 点击tab切换
*/
@ -67,61 +100,15 @@ Page({
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let unitID = options.unitID;
let customerID = options.customerID;
this.GetGoodsWithUnitPrice(unitID, customerID);
this.GetCustomer();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

+ 4
- 4
pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml View File

@ -15,7 +15,7 @@
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views' bindscrolltoupper="unCheckedScrollUpper" bindscrolltolower="unCheckedScrollLower">
<view class='listBackGroundView'>
<checkbox-group bindchange="checkboxValueChange">
<block wx:for="{{customerArray}}" wx:key="item" wx:for-index="idx">
<block wx:for="{{goodsArray}}" wx:key="item" wx:for-index="idx">
<template is="customerChoiceTemplate" data="{{item}}" />
</block>
</checkbox-group>
@ -29,7 +29,7 @@
<swiper-item class="swiper-items2">
<scroll-view scroll-x="false" scroll-y="true" class='scroll-views' bindscrolltoupper="checkedScrollUpper" bindscrolltolower="CheckedScrollLower">
<checkbox-group bindchange="checkboxValueChange">
<block wx:for="{{customerArray}}" wx:key="item" wx:for-index="idx">
<block wx:for="{{CollectionArray}}" wx:key="item" wx:for-index="idx">
<template is="customerChoiceTemplate" data="{{item}}" />
</block>
</checkbox-group>
@ -40,8 +40,8 @@
<template name="customerChoiceTemplate">
<view class='listItem'>
<view class='itemClass'>{{item.Name}}</view>
<checkbox value="{{item.ID}}"/>
<view class='itemClass'>{{item.Goods_Name}}</view>
<checkbox value="{{item.SaleGoods_ID}}"/>
</view>
<view class='horizontallineView'></view>
</template>

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

@ -24,8 +24,8 @@ Page({
switch (btnID) {
// 销售预报
case "1":
// transferURL = '/pages/saleForecastList/saleForecastList';
transferURL = '/pages/goodaNameChooseTemplate/goodaNameChooseTemplate';
transferURL = '/pages/saleForecastList/saleForecastList';
// transferURL = '/pages/goodaNameChooseTemplate/goodaNameChooseTemplate';
break;
// 销售订单
case "2":


+ 41
- 17
pages/saleForecastList/newBill/newBill.js View File

@ -8,7 +8,6 @@ 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) {
@ -104,18 +103,12 @@ function GetGoodsWithUnitPrice(that, v, date) {
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面配置
*/
which: "",
winWidth: 0,
winHeight: app.globalData.winHeight,
// tab切换
currentTab: 0,
// 存货数组
obj: [],
goods: [],
idx: 0,
@ -167,13 +160,28 @@ Page({
dateTimeArray1: obj1.dateTimeArray,
dateTime1: obj1.dateTime
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
console.log(app.globalData.goodsNameArray);
var goodsArr = app.globalData.goodsNameArray;
if (goodsArr.length > 0) {
let backGoodsArr = [];
for (var i = 0; i < goodsArr.length; i++){
let goodsNameObj = {
Goods_Name: goodsArr[i].Goods_Name,
Goods_ID: goodsArr[i].SaleGoods_ID,
}
backGoodsArr.push(goodsNameObj)
}
this.setData({
obj: backGoodsArr,
})
}
},
@ -207,20 +215,36 @@ Page({
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: '请先选择客户及会计单位',
})
}
let newobj = {
Goods_Name: "请选择存货"
};
// let newobj = {
// Goods_Name: "请选择存货"
// };
this.data.obj.push(newobj)
// this.data.obj.push(newobj)
let aaa = this.data.obj;
// let aaa = this.data.obj;
this.setData({
obj: aaa,
})
// this.setData({
// obj: aaa,
// })
},
deleteItem: function(e) {
let idx = e.target.dataset.idx;
let deleteobj = this.data.obj;


+ 15
- 20
pages/saleForecastList/newBill/newBill.wxml View File

@ -4,12 +4,13 @@
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 31}}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="powerDrawer" data-statu="open" data-x='购货客户' data-item='{{which}}'>
{{customer[customerIndex].Name}}
</view>
@ -26,19 +27,15 @@
<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>
<!-- <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>
@ -46,26 +43,20 @@
<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>
<input class='baseitem_value' bindinput='getAddrs' placeholder='请输入送货地址' placeholder-style='color:rgb(202, 202, 202)'></input>
</view>
<button class='submit' catchtap='submitForm'>提交</button>
<!-- <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属性指定需要执行的动画-->
@ -91,11 +82,11 @@
<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}}'>
<view class='baseitem_value2'>
{{obj[idx].Goods_Name}}
</view>
</view>
@ -128,9 +119,12 @@
</view>
</block>
<view class='add' catchtap='add'>
<image class="ico" src="/imgs/tianjia.png"></image>
选择存货
<!-- <image class="ico" src="/imgs/tianjia.png"></image> -->
</view>
</view>
<!-- <template name='fodder'>
@ -158,4 +152,5 @@
<view class="btn_ok" bindtap="powerDrawer1" data-statu="close">取消</view>
</view>
</swiper-item>
</swiper>
</swiper>

+ 42
- 57
pages/saleForecastList/newBill/newBill.wxss View File

@ -1,3 +1,4 @@
/* pages/saleForecastList/saleForecastCreatNew/saleForecastCreatNew.wxss */
page {
background: rgb(240, 239, 245);
}
@ -5,53 +6,36 @@ page {
.swiper-tab {
width: 100%;
text-align: center;
line-height: 80rpx;
line-height: 45px;
background: white;
display: flex;
flex-direction: row;
justify-content: center;
justify-content: space-around;
border-bottom: 0.2rpx solid rgb(223, 218, 218);
}
.swiper-tab-list {
font-size: 30rpx;
width: 40%;
width: 25%;
color: #777;
margin-top: 5rpx;
height: 60rpx;
line-height: 60rpx;
}
.tab1 {
border-top: 2rpx solid #999;
border-bottom: 2rpx solid #999;
border-left: 2rpx solid #999;
border-radius: 20rpx 0rpx 0rpx 20rpx;
background: white;
}
.tab2 {
border-top: 2rpx solid #999;
border-bottom: 2rpx solid #999;
border-right: 2rpx solid #999;
border-radius: 0rpx 20rpx 20rpx 0rpx;
background: white;
}
.on {
background: #2788f8;
color: white;
color: #2788f8;
border-bottom: 2rpx solid #2788f8;
}
.swiper-box {
display: block;
height: 100%;
width: 100%;
overflow: hidden;
margin-top: 3px;
}
.swiper-items1 {
height: 100%;
padding-top: 3%;
/* padding-top: 3%; */
}
.swiper-items2 {
@ -71,51 +55,52 @@ page {
align-items: center;
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.twogroup {
display: flex;
flex-direction: row;
font-size: 30rpx;
}
.baseitem_key {
color: black;
width: 20%;
margin-left: 5%;
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value {
margin-left: 5%;
width: 70%;
color: rgb(48, 48, 48);
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key2 {
color: black;
width: 20%;
font-size: 30rpx;
margin-left: 10rpx;
color: #666;
width: 40%;
margin-left: 20rpx;
}
.baseitem_value2 {
color: rgb(48, 48, 48);
font-size: 30rpx;
margin-left: 20rpx;
margin-right: 20rpx;
width: 160%;
text-align: right;
}
.baseitem_key1 {
color: black;
width: 40%;
font-size: 30rpx;
margin-left: 10rpx;
color: #666;
width: 100%;
margin-left: 20rpx;
}
.baseitem_value1 {
color: rgb(48, 48, 48);
font-size: 30rpx;
margin-left: 20rpx;
width: 60%;
margin-right: 20rpx;
width: 100%;
text-align: right;
}
::-webkit-scrollbar {
width: 0;
height: 0;
@ -160,12 +145,8 @@ page {
}
.submit {
margin-left: 5%;
margin-top: 10%;
width: 90%;
margin-right: 5%;
color: #fff;
background: linear-gradient(to right, #39c4fd, #539eef);
margin-top: 50rpx;
margin-bottom: 30rpx;
}
.drawer_screen {
@ -181,14 +162,15 @@ page {
}
.sousuo {
margin-right: 10%;
margin-left: 10%;
/* margin-right: 10%;
margin-left: 10%; */
text-align: center;
background: #d6d8da;
height: 40px;
font-size: 28rpx;
}
.drawer_content {
height: 500rpx;
overflow-y: scroll; /*超出父盒子高度可滚动*/
@ -211,7 +193,7 @@ page {
font: 20px "microsoft yahei";
text-align: center;
border-top: 1px solid #e8e8ea;
color: #2e8cf5;
color: #2E8CF5;
}
.top {
@ -223,8 +205,11 @@ page {
.grid1 {
width: 100%;
border-bottom: 1px solid #c3c3c3;
padding-top: 5px;
padding-bottom: 10px;
/* padding-top: 5px;
padding-bottom: 10px; */
padding-top: 16rpx;
padding-bottom: 16rpx;
text-align: center;
}
.text3 {


Loading…
Cancel
Save