detailsPage.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div v-if="!auditDisabled" class="upper_right_button">
  10. <el-button type="primary" size="small" v-if="viewDisabled" class="el-button--small-yh " :loading="buttonLoading"
  11. @click.stop="openEdit()">编辑
  12. </el-button>
  13. <el-dropdown style="padding: 0 6px;line-height: 0">
  14. <el-button type="primary" size="small" :loading="buttonLoading" :disabled="!form.id">
  15. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  16. </el-button>
  17. <el-dropdown-menu slot="dropdown">
  18. <el-dropdown-item :loading="buttonLoading" @click.native="auditCheck">审核数据</el-dropdown-item>
  19. <el-dropdown-item @click.native="checkScheduleDialog = true">审核进度</el-dropdown-item>
  20. <el-dropdown-item disabled>撤销审核</el-dropdown-item>
  21. </el-dropdown-menu>
  22. </el-dropdown>
  23. <el-dropdown style="padding: 0 6px;line-height: 0" v-if="false">
  24. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  25. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  26. </el-button>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item @click.native="applySettlement('收费')">生成账单
  29. </el-dropdown-item>
  30. <el-dropdown-item @click.native="applySettlement('申请')">申请退款
  31. </el-dropdown-item>
  32. <el-dropdown-item @click.native="openApplicationDialog">查看账单
  33. </el-dropdown-item>
  34. </el-dropdown-menu>
  35. </el-dropdown>
  36. <el-dropdown style="padding: 0 6px;line-height: 0">
  37. <el-button type="success" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  38. 业务处理<i class="el-icon-arrow-down el-icon--right"></i>
  39. </el-button>
  40. <el-dropdown-menu slot="dropdown">
  41. <el-dropdown-item @click.native="createData()">创建单据
  42. </el-dropdown-item>
  43. <el-dropdown-item @click.native="copyData()">复制单据
  44. </el-dropdown-item>
  45. </el-dropdown-menu>
  46. </el-dropdown>
  47. <div>
  48. <el-button class="el-button--small-yh" type="primary" size="small" :disabled="disabled || viewDisabled"
  49. :loading="buttonLoading" @click="editCustomer">保存数据
  50. </el-button>
  51. </div>
  52. </div>
  53. <div v-if="auditDisabled" class="upper_right_button">
  54. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  55. @click.stop="checkScheduleDialog = true, checkId = detailData.check.srcBillId">
  56. 审批流程
  57. </el-button>
  58. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  59. :disabled="buttonDisabled" @click.stop="checkDialog = true">
  60. 审批
  61. </el-button>
  62. </div>
  63. </div>
  64. <div class="customer-main">
  65. <el-form :model="form" ref="form" label-width="130px">
  66. <trade-card title="基础信息">
  67. <el-row>
  68. <el-col v-for="(item, index) in basicData.column" :span="item.span ? item.span : 8" :key="index">
  69. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  70. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  71. :disabled="viewDisabled || takeDisabled" size="small" type="date" placeholder="选择日期"
  72. value-format="yyyy-MM-dd HH:mm:ss" />
  73. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]"
  74. :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" clearable filterable>
  75. <el-option v-for="(data, index) in item.dicData" :key="index" :label="data.label" :value="data.value">
  76. </el-option>
  77. </el-select>
  78. <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]"
  79. :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" @change="currencyChange"
  80. clearable filterable>
  81. <el-option v-for="(item, index) in currencyDic" :key="index" :label="item.dictValue"
  82. :disabled="viewDisabled || takeDisabled" :value="item.dictValue"></el-option>
  83. </el-select>
  84. <crop-select v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" corpType="KH"
  85. :disabled="viewDisabled || takeDisabled" style="width: 100%"></crop-select>
  86. <crop-select v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]"
  87. :disabled="viewDisabled || takeDisabled" corpType="GS"></crop-select>
  88. <user-com v-else-if="item.prop === 'salesName'" :disabled="viewDisabled || takeDisabled"
  89. v-model="form[item.prop]" style="width: 100%"></user-com>
  90. <el-input type="age" v-else-if="item.type === 'unit'" v-model="form[item.prop]"
  91. @change="downPaymentChange" :disabled="viewDisabled || takeDisabled" size="small" autocomplete="off"
  92. placeholder="请输入">
  93. <template slot="append">%</template>
  94. </el-input>
  95. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]"
  96. :disabled="viewDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
  97. <el-input type="age" v-else v-model="form[item.prop]" size="small"
  98. :disabled="item.disabled ? true : false || viewDisabled" autocomplete="off" placeholder="请输入">
  99. </el-input>
  100. </el-form-item>
  101. </el-col>
  102. </el-row>
  103. </trade-card>
  104. <!-- 销售明细-->
  105. <trade-card title="销售明细">
  106. <avue-crud :option="importInventory" v-model="importInventoryForm" :data="importInventoryData"
  107. ref="importInventory" :cell-style="cellStyle" @row-save="rowSaveList" @row-update="rowUpdateList"
  108. @row-del="rowDelList" @selection-change="productSelection" @saveColumn="saveColumn"
  109. @resetColumn="resetColumn">
  110. <template slot-scope="{row}" slot="billNo">
  111. <span v-if="row.$cellEdit" class="required_fields">*</span>
  112. <el-input v-if="row.$cellEdit" v-model="row.billNo" style="width: 90%" placeholder=" " size="small"
  113. @change="bingOut(row)"></el-input>
  114. <span v-else>{{ row.billNo }}</span>
  115. </template>
  116. <template slot-scope="{row}" slot="orgOrderNo">
  117. <span v-if="row.$cellEdit" class="required_fields">*</span>
  118. <el-select v-if="row.$cellEdit" style="width:90% !important;" v-model="row.orgOrderNo" placeholder=" "
  119. size="small" clearable filterable>
  120. <el-option v-for="(item, index) in contractDic" :key="index" :label="item.orderNo"
  121. :value="item.orderNo">
  122. </el-option>
  123. </el-select>
  124. <span v-else>{{ row.orgOrderNo }}</span>
  125. </template>
  126. <template slot="price" slot-scope="{ row }">
  127. <el-input v-if="row.$cellEdit" v-model="row.price" placeholder="请输入" size="small"
  128. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  129. </el-input>
  130. <!-- @input="priceChange(row)"-->
  131. <span v-else>{{ row.price }}</span>
  132. </template>
  133. <template slot="orderQuantity" slot-scope="{ row }">
  134. <span v-if="row.$cellEdit" class="required_fields">*</span>
  135. <el-input v-if="row.$cellEdit" v-model="row.orderQuantity" style="width: 90%" placeholder="请输入"
  136. size="small"
  137. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  138. </el-input>
  139. <span v-else>{{ row.orderQuantity | roundNumbers }}</span>
  140. </template>
  141. <template slot="priceCategory" slot-scope="{row,index}">
  142. <span v-if="row.$cellEdit" class="required_fields">*</span>
  143. <goods-select style="width:90% !important;" v-if="row.$cellEdit" v-model="row.priceCategoryNames"
  144. @valueName="(value) => valueName(value, row)" :configuration="itemConfiguration">
  145. </goods-select>
  146. <span v-else>{{ row.priceCategoryNames }}</span>
  147. </template>
  148. <template slot="invoiceWeight" slot-scope="{ row }">
  149. <span v-if="row.$cellEdit" class="required_fields">*</span>
  150. <el-input v-if="row.$cellEdit" v-model="row.invoiceWeight" style="width: 90%" placeholder="请输入"
  151. size="small"
  152. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  153. @change="totalChange(row.invoiceWeight)"></el-input>
  154. <span v-else>{{ row.invoiceWeight }}</span>
  155. </template>
  156. <template slot="billWeight" slot-scope="{ row }">
  157. <el-input v-if="row.$cellEdit" v-model="row.billWeight" placeholder="请输入" style="width: 90%" size="small"
  158. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  159. @change="totalChange(row.billWeight)"></el-input>
  160. <!-- @input="billWeightChange(row)"-->
  161. <span v-else>{{ row.billWeight }}</span>
  162. </template>
  163. <template slot="grossWeight" slot-scope="{ row }">
  164. <el-input v-if="row.$cellEdit" v-model="row.grossWeight" style="width: 90%" placeholder="请输入" size="small"
  165. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  166. </el-input>
  167. <span v-else>{{ row.grossWeight }}</span>
  168. </template>
  169. <template slot="amount" slot-scope="{ row }">
  170. <el-input v-if="row.$cellEdit" v-model="row.amount" placeholder="请输入" size="small"
  171. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  172. </el-input>
  173. <span v-else>{{ row.amount }}</span>
  174. </template>
  175. <template slot="taxRate" slot-scope="{ row }">
  176. <el-input v-if="row.$cellEdit" v-model="row.taxRate" size="small"
  177. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  178. autocomplete="off">
  179. <i slot="suffix" style="margin-top:3px;margin-right: 10px;display:inline-block">%</i>
  180. </el-input>
  181. <span v-else>{{ row.taxRate | isPercentage }}</span>
  182. </template>
  183. <template slot="actualQuantity" slot-scope="{ row }">
  184. <span>{{ row.actualQuantity | roundNumbers }}</span>
  185. </template>
  186. <template slot="menuLeft" slot-scope="{ row }">
  187. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="viewDisabled"
  188. :loading="buttonLoading" @click="newDetails">录入明细</el-button>
  189. <!-- <el-button type="warning" size="small" :loading="buttonLoading"
  190. :disabled="selection.length ==0|| form.status!=1 " @click="generateShipmentD">生成发货单
  191. </el-button>-->
  192. <el-button type="warning" size="small" :loading="buttonLoading"
  193. @click="generateShipmentD">生成发货单
  194. </el-button>
  195. <!-- <el-button type="info"
  196. size="small"
  197. :disabled="importInventoryData.length < 1"
  198. @click="payeeDialog = true"
  199. >收款记录
  200. </el-button>-->
  201. </template>
  202. <template slot-scope="{row,index}" slot="menu">
  203. <el-button type="text" size="small" icon="el-icon-edit" :disabled="viewDisabled"
  204. @click="rowCell(row, index)">{{ row.$cellEdit ? '修改完成' : '修改' }}
  205. </el-button>
  206. <el-button type="text" size="small" icon="el-icon-delete" :disabled="viewDisabled"
  207. @click="rowDelList(row, index)">删除
  208. </el-button>
  209. </template>
  210. </avue-crud>
  211. </trade-card>
  212. <fee-info ref="feeInfo" @beforeFinance="beforeFinance" @afterFinance="afterFinance" :disabled="viewDisabled"
  213. :orderFeesList="orderFeesList" :itemType="'采购'" :optionType="'JK'" feeUrl="" :corpId="form.corpId" />
  214. <upload-file ref="uploadFile" title="合同附件" :disabled="viewDisabled"
  215. :orderFilesList="orderFilesList || viewDisabled" delUrl="" />
  216. </el-form>
  217. </div>
  218. <el-dialog title="收款记录" append-to-body class="el-dialogDeep" :visible.sync="payeeDialog" width="60%"
  219. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  220. <basic-container>
  221. <avue-crud :option="importInventory" :table-loading="payeeLoading" :data="payeeData" ref="applicationCrud"
  222. @refresh-change="payeeRefreshChange" :page.sync="payeePage" @on-load="payeeOnLoad"></avue-crud>
  223. </basic-container>
  224. <span slot="footer" class="dialog-footer">
  225. <el-button @click="payeeDialog = false">关 闭</el-button>
  226. </span>
  227. </el-dialog>
  228. <el-dialog append-to-body class="el-dialogDeep" :visible.sync="applySettlementDialog" width="60%"
  229. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  230. <apply-payment :billUrl="billUrl" :billType="billType" :billData="billData" @choceFun="choceFun">
  231. </apply-payment>
  232. </el-dialog>
  233. <el-dialog append-to-body title="账单" class="el-dialogDeep" :visible.sync="financialAccountDialog" width="70%"
  234. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  235. <financial-account :billId="form.id" :billType="billType" :billData="billData"
  236. :belongCompany="form.belongToCorpId" @choceFun="choceFun">
  237. </financial-account>
  238. </el-dialog>
  239. <el-dialog title="收款记录" append-to-body class="el-dialogDeep" :visible.sync="applicationDialog" width="60%"
  240. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  241. <bill-application :billId="form.id" @choceApplication="choceApplication">
  242. </bill-application>
  243. </el-dialog>
  244. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  245. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  246. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  247. </check-schedule>
  248. </el-dialog>
  249. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  250. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  251. <check :checkData="detailData.check" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  252. </check>
  253. </el-dialog>
  254. </div>
  255. </template>
  256. <script>
  257. import importInventory from './config/importInventory.json';
  258. import {
  259. detailSaleList,
  260. submitData,
  261. goodsListRemove,
  262. getOrgOrderNo
  263. } from "@/api/importTrade/salesContract"
  264. import feeInfo from "@/components/fee-info/main";
  265. import uploadFile from "@/components/upload-file/main";
  266. import { contrastObj, contrastList } from "@/util/contrastData";
  267. import _ from "lodash";
  268. import { isPercentage, roundNumbers } from "@/util/validate";
  269. //账单组件
  270. import financialAccount from "../../../components/finance/financialAccount";
  271. import ApplyPayment from "../../../components/finance/applyPayment";
  272. import billApplication from "@/components/bill/billApplication";
  273. import checkSchedule from "../../../components/check/checkSchedule";
  274. import check from "@/components/check/check";
  275. import { pleaseCheck } from "@/api/basicData/configuration"
  276. export default {
  277. name: "detailsPage",
  278. props: {
  279. detailData: {
  280. type: Object
  281. }
  282. },
  283. filters: {
  284. isPercentage(val) {
  285. return isPercentage(val);
  286. },
  287. roundNumbers(val) {
  288. return roundNumbers(val);
  289. }
  290. },
  291. components: {
  292. ApplyPayment,
  293. feeInfo,
  294. financialAccount,
  295. uploadFile,
  296. billApplication,
  297. checkSchedule,
  298. check
  299. },
  300. data() {
  301. return {
  302. disabled: false,
  303. buttonLoading: false,
  304. dialogCommodity: false,
  305. applySettlementDialog: false,
  306. financialAccountDialog: false,
  307. applicationDialog: false,
  308. viewDisabled: false,
  309. takeDisabled: false,
  310. buttonDisabled: false,
  311. checkScheduleDialog: false,//审批窗口
  312. auditDisabled: false,//显示审批按钮还是正常按钮
  313. checkDialog: false,//审批窗口
  314. approverDisabled: false,//是否审批过了
  315. batchNo: '',//审批流程
  316. lockData: {},
  317. form: {},
  318. orderFeesList: [],
  319. orderFilesList: [],
  320. currencyDic: [],
  321. contractDic: [],
  322. selectKind: -1,
  323. billUrl: "",
  324. billType: "",
  325. billData: {},
  326. itemConfiguration: {
  327. multipleChoices: false,
  328. multiple: false,
  329. disabled: false,
  330. searchShow: true,
  331. collapseTags: false,
  332. placeholder: '请点击右边按钮选择',
  333. dicData: []
  334. },
  335. // 基础信息
  336. basicData: {
  337. column: [
  338. {
  339. label: '系统号',
  340. prop: 'sysNo',
  341. disabled: true,
  342. rules: [
  343. {
  344. required: false,
  345. message: ' ',
  346. trigger: 'blur'
  347. }
  348. ]
  349. },
  350. {
  351. label: '客户名称',
  352. span: 16,
  353. prop: 'corpId',
  354. rules: [
  355. {
  356. required: true,
  357. message: ' ',
  358. trigger: 'blur'
  359. }
  360. ]
  361. },
  362. {
  363. label: '合同号',
  364. prop: 'orderNo',
  365. rules: [
  366. {
  367. required: true,
  368. message: ' ',
  369. trigger: 'blur'
  370. }
  371. ]
  372. },
  373. {
  374. label: '所属公司',
  375. prop: 'belongToCorpId',
  376. span: 16,
  377. dicData: [],
  378. rules: [
  379. {
  380. required: true,
  381. message: ' ',
  382. trigger: 'blur'
  383. }
  384. ]
  385. },
  386. {
  387. label: '合同日期',
  388. prop: 'businesDate',
  389. type: 'datetime',
  390. data: [],
  391. rules: [
  392. {
  393. required: false,
  394. message: ' ',
  395. trigger: 'blur'
  396. }
  397. ]
  398. },
  399. {
  400. label: '合同金额',
  401. prop: 'orderAmount',
  402. rules: [
  403. {
  404. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  405. message: ' ',
  406. trigger: 'blur'
  407. }
  408. ]
  409. },
  410. {
  411. label: '合同重量(吨)',
  412. prop: 'contractWeight',
  413. rules: [
  414. {
  415. required: false,
  416. message: ' ',
  417. trigger: 'blur'
  418. }
  419. ]
  420. },
  421. {
  422. label: '销售单价',
  423. prop: 'salesPrice',
  424. rules: [
  425. {
  426. required: false,
  427. message: ' ',
  428. trigger: 'blur'
  429. }
  430. ]
  431. },
  432. {
  433. label: '币别',
  434. prop: 'currency',
  435. }, {
  436. label: '汇率',
  437. prop: 'exchangeRate',
  438. rules: [
  439. {
  440. required: false,
  441. message: ' ',
  442. trigger: 'blur'
  443. }
  444. ]
  445. },
  446. {
  447. label: '客户首付日期',
  448. prop: 'advanceCollectionDate',
  449. type: 'datetime',
  450. rules: [
  451. {
  452. required: false,
  453. message: ' ',
  454. trigger: 'blur'
  455. }
  456. ]
  457. },
  458. {
  459. label: '首付比例',
  460. type: "unit",
  461. prop: 'downPayment',
  462. rules: [
  463. {
  464. required: false,
  465. message: ' ',
  466. trigger: 'blur'
  467. }
  468. ]
  469. },
  470. {
  471. label: '首付金额',
  472. prop: 'advancePayment',
  473. rules: [
  474. {
  475. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  476. message: ' ',
  477. trigger: 'blur'
  478. }
  479. ]
  480. },
  481. {
  482. label: '已收人民币金额',
  483. prop: 'settlmentAmount',
  484. disabled: true,
  485. },
  486. {
  487. label: '已收外币金额',
  488. prop: 'foreignSettlmentAmount',
  489. disabled: true,
  490. },
  491. {
  492. label: '计划交期',
  493. prop: 'plannedDeliveryDate',
  494. type: 'datetime',
  495. },
  496. {
  497. label: '已退人民币金额',
  498. prop: 'refundSettlmentAmount',
  499. disabled: true,
  500. },
  501. {
  502. label: '已退外币金额',
  503. prop: 'refundForeignSettlmentAmount',
  504. disabled: true,
  505. },
  506. {
  507. label: '业务员',
  508. prop: 'salesName',
  509. dicData: [],
  510. },
  511. {
  512. label: '发票重量',
  513. prop: 'invoiceWeight',
  514. disabled: true,
  515. },
  516. {
  517. label: '码单重量',
  518. prop: 'billWeight',
  519. disabled: true,
  520. },
  521. {
  522. label: '开票单位',
  523. prop: 'vbrk',
  524. },
  525. {
  526. label: '包装要求',
  527. prop: 'packageRemarks',
  528. rules: [
  529. {
  530. required: false,
  531. message: ' ',
  532. trigger: 'blur'
  533. }
  534. ]
  535. },
  536. {
  537. label: "备注",
  538. span: 24,
  539. prop: "orderRemark",
  540. mock: {
  541. type: 'county'
  542. }
  543. }
  544. ],
  545. },
  546. //收款记录
  547. payeeDialog: false,
  548. payeeLoading: false,
  549. payeeData: [],
  550. payeePage: {
  551. pageSize: 10,
  552. currentPage: 1,
  553. total: 0
  554. },
  555. // 导入库存配置
  556. importInventory: {},
  557. importInventoryForm: {},
  558. importInventoryData: [],
  559. selection: [],
  560. //新旧数据对比
  561. oldForm: {},
  562. oldInventoryData: [],
  563. oldFeesList: [],
  564. oldFilesList: [],
  565. }
  566. },
  567. async created() {
  568. this.importInventory = await this.getColumnData(this.getColumnName(39), importInventory);
  569. //币别
  570. this.getWorkDicts("currency").then(res => {
  571. this.currencyDic = res.data.data
  572. if (!this.detailData.id) {
  573. this.$set(this.form, "currency", "USD")
  574. this.currencyChange("USD")
  575. }
  576. })
  577. if (this.detailData.view) {
  578. this.viewDisabled = true
  579. }
  580. if (this.detailData.id) {
  581. this.buttonLoading = true;
  582. let id = this.detailData.id.replace(/\"/g, "")
  583. detailSaleList(id).then(res => {
  584. this.afterEcho(res.data.data)
  585. }).finally(() => {
  586. this.buttonLoading = false
  587. })
  588. } else {
  589. //采购日期默认当天
  590. let date = new Date();
  591. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  592. this.$set(this.form, "businesDate", strDate)
  593. }
  594. if (this.detailData.check) {
  595. //待审批状态才可选择通过或者驳回
  596. if (this.detailData.check.auditStatus === "S") {
  597. this.buttonDisabled = false
  598. }
  599. this.viewDisabled = true //查看审批不能编辑
  600. this.auditDisabled = true
  601. this.buttonLoading = true;
  602. this.batchNo = this.detailData.check.batchNo
  603. let id = this.detailData.check.srcBillId.replace(/\"/g, "")
  604. detailSaleList(id).then(res => {
  605. this.afterEcho(res.data.data)
  606. }).finally(() => {
  607. this.buttonLoading = false;
  608. })
  609. }
  610. },
  611. methods: {
  612. valueName(value, row) {
  613. this.$set(row, "priceCategory", value.id)
  614. },
  615. //首付比例 带出金额
  616. downPaymentChange() {
  617. if (this.form.orderAmount) {
  618. this.$set(this.form, "advancePayment", _.multiply(this.form.orderAmount, (this.form.downPayment * 0.01)).toFixed(2))
  619. }
  620. },
  621. //合计
  622. totalChange() {
  623. let invoiceList = this.importInventoryData.map(item => {
  624. if (item.invoiceWeight) {
  625. return parseFloat(item.invoiceWeight);
  626. } else return 0
  627. });
  628. let billList = this.importInventoryData.map(item => {
  629. if (item.billWeight) {
  630. return parseFloat(item.billWeight);
  631. } else return 0
  632. });
  633. this.$set(this.form, "invoiceWeight", invoiceList.reduce((n, m) => n + m))
  634. this.$set(this.form, "billWeight", billList.reduce((n, m) => n + m))
  635. },
  636. //带出汇率
  637. currencyChange(value) {
  638. this.currencyDic.forEach(item => {
  639. if (item.dictValue === value) {
  640. this.$set(this.form, "exchangeRate", item.remark)
  641. }
  642. })
  643. },
  644. //单价
  645. priceChange(row) {
  646. if (row.price && row.billWeight) {
  647. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  648. }
  649. },
  650. //数量
  651. billWeightChange(row) {
  652. if (row.price && row.billWeight) {
  653. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  654. }
  655. },
  656. //提单号带出合同号
  657. bingOut(row) {
  658. getOrgOrderNo(row.billNo).then(res => {
  659. if (res.data.length != 0) {
  660. this.contractDic = res.data;
  661. row.orgOrderNo = res.data[0].orderNo
  662. row.itemId = res.data[0].itemId;
  663. row.priceCategoryNames = res.data[0].itemName[0].cname
  664. row.priceCategory = res.data[0].itemName[0].id
  665. row.cntrNo = res.data[0].cntrNo
  666. } else {
  667. this.$message.warning("无此提单号记录!");
  668. this.contractDic = [];
  669. row.orgOrderNo = ''
  670. row.itemId = ''
  671. row.priceCategoryNames = ''
  672. row.priceCategory = ''
  673. }
  674. }).catch(() => {
  675. row.orgOrderNo = ''
  676. })
  677. },
  678. //打开申请记录
  679. openApplicationDialog() {
  680. this.applicationDialog = true
  681. },
  682. //关闭申记录
  683. choceApplication() {
  684. this.applicationDialog = false
  685. },
  686. //生成账单数据
  687. beforeBillData(bool, type) {
  688. this.billType = type
  689. this.billData = {
  690. srcOrderno: this.form.orderNo,
  691. itemType: "销售",
  692. optionType: 'JK',
  693. billNoList: this.importInventoryData.map(item => { return item.billNo }),
  694. amount: this.form.orderAmount,
  695. belongToCorpId: this.form.belongToCorpId,
  696. corpsName: this.form.corpName,
  697. corpId: this.form.corpId,
  698. price: this.form.salesPrice,
  699. accDate: this.form.businesDate,
  700. currency: this.form.currency,
  701. exchangeRate: this.form.exchangeRate,
  702. srcParentId: this.form.id,
  703. }
  704. if (type) { //申请货款
  705. this.billData.srcId = -1
  706. }
  707. },
  708. //费用明细回调验证
  709. beforeFinance(feesData, callback) {
  710. let params = {}
  711. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  712. || contrastList(feesData, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  713. ) {
  714. this.$confirm("数据发生变化,请先提交保存?", {
  715. confirmButtonText: "保存",
  716. cancelButtonText: "取消",
  717. type: "warning"
  718. }).then(() => {
  719. this.editCustomer();
  720. }).finally(() => {
  721. params.valid = false
  722. callback(params)
  723. })
  724. } else {
  725. params.valid = true
  726. params.parentId = this.form.id
  727. params.srcOrderno = this.form.orderNo
  728. callback(params)
  729. }
  730. },
  731. //生成账单之后需要更新明细列表的属性
  732. afterFinance() {
  733. detailSaleList(this.form.id).then(res => {
  734. this.afterEcho(res.data.data)
  735. })
  736. },
  737. //请核
  738. auditCheck() {
  739. if (this.verificationData()) {
  740. this.$confirm("确定审核此订单?", {
  741. confirmButtonText: "确定",
  742. cancelButtonText: "取消",
  743. type: "warning"
  744. }).then(() => {
  745. this.buttonLoading = true
  746. const data = {
  747. id: this.form.id,
  748. checkType: 'xsqh',
  749. url: '/salesManagement/salesContract/index',
  750. pageStatus: "this.$store.getters.entranceXsStatus",
  751. pageLabel: "销售订单",
  752. checkFlag: 2,
  753. }
  754. pleaseCheck(data).then(res => {
  755. if (res.data.success) {
  756. this.$message.success("操作成功!")
  757. this.viewDisabled = true
  758. this.approverDisabled = true
  759. }
  760. })
  761. }).finally(() => {
  762. this.buttonLoading = false
  763. })
  764. }
  765. },
  766. //财务操作
  767. applySettlement(type) {
  768. if (this.verificationData()) {
  769. this.beforeBillData(true, type)
  770. this.financialAccountDialog = true;
  771. }
  772. },
  773. choceFun() {
  774. this.financialAccountDialog = false
  775. },
  776. //刷新
  777. payeeRefreshChange() {
  778. console.log(1)
  779. },
  780. //申请记录
  781. payeeOnLoad() {
  782. console.log(1)
  783. },
  784. //商品选中触发
  785. productSelection(selection) {
  786. this.selection = selection
  787. },
  788. //生成发货单
  789. generateShipmentD() {
  790. if (this.verificationData()) {
  791. if (this.$store.getters.goStatus) {
  792. this.$alert("发货单页面已存在,请关闭发货单再进行操作", "温馨提示", {
  793. confirmButtonText: "确定",
  794. type: 'warning',
  795. callback: action => {
  796. }
  797. });
  798. } else {
  799. const params = {
  800. id: this.form.id,
  801. orderItemIds: this.selection.map(i => { return i.id })
  802. }
  803. this.$router.push({
  804. path: "/importTrade/invoice/index",
  805. query: { form: params },
  806. });
  807. this.$router.$avueRouter.closeTag('/importTrade/invoice/index');
  808. }
  809. }
  810. },
  811. //录入明细
  812. newDetails() {
  813. const params = {
  814. price: this.form.salesPrice,
  815. exRate: this.form.exchangeRate
  816. }
  817. this.$refs.importInventory.rowCellAdd(params);
  818. },
  819. //商品编辑
  820. rowCell(row, index) {
  821. this.$refs.importInventory.rowCell(row, index)
  822. },
  823. //新增明细保存触发
  824. rowSaveList(row, done, loading) {
  825. done()
  826. },
  827. //修改明细触发
  828. rowUpdateList(row, index, done, loading) {
  829. done(row);
  830. },
  831. //关闭审核
  832. choceCheckFun() {
  833. this.checkDialog = false;
  834. },
  835. choceScheduleFun() {
  836. this.checkScheduleDialog = false
  837. },
  838. //删除商品明细触发
  839. rowDelList(row, index, donerowDel) {
  840. this.$confirm("确定将选择数据删除?", {
  841. confirmButtonText: "确定",
  842. cancelButtonText: "取消",
  843. type: "warning"
  844. }).then(() => {
  845. if (row.id) {
  846. goodsListRemove(row.id).then(res => {
  847. this.$message({
  848. type: "success",
  849. message: "操作成功!"
  850. });
  851. this.importInventoryData.splice(index, 1);
  852. })
  853. } else {
  854. this.$message({
  855. type: "success",
  856. message: "操作成功!"
  857. });
  858. this.importInventoryData.splice(index, 1);
  859. }
  860. }).finally(() => {
  861. this.totalChange()
  862. })
  863. },
  864. //修改
  865. editCustomer(status) {
  866. this.$refs["form"].validate((valid) => {
  867. if (valid) {
  868. let orderFeesList = this.$refs.feeInfo.submitData();
  869. for (let i = 0; i < orderFeesList.length; i++) {
  870. if (orderFeesList[i].corpId == null) {
  871. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  872. }
  873. if (orderFeesList[i].price == 0) {
  874. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  875. }
  876. if (orderFeesList[i].orderQuantity == 0) {
  877. return this.$message.error(`请正确输入第${i + 1}行的件数`);
  878. }
  879. }
  880. let orderUpLoadList = this.$refs.uploadFile.submitData();
  881. for (let j = 0; j < this.importInventoryData.length; j++) {
  882. if (this.importInventoryData[j].billNo === (null || "")) {
  883. return this.$message.error(`请输入销售明细第${j + 1}行的提单号`);
  884. }
  885. if (this.importInventoryData[j].orgOrderNo === (null || "")) {
  886. return this.$message.error(`请输入销售明细第${j + 1}行的合同号`);
  887. }
  888. if (this.importInventoryData[j].priceCategory === (null || "")) {
  889. return this.$message.error(`请输入销售明细第${j + 1}行的货品物种`);
  890. }
  891. if (this.importInventoryData[j].orderQuantity === (null || "")) {
  892. return this.$message.error(`请输入销售明细第${j + 1}行的件数`);
  893. }
  894. if (this.importInventoryData[j].invoiceWeight === (null || "")) {
  895. return this.$message.error(`请输入销售明细第${j + 1}行的发票重量`);
  896. }
  897. }
  898. this.buttonLoading = true;
  899. if (this.importInventoryData.length !== 0) {
  900. //提单号
  901. this.form.billNo = Array.from(new Set(this.importInventoryData.map(item => { return item.billNo }))).join(",")
  902. //发票金额合计 存入主表
  903. let invoiceList = this.importInventoryData.map(item => {
  904. if (item.amount) {
  905. return parseFloat(item.amount);
  906. } else return 0
  907. });
  908. this.form.invoiceAmount = invoiceList.reduce((n, m) => n + m)
  909. }
  910. let submitDto = {
  911. ...this.form,
  912. orderItemsList: this.importInventoryData,
  913. orderFeesList: orderFeesList,
  914. orderUpLoadList: orderUpLoadList,
  915. };
  916. submitData(submitDto).then(res => {
  917. if (res.data.success) {
  918. this.$message.success("操作成功!")
  919. detailSaleList(res.data.data.id).then(res => {
  920. this.afterEcho(res.data.data)
  921. })
  922. }
  923. })
  924. .finally(() => {
  925. this.buttonLoading = false
  926. })
  927. if (status === true) {
  928. this.$emit("goBack");
  929. }
  930. } else {
  931. return false;
  932. }
  933. });
  934. },
  935. afterEcho(data) {
  936. this.form = data;
  937. this.oldForm = Object.assign({}, data);
  938. this.importInventoryData = data.orderItemsList
  939. //销售明细列表如果存在已发数量或重量不为0 则此订单已发货 禁止编辑主要参数
  940. this.takeDisabled = this.importInventoryData.map(item => { if (item.actualQuantity != 0 || item.actualWeight != 0) return true }).some(item => { return item == true })
  941. this.basicData.column.forEach(item => {
  942. if (item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight") {
  943. item.disabled = this.takeDisabled
  944. }
  945. })
  946. if (data.orderItemsList) {
  947. this.importInventoryData = data.orderItemsList
  948. this.oldInventoryData = this.deepClone(data.orderItemsList)
  949. }
  950. if (data.orderFeesList) {
  951. this.orderFeesList = data.orderFeesList
  952. this.oldFeesList = this.deepClone(data.orderFeesList)
  953. }
  954. if (data.orderFilesList) {
  955. this.orderFilesList = data.orderFilesList
  956. this.oldFilesList = this.deepClone(data.orderFilesList)
  957. }
  958. if (this.detailData.status === 'copy') {
  959. this.copyData()
  960. }
  961. },
  962. //验证数据
  963. verificationData() {
  964. this.orderFeesList = this.$refs.feeInfo.submitData();
  965. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  966. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  967. ) {
  968. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  969. confirmButtonText: "保存",
  970. cancelButtonText: "取消",
  971. type: "warning",
  972. }).then(() => {
  973. this.editCustomer()
  974. }).catch(() => {
  975. return false
  976. })
  977. } else {
  978. return true
  979. }
  980. },
  981. createData() {
  982. if (this.verificationData()) {
  983. this.$confirm("确定创建新的单据吗?", "提示", {
  984. confirmButtonText: "保存",
  985. cancelButtonText: "取消",
  986. type: "warning",
  987. }).then(() => {
  988. this.form = {}
  989. this.oldForm = {}
  990. this.importInventoryData = []
  991. this.oldInventoryData = []
  992. this.orderFeesList = []
  993. this.oldFeesList = []
  994. this.orderFilesList = []
  995. this.oldFilesList = []
  996. })
  997. }
  998. },
  999. //复制单据
  1000. copyData() {
  1001. if (this.verificationData()) {
  1002. this.takeDisabled = false
  1003. this.basicData.column.forEach(item => {
  1004. if (item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight") {
  1005. item.disabled = this.takeDisabled
  1006. }
  1007. })
  1008. delete this.form.id //删除id
  1009. this.$set(this.form, "sysNo", "")//系统编号
  1010. this.$set(this.form, "orderNo", "")//合同号
  1011. this.$set(this.form, "settlmentAmount", "")//已付人民币
  1012. this.$set(this.form, "foreignSettlmentAmount", "")//已付外币
  1013. this.$set(this.form, "refundSettlmentAmount", "")//已退人民币
  1014. this.$set(this.form, "refundForeignSettlmentAmount", "")//已退外币
  1015. this.importInventoryData.forEach(item => {
  1016. delete item.id //删除id
  1017. item.actualQuantity = "" //已收件数
  1018. item.actualWeight = "" //已收发票
  1019. })
  1020. this.orderFeesList.forEach(item => {
  1021. delete item.id //删除id
  1022. })
  1023. this.oldForm = {}
  1024. this.oldInventoryData = []
  1025. this.oldFeesList = []
  1026. this.oldFilesList = []
  1027. this.$message.success("复制成功!")
  1028. }
  1029. },
  1030. async openEdit() {
  1031. if (this.approverDisabled || this.form.status != 0) { //是否审批
  1032. this.$message.warning("此订单已提交审批,不可编辑!")
  1033. return
  1034. }
  1035. //标签页保存key
  1036. this.inDetailsKey(this.$route.name, this.detailData.lockData);
  1037. //单据是否锁定
  1038. if (!await this.checkLocks(this.detailData.lockData)) {
  1039. this.onLock(this.detailData.lockData); //上锁
  1040. this.viewDisabled = false
  1041. } else {
  1042. this.$message.warning('此单据已被锁定,请稍后再进行操作!')
  1043. }
  1044. },
  1045. backToList() {
  1046. //如果单据已被锁定 并且编辑按钮存在 则直接返回
  1047. if (this.viewDisabled || !this.detailData.lockData) {
  1048. this.$emit("goBack");
  1049. return
  1050. }
  1051. this.orderFeesList = this.$refs.feeInfo.submitData();
  1052. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  1053. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  1054. ) {
  1055. this.$confirm("是否保存当前页面?", "提示", {
  1056. confirmButtonText: "保存",
  1057. cancelButtonText: "取消",
  1058. type: "warning",
  1059. }).then(() => {
  1060. this.editCustomer(true)
  1061. }).catch(() => {
  1062. this.$emit("goBack");
  1063. }).finally(() => {
  1064. if (this.form.id) {
  1065. this.unLock(this.detailData.lockData);
  1066. this.leaveDetailsKey(this.$route.name);
  1067. }
  1068. })
  1069. } else {
  1070. this.$emit("goBack");
  1071. if (this.form.id) {
  1072. this.unLock(this.detailData.lockData);
  1073. this.leaveDetailsKey(this.$route.name);
  1074. }
  1075. }
  1076. },
  1077. //列保存触发
  1078. async saveColumn() {
  1079. const inSave = await this.saveColumnData(
  1080. this.getColumnName(39),
  1081. this.importInventory
  1082. );
  1083. if (inSave) {
  1084. this.$message.success("保存成功");
  1085. //关闭窗口
  1086. this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
  1087. }
  1088. },
  1089. async resetColumn() {
  1090. const inSave = await this.delColumnData(
  1091. this.getColumnName(39),
  1092. importInventory
  1093. );
  1094. if (inSave) {
  1095. this.$message.success("重置成功");
  1096. this.importInventory = importInventory;
  1097. //关闭窗口
  1098. this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
  1099. }
  1100. },
  1101. cellStyle() {
  1102. return "padding:0;height:40px;";
  1103. },
  1104. },
  1105. }
  1106. </script>
  1107. <style scoped lang="scss">
  1108. .required_fields {
  1109. color: #F56C6C;
  1110. display: inline-block;
  1111. width: 7%
  1112. }
  1113. .upper_right_button {
  1114. display: flex;
  1115. position: fixed;
  1116. right: 12px;
  1117. top: 47px;
  1118. }
  1119. ::v-deep .el-form-item {
  1120. margin-bottom: 0;
  1121. }
  1122. ::v-deep .el-form-item__content {
  1123. line-height: 32px;
  1124. }
  1125. </style>