detailsPageEdit.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <el-button
  11. class="el-button--small-yh add-customer-btn"
  12. style="right: 245px;"
  13. type="primary"
  14. @click="revokeOutGoods"
  15. v-if="form.deliveryStatus !== '录入'"
  16. >撤销发货</el-button>
  17. <el-button
  18. class="el-button--small-yh add-customer-btn"
  19. style="right: 245px;"
  20. type="primary"
  21. @click="sendOutGoods"
  22. v-if="form.deliveryStatus == '录入'"
  23. >确认发货</el-button>
  24. <el-button
  25. class="el-button--small-yh add-customer-btn"
  26. type="success" style="right: 140px;" @click="copyOrder">
  27. 复制新单
  28. </el-button>
  29. <el-button
  30. class="el-button--small-yh add-customer-btn"
  31. type="primary"
  32. :disabled="disabled"
  33. @click="editCustomer(false)"
  34. >{{ form.id ? '确认修改' : '确认新增' }}
  35. </el-button>
  36. </div>
  37. <div style="margin-top: 60px">
  38. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  39. <containerTitle title="基础资料"></containerTitle>
  40. <basic-container style="margin-bottom: 10px">
  41. <el-row>
  42. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  43. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  44. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  45. <!-- ></avue-input-tree>-->
  46. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  47. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled"/>
  48. <selectComponent v-else-if="item.prop === 'corpId' || item.prop === 'salesCompany'" v-model="form[item.prop]"
  49. :configuration="configuration" style="width: 100%"/>
  50. <el-select v-else-if="item.prop === 'deliveryStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="item.disabled">
  51. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue" size="small"></el-option>
  52. </el-select>
  53. <!-- <avue-input-tree-->
  54. <!-- v-else-if="item.prop === 'warehouseType'"-->
  55. <!-- leaf-only-->
  56. <!-- placeholder="请选择内容"-->
  57. <!-- :dic="warehouseType"-->
  58. <!-- type="tree"-->
  59. <!-- v-model="form[item.prop]"-->
  60. <!-- style="width: 100%"-->
  61. <!-- size="small"-->
  62. <!-- @change="warehouseTreeChange"-->
  63. <!-- >-->
  64. <!-- </avue-input-tree>-->
  65. <el-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
  66. <el-option v-for="(item,index) in warehouseName" :key="index" :label="item.cname" :value="item.id" size="small"></el-option>
  67. </el-select>
  68. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  69. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  70. </el-form-item>
  71. </el-col>
  72. </el-row>
  73. </basic-container>
  74. <containerTitle title="商品信息"></containerTitle>
  75. <basic-container style="margin-bottom: 10px">
  76. <avue-crud
  77. :option="customerContact"
  78. v-model="contactsForm"
  79. :data="contactsData"
  80. ref="crudContact"
  81. @row-save="rowSave"
  82. @row-click="handleRowClick"
  83. @row-update="rowUpdate"
  84. @row-del="rowDel"
  85. @saveColumn="saveColumn('goods')"
  86. >
  87. <template slot="code" slot-scope="{row,index}">
  88. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  89. <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
  90. </template>
  91. <template slot-scope="{row,index}" slot="menu">
  92. <el-button
  93. type="text"
  94. size="small"
  95. @click="rowCell(row,index)"
  96. >{{ row.$cellEdit ? '保存' : '修改' }}
  97. </el-button>
  98. </template>
  99. <template slot="menuLeft" slot-scope="{size}">
  100. <el-button type="primary"
  101. icon="el-icon-plus"
  102. size="small"
  103. @click="commoditySelection"
  104. >录入明细
  105. </el-button>
  106. <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
  107. </template>
  108. <template slot="actualQuantity" slot-scope="{ row }">
  109. <el-input
  110. v-if="row.$cellEdit"
  111. v-model="row.actualQuantity"
  112. v-input-limit="0"
  113. @change="actualQuantityChange(row)"
  114. ></el-input>
  115. <span v-else>{{ row.actualQuantity }}</span>
  116. </template>
  117. </avue-crud>
  118. </basic-container>
  119. <containerTitle title="费用明细"></containerTitle>
  120. <basic-container style="margin-bottom: 10px">
  121. <avue-crud
  122. :option="advantageProject"
  123. v-model="advantageProjectForm"
  124. :data="advantageProjectData"
  125. ref="crudProject"
  126. @row-save="rowSaveProject"
  127. @row-update="rowUpdateProject"
  128. @row-del="rowDelProject"
  129. @saveColumn="saveColumn('fees')"
  130. >
  131. <template slot="code" slot-scope="{row,index}">
  132. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  133. <el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  134. </template>
  135. <template slot="corpId" slot-scope="{ row }">
  136. <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
  137. :configuration="configuration" @receiveList="receiveList"/>
  138. <span v-else>
  139. <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
  140. </span>
  141. </template>
  142. <template slot-scope="{row,index}" slot="menu">
  143. <el-button
  144. type="text"
  145. size="small"
  146. @click="rowCellTwo(row,index)"
  147. >{{ row.$cellEdit ? '保存' : '修改' }}
  148. </el-button>
  149. </template>
  150. <template slot="menuLeft" slot-scope="{size}">
  151. <el-button type="primary"
  152. icon="el-icon-plus"
  153. size="small"
  154. @click="costIncrease"
  155. >录入明细
  156. </el-button>
  157. </template>
  158. </avue-crud>
  159. </basic-container>
  160. <containerTitle title="附件上传"></containerTitle>
  161. <basic-container style="margin-bottom: 40px">
  162. <avue-crud
  163. :option="bankOfDeposit"
  164. v-model="bankOfDepositForm"
  165. :data="bankOfDepositData"
  166. @row-save="rowSaveBankOfDeposit"
  167. @row-update="rowUpdateBankOfDeposit"
  168. @row-del="rowDelBankOfDeposit"
  169. :upload-after="uploadAfter"
  170. ></avue-crud>
  171. </basic-container>
  172. </el-form>
  173. </div>
  174. <el-dialog
  175. title="导入商品"
  176. append-to-body
  177. class="el-dialogDeep"
  178. :visible.sync="dialogVisible"
  179. width="80%"
  180. :close-on-click-modal="false"
  181. :destroy-on-close="true"
  182. :close-on-press-escape="false"
  183. @close="closeGoods">
  184. <el-row style="height: 0;">
  185. <el-col :span="5">
  186. <div>
  187. <el-scrollbar>
  188. <basic-container>
  189. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  190. </basic-container>
  191. </el-scrollbar>
  192. </div>
  193. </el-col>
  194. <el-col :span="19">
  195. <basic-container>
  196. <avue-crud :option="optionTwo"
  197. :table-loading="loading"
  198. :data="data"
  199. ref="crud"
  200. @refresh-change="refreshChange"
  201. @selection-change="selectionChange"
  202. :page.sync="page"
  203. @on-load="onLoad"></avue-crud>
  204. </basic-container>
  205. </el-col>
  206. </el-row>
  207. <span slot="footer" class="dialog-footer">
  208. <el-button @click="dialogVisible = false">取 消</el-button>
  209. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  210. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  211. :disabled="tableData.length !== 1">导入</el-button>
  212. </span>
  213. </el-dialog>
  214. <el-dialog
  215. title="导入费用"
  216. append-to-body
  217. class="el-dialogDeep"
  218. :visible.sync="dialogCost"
  219. width="80%"
  220. :close-on-click-modal="false"
  221. :destroy-on-close="true"
  222. :close-on-press-escape="false"
  223. @close="closeFees">
  224. <el-row style="height: 0;">
  225. <el-col :span="5">
  226. <div>
  227. <el-scrollbar>
  228. <basic-container>
  229. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  230. </basic-container>
  231. </el-scrollbar>
  232. </div>
  233. </el-col>
  234. <el-col :span="19">
  235. <basic-container>
  236. <avue-crud :option="optionTwoCost"
  237. :table-loading="loadingCost"
  238. :data="dataCost"
  239. ref="crud"
  240. @refresh-change="refreshChangeCost"
  241. @selection-change="selectionChangeCost"
  242. :page.sync="pageCost"
  243. @on-load="onLoadCost">
  244. </avue-crud>
  245. </basic-container>
  246. </el-col>
  247. </el-row>
  248. <span slot="footer" class="dialog-footer">
  249. <el-button @click="dialogCost = false">取 消</el-button>
  250. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  251. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  252. :disabled="tableDataCost.length !== 1">导入</el-button>
  253. </span>
  254. </el-dialog>
  255. </div>
  256. </template>
  257. <script>
  258. import {
  259. typeSave, detail,
  260. corpstypeTree,
  261. corpsattn,
  262. corpsbank,
  263. corpsitem,
  264. getList,
  265. sendOutGoods,
  266. revokeOutGoods
  267. } from "@/api/basicData/deliveryNotice"
  268. import customerContact from "./configuration/customerContact.json"
  269. import advantageProject from "./configuration/advantageProject.json"
  270. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  271. import commodity from "./configuration/commodity.json"
  272. import optionTwoCost from "./configuration/mainListCost.json"
  273. import {getDeptLazyTree,getDeptLazyTreeTwo, customerList} from "@/api/basicData/basicFeesDesc";
  274. import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
  275. import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
  276. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  277. export default {
  278. name: "detailsPage",
  279. props: {
  280. detailData: {
  281. type: Object
  282. }
  283. },
  284. data() {
  285. return {
  286. configuration: {
  287. multipleChoices: false,
  288. multiple: false,
  289. collapseTags: false,
  290. placeholder: '请点击右边按钮选择',
  291. dicData: []
  292. },
  293. form: {},
  294. data: [],
  295. loadingCost: false,
  296. choiceData: false,
  297. commodityData: false,
  298. dataCost: [],
  299. treeDataGoods: [],
  300. treeData: [],
  301. choiceIndex: '',
  302. dialogCost: false,
  303. treeDeptId: '',
  304. treeDeptIdCost: '',
  305. pageCost: {
  306. pageSize: 10,
  307. currentPage: 1,
  308. total: 0
  309. },
  310. page: {
  311. pageSize: 10,
  312. currentPage: 1,
  313. total: 0
  314. },
  315. loading: false,
  316. contactsForm: {},
  317. optionTwo: commodity,
  318. optionTwoCost: optionTwoCost,
  319. treeOptionCost: {
  320. nodeKey: 'id',
  321. lazy: true,
  322. treeLoad: function (node, resolve) {
  323. const parentId = (node.level === 0) ? 0 : node.data.id;
  324. getDeptLazyTree(parentId).then(res => {
  325. resolve(res.data.data.map(item => {
  326. return {
  327. ...item,
  328. leaf: !item.hasChildren
  329. }
  330. }))
  331. });
  332. },
  333. addBtn: false,
  334. menu: false,
  335. size: 'small',
  336. props: {
  337. labelText: '标题',
  338. label: 'title',
  339. value: 'value',
  340. children: 'children'
  341. }
  342. },
  343. treeOption: {
  344. nodeKey: 'id',
  345. lazy: true,
  346. treeLoad: function (node, resolve) {
  347. const parentId = (node.level === 0) ? 0 : node.data.id;
  348. getDeptLazyTreeTwo(parentId).then(res => {
  349. resolve(res.data.data.map(item => {
  350. return {
  351. ...item,
  352. leaf: !item.hasChildren
  353. }
  354. }))
  355. });
  356. },
  357. addBtn: false,
  358. menu: false,
  359. size: 'small',
  360. props: {
  361. labelText: '标题',
  362. label: 'title',
  363. value: 'value',
  364. children: 'children'
  365. }
  366. },
  367. dialogVisible: false,
  368. advantageProjectForm: {},
  369. bankOfDepositForm: {},
  370. contactsData: [],
  371. advantageProjectData: [],
  372. disabled: false,
  373. bankOfDepositData: [],
  374. tableDataCost: [],
  375. dic: [],
  376. tableData: [],
  377. customerContact: {},
  378. advantageProject: {},
  379. bankOfDeposit: bankOfDeposit,
  380. basicData: {
  381. column: [
  382. {
  383. label: '系统编号',//发货通知(点击)
  384. prop: 'sysNo',
  385. disabled: true,
  386. rules: [
  387. {
  388. required: false,
  389. message: ' ',
  390. trigger: 'blur'
  391. }
  392. ]
  393. }, {
  394. label: '客户名称',
  395. prop: 'corpId',
  396. rules: [
  397. {
  398. required: true,
  399. message: ' ',
  400. trigger: 'blur'
  401. }
  402. ]
  403. }, {
  404. label: '单据状态',
  405. prop: 'deliveryStatus',
  406. disabled: true,
  407. rules: [
  408. {
  409. required: true,
  410. message: ' ',
  411. trigger: 'blur'
  412. }
  413. ]
  414. }, {
  415. label: '所属公司',
  416. prop: 'salesCompany', //salesCompany
  417. rules: [
  418. {
  419. required: true,
  420. message: ' ',
  421. trigger: 'blur'
  422. }
  423. ]
  424. }, {
  425. label: '仓库类型',
  426. prop: 'warehouseType',//字典表
  427. rules: [
  428. {
  429. required: true,
  430. message: ' ',
  431. trigger: 'blur'
  432. }
  433. ]
  434. }, {
  435. label: '仓库名称',
  436. prop: 'storageId',
  437. rules: [
  438. {
  439. required: true,
  440. message: ' ',
  441. trigger: 'blur'
  442. }
  443. ]
  444. },{
  445. label: '匹配订单号',
  446. prop: 'srcOrderNo',
  447. rules: [
  448. {
  449. required: true,
  450. message: ' ',
  451. trigger: 'blur'
  452. }
  453. ]
  454. }, {
  455. label: '出库金额',
  456. prop: 'deliveryAmount',
  457. disabled: true,
  458. rules: [
  459. {
  460. required: true,
  461. message: ' ',
  462. trigger: 'blur'
  463. }
  464. ]
  465. }, {
  466. label: '出库数量',
  467. prop: 'totalQuantity',
  468. disabled: true,
  469. rules: [
  470. {
  471. required: true,
  472. message: ' ',
  473. trigger: 'blur'
  474. }
  475. ]
  476. }, {
  477. label: '出库日期',
  478. prop: 'businessDate',
  479. type: 'datetime',
  480. rules: [
  481. {
  482. required: true,
  483. message: ' ',
  484. trigger: 'blur'
  485. }
  486. ]
  487. }, {
  488. label: '制单时间',
  489. type: 'datetime',
  490. prop: 'createTime',
  491. disabled: true,
  492. rules: [
  493. {
  494. required: false,
  495. message: ' ',
  496. trigger: 'blur'
  497. }
  498. ]
  499. }, {
  500. label: '费用合计',
  501. prop: 'totalCost',
  502. rules: [
  503. {
  504. required: true,
  505. message: ' ',
  506. trigger: 'blur'
  507. }
  508. ]
  509. }, {
  510. label: "备注",
  511. span: 24,
  512. type: 'textarea',
  513. prop: "otherRemarks",
  514. mock: {
  515. type: 'county'
  516. }
  517. }
  518. ]
  519. },
  520. statusOption: [],
  521. // 仓库类型
  522. warehouseType: [],
  523. // 仓库名称
  524. warehouseName: [],
  525. maxFeeNum: 0,
  526. maxGoodsNum: 0,
  527. }
  528. },
  529. //初始化查询
  530. async created() {
  531. this.customerContact = await this.getColumnData(this.getColumnName(21), customerContact);
  532. this.advantageProject = await this.getColumnData(this.getColumnName(22), advantageProject);
  533. this.getWorkDicts("order_status").then(res => {
  534. this.statusOption = res.data.data
  535. })
  536. this.$set(this.form,'deliveryStatus','录入')
  537. wareHouseType().then(res => {
  538. this.warehouseType = res.data.data.records
  539. this.warehouseType.forEach(item => {
  540. this.$set(item, 'label', item.cname)
  541. this.$set(item, 'value', item.id)
  542. if (item.hasChildren) {
  543. this.$set(item, 'children', [])
  544. }
  545. })
  546. let result = [], temp = {}
  547. for(let i = 0; i < this.warehouseType.length;i++) {
  548. temp[this.warehouseType[i].id] = this.warehouseType[i]
  549. }
  550. for (let j = 0;j < this.warehouseType.length;j++) {
  551. let current = this.warehouseType[j]
  552. let tempCurrentParent = temp[current.parentId]
  553. if (tempCurrentParent) {
  554. if (!tempCurrentParent["children"]) {
  555. tempCurrentParent["children"] = []
  556. }
  557. tempCurrentParent["children"].push(current)
  558. } else {
  559. result.push(current)
  560. }
  561. }
  562. this.warehouseType = result
  563. });
  564. selectWareHouse().then(res => {
  565. console.log(res)
  566. this.warehouseName = res.data.data.records
  567. })
  568. if (this.detailData.id) {
  569. let id = this.detailData.id
  570. this.queryData(id)
  571. }else if (this.detailData.form){
  572. this.form = JSON.parse(this.detailData.form);
  573. delete this.form.createTime
  574. delete this.form.id
  575. delete this.form.sysNo
  576. this.contactsData = this.form.orderItemsList
  577. delete this.form.orderItemsList
  578. this.configuration.dicData = this.form.corpName
  579. delete this.form.corpName
  580. this.$set(this.form, 'deliveryStatus', '录入')
  581. if (this.form.belongToCorpList) {
  582. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  583. delete this.form.belongToCorpId
  584. this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
  585. }
  586. delete this.form.belongToCorpList
  587. this.$set(this.form, 'deliveryAmount', 0)
  588. this.$set(this.form, 'totalQuantity', 0)
  589. this.$set(this.form, 'totalCost', 0)
  590. this.contactsData.forEach(item => {
  591. this.$set(item, "srcId", item.id)
  592. this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
  593. this.$set(item, "deliveryAmount", item.amount)
  594. this.$set(item, "inventoryNumber", item.storageQuantity)
  595. this.$set(item, "inventoryAmount", 0)
  596. this.form.deliveryAmount += Number(item.deliveryAmount)
  597. this.form.totalQuantity += Number(item.actualQuantity)
  598. this.form.totalCost += Number(item.deliveryAmount)
  599. // 出库数量和出库金额的比例
  600. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  601. delete item.id
  602. delete item.pid
  603. })
  604. } else if (this.detailData.copyId) {
  605. let id = this.detailData.copyId
  606. this.queryData(id, true)
  607. }
  608. },
  609. watch: {
  610. },
  611. methods: {
  612. queryData(id, isCopy = false) {
  613. detail(id).then(res => {
  614. console.log(res.data.data)
  615. this.form = res.data.data;
  616. this.contactsData = this.form.deliveryItemsList
  617. this.advantageProjectData = this.form.deliveryFeesList
  618. this.bankOfDepositData = this.form.deliveryFilesList
  619. this.configuration.dicData = this.form.corpName
  620. this.form.deliveryAmount = 0
  621. this.form.totalQuantity = 0
  622. this.contactsData.forEach(item => {
  623. this.form.deliveryAmount += Number(item.deliveryAmount)
  624. this.form.totalQuantity += Number(item.actualQuantity)
  625. // 出库金额和出库数量的比例
  626. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  627. })
  628. console.log(this.contactsData)
  629. if (this.form.companyName) {
  630. this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
  631. }
  632. let feesData = []
  633. this.form.deliveryFeesList.forEach(item => {
  634. let a = {
  635. cname: item.corpName,
  636. id: item.corpId
  637. }
  638. feesData.push(a)
  639. })
  640. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  641. // 去重
  642. this.removeRepeat()
  643. delete this.form.deliveryItemsList
  644. delete this.form.deliveryFeesList
  645. delete this.form.deliveryFilesList
  646. delete this.form.corpName
  647. delete this.form.companyName
  648. // 获取最大值
  649. let num = []
  650. this.advantageProjectData.forEach(item => {
  651. num.push(item.sort)
  652. })
  653. if (num.length == 0) {
  654. this.maxFeeNum = 0;
  655. } else {
  656. this.maxFeeNum = num.reduce((a, b) => {
  657. return b > a? b: a;
  658. })
  659. }
  660. let goodsNum = []
  661. this.contactsData.forEach(item => {
  662. goodsNum.push(item.sort)
  663. })
  664. if (goodsNum.length == 0) {
  665. this.maxGoodsNum = 0;
  666. } else {
  667. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  668. return b > a? b: a;
  669. })
  670. }
  671. if (isCopy) {
  672. delete this.form.sysNo
  673. delete this.form.id
  674. this.contactsData.forEach(item => {
  675. delete item.id
  676. delete item.pid
  677. })
  678. this.advantageProjectData.forEach(item => {
  679. delete item.id
  680. delete item.pid
  681. })
  682. this.bankOfDepositData.forEach(item => {
  683. delete item.id
  684. delete item.pid
  685. })
  686. this.form.deliveryStatus == '录入'
  687. }
  688. });
  689. },
  690. // 出库数量变化时调用
  691. actualQuantityChange(row) {
  692. if (row.scale) {
  693. row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
  694. this.contactsData.forEach(item => {
  695. this.form.deliveryAmount += Number(item.deliveryAmount)
  696. this.form.totalQuantity += Number(item.actualQuantity)
  697. })
  698. }
  699. },
  700. // 类别变换时触发
  701. warehouseTreeChange(id) {
  702. this.warehouseName = []
  703. if (this.firstComing) {
  704. if (!this.form.storageId) {
  705. this.$set(this.form, 'storageId', null)
  706. } else {
  707. this.form.storageId = null
  708. }
  709. }
  710. let data = {
  711. storageTypeId: id
  712. }
  713. selectWareHouse(data).then(res => {
  714. this.warehouseName = res.data.data.records
  715. })
  716. this.firstComing = true
  717. },
  718. //点击行可编辑
  719. handleRowClick(row, event, column) {
  720. console.log(row.$index)
  721. },
  722. //商品编辑
  723. rowCell(row, index) {
  724. console.log(row)
  725. this.$refs.crudContact.rowCell(row, index)
  726. },
  727. //费用编辑
  728. rowCellTwo(row, index) {
  729. console.log(row)
  730. this.$refs.crudProject.rowCell(row, index)
  731. },
  732. //费用新增触发
  733. costIncrease() {
  734. this.dialogCost = !this.dialogCost
  735. this.choiceData = false
  736. },
  737. //商品新增触发
  738. commoditySelection() {
  739. this.dialogVisible = !this.dialogVisible
  740. this.tableData = []
  741. this.commodityData = false
  742. },
  743. //点击费用明细选择触发
  744. choice(row) {
  745. this.dialogCost = !this.dialogCost
  746. this.choiceData = true
  747. console.log(row)
  748. this.choiceIndex = row.$index
  749. },
  750. //点击商品明细选择触发
  751. commodityChoice(row) {
  752. this.dialogVisible = !this.dialogVisible
  753. this.commodityData = true
  754. console.log(row)
  755. this.choiceIndexT = row.$index
  756. },
  757. //导入商品触发
  758. importChoice() {
  759. if (this.tableData.length === 1) {
  760. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  761. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  762. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  763. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  764. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  765. selectGoodsNum({
  766. goodsId: this.tableData[0].id,
  767. typeno: this.tableData[0].typeno
  768. }).then(res => {
  769. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  770. })
  771. }
  772. this.dialogVisible = !this.dialogVisible
  773. this.commodityData = false
  774. },
  775. //费用编辑导入触发
  776. choiceCost() {
  777. console.log('1111')
  778. if (this.tableDataCost.length === 1) {
  779. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  780. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  781. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  782. }
  783. this.dialogCost = !this.dialogCost
  784. this.choiceData = false
  785. },
  786. //费用导入触发
  787. importCost() {
  788. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  789. if (this.tableDataCost.length > 0) {
  790. for (let item in this.tableDataCost) {
  791. console.log(this.tableDataCost[item])
  792. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  793. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  794. this.tableDataCost[item].sort = this.maxFeeNum + 1
  795. this.maxFeeNum++
  796. delete this.tableDataCost[item].id
  797. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  798. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  799. }
  800. }
  801. this.tableDataCost = []
  802. this.dialogCost = false
  803. },
  804. //确认导入触发
  805. importGoods() {
  806. // this.contactsData = this.contactsData.concat(this.tableData)
  807. if (this.tableData.length > 0) {
  808. for (let item in this.tableData) {
  809. console.log(this.tableData[item])
  810. selectGoodsNum({
  811. goodsId: this.tableData[item].id,
  812. typeno: this.tableData[item].typeno
  813. }).then(res =>{
  814. this.tableData[item].storageQuantity = res.data.data
  815. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specificationAndModel)
  816. this.tableData[item].itemId = this.tableData[item].id
  817. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  818. delete this.tableData[item].goodsTypeName
  819. delete this.tableData[item].id
  820. delete this.tableData[item].status
  821. delete this.tableData[item].isDeleted
  822. this.$set(this.tableData[item], 'inventoryNumber', 0)
  823. this.$set(this.tableData[item], 'actualQuantity', 0)
  824. this.$set(this.tableData[item], 'inventoryAmount', 0)
  825. this.$set(this.tableData[item], 'deliveryAmount', 0)
  826. this.tableData[item].price = 0
  827. this.tableData[item].amount = 0
  828. this.tableData[item].sort = this.maxGoodsNum + 1
  829. this.maxGoodsNum++
  830. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  831. console.log(this.contactsData)
  832. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  833. })
  834. }
  835. }
  836. this.dialogVisible = false
  837. },
  838. closeGoods() {
  839. this.treeDataGoods = [];
  840. this.treeDeptId = "";
  841. },
  842. closeFees() {
  843. this.treeDeptIdCost = "";
  844. this.treeData = [];
  845. },
  846. //选中触发
  847. selectionChange(list) {
  848. console.log(list);
  849. this.tableData = list
  850. },
  851. //费用选中触发
  852. selectionChangeCost(list) {
  853. console.log(list);
  854. this.tableDataCost = list
  855. },
  856. //导入页左商品类型查询
  857. nodeClick(data) {
  858. this.treeDeptId = data.id;
  859. this.page.currentPage = 1;
  860. this.onLoad(this.page);
  861. },
  862. //导入页左费用类型查询
  863. nodeClickCost(data) {
  864. this.treeDeptIdCost = data.id;
  865. this.pageCost.currentPage = 1;
  866. this.onLoadCost(this.pageCost);
  867. },
  868. //刷新触发
  869. refreshChange() {
  870. this.treeDeptId = '';
  871. this.page.currentPage = 1;
  872. this.onLoad(this.page);
  873. },
  874. //费用刷新触发
  875. refreshChangeCost() {
  876. this.treeDeptIdCost = '';
  877. this.pageCost.currentPage = 1;
  878. this.onLoadCost(this.pageCost);
  879. },
  880. //新增商品信息保存触发
  881. rowSave(row, done, loading) {
  882. console.log(row)
  883. console.log(this.contactsData)
  884. // this.contactsData.push(row)
  885. done()
  886. },
  887. //修改商品信息触发
  888. rowUpdate(row, index, done, loading) {
  889. done(row);
  890. },
  891. //删除商品信息触发
  892. rowDel(row, index, donerowDel) {
  893. this.$confirm("确定将选择数据删除?", {
  894. confirmButtonText: "确定",
  895. cancelButtonText: "取消",
  896. type: "warning"
  897. }).then(() => {
  898. //商品判断是否需要调用删除接口
  899. if (row.id) {
  900. corpsattn(row.id).then(res => {
  901. this.$message({
  902. type: "success",
  903. message: "操作成功!"
  904. });
  905. this.contactsData.splice(index, 1);
  906. })
  907. } else {
  908. this.$message({
  909. type: "success",
  910. message: "操作成功!"
  911. });
  912. this.contactsData.splice(index, 1);
  913. }
  914. })
  915. },
  916. //新增费用明细保存触发
  917. rowSaveProject(row, done, loading) {
  918. // this.advantageProjectData.push(row)
  919. done()
  920. },
  921. //修改费用明细触发
  922. rowUpdateProject(row, index, done, loading) {
  923. done(row);
  924. },
  925. //商品列表查询
  926. onLoad(page, params = {}) {
  927. this.loading = true;
  928. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  929. console.log(res)
  930. const data = res.data.data;
  931. this.page.total = data.total;
  932. this.data = data.records;
  933. this.loading = false;
  934. });
  935. },
  936. //费用查询
  937. onLoadCost(page, params = {}) {
  938. this.loadingCost = true;
  939. let queryParams = Object.assign({}, params, {
  940. pageSize: page.pageSize,
  941. pageNum: page.currentPage,
  942. parentId: 0,
  943. feesTypeId: this.treeDeptIdCost
  944. })
  945. customerList(queryParams).then(res => {
  946. console.log(res)
  947. const data = res.data.data;
  948. this.pageCost.total = data.total;
  949. this.dataCost = data.records;
  950. this.loadingCost = false;
  951. });
  952. },
  953. //删除费用明细触发
  954. rowDelProject(row, index, donerowDel) {
  955. this.$confirm("确定将选择数据删除?", {
  956. confirmButtonText: "确定",
  957. cancelButtonText: "取消",
  958. type: "warning"
  959. }).then(() => {
  960. //费用判断是否需要调用删除接口
  961. if (row.id) {
  962. corpsitem(row.id).then(res => {
  963. this.$message({
  964. type: "success",
  965. message: "操作成功!"
  966. });
  967. this.advantageProjectData.splice(index, 1);
  968. })
  969. } else {
  970. this.$message({
  971. type: "success",
  972. message: "操作成功!"
  973. });
  974. this.advantageProjectData.splice(index, 1);
  975. }
  976. })
  977. },
  978. //新增附件上传保存触发
  979. rowSaveBankOfDeposit(row, done, loading) {
  980. this.bankOfDepositData.push(row)
  981. done()
  982. },
  983. //修改附件上传触发
  984. rowUpdateBankOfDeposit(row, index, done, loading) {
  985. done(row);
  986. },
  987. //删除附件上传触发
  988. rowDelBankOfDeposit(row, index, donerowDel) {
  989. this.$confirm("确定将选择数据删除?", {
  990. confirmButtonText: "确定",
  991. cancelButtonText: "取消",
  992. type: "warning"
  993. }).then(() => {
  994. //附件判断是否需要调用删除接口
  995. if (row.id) {
  996. corpsbank(row.id).then(res => {
  997. this.$message({
  998. type: "success",
  999. message: "操作成功!"
  1000. });
  1001. this.bankOfDepositData.splice(index, 1);
  1002. })
  1003. } else {
  1004. this.$message({
  1005. type: "success",
  1006. message: "操作成功!"
  1007. });
  1008. this.bankOfDepositData.splice(index, 1);
  1009. }
  1010. })
  1011. },
  1012. uploadAfter(res, done) {
  1013. if (res.originalName) {
  1014. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1015. ? this.bankOfDepositForm.fileName
  1016. : res.originalName;
  1017. }
  1018. done();
  1019. },
  1020. // 去重
  1021. removeRepeat() {
  1022. let obj = []
  1023. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1024. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1025. return current
  1026. }, [])
  1027. },
  1028. //
  1029. receiveList(data){
  1030. this.configuration.dicData = this.configuration.dicData.concat(data)
  1031. this.removeRepeat()
  1032. },
  1033. //修改提交触发
  1034. editCustomer(isBack = false) {
  1035. console.log(this.form)
  1036. this.$refs["form"].validate((valid) => {
  1037. if (valid) {
  1038. //商品信息
  1039. this.form.deliveryItemsList = this.contactsData
  1040. this.form.deliveryFeesList = this.advantageProjectData
  1041. this.form.deliveryFilesList = this.bankOfDepositData
  1042. if (typeof this.form.corpsTypeId == 'object') {
  1043. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1044. }
  1045. this.disabled = true
  1046. this.form.billType = 'FH'
  1047. typeSave(this.form).then(res => {
  1048. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1049. this.disabled = false
  1050. if (isBack) {
  1051. //成功关闭此页面回到列表页
  1052. this.$emit("goBack");
  1053. } else {
  1054. this.queryData(res.data.data.id)
  1055. }
  1056. })
  1057. } else {
  1058. return false;
  1059. }
  1060. });
  1061. },
  1062. //复制新单
  1063. copyOrder() {
  1064. this.queryData(this.form.id, true)
  1065. },
  1066. //返回列表
  1067. backToList() {
  1068. this.$confirm("是否保存当前页面?", "提示", {
  1069. confirmButtonText: "保存",
  1070. cancelButtonText: "取消",
  1071. type: "warning",
  1072. }).then(() => {
  1073. this.editCustomer(true)
  1074. }).catch(() => {
  1075. this.$emit("goBack");
  1076. })
  1077. },
  1078. // 确认发货
  1079. sendOutGoods() {
  1080. this.$refs["form"].validate((valid) => {
  1081. if (valid) {
  1082. if (this.contactsData.length == 0) {
  1083. return this.$message.error('商品信息为空')
  1084. }
  1085. for (let item in this.contactsData) {
  1086. if (!this.contactsData[item].id) {
  1087. return this.$message.error('有商品未保存,请先保存')
  1088. }
  1089. }
  1090. //商品信息
  1091. this.form.deliveryItemsList = this.contactsData
  1092. this.form.deliveryFeesList = this.advantageProjectData
  1093. this.form.deliveryFilesList = this.bankOfDepositData
  1094. if (typeof this.form.corpsTypeId == 'object') {
  1095. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1096. }
  1097. sendOutGoods(this.form).then(res => {
  1098. console.log(res)
  1099. this.$message.success('发货成功')
  1100. this.queryData(res.data.data.id)
  1101. })
  1102. } else {
  1103. return false;
  1104. }
  1105. });
  1106. },
  1107. // 撤销发货
  1108. revokeOutGoods() {
  1109. this.$refs["form"].validate((valid) => {
  1110. if (valid) {
  1111. //商品信息
  1112. this.form.deliveryItemsList = this.contactsData
  1113. this.form.deliveryFeesList = this.advantageProjectData
  1114. this.form.deliveryFilesList = this.bankOfDepositData
  1115. if (typeof this.form.corpsTypeId == 'object') {
  1116. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1117. }
  1118. revokeOutGoods(this.form).then(res => {
  1119. console.log(res)
  1120. this.$message.success('撤销成功')
  1121. this.queryData(res.data.data.id)
  1122. })
  1123. } else {
  1124. return false;
  1125. }
  1126. });
  1127. },
  1128. // 保存列设置
  1129. async saveColumn(name) {
  1130. /**
  1131. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1132. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1133. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1134. */
  1135. if (name == 'goods') {
  1136. const inSave = await this.saveColumnData(
  1137. this.getColumnName(21),
  1138. this.customerContact
  1139. );
  1140. if (inSave) {
  1141. this.$message.success("保存成功");
  1142. //关闭窗口
  1143. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1144. }
  1145. } else if (name === 'fees') {
  1146. const inSave = await this.saveColumnData(
  1147. this.getColumnName(22),
  1148. this.advantageProject
  1149. );
  1150. if (inSave) {
  1151. this.$message.success("保存成功");
  1152. //关闭窗口
  1153. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1154. }
  1155. }
  1156. },
  1157. }
  1158. }
  1159. </script>
  1160. <style lang="scss" scoped>
  1161. .customer-head {
  1162. position: fixed;
  1163. top: 105px;
  1164. width: 100%;
  1165. margin-left: -10px;
  1166. height: 62px;
  1167. background: #ffffff;
  1168. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1169. z-index: 999;
  1170. /* display: flex;
  1171. justify-content: left; */
  1172. }
  1173. .customer-back {
  1174. cursor: pointer;
  1175. line-height: 62px;
  1176. font-size: 16px;
  1177. color: #323233;
  1178. font-weight: 400;
  1179. }
  1180. .back-icon {
  1181. line-height: 64px;
  1182. font-size: 20px;
  1183. margin-right: 8px;
  1184. }
  1185. .add-customer-btn {
  1186. position: fixed;
  1187. right: 36px;
  1188. top: 115px;
  1189. }
  1190. ::v-deep .el-form-item {
  1191. margin-bottom: 0;
  1192. }
  1193. .el-dialogDeep {
  1194. ::v-deep .el-dialog {
  1195. margin: 1vh auto 0 !important;
  1196. padding-bottom: 10px !important;
  1197. .el-dialog__body, .el-dialog__footer {
  1198. padding-bottom: 0 !important;
  1199. padding-top: 0 !important;
  1200. }
  1201. }
  1202. }
  1203. .print-div {
  1204. color: #000;
  1205. }
  1206. .print_table {
  1207. table {
  1208. border-right: 1px solid #000;
  1209. border-bottom: 1px solid #000;
  1210. font-size: 12px;
  1211. margin-bottom: 5px;
  1212. }
  1213. table td {
  1214. border-left: 1px solid #000;
  1215. border-top: 1px solid #000;
  1216. vertical-align: middle;
  1217. padding: 2px;
  1218. text-align: center;
  1219. }
  1220. }
  1221. .table {
  1222. border-collapse: collapse;
  1223. border-spacing: 0;
  1224. background-color: transparent;
  1225. display: table;
  1226. width: 99%;
  1227. max-width: 100%;
  1228. margin: 0 auto;
  1229. }
  1230. .table td {
  1231. text-align: left;
  1232. vertical-align: middle;
  1233. font-size: 14px;
  1234. color: #000000;
  1235. padding: 10.5px 0 10.5px 30px;
  1236. //border: 1px solid #000;
  1237. }
  1238. </style>