|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<div v-show="viewState == 1">
|
|
|
|
<div class="tab-header webtop">
|
|
|
|
<!-- 标题 -->
|
|
|
|
<div>{{title}}采购订单</div>
|
|
|
|
<!-- start 添加修改按钮 -->
|
|
|
|
<div>
|
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
|
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
|
|
|
</div>
|
|
|
|
<!-- end 添加修改按钮 -->
|
|
|
|
<!-- end 详情按钮 -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="listconadd">
|
|
|
|
|
|
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
|
|
|
|
<!-- <div class="title">
|
|
|
|
<div>基础信息</div>
|
|
|
|
</div> -->
|
|
|
|
<el-row class="first_row">
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">制单人</div>
|
|
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">制单部门</div>
|
|
|
|
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">制单日期</div>
|
|
|
|
<el-form-item>
|
|
|
|
<el-date-picker v-model="formobj.createTime" type="date" class="addinputw addinputInfo"
|
|
|
|
value-format="yyyy-MM-dd" placeholder="选择日期">
|
|
|
|
</el-date-picker></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty"><span class="must">*</span> 供应商</div>
|
|
|
|
<el-form-item prop="supplierName"> <el-select v-model="formobj.supplierName" filterable clearable
|
|
|
|
placeholder="请选择供应商" class="addinputw addinputInfo" @change="supplierNameSelect">
|
|
|
|
<el-option v-for="(item,index ) in supplierList" :key="index" :label="item.supplierName"
|
|
|
|
:value="item.sid">
|
|
|
|
</el-option>
|
|
|
|
</el-select></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty"><span class="must">*</span> 收货仓库</div>
|
|
|
|
<el-form-item prop="wareHouseName">
|
|
|
|
<el-select v-model="formobj.wareHouseName" placeholder="请选择收货仓库" class="addinputw addinputInfo"
|
|
|
|
@change="selectWarehouseName">
|
|
|
|
<el-option v-for="(item,index ) in warehouseList" :key="index" :label="item.warehouseName"
|
|
|
|
:value="item.sid" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty"><span class="must">*</span> 业务员</div>
|
|
|
|
<el-form-item prop="purchaserName">
|
|
|
|
<el-select v-model="formobj.purchaserName" filterable clearable placeholder="请选择业务员"
|
|
|
|
class="addinputw addinputInfo" @change="allOrgperSelect">
|
|
|
|
<el-option v-for="(item,index ) in allOrgperList" :key="index" :label="item.name" :value="item.sid">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="16">
|
|
|
|
<div class="span-sty">银行账号</div>
|
|
|
|
<el-form-item prop="bankAccount"> <el-input class="addinputw addinputInfo"
|
|
|
|
v-model="formobj.purchaseBillAmount.bankAccount" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" /></el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">货币类别</div>
|
|
|
|
<el-form-item prop="currencyValue">
|
|
|
|
<el-select v-model="formobj.purchaseBillAmount.currencyValue" placeholder="请选择货币类别"
|
|
|
|
class="addinputw addinputInfo" @change="selectCurrency">
|
|
|
|
<el-option v-for="(item,index) in currencyTypeList" :key="index" :label="item.dictValue"
|
|
|
|
:value="item.dictKey" />
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">采购运费</div>
|
|
|
|
<el-form-item prop="freight"> <el-input class="addinputw addinputInfo"
|
|
|
|
v-model="formobj.purchaseBillAmount.freight" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">运费分摊方式</div>
|
|
|
|
<el-form-item prop="freightShareTypeValue">
|
|
|
|
<el-select v-model="formobj.purchaseBillAmount.freightShareTypeValue" placeholder="请选择分摊方式"
|
|
|
|
class="addinputw addinputInfo" @change="selectFreightShareType">
|
|
|
|
<el-option v-for="(item,index ) in shareTypeList" :key="index" :label="item.dictValue"
|
|
|
|
:value="item.dictKey" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty"> 结算账户</div>
|
|
|
|
<el-form-item prop="settleAccountValue">
|
|
|
|
<el-select v-model="formobj.purchaseBillAmount.settleAccountValue" filterable clearable
|
|
|
|
placeholder="请选择结算账户" class="addinputw addinputInfo" @change="selectSettleAccount">
|
|
|
|
<el-option v-for="(item,index ) in settlementList" :key="index" :label="item.dictValue"
|
|
|
|
:value="item.dictKey" />
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">其他费用</div>
|
|
|
|
<el-form-item prop="otherAmountName"> <el-input class="addinputw addinputInfo"
|
|
|
|
v-model="formobj.purchaseBillAmount.otherAmountName" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">其他费用分摊方式</div>
|
|
|
|
<el-form-item prop="otherShareTypeValue">
|
|
|
|
<el-select v-model="formobj.purchaseBillAmount.otherShareTypeValue" placeholder="请选择分摊方式"
|
|
|
|
class="addinputw addinputInfo" @change="selectOtherShareType">
|
|
|
|
<el-option v-for="(item,index ) in shareTypeList" :key="index" :label="item.dictValue"
|
|
|
|
:value="item.dictKey" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty">预付金额</div>
|
|
|
|
<el-form-item prop="prepayment"> <el-input class="addinputw addinputInfo"
|
|
|
|
v-model="formobj.purchaseBillAmount.prepayment" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
|
|
|
|
<el-col :span="24">
|
|
|
|
<div class="span-sty">附件</div>
|
|
|
|
<el-form-item prop="imgList">
|
|
|
|
<upload-img ref="uploadImg" class="addinputw" v-model="imgList" :limit="50" bucket="map"
|
|
|
|
:upload-data="{ type: '0001' }" @change="backData2" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="24">
|
|
|
|
<div class="span-sty">备注</div>
|
|
|
|
<el-form-item> <el-input v-model="formobj.remarks" placeholder="" class="addinputw addinputInfo"
|
|
|
|
type="textarea" :rows="4" clearable /></el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<div class="title titleOne">
|
|
|
|
<div>商品列表</div>
|
|
|
|
<el-button type="primary" size="mini" class="btntopblueline" @click="goodsAdd()">添加</el-button>
|
|
|
|
</div>
|
|
|
|
<el-table v-loading="listLoading" :data="formobj.purchaseBillDetailList" border style="width: 100%;">
|
|
|
|
<!-- <el-table-column fixed width="50" type="selection" align="center" /> -->
|
|
|
|
<el-table-column fixed width="80" label="序号" type="index" :index="indexMethod" align="center" />
|
|
|
|
<el-table-column fixed label="操作" wid align="center" width="100">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-button type="primary" size="mini" @click="deleteGoods(scope.row)">删除</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="商品编码" prop="goodsSkuCode" width="150" align="center" />
|
|
|
|
<el-table-column label="商品名称" prop="goodsSpuName" width="150" align="center" />
|
|
|
|
<el-table-column label="商品规格" prop="goodsSkuOwnSpec" width="150" align="center" />
|
|
|
|
<el-table-column label="单位" prop="unit" width="120" align="center" />
|
|
|
|
<el-table-column label="采购数量" align="center" width="150">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-input v-model="scope.row.count" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" @input="calculation(scope.row)" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="单价" prop="cost" width="120" align="center" />
|
|
|
|
<el-table-column label="折扣率(%)" align="center" width="150">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-input v-model="scope.row.discountRate" clearable placeholder=""
|
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')"
|
|
|
|
@input="calculation(scope.row)" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="discountPrice" label="折扣单价" width="120" align="center" />
|
|
|
|
<!-- <el-table-column prop="shareAmount" label="分摊金额" width="150" align="center" /> -->
|
|
|
|
<el-table-column prop="amount" label="总价" width="120" align="center" />
|
|
|
|
<el-table-column label="预计到货日期" align="center" min-width="250">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-date-picker v-model="scope.row.deliveryDate" type="date" value-format="yyyy-MM-dd"
|
|
|
|
placeholder="选择日期" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 选择商品 -->
|
|
|
|
<chooseproducts v-show="viewState == 2" ref="divSp" @backData="backData" @doback="resetState" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import req from '@/api/purchase/purchaseOrder.js'
|
|
|
|
import chooseproducts from './relation/chooseproducts'
|
|
|
|
import {
|
|
|
|
getOrgSidByPath,
|
|
|
|
choiceSupplierInfo,
|
|
|
|
getWarehouses,
|
|
|
|
selAllByOrgSidPath,
|
|
|
|
typeValues
|
|
|
|
} from '@/api/Common/dictcommons'
|
|
|
|
import uploadImg from '@/components/uploadFile/uploadImg'
|
|
|
|
import {
|
|
|
|
getCurrentDate
|
|
|
|
} from '@/utils/index.js'
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
chooseproducts,
|
|
|
|
uploadImg
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title: "【新增】",
|
|
|
|
viewState: 1,
|
|
|
|
listLoading: false,
|
|
|
|
submitdisabled: false,
|
|
|
|
formobj: {
|
|
|
|
"sid": "",
|
|
|
|
"remarks": "",
|
|
|
|
"createTime": getCurrentDate(),
|
|
|
|
"createBySid": window.sessionStorage.getItem('userSid'),
|
|
|
|
"createByName": window.sessionStorage.getItem('userName'),
|
|
|
|
"sourceBillSid": "",
|
|
|
|
"sourceBillNo": "",
|
|
|
|
"billNo": "",
|
|
|
|
"purchaseTypeKey": "",
|
|
|
|
"purchaseTypeValue": "",
|
|
|
|
"purchaseReasonKey": "",
|
|
|
|
"purchaseReasonValue": "",
|
|
|
|
"payTypeKey": "",
|
|
|
|
"payTypeValue": "",
|
|
|
|
"supplierSid": "",
|
|
|
|
"supplierName": "",
|
|
|
|
"supplierPhone": "",
|
|
|
|
"purchaserSid": "",
|
|
|
|
"purchaserName": "",
|
|
|
|
"deliveryDate": "",
|
|
|
|
"wareHouseSid": "",
|
|
|
|
"wareHouseName": "",
|
|
|
|
"deptSid": window.sessionStorage.getItem('departmentSid'),
|
|
|
|
"deptName": window.sessionStorage.getItem('departmentName'),
|
|
|
|
"useOrgSid": window.sessionStorage.getItem('orgSid'),
|
|
|
|
"createOrgSid": window.sessionStorage.getItem('orgSid'),
|
|
|
|
"orgPath": window.sessionStorage.getItem('orgSid'),
|
|
|
|
"purchaseBillAmount": {
|
|
|
|
"sid": "",
|
|
|
|
"billSid": "",
|
|
|
|
"errorAmount": "",
|
|
|
|
"discountAmount": "",
|
|
|
|
"payableAmount": "",
|
|
|
|
"freight": "",
|
|
|
|
"freightShareTypeKey": "",
|
|
|
|
"freightShareTypeValue": "",
|
|
|
|
"otherAmountName": "",
|
|
|
|
"otherShareTypeKey": "",
|
|
|
|
"otherShareTypeValue": "",
|
|
|
|
"settleAccountKey": "",
|
|
|
|
"settleAccountValue": "",
|
|
|
|
"prepayment": "",
|
|
|
|
"paymentTerm": "",
|
|
|
|
"bankName": "",
|
|
|
|
"bankAccountName": "",
|
|
|
|
"bankAccount": "",
|
|
|
|
"currencyKey": "",
|
|
|
|
"currencyValue": ""
|
|
|
|
},
|
|
|
|
"purchaseBillExtend": {
|
|
|
|
"sid": "",
|
|
|
|
"billSid": "",
|
|
|
|
"logisticsNum": "",
|
|
|
|
"productProgress": "",
|
|
|
|
"receiveStateKey": "",
|
|
|
|
"receiveStateValue": "",
|
|
|
|
"deliveryStateKey": "",
|
|
|
|
"deliveryStateValue": ""
|
|
|
|
},
|
|
|
|
"purchaseBillDetailList": [],
|
|
|
|
"purchaseAppendixList": [
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
|
|
|
supplierList: [],
|
|
|
|
warehouseList: [],
|
|
|
|
allOrgperList: [],
|
|
|
|
currencyTypeList: [],
|
|
|
|
settlementList: [],
|
|
|
|
shareTypeList: [],
|
|
|
|
rules: {
|
|
|
|
createTime: [{
|
|
|
|
required: true,
|
|
|
|
message: '请选择日期',
|
|
|
|
trigger: 'change'
|
|
|
|
}],
|
|
|
|
supplierName: [{
|
|
|
|
required: true,
|
|
|
|
message: '请选择供应商',
|
|
|
|
trigger: 'change'
|
|
|
|
}],
|
|
|
|
wareHouseName: [{
|
|
|
|
required: true,
|
|
|
|
message: '请选择收货仓库',
|
|
|
|
trigger: 'change'
|
|
|
|
}],
|
|
|
|
purchaserName: [{
|
|
|
|
required: true,
|
|
|
|
message: '请选择业务员',
|
|
|
|
trigger: 'change'
|
|
|
|
}],
|
|
|
|
|
|
|
|
},
|
|
|
|
imgList: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
init() {
|
|
|
|
|
|
|
|
getOrgSidByPath({
|
|
|
|
orgPath: window.sessionStorage.getItem('defaultOrgPath')
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.formobj.createOrgSid = res.data
|
|
|
|
this.formobj.useOrgSid = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 供应商
|
|
|
|
choiceSupplierInfo({
|
|
|
|
deptSid: window.sessionStorage.getItem('departmentSid')
|
|
|
|
}).then((resp) => {
|
|
|
|
if (resp.success) {
|
|
|
|
this.supplierList = resp.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 仓库
|
|
|
|
getWarehouses({
|
|
|
|
orgPath: window.sessionStorage.getItem('defaultOrgPath'),
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.warehouseList = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 业务员
|
|
|
|
selAllByOrgSidPath({
|
|
|
|
orgSidPath: window.sessionStorage.getItem('defaultOrgPath')
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.allOrgperList = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 货币
|
|
|
|
typeValues({
|
|
|
|
type: 'wms_busType'
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.currencyTypeList = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 结算账户
|
|
|
|
typeValues({
|
|
|
|
type: 'wms_busType'
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.settlementList = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// 分摊方式
|
|
|
|
typeValues({
|
|
|
|
type: 'wms_busType'
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.shareTypeList = res.data
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
calculation(row) {
|
|
|
|
|
|
|
|
row.discountPrice = (Number(row.cost) * Number(row.discountRate) / 100).toFixed(2)
|
|
|
|
row.amount = (Number(row.count) * Number(row.discountPrice)).toFixed(2)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
goodsAdd() {
|
|
|
|
this.viewState = 2
|
|
|
|
this.$refs['divSp'].showAdd(this.formobj.createOrgSid)
|
|
|
|
},
|
|
|
|
deleteGoods(row) {
|
|
|
|
console.log("deleteGoods》》》》", row)
|
|
|
|
|
|
|
|
this.$confirm("是否确定删除此商品?", '提示', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
const index = this.formobj.purchaseBillDetailList.findIndex((item) => item === row)
|
|
|
|
console.log("index》》》》", index)
|
|
|
|
this.formobj.purchaseBillDetailList.splice(index, 1)
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
backData2(value) {
|
|
|
|
console.log('backData2》》》》', value)
|
|
|
|
console.log('imgList', this.imgList)
|
|
|
|
|
|
|
|
for (var i = 0; i < this.imgList.length; i++) {
|
|
|
|
this.formobj.purchaseAppendixList.push({
|
|
|
|
url: this.imgList[i].url
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
backData(value) {
|
|
|
|
this.viewState = 1
|
|
|
|
console.log('>>>>>>>>>backData', value)
|
|
|
|
|
|
|
|
for (var i = 0; i < value.length; i++) {
|
|
|
|
|
|
|
|
this.formobj.purchaseBillDetailList.push(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"sid": "",
|
|
|
|
"remarks": "",
|
|
|
|
"billSid": "",
|
|
|
|
"goodsSpuSid": value[i].sid,
|
|
|
|
"goodsSpuName": value[i].goodsName,
|
|
|
|
"goodsSkuSid": "",
|
|
|
|
"goodsSkuTitle": "",
|
|
|
|
"goodsSkuCode": value[i].goodsSkuCode,
|
|
|
|
"goodsSN": "",
|
|
|
|
"goodsNum": "",
|
|
|
|
"goodsSkuOwnSpec": value[i].goodsSkuOwnSpec,
|
|
|
|
"unit": value[i].unit,
|
|
|
|
"cost": value[i].cost,
|
|
|
|
"count": "0",
|
|
|
|
"discountRate": value[i].discountRate,
|
|
|
|
"discountPrice": "0.00",
|
|
|
|
"shareAmount": "0.00",
|
|
|
|
"shareRate": "0.00",
|
|
|
|
"amount": "0.00",
|
|
|
|
"cycle": "",
|
|
|
|
"deliveryDate": "",
|
|
|
|
"taxAmount": "0.00",
|
|
|
|
"taxPrice": "0.00"
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
resetState() {
|
|
|
|
this.viewState = 1
|
|
|
|
},
|
|
|
|
|
|
|
|
indexMethod(index) {
|
|
|
|
return index + 1
|
|
|
|
},
|
|
|
|
saveOrUpdate() {
|
|
|
|
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
|
|
|
|
|
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
if (this.formobj.purchaseBillDetailList.length == 0) {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
type: 'warning',
|
|
|
|
message: '请添加采购商品'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < this.formobj.purchaseBillDetailList.length; i++) {
|
|
|
|
var item = this.formobj.purchaseBillDetailList[i]
|
|
|
|
if (Number(item.count) == 0) {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
type: 'warning',
|
|
|
|
message: '商品采购数量不能为0或空'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Number(item.discountRate) == 0) {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
type: 'warning',
|
|
|
|
message: '商品折扣率不能为0或空'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.submitdisabled = true
|
|
|
|
req.save(this.formobj).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
type: 'success',
|
|
|
|
message: '保存成功'
|
|
|
|
})
|
|
|
|
this.handleReturn('true')
|
|
|
|
} else {
|
|
|
|
this.submitdisabled = false
|
|
|
|
}
|
|
|
|
}).catch(() => {
|
|
|
|
this.submitdisabled = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
handleReturn(isreload) {
|
|
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
|
|
this.submitdisabled = false
|
|
|
|
this.imgList = []
|
|
|
|
this.formobj = {
|
|
|
|
"sid": "",
|
|
|
|
"remarks": "",
|
|
|
|
"createTime": getCurrentDate(),
|
|
|
|
"createBySid": window.sessionStorage.getItem('userSid'),
|
|
|
|
"createByName": window.sessionStorage.getItem('userName'),
|
|
|
|
"sourceBillSid": "",
|
|
|
|
"sourceBillNo": "",
|
|
|
|
"billNo": "",
|
|
|
|
"purchaseTypeKey": "",
|
|
|
|
"purchaseTypeValue": "",
|
|
|
|
"purchaseReasonKey": "",
|
|
|
|
"purchaseReasonValue": "",
|
|
|
|
"payTypeKey": "",
|
|
|
|
"payTypeValue": "",
|
|
|
|
"supplierSid": "",
|
|
|
|
"supplierName": "",
|
|
|
|
"supplierPhone": "",
|
|
|
|
"purchaserSid": "",
|
|
|
|
"purchaserName": "",
|
|
|
|
"deliveryDate": "",
|
|
|
|
"wareHouseSid": "",
|
|
|
|
"wareHouseName": "",
|
|
|
|
"deptSid": window.sessionStorage.getItem('departmentSid'),
|
|
|
|
"deptName": window.sessionStorage.getItem('departmentName'),
|
|
|
|
"useOrgSid": '',
|
|
|
|
"createOrgSid": '',
|
|
|
|
"orgPath": '',
|
|
|
|
"purchaseBillAmount": {
|
|
|
|
"sid": "",
|
|
|
|
"billSid": "",
|
|
|
|
"errorAmount": "",
|
|
|
|
"discountAmount": "",
|
|
|
|
"payableAmount": "",
|
|
|
|
"freight": "",
|
|
|
|
"freightShareTypeKey": "",
|
|
|
|
"freightShareTypeValue": "",
|
|
|
|
"otherAmountName": "",
|
|
|
|
"otherShareTypeKey": "",
|
|
|
|
"otherShareTypeValue": "",
|
|
|
|
"settleAccountKey": "",
|
|
|
|
"settleAccountValue": "",
|
|
|
|
"prepayment": "",
|
|
|
|
"paymentTerm": "",
|
|
|
|
"bankName": "",
|
|
|
|
"bankAccountName": "",
|
|
|
|
"bankAccount": "",
|
|
|
|
"currencyKey": "",
|
|
|
|
"currencyValue": ""
|
|
|
|
},
|
|
|
|
"purchaseBillExtend": {
|
|
|
|
"sid": "",
|
|
|
|
"billSid": "",
|
|
|
|
"logisticsNum": "",
|
|
|
|
"productProgress": "",
|
|
|
|
"receiveStateKey": "",
|
|
|
|
"receiveStateValue": "",
|
|
|
|
"deliveryStateKey": "",
|
|
|
|
"deliveryStateValue": ""
|
|
|
|
},
|
|
|
|
"purchaseBillDetailList": [],
|
|
|
|
"purchaseAppendixList": [
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
this.$emit('doback')
|
|
|
|
},
|
|
|
|
|
|
|
|
showAdd() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs['form_obj'].clearValidate()
|
|
|
|
})
|
|
|
|
this.init()
|
|
|
|
|
|
|
|
this.title = '【新增】'
|
|
|
|
|
|
|
|
},
|
|
|
|
showEdit(row) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs['form_obj'].clearValidate()
|
|
|
|
})
|
|
|
|
this.init()
|
|
|
|
|
|
|
|
this.title = '【编辑】'
|
|
|
|
|
|
|
|
const loading = this.$loading({
|
|
|
|
lock: true,
|
|
|
|
text: 'Loading',
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
})
|
|
|
|
|
|
|
|
req.fetchDetailsBySid(row.sid)
|
|
|
|
.then(resp => {
|
|
|
|
if (resp.success) {
|
|
|
|
this.formobj = resp.data
|
|
|
|
loading.close()
|
|
|
|
this.imgList = []
|
|
|
|
for (var i = 0; i < resp.data.purchaseAppendixList.length; i++) {
|
|
|
|
this.imgList.push({
|
|
|
|
url: resp.data.purchaseAppendixList[i].url
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
loading.close()
|
|
|
|
this.formobj = {}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
supplierNameSelect(val) {
|
|
|
|
console.log("supplierNameSelect", val);
|
|
|
|
const choose = this.supplierList.filter((item) => item.sid == val)
|
|
|
|
console.log('>>>>>>>>>supplierNameSelect', choose)
|
|
|
|
this.formobj.supplierName = choose[0].supplierName
|
|
|
|
this.formobj.supplierSid = choose[0].sid
|
|
|
|
|
|
|
|
},
|
|
|
|
selectWarehouseName(val) {
|
|
|
|
|
|
|
|
console.log("selectWarehouseName", val);
|
|
|
|
const choose = this.warehouseList.filter((item) => item.sid == val)
|
|
|
|
console.log('>>>>>>>>>selectWarehouseName', choose)
|
|
|
|
this.formobj.wareHouseName = choose[0].warehouseName
|
|
|
|
this.formobj.wareHouseSid = choose[0].sid
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
allOrgperSelect(val) {
|
|
|
|
console.log("allOrgperSelect", val);
|
|
|
|
|
|
|
|
const choose = this.allOrgperList.filter((item) => item.sid == val)
|
|
|
|
console.log('>>>>>>>>>allOrgperSelect', choose)
|
|
|
|
this.formobj.purchaserName = choose[0].name
|
|
|
|
this.formobj.purchaserSid = choose[0].sid
|
|
|
|
|
|
|
|
},
|
|
|
|
selectCurrency(val) {
|
|
|
|
|
|
|
|
},
|
|
|
|
selectFreightShareType(val) {
|
|
|
|
|
|
|
|
},
|
|
|
|
selectSettleAccount(val) {
|
|
|
|
|
|
|
|
},
|
|
|
|
selectOtherShareType(val) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
/deep/ .el-form-item__error {
|
|
|
|
margin-left: 120px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.must {
|
|
|
|
color: #f00;
|
|
|
|
}
|
|
|
|
|
|
|
|
.span-sty {
|
|
|
|
width: 130px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.addinputInfo {
|
|
|
|
margin-left: 120px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw {
|
|
|
|
margin-left: 120px !important;
|
|
|
|
width: calc(100% - 115px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.first_row {
|
|
|
|
border-top: 1px solid #E0E3EB;
|
|
|
|
}
|
|
|
|
|
|
|
|
.titleOne {
|
|
|
|
padding: 7px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
</style>
|