|
|
@ -1,18 +1,18 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view> |
|
|
<view> |
|
|
<view class="head"> |
|
|
<view class="head"> |
|
|
<view class="list"> |
|
|
|
|
|
|
|
|
<view class="list" @click="addSupplier"> |
|
|
<view class="lf-row-between"> |
|
|
<view class="lf-row-between"> |
|
|
<view>供应商</view> |
|
|
<view>供应商</view> |
|
|
<view class="lf-icon" @click="$url('/pages/classification/supplier')"> |
|
|
|
|
|
|
|
|
<view class="lf-icon"> |
|
|
<u-icon name="plus-circle" size="42"></u-icon> |
|
|
<u-icon name="plus-circle" size="42"></u-icon> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="list" v-if="show_material"> |
|
|
|
|
|
|
|
|
<view class="list" v-if="show_material" @click="$url('/pages/classification/material?type=1')"> |
|
|
<view class="lf-row-between"> |
|
|
<view class="lf-row-between"> |
|
|
<view>采购清单</view> |
|
|
<view>采购清单</view> |
|
|
<view class="lf-icon" @click="$url('/pages/classification/material?type=1')"> |
|
|
|
|
|
|
|
|
<view class="lf-icon"> |
|
|
<u-icon name="plus-circle" size="42"></u-icon> |
|
|
<u-icon name="plus-circle" size="42"></u-icon> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -71,87 +71,21 @@ |
|
|
render_material_list: {}, // 渲染出来的物资列表 |
|
|
render_material_list: {}, // 渲染出来的物资列表 |
|
|
show_count: 0, // 页面显示次数 |
|
|
show_count: 0, // 页面显示次数 |
|
|
p_sn: '', // 订单号,如果有 |
|
|
p_sn: '', // 订单号,如果有 |
|
|
type: 0 // 类型 |
|
|
|
|
|
|
|
|
type: 0 // 类型, 1编辑, 2复用 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(options){ |
|
|
onLoad(options){ |
|
|
// TODO 采购单编辑时保存 |
|
|
|
|
|
// todo 采购单复用ok,还差 编辑 采购单保存 |
|
|
|
|
|
|
|
|
|
|
|
// 监听MaterialList被操作 |
|
|
// 监听MaterialList被操作 |
|
|
uni.$on('addMaterialList', res => { |
|
|
uni.$on('addMaterialList', res => { |
|
|
this.material_list = res; |
|
|
this.material_list = res; |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// /pages/purchase/launch?p_sn=P162771908650053&enter_type=2 |
|
|
|
|
|
if(options){ |
|
|
if(options){ |
|
|
this.p_sn = options.p_sn || ''; |
|
|
this.p_sn = options.p_sn || ''; |
|
|
this.type = options.enter_type || 0; |
|
|
this.type = options.enter_type || 0; |
|
|
if(options.enter_type == 2){ |
|
|
|
|
|
|
|
|
if(options.enter_type == 1 || options.enter_type == 2){ |
|
|
this.copyMaterialList(); // 复用采购单 |
|
|
this.copyMaterialList(); // 复用采购单 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var test = { |
|
|
|
|
|
"2": { |
|
|
|
|
|
address: "", |
|
|
|
|
|
admin_uid: 2, |
|
|
|
|
|
area_id: 0, |
|
|
|
|
|
checked: true, |
|
|
|
|
|
city_id: 0, |
|
|
|
|
|
corporate_account: "", |
|
|
|
|
|
corporate_account_name: "", |
|
|
|
|
|
corporate_bank: "", |
|
|
|
|
|
corporate_bank_sub: "", |
|
|
|
|
|
corporate_name: "", |
|
|
|
|
|
corporate_phone: "", |
|
|
|
|
|
created_at: "2021-07-31 10:23:47", |
|
|
|
|
|
created_uid: 1, |
|
|
|
|
|
ctl_man: "张大拿", |
|
|
|
|
|
ctl_phone: "13177889965", |
|
|
|
|
|
deleted_at: null, |
|
|
|
|
|
deleted_uid: 0, |
|
|
|
|
|
id: 2, |
|
|
|
|
|
license_number: "", |
|
|
|
|
|
license_pic: "https://gxskyimg.lanzulive.com/", |
|
|
|
|
|
logo: "admin_images/89897b012083b738b5792079368e73b9.jpeg", |
|
|
|
|
|
material_list: { |
|
|
|
|
|
"1": { |
|
|
|
|
|
brand: "", |
|
|
|
|
|
checked: true, |
|
|
|
|
|
item_id: 1, |
|
|
|
|
|
m_sn: "M162769768826400", |
|
|
|
|
|
material_id: 1, |
|
|
|
|
|
material_name: "上林丝苗米", |
|
|
|
|
|
non_tax_price: "1.00", |
|
|
|
|
|
purchase_limit: 1, |
|
|
|
|
|
quality_level: "", |
|
|
|
|
|
spec_id: 1, |
|
|
|
|
|
spec_name: "-", |
|
|
|
|
|
supplier_id: 2, |
|
|
|
|
|
supplier_name: "食品类供应商001", |
|
|
|
|
|
tax_price: "2.00" |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
private_account: "", |
|
|
|
|
|
private_account_name: "", |
|
|
|
|
|
private_bank: "", |
|
|
|
|
|
private_bank_sub: "", |
|
|
|
|
|
province_id: 0, |
|
|
|
|
|
qualification_pic: "https://gxskyimg.lanzulive.com/", |
|
|
|
|
|
remark: "", |
|
|
|
|
|
s_cate_id: 1, |
|
|
|
|
|
state: "启用", |
|
|
|
|
|
subject_name: "", |
|
|
|
|
|
subject_type: "公司", |
|
|
|
|
|
supplier_name: "食品类供应商001", |
|
|
|
|
|
updated_at: "2021-07-31 10:24:03", |
|
|
|
|
|
updated_uid: 1 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log("options", options); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
onShow(){ |
|
|
onShow(){ |
|
|
this.show_count++; |
|
|
this.show_count++; |
|
|
@ -203,7 +137,7 @@ |
|
|
// table 内容处理 |
|
|
// table 内容处理 |
|
|
let list_arr = []; |
|
|
let list_arr = []; |
|
|
for(let j in material_list[i].material_list){ |
|
|
for(let j in material_list[i].material_list){ |
|
|
material_list[i].material_list[j].purchase_number = {edit: true, value: ''}; |
|
|
|
|
|
|
|
|
material_list[i].material_list[j].purchase_number = {edit: true, value: material_list[i].material_list[j].purchase_number || ''}; |
|
|
material_list[i].material_list[j].operation = {button: true, key: 'delete', value: '删除'}; |
|
|
material_list[i].material_list[j].operation = {button: true, key: 'delete', value: '删除'}; |
|
|
material_list[i].material_list[j].supplier_name = material_list[i].supplier_name; |
|
|
material_list[i].material_list[j].supplier_name = material_list[i].supplier_name; |
|
|
material_list[i].material_list[j].tax_price = material_list[i].material_list[j].tax_price; |
|
|
material_list[i].material_list[j].tax_price = material_list[i].material_list[j].tax_price; |
|
|
@ -225,32 +159,33 @@ |
|
|
let list = res.data || []; |
|
|
let list = res.data || []; |
|
|
let material_list = {}; |
|
|
let material_list = {}; |
|
|
list.map(item => { |
|
|
list.map(item => { |
|
|
let items = item.purchase[0].items; |
|
|
|
|
|
|
|
|
let items = item.purchase[0]?.items || []; |
|
|
let items_obj = {}; |
|
|
let items_obj = {}; |
|
|
items.map(i_item => { |
|
|
items.map(i_item => { |
|
|
items_obj[i_item.quotation_item_id] = { |
|
|
items_obj[i_item.quotation_item_id] = { |
|
|
brand: i_item.material.brand, |
|
|
|
|
|
|
|
|
brand: i_item?.material?.brand || '', |
|
|
checked: true, |
|
|
checked: true, |
|
|
item_id: i_item.quotation_item_id, |
|
|
item_id: i_item.quotation_item_id, |
|
|
m_sn: i_item.material.m_sn, |
|
|
|
|
|
material_id: i_item.material.id, |
|
|
|
|
|
material_name: i_item.material.m_name, |
|
|
|
|
|
|
|
|
m_sn: i_item?.material?.m_sn || '', |
|
|
|
|
|
material_id: i_item?.material?.id || 0, |
|
|
|
|
|
material_name: i_item?.material?.m_name || '', |
|
|
non_tax_price: i_item.non_tax_price, |
|
|
non_tax_price: i_item.non_tax_price, |
|
|
purchase_limit: i_item.p_order_item.purchase_limit, |
|
|
|
|
|
quality_level: i_item.material.quality_level, |
|
|
|
|
|
spec_id: i_item.spec.id, |
|
|
|
|
|
spec_name: i_item.spec.name, |
|
|
|
|
|
|
|
|
purchase_limit: i_item?.p_order_item?.purchase_limit || '', |
|
|
|
|
|
quality_level: i_item?.material?.quality_level || '', |
|
|
|
|
|
spec_id: i_item?.spec?.id || 0, |
|
|
|
|
|
spec_name: i_item?.spec?.name || '', |
|
|
supplier_id: item.id, |
|
|
supplier_id: item.id, |
|
|
supplier_name: item.supplier_name, |
|
|
supplier_name: item.supplier_name, |
|
|
tax_price: i_item.tax_price |
|
|
|
|
|
|
|
|
tax_price: i_item.tax_price, |
|
|
|
|
|
purchase_number: i_item.purchase_number |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
item.material_list = items_obj; |
|
|
item.material_list = items_obj; |
|
|
material_list[item.id] = item; |
|
|
material_list[item.id] = item; |
|
|
|
|
|
this.date = item.purchase[0]?.deadline_text || ''; |
|
|
}) |
|
|
}) |
|
|
this.material_list = material_list; |
|
|
this.material_list = material_list; |
|
|
this.transformList(); |
|
|
this.transformList(); |
|
|
console.log("yes", material_list); |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// table-input值被改变 |
|
|
// table-input值被改变 |
|
|
@ -338,17 +273,6 @@ |
|
|
purchase_number: Number(item.purchase_number.value) || item.purchase_limit |
|
|
purchase_number: Number(item.purchase_number.value) || item.purchase_limit |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
// 对象写法: |
|
|
|
|
|
// let arr = []; |
|
|
|
|
|
// for(let j in material){ |
|
|
|
|
|
// arr.push({ |
|
|
|
|
|
// m_id: material[j].material_id, |
|
|
|
|
|
// m_spec_id: material[j].spec_id, |
|
|
|
|
|
// tax_price: material[j].tax_price, |
|
|
|
|
|
// non_tax_price: material[j].non_tax_price, |
|
|
|
|
|
// purchase_number: material[j].purchase_number.value || 0 |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
list.push({ |
|
|
list.push({ |
|
|
supplier_id: material_list[i].id, |
|
|
supplier_id: material_list[i].id, |
|
|
material: arr |
|
|
material: arr |
|
|
@ -356,7 +280,6 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log("list", list) |
|
|
|
|
|
let deadline = this.date; |
|
|
let deadline = this.date; |
|
|
if(!deadline){ |
|
|
if(!deadline){ |
|
|
this.$msg('请选择收货时间'); |
|
|
this.$msg('请选择收货时间'); |
|
|
@ -370,15 +293,26 @@ |
|
|
this.$msg('采购数量需大于起购数量'); |
|
|
this.$msg('采购数量需大于起购数量'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// let state = ['待发单', '待审核'][_t]; |
|
|
|
|
|
this.$http(this.API.API_CANTEEN_PURCHASEAPPLY, { |
|
|
|
|
|
|
|
|
let _api = this.API.API_CANTEEN_PURCHASEAPPLY; |
|
|
|
|
|
let _data = { |
|
|
order: list, |
|
|
order: list, |
|
|
state: _t, |
|
|
state: _t, |
|
|
deadline: deadline |
|
|
deadline: deadline |
|
|
}).then(res => { |
|
|
|
|
|
console.log("save", res); |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
if(this.type == 1){ |
|
|
|
|
|
_api = this.API.API_CANTEEN_PURCHASESAVE; |
|
|
|
|
|
_data.p_sn = this.p_sn; |
|
|
|
|
|
} |
|
|
|
|
|
this.$http(_api, _data).then(res => { |
|
|
this.$msg('操作成功').then(()=>{this.$toBack()}); |
|
|
this.$msg('操作成功').then(()=>{this.$toBack()}); |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 页面跳转添加供应商 |
|
|
|
|
|
addSupplier(){ |
|
|
|
|
|
if(this.type == 1){ |
|
|
|
|
|
return this.$msg('编辑时不可更换供应商'); |
|
|
|
|
|
} |
|
|
|
|
|
this.$url('/pages/classification/supplier'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|