SaleOutModal.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. :keyboard="false"
  8. :forceRender="true"
  9. v-bind:prefixNo="prefixNo"
  10. fullscreen
  11. switchHelp
  12. switchFullscreen
  13. @cancel="handleCancel"
  14. :id="prefixNo"
  15. style="top: 20px; height: 95%"
  16. >
  17. <template slot="footer">
  18. <a-button @click="handleCancel">取消</a-button>
  19. <a-button v-if="billPrintFlag && isShowPrintBtn" @click="handlePrint('销售出库')">三联打印预览</a-button>
  20. <a-button v-if="checkFlag && isCanCheck" :loading="confirmLoading" @click="handleOkAndCheck">保存并审核</a-button>
  21. <a-button type="primary" :loading="confirmLoading" @click="handleOk">保存(Ctrl+S)</a-button>
  22. <!--发起多级审核-->
  23. <a-button v-if="!checkFlag" @click="handleWorkflow()" type="primary">提交流程</a-button>
  24. </template>
  25. <a-spin :spinning="confirmLoading">
  26. <a-form :form="form">
  27. <a-row class="form-row" :gutter="24">
  28. <a-col :lg="6" :md="12" :sm="24">
  29. <a-form-item
  30. :labelCol="labelCol"
  31. :wrapperCol="wrapperCol"
  32. label="客户"
  33. data-step="1"
  34. data-title="客户"
  35. data-intro="客户必须选择,如果发现需要选择的客户尚未录入,可以在下拉框中点击新增客户进行录入。
  36. 特别注意,客户如果录入之后在下拉框中不显示,请检查是否给当前用户分配对应的客户权限"
  37. >
  38. <a-select
  39. placeholder="请选择客户"
  40. v-decorator="['organId', validatorRules.organId]"
  41. :disabled="!rowCanEdit"
  42. :dropdownMatchSelectWidth="false"
  43. showSearch
  44. optionFilterProp="children"
  45. @change="handleOrganChange"
  46. >
  47. <div slot="dropdownRender" slot-scope="menu">
  48. <v-nodes :vnodes="menu" />
  49. <a-divider style="margin: 4px 0" />
  50. <div
  51. v-if="quickBtn.customer"
  52. style="padding: 4px 8px; cursor: pointer"
  53. @mousedown="(e) => e.preventDefault()"
  54. @click="addCustomer"
  55. >
  56. <a-icon type="plus" /> 新增客户
  57. </div>
  58. </div>
  59. <a-select-option v-for="(item, index) in cusList" :key="index" :value="item.id">
  60. {{ item.supplier }}
  61. </a-select-option>
  62. </a-select>
  63. </a-form-item>
  64. </a-col>
  65. <a-col :lg="6" :md="12" :sm="24">
  66. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="单据日期">
  67. <j-date v-decorator="['operTime', validatorRules.operTime]" :show-time="true" />
  68. </a-form-item>
  69. </a-col>
  70. <a-col :lg="6" :md="12" :sm="24">
  71. <a-form-item
  72. :labelCol="labelCol"
  73. :wrapperCol="wrapperCol"
  74. label="单据编号"
  75. data-step="2"
  76. data-title="单据编号"
  77. data-intro="单据编号自动生成、自动累加、开头是单据类型的首字母缩写,累加的规则是每次打开页面会自动占用一个新的编号"
  78. >
  79. <a-input placeholder="请输入单据编号" v-decorator.trim="['number']" />
  80. </a-form-item>
  81. </a-col>
  82. <a-col :lg="6" :md="12" :sm="24">
  83. <a-form-item
  84. :labelCol="labelCol"
  85. :wrapperCol="wrapperCol"
  86. label="关联订单"
  87. data-step="3"
  88. data-title="关联订单"
  89. data-intro="销售出库单据可以通过关联订单来选择已录入的订单,选择之后会自动加载订单的内容,然后继续录入仓库等信息完成单据的提交,
  90. 提交之后原来的销售订单会对应的改变单据状态。另外本系统支持订单多次出库,只需选择订单之后修改对应的商品数量即可"
  91. >
  92. <a-input-search
  93. placeholder="请选择关联订单"
  94. v-decorator="['linkNumber']"
  95. @search="onSearchLinkNumber"
  96. :readOnly="true"
  97. />
  98. </a-form-item>
  99. </a-col>
  100. </a-row>
  101. <j-editable-table
  102. id="billModal"
  103. :ref="refKeys[0]"
  104. :loading="materialTable.loading"
  105. :columns="materialTable.columns"
  106. :dataSource="materialTable.dataSource"
  107. :minWidth="minWidth"
  108. :maxHeight="300"
  109. :rowNumber="false"
  110. :rowSelection="rowCanEdit"
  111. :actionButton="rowCanEdit"
  112. :dragSortAndNumber="rowCanEdit"
  113. @valueChange="onValueChange"
  114. @added="onAdded"
  115. @deleted="onDeleted"
  116. @focusChange="getUnitInfo"
  117. >
  118. <template #buttonAfter>
  119. <a-row
  120. v-if="rowCanEdit"
  121. :gutter="24"
  122. style="float: left; padding-bottom: 5px"
  123. data-step="4"
  124. data-title="扫码录入"
  125. data-intro="此功能支持扫码枪扫描商品条码进行录入"
  126. >
  127. <a-col v-if="scanStatus" :md="6" :sm="24">
  128. <a-button @click="scanEnter">扫码录入</a-button>
  129. </a-col>
  130. <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 8px 0 12px">
  131. <a-input
  132. placeholder="请扫条码或序列号并回车"
  133. v-model="scanBarCode"
  134. @pressEnter="scanPressEnter"
  135. ref="scanBarCode"
  136. />
  137. </a-col>
  138. <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px 12px 0 0">
  139. <a-button @click="stopScan">收起扫码</a-button>
  140. </a-col>
  141. </a-row>
  142. <a-row :gutter="24" style="float: left; padding-bottom: 5px">
  143. <a-col :md="24" :sm="24">
  144. <a-button style="margin-left: 8px" @click="handleHistoryBillList"
  145. ><a-icon type="history" />历史单据</a-button
  146. >
  147. </a-col>
  148. </a-row>
  149. <a-row v-if="rowCanEdit" :gutter="24" style="float: left; padding-bottom: 5px; padding-left: 20px">
  150. <a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
  151. </a-row>
  152. </template>
  153. <template #depotBatchSet>
  154. <a-icon type="down" @click="handleBatchSetDepot" />
  155. </template>
  156. <template #depotAdd>
  157. <a-divider v-if="quickBtn.depot" style="margin: 4px 0" />
  158. <div v-if="quickBtn.depot" style="padding: 4px 8px; cursor: pointer" @click="addDepot">
  159. <a-icon type="plus" /> 新增仓库
  160. </div>
  161. </template>
  162. <template #unit="{ handleChange, handleFocus, value }">
  163. <a-select
  164. placeholder="请选择"
  165. v-decorator="['unit']"
  166. :dropdownMatchSelectWidth="false"
  167. showSearch
  168. :allowClear="false"
  169. optionFilterProp="children"
  170. :value="value"
  171. @change="($event) => handleChange($event)"
  172. @focus="($event) => handleFocus($event)"
  173. >
  174. <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
  175. {{ item.name }}
  176. </a-select-option>
  177. </a-select>
  178. </template>
  179. </j-editable-table>
  180. <a-row class="form-row" :gutter="24">
  181. <a-col :lg="24" :md="24" :sm="24">
  182. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  183. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  184. </a-form-item>
  185. </a-col>
  186. </a-row>
  187. <a-row class="form-row" :gutter="24">
  188. <a-col :lg="6" :md="12" :sm="24">
  189. <a-form-item
  190. :labelCol="labelCol"
  191. :wrapperCol="wrapperCol"
  192. label="优惠率"
  193. data-step="5"
  194. data-title="优惠率"
  195. data-intro="针对单据明细中商品总金额进行优惠的比例"
  196. >
  197. <a-input
  198. style="width: 80%"
  199. placeholder="请输入优惠率"
  200. v-decorator.trim="['discount']"
  201. suffix="%"
  202. @change="onChangeDiscount"
  203. />
  204. </a-form-item>
  205. </a-col>
  206. <a-col :lg="6" :md="12" :sm="24">
  207. <a-form-item
  208. :labelCol="labelCol"
  209. :wrapperCol="wrapperCol"
  210. label="收款优惠"
  211. data-step="6"
  212. data-title="收款优惠"
  213. data-intro="针对单据明细中商品总金额进行优惠的金额"
  214. >
  215. <a-input
  216. placeholder="请输入付款优惠"
  217. v-decorator.trim="['discountMoney']"
  218. @change="onChangeDiscountMoney"
  219. />
  220. </a-form-item>
  221. </a-col>
  222. <a-col :lg="6" :md="12" :sm="24">
  223. <a-form-item
  224. :labelCol="labelCol"
  225. :wrapperCol="wrapperCol"
  226. label="优惠后金额"
  227. data-step="7"
  228. data-title="优惠后金额"
  229. data-intro="针对单据明细中商品总金额进行优惠后的金额"
  230. >
  231. <a-input placeholder="请输入优惠后金额" v-decorator.trim="['discountLastMoney']" :readOnly="true" />
  232. </a-form-item>
  233. </a-col>
  234. <a-col :lg="6" :md="12" :sm="24">
  235. <a-form-item
  236. :labelCol="labelCol"
  237. :wrapperCol="wrapperCol"
  238. label="其它费用"
  239. data-step="8"
  240. data-title="其它费用"
  241. data-intro="比如快递费、油费、过路费"
  242. >
  243. <a-input placeholder="请输入其它费用" v-decorator.trim="['otherMoney']" @change="onChangeOtherMoney" />
  244. </a-form-item>
  245. </a-col>
  246. </a-row>
  247. <a-row class="form-row" :gutter="24">
  248. <a-col :lg="6" :md="12" :sm="24">
  249. <a-form-item
  250. :labelCol="labelCol"
  251. :wrapperCol="wrapperCol"
  252. label="结算账户"
  253. data-step="9"
  254. data-title="结算账户"
  255. data-intro="如果在下拉框中选择多账户,则可以通过多个结算账户进行结算"
  256. >
  257. <a-select
  258. style="width: 80%"
  259. placeholder="请选择结算账户"
  260. v-decorator="['accountId', validatorRules.accountId]"
  261. :dropdownMatchSelectWidth="false"
  262. allowClear
  263. @select="selectAccount"
  264. >
  265. <div slot="dropdownRender" slot-scope="menu">
  266. <v-nodes :vnodes="menu" />
  267. <a-divider style="margin: 4px 0" />
  268. <div
  269. v-if="quickBtn.account"
  270. style="padding: 4px 8px; cursor: pointer"
  271. @mousedown="(e) => e.preventDefault()"
  272. @click="addAccount"
  273. >
  274. <a-icon type="plus" /> 新增结算账户
  275. </div>
  276. </div>
  277. <a-select-option v-for="(item, index) in accountList" :key="index" :value="item.id">
  278. {{ item.name }}
  279. </a-select-option>
  280. </a-select>
  281. <a-tooltip title="多账户明细">
  282. <a-button
  283. type="default"
  284. icon="folder"
  285. style="margin-left: 8px"
  286. size="small"
  287. v-show="manyAccountBtnStatus"
  288. @click="handleManyAccount"
  289. />
  290. </a-tooltip>
  291. </a-form-item>
  292. </a-col>
  293. <a-col v-if="depositStatus" :lg="6" :md="12" :sm="24">
  294. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="扣除订金">
  295. <a-input v-decorator.trim="['deposit']" @change="onChangeDeposit" />
  296. </a-form-item>
  297. </a-col>
  298. <a-col :lg="6" :md="12" :sm="24">
  299. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="本次收款">
  300. <a-input
  301. placeholder="请输入本次收款"
  302. v-decorator.trim="['changeAmount', validatorRules.changeAmount]"
  303. @change="onChangeChangeAmount"
  304. />
  305. </a-form-item>
  306. </a-col>
  307. <a-col :lg="6" :md="12" :sm="24">
  308. <a-form-item
  309. :labelCol="labelCol"
  310. :wrapperCol="wrapperCol"
  311. label="本次欠款"
  312. data-step="10"
  313. data-title="本次欠款"
  314. data-intro="欠款产生的费用,后续可以在收款单进行收取"
  315. >
  316. <a-input
  317. placeholder="请输入本次欠款"
  318. v-decorator.trim="['debt', validatorRules.price]"
  319. :readOnly="true"
  320. />
  321. </a-form-item>
  322. </a-col>
  323. </a-row>
  324. <a-row class="form-row" :gutter="24">
  325. <a-col :lg="6" :md="12" :sm="24">
  326. <a-form-item
  327. :labelCol="labelCol"
  328. :wrapperCol="wrapperCol"
  329. label="销售人员"
  330. data-step="11"
  331. data-title="销售人员"
  332. data-intro="销售人员的数据来自【经手人管理】菜单中的销售员"
  333. >
  334. <j-select-multiple
  335. style="width: 185px"
  336. placeholder="请选择销售人员"
  337. v-model="personList.value"
  338. :options="personList.options"
  339. />
  340. </a-form-item>
  341. </a-col>
  342. <a-col :lg="6" :md="12" :sm="24"> </a-col>
  343. <a-col :lg="6" :md="12" :sm="24"> </a-col>
  344. <a-col :lg="6" :md="12" :sm="24"> </a-col>
  345. </a-row>
  346. <a-row class="form-row" :gutter="24">
  347. <a-col :lg="6" :md="12" :sm="24">
  348. <a-form-item
  349. :labelCol="labelCol"
  350. :wrapperCol="wrapperCol"
  351. label="附件"
  352. data-step="12"
  353. data-title="附件"
  354. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  355. >
  356. <j-upload v-model="fileList" bizPath="bill"></j-upload>
  357. </a-form-item>
  358. </a-col>
  359. </a-row>
  360. <a-row class="form-row" :gutter="24">
  361. <a-col :lg="6" :md="12" :sm="24">
  362. <a-form-item
  363. :labelCol="labelCol"
  364. :wrapperCol="wrapperCol"
  365. label="凭证图片"
  366. data-step="11"
  367. data-title="附件"
  368. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  369. >
  370. <j-image-upload v-model="imageList" bizPath="material" text="上传图片" isMultiple></j-image-upload>
  371. </a-form-item>
  372. </a-col>
  373. </a-row>
  374. </a-form>
  375. </a-spin>
  376. <many-account-modal ref="manyAccountModalForm" @ok="manyAccountModalFormOk"></many-account-modal>
  377. <import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
  378. <link-bill-list ref="linkBillList" @ok="linkBillListOk"></link-bill-list>
  379. <customer-modal ref="customerModalForm" @ok="customerModalFormOk"></customer-modal>
  380. <depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
  381. <account-modal ref="accountModalForm" @ok="accountModalFormOk"></account-modal>
  382. <batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
  383. <history-bill-list ref="historyBillListModalForm"></history-bill-list>
  384. <workflow-iframe ref="modalWorkflow" @ok="workflowModalFormOk"></workflow-iframe>
  385. <bill-print-iframe ref="modalPrint"></bill-print-iframe>
  386. </j-modal>
  387. </template>
  388. <script>
  389. import pick from 'lodash.pick'
  390. import ManyAccountModal from '../dialog/ManyAccountModal'
  391. import ImportItemModal from '../dialog/ImportItemModal'
  392. import LinkBillList from '../dialog/LinkBillList'
  393. import CustomerModal from '../../system/modules/CustomerModal'
  394. import DepotModal from '../../system/modules/DepotModal'
  395. import AccountModal from '../../system/modules/AccountModal'
  396. import BatchSetDepot from '../dialog/BatchSetDepot'
  397. import HistoryBillList from '../dialog/HistoryBillList'
  398. import WorkflowIframe from '@/components/tools/WorkflowIframe'
  399. import BillPrintIframe from '../dialog/BillPrintIframe'
  400. import { FormTypes } from '@/utils/JEditableTableUtil'
  401. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  402. import { BillModalMixin } from '../mixins/BillModalMixin'
  403. import { getMpListShort, handleIntroJs } from '@/utils/util'
  404. import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
  405. import JUpload from '@/components/jeecg/JUpload'
  406. import JImageUpload from '@/components/jeecg/JImageUpload.vue'
  407. import JDate from '@/components/jeecg/JDate'
  408. import Vue from 'vue'
  409. export default {
  410. name: 'SaleOutModal',
  411. mixins: [JEditableTableMixin, BillModalMixin],
  412. components: {
  413. ManyAccountModal,
  414. ImportItemModal,
  415. LinkBillList,
  416. CustomerModal,
  417. DepotModal,
  418. AccountModal,
  419. BatchSetDepot,
  420. HistoryBillList,
  421. WorkflowIframe,
  422. BillPrintIframe,
  423. JUpload,
  424. JDate,
  425. JSelectMultiple,
  426. JImageUpload,
  427. VNodes: {
  428. functional: true,
  429. render: (h, ctx) => ctx.props.vnodes,
  430. },
  431. },
  432. data() {
  433. return {
  434. title: '操作',
  435. width: '1600px',
  436. moreStatus: false,
  437. // 新增时子表默认添加几行空数据
  438. addDefaultRowNum: 1,
  439. visible: false,
  440. operTimeStr: '',
  441. prefixNo: 'XSCK',
  442. depositStatus: false,
  443. fileList: [],
  444. imageList: [],
  445. rowCanEdit: true,
  446. model: {},
  447. labelCol: {
  448. xs: { span: 24 },
  449. sm: { span: 8 },
  450. },
  451. wrapperCol: {
  452. xs: { span: 24 },
  453. sm: { span: 16 },
  454. },
  455. refKeys: ['materialDataTable'],
  456. activeKey: 'materialDataTable',
  457. materialTable: {
  458. loading: false,
  459. dataSource: [],
  460. columns: [
  461. {
  462. title: '批次号',
  463. key: 'batchNumber',
  464. width: '12%',
  465. type: FormTypes.popupJsh,
  466. kind: 'material',
  467. multi: true,
  468. validateRules: [{ required: true, message: '${title}不能为空' }],
  469. },
  470. { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
  471. { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
  472. { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
  473. { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
  474. { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
  475. { title: '仓库名', key: 'depotId', width: '6%', type: FormTypes.select, disabled: true },
  476. { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
  477. { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
  478. { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
  479. { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
  480. { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
  481. { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
  482. { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
  483. { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },
  484. {
  485. title: '单位',
  486. key: 'unit',
  487. width: '6%',
  488. type: FormTypes.slot,
  489. options: [],
  490. allowClear: false,
  491. slotName: 'unit',
  492. },
  493. { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
  494. { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
  495. { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'sn', multi: true },
  496. { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
  497. { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
  498. { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
  499. { title: '已出库', key: 'finishNumber', width: '4%', type: FormTypes.normal },
  500. {
  501. title: '出库数量',
  502. key: 'operNumber',
  503. width: '5%',
  504. type: FormTypes.inputNumber,
  505. statistics: true,
  506. validateRules: [{ required: true, message: '${title}不能为空' }],
  507. },
  508. { title: '单价', key: 'unitPrice', width: '4%', type: FormTypes.inputNumber },
  509. { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
  510. { title: '税率', key: 'taxRate', width: '4%', type: FormTypes.inputNumber, placeholder: '%' },
  511. {
  512. title: '税额',
  513. key: 'taxMoney',
  514. width: '5%',
  515. type: FormTypes.inputNumber,
  516. readonly: true,
  517. statistics: true,
  518. },
  519. { title: '价税合计', key: 'taxLastMoney', width: '7%', type: FormTypes.inputNumber, statistics: true },
  520. {
  521. title: '实际出库数量',
  522. key: 'actualQuantityInStorage',
  523. width: '9%',
  524. type: FormTypes.inputNumber,
  525. validateRules: [{ required: true, message: '实际入库数量不能为空' }],
  526. },
  527. { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
  528. { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
  529. {
  530. title: '出库人',
  531. key: 'warehousingUser',
  532. width: '9%',
  533. type: FormTypes.input,
  534. validateRules: [{ required: true, message: '出库人不能为空' }],
  535. },
  536. { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
  537. { title: '备注', key: 'remark', width: '6%', type: FormTypes.input },
  538. { title: '关联id', key: 'linkId', width: '5%', type: FormTypes.hidden },
  539. ],
  540. },
  541. confirmLoading: false,
  542. validatorRules: {
  543. operTime: {
  544. rules: [{ required: true, message: '请输入单据日期!' }],
  545. },
  546. organId: {
  547. rules: [{ required: true, message: '请选择客户!' }],
  548. },
  549. accountId: {
  550. rules: [{ required: true, message: '请选择结算账户!' }],
  551. },
  552. changeAmount: {
  553. rules: [
  554. { required: true, message: '请输入金额,如果为空请填0!' },
  555. { pattern: /^(([0-9][0-9]*)|([0]\.\d{0,4}|[0-9][0-9]*\.\d{0,4}))$/, message: '金额格式不正确!' },
  556. ],
  557. },
  558. },
  559. url: {
  560. add: '/depotHead/addDepotHeadAndDetail',
  561. edit: '/depotHead/updateDepotHeadAndDetail',
  562. detailList: '/depotItem/getDetailList',
  563. },
  564. unitList: [],
  565. }
  566. },
  567. created() {},
  568. methods: {
  569. //调用完edit()方法之后会自动调用此方法
  570. editAfter() {
  571. this.billStatus = '0'
  572. this.currentSelectDepotId = ''
  573. this.rowCanEdit = true
  574. this.materialTable.columns[0].type = FormTypes.popupJsh
  575. this.changeColumnHide()
  576. this.changeFormTypes(this.materialTable.columns, 'snList', 0)
  577. // this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
  578. this.changeFormTypes(this.materialTable.columns, 'expirationDate', 0)
  579. this.changeFormTypes(this.materialTable.columns, 'preNumber', 0)
  580. this.changeFormTypes(this.materialTable.columns, 'finishNumber', 0)
  581. if (this.action === 'add') {
  582. this.depositStatus = false
  583. this.addInit(this.prefixNo)
  584. this.personList.value = ''
  585. this.fileList = []
  586. this.imageList = []
  587. this.$nextTick(() => {
  588. handleIntroJs(this.prefixNo, 1)
  589. })
  590. } else {
  591. if (this.model.linkNumber) {
  592. this.rowCanEdit = false
  593. this.materialTable.columns[1].type = FormTypes.normal
  594. }
  595. this.model.operTime = this.model.operTimeStr
  596. if (this.model.deposit) {
  597. this.depositStatus = true
  598. } else {
  599. this.depositStatus = false
  600. this.model.deposit = 0
  601. }
  602. this.model.debt = (
  603. this.model.discountLastMoney +
  604. this.model.otherMoney -
  605. this.model.deposit -
  606. this.model.changeAmount
  607. ).toFixed(2)
  608. if (this.model.accountId == null) {
  609. this.model.accountId = 0
  610. this.manyAccountBtnStatus = true
  611. this.accountIdList = this.model.accountIdList
  612. this.accountMoneyList = this.model.accountMoneyList
  613. } else {
  614. this.manyAccountBtnStatus = false
  615. }
  616. this.personList.value = this.model.salesMan
  617. this.fileList = this.model.fileName
  618. this.imageList = this.model.voucherPicture
  619. this.$nextTick(() => {
  620. this.form.setFieldsValue(
  621. pick(
  622. this.model,
  623. 'organId',
  624. 'operTime',
  625. 'number',
  626. 'linkNumber',
  627. 'remark',
  628. 'discount',
  629. 'discountMoney',
  630. 'discountLastMoney',
  631. 'otherMoney',
  632. 'accountId',
  633. 'deposit',
  634. 'changeAmount',
  635. 'debt',
  636. 'salesMan'
  637. )
  638. )
  639. })
  640. // 加载子表数据
  641. let params = {
  642. headerId: this.model.id,
  643. mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
  644. linkType: 'basic',
  645. }
  646. let url = this.readOnly ? this.url.detailList : this.url.detailList
  647. this.requestSubTableData(url, params, this.materialTable)
  648. }
  649. //复制新增单据-初始化单号和日期
  650. if (this.action === 'copyAdd') {
  651. this.model.id = ''
  652. this.model.tenantId = ''
  653. this.copyAddInit(this.prefixNo)
  654. }
  655. this.initSystemConfig()
  656. this.initCustomer(0)
  657. this.initSalesman()
  658. this.initDepot()
  659. this.initAccount(0)
  660. this.initPlatform()
  661. this.initQuickBtn()
  662. },
  663. //提交单据时整理成formData
  664. classifyIntoFormData(allValues) {
  665. let totalPrice = 0
  666. let billMain = Object.assign(this.model, allValues.formValue)
  667. let detailArr = allValues.tablesValue[0].values
  668. billMain.type = '出库'
  669. billMain.subType = '销售'
  670. for (let item of detailArr) {
  671. totalPrice += item.allPrice - 0
  672. }
  673. billMain.totalPrice = totalPrice
  674. if (billMain.accountId === 0) {
  675. billMain.accountId = ''
  676. }
  677. billMain.accountIdList = this.accountIdList.length > 0 ? JSON.stringify(this.accountIdList) : ''
  678. billMain.accountMoneyList = this.accountMoneyList.length > 0 ? JSON.stringify(this.accountMoneyList) : ''
  679. if (this.fileList && this.fileList.length > 0) {
  680. billMain.fileName = this.fileList
  681. } else {
  682. billMain.fileName = ''
  683. }
  684. if (this.imageList && this.imageList.length > 0) {
  685. billMain.voucherPicture = this.imageList
  686. } else {
  687. billMain.voucherPicture = ''
  688. }
  689. if (this.model.id) {
  690. billMain.id = this.model.id
  691. }
  692. billMain.salesMan = this.personList.value
  693. billMain.status = this.billStatus
  694. return {
  695. info: JSON.stringify(billMain),
  696. rows: JSON.stringify(detailArr),
  697. }
  698. },
  699. handleHistoryBillList() {
  700. let organId = this.form.getFieldValue('organId')
  701. this.$refs.historyBillListModalForm.show('出库', '销售', '客户', organId)
  702. this.$refs.historyBillListModalForm.disableSubmit = false
  703. },
  704. onSearchLinkNumber() {
  705. this.$refs.linkBillList.show('其它', '销售订单', '客户', '1,3')
  706. this.$refs.linkBillList.title = '请选择销售订单'
  707. },
  708. linkBillListOk(
  709. selectBillDetailRows,
  710. linkNumber,
  711. organId,
  712. discountMoney,
  713. deposit,
  714. remark,
  715. depotId,
  716. accountId,
  717. salesMan
  718. ) {
  719. let that = this
  720. this.rowCanEdit = false
  721. this.materialTable.columns[1].type = FormTypes.normal
  722. this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
  723. this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
  724. if (selectBillDetailRows && selectBillDetailRows.length > 0) {
  725. let listEx = []
  726. let allTaxLastMoney = 0
  727. for (let j = 0; j < selectBillDetailRows.length; j++) {
  728. let info = selectBillDetailRows[j]
  729. if (info.finishNumber > 0) {
  730. info.operNumber = info.preNumber - info.finishNumber
  731. info.allPrice = info.operNumber * info.unitPrice - 0
  732. let taxRate = info.taxRate - 0
  733. info.taxMoney = ((info.allPrice * taxRate) / 100).toFixed(2) - 0
  734. info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2) - 0
  735. }
  736. info.linkId = info.id
  737. allTaxLastMoney += info.taxLastMoney
  738. listEx.push(info)
  739. this.changeColumnShow(info)
  740. }
  741. this.materialTable.dataSource = listEx
  742. ///给优惠后金额重新赋值
  743. allTaxLastMoney = allTaxLastMoney ? allTaxLastMoney : 0
  744. let discount = 0
  745. if (allTaxLastMoney !== 0) {
  746. discount = ((discountMoney / allTaxLastMoney) * 100).toFixed(2) - 0
  747. }
  748. let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2) - 0
  749. let changeAmount = discountLastMoney
  750. if (deposit) {
  751. this.depositStatus = true
  752. changeAmount = (discountLastMoney - deposit).toFixed(2) - 0
  753. }
  754. this.$nextTick(() => {
  755. this.form.setFieldsValue({
  756. organId: organId,
  757. linkNumber: linkNumber,
  758. discount: discount,
  759. discountMoney: discountMoney,
  760. discountLastMoney: discountLastMoney,
  761. deposit: deposit,
  762. changeAmount: changeAmount,
  763. accountId: accountId,
  764. remark: remark,
  765. })
  766. this.personList.value = salesMan
  767. })
  768. //判断后进行仓库的切换
  769. if (depotId) {
  770. setTimeout(function () {
  771. that.batchSetDepotModalFormOk(depotId)
  772. }, 1000)
  773. }
  774. }
  775. },
  776. getUnitInfo(val) {
  777. this.unitList = val
  778. },
  779. },
  780. }
  781. </script>
  782. <style scoped></style>