5 changed files with 1083 additions and 0 deletions
@ -0,0 +1,72 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export default { |
|||
// 查询分页列表
|
|||
listPage: function(params) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebill/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 查询分页列表 -- 供应商
|
|||
supplierListPage: function(params) { |
|||
return request({ |
|||
url: '/base/basesupplierinfo/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 查询分页列表 -- 商品列表
|
|||
purGoodsListPage: function(params) { |
|||
return request({ |
|||
url: '/base/basegoodssku/purGoodsListPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 初始化
|
|||
fetchDetailsBySid: function(data) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebillsettle/fetchDetailsBySid/' + data, |
|||
method: 'get' |
|||
}) |
|||
}, |
|||
saveOrUpdate: function(data) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebill/save', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
settlement: function(data) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebillsettle/save', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
deleteBySids: function(data) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebill/delBySids', |
|||
method: 'DELETE', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 导出
|
|||
exportExcel: function(data) { |
|||
return request({ |
|||
url: '/pms/pmspurchasebill/exportExcel', |
|||
method: 'post', |
|||
responseType: 'blob', // 表明返回服务器返回的数据类型
|
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
} |
|||
} |
@ -0,0 +1,338 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--列表页面--> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar view-title="采购开单管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/> |
|||
<!--Start查询列表部分--> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="100px" class="tab-header"> |
|||
<el-form-item label="供应商"> |
|||
<el-select v-model="listQuery.params.supplierSid" placeholder="请选择" clearable filterable> |
|||
<el-option v-for="item in supplier_list" :key="item.sid" :label="item.supplierName" :value="item.sid"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="开单时间"> |
|||
<el-date-picker v-model="listQuery.params.createStartTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker> |
|||
<span style="padding: 0 8px">至</span> |
|||
<el-date-picker v-model="listQuery.params.createEndTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="结算时间">--> |
|||
<!-- <el-date-picker v-model="listQuery.params.appealDueStartDate" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>--> |
|||
<!-- <span style="padding: 0 8px">至</span>--> |
|||
<!-- <el-date-picker v-model="listQuery.params.appealDueEndDate" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>--> |
|||
<!-- </el-form-item>--> |
|||
<el-form-item> |
|||
<el-input v-model="listQuery.params.otherQuery" placeholder="单号、备注" clearable/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleFilter">查询</el-button> |
|||
<el-button type="primary" icon="el-icon-refresh" size="small" @click="handleReset">重置</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!--End查询列表部分--> |
|||
<div class="listtop"> |
|||
<div class="tit">采购开单列表</div> |
|||
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<!--Start 主页面主要部分 --> |
|||
<div class=""> |
|||
<el-table :key="tableKey" v-loading="listLoading" :data="list" :border="true" style="width: 100%;" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" align="center" width="50" /> |
|||
<el-table-column label="序号" type="index" width="80" :index="indexMethod" align="center" /> |
|||
<el-table-column label="操作" width="180px" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="primary" size="mini" @click="toInfo(scope.row)">查看</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="settleState" label="结算标志" align="center" /> |
|||
<el-table-column prop="billNo" label="单号" align="center" /> |
|||
<el-table-column prop="supplierName" label="供应商" align="center" /> |
|||
<el-table-column prop="supplierPhone" label="供应商联系方式" align="center" /> |
|||
<el-table-column prop="storekeeperName" label="库管员" align="center" /> |
|||
<el-table-column prop="settleTime" label="结算时间" align="center" /> |
|||
<el-table-column prop="createTime" label="创建时间" align="center" /> |
|||
<el-table-column prop="createByName" label="制单人" align="center" /> |
|||
</el-table> |
|||
</div> |
|||
<!--End 主页面主要部分--> |
|||
<div class="pages"> |
|||
<div class="tit"/> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<!--End查询列表部分--> |
|||
</div> |
|||
</div> |
|||
<!--新增及修改 --> |
|||
<procurementAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="getList" /> |
|||
<!-- 详情 --> |
|||
<procurementInfo v-show="viewState == 4" ref="divInfo" @doback="resetState" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import req from '@/api/purchase/procurement' |
|||
import { choiceSupplierInfo } from '@/api/Common/dictcommons' |
|||
import procurementAdd from './procurementAdd' |
|||
import procurementInfo from './procurementInfo' |
|||
|
|||
export default { |
|||
name: 'Procurement', |
|||
components: { |
|||
Pagination, |
|||
pageye, |
|||
ButtonBar, |
|||
procurementAdd, |
|||
procurementInfo |
|||
}, |
|||
data() { |
|||
return { |
|||
btndisabled: false, |
|||
btnList: [ |
|||
{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'toAdd', |
|||
btnLabel: '新增' |
|||
}, |
|||
{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'edit', |
|||
btnKey: 'toEdit', |
|||
btnLabel: '编辑' |
|||
}, |
|||
{ |
|||
type: 'danger', |
|||
size: 'small', |
|||
icon: 'del', |
|||
btnKey: 'doDel', |
|||
btnLabel: '删除' |
|||
}, |
|||
{ |
|||
type: 'success', |
|||
size: 'small', |
|||
icon: 'export', |
|||
btnKey: 'doExport', |
|||
btnLabel: '导出' |
|||
}, |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
viewState: 1, // 1、列表 2、新增 3、编辑 4、查看 |
|||
tableKey: 0, |
|||
list: [], |
|||
sids: [], // 用于导出的时候保存已选择的SIDs |
|||
supplier_list: [], |
|||
FormLoading: false, |
|||
listLoading: false, |
|||
// 翻页 |
|||
listQuery: { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
supplierSid: '', |
|||
createStartTime: '', |
|||
createEndTime: '', |
|||
createOrgSid: '', |
|||
otherQuery: '' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
// 初始化变量 |
|||
this.init() |
|||
this.getList() |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
methods: { |
|||
init() { |
|||
choiceSupplierInfo({ createOrgSid : '' }).then((res) => { |
|||
if (res.success) { |
|||
this.supplier_list = res.data |
|||
} |
|||
}) |
|||
}, |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
btnHandle(btnKey) { |
|||
console.log('XXXXXXXXXXXXXXX ' + btnKey) |
|||
switch (btnKey) { |
|||
case 'toAdd': |
|||
this.toAdd() |
|||
break |
|||
case 'toEdit': |
|||
this.toEdit() |
|||
break |
|||
case 'doDel': |
|||
this.doDel() |
|||
break |
|||
case 'doExport': |
|||
this.doExport() |
|||
break |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
// 信息条数 获取点击时当前的sid |
|||
handleSelectionChange(row) { |
|||
const aa = [] |
|||
row.forEach(element => { |
|||
aa.push(element.sid) |
|||
}) |
|||
this.sids = aa |
|||
}, |
|||
// 表中序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
// 查询列表信息 |
|||
getList() { |
|||
this.listLoading = true |
|||
req.listPage(this.listQuery).then((response) => { |
|||
this.listLoading = false |
|||
if (response.success) { |
|||
this.list = response.data.records |
|||
this.listQuery.total = response.data.total |
|||
} else { |
|||
this.list = [] |
|||
this.listQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
// 查询按钮 |
|||
handleFilter() { |
|||
this.listQuery.current = 1 |
|||
this.getList() |
|||
}, |
|||
// 点击重置 |
|||
handleReset() { |
|||
this.listQuery = { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
supplierSid: '', |
|||
createStartTime: '', |
|||
createEndTime: '', |
|||
createOrgSid: '', |
|||
otherQuery: '' |
|||
} |
|||
} |
|||
this.init() |
|||
}, |
|||
toAdd() { |
|||
this.viewState = 2 |
|||
this.$refs['divAdd'].showAdd(this.listQuery.params.createOrgSid) |
|||
}, |
|||
toEdit(row) { |
|||
if (this.sids.length === 1) { |
|||
this.viewState = 3 |
|||
this.$refs['divAdd'].showEdit(this.sids[0]) |
|||
} else { |
|||
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行编辑操作' }) |
|||
} |
|||
}, |
|||
toInfo(row) { |
|||
this.viewState = 4 |
|||
this.$refs['divInfo'].showInfo(row) |
|||
}, |
|||
doDel() { |
|||
if (this.sids.length === 0) { |
|||
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) |
|||
return |
|||
} |
|||
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' |
|||
this.$confirm(tip, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
const loading = this.$loading({ |
|||
lock: true, |
|||
text: 'Loading', |
|||
spinner: 'el-icon-loading', |
|||
background: 'rgba(0, 0, 0, 0.7)' |
|||
}) |
|||
req.deleteBySids(this.sids).then(resp => { |
|||
if (resp.success) { |
|||
this.$message({ type: 'success', message: resp.msg, showClose: true }) |
|||
} |
|||
this.getList() |
|||
loading.close() |
|||
}).catch(e => { |
|||
loading.close() |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
doExport() { |
|||
const loading = this.$loading({ |
|||
lock: true, |
|||
text: 'Loading', |
|||
spinner: 'el-icon-loading', |
|||
background: 'rgba(0, 0, 0, 0.7)' |
|||
}) |
|||
req.exportExcel(this.listQuery.params).then((resp) => { |
|||
loading.close() |
|||
const blob = new Blob([resp], { |
|||
type: 'application/vnd.ms-excel' |
|||
}) |
|||
const fileName = '销售单查询' + '.xls' |
|||
const elink = document.createElement('a') |
|||
elink.download = fileName |
|||
elink.style.display = 'nonde' |
|||
elink.href = URL.createObjectURL(blob) |
|||
document.body.appendChild(elink) |
|||
elink.click() |
|||
URL.revokeObjectURL(elink.href) |
|||
document.body.removeChild(elink) |
|||
}).catch(() => { |
|||
loading.close() |
|||
}) |
|||
}, |
|||
// 修改、编辑、详情返回列表页面 |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
</style> |
@ -0,0 +1,599 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<div class="tab-header webtop"> |
|||
<div>{{ viewTitle }}</div> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存</el-button> |
|||
<el-button type="danger" size="small" :disabled="submitdisabled" @click="settle()">结算</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="16"> |
|||
<div class="span-sty">供应商</div> |
|||
<el-form-item> |
|||
<el-popover placement="right" width="600" trigger="click"> |
|||
<div> |
|||
<el-table :data="supplierData" v-loading="supplierLoading" highlight-current-row @current-change="supplierCurrentChange"> |
|||
<el-table-column fixed prop="vehMark" label="车辆拍照" align="center" width="130"/> |
|||
<el-table-column prop="name" label="客户" align="center" width="100"/> |
|||
<el-table-column prop="mobile" label="联系方式" align="center" min-width="300"/> |
|||
<el-table-column prop="orgName" label="客户单位" align="center" width="100"/> |
|||
</el-table> |
|||
<el-pagination :page.sync="supplierQuery.current" :page-size="supplierQuery.size" layout="total, pager" :total="supplierQuery.total"/> |
|||
</div> |
|||
<el-input slot="reference" class="addinputInfo addinputw" style="width: 30%" v-model="formobj.pmsPurchaseBill.supplierName" @input="supplierInput(formobj.pmsPurchaseBill.supplierName)" clearable placeholder="供应商名称、联系方式、缩写"/> |
|||
</el-popover> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">联系方式</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.pmsPurchaseBill.supplierPhone }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">发票类型</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.pmsPurchaseBill.billTypeValue" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">是否需要发票</div> |
|||
<el-form-item> |
|||
<el-radio-group class="addinputInfo" style="font-size: 1px" v-model="formobj.pmsPurchaseBill.isInvoicing"> |
|||
<el-radio label="1">是</el-radio> |
|||
<el-radio label="2">否</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">发票号码</div> |
|||
<el-form-item> |
|||
<el-input class="addinputInfo addinputw" v-model="formobj.pmsPurchaseBill.invoiceCode" clearable placeholder=""/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">备注</div> |
|||
<el-form-item> |
|||
<el-input class="addinputInfo addinputw" v-model="formobj.pmsPurchaseBill.remarks" clearable placeholder=""/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">采购员</div> |
|||
<el-form-item> |
|||
<el-input class="addinputInfo addinputw" v-model="formobj.purchaserName" clearable placeholder=""/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">库管员</div> |
|||
<el-form-item> |
|||
<el-input class="addinputInfo addinputw" v-model="formobj.pmsPurchaseBill.storekeeperName" clearable placeholder=""/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title">商品列表</div> |
|||
<el-table :key="commodityKey" :data="formobj.pmsPurchaseBill.pmsPurchaseBillDetailList" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column align="center" width="70" :render-header="commodityHeader"> |
|||
<template slot-scope="scope"> |
|||
<i class="el-icon-delete" @click="commodityDelete(scope.$index)"></i> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="商品名称" align="center" min-width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-popover placement="right" width="600" trigger="click"> |
|||
<div> |
|||
<el-table :data="commodityData" v-loading="commodityLoading" highlight-current-row @current-change="commodityCurrentChange($event, scope.row)"> |
|||
<el-table-column fixed prop="goodsName" label="商品名称" align="center" /> |
|||
<el-table-column prop="goodsSkuCode" label="零件号" align="center" /> |
|||
<el-table-column prop="goodsShortName" label="商品简称" align="center" /> |
|||
<el-table-column prop="goodsPY" label="商品拼音" align="center" /> |
|||
<el-table-column prop="title" label="规格" align="center" /> |
|||
</el-table> |
|||
<el-pagination :page.sync="commodityQuery.current" :page-size="commodityQuery.size" layout="total, pager" :total="commodityQuery.total" /> |
|||
</div> |
|||
<el-input slot="reference" v-model="scope.row.goodsSpuName" @input="commodityInput(scope.row.goodsSpuName)" clearable placeholder="商品名称、零件号、拼音"/> |
|||
</el-popover> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="goodsCode" label="零件号" align="center" width="100" /> |
|||
<el-table-column prop="goodsSkuOwnSpec" label="规格" align="center" width="100" /> |
|||
<el-table-column prop="currentCount" label="库存数量" align="center" width="100" /> |
|||
<el-table-column label="仓库" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.warehouseName" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="货位" align="center" width="130"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.warehouseRackName" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="进价" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="amountInput(scope.row)" @keyup.native="scope.row.cost = getNumber(scope.row.cost, 2)" v-model="scope.row.cost" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="采购数量" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="amountInput(scope.row)" @keyup.native="scope.row.count = getNumber(scope.row.count, 2)" v-model="scope.row.count" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="taxAmount" label="税额" align="center" width="100" /> |
|||
<el-table-column label="含税价" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.taxPrice" @keyup.native="scope.row.taxPrice = getNumber(scope.row.taxPrice, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="amount" label="采购金额" align="center" width="100" /> |
|||
<el-table-column label="销售价" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.salesPrice" @keyup.native="scope.row.salesPrice = getNumber(scope.row.salesPrice, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">合计含税金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ hjhsjeTotal }} = 进价: {{ jjTotal }} + 税额: {{ seTotal }} | 数量: {{ slTotal }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">采购金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ cgjeTotal }} = 合计含税金额:{{ hjhsjeTotal }} + 误差调整:<el-input style="width: 100px" v-model="formobj.errorAmount" clearable placeholder="" /></span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">应付金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ yfjeTotal }} = 采购金额:{{ cgjeTotal }} - 优惠金额:<el-input style="width: 100px" v-model="formobj.discountAmount" clearable placeholder="" /></span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
<el-dialog :visible.sync="settleVisible" width="70%"> |
|||
<el-form :model="formobj" class="formaddcopy02"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">应付金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.payableAmount }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="16"> |
|||
<div class="span-sty">预付款抵扣</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.prepaymentdeductAmount" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算方式</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.settleValue" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算金额</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.settleAmount" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算时间</div> |
|||
<el-form-item><el-date-picker class="addinputInfo addinputw" v-model="formobj.settleTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">其他结算方式</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.otherSettleKey" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">其他结算金额</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.otherSettleValue" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">欠款金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ debts }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div style="text-align:center;margin-top: 20px;"> |
|||
<el-button type="primary" size="mini" @click="confirm">确 定</el-button> |
|||
<el-button type="info " size="mini" @click="settleVisible = false">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/purchase/procurement' |
|||
|
|||
export default { |
|||
name: 'ProcurementAdd', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
submitdisabled: false, |
|||
settleVisible: false, // 结算弹框 |
|||
activeNames: '1', |
|||
index: 0, |
|||
// supplier供应商 |
|||
supplierKey: 1, |
|||
supplierLoading: false, |
|||
supplierQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
otherQuery: '', |
|||
useOrgSid: '' |
|||
} |
|||
}, |
|||
supplierData: [], |
|||
// commodity商品 |
|||
commodityKey: 1, |
|||
commodityLoading: false, |
|||
commodityQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
otherQuery: '', |
|||
orgSid: '' |
|||
} |
|||
}, |
|||
commodityData: [], |
|||
formobj: { |
|||
sid: '', |
|||
pmsPurchaseBill: { |
|||
sid: '', |
|||
remarks: '', |
|||
createBySid: '', |
|||
createByName: '', |
|||
sourceBillSid: '', |
|||
sourceBillNo: '', |
|||
billNo: '', |
|||
purchaseTypeKey: '', |
|||
purchaseTypeValue: '', |
|||
supplierSid: '', |
|||
supplierName: '', |
|||
supplierPhone: '', |
|||
billTypeKey: '', |
|||
billTypeValue: '', |
|||
isInvoicing: '', |
|||
invoiceCode: '', |
|||
purchaserSid: '', |
|||
purchaserName: '', |
|||
storekeeperSid: '', |
|||
storekeeperName: '', |
|||
freight: '', |
|||
discountAmount: '', |
|||
payableAmount: '', |
|||
purchaser: '', |
|||
sortNo: '', |
|||
errorAmount: '', |
|||
pmsPurchaseBillDetailList: [] |
|||
}, |
|||
remarks: '', |
|||
createBySid: '', |
|||
createByName: '', |
|||
billSid: '', |
|||
payableAmount: '', |
|||
prepaymentdeductAmount: '', |
|||
settleKey: '', |
|||
settleValue: '', |
|||
settleAmount: '', |
|||
otherSettleKey: '', |
|||
otherSettleValue: '', |
|||
debts: '', |
|||
settleTime: '' |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
computed: { |
|||
// 合计进价 |
|||
jjTotal() { |
|||
let jj = 0 |
|||
if (this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.length > 0) { |
|||
this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.forEach((e) => { |
|||
if (e.goodsSpuName !== '' && e.cost !== '' && e.count !== '') { |
|||
jj = jj + Math.round((parseFloat(e.cost) * parseFloat(e.count)) * 100) / 100 |
|||
} |
|||
}) |
|||
} |
|||
return jj |
|||
}, |
|||
// 合计税额 |
|||
seTotal() { |
|||
let se = 0 |
|||
if (this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.length > 0) { |
|||
this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.forEach((e) => { |
|||
if (e.goodsSpuName !== '' && e.taxAmount !== '') { |
|||
se = se + parseFloat(e.taxAmount) |
|||
} |
|||
}) |
|||
} |
|||
return se |
|||
}, |
|||
// 合计数量 |
|||
slTotal() { |
|||
let sl = 0 |
|||
if (this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.length > 0) { |
|||
this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.forEach((e) => { |
|||
if (e.goodsSpuName !== '' && e.count !== '') { |
|||
sl = sl + parseFloat(e.count) |
|||
} |
|||
}) |
|||
} |
|||
return sl |
|||
}, |
|||
// 合计含税金额 |
|||
hjhsjeTotal() { |
|||
let hjhsje = 0 |
|||
if (this.jjTotal !== null) { |
|||
hjhsje = this.jjTotal |
|||
} |
|||
return hjhsje |
|||
}, |
|||
// 采购金额 |
|||
cgjeTotal() { |
|||
let cgje = 0 |
|||
if (this.hjhsjeTotal !== null) { |
|||
cgje = cgje + Math.round((parseFloat(this.hjhsjeTotal !== '' ? this.hjhsjeTotal : '0') + parseFloat(this.formobj.pmsPurchaseBill.errorAmount !== '' ? this.formobj.pmsPurchaseBill.errorAmount : '0')) * 100) / 100 |
|||
} |
|||
return cgje |
|||
}, |
|||
// 应付金额 |
|||
yfjeTotal() { |
|||
let yfje = 0 |
|||
if (this.cgjeTotal !== null) { |
|||
yfje = yfje + Math.round((parseFloat(this.cgjeTotal !== '' ? this.cgjeTotal : '0') - parseFloat(this.formobj.pmsPurchaseBill.discountAmount !== '' ? this.formobj.pmsPurchaseBill.discountAmount : '0')) * 100) / 100 |
|||
} |
|||
return yfje |
|||
}, |
|||
// 结算页面中计算欠款金额 |
|||
debts() { |
|||
let debt = 0 |
|||
return debt |
|||
} |
|||
}, |
|||
methods: { |
|||
showAdd() { |
|||
this.viewTitle = '【新增】采购单' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
}, |
|||
showEdit(row) { |
|||
this.viewTitle = '【新增】采购单' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
req.fetchDetailsBySid(row.sid).then((res) => { |
|||
if (res.success) { |
|||
this.formobj = res.data |
|||
} |
|||
}) |
|||
}, |
|||
getNumber(val, limit) { |
|||
val = val.replace(/[^0-9.]/g, '') // 保留数字 |
|||
val = val.replace(/^00/, '0.') // 开头不能有两个0 |
|||
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0. |
|||
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个 |
|||
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点 |
|||
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0 |
|||
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' |
|||
const reg = new RegExp(str) |
|||
if (limit === 0) { |
|||
// 不需要小数点 |
|||
val = val.replace(reg, '$1') |
|||
} else { |
|||
// 通过正则保留小数点后指定的位数 |
|||
val = val.replace(reg, '$1.$2') |
|||
} |
|||
return val |
|||
}, |
|||
supplierInput(value) { |
|||
this.supplierQuery.params.otherQuery = value |
|||
this.supplierLoading = true |
|||
req.supplierListPage(this.supplierQuery).then((response) => { |
|||
if (response.success) { |
|||
this.supplierLoading = false |
|||
this.supplierData = response.data.records |
|||
this.supplierQuery.total = response.data.total |
|||
} else { |
|||
this.serviceLoading = false |
|||
this.supplierData = [] |
|||
this.supplierQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
supplierCurrentChange(value) { |
|||
this.formobj.pmsPurchaseBill.supplierName = value.supplierName |
|||
this.formobj.pmsPurchaseBill.supplierSid = value.sid |
|||
this.formobj.pmsPurchaseBill.supplierPhone = value.contactTelePhone |
|||
document.body.click() |
|||
}, |
|||
// 在头部标题上添加“新增”图标 |
|||
commodityHeader(h, { column }) { |
|||
return h( |
|||
'div', |
|||
[ |
|||
h('span', column.label), |
|||
h('i', { |
|||
class: 'add-btn-icon el-icon-plus', |
|||
style: 'color: red;font-size:20px', |
|||
on: { |
|||
click: this.commodityAdd // 点击执行函数 |
|||
} |
|||
}) |
|||
] |
|||
) |
|||
}, |
|||
commodityAdd() { |
|||
this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.push({ |
|||
sid: '', |
|||
billSid: '', |
|||
goodSpuSid: '', |
|||
goodsSpuName: '', |
|||
goodsSkuSid: '', |
|||
goodsSkuTitle: '', |
|||
goodsSkuCode: '', |
|||
goodsSkuOwnSpec: '', |
|||
currentCount: '', |
|||
warehouseSid: '', |
|||
warehouseName: '', |
|||
warehouseAreaSid: '', |
|||
warehouseAreaName: '', |
|||
warehouseRackSid: '', |
|||
warehouseRackName: '', |
|||
cost: '', |
|||
count: '', |
|||
taxAmount: '', |
|||
taxPrice: '', |
|||
amount: '', |
|||
salesPrice: '', |
|||
minimumSalesPrice: '' |
|||
}) |
|||
}, |
|||
commodityInput(value) { |
|||
this.commodityQuery.params.otherQuery = value |
|||
this.commodityLoading = true |
|||
req.purGoodsListPage(this.commodityQuery).then((response) => { |
|||
if (response.success) { |
|||
this.commodityLoading = false |
|||
this.commodityData = response.data.records |
|||
this.commodityQuery.total = response.data.total |
|||
} else { |
|||
this.serviceLoading = false |
|||
this.commodityData = [] |
|||
this.commodityQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
commodityDelete(index) { |
|||
this.formobj.pmsPurchaseBill.pmsPurchaseBillDetailList.splice(index, 1) |
|||
}, |
|||
commodityCurrentChange(value, row) { |
|||
row.goodsSpuName = value.goodsName |
|||
row.goodsSkuOwnSpec = value.title |
|||
document.body.click() |
|||
}, |
|||
// 计算采购金额 |
|||
amountInput(row) { |
|||
if (row.goodsSpuName !== '') { |
|||
row.amount = Math.round((parseFloat(row.cost !== '' ? row.cost : '0') * parseFloat(row.count !== '' ? row.count : '0')) * 100) / 100 |
|||
} |
|||
}, |
|||
saveOrUpdate() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.saveOrUpdate(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 |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
settle() { |
|||
this.settleVisible = true |
|||
this.formobj.payableAmount = this.yfjeTotal |
|||
}, |
|||
confirm() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.settlement(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.formobj = { |
|||
sid: '', |
|||
pmsPurchaseBill: { |
|||
sid: '', |
|||
remarks: '', |
|||
createBySid: '', |
|||
createByName: '', |
|||
sourceBillSid: '', |
|||
sourceBillNo: '', |
|||
billNo: '', |
|||
purchaseTypeKey: '', |
|||
purchaseTypeValue: '', |
|||
supplierSid: '', |
|||
supplierName: '', |
|||
supplierPhone: '', |
|||
billTypeKey: '', |
|||
billTypeValue: '', |
|||
isInvoicing: '', |
|||
invoiceCode: '', |
|||
purchaserSid: '', |
|||
purchaserName: '', |
|||
storekeeperSid: '', |
|||
storekeeperName: '', |
|||
freight: '', |
|||
discountAmount: '', |
|||
payableAmount: '', |
|||
purchaser: '', |
|||
sortNo: '', |
|||
errorAmount: '', |
|||
pmsPurchaseBillDetailList: [] |
|||
}, |
|||
remarks: '', |
|||
createBySid: '', |
|||
createByName: '', |
|||
billSid: '', |
|||
payableAmount: '', |
|||
prepaymentdeductAmount: '', |
|||
settleKey: '', |
|||
settleValue: '', |
|||
settleAmount: '', |
|||
otherSettleKey: '', |
|||
otherSettleValue: '', |
|||
debts: '', |
|||
settleTime: '' |
|||
} |
|||
this.submitdisabled = false |
|||
this.settleVisible = false |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.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); |
|||
} |
|||
</style> |
@ -0,0 +1,58 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<div class="tab-header webtop"> |
|||
<div>{{ viewTitle }}</div> |
|||
<div> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-table :key="tableKey" :data="formobj.pmsPurchaseBill.pmsPurchaseBillDetailList" :index="index" border style="width: 100%"> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import req from '@/api/purchase/procurement' |
|||
|
|||
export default { |
|||
name: 'ProcurementInfo', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
tableKey: 0, |
|||
index: 0, |
|||
formobj: {}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
showInfo(row) { |
|||
this.viewTitle = '采购开单详情' |
|||
req.fetchDetailsBySid(row.sio).then((res) => { |
|||
if (res.success) { |
|||
this.formobj = res.data |
|||
} |
|||
}) |
|||
}, |
|||
handleReturn() { |
|||
this.formobj = {} |
|||
this.$emit('doback') |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.span-sty { |
|||
width: 130px !important; |
|||
} |
|||
.addinputInfo { |
|||
margin-left: 120px !important; |
|||
} |
|||
</style> |
Loading…
Reference in new issue