detailsPageEdit.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  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. import { contrastObj, contrastList } from "@/util/contrastData";
  278. export default {
  279. name: "detailsPage",
  280. props: {
  281. detailData: {
  282. type: Object
  283. }
  284. },
  285. data() {
  286. return {
  287. configuration: {
  288. multipleChoices: false,
  289. multiple: false,
  290. collapseTags: false,
  291. placeholder: '请点击右边按钮选择',
  292. dicData: []
  293. },
  294. form: {},
  295. data: [],
  296. loadingCost: false,
  297. choiceData: false,
  298. commodityData: false,
  299. dataCost: [],
  300. treeDataGoods: [],
  301. treeData: [],
  302. choiceIndex: '',
  303. dialogCost: false,
  304. treeDeptId: '',
  305. treeDeptIdCost: '',
  306. pageCost: {
  307. pageSize: 10,
  308. currentPage: 1,
  309. total: 0
  310. },
  311. page: {
  312. pageSize: 10,
  313. currentPage: 1,
  314. total: 0
  315. },
  316. loading: false,
  317. contactsForm: {},
  318. optionTwo: commodity,
  319. optionTwoCost: optionTwoCost,
  320. treeOptionCost: {
  321. nodeKey: 'id',
  322. lazy: true,
  323. treeLoad: function (node, resolve) {
  324. const parentId = (node.level === 0) ? 0 : node.data.id;
  325. getDeptLazyTree(parentId).then(res => {
  326. resolve(res.data.data.map(item => {
  327. return {
  328. ...item,
  329. leaf: !item.hasChildren
  330. }
  331. }))
  332. });
  333. },
  334. addBtn: false,
  335. menu: false,
  336. size: 'small',
  337. props: {
  338. labelText: '标题',
  339. label: 'title',
  340. value: 'value',
  341. children: 'children'
  342. }
  343. },
  344. treeOption: {
  345. nodeKey: 'id',
  346. lazy: true,
  347. treeLoad: function (node, resolve) {
  348. const parentId = (node.level === 0) ? 0 : node.data.id;
  349. getDeptLazyTreeTwo(parentId).then(res => {
  350. resolve(res.data.data.map(item => {
  351. return {
  352. ...item,
  353. leaf: !item.hasChildren
  354. }
  355. }))
  356. });
  357. },
  358. addBtn: false,
  359. menu: false,
  360. size: 'small',
  361. props: {
  362. labelText: '标题',
  363. label: 'title',
  364. value: 'value',
  365. children: 'children'
  366. }
  367. },
  368. dialogVisible: false,
  369. advantageProjectForm: {},
  370. bankOfDepositForm: {},
  371. contactsData: [],
  372. advantageProjectData: [],
  373. disabled: false,
  374. bankOfDepositData: [],
  375. tableDataCost: [],
  376. dic: [],
  377. tableData: [],
  378. customerContact: {},
  379. advantageProject: {},
  380. bankOfDeposit: bankOfDeposit,
  381. basicData: {
  382. column: [
  383. {
  384. label: '系统编号',//发货通知(点击)
  385. prop: 'sysNo',
  386. disabled: true,
  387. rules: [
  388. {
  389. required: false,
  390. message: ' ',
  391. trigger: 'blur'
  392. }
  393. ]
  394. }, {
  395. label: '客户名称',
  396. prop: 'corpId',
  397. rules: [
  398. {
  399. required: true,
  400. message: ' ',
  401. trigger: 'blur'
  402. }
  403. ]
  404. }, {
  405. label: '单据状态',
  406. prop: 'deliveryStatus',
  407. disabled: true,
  408. rules: [
  409. {
  410. required: true,
  411. message: ' ',
  412. trigger: 'blur'
  413. }
  414. ]
  415. }, {
  416. label: '所属公司',
  417. prop: 'salesCompany', //salesCompany
  418. rules: [
  419. {
  420. required: true,
  421. message: ' ',
  422. trigger: 'blur'
  423. }
  424. ]
  425. }, {
  426. label: '仓库类型',
  427. prop: 'warehouseType',//字典表
  428. rules: [
  429. {
  430. required: true,
  431. message: ' ',
  432. trigger: 'blur'
  433. }
  434. ]
  435. }, {
  436. label: '仓库名称',
  437. prop: 'storageId',
  438. rules: [
  439. {
  440. required: true,
  441. message: ' ',
  442. trigger: 'blur'
  443. }
  444. ]
  445. },{
  446. label: '匹配订单号',
  447. prop: 'srcOrderNo',
  448. rules: [
  449. {
  450. required: true,
  451. message: ' ',
  452. trigger: 'blur'
  453. }
  454. ]
  455. }, {
  456. label: '出库金额',
  457. prop: 'deliveryAmount',
  458. disabled: true,
  459. rules: [
  460. {
  461. required: true,
  462. message: ' ',
  463. trigger: 'blur'
  464. }
  465. ]
  466. }, {
  467. label: '出库数量',
  468. prop: 'totalQuantity',
  469. disabled: true,
  470. rules: [
  471. {
  472. required: true,
  473. message: ' ',
  474. trigger: 'blur'
  475. }
  476. ]
  477. }, {
  478. label: '出库日期',
  479. prop: 'businessDate',
  480. type: 'datetime',
  481. rules: [
  482. {
  483. required: true,
  484. message: ' ',
  485. trigger: 'blur'
  486. }
  487. ]
  488. }, {
  489. label: '制单时间',
  490. type: 'datetime',
  491. prop: 'createTime',
  492. disabled: true,
  493. rules: [
  494. {
  495. required: false,
  496. message: ' ',
  497. trigger: 'blur'
  498. }
  499. ]
  500. }, {
  501. label: '费用合计',
  502. prop: 'totalCost',
  503. rules: [
  504. {
  505. required: true,
  506. message: ' ',
  507. trigger: 'blur'
  508. }
  509. ]
  510. }, {
  511. label: "备注",
  512. span: 24,
  513. type: 'textarea',
  514. prop: "otherRemarks",
  515. mock: {
  516. type: 'county'
  517. }
  518. }
  519. ]
  520. },
  521. statusOption: [],
  522. // 仓库类型
  523. warehouseType: [],
  524. // 仓库名称
  525. warehouseName: [],
  526. maxFeeNum: 0,
  527. maxGoodsNum: 0,
  528. oldForm: {
  529. orderStatus: "录入"
  530. },
  531. oldGoodsList: [],
  532. oldFeesList: [],
  533. oldUploadList: [],
  534. }
  535. },
  536. //初始化查询
  537. async created() {
  538. this.customerContact = await this.getColumnData(this.getColumnName(21), customerContact);
  539. this.advantageProject = await this.getColumnData(this.getColumnName(22), advantageProject);
  540. this.getWorkDicts("order_status").then(res => {
  541. this.statusOption = res.data.data
  542. })
  543. this.$set(this.form,'deliveryStatus','录入')
  544. wareHouseType().then(res => {
  545. this.warehouseType = res.data.data.records
  546. this.warehouseType.forEach(item => {
  547. this.$set(item, 'label', item.cname)
  548. this.$set(item, 'value', item.id)
  549. if (item.hasChildren) {
  550. this.$set(item, 'children', [])
  551. }
  552. })
  553. let result = [], temp = {}
  554. for(let i = 0; i < this.warehouseType.length;i++) {
  555. temp[this.warehouseType[i].id] = this.warehouseType[i]
  556. }
  557. for (let j = 0;j < this.warehouseType.length;j++) {
  558. let current = this.warehouseType[j]
  559. let tempCurrentParent = temp[current.parentId]
  560. if (tempCurrentParent) {
  561. if (!tempCurrentParent["children"]) {
  562. tempCurrentParent["children"] = []
  563. }
  564. tempCurrentParent["children"].push(current)
  565. } else {
  566. result.push(current)
  567. }
  568. }
  569. this.warehouseType = result
  570. });
  571. selectWareHouse().then(res => {
  572. console.log(res)
  573. this.warehouseName = res.data.data.records
  574. })
  575. if (this.detailData.id) {
  576. let id = this.detailData.id
  577. this.queryData(id)
  578. }else if (this.detailData.form){
  579. this.form = JSON.parse(this.detailData.form);
  580. delete this.form.createTime
  581. delete this.form.id
  582. delete this.form.sysNo
  583. this.contactsData = this.form.orderItemsList
  584. delete this.form.orderItemsList
  585. this.configuration.dicData = this.form.corpName
  586. delete this.form.corpName
  587. this.$set(this.form, 'deliveryStatus', '录入')
  588. if (this.form.belongToCorpList) {
  589. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  590. delete this.form.belongToCorpId
  591. this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
  592. }
  593. delete this.form.belongToCorpList
  594. this.$set(this.form, 'deliveryAmount', 0)
  595. this.$set(this.form, 'totalQuantity', 0)
  596. this.$set(this.form, 'totalCost', 0)
  597. this.contactsData.forEach(item => {
  598. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  599. this.$set(item, "srcId", item.id)
  600. this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
  601. this.$set(item, "deliveryAmount", item.amount)
  602. this.$set(item, "inventoryNumber", item.storageQuantity)
  603. this.$set(item, "inventoryAmount", 0)
  604. this.form.deliveryAmount += Number(item.deliveryAmount)
  605. this.form.totalQuantity += Number(item.actualQuantity)
  606. this.form.totalCost += Number(item.deliveryAmount)
  607. // 出库数量和出库金额的比例
  608. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  609. delete item.id
  610. delete item.pid
  611. })
  612. } else if (this.detailData.copyId) {
  613. let id = this.detailData.copyId
  614. this.queryData(id, true)
  615. }
  616. },
  617. watch: {
  618. },
  619. methods: {
  620. queryData(id, isCopy = false) {
  621. detail(id).then(res => {
  622. console.log(res.data.data)
  623. this.form = res.data.data;
  624. this.contactsData = this.form.deliveryItemsList
  625. this.advantageProjectData = this.form.deliveryFeesList
  626. this.bankOfDepositData = this.form.deliveryFilesList
  627. this.configuration.dicData = this.form.corpName
  628. this.form.deliveryAmount = 0
  629. this.form.totalQuantity = 0
  630. this.contactsData.forEach(item => {
  631. this.form.deliveryAmount += Number(item.deliveryAmount)
  632. this.form.totalQuantity += Number(item.actualQuantity)
  633. // 出库金额和出库数量的比例
  634. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  635. })
  636. console.log(this.contactsData)
  637. if (this.form.companyName) {
  638. this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
  639. }
  640. let feesData = []
  641. this.form.deliveryFeesList.forEach(item => {
  642. let a = {
  643. cname: item.corpName,
  644. id: item.corpId
  645. }
  646. feesData.push(a)
  647. })
  648. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  649. // 去重
  650. this.removeRepeat()
  651. delete this.form.deliveryItemsList
  652. delete this.form.deliveryFeesList
  653. delete this.form.deliveryFilesList
  654. delete this.form.corpName
  655. delete this.form.companyName
  656. // 获取最大值
  657. let num = []
  658. this.advantageProjectData.forEach(item => {
  659. num.push(item.sort)
  660. })
  661. if (num.length == 0) {
  662. this.maxFeeNum = 0;
  663. } else {
  664. this.maxFeeNum = num.reduce((a, b) => {
  665. return b > a? b: a;
  666. })
  667. }
  668. let goodsNum = []
  669. this.contactsData.forEach(item => {
  670. goodsNum.push(item.sort)
  671. })
  672. if (goodsNum.length == 0) {
  673. this.maxGoodsNum = 0;
  674. } else {
  675. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  676. return b > a? b: a;
  677. })
  678. }
  679. this.oldGoodsList = []
  680. this.oldFeesList = []
  681. this.oldUploadList = []
  682. this.oldForm = Object.assign({}, this.form)
  683. this.oldGoodsList = this.oldGoodsList.concat(this.contactsData)
  684. this.oldFeesList = this.oldFeesList.concat(this.advantageProjectData)
  685. this.oldUploadList = this.oldUploadList.concat(this.bankOfDepositData)
  686. if (isCopy) {
  687. delete this.form.sysNo
  688. delete this.form.id
  689. this.contactsData.forEach(item => {
  690. delete item.id
  691. delete item.pid
  692. })
  693. this.advantageProjectData.forEach(item => {
  694. delete item.id
  695. delete item.pid
  696. })
  697. this.bankOfDepositData.forEach(item => {
  698. delete item.id
  699. delete item.pid
  700. })
  701. this.form.deliveryStatus == '录入'
  702. }
  703. });
  704. },
  705. // 出库数量变化时调用
  706. actualQuantityChange(row) {
  707. if (row.scale) {
  708. row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
  709. this.contactsData.forEach(item => {
  710. this.form.deliveryAmount += Number(item.deliveryAmount)
  711. this.form.totalQuantity += Number(item.actualQuantity)
  712. })
  713. }
  714. },
  715. // 类别变换时触发
  716. warehouseTreeChange(id) {
  717. this.warehouseName = []
  718. if (this.firstComing) {
  719. if (!this.form.storageId) {
  720. this.$set(this.form, 'storageId', null)
  721. } else {
  722. this.form.storageId = null
  723. }
  724. }
  725. let data = {
  726. storageTypeId: id
  727. }
  728. selectWareHouse(data).then(res => {
  729. this.warehouseName = res.data.data.records
  730. })
  731. this.firstComing = true
  732. },
  733. //点击行可编辑
  734. handleRowClick(row, event, column) {
  735. console.log(row.$index)
  736. },
  737. //商品编辑
  738. rowCell(row, index) {
  739. console.log(row)
  740. this.$refs.crudContact.rowCell(row, index)
  741. },
  742. //费用编辑
  743. rowCellTwo(row, index) {
  744. console.log(row)
  745. this.$refs.crudProject.rowCell(row, index)
  746. },
  747. //费用新增触发
  748. costIncrease() {
  749. this.dialogCost = !this.dialogCost
  750. this.choiceData = false
  751. },
  752. //商品新增触发
  753. commoditySelection() {
  754. this.dialogVisible = !this.dialogVisible
  755. this.tableData = []
  756. this.commodityData = false
  757. },
  758. //点击费用明细选择触发
  759. choice(row) {
  760. this.dialogCost = !this.dialogCost
  761. this.choiceData = true
  762. console.log(row)
  763. this.choiceIndex = row.$index
  764. },
  765. //点击商品明细选择触发
  766. commodityChoice(row) {
  767. this.dialogVisible = !this.dialogVisible
  768. this.commodityData = true
  769. console.log(row)
  770. this.choiceIndexT = row.$index
  771. },
  772. //导入商品触发
  773. importChoice() {
  774. if (this.tableData.length === 1) {
  775. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  776. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  777. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  778. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  779. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  780. selectGoodsNum({
  781. goodsId: this.tableData[0].id,
  782. typeno: this.tableData[0].typeno
  783. }).then(res => {
  784. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  785. })
  786. }
  787. this.dialogVisible = !this.dialogVisible
  788. this.commodityData = false
  789. },
  790. //费用编辑导入触发
  791. choiceCost() {
  792. console.log('1111')
  793. if (this.tableDataCost.length === 1) {
  794. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  795. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  796. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  797. }
  798. this.dialogCost = !this.dialogCost
  799. this.choiceData = false
  800. },
  801. //费用导入触发
  802. importCost() {
  803. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  804. if (this.tableDataCost.length > 0) {
  805. for (let item in this.tableDataCost) {
  806. console.log(this.tableDataCost[item])
  807. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  808. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  809. this.tableDataCost[item].sort = this.maxFeeNum + 1
  810. this.maxFeeNum++
  811. delete this.tableDataCost[item].id
  812. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  813. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  814. }
  815. }
  816. this.tableDataCost = []
  817. this.dialogCost = false
  818. },
  819. //确认导入触发
  820. importGoods() {
  821. // this.contactsData = this.contactsData.concat(this.tableData)
  822. if (this.tableData.length > 0) {
  823. for (let item in this.tableData) {
  824. console.log(this.tableData[item])
  825. selectGoodsNum({
  826. goodsId: this.tableData[item].id,
  827. typeno: this.tableData[item].typeno
  828. }).then(res =>{
  829. this.tableData[item].storageQuantity = res.data.data
  830. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specificationAndModel)
  831. this.tableData[item].itemId = this.tableData[item].id
  832. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  833. delete this.tableData[item].goodsTypeName
  834. delete this.tableData[item].id
  835. delete this.tableData[item].status
  836. delete this.tableData[item].isDeleted
  837. this.$set(this.tableData[item], 'inventoryNumber', 0)
  838. this.$set(this.tableData[item], 'actualQuantity', 0)
  839. this.$set(this.tableData[item], 'inventoryAmount', 0)
  840. this.$set(this.tableData[item], 'deliveryAmount', 0)
  841. this.tableData[item].price = 0
  842. this.tableData[item].amount = 0
  843. this.tableData[item].sort = this.maxGoodsNum + 1
  844. this.maxGoodsNum++
  845. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  846. console.log(this.contactsData)
  847. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  848. })
  849. }
  850. }
  851. this.dialogVisible = false
  852. },
  853. closeGoods() {
  854. this.treeDataGoods = [];
  855. this.treeDeptId = "";
  856. },
  857. closeFees() {
  858. this.treeDeptIdCost = "";
  859. this.treeData = [];
  860. },
  861. //选中触发
  862. selectionChange(list) {
  863. console.log(list);
  864. this.tableData = list
  865. },
  866. //费用选中触发
  867. selectionChangeCost(list) {
  868. console.log(list);
  869. this.tableDataCost = list
  870. },
  871. //导入页左商品类型查询
  872. nodeClick(data) {
  873. this.treeDeptId = data.id;
  874. this.page.currentPage = 1;
  875. this.onLoad(this.page);
  876. },
  877. //导入页左费用类型查询
  878. nodeClickCost(data) {
  879. this.treeDeptIdCost = data.id;
  880. this.pageCost.currentPage = 1;
  881. this.onLoadCost(this.pageCost);
  882. },
  883. //刷新触发
  884. refreshChange() {
  885. this.treeDeptId = '';
  886. this.page.currentPage = 1;
  887. this.onLoad(this.page);
  888. },
  889. //费用刷新触发
  890. refreshChangeCost() {
  891. this.treeDeptIdCost = '';
  892. this.pageCost.currentPage = 1;
  893. this.onLoadCost(this.pageCost);
  894. },
  895. //新增商品信息保存触发
  896. rowSave(row, done, loading) {
  897. console.log(row)
  898. console.log(this.contactsData)
  899. // this.contactsData.push(row)
  900. done()
  901. },
  902. //修改商品信息触发
  903. rowUpdate(row, index, done, loading) {
  904. done(row);
  905. },
  906. //删除商品信息触发
  907. rowDel(row, index, donerowDel) {
  908. this.$confirm("确定将选择数据删除?", {
  909. confirmButtonText: "确定",
  910. cancelButtonText: "取消",
  911. type: "warning"
  912. }).then(() => {
  913. //商品判断是否需要调用删除接口
  914. if (row.id) {
  915. corpsattn(row.id).then(res => {
  916. this.$message({
  917. type: "success",
  918. message: "操作成功!"
  919. });
  920. this.contactsData.splice(index, 1);
  921. })
  922. } else {
  923. this.$message({
  924. type: "success",
  925. message: "操作成功!"
  926. });
  927. this.contactsData.splice(index, 1);
  928. }
  929. })
  930. },
  931. //新增费用明细保存触发
  932. rowSaveProject(row, done, loading) {
  933. // this.advantageProjectData.push(row)
  934. done()
  935. },
  936. //修改费用明细触发
  937. rowUpdateProject(row, index, done, loading) {
  938. done(row);
  939. },
  940. //商品列表查询
  941. onLoad(page, params = {}) {
  942. this.loading = true;
  943. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  944. console.log(res)
  945. const data = res.data.data;
  946. this.page.total = data.total;
  947. this.data = data.records;
  948. this.loading = false;
  949. });
  950. },
  951. //费用查询
  952. onLoadCost(page, params = {}) {
  953. this.loadingCost = true;
  954. let queryParams = Object.assign({}, params, {
  955. pageSize: page.pageSize,
  956. pageNum: page.currentPage,
  957. parentId: 0,
  958. feesTypeId: this.treeDeptIdCost
  959. })
  960. customerList(queryParams).then(res => {
  961. console.log(res)
  962. const data = res.data.data;
  963. this.pageCost.total = data.total;
  964. this.dataCost = data.records;
  965. this.loadingCost = false;
  966. });
  967. },
  968. //删除费用明细触发
  969. rowDelProject(row, index, donerowDel) {
  970. this.$confirm("确定将选择数据删除?", {
  971. confirmButtonText: "确定",
  972. cancelButtonText: "取消",
  973. type: "warning"
  974. }).then(() => {
  975. //费用判断是否需要调用删除接口
  976. if (row.id) {
  977. corpsitem(row.id).then(res => {
  978. this.$message({
  979. type: "success",
  980. message: "操作成功!"
  981. });
  982. this.advantageProjectData.splice(index, 1);
  983. })
  984. } else {
  985. this.$message({
  986. type: "success",
  987. message: "操作成功!"
  988. });
  989. this.advantageProjectData.splice(index, 1);
  990. }
  991. })
  992. },
  993. //新增附件上传保存触发
  994. rowSaveBankOfDeposit(row, done, loading) {
  995. this.bankOfDepositData.push(row)
  996. done()
  997. },
  998. //修改附件上传触发
  999. rowUpdateBankOfDeposit(row, index, done, loading) {
  1000. done(row);
  1001. },
  1002. //删除附件上传触发
  1003. rowDelBankOfDeposit(row, index, donerowDel) {
  1004. this.$confirm("确定将选择数据删除?", {
  1005. confirmButtonText: "确定",
  1006. cancelButtonText: "取消",
  1007. type: "warning"
  1008. }).then(() => {
  1009. //附件判断是否需要调用删除接口
  1010. if (row.id) {
  1011. corpsbank(row.id).then(res => {
  1012. this.$message({
  1013. type: "success",
  1014. message: "操作成功!"
  1015. });
  1016. this.bankOfDepositData.splice(index, 1);
  1017. })
  1018. } else {
  1019. this.$message({
  1020. type: "success",
  1021. message: "操作成功!"
  1022. });
  1023. this.bankOfDepositData.splice(index, 1);
  1024. }
  1025. })
  1026. },
  1027. uploadAfter(res, done) {
  1028. if (res.originalName) {
  1029. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1030. ? this.bankOfDepositForm.fileName
  1031. : res.originalName;
  1032. }
  1033. done();
  1034. },
  1035. // 去重
  1036. removeRepeat() {
  1037. let obj = []
  1038. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1039. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1040. return current
  1041. }, [])
  1042. },
  1043. //
  1044. receiveList(data){
  1045. this.configuration.dicData = this.configuration.dicData.concat(data)
  1046. this.removeRepeat()
  1047. },
  1048. //修改提交触发
  1049. editCustomer(isBack = false) {
  1050. console.log(this.form)
  1051. this.$refs["form"].validate((valid) => {
  1052. if (valid) {
  1053. //商品信息
  1054. this.form.deliveryItemsList = this.contactsData
  1055. this.form.deliveryFeesList = this.advantageProjectData
  1056. this.form.deliveryFilesList = this.bankOfDepositData
  1057. if (typeof this.form.corpsTypeId == 'object') {
  1058. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1059. }
  1060. this.disabled = true
  1061. this.form.billType = 'FH'
  1062. typeSave(this.form).then(res => {
  1063. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1064. this.disabled = false
  1065. if (isBack) {
  1066. //成功关闭此页面回到列表页
  1067. this.$emit("goBack");
  1068. } else {
  1069. this.queryData(res.data.data.id)
  1070. }
  1071. })
  1072. } else {
  1073. return false;
  1074. }
  1075. });
  1076. },
  1077. //复制新单
  1078. copyOrder() {
  1079. this.queryData(this.form.id, true)
  1080. },
  1081. //返回列表
  1082. backToList() {
  1083. if (contrastObj(this.form, this.oldForm) ||
  1084. contrastList(this.contactsData, this.oldGoodsList) ||
  1085. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1086. contrastList(this.bankOfDepositData, this.oldUploadList)
  1087. ) {
  1088. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1089. confirmButtonText: "确定",
  1090. cancelButtonText: "取消",
  1091. type: "warning"
  1092. }).then(() => {
  1093. this.editCustomer(true)
  1094. }).catch(() => {
  1095. this.$emit("goBack");
  1096. })
  1097. } else {
  1098. this.$emit("goBack");
  1099. }
  1100. },
  1101. // 确认发货
  1102. sendOutGoods() {
  1103. this.$refs["form"].validate((valid) => {
  1104. if (valid) {
  1105. if (this.contactsData.length == 0) {
  1106. return this.$message.error('商品信息为空')
  1107. }
  1108. for (let item in this.contactsData) {
  1109. if (!this.contactsData[item].id) {
  1110. return this.$message.error('有商品未保存,请先保存')
  1111. }
  1112. }
  1113. //商品信息
  1114. this.form.deliveryItemsList = this.contactsData
  1115. this.form.deliveryFeesList = this.advantageProjectData
  1116. this.form.deliveryFilesList = this.bankOfDepositData
  1117. if (typeof this.form.corpsTypeId == 'object') {
  1118. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1119. }
  1120. sendOutGoods(this.form).then(res => {
  1121. console.log(res)
  1122. this.$message.success('发货成功')
  1123. this.queryData(res.data.data.id)
  1124. })
  1125. } else {
  1126. return false;
  1127. }
  1128. });
  1129. },
  1130. // 撤销发货
  1131. revokeOutGoods() {
  1132. this.$refs["form"].validate((valid) => {
  1133. if (valid) {
  1134. //商品信息
  1135. this.form.deliveryItemsList = this.contactsData
  1136. this.form.deliveryFeesList = this.advantageProjectData
  1137. this.form.deliveryFilesList = this.bankOfDepositData
  1138. if (typeof this.form.corpsTypeId == 'object') {
  1139. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1140. }
  1141. revokeOutGoods(this.form).then(res => {
  1142. console.log(res)
  1143. this.$message.success('撤销成功')
  1144. this.queryData(res.data.data.id)
  1145. })
  1146. } else {
  1147. return false;
  1148. }
  1149. });
  1150. },
  1151. // 保存列设置
  1152. async saveColumn(name) {
  1153. /**
  1154. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1155. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1156. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1157. */
  1158. if (name == 'goods') {
  1159. const inSave = await this.saveColumnData(
  1160. this.getColumnName(21),
  1161. this.customerContact
  1162. );
  1163. if (inSave) {
  1164. this.$message.success("保存成功");
  1165. //关闭窗口
  1166. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1167. }
  1168. } else if (name === 'fees') {
  1169. const inSave = await this.saveColumnData(
  1170. this.getColumnName(22),
  1171. this.advantageProject
  1172. );
  1173. if (inSave) {
  1174. this.$message.success("保存成功");
  1175. //关闭窗口
  1176. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1177. }
  1178. }
  1179. },
  1180. }
  1181. }
  1182. </script>
  1183. <style lang="scss" scoped>
  1184. .customer-head {
  1185. position: fixed;
  1186. top: 105px;
  1187. width: 100%;
  1188. margin-left: -10px;
  1189. height: 62px;
  1190. background: #ffffff;
  1191. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1192. z-index: 999;
  1193. /* display: flex;
  1194. justify-content: left; */
  1195. }
  1196. .customer-back {
  1197. cursor: pointer;
  1198. line-height: 62px;
  1199. font-size: 16px;
  1200. color: #323233;
  1201. font-weight: 400;
  1202. }
  1203. .back-icon {
  1204. line-height: 64px;
  1205. font-size: 20px;
  1206. margin-right: 8px;
  1207. }
  1208. .add-customer-btn {
  1209. position: fixed;
  1210. right: 36px;
  1211. top: 115px;
  1212. }
  1213. ::v-deep .el-form-item {
  1214. margin-bottom: 0;
  1215. }
  1216. .el-dialogDeep {
  1217. ::v-deep .el-dialog {
  1218. margin: 1vh auto 0 !important;
  1219. padding-bottom: 10px !important;
  1220. .el-dialog__body, .el-dialog__footer {
  1221. padding-bottom: 0 !important;
  1222. padding-top: 0 !important;
  1223. }
  1224. }
  1225. }
  1226. .print-div {
  1227. color: #000;
  1228. }
  1229. .print_table {
  1230. table {
  1231. border-right: 1px solid #000;
  1232. border-bottom: 1px solid #000;
  1233. font-size: 12px;
  1234. margin-bottom: 5px;
  1235. }
  1236. table td {
  1237. border-left: 1px solid #000;
  1238. border-top: 1px solid #000;
  1239. vertical-align: middle;
  1240. padding: 2px;
  1241. text-align: center;
  1242. }
  1243. }
  1244. .table {
  1245. border-collapse: collapse;
  1246. border-spacing: 0;
  1247. background-color: transparent;
  1248. display: table;
  1249. width: 99%;
  1250. max-width: 100%;
  1251. margin: 0 auto;
  1252. }
  1253. .table td {
  1254. text-align: left;
  1255. vertical-align: middle;
  1256. font-size: 14px;
  1257. color: #000000;
  1258. padding: 10.5px 0 10.5px 30px;
  1259. //border: 1px solid #000;
  1260. }
  1261. </style>