detailsPage.vue 42 KB

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