detailsPageEdit.vue 41 KB

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