SaleOutModal.vue 31 KB

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