|
|
@ -7,6 +7,7 @@ |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="selectCustomer()">选择客户</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="settleAccounts()">结算</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="print()">打印</el-button> |
|
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -28,34 +29,18 @@ |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty"><span class="icon">*</span>服务顾问</div> |
|
|
|
<div class="span-sty"><span class="icon">*</span>销售人员</div> |
|
|
|
<el-form-item prop="salesName"> |
|
|
|
<el-select class="addinputInfo" v-model="formobj.salesName" placeholder="请选择" @change="waitorChange" clearable filterable> |
|
|
|
<el-option v-for="item in user_list" :key="item.sid" :label="item.name" :value="item.name"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="16"> |
|
|
|
<div class="span-sty"><span class="icon">*</span>科目</div> |
|
|
|
<el-form-item prop="subject"> |
|
|
|
<el-select class="addinputInfo" v-model="formobj.subject" placeholder="请选择" @change="changeSubject" clearable filterable> |
|
|
|
<el-option v-for="item in subject_list" :key="item.subjectSid" :label="item.subject" :value="item.subject"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<div class="span-sty">快捷备注</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.shotRemarks" clearable placeholder="" /></el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">备注(打印)</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.printRemarks" clearable placeholder="" /></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">备注</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.remarks" clearable placeholder="" /></el-form-item> |
|
|
|
</el-col> |
|
|
@ -82,14 +67,14 @@ |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">是否开发票</div> |
|
|
|
<el-form-item> |
|
|
|
<el-radio-group class="addinputInfo" style="font-size: 1px" v-model="formobj.invoiceVo.isInvoicing"> |
|
|
|
<el-radio-group class="addinputInfo" v-model="formobj.invoiceVo.isInvoicing" @change="isInvoicingChange"> |
|
|
|
<el-radio label="1">是</el-radio> |
|
|
|
<el-radio label="0">否</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">发票类型</div> |
|
|
|
<div class="span-sty">开票类型</div> |
|
|
|
<el-form-item> |
|
|
|
<el-select class="addinputInfo" :disabled="formobj.invoiceVo.isInvoicing != '1'" v-model="formobj.invoiceVo.invoiceType" placeholder="请选择" @change="invoiceTypeChange" clearable filterable> |
|
|
|
<el-option v-for="item in invoiceType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"></el-option> |
|
|
@ -97,36 +82,36 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">开票名称</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" :disabled="formobj.invoiceVo.isInvoicing != '1'" v-model="formobj.invoiceVo.invoiceTitle" clearable placeholder="" /></el-form-item> |
|
|
|
<div class="span-sty">税率(%)</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" @input="taxRateInput" :disabled="formobj.invoiceVo.isInvoicing != '1'" @keyup.native="formobj.invoiceVo.taxRate = getNumber(formobj.invoiceVo.taxRate, 2)" v-model="formobj.invoiceVo.taxRate" 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" :disabled="formobj.invoiceVo.isInvoicing != '1'" v-model="formobj.invoiceVo.taxpayerNo" clearable placeholder="" /></el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="16"> |
|
|
|
<div class="span-sty">税率(%)</div> |
|
|
|
<el-form-item><el-input class="addinputInfo addinputw" :disabled="formobj.invoiceVo.isInvoicing != '1'" @keyup.native="formobj.invoiceVo.taxRate = getNumber(formobj.invoiceVo.taxRate, 2)" v-model="formobj.invoiceVo.taxRate" clearable placeholder="" /></el-form-item> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="span-sty">开票单位</div> |
|
|
|
<el-form-item> |
|
|
|
<el-select class="addinputInfo" :disabled="formobj.invoiceVo.isInvoicing != '1'" v-model="formobj.invoiceVo.invoiceTitleSid" placeholder="请选择" @change="changeCompanyInvoicing" clearable> |
|
|
|
<el-option v-for="item in companyInvoicing_list" :key="item.companyInvoicingSid" :label="item.companyInvoicingName" :value="item.companyInvoicingSid"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-collapse-item> |
|
|
|
</el-collapse> |
|
|
|
<div class="title titleOne"> |
|
|
|
<div>商品</div> |
|
|
|
<el-button type="primary" size="mini" @click="commodityAdd">添加</el-button> |
|
|
|
</div> |
|
|
|
<div class="title">商品列表</div> |
|
|
|
<el-table :key="commodityKey" :data="formobj.goodsVos" :index="index" border style="width: 100%"> |
|
|
|
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center" /> |
|
|
|
<el-table-column fixed label="操作" align="center" width="70"> |
|
|
|
<el-table-column align="center" width="80"> |
|
|
|
<template slot="header" slot-scope="scope"> |
|
|
|
<i class="add-btn-icon el-icon-plus" style="color: red;font-size:20px" @click="commodityAdd(scope.row)"></i> |
|
|
|
</template> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="danger" size="small" @click="commodityDelete(scope.$index)">删除</el-button> |
|
|
|
<i class="el-icon-delete" @click="commodityDelete(scope.$index)"></i> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="商品名称" width="200" align="center"> |
|
|
|
<el-table-column label="商品名称" align="center" width="200"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-popover placement="right" width="500" trigger="click"> |
|
|
|
<el-popover placement="right" trigger="click" width="500"> |
|
|
|
<div> |
|
|
|
<el-table :data="commodityData" v-loading="commodityLoading" highlight-current-row @current-change="commodityCurrentChange($event, scope.row)"> |
|
|
|
<el-table-column fixed prop="goodsSpuName" label="商品名称" align="center" /> |
|
|
@ -140,16 +125,15 @@ |
|
|
|
</el-popover> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="goodsSkuCode" label="图号" width="100" align="center" /> |
|
|
|
<el-table-column prop="goodsSkuOwnSpec" label="规格" width="100" align="center" /> |
|
|
|
<el-table-column prop="unit" label="单位" width="100" align="center" /> |
|
|
|
<el-table-column prop="supplierName" label="厂家" width="100" align="center" /> |
|
|
|
<el-table-column prop="currentCount" label="库存" width="100" align="center" /> |
|
|
|
<el-table-column label="销售价" align="center" width="150"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.price" @keyup.native="scope.row.price = getNumber(scope.row.price, 2)" clearable placeholder="" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="goodsSkuCode" label="图号" align="center" width="100" /> |
|
|
|
<el-table-column prop="goodsSkuOwnSpec" label="规格" align="center" width="100" /> |
|
|
|
<el-table-column prop="unit" label="单位" align="center" width="100" /> |
|
|
|
<el-table-column prop="billObjName" label="供应商" align="center" width="150" /> |
|
|
|
<el-table-column prop="warehouseName" label="仓库" align="center" width="150" /> |
|
|
|
<el-table-column prop="areaName" label="库区" align="center" width="150" /> |
|
|
|
<el-table-column prop="warehouseRackCode" label="库位" align="center" width="150" /> |
|
|
|
<el-table-column prop="currentCount" label="库存" align="center" width="100" /> |
|
|
|
<el-table-column prop="price" label="销售价" align="center" width="150" /> |
|
|
|
<el-table-column label="数量" align="center" width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input @input="computeYHAndXSJE(scope.row)" v-model="scope.row.count" @keyup.native="scope.row.count = getNumber(scope.row.count, 2)" clearable placeholder="" /> |
|
|
@ -160,23 +144,23 @@ |
|
|
|
<el-input @input="computeYHAndXSJE(scope.row)" v-model="scope.row.discount" @keyup.native="scope.row.discount = getNumber(scope.row.discount, 2)" clearable placeholder="" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="discountAmount" label="优惠" width="100" align="center" /> |
|
|
|
<el-table-column prop="amount" label="金额" width="100" align="center" /> |
|
|
|
<el-table-column prop="discountAmount" label="优惠" align="center" width="100" /> |
|
|
|
<el-table-column prop="amount" label="金额" align="center" width="100" /> |
|
|
|
<el-table-column label="备注" align="center" min-width="300"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.remarks" clearable placeholder="" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<div class="title titleOne"> |
|
|
|
<div>附加项目</div> |
|
|
|
<el-button type="primary" size="mini" @click="subjoinAdd">添加</el-button> |
|
|
|
</div> |
|
|
|
<div class="title">附加项目</div> |
|
|
|
<el-table :key="subjoinKey" :data="formobj.aitemVos" :index="index" border style="width: 100%"> |
|
|
|
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|
|
|
<el-table-column fixed label="操作" align="center" width="70"> |
|
|
|
<el-table-column align="center" width="80"> |
|
|
|
<template slot="header" slot-scope="scope"> |
|
|
|
<i class="add-btn-icon el-icon-plus" style="color: red;font-size:20px" @click="subjoinAdd(scope.row)"></i> |
|
|
|
</template> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="danger" size="small" @click="subjoinDelete(scope.$index)">删除</el-button> |
|
|
|
<i class="el-icon-delete" @click="subjoinDelete(scope.$index)"></i> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="附加项目" align="center" width="200"> |
|
|
@ -185,7 +169,7 @@ |
|
|
|
<div> |
|
|
|
<el-table :data="subjoinData" v-loading="subjoinLoading" highlight-current-row @current-change="subjoinCurrentChange($event, scope.row)"> |
|
|
|
<el-table-column fixed prop="aitemName" label="项目名称" align="center" /> |
|
|
|
<el-table-column prop="aitemCode" label="拼音缩写" align="center" /> |
|
|
|
<el-table-column prop="aitemCode" label="项目编码" align="center" /> |
|
|
|
<el-table-column prop="price" label="销售金额" align="center" /> |
|
|
|
</el-table> |
|
|
|
<el-pagination :page.sync="subjoinQuery.current" :page-size="subjoinQuery.size" layout="total, pager" :total="subjoinQuery.total" /> |
|
|
@ -194,11 +178,7 @@ |
|
|
|
</el-popover> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="销售价" align="center" width="150"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.price" @keyup.native="scope.row.price = getNumber(scope.row.price, 2)" clearable placeholder="" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="price" label="销售价" align="center" width="150" /> |
|
|
|
<el-table-column label="备注" align="center" min-width="200"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.remarks" clearable placeholder="" /> |
|
|
@ -208,14 +188,13 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="span-sty" style="border-right: 0px">合计金额:</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ jeTotal }} = 材料费:{{ clfTotal }} + 附加费:{{ fjfTotal }} + 税额:{{ seTotal }}</span></el-form-item> |
|
|
|
<el-form-item><span class="addinputInfo">{{ jeTotal }} = 材料费:{{ clfTotal }} + 附加费:{{ fjfTotal }}</span></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="span-sty" style="border-right: 0px">应收金额:</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ ysjeTotal }} = 合计金额:{{ jeTotal }} - 优惠:<el-input style="width: 100px" v-model="formobj.discountAmount" @keyup.native="formobj.discountAmount = getNumber(formobj.discountAmount, 2)" clearable placeholder="" /></span></el-form-item> |
|
|
|
<!-- - 优惠券:<el-input style="width: 100px" v-model="formobj.coupon" @keyup.native="formobj.coupon = getNumber(formobj.coupon, 2)" clearable placeholder="" /> - 积分抵扣:<el-input style="width: 100px" v-model="formobj.scoreDeduct" @keyup.native="formobj.scoreDeduct = getNumber(formobj.scoreDeduct, 2)" clearable placeholder="" />--> |
|
|
|
<el-form-item><span class="addinputInfo">{{ ysjeTotal }} = 合计金额:{{ jeTotal }} - 优惠:{{ yhTotal }}</span></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
@ -294,8 +273,9 @@ |
|
|
|
<script> |
|
|
|
import req from '@/api/operation/salesticket' |
|
|
|
import additionitem from '@/api/basicinformation/additionitem' |
|
|
|
import { selAllByOrgSidPath, selSubjectInfo, typeValues, listPageSales, getOrgSidByPath } from '@/api/Common/dictcommons' |
|
|
|
import { selAllByOrgSidPath, selSubjectInfo, typeValues, listPageSales, getOrgSidByPath, getInvoicingList } from '@/api/Common/dictcommons' |
|
|
|
import selectCustomer from '@/components/publicPage/selectCustomer' |
|
|
|
import {getStorage} from "@/utils/auth"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'SalesTicketAdd', |
|
|
@ -307,10 +287,11 @@ export default { |
|
|
|
viewTitle: '', |
|
|
|
viewState: 1, |
|
|
|
submitdisabled: false, |
|
|
|
user_list: [], // 服务顾问 |
|
|
|
user_list: [], // 销售人员 |
|
|
|
subject_list: [], // 科目 |
|
|
|
settleVisible: false, // 结算弹框 |
|
|
|
invoiceType_list: [], // 发票类型 |
|
|
|
companyInvoicing_list: [], // 开票单位 |
|
|
|
settle_list: [], // 结算方式 |
|
|
|
otherSettle_list: [], // 其他结算方式 |
|
|
|
activeNames: '1', |
|
|
@ -343,6 +324,10 @@ export default { |
|
|
|
subjoinData: [], |
|
|
|
formobj: { |
|
|
|
sid: '', |
|
|
|
createOrgSid: '', |
|
|
|
createOrgName: '', |
|
|
|
useOrgSid: '', |
|
|
|
useOrgName: '', |
|
|
|
createTime: '', |
|
|
|
createByName: '', |
|
|
|
createBySid: '', |
|
|
@ -365,14 +350,17 @@ export default { |
|
|
|
scoreDeduct: '', |
|
|
|
customerOrg: '', |
|
|
|
receivableAmount: '', |
|
|
|
goodsAmount: '', |
|
|
|
addAmount: '', |
|
|
|
invoiceVo: { |
|
|
|
isInvoicing: '', |
|
|
|
invoiceType: '', |
|
|
|
invoiceTypeKey: '', |
|
|
|
invoiceTitle: '', |
|
|
|
taxpayerNo: '', |
|
|
|
invoiceCode: '', |
|
|
|
taxRate: '' |
|
|
|
taxRate: '', |
|
|
|
invoiceTitleSid: '', |
|
|
|
invoiceTitle: '' |
|
|
|
}, |
|
|
|
aitemVos: [], |
|
|
|
goodsVos: [], |
|
|
@ -392,8 +380,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
salesName: [{ required: true, message: '服务顾问不能为空', trigger: 'change' }], |
|
|
|
subject: [{ required: true, message: '科目不能为空', trigger: 'change' }] |
|
|
|
salesName: [{ required: true, message: '服务顾问不能为空', trigger: 'change' }] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
@ -422,23 +409,26 @@ export default { |
|
|
|
} |
|
|
|
return fjf |
|
|
|
}, |
|
|
|
// 计算税额 = 材料费 * 税率 |
|
|
|
seTotal() { |
|
|
|
let se = '0' |
|
|
|
se = Math.round((parseFloat(this.clfTotal) * (parseFloat(this.formobj.invoiceVo.taxRate !== '' ? this.formobj.invoiceVo.taxRate : '0') / 100)) * 100) / 100 |
|
|
|
return se |
|
|
|
}, |
|
|
|
// 计算合计金额 = 工时费 + 材料费 + 附加费 + 税额 |
|
|
|
// 计算合计金额 = 材料费 + 附加费 |
|
|
|
jeTotal() { |
|
|
|
let je = '0' |
|
|
|
je = Math.round((parseFloat(je) + parseFloat(this.clfTotal) + parseFloat(this.fjfTotal) + parseFloat(this.seTotal)) * 100) / 100 |
|
|
|
je = Math.round((parseFloat(je) + parseFloat(this.clfTotal) + parseFloat(this.fjfTotal)) * 100) / 100 |
|
|
|
return je |
|
|
|
}, |
|
|
|
// 计算应收金额 |
|
|
|
// 计算优惠 = 商品列表中所有优惠之和、 |
|
|
|
yhTotal() { |
|
|
|
let yh = '0' |
|
|
|
if (this.formobj.goodsVos.length > 0) { |
|
|
|
this.formobj.goodsVos.forEach((e) => { |
|
|
|
yh = Math.round((parseFloat(yh) + parseFloat(e.discountAmount !== '' ? e.discountAmount : '0')) * 100) / 100 |
|
|
|
}) |
|
|
|
} |
|
|
|
return yh |
|
|
|
}, |
|
|
|
// 计算应收金额 = 合计金额 - 优惠 |
|
|
|
ysjeTotal() { |
|
|
|
let ysje = '0' |
|
|
|
ysje = Math.round((parseFloat(ysje) + parseFloat(this.jeTotal) - parseFloat(this.formobj.discountAmount !== '' ? this.formobj.discountAmount : '0')) * 100) / 100 |
|
|
|
// - parseFloat(this.formobj.coupon !== '' ? this.formobj.coupon : '0') - parseFloat(this.formobj.scoreDeduct !== '' ? this.formobj.scoreDeduct : '0') |
|
|
|
ysje = Math.round((parseFloat(ysje) + parseFloat(this.jeTotal) - parseFloat(this.yhTotal)) * 100) / 100 |
|
|
|
return ysje |
|
|
|
}, |
|
|
|
// 结算页面中计算欠款金额 = 应付金额 - 订金抵扣 - 结算金额 - 其他结算金额 |
|
|
@ -455,6 +445,11 @@ export default { |
|
|
|
this.invoiceType_list = res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
getInvoicingList({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.companyInvoicing_list = res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
typeValues({ type: 'settle' }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.settle_list = res.data |
|
|
@ -511,6 +506,7 @@ export default { |
|
|
|
day: nowDate.getDate() |
|
|
|
} |
|
|
|
this.formobj.createTime = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day) |
|
|
|
this.formobj.invoiceVo.isInvoicing = '0' |
|
|
|
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.formobj.createOrgSid = res.data |
|
|
@ -543,14 +539,6 @@ export default { |
|
|
|
this.formobj.vehMark = value.vehMark |
|
|
|
this.formobj.vinNo = value.vinNo |
|
|
|
}, |
|
|
|
changeSubject(value) { |
|
|
|
const choose = this.subject_list.filter((item) => item.subject === value) |
|
|
|
if (choose.length > 0 && choose !== null) { |
|
|
|
this.formobj.subjectSid = choose[0].subjectSid |
|
|
|
} else { |
|
|
|
this.formobj.subjectSid = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
waitorChange(value) { |
|
|
|
const choose = this.user_list.filter((item) => item.name === value) |
|
|
|
if (choose.length > 0 && choose !== null) { |
|
|
@ -559,6 +547,16 @@ export default { |
|
|
|
this.formobj.salesUserSid = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
isInvoicingChange() { |
|
|
|
if (this.formobj.invoiceVo.isInvoicing !== '1') { |
|
|
|
this.formobj.invoiceVo.invoiceTitle = '' |
|
|
|
this.formobj.invoiceVo.invoiceTitleSid = '' |
|
|
|
this.formobj.invoiceVo.invoiceType = '' |
|
|
|
this.formobj.invoiceVo.invoiceTypeKey = '' |
|
|
|
this.formobj.invoiceVo.taxRate = '' |
|
|
|
} |
|
|
|
this.taxRateInput() |
|
|
|
}, |
|
|
|
invoiceTypeChange(value) { |
|
|
|
const choose = this.invoiceType_list.filter((item) => item.dictValue === value) |
|
|
|
if (choose.length > 0 && choose !== null) { |
|
|
@ -567,6 +565,44 @@ export default { |
|
|
|
this.formobj.invoiceVo.invoiceTypeKey = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
taxRateInput() { |
|
|
|
if (this.formobj.goodsVos.length > 0) { |
|
|
|
this.formobj.aitemVos.forEach((k) => { |
|
|
|
if (this.formobj.invoiceVo.isInvoicing === '1') { |
|
|
|
if (k.isTaxRate === '0') { |
|
|
|
// 商品进货价含税则销售价 = 原销售价 |
|
|
|
k.price = k.goodsDetailsPrice |
|
|
|
} else { |
|
|
|
// 商品进货价不含税则销售价 = 原销售价 + 原销售价 * (1 + 税率) |
|
|
|
k.price = Math.round((parseFloat(k.goodsDetailsPrice) + parseFloat(k.goodsDetailsPrice) * (parseFloat(1) + parseFloat(this.formobj.invoiceVo.taxRate !== '' ? this.formobj.invoiceVo.taxRate : '0') / 100)) * 100) / 100 |
|
|
|
} |
|
|
|
this.computeYHAndXSJE(k) |
|
|
|
} else { |
|
|
|
// 销售价 = 原销售价 |
|
|
|
k.price = k.goodsDetailsPrice |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (this.formobj.aitemVos.length > 0) { |
|
|
|
this.formobj.aitemVos.forEach((e) => { |
|
|
|
if (this.formobj.invoiceVo.isInvoicing === '1') { |
|
|
|
// 销售价 = 原销售价 + 原销售价 * (1 + 税率) |
|
|
|
e.price = Math.round((parseFloat(e.aitemPrice) + parseFloat(e.aitemPrice) * (parseFloat(1) + parseFloat(this.formobj.invoiceVo.taxRate !== '' ? this.formobj.invoiceVo.taxRate : '0') / 100)) * 100) / 100 |
|
|
|
} else { |
|
|
|
// 销售价 = 原销售价 |
|
|
|
e.price = e.aitemPrice |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
changeCompanyInvoicing(value) { |
|
|
|
const choose = this.companyInvoicing_list.filter((item) => item.companyInvoicingSid === value) |
|
|
|
if (choose.length > 0 && choose !== null) { |
|
|
|
this.formobj.invoiceVo.invoiceTitle = choose[0].companyInvoicingName |
|
|
|
} else { |
|
|
|
this.formobj.invoiceVo.invoiceTitle = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
commodityAdd() { |
|
|
|
this.formobj.goodsVos.push({ |
|
|
|
goodSpuSid: '', |
|
|
@ -576,7 +612,13 @@ export default { |
|
|
|
goodsSkuOwnSpec: '', // 规格型号 |
|
|
|
unit: '', // 计量单位 |
|
|
|
warehouseName: '', // 仓库名称 |
|
|
|
warehouseSid: '', |
|
|
|
areaName: '', // 库区 |
|
|
|
areaSid: '', |
|
|
|
warehouseRackCode: '', // 库位编号 |
|
|
|
warehouseRackSid: '', |
|
|
|
billObjName: '', // 供应商 |
|
|
|
billObjSid: '', |
|
|
|
count: '', // 出/退库数量 |
|
|
|
price: '', // 销售价 |
|
|
|
discount: '', // 折扣(0-10,0免费,10不打折) |
|
|
@ -611,10 +653,29 @@ export default { |
|
|
|
row.goodsSkuCode = value.goodsSkuCode |
|
|
|
row.goodsSkuOwnSpec = value.goodsSkuOwnSpec |
|
|
|
row.unit = value.unit |
|
|
|
row.warehouseName = '' |
|
|
|
row.warehouseRackCode = '' |
|
|
|
row.warehouseName = value.warehouseName |
|
|
|
row.warehouseSid = value.warehouseSid |
|
|
|
row.areaName = value.areaName |
|
|
|
row.areaSid = value.areaSid |
|
|
|
row.warehouseRackCode = value.warehouseRackCode |
|
|
|
row.warehouseRackSid = value.warehouseRackSid |
|
|
|
row.billObjName = value.billObjName |
|
|
|
row.billObjSid = value.billObjSid |
|
|
|
row.count = value.count |
|
|
|
row.price = value.price |
|
|
|
row.goodsDetailsPrice = value.price |
|
|
|
row.isTaxRate = value.isTaxRate |
|
|
|
if (this.formobj.invoiceVo.isInvoicing === '1') { |
|
|
|
if (row.isTaxRate === '0') { |
|
|
|
// 商品进货价含税则销售价 = 原销售价 |
|
|
|
row.price = row.goodsDetailsPrice |
|
|
|
} else { |
|
|
|
// 商品进货价不含税则销售价 = 原销售价 + 原销售价 * (1 + 税率) |
|
|
|
row.price = Math.round((parseFloat(row.goodsDetailsPrice) + parseFloat(row.goodsDetailsPrice) * (parseFloat(1) + parseFloat(this.formobj.invoiceVo.taxRate !== '' ? this.formobj.invoiceVo.taxRate : '0') / 100)) * 100) / 100 |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 销售价 = 原销售价 |
|
|
|
row.price = row.goodsDetailsPrice |
|
|
|
} |
|
|
|
row.discount = '' |
|
|
|
row.discountAmount = '' |
|
|
|
row.amount = '' |
|
|
@ -627,15 +688,15 @@ export default { |
|
|
|
commodityDelete(index) { |
|
|
|
this.formobj.goodsVos.splice(index, 1) |
|
|
|
}, |
|
|
|
// 计算优惠、销售金额 |
|
|
|
// 计算优惠、销售金额 -- 维修项目列表 |
|
|
|
computeYHAndXSJE(row) { |
|
|
|
// 计算优惠(销售价 * (1 - (折扣 * 0.1))) |
|
|
|
row.discountAmount = Math.round(((parseFloat(row.price === '' ? '0' : row.price) * parseFloat(row.count === '' ? '0' : row.count)) * Math.round((parseFloat(1) - parseFloat(row.discount === '' ? '0' : row.discount) * parseFloat(0.1)) * 100) / 100) * 100) / 100 |
|
|
|
// 计算销售金额(销售价 - 优惠) |
|
|
|
// 计算优惠(销售价 * 数量 * (1 - (折扣 * 0.1))) |
|
|
|
row.discountAmount = Math.round((parseFloat(row.price === '' ? '0' : row.price) * parseFloat(row.count !== '' ? row.count : '0') * Math.round((parseFloat(1) - parseFloat(row.discount === '' ? '0' : row.discount) * parseFloat(0.1)) * 100) / 100) * 100) / 100 |
|
|
|
// 计算销售金额(销售价 * 数量 - 优惠) |
|
|
|
if (row.price == 0) { |
|
|
|
row.amount = '0' |
|
|
|
} else { |
|
|
|
row.amount = Math.round(((parseFloat(row.price === '' ? '0' : row.price) * parseFloat(row.count === '' ? '0' : row.count)) - parseFloat(row.discountAmount === '' ? '0' : row.discountAmount)) * 100) / 100 |
|
|
|
row.amount = Math.round((parseFloat(row.price === '' ? '0' : row.price) * parseFloat(row.count !== '' ? row.count : '0') - parseFloat(row.discountAmount === '' ? '0' : row.discountAmount)) * 100) / 100 |
|
|
|
} |
|
|
|
}, |
|
|
|
subjoinAdd() { |
|
|
@ -667,13 +728,31 @@ export default { |
|
|
|
subjoinCurrentChange(value, row) { |
|
|
|
row.aitemSid = value.sid |
|
|
|
row.aitemName = value.aitemName |
|
|
|
row.price = value.price |
|
|
|
row.aitemPrice = value.price |
|
|
|
if (this.formobj.invoiceVo.isInvoicing === '1') { |
|
|
|
// 销售价 = 原销售价 + 原销售价 * (1 + 税率) |
|
|
|
row.price = Math.round((parseFloat(row.aitemPrice) + parseFloat(row.aitemPrice) * (parseFloat(1) + parseFloat(this.formobj.invoiceVo.taxRate !== '' ? this.formobj.invoiceVo.taxRate : '0') / 100)) * 100) / 100 |
|
|
|
} else { |
|
|
|
// 销售价 = 原销售价 |
|
|
|
row.price = row.aitemPrice |
|
|
|
} |
|
|
|
document.body.click() |
|
|
|
}, |
|
|
|
saveOrUpdate() { |
|
|
|
this.$refs['form_obj'].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
if (this.formobj.customerName === '') { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '客户信息不能为空' }) |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.formobj.goodsVos.length === 0) { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '商品列表不能为空' }) |
|
|
|
return |
|
|
|
} |
|
|
|
this.formobj.receivableAmount = this.ysjeTotal |
|
|
|
this.formobj.discountAmount = this.yhTotal |
|
|
|
this.formobj.goodsAmount = this.clfTotal // 材料费 |
|
|
|
this.formobj.addAmount = this.fjfTotal // 附加费 |
|
|
|
this.submitdisabled = true |
|
|
|
req.saveOrUpdate(this.formobj).then((res) => { |
|
|
|
if (res.success) { |
|
|
@ -719,6 +798,9 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
this.formobj.receivableAmount = this.ysjeTotal |
|
|
|
this.formobj.discountAmount = this.yhTotal |
|
|
|
this.formobj.goodsAmount = this.clfTotal // 材料费 |
|
|
|
this.formobj.addAmount = this.fjfTotal // 附加费 |
|
|
|
this.submitdisabled = true |
|
|
|
req.settle(this.formobj).then((res) => { |
|
|
|
if (res.success) { |
|
|
@ -733,6 +815,36 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
print() { |
|
|
|
if (this.formobj.sid !== '') { |
|
|
|
req.printSmsBill({ sid: this.formobj.sid, userSid: this.formobj.createBySid, createOrgSid: this.formobj.createOrgSid, useOrgSid: this.formobj.deptSid }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
var xhr = new XMLHttpRequest() |
|
|
|
xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + res.data + '&outFileName=' + '销售单', true) |
|
|
|
xhr.setRequestHeader('token', getStorage()) |
|
|
|
xhr.responseType = 'blob' |
|
|
|
xhr.onload = function(e) { |
|
|
|
// 如果请求执行成功 |
|
|
|
var blob = this.response |
|
|
|
var filename = '销售单.pdf' |
|
|
|
var a = document.createElement('a') |
|
|
|
// blob.type="application/octet-stream"; |
|
|
|
// 创键临时url对象 |
|
|
|
var url = URL.createObjectURL(blob) |
|
|
|
a.href = url |
|
|
|
a.download = filename |
|
|
|
a.click() |
|
|
|
// 释放之前创建的URL对象 |
|
|
|
window.URL.revokeObjectURL(url) |
|
|
|
} |
|
|
|
// 发送请求 |
|
|
|
xhr.send() |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '请保存相关信息后在进行打印' }) |
|
|
|
} |
|
|
|
}, |
|
|
|
resetState() { |
|
|
|
this.viewState = 1 |
|
|
|
}, |
|
|
@ -740,6 +852,10 @@ export default { |
|
|
|
if (isreload === 'true') this.$emit('reloadlist') |
|
|
|
this.formobj = { |
|
|
|
sid: '', |
|
|
|
createOrgSid: '', |
|
|
|
createOrgName: '', |
|
|
|
useOrgSid: '', |
|
|
|
useOrgName: '', |
|
|
|
createTime: '', |
|
|
|
createByName: '', |
|
|
|
createBySid: '', |
|
|
@ -762,14 +878,17 @@ export default { |
|
|
|
scoreDeduct: '', |
|
|
|
customerOrg: '', |
|
|
|
receivableAmount: '', |
|
|
|
goodsAmount: '', |
|
|
|
addAmount: '', |
|
|
|
invoiceVo: { |
|
|
|
isInvoicing: '', |
|
|
|
invoiceType: '', |
|
|
|
invoiceTypeKey: '', |
|
|
|
invoiceTitle: '', |
|
|
|
taxpayerNo: '', |
|
|
|
invoiceCode: '', |
|
|
|
taxRate: '' |
|
|
|
taxRate: '', |
|
|
|
invoiceTitleSid: '', |
|
|
|
invoiceTitle: '' |
|
|
|
}, |
|
|
|
aitemVos: [], |
|
|
|
goodsVos: [], |
|
|
@ -812,11 +931,9 @@ export default { |
|
|
|
margin-left: 120px !important; |
|
|
|
width: calc(100% - 115px); |
|
|
|
} |
|
|
|
.titleOne { |
|
|
|
padding: 7px; |
|
|
|
display: flex; |
|
|
|
flex-direction: row; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .el-radio-group { |
|
|
|
display: inline; |
|
|
|
line-height: 1px; |
|
|
|
vertical-align: middle; |
|
|
|
} |
|
|
|
</style> |
|
|
|