diff --git a/canteen/pages/classification/material.vue b/canteen/pages/classification/material.vue
index 7b88b7e..016757b 100644
--- a/canteen/pages/classification/material.vue
+++ b/canteen/pages/classification/material.vue
@@ -13,7 +13,7 @@
:style="{height: 'calc('+ windowHeight +'px - 222rpx)', width:is_search_ing?'100%':'550rpx'}">
diff --git a/canteen/pages/purchase/detail.vue b/canteen/pages/purchase/detail.vue
index af9c912..b2c44f7 100644
--- a/canteen/pages/purchase/detail.vue
+++ b/canteen/pages/purchase/detail.vue
@@ -1,96 +1,100 @@
-
-
- 采购单 {{ order.p_sn }}
-
-
-
-
- {{ order.supplier.supplier_name }}
- {{ order.supplier.address }}
+
+
+
+ 采购单 {{ order.p_sn }}
+
+
+
+
+ {{ order.supplier.supplier_name }}
+ {{ order.supplier.address }}
+
-
-
-
-
-
-
-
-
-
- 车辆
- {{order.car_license}}
-
-
- 司机
- {{order.deliver_man}}
-
-
- 联系电话
- {{order.deliver_phone}}
+
+
+
-
- 证明材料-供应端
-
-
+
+
+
+ 车辆
+ {{order.car_license || '-'}}
-
-
- 证明材料-食堂端
-
-
+
+ 司机
+ {{order.deliver_man || '-'}}
+
+
+ 联系电话
+ {{order.deliver_phone || '-'}}
+
+
+ 证明材料-供应端
+
+
+
+
+
+ 证明材料-食堂端
+
+
+
-
-
-
- 物资明细
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ 物资明细
+
-
-
- 已完成
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 已完成
+
+
+ {{ type }}
+
-
-
-
-
+
+
@@ -136,20 +140,23 @@
contents: [],
order: {},
p_sn: '',
- type: 4,
+ type: '',
is_show_voucher: false,
voucher_list: [],
- voucher_count: 6
+ voucher_count: 6,
+ show_count: 0
}
},
onLoad(options){
- // TODO 1、凭证上传流程变动:当采购单状态为已发货状态时,食堂可以上传凭证图片;
- // TODO 2、食堂收货时,实到数、实收数默认填充采购数量;
- // todo 上传凭证参考页面:/uniapp-supplychain/supplier/pages/gonghuo/detail
this.p_sn = options.p_sn || '';
- // TODO 显示车辆等信息,显示table信息
this.getData();
},
+ onShow(){
+ this.show_count++;
+ if(this.show_count > 1){
+ this.getData();
+ }
+ },
methods: {
// 预览图片
lookPopupImage(current){
@@ -201,10 +208,7 @@
})
Promise.all(http_list).then(res => {
- console.log("上传完毕", res);
let images = res.map(item => item.path);
- console.log(images)
- // todo 图片上传url给后端
that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
p_sn: that.p_sn,
images: images,
@@ -228,9 +232,7 @@
getData(){
this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
p_sn: this.p_sn
- // p_sn: '802316269455228606'
}).then(res => {
- console.log("xxx",res)
this.order = res.data.order;
let list = res.data.order.items || [];
let contents = list.map(item => {
@@ -248,9 +250,8 @@
}
})
this.contents = contents;
- console.log(this.contents)
this.type = res.data.order.state
- })
+ }).catch(err => this.$toBack());
},
// 预览图片
lookImage(index){
@@ -262,14 +263,14 @@
})
}, 200);
},
- // 改变订单状态 TODO
+ // 改变订单状态
orderStateChange(state){
this.$http(this.API.API_CANTEEN_PURCHASEUPDATE, {
p_sn: this.p_sn,
state: state
}).then(res => {
console.log("orderStateChange", res);
- this.$msg('操作成功').then(()=>{this.$toBack()});
+ this.$msg('操作成功').then(()=> this.getData());
})
}
}
diff --git a/canteen/pages/purchase/launch.vue b/canteen/pages/purchase/launch.vue
index 27cdd34..8091f04 100644
--- a/canteen/pages/purchase/launch.vue
+++ b/canteen/pages/purchase/launch.vue
@@ -1,18 +1,18 @@
-
+
供应商
-
+
-
+
采购清单
-
+
@@ -71,87 +71,21 @@
render_material_list: {}, // 渲染出来的物资列表
show_count: 0, // 页面显示次数
p_sn: '', // 订单号,如果有
- type: 0 // 类型
+ type: 0 // 类型, 1编辑, 2复用
}
},
onLoad(options){
- // TODO 采购单编辑时保存
- // todo 采购单复用ok,还差 编辑 采购单保存
-
// 监听MaterialList被操作
uni.$on('addMaterialList', res => {
this.material_list = res;
})
-
- // /pages/purchase/launch?p_sn=P162771908650053&enter_type=2
if(options){
this.p_sn = options.p_sn || '';
this.type = options.enter_type || 0;
- if(options.enter_type == 2){
+ if(options.enter_type == 1 || options.enter_type == 2){
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(){
this.show_count++;
@@ -203,7 +137,7 @@
// table 内容处理
let list_arr = [];
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].supplier_name = material_list[i].supplier_name;
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 material_list = {};
list.map(item => {
- let items = item.purchase[0].items;
+ let items = item.purchase[0]?.items || [];
let items_obj = {};
items.map(i_item => {
items_obj[i_item.quotation_item_id] = {
- brand: i_item.material.brand,
+ brand: i_item?.material?.brand || '',
checked: true,
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,
- 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_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;
material_list[item.id] = item;
+ this.date = item.purchase[0]?.deadline_text || '';
})
this.material_list = material_list;
this.transformList();
- console.log("yes", material_list);
})
},
// table-input值被改变
@@ -338,17 +273,6 @@
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({
supplier_id: material_list[i].id,
material: arr
@@ -356,7 +280,6 @@
}
}
- console.log("list", list)
let deadline = this.date;
if(!deadline){
this.$msg('请选择收货时间');
@@ -370,15 +293,26 @@
this.$msg('采购数量需大于起购数量');
return;
}
- // let state = ['待发单', '待审核'][_t];
- this.$http(this.API.API_CANTEEN_PURCHASEAPPLY, {
+ let _api = this.API.API_CANTEEN_PURCHASEAPPLY;
+ let _data = {
order: list,
state: _t,
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()});
})
+ },
+ // 页面跳转添加供应商
+ addSupplier(){
+ if(this.type == 1){
+ return this.$msg('编辑时不可更换供应商');
+ }
+ this.$url('/pages/classification/supplier');
}
}
}