detailsPageEdit.vue 38 KB

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