SaleOutModal.vue 32 KB

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