diff --git a/pages/customerChooseTemplate/customerChooseTemplate.js b/pages/customerChooseTemplate/customerChooseTemplate.js
index acb55e7..eaa6ee3 100644
--- a/pages/customerChooseTemplate/customerChooseTemplate.js
+++ b/pages/customerChooseTemplate/customerChooseTemplate.js
@@ -18,7 +18,12 @@ Page({
checkBoxArray: [],
},
- GetCustomer: function(inputValue) {
+ getCustomerBySearchString:function(event){
+ var searchStr =event.detail.value;
+ this.GetCustomer(searchStr);
+ },
+
+ GetCustomer: function (inputValue) {
var that =this;
let method = getCustomer;
let params = [{
diff --git a/pages/customerChooseTemplate/customerChooseTemplate.wxml b/pages/customerChooseTemplate/customerChooseTemplate.wxml
index 8251764..ab720bf 100644
--- a/pages/customerChooseTemplate/customerChooseTemplate.wxml
+++ b/pages/customerChooseTemplate/customerChooseTemplate.wxml
@@ -1,16 +1,8 @@
-
-
- 全部
- 收藏夹
-
-
-
-
+
-
- 收藏
+
@@ -25,16 +17,6 @@
添加存货明细
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/customerChooseTemplate/customerChooseTemplate.wxss b/pages/customerChooseTemplate/customerChooseTemplate.wxss
index 8185917..5afea93 100644
--- a/pages/customerChooseTemplate/customerChooseTemplate.wxss
+++ b/pages/customerChooseTemplate/customerChooseTemplate.wxss
@@ -57,7 +57,7 @@ page{
.imput_goodsName{
border: 1rpx solid rgb(236, 231, 231);
height: 100%;
- width: 85%;
+ width: 100%;
border-radius: 10rpx;
background-color: #fff;
text-align: center;
diff --git a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js
index 7d79607..9263328 100644
--- a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js
+++ b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.js
@@ -4,7 +4,9 @@ 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 unitID = null;
+var customerID = null;
+
var getGoods = "/MainSystem/B3MiniProgramRpc/Rpcs/BaseInfoRpc/GetGoodsWithUnitPrice";
Page({
@@ -12,55 +14,145 @@ Page({
data: {
winHeight: app.globalData.winHeight,
currentTab: 0,
- collectionArray:[],
- goodsArray:[],
- checkBoxArray:[],
+ collectionArray: [],
+ goodsArray: [],
+ checkBoxArray: [],
+ storageCheckBoxArray: [],
+ },
+
+ getGoodsNameBySearchString: function (event){
+ var searchString = event.detail.value;
+ this.GetGoodsWithUnitPrice(unitID, customerID, searchString);
+
},
- GetGoodsWithUnitPrice: function (unitID, customerID) {
- var that =this;
+ GetGoodsWithUnitPrice: function(unitID, customerID, searchString) {
+ var that = this;
let timestamp = Date.parse(new Date());
let date = "/Date(" + timestamp + "+0800)/";
let method = getGoods;
let params = [{
- "Input": "",
+ "Input": searchString,
"PageIndex": 0,
"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({
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
- // })
- // })
- // },
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function(options) {
+ // 根据客户id和会计单位获取存货及价格
+ var that = this;
+ unitID = options.unitID;
+ customerID = options.customerID;
+ this.GetGoodsWithUnitPrice(unitID, customerID, "");
+ // 获取收藏的存货信息
+ wx.getStorage({
+ key: 'storageGoodsKey',
+ success(res) {
+ console.log(res.data);
+ if (res.data.length > 0) {
+ that.setData({
+ collectionArray: res.data,
+ })
+ }
+ }
+ })
+ },
+
+ storegeBtnClick: function() {
+ var that = this;
+
+ // 获取收藏的存货信息
+ var oldCollectionArr = this.data.collectionArray;
+ var waitStorageArr = this.data.checkBoxArray;
+ var goodsNameArrayAll = this.data.goodsArray;
+
+ if (waitStorageArr.length <= 0) {
+ wx.showToast({
+ title: '请选择存货',
+ })
+ return;
+ } else {
+
+ // 对比所选存货是否已经存在于收藏中 有:不重复添加 返回未添加过的数组
+ for (var i = 0; i < waitStorageArr.length; i++) {
+ for (var j = 0; j < oldCollectionArr.length; j++) {
+ if (Number(waitStorageArr[i]) == Number(oldCollectionArr[j].SaleGoods_ID)) {
+ waitStorageArr.splice(i, 1);
+ }
+ }
+ }
+
+ // 对比原有数组和选中的数组 存在,将数组包含的其他值也取出加载
+ let choseCheck = [];
+ for (var i = 0; i < that.data.goodsArray.length; i++) {
+ for (var j = 0; j < waitStorageArr.length; j++) {
+ if (Number(goodsNameArrayAll[i].SaleGoods_ID) == waitStorageArr[j]) {
+ choseCheck.push(goodsNameArrayAll[i])
+ }
+ }
+ }
+ oldCollectionArr = oldCollectionArr.concat(choseCheck);
+ that.setData({
+ collectionArray: oldCollectionArr,
+ currentTab: 1,
+ });
+ wx.setStorage({
+ key: "storageGoodsKey",
+ data: oldCollectionArr,
+ success: function() {
+ wx.showToast({
+ title: '收藏成功',
+ });
+ },
+ })
+ }
+ },
+
// 多选框数值变化
- checkboxValueChange: function (e) {
+ checkboxValueChange: function(e) {
this.setData({
checkBoxArray: e.detail.value,
})
},
- // 点击添加存货明细按钮 存数据进入global
- addGoodsName:function(){
+ // 收藏夹页面多选框值变化
+ storageCheckboxValueChange:function (e){
+ this.setData({
+ storageCheckBoxArray: e.detail.value,
+ })
+ },
+
+ // 收藏夹点击添加存货明细按钮 存数据进入global
+ storageAddGoodsNameArrayBack: function () {
+ let choseCheck = []
+ // 对比原有数组和选中的数组 存在,将数组包含的其他值也取出加载
+ for (var i = 0; i < this.data.collectionArray.length; i++) {
+ for (var j = 0; j < this.data.storageCheckBoxArray.length; j++) {
+ if (Number(this.data.collectionArray[i].SaleGoods_ID) == this.data.storageCheckBoxArray[j]) {
+ choseCheck.push(this.data.collectionArray[i])
+ }
+ }
+ }
+ app.globalData.goodsNameArray = choseCheck;
+ wx.navigateBack({
+ delta: 1,
+ })
+ },
+
+ // 全部页面点击添加存货明细按钮 存数据进入global
+ addGoodsName: function() {
let choseCheck = []
// 对比原有数组和选中的数组 存在,将数组包含的其他值也取出加载
for (var i = 0; i < this.data.goodsArray.length; i++) {
@@ -101,14 +193,4 @@ Page({
}
},
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- let unitID = options.unitID;
- let customerID = options.customerID;
- this.GetGoodsWithUnitPrice(unitID, customerID);
-
- },
-
})
\ No newline at end of file
diff --git a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml
index 3c1eabd..ac3a0d2 100644
--- a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml
+++ b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxml
@@ -9,8 +9,8 @@
-
- 收藏
+
+ 收藏
@@ -20,28 +20,29 @@
-
添加存货明细
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ 添加存货明细
-
{{item.Goods_Name}}
-
+
\ No newline at end of file
diff --git a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxss b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxss
index cdd78e9..8b64093 100644
--- a/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxss
+++ b/pages/goodaNameChooseTemplate/goodaNameChooseTemplate.wxss
@@ -80,6 +80,14 @@ page{
flex-direction: column;
}
+.storage-scroll-views {
+ margin-top: 25rpx;
+ height: calc(100% - 45px);
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
.listBackGroundView{
background-color: #fff;
}