| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060 |
- <template>
- <el-form :model="form" ref="form">
- <ele-pro-table
- ref="table"
- :needPage="false"
- :columns="columns"
- :toolkit="[]"
- max-height="500px"
- :span-method="objectSpanMethod"
- :datasource="form.resultList"
- cache-key="systemRoleTable17"
- class="time-form"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-row type="flex" justify="end" align="middle">
- <el-popconfirm
- class="ele-action"
- title="确定要删除吗?"
- @confirm="removeSupplier"
- v-if="status !== 'Detail'"
- >
- <template v-slot:reference>
- <el-link
- type="danger"
- title="删除供应商"
- :underline="false"
- icon="el-icon-delete"
- >
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </el-row>
- </template>
- <template v-slot:supplierName="{ row, $index }">
- {{ form.supplierName }}
- </template>
- <template v-slot:supplierTotalPrice="{ row, $index }">
- {{ form.totalPrice }}
- </template>
- <template v-slot:preferentialPrice="{ row, $index }">
- <el-form-item
- prop="preferentialPrice"
- :rules="{
- required: true,
- message: '请输入优惠价',
- trigger: 'blur'
- }"
- >
- <el-input
- v-model="form.preferentialPrice"
- :disabled="status == 'Detail'"
- type="number"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:settlementMode="{ row, $index }">
- <el-form-item prop="settlementMode">
- <DictSelection
- dictName="结算方式"
- clearable
- v-model="form.settlementMode"
- @itemChange="chaengMode"
- :disabled="status == 'Detail'"
- >
- </DictSelection>
- </el-form-item>
- </template>
- <template v-slot:deliveryDate="{ row, $index }">
- <el-form-item
- prop="deliveryDate"
- :rules="{
- required: true,
- message: '请选择交货日期',
- trigger: 'change'
- }"
- >
- <el-date-picker
- style="width: 100%"
- clearable
- type="date"
- :disabled="status == 'Detail'"
- v-model="form.deliveryDate"
- value-format="yyyy-MM-dd"
- placeholder="请选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </template>
- <template v-slot:taxRate="{ row, $index }">
- <el-form-item>
- <el-input
- v-model="row.taxRate"
- style="width: 100%"
- :disabled="status == 'Detail'"
- @input="getNotaxSinglePrice"
- >
- <template slot="suffix">%</template>
- </el-input>
- </el-form-item>
- </template>
- <template v-slot:files="{ row, $index }">
- <el-form-item prop="files">
- <fileMain
- v-model="form.files"
- :type="status == 'Detail' ? 'view' : ''"
- ></fileMain>
- </el-form-item>
- </template>
- <template v-slot:isWinner="{ row, $index }">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + $index + '.isWinner'"
- :rules="{
- required: true,
- message: '请输入',
- trigger: 'change'
- }"
- >
- <el-select v-model="row.isWinner" :disabled="status == 'Detail'">
- <el-option label="是" :value="1"></el-option>
- <el-option label="否" :value="0"></el-option>
- </el-select>
- </el-form-item>
- </template>
- <template v-slot:supplierProductName="{ row, $index }">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + $index + '.supplierProductName'"
- :rules="{
- required: true,
- message: '请输入',
- trigger: 'change'
- }"
- >
- <el-input
- v-model="row.supplierProductName"
- placeholder="请输入"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:supplierProductCode="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.supplierProductCode'"
- :rules="{
- required: false,
- message: '请输入',
- trigger: 'blur'
- }"
- >
- <el-input
- v-model="scope.row.supplierProductCode"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:deliveryDays="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.deliveryDays'"
- >
- <el-input
- v-model="scope.row.deliveryDays"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:guaranteePeriod="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.guaranteePeriod'"
- >
- <el-input
- v-model="scope.row.guaranteePeriod"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:guaranteePeriodUnitCode="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.guaranteePeriodUnitCode'"
- >
- <DictSelection
- dictName="质保期单位"
- clearable
- v-model="scope.row.guaranteePeriodUnitCode"
- :disabled="status == 'Detail'"
- @itemChange="chaengUnitCode"
- >
- </DictSelection>
- </el-form-item>
- </template>
- <template v-slot:singlePrice="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.singlePrice'"
- :rules="{
- required: true,
- message: '请输入',
- trigger: 'change'
- }"
- >
- <el-input
- @input="changeCount(scope.row, scope.$index)"
- v-model="scope.row.singlePrice"
- :disabled="status == 'Detail'"
- type="number"
- >
- <template slot="suffix">元</template>
- </el-input>
- </el-form-item>
- </template>
- <template v-slot:notaxSinglePrice="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.notaxSinglePrice'"
- >
- <el-input
- v-model="scope.row.notaxSinglePrice"
- placeholder="请输入"
- type="number"
- :disabled="status == 'Detail'"
- >
- <template slot="append">元</template>
- </el-input>
- </el-form-item>
- </template>
- <template v-slot:totalCount="scope">
- <el-form-item
- :prop="'resultList.' + scope.$index + '.totalCount'"
- :rules="{
- required: true,
- pattern: numberReg,
- message: '请输入数字',
- trigger: 'blur'
- }"
- >
- <el-input
- @input="changeCount(scope.row, scope.$index)"
- v-model="scope.row.totalCount"
- :disabled="status == 'Detail'"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:totalPrice="scope">
- <span>{{
- totalPrice(scope.row.totalCount, scope.row.singlePrice, scope.row)
- }}</span>
- </template>
- <template v-slot:modelType="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.modelType'"
- >
- <el-input
- v-model="scope.row.modelType"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:specification="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.specification'"
- >
- <el-input
- v-model="scope.row.specification"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <!-- <template v-slot:measuringUnit="scope">-->
- <!-- <el-form-item-->
- <!-- style="margin-bottom: 20px"-->
- <!-- :prop="'resultList.' + scope.$index + '.measuringUnit'"-->
- <!-- :rules="{-->
- <!-- required: false,-->
- <!-- message: '请输入',-->
- <!-- trigger: 'blur'-->
- <!-- }"-->
- <!-- >-->
- <!-- <el-input-->
- <!-- v-model="scope.row.measuringUnit"-->
- <!-- placeholder="请输入"-->
- <!-- :disabled="true"-->
- <!-- ></el-input>-->
- <!-- </el-form-item>-->
- <!-- </template>-->
- <template v-slot:remark="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.remark'"
- >
- <el-input
- v-model="scope.row.remark"
- type="textarea"
- placeholder="请输入"
- :disabled="status == 'Detail'"
- ></el-input>
- </el-form-item>
- </template>
- <template v-slot:provenance="scope">
- <el-form-item :prop="'resultList.' + scope.$index + '.provenance'">
- <DictSelection
- dictName="产地"
- clearable
- :disabled="status == 'Detail'"
- v-model="scope.row.provenance"
- multiple
- >
- </DictSelection>
- </el-form-item>
- </template>
- <template v-slot:isRequired="{ column }">
- <span class="is-required">{{ column.label }}</span>
- </template>
- <template v-slot:purchaseCount="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.purchaseCount'"
- :rules="{
- required: true,
- message: '请输入数量',
- trigger: 'change'
- }"
- >
- <el-input
- v-model="scope.row.purchaseCount"
- placeholder="请输入"
- type="number"
- :disabled="status == 'Detail'"
- :min="0"
- @input="changeCount(scope.row, scope.$index)"
- >
- </el-input>
- </el-form-item>
- </template>
- <template v-slot:purchaseUnit="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'resultList.' + scope.$index + '.purchaseUnitId'"
- >
- <el-select
- v-model="scope.row.purchaseUnitId"
- style="width: 100%"
- :disabled="status == 'Detail'"
- @change="changeCount(scope.row, scope.$index)"
- >
- <el-option
- :label="item.conversionUnit"
- :value="item.id"
- @click.native="packingChange(item, scope.$index)"
- v-for="(item, index) in scope.row.packageDispositionList"
- :key="index"
- ></el-option>
- </el-select>
- </el-form-item>
- </template>
- </ele-pro-table>
- </el-form>
- </template>
- <script>
- import { numberReg } from 'ele-admin';
- import dictMixins from '@/mixins/dictMixins';
- import fileUpload from '@/components/upload/fileUpload';
- import { copyObj } from '@/utils/util';
- import { getFile } from '@/api/system/file';
- // import fileMain from '@/components/addDoc/index.vue';
- import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
- import { listByContactId } from '@/api/bpm/components/saleManage/contact';
- // import headList from '@/views/saleManage/businessOpportunity/components/headList.vue';
- import { levelList } from '@/enum/dict.js';
- import { changeCount } from '@/BIZComponents/setProduct.js';
- const defaultColumns = [
- {
- width: 50,
- label: '序号',
- type: 'index',
- columnKey: 'index',
- align: 'center',
- fixed: 'left'
- },
- {
- minWidth: 120,
- prop: 'supplierName',
- label: '供应商',
- slot: 'supplierName',
- align: 'center',
- showOverflowTooltip: true,
- isMerge: true,
- fixed: 'left'
- },
- {
- minWidth: 80,
- prop: 'supplierTotalPrice',
- label: '总价',
- slot: 'supplierTotalPrice',
- align: 'center',
- showOverflowTooltip: true,
- isMerge: true,
- fixed: 'left'
- },
- {
- minWidth: 140,
- prop: 'preferentialPrice',
- label: '优惠后总价',
- slot: 'preferentialPrice',
- headerSlot: 'isRequired',
- align: 'center',
- showOverflowTooltip: true,
- isMerge: true,
- fixed: 'left'
- },
- {
- minWidth: 120,
- prop: 'settlementMode',
- label: '结算方式',
- slot: 'settlementMode',
- headerSlot: 'isRequired',
- align: 'center',
- showOverflowTooltip: true,
- isMerge: true,
- fixed: 'left'
- },
- {
- minWidth: 160,
- prop: 'deliveryDate',
- label: '交货日期',
- slot: 'deliveryDate',
- headerSlot: 'isRequired',
- align: 'center',
- showOverflowTooltip: true,
- isMerge: true,
- fixed: 'left'
- },
- {
- minWidth: 100,
- prop: 'productCode',
- label: '编码',
- slot: 'productCode',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'productName',
- label: '产品名称',
- slot: 'productName',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'isWinner',
- label: '是否中标',
- slot: 'isWinner',
- align: 'center',
- headerSlot: 'isRequired',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'supplierProductCode',
- label: '供应商产品编码',
- slot: 'supplierProductCode',
- align: 'center'
- },
- {
- minWidth: 160,
- prop: 'supplierProductName',
- label: '供应商产品名称',
- slot: 'supplierProductName',
- headerSlot: 'isRequired',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'goodsLevel',
- label: '物品级别',
- formatter: (_row, _column, cellValue) => {
- return levelList.find((item) => item.value == _row.goodsLevel)?.label;
- },
- align: 'center'
- },
- {
- minWidth: 130,
- prop: 'reqTotalCount',
- label: '需求数量',
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- width: 150,
- prop: 'purchaseCount',
- label: '数量',
- slot: 'purchaseCount',
- headerSlot: 'headerTotalCount',
- align: 'center'
- },
- {
- width: 150,
- prop: 'purchaseUnit',
- label: '单位',
- slot: 'purchaseUnit',
- align: 'center'
- },
- {
- width: 120,
- prop: 'packingSpecification',
- align: 'center',
- label: '包装规格',
- showOverflowTooltip: true
- },
- {
- minWidth: 90,
- prop: 'totalCount',
- label: '购买数量',
- // slot: 'totalCount',
- // headerSlot: 'isRequired',
- align: 'center'
- },
- {
- minWidth: 80,
- prop: 'availableCountBase',
- label: '库存数量',
- slot: 'availableCountBase',
- align: 'center'
- },
- {
- minWidth: 80,
- prop: 'measuringUnit',
- label: '单位',
- slot: 'measuringUnit',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'modelType',
- label: '型号',
- slot: 'modelType',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'specification',
- label: '规格',
- slot: 'specification',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'minimumOrderQuantity',
- label: '最低订购量',
- align: 'center'
- },
- {
- minWidth: 80,
- prop: 'doneTotalCount',
- label: '已采数量',
- align: 'center'
- },
- {
- minWidth: 80,
- prop: 'waitTotalCount',
- label: '待采数量',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'singlePrice',
- label: '采购单价',
- slot: 'singlePrice',
- headerSlot: 'isRequired',
- align: 'center'
- },
- {
- width: 180,
- prop: 'notaxSinglePrice',
- label: '不含税单价',
- // slot: 'notaxSinglePrice',
- align: 'center'
- },
- {
- minWidth: 80,
- prop: 'totalPrice',
- label: '采购金额',
- slot: 'totalPrice',
- align: 'center'
- },
- {
- minWidth: 150,
- prop: 'taskName',
- label: '工序',
- slot: 'taskName',
- align: 'center'
- },
- {
- width: 110,
- prop: 'batchNo',
- label: '批次号',
- slot: 'batchNo',
- align: 'center'
- },
- {
- prop: 'provenance',
- label: '产地',
- slot: 'provenance',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- minWidth: 80,
- prop: 'deliveryDays',
- label: '交期(天)',
- slot: 'deliveryDays',
- align: 'center'
- },
- {
- minWidth: 100,
- prop: 'guaranteePeriod',
- label: '有效期',
- slot: 'guaranteePeriod',
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'guaranteePeriodUnitCode',
- label: '有效期单位',
- slot: 'guaranteePeriodUnitCode',
- align: 'center'
- },
- {
- minWidth: 220,
- prop: 'remark',
- label: '备注',
- slot: 'remark',
- align: 'center'
- },
- {
- minWidth: 90,
- prop: 'taxRate',
- label: '税率',
- slot: 'taxRate',
- align: 'center',
- // isMerge: true,
- showOverflowTooltip: true
- },
- {
- minWidth: 220,
- prop: 'files',
- label: '附件',
- slot: 'files',
- align: 'center',
- isMerge: true,
- showOverflowTooltip: true
- }
- ];
- export default {
- mixins: [dictMixins],
- components: {
- // fileMain,
- fileUpload
- // headList
- },
- props: {
- obj: {},
- status: {
- default: 'edit'
- },
- radio: {
- default: ''
- },
- isUpdate: {
- default: false
- }
- },
- data() {
- const defaultForm = {
- key: null,
- endTime: '',
- isFirst: 0,
- name: ''
- };
- return {
- numberReg,
- defaultForm,
- radio1: '',
- form: {
- resultList: [
- {
- supplierProductCode: '',
- deliveryDays: '',
- guaranteePeriod: '',
- guaranteePeriodUnitCode: '',
- guaranteePeriodUnitName: '',
- measuringUnit: '',
- modelType: '',
- productCode: '',
- isWinner: '',
- remark: '',
- singlePrice: '',
- specification: '',
- supplierProductName: '',
- technicalAnswerName: '',
- technicalParams: '',
- totalCount: '',
- totalPrice: ''
- }
- ]
- },
- dataList: [],
- spanArr: [],
- columns: [...defaultColumns]
- };
- },
- computed: {},
- watch: {
- radio(n, v) {
- this.radio1 = n;
- }
- },
- created() {
- this.obj.resultList.forEach((item) => {
- this.obj['deliveryDate'] =
- this.obj.deliveryDate || item.expectReceiveDate;
- });
- this.form = copyObj(this.obj);
- console.log(this.obj);
- this.radio1 = this.radio;
- this.getSpanArr();
- this.setDeliveryDays();
- this.setIsInquiry();
- this.getInventoryTotalAPI();
- this.getListByContactId();
- },
- methods: {
- //计算交期
- setDeliveryDays() {
- this.form.resultList.forEach((item, index) => {
- let day =
- this.form.deliveryDate &&
- (new Date(this.form.deliveryDate).getTime() -
- new Date().getTime()) /
- 1000 /
- 60 /
- 60 /
- 24;
- this.$set(
- this.form.resultList[index],
- 'deliveryDays',
- Math.ceil(day) || 1
- );
- });
- this.$forceUpdate();
- },
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
- if (this.columns[columnIndex]?.isMerge) {
- const _row = this.spanArr[rowIndex]?.supplierName || 0;
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- return {
- rowspan: 1,
- colspan: 1
- };
- },
- async getInventoryTotalAPI() {
- let codeList = this.form.resultList.map((item) => item.productCode);
- //获取仓库库存
- let inventoryTotalList = await getInventoryTotalAPI(codeList);
- this.form.resultList.forEach((item, index) => {
- let find =
- inventoryTotalList.find((key) => key.code == item.productCode) ||
- {};
- // item.availableCountBase = find.availableCountBase;
- this.$set(
- this.form.resultList[index],
- 'availableCountBase',
- find.availableCountBase
- );
- });
- },
- //获取最新订购量
- async getListByContactId() {
- let productIds = this.form.resultList
- .filter((item) => item.productId)
- .map((item) => item.productId);
- if (productIds?.length > 0) {
- const data = await listByContactId({
- contactId: this.form.supplierId,
- productIds
- });
- this.form.resultList
- .filter((item) => item.productCode)
- .forEach((item, index) => {
- let pData = data.find((val) => val.productId == item.productId);
- if (pData) {
- this.$set(
- this.form.resultList[index],
- 'minimumOrderQuantity',
- pData.minimumOrderQuantity
- );
- }
- });
- }
- },
- getSpanArr() {
- let pos = 0;
- this.spanArr = [];
- this.form.resultList.forEach((item, index) => {
- // item.guaranteePeriodUnitCode = Number(item.guaranteePeriodUnitCode);
- // console.log(item.guaranteePeriodUnitCode,'item.guaranteePeriodUnitCode')
- if (index === 0) {
- let obj = {};
- this.columns.forEach((col) => {
- if (col.isMerge) {
- obj[col.prop] = 1;
- }
- });
- this.spanArr.push(obj);
- } else {
- let nameSame =
- item.supplierName ===
- this.form.resultList[index - 1].supplierName;
- if (nameSame) {
- this.spanArr[pos].supplierName += 1;
- this.spanArr.push({
- supplierName: 0,
- supplierTotalPrice: 0,
- preferentialPrice: 0,
- settlementMode: '4',
- taxRate: 0,
- files: 0,
- deliveryDate: 0
- });
- } else {
- pos = index;
- let obj = {};
- this.columns.forEach((col) => {
- if (col.isMerge) {
- obj[col.prop] = 1;
- }
- });
- this.spanArr.push(obj);
- }
- // let totalPriceSame = item.totalPrice === this.form.resultList[index - 1].totalPrice;
- // if (totalPriceSame) {
- // this.spanArr[pos].totalPrice += 1;
- // this.spanArr.push({ totalPrice: 0 });
- // } else {
- // pos = index;
- // this.spanArr.push({ totalPrice: 1 });
- // }
- }
- });
- },
- setIsInquiry() {
- return;
- this.$emit('setIsInquiry');
- },
- deliveryDateChange(row) {
- this.$emit('deliveryDateChange', (data) => {
- let is = false;
- if (data.length > 0) {
- data.forEach((item) => {
- if (
- new Date(this.form.deliveryDate).getTime() >
- new Date(item.expectReceiveDate).getTime()
- ) {
- is = true;
- }
- });
- }
- if (is) {
- this.$message.error('交货日期大于到货日期');
- }
- });
- this.setDeliveryDays();
- },
- packingChange(item, index) {
- this.$set(
- this.form.resultList[index],
- 'purchaseUnit',
- item.conversionUnit
- );
- },
- //改变数量
- changeCount(row, index) {
- this.$set(
- this.form,
- 'resultList[' + index + ']',
- changeCount(row, {
- countKey: 'purchaseCount',
- unitKey: 'purchaseUnit',
- unitIdKey: 'purchaseUnitId'
- })
- );
- this.getNotaxSinglePrice();
- this.$forceUpdate();
- },
- //计算不含税单价
- getNotaxSinglePrice() {
- this.form.resultList.forEach((item, index) => {
- if (item.singlePrice && item.taxRate) {
- this.$set(
- this.form.resultList[index],
- 'notaxSinglePrice',
- parseFloat(
- (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
- )
- );
- } else {
- this.$set(this.form.resultList[index], 'notaxSinglePrice', '');
- }
- });
- },
- // changeGetPrice(row) {
- // if (row.singlePrice && row.totalCount) {
- // let num = 0;
- // this.form.resultList.forEach((item) => {
- // num += item.totalPrice || 0;
- // });
- // this.form.preferentialPrice = parseFloat(num.toFixed(2));
- // }
- // },
- //计算销售金额
- totalPrice(a, b, row) {
- if (!a || !b) {
- return;
- }
- row.totalPrice = parseFloat((a * b).toFixed(2));
- this.totalPriceAll();
- return row.totalPrice;
- },
- //计算销售总价
- totalPriceAll() {
- let num = 0;
- this.form.resultList.forEach((item) => {
- num += item.totalPrice || 0;
- });
- this.form.totalPrice = parseFloat(num.toFixed(2));
- // this.form.preferentialPrice = parseFloat(num.toFixed(2));
- // console.log(this.form.resultList,'dasdasd')
- },
- // 返回列表数据
- getTableValue() {
- return this.form;
- },
- chaengMode(data) {
- this.form.settlementModeName = data.dictValue;
- },
- chaengUnitCode(data) {
- this.form.settlementModeName = data.dictValue;
- },
- //修改回显
- putTableValue(data) {
- this.form.resultList = copyObj(data);
- this.setDeliveryDays();
- this.setIsInquiry();
- },
- remove(productCode) {
- let index = this.form.resultList.findIndex(
- (item) => item.productCode == productCode
- );
- this.form.resultList.splice(index, 1);
- this.setIsInquiry();
- this.setSort();
- },
- removeSupplier() {
- this.$emit('removeSupplier', this.form.supplierId);
- },
- // 重新排序
- setSort() {
- this.form.resultList.forEach((n, index) => {
- n.key = index + 1;
- });
- },
- validateForm(callback) {
- //开始表单校验
- this.$refs.form.validate((valid) => {
- callback(valid);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .headbox {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .amount {
- font-size: 14px;
- font-weight: bold;
- }
- }
- .time-form .el-form-item {
- margin-bottom: 0 !important;
- }
- ::v-deep .period {
- display: flex;
- .borderleftnone {
- .el-input--medium .el-input__inner {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- }
- .borderrightnone {
- .el-input--medium .el-input__inner {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- }
- }
- }
- ::v-deep .time-form tbody > tr:hover > td {
- background-color: transparent !important;
- }
- ::v-deep .time-form .el-table tr {
- background-color: #ffffff;
- }
- ::v-deep .el-upload-list--text {
- width: 75%;
- }
- </style>
|