Browse Source

对接采购单编辑,优化采购订单详情页面

master
邓平艺 5 years ago
parent
commit
43bea8d595
  1. 2
      canteen/pages/classification/material.vue
  2. 189
      canteen/pages/purchase/detail.vue
  3. 134
      canteen/pages/purchase/launch.vue

2
canteen/pages/classification/material.vue

@ -13,7 +13,7 @@
:style="{height: 'calc('+ windowHeight +'px - 222rpx)', width:is_search_ing?'100%':'550rpx'}">
<view class="supplier-item" v-for="(item, index) in tab_list[current].list" :key="index">
<label class="lf-row-between" @click="switchChecked(item)">
<view style="height: 40rpx;">{{ item.material_name }}</view>
<view style="min-height: 40rpx; max-height: max-content; width: 440rpx;">{{ item.material_name }}</view>
<u-icon name="checkmark-circle-fill" size="40" color="#11D189" v-if="item.checked"></u-icon>
</label>
</view>

189
canteen/pages/purchase/detail.vue

@ -1,96 +1,100 @@
<template>
<view>
<view class="head" v-if="$isRight(order)">
<view class="lf-row-between lf-color-gray list">
<view>采购单 {{ order.p_sn }}</view>
</view>
<view class="lf-row-between list">
<image :src="order.supplier.logo" class="image"></image>
<view class="info">
<view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view>
<view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view>
<block v-if="$isRight(order)">
<view class="head">
<view class="lf-row-between lf-color-gray list">
<view>采购单 {{ order.p_sn }}</view>
</view>
<view class="lf-row-between list">
<image :src="order.supplier.logo" class="image"></image>
<view class="info">
<view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view>
<view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view>
</view>
</view>
</view>
</view>
<self-line></self-line>
<view class="lf-p-l-32 lf-p-r-32 lf-border-box lf-bg-white">
<!-- <lf-ysteps :stepList="stepList" color="#11D189"></lf-ysteps> -->
<lf-stepbar :list="order.state_log" v-if="order.state_log"></lf-stepbar>
</view>
<self-line></self-line>
<view class="head">
<view class="lf-row-between list">
<view>车辆</view>
<view class="lf-font-bold">{{order.car_license}}</view>
</view>
<view class="lf-row-between list">
<view>司机</view>
<view class="lf-font-bold">{{order.deliver_man}}</view>
</view>
<view class="lf-row-between list">
<view>联系电话</view>
<view class="lf-font-bold">{{order.deliver_phone}}</view>
<self-line></self-line>
<view class="lf-p-l-32 lf-p-r-32 lf-border-box lf-bg-white">
<lf-stepbar :list="order.state_log" v-if="order.state_log"></lf-stepbar>
</view>
<view class="list">
<view>证明材料-供应端</view>
<view class="lf-flex-wrap lf-m-t-10">
<image :src="item.voucher_pic" @click="lookImage(index)" class="ms-img" v-for="(item, index) in order.voucher" :key="item.id"></image>
<self-line></self-line>
<view class="head">
<view class="lf-row-between list">
<view>车辆</view>
<view class="lf-font-bold">{{order.car_license || '-'}}</view>
</view>
</view>
<view class="list" v-if="voucher_list.length">
<view>证明材料-食堂端</view>
<view class="lf-flex-wrap lf-m-t-10">
<image :src="item" @click="lookPopupImage(index)" class="ms-img" v-for="(item, index) in voucher_list" :key="index"></image>
<view class="lf-row-between list">
<view>司机</view>
<view class="lf-font-bold">{{order.deliver_man || '-'}}</view>
</view>
<view class="lf-row-between list">
<view>联系电话</view>
<view class="lf-font-bold">{{order.deliver_phone || '-'}}</view>
</view>
<view class="list" v-if="order.voucher.length">
<view>证明材料-供应端</view>
<view class="lf-flex-wrap lf-m-t-10">
<image :src="item.voucher_pic" @click="lookImage(index)" class="ms-img" v-for="(item, index) in order.voucher" :key="item.id"></image>
</view>
</view>
<view class="list" v-if="voucher_list.length">
<view>证明材料-食堂端</view>
<view class="lf-flex-wrap lf-m-t-10">
<image :src="item" @click="lookPopupImage(index)" class="ms-img" v-for="(item, index) in voucher_list" :key="index"></image>
</view>
</view>
</view>
</view>
<self-line></self-line>
<view class="lf-m-t-30 lf-m-l-32">
<view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
<wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="350rpx"></wyb-table>
</view>
<view style="height: 100rpx;"></view>
<!-- 操作按钮 -->
<view class="fixed-bottom" v-if="type != '备货中'">
<view v-if="type == '待发单'" class="lf-row-flex-end">
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
<button class="btn btn2">立即发单</button>
</view>
<view v-else-if="type == '待接单'" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
</view>
<view v-else-if="type == '已发货'" class="lf-row-flex-end">
<button class="btn btn1">退单</button>
<button class="btn btn1 lf-m-l-20" @click="is_show_voucher = true">上传凭证</button>
<button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">确认收货</button>
<self-line></self-line>
<view class="lf-m-t-30 lf-m-l-32">
<view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
<wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="80vh"></wyb-table>
</view>
<view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between">
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
<view class="lf-font-32" style="color: #11D189;">已完成</view>
<view style="height: 140rpx;"></view>
<!-- 操作按钮 -->
<view class="fixed-bottom" v-if="type && type != '备货中'">
<view v-if="type == '待发单'" class="lf-row-flex-end">
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
<button class="btn btn2" @click="orderStateChange('待接单')">立即发单</button>
</view>
<view v-else-if="type == '待接单'" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
</view>
<view v-else-if="type == '已发货'" class="lf-row-flex-end">
<button class="btn btn1" @click="orderStateChange('已退单')">退单</button>
<button class="btn btn1 lf-m-l-20" @click="is_show_voucher = true">上传凭证</button>
<button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">确认收货</button>
</view>
<view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between">
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button>
<view class="lf-font-32" style="color: #11D189;">已完成</view>
</view>
<view v-else class="lf-row-flex-end">
<view class="lf-font-32">{{ type }}</view>
</view>
</view>
</view>
<!-- 弹出层-上传凭证 -->
<u-popup v-model="is_show_voucher" mode="center" border-radius="20">
<view class="popup-box">
<view class="content">
<view class="popup-title">上传凭证信息</view>
<view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
<view class="popup-images">
<view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookPopupImage(index)">
<image :src="item" mode="aspectFill"></image>
<view class="remove-image" @click.stop="removeInage(index)">
<u-icon name="close-circle"></u-icon>
<!-- 弹出层-上传凭证 -->
<u-popup v-model="is_show_voucher" mode="center" border-radius="20">
<view class="popup-box">
<view class="content">
<view class="popup-title">上传凭证信息</view>
<view class="popup-desc">请在此处上传检验检疫凭证售卖资质等证书</view>
<view class="popup-images">
<view class="popup-image-item" v-for="(item, index) in voucher_list" :key="index" @click="lookPopupImage(index)">
<image :src="item" mode="aspectFill"></image>
<view class="remove-image" @click.stop="removeInage(index)">
<u-icon name="close-circle"></u-icon>
</view>
</view>
<view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
</view>
<view class="popup-image-item popup-image-item-after" @click="uploadImage" v-if="voucher_list.length < 6"></view>
</view>
<view class="foot-btn">
<u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
<u-button class="popup-btn" @click="submitImage">确定</u-button>
</view>
</view>
<view class="foot-btn">
<u-button class="popup-btn" @click="is_show_voucher = false">取消</u-button>
<u-button class="popup-btn" @click="submitImage">确定</u-button>
</view>
</view>
</u-popup>
</u-popup>
</block>
</view>
</template>
@ -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());
})
}
}

134
canteen/pages/purchase/launch.vue

@ -1,18 +1,18 @@
<template>
<view>
<view class="head">
<view class="list">
<view class="list" @click="addSupplier">
<view class="lf-row-between">
<view>供应商</view>
<view class="lf-icon" @click="$url('/pages/classification/supplier')">
<view class="lf-icon">
<u-icon name="plus-circle" size="42"></u-icon>
</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>采购清单</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>
</view>
</view>
@ -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');
}
}
}

Loading…
Cancel
Save