SaleOrderModal.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. :dropdownMatchSelectWidth="false"
  42. showSearch
  43. optionFilterProp="children"
  44. @change="getTatRate"
  45. >
  46. <div slot="dropdownRender" slot-scope="menu">
  47. <v-nodes :vnodes="menu" />
  48. <a-divider style="margin: 4px 0" />
  49. <div
  50. v-if="quickBtn.customer"
  51. style="padding: 4px 8px; cursor: pointer"
  52. @mousedown="(e) => e.preventDefault()"
  53. @click="addCustomer"
  54. >
  55. <a-icon type="plus" /> 新增客户
  56. </div>
  57. </div>
  58. <a-select-option v-for="(item, index) in cusList" :key="index" :value="item.id">
  59. {{ item.supplier }}
  60. </a-select-option>
  61. </a-select>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :lg="6" :md="12" :sm="24">
  65. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="单据日期">
  66. <j-date v-decorator="['operTime', validatorRules.operTime]" :show-time="true" />
  67. </a-form-item>
  68. </a-col>
  69. <a-col :lg="6" :md="12" :sm="24">
  70. <a-form-item
  71. :labelCol="labelCol"
  72. :wrapperCol="wrapperCol"
  73. label="单据编号"
  74. data-step="2"
  75. data-title="单据编号"
  76. data-intro="单据编号自动生成、自动累加、开头是单据类型的首字母缩写,累加的规则是每次打开页面会自动占用一个新的编号"
  77. >
  78. <a-input placeholder="请输入单据编号" v-decorator.trim="['number']" />
  79. </a-form-item>
  80. </a-col>
  81. <a-col :lg="6" :md="12" :sm="24">
  82. <a-form-item
  83. :labelCol="labelCol"
  84. :wrapperCol="wrapperCol"
  85. label="销售人员"
  86. data-step="3"
  87. data-title="销售人员"
  88. data-intro="销售人员的数据来自【经手人管理】菜单中的销售员"
  89. >
  90. <j-select-multiple
  91. placeholder="请选择销售人员"
  92. v-model="personList.value"
  93. :options="personList.options"
  94. />
  95. </a-form-item>
  96. </a-col>
  97. <a-col :lg="6" :md="12" :sm="24">
  98. <a-form-item
  99. :labelCol="labelCol"
  100. :wrapperCol="wrapperCol"
  101. label="仓库名"
  102. data-step="4"
  103. data-title=""
  104. data-intro="仓库名"
  105. >
  106. <a-select v-decorator="['depotId',validatorRules.depotId]" placeholder="请选择仓库名" @change="changeDepot($event,refKeys[0])">
  107. <a-select-option v-for="(item, index) in depotList" :key="index" :value="item.id">
  108. {{ item.depotName }}
  109. </a-select-option>
  110. </a-select>
  111. </a-form-item>
  112. </a-col>
  113. <a-col :lg="6" :md="12" :sm="24">
  114. <a-form-item
  115. :labelCol="labelCol"
  116. :wrapperCol="wrapperCol"
  117. label="税率"
  118. data-step="5"
  119. data-title="税率"
  120. data-intro="税率"
  121. >
  122. <a-input placeholder="自动带出" disabled v-decorator="['taxRate']" />
  123. </a-form-item>
  124. </a-col>
  125. </a-row>
  126. <j-editable-table
  127. id="billModal"
  128. :ref="refKeys[0]"
  129. :loading="materialTable.loading"
  130. :columns="materialTable.columns"
  131. :dataSource="materialTable.dataSource"
  132. :minWidth="minWidth"
  133. :maxHeight="300"
  134. :rowNumber="false"
  135. :rowSelection="true"
  136. :actionButton="true"
  137. :dragSortAndNumber="true"
  138. @valueChange="onValueChange"
  139. @added="onAdded"
  140. @deleted="onDeleted"
  141. @focusChange="getUnitInfo"
  142. >
  143. <template #buttonAfter>
  144. <a-row
  145. :gutter="24"
  146. style="float: left; padding-bottom: 5px"
  147. data-step="4"
  148. data-title="扫码录入"
  149. data-intro="此功能支持扫码枪扫描商品条码进行录入"
  150. >
  151. <a-col v-if="scanStatus" :md="6" :sm="24">
  152. <a-button @click="scanEnter">扫码录入</a-button>
  153. </a-col>
  154. <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 8px 0 12px">
  155. <a-input
  156. placeholder="请扫描商品条码并回车"
  157. v-model="scanBarCode"
  158. @pressEnter="scanPressEnter"
  159. ref="scanBarCode"
  160. />
  161. </a-col>
  162. <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px 12px 0 0">
  163. <a-button @click="stopScan">收起扫码</a-button>
  164. </a-col>
  165. </a-row>
  166. <a-row :gutter="24" style="float: left; padding-bottom: 5px">
  167. <a-col :md="24" :sm="24">
  168. <a-button style="margin-left: 8px" @click="handleHistoryBillList"
  169. ><a-icon type="history" />历史单据</a-button
  170. >
  171. </a-col>
  172. </a-row>
  173. <a-row :gutter="24" style="float: left; padding-bottom: 5px; padding-left: 20px">
  174. <a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
  175. </a-row>
  176. </template>
  177. <template #depotId="{ value }">
  178. <a-select
  179. disabled
  180. :value="value"
  181. :options="depotList"
  182. >
  183. </a-select>
  184. </template>
  185. <template #unitPrice="{ handleChange, value, index,allValues }">
  186. <a-input :value="value" @change="($event) => onChangePrice($event,handleChange)">
  187. <a-tooltip slot="suffix" title="修改后和默认价格不一致">
  188. <a-icon type="info-circle" style="color: #f5222d" v-show="getDefaultWholesaleDecimal(index,'defaultWholesaleDecimal',value, allValues)" />
  189. </a-tooltip>
  190. </a-input>
  191. </template>
  192. <!-- <template #unit="{ handleChange, handleFocus, value }">
  193. <a-select
  194. placeholder="请选择"
  195. v-decorator="['unit']"
  196. :dropdownMatchSelectWidth="false"
  197. showSearch
  198. :allowClear="false"
  199. optionFilterProp="children"
  200. :value="value"
  201. @change="($event) => handleChange($event)"
  202. @focus="($event) => handleFocus($event)"
  203. >
  204. <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
  205. {{ item.name }}
  206. </a-select-option>
  207. </a-select>
  208. </template> -->
  209. </j-editable-table>
  210. <a-row class="form-row" :gutter="24">
  211. <a-col :lg="24" :md="24" :sm="24">
  212. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  213. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  214. </a-form-item>
  215. </a-col>
  216. </a-row>
  217. <a-row class="form-row" :gutter="24">
  218. <a-col :lg="6" :md="12" :sm="24">
  219. <a-form-item
  220. :labelCol="labelCol"
  221. :wrapperCol="wrapperCol"
  222. label="优惠率"
  223. data-step="5"
  224. data-title="优惠率"
  225. data-intro="针对单据明细中商品总金额进行优惠的比例"
  226. >
  227. <a-input
  228. style="width: 80%"
  229. placeholder="请输入优惠率"
  230. v-decorator.trim="['discount']"
  231. suffix="%"
  232. @change="onChangeDiscount"
  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="6"
  242. data-title="收款优惠"
  243. data-intro="针对单据明细中商品总金额进行优惠的金额"
  244. >
  245. <a-input
  246. placeholder="请输入付款优惠"
  247. v-decorator.trim="['discountMoney']"
  248. @change="onChangeDiscountMoney"
  249. />
  250. </a-form-item>
  251. </a-col>
  252. <a-col :lg="6" :md="12" :sm="24">
  253. <a-form-item
  254. :labelCol="labelCol"
  255. :wrapperCol="wrapperCol"
  256. label="优惠后金额"
  257. data-step="7"
  258. data-title="优惠后金额"
  259. data-intro="针对单据明细中商品总金额进行优惠后的金额"
  260. >
  261. <a-input placeholder="请输入优惠后金额" v-decorator.trim="['discountLastMoney']" :readOnly="true" />
  262. </a-form-item>
  263. </a-col>
  264. <a-col :lg="6" :md="12" :sm="24"></a-col>
  265. </a-row>
  266. <a-row class="form-row" :gutter="24">
  267. <a-col :lg="6" :md="12" :sm="24">
  268. <a-form-item
  269. :labelCol="labelCol"
  270. :wrapperCol="wrapperCol"
  271. label="结算账户"
  272. data-step="8"
  273. data-title="结算账户"
  274. data-intro="如果在下拉框中选择多账户,则可以通过多个结算账户进行结算"
  275. >
  276. <a-select
  277. style="width: 80%"
  278. placeholder="请选择结算账户"
  279. v-decorator="['accountId']"
  280. :dropdownMatchSelectWidth="false"
  281. allowClear
  282. @select="selectAccount"
  283. >
  284. <div slot="dropdownRender" slot-scope="menu">
  285. <v-nodes :vnodes="menu" />
  286. <a-divider style="margin: 4px 0" />
  287. <div
  288. v-if="quickBtn.account"
  289. style="padding: 4px 8px; cursor: pointer"
  290. @mousedown="(e) => e.preventDefault()"
  291. @click="addAccount"
  292. >
  293. <a-icon type="plus" /> 新增结算账户
  294. </div>
  295. </div>
  296. <a-select-option v-for="(item, index) in accountList" :key="index" :value="item.id">
  297. {{ item.name }}
  298. </a-select-option>
  299. </a-select>
  300. <a-tooltip title="多账户明细">
  301. <a-button
  302. type="default"
  303. icon="folder"
  304. style="margin-left: 8px"
  305. size="small"
  306. v-show="manyAccountBtnStatus"
  307. @click="handleManyAccount"
  308. />
  309. </a-tooltip>
  310. </a-form-item>
  311. </a-col>
  312. <a-col :lg="6" :md="12" :sm="24">
  313. <a-form-item
  314. :labelCol="labelCol"
  315. :wrapperCol="wrapperCol"
  316. label="收取订金"
  317. data-step="9"
  318. data-title="收取订金"
  319. data-intro="填写订金之后,在销售出库单会自动计算扣除订金"
  320. >
  321. <a-input
  322. placeholder="请输入收取订金"
  323. v-decorator.trim="['changeAmount', validatorRules.price]"
  324. @change="onChangeChangeAmount"
  325. />
  326. </a-form-item>
  327. </a-col>
  328. <a-col :lg="6" :md="12" :sm="24">
  329. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货人" data-step="10">
  330. <a-input placeholder="请输入收货人" v-decorator.trim="['receiverName']" />
  331. </a-form-item>
  332. </a-col>
  333. <a-col :lg="6" :md="12" :sm="24">
  334. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货人电话" data-step="10">
  335. <a-input placeholder="请输入收货人电话" v-decorator.trim="['receiverPhone']" />
  336. </a-form-item>
  337. </a-col>
  338. <a-col :lg="6" :md="12" :sm="24">
  339. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收货地址" data-step="8">
  340. <a-input style="width: 80%" placeholder="请输入收货地址" v-decorator.trim="['receiverAddress']" />
  341. </a-form-item>
  342. </a-col>
  343. </a-row>
  344. <a-row class="form-row" :gutter="24">
  345. <a-col :lg="6" :md="12" :sm="24">
  346. <a-form-item
  347. :labelCol="labelCol"
  348. :wrapperCol="wrapperCol"
  349. label="附件"
  350. data-step="10"
  351. data-title="附件"
  352. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  353. >
  354. <j-upload v-model="fileList" bizPath="bill"></j-upload>
  355. </a-form-item>
  356. </a-col>
  357. </a-row>
  358. </a-form>
  359. </a-spin>
  360. <many-account-modal ref="manyAccountModalForm" @ok="manyAccountModalFormOk"></many-account-modal>
  361. <import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk" exportTitle="销售订单导入模版[下载]"></import-item-modal>
  362. <customer-modal ref="customerModalForm" @ok="customerModalFormOk"></customer-modal>
  363. <account-modal ref="accountModalForm" @ok="accountModalFormOk"></account-modal>
  364. <history-bill-list ref="historyBillListModalForm"></history-bill-list>
  365. <workflow-iframe ref="modalWorkflow" @ok="workflowModalFormOk"></workflow-iframe>
  366. <bill-print-iframe ref="modalPrint"></bill-print-iframe>
  367. </j-modal>
  368. </template>
  369. <script>
  370. import pick from 'lodash.pick'
  371. import ManyAccountModal from '../dialog/ManyAccountModal'
  372. import ImportItemModal from '../dialog/ImportItemModal'
  373. import CustomerModal from '../../system/modules/CustomerModal'
  374. import AccountModal from '../../system/modules/AccountModal'
  375. import HistoryBillList from '../dialog/HistoryBillList'
  376. import WorkflowIframe from '@/components/tools/WorkflowIframe'
  377. import BillPrintIframe from '../dialog/BillPrintIframe'
  378. import { FormTypes } from '@/utils/JEditableTableUtil'
  379. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  380. import { BillModalMixin } from '../mixins/BillModalMixin'
  381. import { getMpListShort, handleIntroJs } from '@/utils/util'
  382. import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
  383. import JUpload from '@/components/jeecg/JUpload'
  384. import JDate from '@/components/jeecg/JDate'
  385. import Vue from 'vue'
  386. export default {
  387. name: 'SaleOrderModal',
  388. mixins: [JEditableTableMixin, BillModalMixin],
  389. components: {
  390. ManyAccountModal,
  391. ImportItemModal,
  392. CustomerModal,
  393. AccountModal,
  394. HistoryBillList,
  395. WorkflowIframe,
  396. BillPrintIframe,
  397. JUpload,
  398. JDate,
  399. JSelectMultiple,
  400. VNodes: {
  401. functional: true,
  402. render: (h, ctx) => ctx.props.vnodes,
  403. },
  404. },
  405. data() {
  406. return {
  407. title: '操作',
  408. width: '1600px',
  409. moreStatus: false,
  410. // 新增时子表默认添加几行空数据
  411. addDefaultRowNum: 1,
  412. visible: false,
  413. operTimeStr: '',
  414. prefixNo: 'XSDD',
  415. fileList: [],
  416. model: {},
  417. labelCol: {
  418. xs: { span: 24 },
  419. sm: { span: 8 },
  420. },
  421. wrapperCol: {
  422. xs: { span: 24 },
  423. sm: { span: 16 },
  424. },
  425. refKeys: ['materialDataTable'],
  426. activeKey: 'materialDataTable',
  427. materialTable: {
  428. loading: false,
  429. dataSource: [],
  430. columns: [
  431. // { title: '', key: 'hiddenKey', width: '1%', type: FormTypes.hidden },
  432. {
  433. title: '商品条码',
  434. key: 'barCode',
  435. width: '200px',
  436. type: FormTypes.popupJsh,
  437. kind: 'material2',
  438. multi: true,
  439. validateRules: [{ required: true, message: '${title}不能为空' }],
  440. },
  441. { title: '名称', key: 'name', width: '120px', type: FormTypes.normal },
  442. // { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
  443. // { title: '生产日期', key: 'productionDate', width: '6%', type: FormTypes.normal },
  444. // { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
  445. // { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
  446. { title: '仓库名', key: 'depotId', width: '120px', type: FormTypes.slot },
  447. { title: '仓库货架', key: 'position', width: '120px', type: FormTypes.input },
  448. { title: '包装规格', key: 'unitName', width: '120px', type: FormTypes.normal },
  449. { title: '型号', key: 'model', width: '120px', type: FormTypes.normal },
  450. { title: '颜色', key: 'color', width: '120px', type: FormTypes.normal },
  451. { title: '品牌', key: 'brand', width: '120px', type: FormTypes.normal },
  452. { title: '制造商', key: 'mfrs', width: '120px', type: FormTypes.normal },
  453. { title: '扩展信息', key: 'materialOther', width: '120px', type: FormTypes.normal },
  454. { title: '库存', key: 'stock', width: '120px', type: FormTypes.normal },
  455. {
  456. title: '单位',
  457. key: 'unit',
  458. width: '120px',
  459. type: FormTypes.normal,
  460. // options: [],
  461. // allowClear: false,
  462. // slotName: 'unit',
  463. },
  464. // { title: '单位id', key: 'unitId', width: '120px', type: FormTypes.hidden },
  465. // { title: '单位列表', key: 'unitList', width: '120px', type: FormTypes.hidden },
  466. // { title: '序列号', key: 'snList', width: '120px', type: FormTypes.popupJsh, kind: 'sn', multi: true },
  467. // { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
  468. // { title: '多属性', key: 'sku', width: '120px', type: FormTypes.normal },
  469. // { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
  470. // { title: '已出库', key: 'finishNumber', width: '4%', type: FormTypes.normal },
  471. {
  472. title: '出库数量',
  473. key: 'operNumber',
  474. width: '120px',
  475. type: FormTypes.inputNumber,
  476. statistics: true,
  477. validateRules: [{ required: true, message: '${title}不能为空' }],
  478. },
  479. { 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: '金额格式不正确!' }], },
  480. { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, readonly: true, statistics: true },
  481. { title: '税率', key: 'taxRate', width: '120px', type: FormTypes.hidden, placeholder: '%' },
  482. {
  483. title: '税额',
  484. key: 'taxMoney',
  485. width: '120px',
  486. type: FormTypes.inputNumber,
  487. readonly: true,
  488. statistics: true,
  489. },
  490. { title: '价税合计', key: 'taxLastMoney', width: '120px', type: FormTypes.inputNumber, readonly: true, statistics: true },
  491. // {
  492. // title: '实际出库数量',
  493. // key: 'actualQuantityInStorage',
  494. // width: '9%',
  495. // type: FormTypes.inputNumber,
  496. // validateRules: [{ required: true, message: '实际入库数量不能为空' }],
  497. // },
  498. // { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
  499. // { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
  500. // {
  501. // title: '出库人',
  502. // key: 'warehousingUser',
  503. // width: '9%',
  504. // type: FormTypes.input,
  505. // validateRules: [{ required: true, message: '出库人不能为空' }],
  506. // },
  507. // { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
  508. { title: '备注', key: 'remark', width: '200px', type: FormTypes.input },
  509. { title: '关联id', key: 'linkId', width: '120px', type: FormTypes.hidden },
  510. { title: '默认销售价', key: 'defaultWholesaleDecimal', width: '120px', type: FormTypes.hidden },
  511. { title: '默认采购价', key: 'defaultPurchaseDecimal', width: '120px', type: FormTypes.hidden },
  512. ],
  513. },
  514. confirmLoading: false,
  515. validatorRules: {
  516. operTime: {
  517. rules: [{ required: true, message: '请输入单据日期!' }],
  518. },
  519. organId: {
  520. rules: [{ required: true, message: '请选择客户!' }],
  521. },
  522. depotId: {
  523. rules: [{ required: true, message: '请选择仓库名!' }],
  524. },
  525. },
  526. url: {
  527. add: '/depotHead/addDepotHeadAndDetail',
  528. edit: '/depotHead/updateDepotHeadAndDetail',
  529. detailList: '/depotItem/getDetailList',
  530. },
  531. unitList: [],
  532. }
  533. },
  534. created() {},
  535. methods: {
  536. //调用完edit()方法之后会自动调用此方法
  537. editAfter() {
  538. this.billStatus = '0'
  539. this.changeColumnHide()
  540. if (this.action === 'add') {
  541. this.addInit(this.prefixNo)
  542. this.personList.value = ''
  543. this.fileList = []
  544. this.$nextTick(() => {
  545. handleIntroJs(this.prefixNo, 1)
  546. })
  547. } else {
  548. this.model.operTime = this.model.operTimeStr
  549. if (this.model.accountId == null && this.model.accountIdList) {
  550. this.model.accountId = 0
  551. this.manyAccountBtnStatus = true
  552. this.accountIdList = this.model.accountIdList
  553. this.accountMoneyList = this.model.accountMoneyList
  554. } else {
  555. this.manyAccountBtnStatus = false
  556. }
  557. this.personList.value = this.model.salesMan
  558. this.fileList = this.model.fileName
  559. this.$nextTick(() => {
  560. this.form.setFieldsValue(
  561. pick(
  562. this.model,
  563. 'organId',
  564. 'operTime',
  565. 'number',
  566. 'remark',
  567. 'discount',
  568. 'discountMoney',
  569. 'discountLastMoney',
  570. 'accountId',
  571. 'changeAmount',
  572. 'salesMan',
  573. 'receiverName',
  574. 'receiverPhone',
  575. 'receiverAddress',
  576. 'depotId',
  577. 'taxRate'
  578. )
  579. )
  580. })
  581. // 加载子表数据
  582. let params = {
  583. headerId: this.model.id,
  584. mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
  585. linkType: 'basic',
  586. }
  587. let url = this.readOnly ? this.url.detailList : this.url.detailList
  588. this.requestSubTableData(url, params, this.materialTable)
  589. }
  590. //复制新增单据-初始化单号和日期
  591. if (this.action === 'copyAdd') {
  592. this.model.id = ''
  593. this.model.tenantId = ''
  594. this.copyAddInit(this.prefixNo)
  595. }
  596. this.initSystemConfig()
  597. this.initCustomer(0)
  598. this.initSalesman()
  599. this.initAccount(0)
  600. this.initPlatform()
  601. this.initQuickBtn()
  602. this.initDepot()
  603. },
  604. //提交单据时整理成formData
  605. classifyIntoFormData(allValues) {
  606. let totalPrice = 0
  607. let billMain = Object.assign(this.model, allValues.formValue)
  608. let detailArr = allValues.tablesValue[0].values
  609. billMain.type = '其它'
  610. billMain.subType = '销售订单'
  611. for (let item of detailArr) {
  612. // item.depotId = '' //订单不需要仓库
  613. totalPrice += item.allPrice - 0
  614. }
  615. billMain.totalPrice = totalPrice
  616. if (billMain.accountId === 0) {
  617. billMain.accountId = ''
  618. }
  619. billMain.accountIdList = this.accountIdList.length > 0 ? JSON.stringify(this.accountIdList) : ''
  620. billMain.accountMoneyList = this.accountMoneyList.length > 0 ? JSON.stringify(this.accountMoneyList) : ''
  621. if (this.fileList && this.fileList.length > 0) {
  622. billMain.fileName = this.fileList
  623. } else {
  624. billMain.fileName = ''
  625. }
  626. if (this.model.id) {
  627. billMain.id = this.model.id
  628. }
  629. billMain.salesMan = this.personList.value
  630. billMain.status = this.billStatus
  631. return {
  632. info: JSON.stringify(billMain),
  633. rows: JSON.stringify(detailArr),
  634. }
  635. },
  636. handleHistoryBillList() {
  637. let organId = this.form.getFieldValue('organId')
  638. this.$refs.historyBillListModalForm.show('其它', '销售订单', '客户', organId)
  639. this.$refs.historyBillListModalForm.disableSubmit = false
  640. },
  641. getUnitInfo(val) {
  642. this.unitList = val
  643. },
  644. },
  645. }
  646. </script>
  647. <style scoped></style>