Browse Source

采购单详情页也要上传凭证(新改)、采购单确认收货显示已上传的凭证

master
邓平艺 5 years ago
parent
commit
a024dbe661
  1. 176
      canteen/pages/purchase/detail.vue
  2. 6
      canteen/pages/purchase/receipt.vue

176
canteen/pages/purchase/detail.vue

@ -71,6 +71,7 @@
</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">
@ -85,11 +86,35 @@
<view class="lf-font-32">{{ type }}</view>
</view>
</view>
<!-- 弹出层-上传凭证 -->
<u-popup v-model="is_show_voucher" mode="center" border-radius="20">
<view class="voucher-popup-box">
<view class="popup-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="lookImage(index, 'voucher_list')">
<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>
<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>
</block>
</view>
</template>
<script>
import { uploadFile } from '@/common/uploadFile.js'
import wybTable from '@/components/wyb-table/wyb-table';
export default {
components: { wybTable },
@ -233,6 +258,68 @@
})
}, 500);
},
//
removeInage(current){
this.voucher_list.splice(current, 1);
},
//
uploadImage(){
let current_count = this.voucher_count - this.voucher_list.length;
if(current_count == 0) return;
uni.chooseImage({
count: current_count,
complete: result => {
this.voucher_list.push(...result.tempFilePaths);
console.log(this.voucher_list)
}
})
},
// ossurl
submitImage(){
let that = this;
let voucher_list = that.voucher_list;
if(voucher_list.length <= 0){
return that.$msg('您未上传图片哦');
};
that.is_show_voucher = false;
uni.showLoading({
title: '正在上传中...'
})
let http_list = [];
voucher_list.map(item => {
let itemP = new Promise((resolve, reject) => {
uploadFile(item, (res) => {
resolve(res);
}, (err) => {
reject(err);
}, this);
})
http_list.push(itemP);
})
Promise.all(http_list).then(res => {
console.log("sssssss", res);
let images = res.map(item => item.path);
that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
p_sn: that.p_sn,
images: images,
}).then(result => {
uni.hideLoading();
that.voucher_list = [];
that.$msg('凭证已上传成功!');
that.getData();
}).catch(err => uni.hideLoading());
}).catch(err => {
uni.hideLoading();
uni.showModal({
title: '',
content: JSON.stringify(err),
showCancel: false,
confirmColor: '#1833F2'
})
})
},
//
orderStateChange(state){
let that = this;
@ -342,4 +429,93 @@
margin-right: 0rpx;
}
}
.voucher-popup-box{
width: 686rpx;
height: max-content;
display: flex;
justify-content: space-between;
flex-direction: column;
.popup-content{
.popup-title{
font-size: 32rpx;
font-weight: bold;
color: #222222;
text-align: center;
margin-top: 40rpx;
}
.popup-desc{
font-size: 28rpx;
color: #555555;
text-align: center;
margin-top: 20rpx;
margin-bottom: 18rpx;
}
.popup-images{
display: flex;
flex-wrap: wrap;
padding: 22rpx;
margin-bottom: 18rpx;
.popup-image-item{
width: 198rpx;
height: 198rpx;
margin: 8rpx;
background: #F5F5F5;
border-radius: 10rpx;
position: relative;
image{
width: 100%;
height: 100%;
}
.remove-image{
position: absolute;
right: -8rpx;
top: -16rpx;
color: #e74c3c;
font-size: 40rpx;
padding: 8rpx;
}
}
.popup-image-item-after::after{
content: '+';
position: absolute;
left: 30%;
top: 14%;
font-size: 100rpx;
color: #777777;
}
}
.popup-input{
padding: 0 60rpx;
box-sizing: border-box;
height: 90rpx;
font-size: 28rpx;
color: #555555;
input{
text-align: right;
}
}
}
.foot-btn{
height: 90rpx;
width: 100%;
border-top: 1rpx solid #E5E5E5;
display: flex;
box-sizing: border-box;
.popup-btn{
width: 50%;
height: 100%;
border: none;
border-radius: initial;
&:last-child{
border-left: 1rpx solid #E5E5E5;
color: #1833F2;
}
}
}
}
// u-button 线
/deep/.u-hairline-border::after{
border: none;
}
</style>

6
canteen/pages/purchase/receipt.vue

@ -244,10 +244,13 @@
item.reachNum = item.purchase_number
item.receiveNum = item.purchase_number
})
let voucher = res.data?.order?.voucher || [];
voucher = voucher.filter(item => item.client_type == '食堂');
this.is_upload = voucher.length > 0;
this.upload_list = voucher.map(item => item.voucher_pic);
})
},
inputBlur(current, key, event){
console.log("inputBlur", current, key, event);
this.list[current][key] = event.detail.value;
},
comfirm(){
@ -269,7 +272,6 @@
if(!this.is_upload){
return this.$msg('请上传凭证后再确认收货');
}
// return this.$msg('PASS');
this.$http(this.API.API_CONFIRM, {
p_sn: this.p_sn,
state: '已入库',

Loading…
Cancel
Save