SaleOutModal.vue 33 KB

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