<template>
|
<view>
|
<view class="origin-info">
|
<view class="origin-info_wrapper">
|
<view class="origin-info_content">
|
<view class="first-line"><combined-title title="原发信息"></combined-title></view>
|
<u-form :model="originInfoForm"
|
:rules="rules"
|
label-position="top"
|
label-width="160"
|
:label-style="{'marginLeft':'9px'}"
|
ref="originInfoRef">
|
<!-- 外购---isweight === 1 称重 皮毛净 -->
|
<view v-if="isWeight">
|
<u-form-item prop="coalContactSkin">
|
<view class="second-line">
|
<view class="label-text"
|
:class="{ focusClass: isfocus1 }"><text style="color: #f56c6c;">*</text>皮重</view>
|
<view class="input-container"
|
:class="{ inputClass: isfocus1, disabledClass: isModifyoriginInfo }">
|
<u--input placeholder="请输入皮重"
|
border="surround"
|
v-model="originInfoForm.coalContactSkin"
|
@focus="inputFocus(1)"
|
@blur="inputBlur"
|
@change="inputChange"></u--input>
|
</view>
|
<view class="unit"
|
:class="{ focusClass: isfocus1 }">吨</view>
|
</view>
|
</u-form-item>
|
<u-form-item prop="coalContactHair">
|
<view class="second-line">
|
<view class="label-text"
|
:class="{ focusClass: isfocus2 }"><text style="color: #f56c6c;">*</text>毛重</view>
|
<view class="input-container"
|
:class="{ inputClass: isfocus2, disabledClass: isModifyoriginInfo }">
|
<u--input placeholder="请输入毛重"
|
border="surround"
|
v-model="originInfoForm.coalContactHair"
|
@focus="inputFocus(2)"
|
@blur="inputBlur"
|
@change="inputChange"></u--input>
|
</view>
|
<view class="unit"
|
:class="{ focusClass: isfocus2 }">吨</view>
|
</view>
|
</u-form-item>
|
<u-form-item>
|
<view class="second-line">
|
<view class="label-text"><text style="color: #f56c6c;">*</text>净重</view>
|
<view class="input-container"
|
:class="{ disabledClass: isModifyoriginInfo }">
|
<u--input placeholder="净重"
|
border="surround"
|
disabled
|
v-model="coalContactClean"></u--input>
|
</view>
|
<view class="unit">吨</view>
|
</view>
|
</u-form-item>
|
|
</view>
|
<view v-else class="table-div">
|
<uni-table
|
border
|
id="table-box"
|
emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" >产品</uni-th>
|
<!-- <uni-th align="center">皮重</uni-th>
|
<uni-th align="center">毛重</uni-th>
|
<uni-th align="center">净重</uni-th> -->
|
<uni-th align="center">数量</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(subItem, index) in coalData.tmTaskCoalList" :key="index">
|
<uni-td align="center">
|
<view class="name">{{ subItem.productName }}</view></uni-td>
|
<!-- <uni-td align='right'>
|
<view v-if="subItem.skin">{{ Number( subItem.skin).toFixed(2) || ''}}</view>
|
</uni-td>
|
<uni-td align='right'>
|
<view class="name" v-if="subItem.hair">{{ Number(subItem.hair) .toFixed(2) || '' }}</view>
|
</uni-td>
|
<uni-td align='right'>
|
<view class="name" v-if="subItem.clean">{{ Number( subItem.clean).toFixed(2) || '' }}</view>
|
</uni-td> -->
|
|
<uni-td align="right">
|
<view>
|
<u--input
|
placeholder="请输入产品数量"
|
type='number'
|
v-model="subItem.productQuantity"
|
></u--input>
|
</view></uni-td>
|
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<u-form-item prop='contactPicture'>
|
<view class="label-text">
|
<text style="color: #f56c6c;">*</text>原发单据
|
</view>
|
<u-upload :fileList="fileList1"
|
@afterRead="afterRead"
|
@delete="deletePic"
|
name="1"
|
multiple
|
:maxCount="2"
|
width="250"
|
height="150"
|
:previewFullImage="true"></u-upload>
|
</u-form-item>
|
|
</u-form>
|
<view class="submit-button">
|
<view class="">
|
<u-button text="立即预约"
|
type="primary"
|
@click.stop="directAppointment"
|
v-if="isSpecial"></u-button>
|
</view>
|
<view class="">
|
<u-button text="提交信息"
|
type="primary"
|
@click.stop="submitOriginInfo"
|
:loading="submitOriginInfoLoading"
|
:disabled="!coalContactClean"></u-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import combinedTitle from '@/components/combined-title/combined-title.vue'
|
import BigNumber from "bignumber.js"
|
import { BaseUrl } from '@/api/publicInterface.js'
|
export default {
|
components: {
|
combinedTitle
|
},
|
data() {
|
return {
|
orderPlanId: "",
|
// 聚焦时改变样式
|
isfocus1: false,
|
tmTaskCoalList:[],
|
isfocus2: false,
|
// 输入的原发信息
|
originInfoForm: {
|
coalContactSkin: '',
|
coalContactHair: '',
|
coalContactClean: 0,
|
contactPicture: ''
|
},
|
fileList1: [], //图片列表
|
rules: {},
|
submitOriginInfoLoading: false,
|
coalData: {},
|
sendDate: '',
|
deptId: '',
|
filedId: '',
|
isSpecial: null,
|
isWeight:null,
|
}
|
},
|
computed: {
|
coalContactClean() {
|
if(this.isWeight){
|
let xx = BigNumber(this.originInfoForm.coalContactHair ? this.originInfoForm.coalContactHair : 0)
|
let yy = BigNumber(this.originInfoForm.coalContactSkin ? this.originInfoForm.coalContactSkin : 0)
|
return xx.minus(yy).toNumber() > 0 ? xx.minus(yy).toNumber().toFixed(2) : 0
|
}else{
|
//数量
|
if(!this.coalData.tmTaskCoalList.length){
|
return false
|
}else{
|
const reslut = this.coalData.tmTaskCoalList.find(item=>!item.productQuantity);
|
console.log(reslut);
|
if(reslut){
|
return false
|
}else{
|
return true
|
}
|
}
|
}
|
|
},
|
|
},
|
onLoad(params) {
|
this.orderPlanId = params.orderPlanId || ''
|
this.sendDate = params.sendDate || ''
|
this.deptId = params.deptId || ''
|
this.filedId = params.filedId || ''
|
this.isSpecial = Number(params.isSpecial);
|
this.isWeight = Number(params.isWeight)
|
console.log(params.isSpecial, typeof params.isSpecial,params,'paramssssss');
|
this.getTakeCoal()
|
},
|
methods: {
|
getTakeCoal() {
|
uni.showLoading({
|
title: '加载中'
|
});
|
this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
|
uni.hideLoading();
|
if (res.code == 0) {
|
this.coalData = res.data
|
} else {
|
this.$u.toast('加载失败');
|
}
|
})
|
},
|
// input聚焦
|
inputFocus(v) {
|
if (v == 1) {
|
this.isfocus1 = true;
|
} else {
|
this.isfocus2 = true;
|
}
|
},
|
// input失焦
|
inputBlur() {
|
this.isfocus1 = false;
|
this.isfocus2 = false;
|
},
|
inputChange() {
|
if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin >
|
0)) {
|
this.isInputOrigin = true;
|
}
|
},
|
deletePic(event) {
|
this.changeisUploadimg(true);
|
this[`fileList${event.name}`].splice(event.index, 1);
|
},
|
async afterRead(event) {
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
let lists = [].concat(event.file);
|
let fileListLen = this[`fileList${event.name}`].length;
|
lists.map(item => {
|
this[`fileList${event.name}`].push({
|
...item,
|
status: 'uploading',
|
message: '上传中'
|
});
|
});
|
for (let i = 0; i < lists.length; i++) {
|
const result = await this.uploadFilePromise(lists[i].url, event.name);
|
let item = this[`fileList${event.name}`][fileListLen];
|
this[`fileList${event.name}`].splice(
|
fileListLen,
|
1,
|
Object.assign(item, {
|
status: 'success',
|
message: '上传成功',
|
url: result
|
})
|
);
|
fileListLen++;
|
}
|
},
|
uploadFilePromise(url, num) {
|
return new Promise((resolve, reject) => {
|
let a = uni.uploadFile({
|
url: BaseUrl + '/admin/sys-file/uploadUnToken',
|
filePath: url,
|
name: 'file',
|
success: res => {
|
if (num == 1) {
|
this.originInfoForm.contactPicture = JSON.parse(res.data)
|
.data.url;
|
resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
|
}
|
}
|
});
|
});
|
},
|
directAppointment() {
|
uni.navigateTo({
|
url: `/pages/driver-page/appointment/appointment?takeCoalId=${this.orderPlanId}&filedId=${this.filedId}&deptId=${this.deptId}&sendDate=${this.sendDate}`
|
});
|
},
|
submitOriginInfo() {
|
let form = {
|
skin: Number(this.originInfoForm.coalContactSkin),
|
hair: Number(this.originInfoForm.coalContactHair),
|
clean: Number(this.coalContactClean),
|
tmId: this.coalData.tmId,
|
contactPicture: this.originInfoForm.contactPicture,
|
deptId: this.coalData.deptId,
|
filedId: this.coalData.filedId,
|
coalName: this.coalData.coalName,
|
taskCoalCode: this.coalData.code,
|
carNo: this.coalData.carNo,
|
}
|
//称重
|
if(this.isWeight){
|
if (this.originInfoForm.coalContactSkin && this.originInfoForm.coalContactHair && this
|
.originInfoForm
|
.contactPicture) {
|
//原发净重限制
|
if(this.coalContactClean && this.coalContactClean > 200){
|
this.$u.toast('当前净重超过正常值,请检查皮毛重')
|
return
|
|
}else{
|
this.submitOriginInfoLoading = true
|
this.$reqPost('appSaveContact', form, 'json').then(res => {
|
if (res.code === 0) {
|
this.$u.toast('提交成功')
|
this.submitOriginInfoLoading = false
|
setTimeout(() => {
|
uni.navigateTo({
|
url: `/pages/driver-page/appointment/appointment?takeCoalId=${this.orderPlanId}&filedId=${this.filedId}&deptId=${this.deptId}&sendDate=${this.sendDate}`
|
});
|
}, 1500)
|
} else {
|
this.submitOriginInfoLoading = false
|
this.$u.toast(res.msg ? res.msg : '提交失败')
|
}
|
})
|
}
|
|
} else {
|
uni.$u.toast('请填写完整原发信息')
|
}
|
}else{
|
//数量
|
form.numDtoList = this.coalData.tmTaskCoalList.map(item=>{
|
let obj = {
|
tmId:item.id,
|
num:Number(item.productQuantity)
|
}
|
return obj;
|
});
|
//删除皮毛净
|
delete form.clean;
|
delete form.hair;
|
delete form.skin;
|
if (this.coalContactClean && this
|
.originInfoForm
|
.contactPicture) {
|
this.submitOriginInfoLoading = true;
|
console.log(form,'form')
|
this.$reqPost('appSaveContact', form, 'json').then(res => {
|
if (res.code === 0) {
|
this.$u.toast('提交成功')
|
this.submitOriginInfoLoading = false
|
setTimeout(() => {
|
uni.navigateTo({
|
url: `/pages/driver-page/appointment/appointment?takeCoalId=${this.orderPlanId}&filedId=${this.filedId}&deptId=${this.deptId}&sendDate=${this.sendDate}`
|
});
|
}, 1500)
|
} else {
|
this.submitOriginInfoLoading = false
|
this.$u.toast(res.msg ? res.msg : '提交失败')
|
}
|
})
|
} else {
|
uni.$u.toast('请填写完整原发信息')
|
}
|
}
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss"
|
scoped>
|
.table-div{
|
/deep/ .uni-table{
|
width: 95%;
|
min-width: 0!important;
|
margin-left: 20rpx;
|
}
|
|
}
|
/deep/.u-button {
|
font-size: 28rpx;
|
font-weight: 300;
|
color: #ffffff !important;
|
background: #497bfb !important;
|
letter-spacing: 4rpx;
|
border-radius: 37rpx 37rpx 37rpx 37rpx !important;
|
box-shadow: 2rpx 3rpx 13rpx 0rpx rgba(43, 98, 239, 0.5), 0rpx 0rpx 9rpx 0rpx rgba(247, 250, 253, 0.29);
|
}
|
|
@mixin flex {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.origin-info {
|
width: 690rpx;
|
height: 100%;
|
margin: vww(20) vww(15) vww(13);
|
background: #ffffff;
|
box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
|
border-radius: 20rpx;
|
@include flex;
|
justify-content: center;
|
overflow: hidden;
|
position: relative;
|
top: vww(120);
|
|
&_wrapper {
|
width: 650rpx;
|
height: 100%;
|
@include flex;
|
flex-direction: column;
|
margin-bottom: vww(20);
|
position: relative;
|
|
.origin-info_content {
|
width: 100%;
|
height: 100%;
|
// overflow-y: scroll;
|
|
.first-line,
|
.second-line {
|
width: 90%;
|
height: vww(44);
|
|
.focusClass {
|
color: #5b95fd;
|
}
|
|
.inputClass {
|
border: 1px solid rgba(73, 95, 252, 0.6) !important;
|
box-shadow: 0rpx 5rpx 13rpx 0rpx rgba(73, 95, 252, 0.6) !important;
|
border-radius: 12rpx !important;
|
}
|
|
.isInputOrigin {
|
background-color: #f4f4fc;
|
}
|
|
.input-container {
|
border: 2px solid #c5c5c5;
|
box-shadow: 0rpx 5rpx 13rpx 0rpx #c5c5c5;
|
border-radius: 12rpx;
|
}
|
}
|
|
.first-line {
|
@include flex;
|
position: relative;
|
top: vww(8);
|
}
|
|
.second-line {
|
@include flex;
|
}
|
|
.submit-button {
|
width: 450rpx;
|
margin: vww(8) auto;
|
@include flex;
|
|
.u-button {
|
width: 45%;
|
font-size: 28rpx;
|
font-weight: 300;
|
color: #ffffff;
|
background: #497bfb;
|
letter-spacing: 4rpx;
|
border-radius: 37rpx 37rpx 37rpx 37rpx;
|
box-shadow: 2rpx 3rpx 13rpx 0rpx rgba(43, 98, 239, 0.5), 0rpx 0rpx 9rpx 0rpx rgba(247, 250, 253, 0.29);
|
}
|
}
|
}
|
}
|
}
|
</style>
|