Browse Source

存货价格关联

master
chenxuhui 7 years ago
parent
commit
7406a26385
1 changed files with 48 additions and 11 deletions
  1. +48
    -11
      pages/saleForecastList/newBill/newBill.js

+ 48
- 11
pages/saleForecastList/newBill/newBill.js View File

@ -170,25 +170,57 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
console.log(app.globalData.customerArray);
var that = this;
// 返回的用户只能是一条,所以index只能为0
var customerArr = app.globalData.customerArray;
if (customerArr.length > 0){
if (customerArr.length > 0) {
this.setData({
customer: customerArr,
customerIndex:0,
customerIndex: 0,
})
}
// 获取存货 加载完成后计算价格政策
var goodsArr = app.globalData.goodsNameArray;
if (goodsArr.length > 0) {
let backGoodsArr = [];
for (var i = 0; i < goodsArr.length; i++){
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_Name: goodsArr[i].Goods_Name,
Goods_ID: goodsArr[i].SaleGoods_ID,
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)
}
this.setData({
obj: backGoodsArr,
})
@ -223,15 +255,17 @@ Page({
}
},
// 添加地址
getAddrs: function(e) {
this.data.addrs = e.detail.value;
},
// 添加存货 跳转存货选择页面
add: function(e) {
var that =this;
var that = this;
let unitID = that.data.unit[that.data.isUnit].ID;
let customerID = that.data.customer[that.data.customerIndex].ID;
if (unitID && customerID){
if (unitID && customerID) {
wx.navigateTo({
url: '../../goodaNameChooseTemplate/goodaNameChooseTemplate?unitID=' + unitID + '&customerID' + customerID,
})
@ -243,7 +277,8 @@ Page({
}
},
getCustomerItem: function(){
// 添加购货客户 跳转客户选择页面
getCustomerItem: function() {
wx.navigateTo({
url: '../../customerChooseTemplate/customerChooseTemplate',
})
@ -384,11 +419,12 @@ Page({
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 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
@ -412,6 +448,7 @@ Page({
obj: that.data.obj
})
},
select: function(e) {
var that = this;
var which = e.currentTarget.dataset.item;


Loading…
Cancel
Save