SaleOutModal.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  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. <template #warehousingUser="{ handleChange, value }">
  180. <a-select
  181. placeholder="请选择"
  182. v-decorator="['warehousingUser']"
  183. :dropdownMatchSelectWidth="false"
  184. showSearch
  185. :allowClear="false"
  186. optionFilterProp="children"
  187. :value="value"
  188. :options="currentUserList"
  189. @change="($event) => handleChange($event)"
  190. @focus="($event) => handleFocus($event)"
  191. >
  192. </a-select>
  193. </template>
  194. </j-editable-table>
  195. <a-row class="form-row" :gutter="24">
  196. <a-col :lg="24" :md="24" :sm="24">
  197. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  198. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  199. </a-form-item>
  200. </a-col>
  201. </a-row>
  202. <a-row class="form-row" :gutter="24">
  203. <a-col :lg="6" :md="12" :sm="24">
  204. <a-form-item
  205. :labelCol="labelCol"
  206. :wrapperCol="wrapperCol"
  207. label="优惠率"
  208. data-step="5"
  209. data-title="优惠率"
  210. data-intro="针对单据明细中商品总金额进行优惠的比例"
  211. >
  212. <a-input
  213. style="width: 80%"
  214. placeholder="请输入优惠率"
  215. v-decorator.trim="['discount']"
  216. suffix="%"
  217. @change="onChangeDiscount"
  218. />
  219. </a-form-item>
  220. </a-col>
  221. <a-col :lg="6" :md="12" :sm="24">
  222. <a-form-item
  223. :labelCol="labelCol"
  224. :wrapperCol="wrapperCol"
  225. label="收款优惠"
  226. data-step="6"
  227. data-title="收款优惠"
  228. data-intro="针对单据明细中商品总金额进行优惠的金额"
  229. >
  230. <a-input
  231. placeholder="请输入付款优惠"
  232. v-decorator.trim="['discountMoney']"
  233. @change="onChangeDiscountMoney"
  234. />
  235. </a-form-item>
  236. </a-col>
  237. <a-col :lg="6" :md="12" :sm="24">
  238. <a-form-item
  239. :labelCol="labelCol"
  240. :wrapperCol="wrapperCol"
  241. label="优惠后金额"
  242. data-step="7"
  243. data-title="优惠后金额"
  244. data-intro="针对单据明细中商品总金额进行优惠后的金额"
  245. >
  246. <a-input placeholder="请输入优惠后金额" v-decorator.trim="['discountLastMoney']" :readOnly="true" />
  247. </a-form-item>
  248. </a-col>
  249. <a-col :lg="6" :md="12" :sm="24">
  250. <a-form-item
  251. :labelCol="labelCol"
  252. :wrapperCol="wrapperCol"
  253. label="其它费用"
  254. data-step="8"
  255. data-title="其它费用"
  256. data-intro="比如快递费、油费、过路费"
  257. >
  258. <a-input placeholder="请输入其它费用" v-decorator.trim="['otherMoney']" @change="onChangeOtherMoney" />
  259. </a-form-item>
  260. </a-col>
  261. </a-row>
  262. <a-row class="form-row" :gutter="24">
  263. <a-col :lg="6" :md="12" :sm="24">
  264. <a-form-item
  265. :labelCol="labelCol"
  266. :wrapperCol="wrapperCol"
  267. label="结算账户"
  268. data-step="9"
  269. data-title="结算账户"
  270. data-intro="如果在下拉框中选择多账户,则可以通过多个结算账户进行结算"
  271. >
  272. <a-select
  273. style="width: 80%"
  274. placeholder="请选择结算账户"
  275. v-decorator="['accountId', validatorRules.accountId]"
  276. :dropdownMatchSelectWidth="false"
  277. allowClear
  278. @select="selectAccount"
  279. >
  280. <div slot="dropdownRender" slot-scope="menu">
  281. <v-nodes :vnodes="menu" />
  282. <a-divider style="margin: 4px 0" />
  283. <div
  284. v-if="quickBtn.account"
  285. style="padding: 4px 8px; cursor: pointer"
  286. @mousedown="(e) => e.preventDefault()"
  287. @click="addAccount"
  288. >
  289. <a-icon type="plus" /> 新增结算账户
  290. </div>
  291. </div>
  292. <a-select-option v-for="(item, index) in accountList" :key="index" :value="item.id">
  293. {{ item.name }}
  294. </a-select-option>
  295. </a-select>
  296. <a-tooltip title="多账户明细">
  297. <a-button
  298. type="default"
  299. icon="folder"
  300. style="margin-left: 8px"
  301. size="small"
  302. v-show="manyAccountBtnStatus"
  303. @click="handleManyAccount"
  304. />
  305. </a-tooltip>
  306. </a-form-item>
  307. </a-col>
  308. <a-col v-if="depositStatus" :lg="6" :md="12" :sm="24">
  309. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="扣除订金">
  310. <a-input v-decorator.trim="['deposit']" @change="onChangeDeposit" />
  311. </a-form-item>
  312. </a-col>
  313. <a-col :lg="6" :md="12" :sm="24">
  314. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="本次收款">
  315. <a-input
  316. placeholder="请输入本次收款"
  317. v-decorator.trim="['changeAmount', validatorRules.changeAmount]"
  318. @change="onChangeChangeAmount"
  319. />
  320. </a-form-item>
  321. </a-col>
  322. <a-col :lg="6" :md="12" :sm="24">
  323. <a-form-item
  324. :labelCol="labelCol"
  325. :wrapperCol="wrapperCol"
  326. label="本次欠款"
  327. data-step="10"
  328. data-title="本次欠款"
  329. data-intro="欠款产生的费用,后续可以在收款单进行收取"
  330. >
  331. <a-input
  332. placeholder="请输入本次欠款"
  333. v-decorator.trim="['debt', validatorRules.price]"
  334. :readOnly="true"
  335. />
  336. </a-form-item>
  337. </a-col>
  338. </a-row>
  339. <a-row class="form-row" :gutter="24">
  340. <a-col :lg="6" :md="12" :sm="24">
  341. <a-form-item
  342. :labelCol="labelCol"
  343. :wrapperCol="wrapperCol"
  344. label="销售人员"
  345. data-step="11"
  346. data-title="销售人员"
  347. data-intro="销售人员的数据来自【经手人管理】菜单中的销售员"
  348. >
  349. <j-select-multiple
  350. style="width: 185px"
  351. placeholder="请选择销售人员"
  352. v-model="personList.value"
  353. :options="personList.options"
  354. />
  355. </a-form-item>
  356. </a-col>
  357. <a-col :lg="6" :md="12" :sm="24">
  358. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货人" data-step="10">
  359. <a-input placeholder="请输入收货人" v-decorator="['receiverName']" />
  360. </a-form-item>
  361. </a-col>
  362. <a-col :lg="6" :md="12" :sm="24">
  363. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货人电话" data-step="10">
  364. <a-input placeholder="请输入收货人电话" v-decorator="['receiverPhone']" />
  365. </a-form-item>
  366. </a-col>
  367. <a-col :lg="6" :md="12" :sm="24">
  368. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货地址" data-step="10">
  369. <a-input placeholder="请输入收货地址" v-decorator="['receiverAddress']" />
  370. </a-form-item>
  371. </a-col>
  372. </a-row>
  373. <a-row class="form-row" :gutter="24">
  374. <a-col :lg="6" :md="12" :sm="24">
  375. <a-form-item
  376. :labelCol="labelCol"
  377. :wrapperCol="wrapperCol"
  378. label="附件"
  379. data-step="12"
  380. data-title="附件"
  381. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  382. >
  383. <j-upload v-model="fileList" bizPath="bill"></j-upload>
  384. </a-form-item>
  385. </a-col>
  386. </a-row>
  387. <a-row class="form-row" :gutter="24">
  388. <a-col :lg="6" :md="12" :sm="24">
  389. <a-form-item
  390. :labelCol="labelCol"
  391. :wrapperCol="wrapperCol"
  392. label="凭证图片"
  393. data-step="11"
  394. data-title="附件"
  395. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  396. >
  397. <j-image-upload v-model="imageList" bizPath="material" text="上传图片" isMultiple></j-image-upload>
  398. </a-form-item>
  399. </a-col>
  400. </a-row>
  401. </a-form>
  402. </a-spin>
  403. <many-account-modal ref="manyAccountModalForm" @ok="manyAccountModalFormOk"></many-account-modal>
  404. <import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
  405. <link-bill-list ref="linkBillList" @ok="linkBillListOk"></link-bill-list>
  406. <customer-modal ref="customerModalForm" @ok="customerModalFormOk"></customer-modal>
  407. <depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
  408. <account-modal ref="accountModalForm" @ok="accountModalFormOk"></account-modal>
  409. <batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
  410. <history-bill-list ref="historyBillListModalForm"></history-bill-list>
  411. <workflow-iframe ref="modalWorkflow" @ok="workflowModalFormOk"></workflow-iframe>
  412. <bill-print-iframe ref="modalPrint"></bill-print-iframe>
  413. </j-modal>
  414. </template>
  415. <script>
  416. import pick from 'lodash.pick'
  417. import ManyAccountModal from '../dialog/ManyAccountModal'
  418. import ImportItemModal from '../dialog/ImportItemModal'
  419. import LinkBillList from '../dialog/LinkBillList'
  420. import CustomerModal from '../../system/modules/CustomerModal'
  421. import DepotModal from '../../system/modules/DepotModal'
  422. import AccountModal from '../../system/modules/AccountModal'
  423. import BatchSetDepot from '../dialog/BatchSetDepot'
  424. import HistoryBillList from '../dialog/HistoryBillList'
  425. import WorkflowIframe from '@/components/tools/WorkflowIframe'
  426. import BillPrintIframe from '../dialog/BillPrintIframe'
  427. import { FormTypes } from '@/utils/JEditableTableUtil'
  428. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  429. import { BillModalMixin } from '../mixins/BillModalMixin'
  430. import { getMpListShort, handleIntroJs } from '@/utils/util'
  431. import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
  432. import JUpload from '@/components/jeecg/JUpload'
  433. import JImageUpload from '@/components/jeecg/JImageUpload.vue'
  434. import JDate from '@/components/jeecg/JDate'
  435. import Vue from 'vue'
  436. export default {
  437. name: 'SaleOutModal',
  438. mixins: [JEditableTableMixin, BillModalMixin],
  439. components: {
  440. ManyAccountModal,
  441. ImportItemModal,
  442. LinkBillList,
  443. CustomerModal,
  444. DepotModal,
  445. AccountModal,
  446. BatchSetDepot,
  447. HistoryBillList,
  448. WorkflowIframe,
  449. BillPrintIframe,
  450. JUpload,
  451. JDate,
  452. JSelectMultiple,
  453. JImageUpload,
  454. VNodes: {
  455. functional: true,
  456. render: (h, ctx) => ctx.props.vnodes,
  457. },
  458. },
  459. data() {
  460. return {
  461. title: '操作',
  462. width: '1600px',
  463. moreStatus: false,
  464. // 新增时子表默认添加几行空数据
  465. addDefaultRowNum: 1,
  466. visible: false,
  467. operTimeStr: '',
  468. prefixNo: 'XSCK',
  469. depositStatus: false,
  470. fileList: [],
  471. imageList: [],
  472. rowCanEdit: true,
  473. model: {},
  474. labelCol: {
  475. xs: { span: 24 },
  476. sm: { span: 8 },
  477. },
  478. wrapperCol: {
  479. xs: { span: 24 },
  480. sm: { span: 16 },
  481. },
  482. refKeys: ['materialDataTable'],
  483. activeKey: 'materialDataTable',
  484. materialTable: {
  485. loading: false,
  486. dataSource: [],
  487. columns: [
  488. {
  489. title: '批次号',
  490. key: 'batchNumber',
  491. width: '12%',
  492. type: FormTypes.popupJsh,
  493. kind: 'material',
  494. multi: true,
  495. newBatch: true,
  496. validateRules: [{ required: true, message: '${title}不能为空' }],
  497. },
  498. { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
  499. { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
  500. { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
  501. { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
  502. { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
  503. { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
  504. { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
  505. { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
  506. { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
  507. { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
  508. { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
  509. { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
  510. { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
  511. { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },
  512. {
  513. title: '单位',
  514. key: 'unit',
  515. width: '6%',
  516. type: FormTypes.slot,
  517. options: [],
  518. allowClear: false,
  519. slotName: 'unit',
  520. },
  521. { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
  522. { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
  523. { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'sn', multi: true },
  524. { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
  525. { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
  526. { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
  527. { title: '已出库', key: 'finishNumber', width: '4%', type: FormTypes.normal },
  528. {
  529. title: '出库数量',
  530. key: 'operNumber',
  531. width: '5%',
  532. type: FormTypes.inputNumber,
  533. statistics: true,
  534. validateRules: [{ required: true, message: '${title}不能为空' }],
  535. },
  536. { title: '单价', key: 'unitPrice', width: '4%', type: FormTypes.inputNumber },
  537. { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
  538. { title: '税率', key: 'taxRate', width: '4%', type: FormTypes.inputNumber, placeholder: '%' },
  539. {
  540. title: '税额',
  541. key: 'taxMoney',
  542. width: '5%',
  543. type: FormTypes.inputNumber,
  544. readonly: true,
  545. statistics: true,
  546. },
  547. { title: '价税合计', key: 'taxLastMoney', width: '7%', type: FormTypes.inputNumber, statistics: true },
  548. {
  549. title: '实际出库数量',
  550. key: 'actualQuantityInStorage',
  551. width: '9%',
  552. type: FormTypes.inputNumber,
  553. validateRules: [{ required: true, message: '实际入库数量不能为空' }],
  554. },
  555. { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
  556. { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
  557. {
  558. title: '出库人',
  559. key: 'warehousingUser',
  560. width: '9%',
  561. type: FormTypes.slot,
  562. slotName: 'warehousingUser',
  563. validateRules: [{ required: true, message: '出库人不能为空' }],
  564. },
  565. { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
  566. { title: '备注', key: 'remark', width: '6%', type: FormTypes.input },
  567. { title: '关联id', key: 'linkId', width: '5%', type: FormTypes.hidden },
  568. ],
  569. },
  570. confirmLoading: false,
  571. validatorRules: {
  572. operTime: {
  573. rules: [{ required: true, message: '请输入单据日期!' }],
  574. },
  575. organId: {
  576. rules: [{ required: true, message: '请选择客户!' }],
  577. },
  578. accountId: {
  579. rules: [{ required: true, message: '请选择结算账户!' }],
  580. },
  581. changeAmount: {
  582. rules: [
  583. { required: true, message: '请输入金额,如果为空请填0!' },
  584. { pattern: /^(([0-9][0-9]*)|([0]\.\d{0,4}|[0-9][0-9]*\.\d{0,4}))$/, message: '金额格式不正确!' },
  585. ],
  586. },
  587. },
  588. url: {
  589. add: '/depotHead/addDepotHeadAndDetail',
  590. edit: '/depotHead/updateDepotHeadAndDetail',
  591. detailList: '/depotItem/getDetailList',
  592. },
  593. unitList: [],
  594. }
  595. },
  596. created() {},
  597. methods: {
  598. //调用完edit()方法之后会自动调用此方法
  599. editAfter() {
  600. this.billStatus = '0'
  601. this.currentSelectDepotId = ''
  602. this.rowCanEdit = true
  603. this.materialTable.columns[0].type = FormTypes.popupJsh
  604. this.changeColumnHide()
  605. this.changeFormTypes(this.materialTable.columns, 'snList', 0)
  606. // this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
  607. this.changeFormTypes(this.materialTable.columns, 'expirationDate', 0)
  608. this.changeFormTypes(this.materialTable.columns, 'preNumber', 0)
  609. this.changeFormTypes(this.materialTable.columns, 'finishNumber', 0)
  610. if (this.action === 'add') {
  611. this.depositStatus = false
  612. this.addInit(this.prefixNo)
  613. this.personList.value = ''
  614. this.fileList = []
  615. this.imageList = []
  616. this.$nextTick(() => {
  617. handleIntroJs(this.prefixNo, 1)
  618. })
  619. } else {
  620. if (this.model.linkNumber) {
  621. this.rowCanEdit = false
  622. this.materialTable.columns[1].type = FormTypes.normal
  623. }
  624. this.model.operTime = this.model.operTimeStr
  625. if (this.model.deposit) {
  626. this.depositStatus = true
  627. } else {
  628. this.depositStatus = false
  629. this.model.deposit = 0
  630. }
  631. this.model.debt = (
  632. this.model.discountLastMoney +
  633. this.model.otherMoney -
  634. this.model.deposit -
  635. this.model.changeAmount
  636. ).toFixed(2)
  637. if (this.model.accountId == null) {
  638. this.model.accountId = 0
  639. this.manyAccountBtnStatus = true
  640. this.accountIdList = this.model.accountIdList
  641. this.accountMoneyList = this.model.accountMoneyList
  642. } else {
  643. this.manyAccountBtnStatus = false
  644. }
  645. this.personList.value = this.model.salesMan
  646. this.fileList = this.model.fileName
  647. this.imageList = this.model.voucherPicture
  648. this.$nextTick(() => {
  649. this.form.setFieldsValue(
  650. pick(
  651. this.model,
  652. 'organId',
  653. 'operTime',
  654. 'number',
  655. 'linkNumber',
  656. 'remark',
  657. 'discount',
  658. 'discountMoney',
  659. 'discountLastMoney',
  660. 'otherMoney',
  661. 'accountId',
  662. 'deposit',
  663. 'changeAmount',
  664. 'debt',
  665. 'salesMan',
  666. 'receiverName',
  667. 'receiverPhone',
  668. 'receiverAddress'
  669. )
  670. )
  671. })
  672. // 加载子表数据
  673. let params = {
  674. headerId: this.model.id,
  675. mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
  676. linkType: 'basic',
  677. }
  678. let url = this.readOnly ? this.url.detailList : this.url.detailList
  679. this.requestSubTableData(url, params, this.materialTable)
  680. }
  681. //复制新增单据-初始化单号和日期
  682. if (this.action === 'copyAdd') {
  683. this.model.id = ''
  684. this.model.tenantId = ''
  685. this.copyAddInit(this.prefixNo)
  686. }
  687. this.initSystemConfig()
  688. this.initCustomer(0)
  689. this.initSalesman()
  690. this.initDepot()
  691. this.initAccount(0)
  692. this.initPlatform()
  693. this.initQuickBtn()
  694. },
  695. //提交单据时整理成formData
  696. classifyIntoFormData(allValues) {
  697. let totalPrice = 0
  698. let billMain = Object.assign(this.model, allValues.formValue)
  699. let detailArr = allValues.tablesValue[0].values
  700. billMain.type = '出库'
  701. billMain.subType = '销售'
  702. for (let item of detailArr) {
  703. totalPrice += item.allPrice - 0
  704. }
  705. billMain.totalPrice = totalPrice
  706. if (billMain.accountId === 0) {
  707. billMain.accountId = ''
  708. }
  709. billMain.accountIdList = this.accountIdList.length > 0 ? JSON.stringify(this.accountIdList) : ''
  710. billMain.accountMoneyList = this.accountMoneyList.length > 0 ? JSON.stringify(this.accountMoneyList) : ''
  711. if (this.fileList && this.fileList.length > 0) {
  712. billMain.fileName = this.fileList
  713. } else {
  714. billMain.fileName = ''
  715. }
  716. if (this.imageList && this.imageList.length > 0) {
  717. billMain.voucherPicture = this.imageList
  718. } else {
  719. billMain.voucherPicture = ''
  720. }
  721. if (this.model.id) {
  722. billMain.id = this.model.id
  723. }
  724. billMain.salesMan = this.personList.value
  725. billMain.status = this.billStatus
  726. return {
  727. info: JSON.stringify(billMain),
  728. rows: JSON.stringify(detailArr),
  729. }
  730. },
  731. handleHistoryBillList() {
  732. let organId = this.form.getFieldValue('organId')
  733. this.$refs.historyBillListModalForm.show('出库', '销售', '客户', organId)
  734. this.$refs.historyBillListModalForm.disableSubmit = false
  735. },
  736. onSearchLinkNumber() {
  737. this.$refs.linkBillList.show('其它', '销售订单', '客户', '1,3')
  738. this.$refs.linkBillList.title = '请选择销售订单'
  739. },
  740. linkBillListOk(
  741. selectBillDetailRows,
  742. linkNumber,
  743. organId,
  744. discountMoney,
  745. deposit,
  746. remark,
  747. depotId,
  748. accountId,
  749. salesMan,
  750. receiverName,
  751. receiverPhone,
  752. receiverAddress
  753. ) {
  754. let that = this
  755. this.rowCanEdit = false
  756. this.materialTable.columns[1].type = FormTypes.normal
  757. this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
  758. this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
  759. if (selectBillDetailRows && selectBillDetailRows.length > 0) {
  760. let listEx = []
  761. let allTaxLastMoney = 0
  762. for (let j = 0; j < selectBillDetailRows.length; j++) {
  763. let info = selectBillDetailRows[j]
  764. if (info.finishNumber > 0) {
  765. info.operNumber = info.preNumber - info.finishNumber
  766. info.allPrice = info.operNumber * info.unitPrice - 0
  767. let taxRate = info.taxRate - 0
  768. info.taxMoney = ((info.allPrice * taxRate) / 100).toFixed(2) - 0
  769. info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2) - 0
  770. }
  771. info.linkId = info.id
  772. allTaxLastMoney += info.taxLastMoney
  773. listEx.push(info)
  774. this.changeColumnShow(info)
  775. }
  776. this.materialTable.dataSource = listEx
  777. ///给优惠后金额重新赋值
  778. allTaxLastMoney = allTaxLastMoney ? allTaxLastMoney : 0
  779. let discount = 0
  780. if (allTaxLastMoney !== 0) {
  781. discount = ((discountMoney / allTaxLastMoney) * 100).toFixed(2) - 0
  782. }
  783. let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2) - 0
  784. let changeAmount = discountLastMoney
  785. if (deposit) {
  786. this.depositStatus = true
  787. changeAmount = (discountLastMoney - deposit).toFixed(2) - 0
  788. }
  789. this.$nextTick(() => {
  790. this.form.setFieldsValue({
  791. organId: organId,
  792. linkNumber: linkNumber,
  793. discount: discount,
  794. discountMoney: discountMoney,
  795. discountLastMoney: discountLastMoney,
  796. deposit: deposit,
  797. changeAmount: changeAmount,
  798. accountId: accountId,
  799. remark: remark,
  800. receiverName,
  801. receiverPhone,
  802. receiverAddress,
  803. })
  804. this.personList.value = salesMan
  805. })
  806. //判断后进行仓库的切换
  807. if (depotId) {
  808. setTimeout(function () {
  809. that.batchSetDepotModalFormOk(depotId)
  810. }, 1000)
  811. }
  812. }
  813. },
  814. getUnitInfo(val) {
  815. this.unitList = val
  816. },
  817. },
  818. }
  819. </script>
  820. <style scoped></style>