|
|
|
@ -25,7 +25,7 @@ |
|
|
|
<view class="lf-row-between lf-p-30 lf-p-l-32 lf-p-r-32 lf-font-28"> |
|
|
|
<view class="lf-color-black">收货时间</view> |
|
|
|
<picker mode="date" :value="date" @change="pickerChange"> |
|
|
|
<view class="lf-color-555 lf-text-right" style="width: 400rpx;">{{ date }}</view> |
|
|
|
<view class="lf-color-555 lf-text-right" style="width: 400rpx;">{{ date || '请选择收货时间...' }}</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
<self-line></self-line> |
|
|
|
@ -64,7 +64,8 @@ |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
date: this.$shared.recordTime(new Date(), '-', 'date'), // 选择时间 |
|
|
|
// date: this.$shared.recordTime(new Date(), '-', 'date'), // 选择时间, 默认今天 |
|
|
|
date: '', |
|
|
|
material_list: {}, // 供应商,物资列表,不被渲染,在底层逻辑运作 |
|
|
|
show_material: false, // 是否显示采购清单按钮 |
|
|
|
render_material_list: {} // 渲染出来的物资列表 |
|
|
|
@ -142,7 +143,18 @@ |
|
|
|
let detailValue = event.detailValue; // 取出table input被输入的值 |
|
|
|
let supplier_item = this.render_material_list[supplier_id]; // 取出所在供应商 |
|
|
|
let material_item = supplier_item.material_list[material_index]; // 取出物资 |
|
|
|
material_item.purchase_number.value = detailValue; // 将输入的值赋值给物资 |
|
|
|
if(material_item.purchase_limit <= detailValue){ |
|
|
|
material_item.purchase_number.value = detailValue; // 将输入的值赋值给物资 |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title: '温馨提示', |
|
|
|
content: '采购数量必须大于起购数量', |
|
|
|
showCancel: false, |
|
|
|
success: result => { |
|
|
|
material_item.purchase_number.value = material_item.purchase_limit; |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log("render_material_list_change", this.render_material_list); |
|
|
|
}, |
|
|
|
// table 操作按钮被点击 |
|
|
|
@ -186,12 +198,16 @@ |
|
|
|
let material_list = this.render_material_list; |
|
|
|
let list = []; |
|
|
|
let is_empty = true; // 物资数据是否为空 |
|
|
|
let is_right = true; // 采购份数为正常的情况 |
|
|
|
for(let i in material_list){ |
|
|
|
if(Object.keys(material_list[i].material_list).length){ |
|
|
|
is_empty = false; |
|
|
|
let material = material_list[i].material_list; |
|
|
|
// 数组写法 |
|
|
|
let arr = material.map(item => { |
|
|
|
if(item.purchase_limit > item.purchase_number.value){ |
|
|
|
is_right = false; |
|
|
|
}; |
|
|
|
return { |
|
|
|
m_id: item.material_id, |
|
|
|
m_spec_id: item.spec_id, |
|
|
|
@ -219,14 +235,24 @@ |
|
|
|
} |
|
|
|
|
|
|
|
console.log("list", list) |
|
|
|
let deadline = this.date; |
|
|
|
if(!deadline){ |
|
|
|
this.$msg('请选择收货时间'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(is_empty){ |
|
|
|
this.$msg('您未选择物资'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(!is_right){ |
|
|
|
this.$msg('采购数量需大于起购数量'); |
|
|
|
return; |
|
|
|
} |
|
|
|
let state = ['待发单', '待审核'][_t]; |
|
|
|
this.$http(this.API.API_CANTEEN_PURCHASEAPPLY, { |
|
|
|
order: list, |
|
|
|
state: state |
|
|
|
state: state, |
|
|
|
deadline: deadline |
|
|
|
}).then(res => { |
|
|
|
console.log("save", res); |
|
|
|
this.$msg('操作成功'); |
|
|
|
|