You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1329 lines
42 KiB
1329 lines
42 KiB
<template>
|
|
<view class="jnpf-wrap jnpf-wrap-form" v-if="!loading">
|
|
<u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
|
|
label-align="right" :label-width="labelwidth" class="jnpf-form">
|
|
<view class="u-p-l-20 u-p-r-20 ">
|
|
<u-form-item>
|
|
<jnpf-group value="基础信息" content="基础信息" contentPosition="left">
|
|
</jnpf-group>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="凭证编号" prop="voucherCode">
|
|
<u-input v-model="dataForm.voucherCode" disabled @change="changeData('voucherCode',-1)"
|
|
input-align='right' placeholder="系统自动生成" :style='{"width":"100%"}' readonly>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="凭证类型" prop="voucherType">
|
|
<jnpf-select v-model="dataForm.voucherType" @change="changeData('voucherType',-1)" clearable
|
|
placeholder="请选择" :props="voucherTypeProps" :options="voucherTypeOptions"
|
|
:style='{"width":"100%"}'>
|
|
</jnpf-select>
|
|
</u-form-item>
|
|
</view>
|
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="制单时间" prop="preparationTime">
|
|
<jnpf-date-time v-model="dataForm.preparationTime" @change="changeData('preparationTime',-1)"
|
|
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd"
|
|
clearable placeholder="请选择" type="date" :style='{"width":"100%"}'>
|
|
</jnpf-date-time>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="三级供应商" prop="associateThirdSuppliers">
|
|
<jnpf-popup-select v-model="dataForm.associateThirdSuppliers"
|
|
@change="changeData('associateThirdSuppliers',-1)" :rowIndex="null" :formData="dataForm"
|
|
:templateJson="interfaceRes.associateThirdSuppliers" clearable propsValue="id"
|
|
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
|
|
vModel='associateThirdSuppliers' :columnOptions="associateThirdSuppliersColumnOptions"
|
|
interfaceId="523899951990705477" :pageSize="20" placeholder="请选择" type="popup"
|
|
:style='{"width":"100%"}'>
|
|
</jnpf-popup-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="配送方式" prop="deliveryType">
|
|
<jnpf-select v-model="dataForm.deliveryType" @change="changeData('deliveryType',-1)" clearable
|
|
placeholder="请选择" :props="deliveryTypeProps" :options="deliveryTypeOptions"
|
|
:style='{"width":"100%"}'>
|
|
</jnpf-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="采购合同编号" prop="purchaseContractNo">
|
|
<u-input v-model="dataForm.purchaseContractNo" @change="changeData('purchaseContractNo',-1)"
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="销售合同编号" prop="saleContractNo">
|
|
<u-input v-model="dataForm.saleContractNo" @change="changeData('saleContractNo',-1)"
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="采购额" prop="purchaseAmount">
|
|
<u-input v-model="dataForm.purchaseAmount" @change="changeData('purchaseAmount',-1)"
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="销售额" prop="saleAmount">
|
|
<u-input v-model="dataForm.saleAmount" @change="changeData('saleAmount',-1)" input-align='right'
|
|
clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 ">
|
|
<u-form-item>
|
|
<jnpf-group value="凭证信息" content="凭证信息" contentPosition="left">
|
|
</jnpf-group>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="凭证图片" prop="voucherPictures">
|
|
<jnpf-upload-pound v-model="dataForm.voucherPictures" @change="poundlistUploadSuccess"
|
|
sizeUnit="MB" :fileSize="10" :limit="1" pathType="defaultPath" :isAccount="0"
|
|
:value="dataForm.voucherPictures">
|
|
</jnpf-upload-pound>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="磅单编号" prop="poundCode">
|
|
<u-input v-model="dataForm.poundCode" @change="changeData('poundCode',-1)" input-align='right'
|
|
clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="车牌号" prop="vehicleName">
|
|
<u-input v-model="dataForm.vehicleName" @change="changeData('vehicleName',-1)"
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}' @input="vehicleChange(dataForm.vehicleName)">
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="发货单位" prop="supplierId">
|
|
<jnpf-popup-select v-model="dataForm.supplierId" @change="changeData('supplierId',-1)"
|
|
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.supplierId" hasPage clearable
|
|
propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
|
|
vModel='supplierId' :columnOptions="supplierIdColumnOptions" interfaceId="530001731111617029"
|
|
:pageSize="20" placeholder="请选择" type="popup" :style='{"width":"100%"}'>
|
|
</jnpf-popup-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="收货单位" prop="customerId">
|
|
<jnpf-popup-select v-model="dataForm.customerId" @change="changeData('customerId',-1)"
|
|
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.customerId" hasPage clearable
|
|
propsValue="f_id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
|
|
relationField='f_full_name' vModel='customerId' :columnOptions="customerIdColumnOptions"
|
|
interfaceId="522729853024209157" :pageSize="20" placeholder="请选择" type="popup"
|
|
:style='{"width":"100%"}'>
|
|
</jnpf-popup-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 ">
|
|
<u-form-item>
|
|
<jnpf-group value="商品信息" content="商品信息" contentPosition="left">
|
|
</jnpf-group>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="jnpf-table">
|
|
<view class="jnpf-table-item" v-for="(item,i) in dataForm.voucherProductList" :key="i">
|
|
<!-- <view class="jnpf-table-item-title u-flex u-row-between">
|
|
<text class="jnpf-table-item-title-num">({{i+1}})</text>
|
|
<view class="jnpf-table-item-title-action" v-if="dataForm.voucherProductList.length>0"
|
|
@click="delvoucherproductList(i)">删除</view>
|
|
</view> -->
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="商品名称">
|
|
<jnpf-popup-select v-model="dataForm.voucherProductList[i].productId"
|
|
@change="productChangeData" :rowIndex="i" :formData="dataForm"
|
|
:templateJson="interfaceRes.voucherproductproductId" clearable propsValue="id"
|
|
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
|
|
:vModel="'productId'+i" :columnOptions="voucherproductproductIdColumnOptions"
|
|
interfaceId="545146513462930117" :pageSize="20" placeholder="请选择" type="popup"
|
|
:style='{"width":"100%"}'>{ "fieldName": "", "field": "subjectId", "defaultValue": "", "jnpfKey": "popupSelect", "dataType": "varchar", "id": "spNokw1", "relationField": "supplierId", "required": "0" }
|
|
</jnpf-popup-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="规格">
|
|
<u-input v-model="dataForm.voucherProductList[i].spec"
|
|
@change="changeData('voucherproduct-spec',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="单位">
|
|
<u-input v-model="dataForm.voucherProductList[i].unit"
|
|
@change="changeData('voucherproduct-unit',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="毛重">
|
|
<jnpf-number-box v-model="dataForm.voucherProductList[i].grossWeight"
|
|
@change="changeData('voucherproduct-grossWeight',i)" :precision="4" :controls="true"
|
|
placeholder="数字文本" :step="1" :min="0" @input="UpdateWeight(dataForm.voucherProductList[i])">
|
|
</jnpf-number-box>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="皮重">
|
|
<jnpf-number-box v-model="dataForm.voucherProductList[i].tareWeight"
|
|
@change="changeData('voucherproduct-tareWeight',i)" :precision="4" :controls="true"
|
|
placeholder="数字文本" :step="1" :min="0" @input="UpdateWeight(dataForm.voucherProductList[i])">
|
|
</jnpf-number-box>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="扣重">
|
|
<jnpf-number-box v-model="dataForm.voucherProductList[i].buckleWeight"
|
|
@change="changeData('voucherproduct-buckleWeight',i)" :precision="4" :controls="true"
|
|
placeholder="数字文本" :step="1" :min="0" @input="UpdateWeight(dataForm.voucherProductList[i])">
|
|
</jnpf-number-box>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="结算量">
|
|
<jnpf-number-box v-model="dataForm.voucherProductList[i].netWeight"
|
|
@change="changeData('voucherproduct-netWeight',i)" :precision="4" :controls="true"
|
|
placeholder="数字文本" :step="1" :min="0">
|
|
</jnpf-number-box>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="净重">
|
|
<jnpf-number-box v-model="dataForm.voucherProductList[i].clearWeight"
|
|
@change="changeData('voucherproduct-clearWeight',i)" :precision="4" :controls="true"
|
|
placeholder="数字文本" :step="1" :min="0">
|
|
</jnpf-number-box>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="备注">
|
|
<u-input v-model="dataForm.voucherProductList[i].remark"
|
|
@change="changeData('voucherproduct-remark',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="jnpf-table-addBtn" @click="voucherProductList">
|
|
<u-icon name="plus" color="#2979ff"></u-icon>
|
|
<span>{{dataForm.voucherProductList.length==0?"添加":"添加"}}</span>
|
|
</view> -->
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 ">
|
|
<u-form-item>
|
|
<jnpf-group value="运输信息" content="运输信息" contentPosition="left">
|
|
</jnpf-group>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="运输方式" prop="modeTransport">
|
|
<jnpf-select v-model="dataForm.modeTransport" @change="changeData('modeTransport',-1)" clearable
|
|
placeholder="请选择" :props="modeTransportProps" :options="modeTransportOptions"
|
|
:style='{"width":"100%"}'>
|
|
</jnpf-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="承运方式" prop="transportationMethod">
|
|
<jnpf-select v-model="dataForm.transportationMethod" @change="changeData('transportationMethod',-1)"
|
|
clearable placeholder="请选择" :props="transportationMethodProps"
|
|
:options="transportationMethodOptions" :style='{"width":"100%"}'>
|
|
</jnpf-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="承运商" prop="carrier">
|
|
<u-input v-model="dataForm.carrier" @change="changeData('carrier',-1)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="起运地" prop="placeDispatch">
|
|
<jnpf-city-select v-model="dataForm.placeDispatch" @change="changeData('placeDispatch',-1)"
|
|
selectType="all" clearable placeholder="请选择" :level="2" :style='{"width":"100%"}'>
|
|
</jnpf-city-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="到达地" prop="destination">
|
|
<jnpf-city-select v-model="dataForm.destination" @change="changeData('destination',-1)"
|
|
selectType="all" clearable placeholder="请选择" :level="2" :style='{"width":"100%"}'>
|
|
</jnpf-city-select>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="运费" prop="freight">
|
|
<u-input v-model="dataForm.freight" @change="changeData('freight',-1)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="车辆信息" prop="vehiclePictures">
|
|
<jnpf-upload v-model="dataForm.vehiclePictures" @change="changeData('vehiclePictures',-1)"
|
|
sizeUnit="MB" :fileSize="10" :limit="9" pathType="defaultPath" :isAccount="0"
|
|
:value="dataForm.vehiclePictures">
|
|
</jnpf-upload>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 ">
|
|
<u-form-item>
|
|
<jnpf-group value="车辆信息" content="车辆信息" contentPosition="left">
|
|
</jnpf-group>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="jnpf-table">
|
|
<view class="jnpf-table-item" v-for="(item,i) in dataForm.voucherVehicleList" :key="i">
|
|
<!-- <view class="jnpf-table-item-title u-flex u-row-between">
|
|
<text class="jnpf-table-item-title-num">({{i+1}})</text>
|
|
<view class="jnpf-table-item-title-action" v-if="dataForm.voucherVehicleList.length>0"
|
|
@click="delvouchervehicleList(i)">删除</view>
|
|
</view> -->
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item required label="车牌号">
|
|
<!-- <jnpf-popup-select v-model="dataForm.voucherVehicleList[i].vehicleId"
|
|
@change="changeData('vouchervehicle-vehicleId',i)"
|
|
:rowIndex="i" :formData="dataForm" :templateJson="interfaceRes.vouchervehiclevehicleId" clearable propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='vehicle_number' :vModel="'vehicleId'+i" :columnOptions="vouchervehiclevehicleIdColumnOptions" interfaceId="529920852288864453" :pageSize="20" placeholder="请选择" type="popup" :style='{"width":"100%"}'>
|
|
</jnpf-popup-select> -->
|
|
<u-input v-model="dataForm.voucherVehicleList[i].vehicleNumber"
|
|
@change="changeData('vouchervehicle-driverName',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="驾驶员名称">
|
|
<u-input v-model="dataForm.voucherVehicleList[i].driverName"
|
|
@change="changeData('vouchervehicle-driverName',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="联系电话">
|
|
<u-input v-model="dataForm.voucherVehicleList[i].telephone"
|
|
@change="changeData('vouchervehicle-telephone',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
<u-form-item label="承运商">
|
|
<u-input v-model="dataForm.voucherVehicleList[i].carrier"
|
|
@change="changeData('vouchervehicle-carrier',i)" input-align='right' clearable
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
</u-input>
|
|
</u-form-item>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="jnpf-table-addBtn" @click="addvouchervehicleList">
|
|
<u-icon name="plus" color="#2979ff"></u-icon>
|
|
<span>{{dataForm.voucherVehicleList.length==0?"添加":"添加"}}</span>
|
|
</view> -->
|
|
</view>
|
|
</u-form>
|
|
<view class="buttom-actions" v-if="jurisdictionType != 'btn_detail'">
|
|
<u-button class="buttom-btn" :loading="btnLoading" @click="showAction = true" v-if="actionList.length>0">
|
|
更多<u-icon name="arrow-down" size="24"></u-icon>
|
|
</u-button>
|
|
<u-button class="buttom-btn" type="primary" @click="submitForm" :loading="btnLoading">确定</u-button>
|
|
<u-button class="buttom-btn" @click="resetForm">取消</u-button>
|
|
</view>
|
|
<u-action-sheet @click="handleAction" :list="actionList" :tips="{ text: '更多操作' , color: '#000' , fontSize: 30 }"
|
|
v-model="showAction">
|
|
</u-action-sheet>
|
|
<u-modal v-model="show" :content="content" width='70%' border-radius="16"
|
|
:content-style="{fontSize: '28rpx',padding: '20rpx',lineHeight: '44rpx',textAlign: 'left'}"
|
|
:titleStyle="{padding: '20rpx'}" :confirm-style="{height: '80rpx',lineHeight: '80rpx'}" :title="title"
|
|
confirm-text="确定">
|
|
</u-modal>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getDictionaryDataSelector,
|
|
getDataInterfaceRes,
|
|
getDefaultCurrentValueUserId,
|
|
getDefaultCurrentValueDepartmentId
|
|
} from '@/api/common'
|
|
import {
|
|
getDateDay,
|
|
getLaterData,
|
|
getBeforeData,
|
|
getBeforeTime,
|
|
getLaterTime
|
|
} from '@/components/index.js'
|
|
import request from '@/utils/request'
|
|
export default {
|
|
data() {
|
|
return {
|
|
idList: [],
|
|
index: 0,
|
|
actionList: [],
|
|
actionListLength: false,
|
|
showAction: false,
|
|
btnLoading: false,
|
|
loading: false,
|
|
text: '提示:测试文本',
|
|
tableKey: '',
|
|
dataForm: {
|
|
id: "",
|
|
voucherCode: '',
|
|
voucherType: "1",
|
|
preparationTime: "",
|
|
associateThirdSuppliers: "",
|
|
deliveryType: "",
|
|
purchaseContractNo: '',
|
|
saleContractNo: '',
|
|
purchaseAmount: '',
|
|
saleAmount: '',
|
|
voucherPictures: [],
|
|
poundCode: '',
|
|
vehicleName: '',
|
|
supplierId: "",
|
|
customerId: "",
|
|
modeTransport: "",
|
|
transportationMethod: "",
|
|
carrier: '',
|
|
placeDispatch: [],
|
|
destination: [],
|
|
freight: '',
|
|
vehiclePictures: [],
|
|
voucherStatus: "4",
|
|
documentType: "1",
|
|
voucherProductList: [],
|
|
voucherVehicleList: [],
|
|
businessType: "1",
|
|
},
|
|
rules: {
|
|
voucherType: [{
|
|
required: true,
|
|
message: '凭证类型请选择',
|
|
}, ],
|
|
preparationTime: [{
|
|
required: true,
|
|
message: '制单时间请选择',
|
|
}, ],
|
|
deliveryType: [{
|
|
required: true,
|
|
message: '配送方式请选择',
|
|
}, ],
|
|
purchaseContractNo: [{
|
|
required: true,
|
|
message: '采购合同编号请输入',
|
|
}, ],
|
|
voucherPictures: [{
|
|
required: true,
|
|
message: '凭证图片请至少选择一个',
|
|
type: 'array',
|
|
}, ],
|
|
vehicleName: [{
|
|
required: true,
|
|
message: '车牌号请输入',
|
|
}, ],
|
|
supplierId: [{
|
|
required: true,
|
|
message: '发货单位请选择',
|
|
}, ],
|
|
customerId: [{
|
|
required: true,
|
|
message: '收货单位请选择',
|
|
}, ],
|
|
modeTransport: [{
|
|
required: true,
|
|
message: '运输方式请选择',
|
|
}, ],
|
|
transportationMethod: [{
|
|
required: true,
|
|
message: '承运方式请选择',
|
|
}, ],
|
|
placeDispatch: [{
|
|
required: true,
|
|
message: '起运地请至少选择一个',
|
|
type: 'array',
|
|
}, ],
|
|
destination: [{
|
|
required: true,
|
|
message: '到达地请至少选择一个',
|
|
type: 'array',
|
|
}, ],
|
|
freight: [{
|
|
required: true,
|
|
message: '运费请输入',
|
|
}, ],
|
|
vehiclePictures: [{
|
|
required: true,
|
|
message: '车辆信息请至少选择一个',
|
|
type: 'array',
|
|
}, ],
|
|
},
|
|
voucherTypeOptions: [{
|
|
"fullName": "磅单",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "收据",
|
|
"id": "2"
|
|
}, {
|
|
"fullName": "其他",
|
|
"id": "3"
|
|
}],
|
|
voucherTypeProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
associateThirdSuppliersColumnOptions: [{
|
|
"label": "供应商编码",
|
|
"value": "code"
|
|
},
|
|
{
|
|
"label": "供应商名称",
|
|
"value": "name"
|
|
},
|
|
],
|
|
deliveryTypeOptions: [{
|
|
"fullName": "仓配",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "直送",
|
|
"id": "2"
|
|
}],
|
|
deliveryTypeProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
supplierIdColumnOptions: [{
|
|
"label": "供应商名称",
|
|
"value": "name"
|
|
},
|
|
{
|
|
"label": "国家",
|
|
"value": "country"
|
|
},
|
|
{
|
|
"label": "地址",
|
|
"value": "address"
|
|
},
|
|
{
|
|
"label": "电话",
|
|
"value": "phone"
|
|
},
|
|
],
|
|
customerIdColumnOptions: [{
|
|
"label": "机构编码",
|
|
"value": "f_en_code"
|
|
},
|
|
{
|
|
"label": "机构名称",
|
|
"value": "f_full_name"
|
|
},
|
|
],
|
|
modeTransportOptions: [{
|
|
"fullName": "公路",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "铁路",
|
|
"id": "2"
|
|
}, {
|
|
"fullName": "轮船",
|
|
"id": "3"
|
|
}, {
|
|
"fullName": "空运",
|
|
"id": "4"
|
|
}, {
|
|
"fullName": "无",
|
|
"id": "5"
|
|
}],
|
|
modeTransportProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
transportationMethodOptions: [{
|
|
"fullName": "仓库承运(DC)",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "承运商",
|
|
"id": "2"
|
|
}, {
|
|
"fullName": "供应商",
|
|
"id": "3"
|
|
}, {
|
|
"fullName": "自提",
|
|
"id": "4"
|
|
}],
|
|
transportationMethodProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
voucherStatusOptions: [{
|
|
"fullName": "待提交",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "待审核",
|
|
"id": "2"
|
|
}, {
|
|
"fullName": "待质检",
|
|
"id": "3"
|
|
}, {
|
|
"fullName": "已完成",
|
|
"id": "4"
|
|
}, {
|
|
"fullName": "已关闭",
|
|
"id": "5"
|
|
}],
|
|
voucherStatusProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
documentTypeOptions: [{
|
|
"fullName": "收货凭证",
|
|
"id": "1"
|
|
}, {
|
|
"fullName": "发货凭证",
|
|
"id": "2"
|
|
}],
|
|
documentTypeProps: {
|
|
"label": "fullName",
|
|
"value": "id",
|
|
"multiple": false,
|
|
"children": ""
|
|
},
|
|
voucherproductproductIdColumnOptions: [{
|
|
"label": "商品编码",
|
|
"value": "code"
|
|
},
|
|
{
|
|
"label": "商品名称",
|
|
"value": "name"
|
|
},
|
|
{
|
|
"label": "规格",
|
|
"value": "spec"
|
|
},
|
|
],
|
|
vouchervehiclevehicleIdColumnOptions: [{
|
|
"label": "车牌号",
|
|
"value": "vehicle_number"
|
|
},
|
|
{
|
|
"label": "驾驶员",
|
|
"value": "name"
|
|
},
|
|
{
|
|
"label": "电话",
|
|
"value": "mobile"
|
|
},
|
|
],
|
|
labelwidth: 100 * 1.5,
|
|
menuId: '',
|
|
jurisdictionType: '',
|
|
ruleList: {
|
|
voucherProductList: {
|
|
'productId': '商品名称不能为空',
|
|
'unit': '单位不能为空',
|
|
},
|
|
voucherVehicleList: {
|
|
'vehicleNumber': '车牌号不能为空',
|
|
},
|
|
},
|
|
interfaceRes: {
|
|
voucherCode: [],
|
|
voucherType: [],
|
|
preparationTime: [],
|
|
associateThirdSuppliers: [],
|
|
deliveryType: [],
|
|
purchaseContractNo: [],
|
|
saleContractNo: [],
|
|
purchaseAmount: [],
|
|
saleAmount: [],
|
|
voucherPictures: [],
|
|
poundCode: [],
|
|
vehicleName: [],
|
|
supplierId: [],
|
|
customerId: [],
|
|
modeTransport: [],
|
|
transportationMethod: [],
|
|
carrier: [],
|
|
placeDispatch: [],
|
|
destination: [],
|
|
freight: [],
|
|
vehiclePictures: [],
|
|
voucherStatus: [],
|
|
documentType: [],
|
|
voucherproductproductId: [{ "fieldName": "", "field": "subjectId", "defaultValue": "", "jnpfKey": "popupSelect", "dataType": "varchar", "id": "spNokw1", "relationField": "supplierId", "required": "0" }],
|
|
voucherproductspec: [],
|
|
voucherproductunit: [],
|
|
voucherproductgrossWeight: [],
|
|
voucherproducttareWeight: [],
|
|
voucherproductbuckleWeight: [],
|
|
voucherproductnetWeight: [],
|
|
voucherproductclearWeight: [],
|
|
voucherproductremark: [],
|
|
vouchervehiclevehicleId: [],
|
|
vouchervehicledriverName: [],
|
|
vouchervehicletelephone: [],
|
|
vouchervehiclecarrier: [],
|
|
},
|
|
regList: {
|
|
voucherProductList: {
|
|
productId: [],
|
|
spec: [],
|
|
unit: [],
|
|
grossWeight: [],
|
|
tareWeight: [],
|
|
buckleWeight: [],
|
|
netWeight: [],
|
|
clearWeight: [],
|
|
remark: [],
|
|
},
|
|
voucherVehicleList: {
|
|
vehicleId: [],
|
|
driverName: [],
|
|
telephone: [],
|
|
carrier: [],
|
|
},
|
|
},
|
|
ableAll: {},
|
|
childIndex: -1,
|
|
dataValue: {},
|
|
isEdit: false,
|
|
userInfo: {},
|
|
formatType: {
|
|
"yyyy": "yyyy",
|
|
"yyyy-MM": "yyyy-mm",
|
|
"yyyy-MM-dd": "yyyy-mm-dd",
|
|
"yyyy-MM-dd HH:mm": "yyyy-mm-dd hh:MM",
|
|
"yyyy-MM-dd HH:mm:ss": "yyyy-mm-dd hh:MM:ss",
|
|
"HH:mm:ss": "hh:MM:ss",
|
|
"HH:mm": "hh:MM"
|
|
},
|
|
content: '',
|
|
title: '',
|
|
show: false,
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
uni.$on('linkPageConfirm', (subVal) => {
|
|
if (this.tableKey) {
|
|
for (let i = 0; i < subVal.length; i++) {
|
|
let t = subVal[i]
|
|
if (this['get' + this.tableKey]) {
|
|
this['get' + this.tableKey](t)
|
|
}
|
|
}
|
|
this.childIndex = -1
|
|
this.collapse()
|
|
}
|
|
})
|
|
this.jurisdictionType = option.jurisdictionType
|
|
this.menuId = option.menuId
|
|
this.userInfo = uni.getStorageSync('userInfo') || {}
|
|
this.dataForm.id = option.id || 0
|
|
let _title = ""
|
|
if (option.jurisdictionType == 'btn_edit') {
|
|
_title = "编辑"
|
|
}
|
|
if (option.jurisdictionType == 'btn_detail') {
|
|
_title = "详情"
|
|
}
|
|
if (option.jurisdictionType == 'btn_add') {
|
|
_title = "新增"
|
|
}
|
|
if (_title) {
|
|
uni.setNavigationBarTitle({
|
|
title: _title
|
|
})
|
|
}
|
|
this.selfInit()
|
|
this.initDefaultData()
|
|
this.dataAll()
|
|
this.initData()
|
|
this.dataValue = JSON.parse(JSON.stringify(this.dataForm))
|
|
this.idList = option.idList ? option.idList.split(",") : []
|
|
for (let i = 0; i < this.idList.length; i++) {
|
|
if (this.idList[i] == option.id) {
|
|
this.index = i;
|
|
}
|
|
}
|
|
if (!option.id) {
|
|
this.actionList.push({
|
|
text: '确定并新增',
|
|
id: 'save_add'
|
|
})
|
|
} else {
|
|
let upper = {
|
|
text: '上一条',
|
|
id: 'upper',
|
|
disabled: this.index == 0 ? true : false
|
|
}
|
|
this.actionList.push(upper)
|
|
let lower = {
|
|
text: '下一条',
|
|
id: 'lower',
|
|
disabled: this.index == this.idList.length - 1 ? true : false
|
|
}
|
|
this.actionList.push(lower)
|
|
this.actionList.push({
|
|
text: '确定并继续',
|
|
id: 'save_proceed'
|
|
})
|
|
this.collapse()
|
|
}
|
|
},
|
|
onReady() {
|
|
this.$nextTick(() => {
|
|
setTimeout(() => {
|
|
this.$refs.dataForm.setRules(this.rules);
|
|
}, 100)
|
|
})
|
|
},
|
|
watch: {
|
|
dataForm: {
|
|
handler(val, oldVal) {
|
|
this.voucherproduct()
|
|
this.vouchervehicle()
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
methods: {
|
|
//凭证识别
|
|
poundlistUploadSuccess(val, res) {
|
|
if (res && res.data) {
|
|
this.dataForm.poundCode = res.data.deliveryNumber
|
|
this.dataForm.vehicleId = '1'
|
|
this.dataForm.supplierId = res.data.supplierId
|
|
this.dataForm.customerId = res.data.customerId
|
|
if (res.data.vehicleId) {
|
|
this.dataForm.voucherVehicleList.push(res.data)
|
|
}
|
|
let item = {
|
|
productId: '',
|
|
spec: undefined,
|
|
unit: undefined,
|
|
grossWeight: res.data.crossWeight == '' ? 0 : res.data.crossWeight,
|
|
tareWeight: res.data.tareWeight == '' ? 0 : res.data.tareWeight,
|
|
buckleWeight: undefined,
|
|
netWeight: res.data.netWeight == '' ? 0 : res.data.netWeight,
|
|
remark: undefined,
|
|
printTime: undefined,
|
|
}
|
|
item.buckleWeight = this.jnpf.floatSub(this.jnpf.floatSub(item.grossWeight, item.tareWeight), item.netWeight);
|
|
this.dataForm.voucherProductList.push(item)
|
|
} else {
|
|
this.dataForm.poundCode = '';
|
|
this.dataForm.vehicleId = '';
|
|
this.dataForm.supplierId = '';
|
|
this.dataForm.customerId = '';
|
|
this.dataForm.voucherVehicleList = [];
|
|
this.dataForm.voucherProductList = [];
|
|
}
|
|
},
|
|
//选择商品带出信息
|
|
productChangeData(a, b) {
|
|
this.dataForm.voucherProductList[0].spec = b.spec
|
|
if (b.orderMainUnitIds) {
|
|
var unitName = JSON.parse(b.orderMainUnitIds);
|
|
var optArray = [];
|
|
for (let i = 0; i < unitName.length; i++) {
|
|
this.dataForm.voucherProductList[0].unit = unitName[0];
|
|
var opt = {};
|
|
opt.fullName = unitName[i];
|
|
opt.id = unitName[i];
|
|
optArray.push(opt);
|
|
}
|
|
this.dataForm.voucherProductList[0].deliveryproductrelationdeliveryUnitOptions = optArray;
|
|
}
|
|
},
|
|
//子表车牌号赋值
|
|
vehicleChange(val) {
|
|
this.dataForm.voucherVehicleList = []
|
|
let item = {
|
|
vehicleNumber: val
|
|
}
|
|
this.dataForm.voucherVehicleList.push(item)
|
|
},
|
|
//编辑其他重量,更新净重
|
|
UpdateWeight(row) {
|
|
row.netWeight = this.jnpf.floatSub(this.jnpf.floatSub(parseFloat(row.grossWeight), parseFloat(row
|
|
.tareWeight)), parseFloat(row.buckleWeight)) //毛-皮-扣 = 净
|
|
row.clearWeight = row.netWeight
|
|
},
|
|
handleAction(index) {
|
|
if (this.actionList[index].id === 'save_add' || this.actionList[index].id === 'save_proceed') {
|
|
this.submitForm(1)
|
|
} else {
|
|
this.calculation(this.actionList[index].id, index)
|
|
}
|
|
},
|
|
calculation(type, index) {
|
|
if (type === 'upper') {
|
|
this.index--
|
|
this.actionList[index + 1].disabled = false
|
|
if (this.index == 0) this.actionList[index].disabled = true
|
|
} else {
|
|
this.index++
|
|
this.actionList[index - 1].disabled = false
|
|
if (this.index == this.idList.length - 1) this.actionList[index].disabled = true
|
|
}
|
|
this.dataForm.id = this.idList[this.index]
|
|
this.initData()
|
|
},
|
|
changeData(model, index) {
|
|
this.isEdit = false
|
|
this.childIndex = index
|
|
let modelAll = model.split("-");
|
|
let faceMode = "";
|
|
for (let i = 0; i < modelAll.length; i++) {
|
|
faceMode += modelAll[i];
|
|
}
|
|
for (let key in this.interfaceRes) {
|
|
if (key != faceMode) {
|
|
let faceReList = this.interfaceRes[key]
|
|
for (let i = 0; i < faceReList.length; i++) {
|
|
if (faceReList[i].relationField == model) {
|
|
let options = 'get' + key + 'Options';
|
|
if (this[options]) {
|
|
this[options]()
|
|
}
|
|
this.changeData(key, index)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
changeDataFormData(type, data, model, index, defaultValue, edit) {
|
|
if (!edit) {
|
|
if (type == 2) {
|
|
for (let i = 0; i < this.dataForm[data].length; i++) {
|
|
if (index == -1) {
|
|
this.dataForm[data][i][model] = defaultValue
|
|
} else if (index == i) {
|
|
this.dataForm[data][i][model] = defaultValue
|
|
}
|
|
}
|
|
} else {
|
|
this.dataForm[data] = defaultValue
|
|
}
|
|
}
|
|
},
|
|
clickIcon(label, tipLabel) {
|
|
this.content = tipLabel
|
|
this.title = label
|
|
this.show = true
|
|
},
|
|
exist() {
|
|
let title = [];
|
|
let _ruleList = this.ruleList
|
|
for (let k in _ruleList) {
|
|
let childData = this.dataForm[k]
|
|
childData.forEach((item, index) => {
|
|
for (let model in _ruleList[k]) {
|
|
if (item[model] instanceof Array) {
|
|
if (item[model].length == 0) {
|
|
title.push(_ruleList[k][model])
|
|
}
|
|
} else if (!item[model]) {
|
|
title.push(_ruleList[k][model])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
let _regList = this.regList
|
|
for (let k in _regList) {
|
|
let childData = this.dataForm[k]
|
|
for (let n in _regList[k]) {
|
|
for (let i = 0; i < _regList[k][n].length; i++) {
|
|
const element = _regList[k][n][i]
|
|
if (element.pattern) {
|
|
element.pattern = element.pattern.toString()
|
|
let start = element.pattern.indexOf('/')
|
|
let stop = element.pattern.lastIndexOf('/')
|
|
let str = element.pattern.substring(start + 1, stop)
|
|
let reg = new RegExp(str)
|
|
element.pattern = reg
|
|
}
|
|
childData.forEach((item, index) => {
|
|
if (item[n] && !element.pattern.test(item[n])) {
|
|
title.push(element.message)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
if (title.length > 0) {
|
|
return title[0]
|
|
}
|
|
},
|
|
resetForm() {
|
|
uni.navigateBack()
|
|
},
|
|
dataAll() {
|
|
this.collapse()
|
|
},
|
|
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
|
let timeDataValue = null;
|
|
let timeValue = Number(timeValueData)
|
|
if (timeRule) {
|
|
if (timeType == 1) {
|
|
timeDataValue = timeValueData ? timeValue : null
|
|
} else if (timeType == 2) {
|
|
timeDataValue = dataValue
|
|
} else if (timeType == 3) {
|
|
timeDataValue = new Date().getTime()
|
|
} else if (timeType == 4) {
|
|
let previousDate = '';
|
|
if (timeTarget == 1 || timeTarget == 2) {
|
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
} else if (timeTarget == 3) {
|
|
previousDate = getBeforeData(timeValue)
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
} else {
|
|
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
|
}
|
|
} else if (timeType == 5) {
|
|
let previousDate = '';
|
|
if (timeTarget == 1 || timeTarget == 2) {
|
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
} else if (timeTarget == 3) {
|
|
previousDate = getLaterData(timeValue)
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
} else {
|
|
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
|
}
|
|
}
|
|
}
|
|
return timeDataValue;
|
|
},
|
|
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
|
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
|
let timeDataValue = null
|
|
if (timeRule) {
|
|
if (timeType == 1 && timeValue) {
|
|
timeDataValue = timeValue || '00:00:00'
|
|
if (timeDataValue.split(':').length == 3) {
|
|
timeDataValue = timeDataValue
|
|
} else {
|
|
timeDataValue = timeDataValue + ':00'
|
|
}
|
|
} else if (timeType == 2) {
|
|
timeDataValue = dataValue
|
|
} else if (timeType == 3) {
|
|
timeDataValue = this.jnpf.toDate(new Date(), format)
|
|
} else if (timeType == 4) {
|
|
let previousDate = '';
|
|
previousDate = getBeforeTime(timeTarget, timeValue)
|
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
|
} else if (timeType == 5) {
|
|
let previousDate = '';
|
|
previousDate = getLaterTime(timeTarget, timeValue)
|
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
|
}
|
|
}
|
|
return timeDataValue;
|
|
},
|
|
voucherproduct() {
|
|
let table = this.dataForm.voucherProductList
|
|
let summaryField = []
|
|
let summaryFieldName = {}
|
|
let data = {}
|
|
let thousandsField = []
|
|
for (let i in summaryField) {
|
|
let map = {}
|
|
let val = 0
|
|
for (let j = 0; j < table.length; j++) {
|
|
let summary = table[j][summaryField[i]];
|
|
if (summary) {
|
|
let data = isNaN(summary) ? 0 : Number(summary)
|
|
val += data
|
|
}
|
|
}
|
|
map.id = summaryField[i];
|
|
map.name = summaryFieldName[summaryField[i]];
|
|
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
|
|
maximumFractionDigits: '2'
|
|
}) : val;
|
|
data[summaryField[i]] = map;
|
|
}
|
|
return data;
|
|
},
|
|
vouchervehicle() {
|
|
let table = this.dataForm.voucherVehicleList
|
|
let summaryField = []
|
|
let summaryFieldName = {}
|
|
let data = {}
|
|
let thousandsField = []
|
|
for (let i in summaryField) {
|
|
let map = {}
|
|
let val = 0
|
|
for (let j = 0; j < table.length; j++) {
|
|
let summary = table[j][summaryField[i]];
|
|
if (summary) {
|
|
let data = isNaN(summary) ? 0 : Number(summary)
|
|
val += data
|
|
}
|
|
}
|
|
map.id = summaryField[i];
|
|
map.name = summaryFieldName[summaryField[i]];
|
|
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
|
|
maximumFractionDigits: '2'
|
|
}) : val;
|
|
data[summaryField[i]] = map;
|
|
}
|
|
return data;
|
|
},
|
|
initData() {
|
|
this.$nextTick(function() {
|
|
if (this.dataForm.id) {
|
|
this.loading = true
|
|
request({
|
|
url: '/api/scm/Voucher/' + this.dataForm.id,
|
|
method: 'get',
|
|
}).then(res => {
|
|
this.dataInfo(res.data)
|
|
this.loading = false
|
|
})
|
|
} else {
|
|
this.initDefaultData()
|
|
}
|
|
})
|
|
},
|
|
beforeSubmit() {
|
|
const _data = this.dataList()
|
|
return _data
|
|
},
|
|
submitForm(type) {
|
|
var _data = this.dataList()
|
|
this.$refs.dataForm.validate(valid => {
|
|
if (!valid) return
|
|
if (!!this.exist()) return this.$u.toast(
|
|
this.exist()
|
|
)
|
|
var flag = false
|
|
_data.voucherProductList.forEach(e => {
|
|
var tareWeight = e.tareWeight;//皮重
|
|
var grossWeight = e.grossWeight;//毛重
|
|
var buckleWeight = e.buckleWeight;//扣重
|
|
var netWeight = e.netWeight;//净重
|
|
if (grossWeight < this.jnpf.floatAdd(this.jnpf.floatAdd(tareWeight, buckleWeight), netWeight)) {
|
|
uni.showToast({
|
|
title: '毛重不得小于皮重+扣重+净重',
|
|
icon: 'none'
|
|
})
|
|
flag = true
|
|
return
|
|
}
|
|
if (buckleWeight >= netWeight) {
|
|
uni.showToast({
|
|
title: '扣重不得大于净重',
|
|
icon: 'none'
|
|
})
|
|
flag = true
|
|
return
|
|
}
|
|
if (buckleWeight >= grossWeight) {
|
|
uni.showToast({
|
|
title: '扣重不得大于毛重',
|
|
icon: 'none'
|
|
})
|
|
flag = true
|
|
return
|
|
}
|
|
})
|
|
if(flag){
|
|
return
|
|
}
|
|
this.btnLoading = true
|
|
if (this.dataForm.id) {
|
|
request({
|
|
url: '/api/scm/Voucher/' + this.dataForm.id,
|
|
method: 'put',
|
|
data: _data,
|
|
}).then(res => {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
complete: () => {
|
|
setTimeout(() => {
|
|
if (type != 1) {
|
|
uni.$emit('refresh')
|
|
uni.navigateBack()
|
|
}
|
|
this.btnLoading = false
|
|
}, 1500)
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.btnLoading = false
|
|
})
|
|
} else {
|
|
request({
|
|
url: '/api/scm/Voucher',
|
|
method: 'post',
|
|
data: _data,
|
|
}).then(res => {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
complete: () => {
|
|
setTimeout(() => {
|
|
if (type == 1) {
|
|
this.dataForm = JSON.parse(JSON.stringify(
|
|
this.dataValue))
|
|
this.initDefaultData()
|
|
} else {
|
|
uni.$emit('refresh')
|
|
uni.navigateBack()
|
|
}
|
|
this.btnLoading = false
|
|
}, 1500)
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.btnLoading = false
|
|
})
|
|
}
|
|
});
|
|
},
|
|
initDefaultData() {
|
|
this.dataForm.preparationTime = new Date().getTime()
|
|
},
|
|
selfInit() {
|
|
this.$store.commit('base/UPDATE_RELATION_DATA', {})
|
|
},
|
|
selfGetInfo(dataForm) {
|
|
this.dataForm.id = this.dataForm.id
|
|
this.dataInfo(dataForm)
|
|
},
|
|
addvoucherproductList() {
|
|
let value = {}
|
|
this.tableKey = 'voucherProductList';
|
|
this.getvoucherproductList(value)
|
|
this.childIndex = -1
|
|
this.collapse()
|
|
},
|
|
delvoucherproductList(index) {
|
|
var that = this
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确认删除该条信息吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.dataForm.voucherProductList.splice(index, 1);
|
|
that.collapse()
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getvoucherproductList(value) {
|
|
let item = {
|
|
productId: "",
|
|
spec: '',
|
|
unit: '',
|
|
grossWeight: 0,
|
|
tareWeight: 0,
|
|
buckleWeight: 0,
|
|
netWeight: 0,
|
|
clearWeight: 0,
|
|
remark: '',
|
|
}
|
|
let result = {
|
|
...item,
|
|
...value
|
|
}
|
|
this.dataForm.voucherProductList.push(result)
|
|
this.childIndex = this.dataForm.voucherProductList.length - 1
|
|
this.isEdit = true
|
|
this.isEdit = false
|
|
},
|
|
addvouchervehicleList() {
|
|
let value = {}
|
|
this.tableKey = 'voucherVehicleList';
|
|
this.getvouchervehicleList(value)
|
|
this.childIndex = -1
|
|
this.collapse()
|
|
},
|
|
delvouchervehicleList(index) {
|
|
var that = this
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确认删除该条信息吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.dataForm.voucherVehicleList.splice(index, 1);
|
|
that.collapse()
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getvouchervehicleList(value) {
|
|
let item = {
|
|
vehicleId: "",
|
|
driverName: '',
|
|
telephone: '',
|
|
carrier: '',
|
|
}
|
|
let result = {
|
|
...item,
|
|
...value
|
|
}
|
|
this.dataForm.voucherVehicleList.push(result)
|
|
this.childIndex = this.dataForm.voucherVehicleList.length - 1
|
|
this.isEdit = true
|
|
this.isEdit = false
|
|
},
|
|
dataList() {
|
|
var _data = this.dataForm;
|
|
return _data;
|
|
},
|
|
dataInfo(dataAll) {
|
|
let _dataAll = dataAll
|
|
this.dataForm = _dataAll
|
|
this.isEdit = true
|
|
this.dataAll()
|
|
for (let i = 0; i < _dataAll.voucherProductList.length; i++) {
|
|
this.childIndex = i
|
|
}
|
|
for (let i = 0; i < _dataAll.voucherVehicleList.length; i++) {
|
|
this.childIndex = i
|
|
}
|
|
this.childIndex = -1
|
|
this.collapse()
|
|
},
|
|
collapse() {
|
|
setTimeout(() => {}, 1000);
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style>
|
|
page {
|
|
background-color: #f0f2f6;
|
|
}
|
|
</style> |