detailsPageEdit.vue 35 KB

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