detailsPage.vue 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button
  6. type="danger"
  7. style="border: none;background: none;color: red"
  8. icon="el-icon-arrow-left"
  9. @click="backToList"
  10. >返回列表
  11. </el-button>
  12. </div>
  13. <div class="add-customer-btn" v-if="showBut">
  14. <el-button type="info" @click="saveSell" size="small"
  15. >生成采购单</el-button
  16. >
  17. <el-button type="success" disabled size="small">
  18. 复制新单
  19. </el-button>
  20. <el-button
  21. type="primary"
  22. :disabled="disabled"
  23. @click="editCustomer"
  24. :loading="subLoading"
  25. v-if="detailData.status != 1"
  26. size="small"
  27. >{{ form.id ? "确认修改" : "确认新增" }}
  28. </el-button>
  29. </div>
  30. </div>
  31. <div class="customer-main">
  32. <containerTitle title="基础信息"></containerTitle>
  33. <basic-container>
  34. <avue-form
  35. ref="form"
  36. class="trading-form"
  37. v-model="form"
  38. :option="option"
  39. >
  40. <template slot="portOfLoad">
  41. <port-info
  42. v-model="form.portOfLoad"
  43. :disabled="detailData.status == 1"
  44. />
  45. </template>
  46. <template slot="portOfDestination">
  47. <port-info
  48. v-model="form.portOfDestination"
  49. :disabled="detailData.status == 1"
  50. />
  51. </template>
  52. <template slot="corpId">
  53. <crop-select
  54. v-model="form.corpId"
  55. @getCorpData="getCorpData"
  56. corpType="KH"
  57. :disabled="detailData.status == 1"
  58. ></crop-select>
  59. </template>
  60. <template slot="belongToCorpId">
  61. <crop-select
  62. v-model="form.belongToCorpId"
  63. corpType="GS"
  64. :disabled="detailData.status == 1"
  65. ></crop-select>
  66. </template>
  67. <template slot="priceTerms">
  68. <el-select
  69. size="small"
  70. v-model="form.priceTerms"
  71. placeholder="请选择"
  72. @change="priceTermsChange"
  73. clearable
  74. >
  75. <el-option
  76. v-for="item in priceTermsList"
  77. :key="item.id"
  78. :label="item.dictValue"
  79. :value="item.dictValue"
  80. >
  81. </el-option>
  82. </el-select>
  83. </template>
  84. <template slot="paymentType">
  85. <el-select
  86. size="small"
  87. v-model="form.paymentType"
  88. placeholder="请选择"
  89. @change="paymentTypeChange"
  90. clearable
  91. >
  92. <el-option
  93. v-for="item in paymentTermList"
  94. :key="item.id"
  95. :label="item.dictValue"
  96. :value="item.dictValue"
  97. >
  98. </el-option>
  99. </el-select>
  100. </template>
  101. <template slot="currency">
  102. <el-select
  103. size="small"
  104. v-model="form.currency"
  105. placeholder="请选择"
  106. @change="currencyChange"
  107. >
  108. <el-option
  109. v-for="item in currencyList"
  110. :key="item.id"
  111. :label="item.dictValue"
  112. :value="item.dictValue"
  113. >
  114. </el-option>
  115. </el-select>
  116. </template>
  117. <template slot="exchangeRate">
  118. <el-input
  119. size="small"
  120. v-model="form.exchangeRate"
  121. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d).*$/,
  122. "$1.$2")'
  123. placeholder="请输入 汇率"
  124. :disabled="detailData.status == 1"
  125. @change="exchangeRateChange"
  126. />
  127. </template>
  128. <template slot="boxNumber">
  129. <el-input
  130. size="mini"
  131. v-model="form.boxNumber"
  132. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
  133. "$1.$2")'
  134. placeholder="请输入 起订量"
  135. :disabled="detailData.status == 1"
  136. />
  137. </template>
  138. <template slot="minOrder">
  139. <el-input
  140. size="mini"
  141. v-model="form.minOrder"
  142. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
  143. "$1.$2")'
  144. placeholder="请输入 起订量"
  145. :disabled="detailData.status == 1"
  146. />
  147. </template>
  148. <template slot="predictOceanFreight">
  149. <el-input
  150. size="mini"
  151. v-model="form.predictOceanFreight"
  152. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
  153. "$1.$2")'
  154. placeholder="请输入 预计海运费"
  155. :disabled="detailData.status == 1"
  156. />
  157. </template>
  158. <template slot="referenceOceanFreight">
  159. <el-input
  160. size="mini"
  161. v-model="form.referenceOceanFreight"
  162. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
  163. "$1.$2")'
  164. placeholder="请输入 参考海运费"
  165. :disabled="detailData.status == 1"
  166. />
  167. </template>
  168. <template slot="oceanFreight">
  169. <el-input
  170. size="mini"
  171. v-model="form.oceanFreight"
  172. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
  173. "$1.$2")'
  174. placeholder="请输入 实际海运费"
  175. :disabled="detailData.status == 1"
  176. />
  177. </template>
  178. <template slot="orderNo">
  179. <el-input
  180. size="mini"
  181. v-model="form.orderNo"
  182. oninput="this.value=this.value.toUpperCase()"
  183. placeholder="请输入 "
  184. :disabled="detailData.status == 1"
  185. />
  186. </template>
  187. </avue-form>
  188. </basic-container>
  189. <div>
  190. <containerTitle title="商品信息"></containerTitle>
  191. <basic-container>
  192. <avue-crud
  193. ref="crud"
  194. :data="data"
  195. :option="tableOption"
  196. @row-del="rowDel"
  197. @selection-change="goodsSelectionChange"
  198. @saveColumn="saveColumn"
  199. :summary-method="summaryMethod"
  200. :cell-style="cellStyle"
  201. >
  202. <template slot="cname" slot-scope="{ row, index }">
  203. <span v-if="row.$cellEdit" style="display:flex">
  204. <el-select
  205. v-model="row.cname"
  206. placeholder="请选择"
  207. size="small"
  208. style="width:60%"
  209. @change="cnameChange(row, index)"
  210. >
  211. <el-option
  212. v-for="item in goodsoptions"
  213. :key="item.id"
  214. :label="item.cname"
  215. :value="item.cname"
  216. >
  217. </el-option>
  218. </el-select>
  219. <el-button
  220. icon="el-icon-search"
  221. size="small"
  222. @click="rePick(row, index)"
  223. ></el-button>
  224. </span>
  225. <span v-else> {{ row.cname }}</span>
  226. </template>
  227. <template slot="partsList" slot-scope="{ row, index }">
  228. <el-button
  229. size="small"
  230. type="text"
  231. @click="partrePick(row, index)"
  232. :disabled="disabled"
  233. >操作</el-button
  234. >
  235. </template>
  236. <template slot="itemType" slot-scope="{ row }">
  237. <el-select
  238. v-if="row.$cellEdit"
  239. v-model="row.itemType"
  240. filterable
  241. allow-create
  242. default-first-option
  243. placeholder="请输入"
  244. size="small"
  245. @focus="itemTypeFocus(row)"
  246. >
  247. <el-option
  248. v-for="(item, index) in itemtypeList"
  249. :key="index"
  250. :label="item.value"
  251. :value="item.value"
  252. >
  253. </el-option>
  254. </el-select>
  255. <span v-else>{{ row.itemType }}</span>
  256. </template>
  257. <template slot="itemProp" slot-scope="{ row, index }">
  258. <span v-if="row.$cellEdit" style="display:flex">
  259. <el-input
  260. v-model="row.itemProp"
  261. :readonly="true"
  262. size="small"
  263. placeholder="请点击右边按钮"
  264. ></el-input>
  265. <el-button
  266. icon="el-icon-edit"
  267. size="mini"
  268. @click="openProperty(row, index)"
  269. ></el-button>
  270. </span>
  271. <span v-else>{{ row.itemProp }}</span>
  272. </template>
  273. <template slot="priorityReferrer" slot-scope="{ row }">
  274. <el-checkbox
  275. :disabled="!row.$cellEdit"
  276. v-model="row.priorityReferrer"
  277. :true-label="1"
  278. :false-label="0"
  279. />
  280. </template>
  281. <template slot="corpId" slot-scope="{ row, index }">
  282. <crop-select
  283. v-show="row.$cellEdit"
  284. v-model="row.corpId"
  285. :cropIndex="index"
  286. @getCorpData="rowCorpData"
  287. corpType="GYS"
  288. ></crop-select>
  289. <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
  290. </template>
  291. <template slot="purchaseAmount" slot-scope="{ row }">
  292. <el-input
  293. v-if="row.$cellEdit"
  294. v-model="row.purchaseAmount"
  295. size="small"
  296. placeholder="请输入"
  297. @change="purchaseAmountChange(row)"
  298. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  299. ></el-input>
  300. <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
  301. </template>
  302. <template slot="price" slot-scope="{ row }">
  303. <el-input
  304. v-if="row.$cellEdit"
  305. v-model="row.price"
  306. size="small"
  307. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  308. @change="priceChange(row)"
  309. ></el-input>
  310. <span v-else>{{ row.price | micrometerFormat }}</span>
  311. </template>
  312. <template slot="amount" slot-scope="{ row }">
  313. <span>{{ row.amount | micrometerFormat }}</span>
  314. </template>
  315. <template slot="orderQuantity" slot-scope="{ row }">
  316. <el-input
  317. v-if="row.$cellEdit"
  318. v-model="row.orderQuantity"
  319. size="small"
  320. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  321. @change="priceChange(row)"
  322. ></el-input>
  323. <span v-else>{{ row.orderQuantity }}</span>
  324. </template>
  325. <template slot="discount" slot-scope="{ row }">
  326. <el-input
  327. v-if="row.$cellEdit"
  328. v-model="row.discount"
  329. size="small"
  330. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  331. @change="discountChange(row)"
  332. ></el-input>
  333. <span v-else>{{ row.discount | isDiscount }}</span>
  334. </template>
  335. <template slot="insurance" slot-scope="{ row }">
  336. <el-input
  337. v-if="row.$cellEdit"
  338. v-model="row.insurance"
  339. size="small"
  340. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  341. @change="priceChange(row)"
  342. ></el-input>
  343. <span v-else>{{ row.insurance | micrometerFormat }}</span>
  344. </template>
  345. <template slot="freight" slot-scope="{ row }">
  346. <el-input
  347. v-if="row.$cellEdit"
  348. v-model="row.freight"
  349. size="small"
  350. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  351. @change="priceChange(row)"
  352. ></el-input>
  353. <span v-else>{{ row.freight | micrometerFormat }}</span>
  354. </template>
  355. <template slot="taxRate" slot-scope="{ row }">
  356. <el-input
  357. v-if="row.$cellEdit"
  358. v-model="row.taxRate"
  359. size="small"
  360. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  361. @change="taxRateChange(row)"
  362. ></el-input>
  363. <span v-else>{{ row.taxRate | isPercentage }}</span>
  364. </template>
  365. <template slot="menuLeft">
  366. <el-button
  367. type="primary"
  368. icon="el-icon-plus"
  369. size="small"
  370. @click.stop="newDetails"
  371. :disabled="detailData.status == 1"
  372. >新增明细</el-button
  373. >
  374. <el-button
  375. type="primary"
  376. icon="el-icon-plus"
  377. size="small"
  378. @click.stop="addLibrary"
  379. :disabled="detailData.status == 1"
  380. >出口价格库</el-button
  381. >
  382. <el-button
  383. type="info"
  384. icon="el-icon-printer"
  385. size="small"
  386. @click.stop="openReport()"
  387. >报 表</el-button
  388. >
  389. <el-button
  390. type="warning"
  391. icon="el-icon-plus"
  392. size="small"
  393. :disabled="detailData.status == 1 || orderItemIds.length == 0"
  394. @click="getInvoice"
  395. >生成发货单
  396. </el-button>
  397. </template>
  398. <template slot="menu" slot-scope="{ row, index }">
  399. <el-button
  400. size="small"
  401. icon="el-icon-edit"
  402. type="text"
  403. @click="rowCell(row, index)"
  404. :disabled="disabled"
  405. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  406. >
  407. <el-button
  408. size="small"
  409. icon="el-icon-edit"
  410. type="text"
  411. @click="rowDel(row, index)"
  412. :disabled="detailData.status == 1"
  413. >删 除</el-button
  414. >
  415. </template>
  416. </avue-crud>
  417. </basic-container>
  418. </div>
  419. <fee-info
  420. ref="feeInfo"
  421. :orderFeesList="orderFeesList"
  422. :disabled="detailData.status == 1"
  423. feeUrl="/blade-purchase-sales/orderfees/update"
  424. />
  425. <upload-file
  426. ref="uploadFile"
  427. title="合同附件"
  428. :orderFilesList="orderFilesList"
  429. :disabled="detailData.status == 1"
  430. delUrl="/blade-purchase-sales/orderfiles/update"
  431. />
  432. <div>
  433. <containerTitle title="银行信息"></containerTitle>
  434. <basic-container>
  435. <avue-form
  436. class="trading-form"
  437. ref="form"
  438. v-model="form"
  439. :option="bankOption"
  440. />
  441. </basic-container>
  442. </div>
  443. <div>
  444. <containerTitle title="保险信息"></containerTitle>
  445. <basic-container>
  446. <avue-form
  447. class="trading-form"
  448. ref="form"
  449. v-model="form"
  450. :option="insuranceOption"
  451. />
  452. </basic-container>
  453. </div>
  454. <div>
  455. <containerTitle title="唛头"></containerTitle>
  456. <basic-container>
  457. <avue-form
  458. class="trading-form"
  459. ref="form"
  460. v-model="form"
  461. :option="markOption"
  462. />
  463. </basic-container>
  464. </div>
  465. </div>
  466. <el-dialog
  467. title="导入商品"
  468. append-to-body
  469. class="el-dialogDeep"
  470. :visible.sync="dialogVisible"
  471. width="60%"
  472. :close-on-click-modal="false"
  473. :destroy-on-close="true"
  474. :close-on-press-escape="false"
  475. @close="closeGoods"
  476. top="5vh"
  477. v-dialog-drag
  478. >
  479. <span>
  480. <el-row>
  481. <el-col :span="5">
  482. <div>
  483. <el-scrollbar>
  484. <basic-container>
  485. <avue-tree
  486. :option="treeOption"
  487. @node-click="nodeClick"
  488. :style="treeStyle"
  489. />
  490. </basic-container>
  491. </el-scrollbar>
  492. </div>
  493. </el-col>
  494. <el-col :span="19">
  495. <avue-crud
  496. :option="goodsOption"
  497. :table-loading="loading"
  498. :data="goodsList"
  499. ref="goodsCrud"
  500. @refresh-change="refreshChange"
  501. @selection-change="selectionChange"
  502. @row-click="rowClick"
  503. :page.sync="page"
  504. @on-load="onLoad"
  505. @saveColumn="saveGoodsColumn"
  506. :cell-style="cellStyle"
  507. ></avue-crud>
  508. </el-col>
  509. </el-row>
  510. </span>
  511. <span slot="footer" class="dialog-footer">
  512. <el-button @click="dialogVisible = false">取 消</el-button>
  513. <el-button
  514. type="primary"
  515. @click="importGoods"
  516. :disabled="selectionList.length == 0"
  517. >导入</el-button
  518. >
  519. </span>
  520. </el-dialog>
  521. <report-dialog
  522. :switchDialog="switchDialog"
  523. :reportId="form.id"
  524. reportName="销售明细(E)"
  525. @onClose="onClose()"
  526. ></report-dialog>
  527. <part-dialog
  528. ref="part"
  529. :partList="partList"
  530. @importPart="importPart"
  531. @partClosed="partClosed"
  532. />
  533. <price-library ref="library" @importLibray="importLibray" />
  534. <property-dialog ref="property" @importProperty="importProperty" />
  535. </div>
  536. </template>
  537. <script>
  538. import tableOption from "./config/customerContact.json";
  539. import goodsOption from "./config/commodity.json";
  540. import feeInfo from "@/components/fee-info/main";
  541. import uploadFile from "@/components/upload-file/main";
  542. import {
  543. detail,
  544. submit,
  545. delItem,
  546. getDeptLazyTree,
  547. getGoods,
  548. deliverGoods,
  549. getPorts,
  550. getSpecification,
  551. saveSell
  552. } from "@/api/basicData/salesContract";
  553. import _ from "lodash";
  554. import reportDialog from "@/components/report-dialog/main";
  555. import partDialog from "@/components/part-dialog/main";
  556. import { micrometerFormat } from "@/util/validate";
  557. import { contrastObj, contrastList } from "@/util/contrastData";
  558. import customerDialog from "@/components/customer-dialog/main";
  559. import priceLibrary from "@/components/price-Library/main";
  560. import propertyDialog from "@/components/property-dialog/main";
  561. import { dateFormat } from "@/util/date";
  562. import {
  563. productCal,
  564. sellingCal,
  565. amountCal,
  566. transformCal
  567. } from "@/util/calculate";
  568. export default {
  569. name: "detailsPageEdit",
  570. data() {
  571. return {
  572. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  573. configuration: {
  574. multipleChoices: false,
  575. multiple: false,
  576. collapseTags: false,
  577. placeholder: "请点击右边按钮选择",
  578. dicData: []
  579. },
  580. switchDialog: false,
  581. form: {
  582. orderStatus: "录入",
  583. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  584. currency: "CNY",
  585. exchangeRate: "1"
  586. },
  587. disabled: false,
  588. dialogVisible: false,
  589. tableOption: {},
  590. option: {
  591. menuBtn: false,
  592. labelWidth: 100,
  593. column: [
  594. {
  595. label: "客户名称",
  596. prop: "corpId",
  597. rules: [
  598. {
  599. required: true,
  600. message: "",
  601. trigger: "blur"
  602. }
  603. ],
  604. span: 16,
  605. slot: true
  606. },
  607. {
  608. label: "系统号",
  609. prop: "sysNo",
  610. span: 8,
  611. disabled: true
  612. },
  613. {
  614. label: "联系人",
  615. prop: "corpAttn",
  616. span: 8
  617. },
  618. {
  619. label: "电话",
  620. prop: "corpTel",
  621. span: 8
  622. },
  623. {
  624. label: "订单状态",
  625. prop: "orderStatus",
  626. span: 8,
  627. type: "select",
  628. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  629. props: {
  630. label: "dictValue",
  631. value: "dictValue"
  632. }
  633. },
  634. {
  635. label: "公司主体",
  636. prop: "belongToCorpId",
  637. span: 16,
  638. row: true
  639. },
  640. {
  641. label: "起运港",
  642. prop: "portOfLoad",
  643. span: 8,
  644. type: "select",
  645. filterable: true,
  646. dicData: [],
  647. props: {
  648. label: "name",
  649. value: "name"
  650. }
  651. },
  652. {
  653. label: "目的港",
  654. prop: "portOfDestination",
  655. span: 8,
  656. type: "select",
  657. filterable: true,
  658. dicData: [],
  659. props: {
  660. label: "name",
  661. value: "name"
  662. }
  663. },
  664. {
  665. label: "运输方式",
  666. prop: "transport",
  667. span: 8,
  668. type: "select",
  669. dicUrl: "/api/blade-system/dict-biz/dictionary?code=mode_transport",
  670. props: {
  671. label: "dictValue",
  672. value: "dictValue"
  673. }
  674. },
  675. {
  676. label: "价格条款",
  677. prop: "priceTerms",
  678. span: 8
  679. // type: "select",
  680. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=pricing_terms",
  681. // props: {
  682. // label: "dictValue",
  683. // value: "dictValue"
  684. // }
  685. },
  686. {
  687. label: "条款说明",
  688. prop: "priceTermsDescription",
  689. span: 16
  690. },
  691. {
  692. label: "收款方式",
  693. prop: "paymentType",
  694. span: 8
  695. // type: "select",
  696. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_term",
  697. // props: {
  698. // label: "dictValue",
  699. // value: "dictValue"
  700. // }
  701. },
  702. {
  703. label: "收款说明",
  704. prop: "paymentTypeDescription",
  705. span: 16
  706. },
  707. {
  708. label: "订单日期",
  709. prop: "businesDate",
  710. span: 8,
  711. type: "date",
  712. format: "yyyy-MM-dd",
  713. valueFormat: "yyyy-MM-dd 00:00:00",
  714. rules: [
  715. {
  716. required: true,
  717. message: "",
  718. trigger: "blur"
  719. }
  720. ]
  721. },
  722. {
  723. label: "预交日期",
  724. prop: "plannedDeliveryDate",
  725. span: 8,
  726. type: "date",
  727. format: "yyyy-MM-dd",
  728. valueFormat: "yyyy-MM-dd 00:00:00"
  729. },
  730. {
  731. label: "销售订单号",
  732. prop: "orderNo",
  733. span: 8
  734. },
  735. {
  736. label: "币别",
  737. prop: "currency",
  738. span: 8,
  739. rules: [
  740. {
  741. required: true,
  742. message: "",
  743. trigger: "blur"
  744. }
  745. ]
  746. },
  747. {
  748. label: "汇率",
  749. prop: "exchangeRate",
  750. span: 8,
  751. row: true
  752. },
  753. {
  754. label: "箱型",
  755. prop: "boxPile",
  756. type: "select",
  757. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxType",
  758. props: {
  759. label: "dictValue",
  760. value: "dictValue"
  761. },
  762. span: 8
  763. },
  764. {
  765. label: "箱量",
  766. prop: "boxNumber",
  767. span: 8
  768. },
  769. {
  770. label: "起订量",
  771. prop: "minOrder",
  772. span: 8
  773. },
  774. {
  775. label: "预计海运费",
  776. prop: "predictOceanFreight",
  777. span: 8
  778. },
  779. {
  780. label: "参考海运费",
  781. prop: "referenceOceanFreight",
  782. span: 8
  783. },
  784. {
  785. label: "实际海运费",
  786. prop: "oceanFreight",
  787. span: 8
  788. },
  789. {
  790. label: "毛利额",
  791. prop: "grossProfit",
  792. span: 8,
  793. disabled: true
  794. },
  795. {
  796. label: "毛利率",
  797. prop: "grossProfitRate",
  798. span: 8,
  799. row: true,
  800. append: "%",
  801. disabled: true
  802. },
  803. {
  804. label: "备注",
  805. prop: "orderRemark",
  806. type: "textarea",
  807. minRows: 2,
  808. span: 8
  809. },
  810. {
  811. label: "采购备注",
  812. prop: "purchaseRemark",
  813. type: "textarea",
  814. minRows: 2,
  815. span: 8
  816. },
  817. {
  818. label: "船务备注",
  819. prop: "shippingRemark",
  820. type: "textarea",
  821. minRows: 2,
  822. span: 8
  823. }
  824. ]
  825. },
  826. treeOption: {
  827. nodeKey: "id",
  828. lazy: true,
  829. treeLoad: function(node, resolve) {
  830. const parentId = node.level === 0 ? 0 : node.data.id;
  831. getDeptLazyTree(parentId).then(res => {
  832. resolve(
  833. res.data.data.map(item => {
  834. return {
  835. ...item,
  836. leaf: !item.hasChildren
  837. };
  838. })
  839. );
  840. });
  841. },
  842. addBtn: false,
  843. menu: false,
  844. size: "small",
  845. props: {
  846. label: "title",
  847. value: "value",
  848. children: "children"
  849. }
  850. },
  851. bankOption: {
  852. menuBtn: false,
  853. labelWidth: 100,
  854. column: [
  855. {
  856. label: "外币银行",
  857. prop: "banks",
  858. span: 8
  859. },
  860. {
  861. label: "银行信息",
  862. prop: "banksAccountName",
  863. span: 16,
  864. type: "textarea",
  865. minRows: 2
  866. }
  867. ]
  868. },
  869. insuranceOption: {
  870. menuBtn: false,
  871. labelWidth: 100,
  872. column: [
  873. {
  874. label: "保险描述",
  875. prop: "insuranceRemarks",
  876. span: 24,
  877. type: "textarea",
  878. minRows: 2
  879. }
  880. ]
  881. },
  882. markOption: {
  883. menuBtn: false,
  884. labelWidth: 100,
  885. column: [
  886. {
  887. label: "唛头描述",
  888. prop: "marks",
  889. span: 24,
  890. type: "textarea",
  891. minRows: 2
  892. }
  893. ]
  894. },
  895. page: {
  896. pageSize: 10,
  897. currentPage: 1,
  898. total: 0
  899. },
  900. loading: false,
  901. goodsOption: {},
  902. data: [],
  903. goodsList: [],
  904. selectionList: [],
  905. treeDeptId: null,
  906. orderFeesList: [],
  907. orderFilesList: [],
  908. orderItemIds: [],
  909. itemtypeList: [],
  910. reData: null,
  911. oldform: {
  912. orderStatus: "录入",
  913. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  914. currency: "CNY",
  915. exchangeRate: "1"
  916. },
  917. olddata: [],
  918. oldorderFeesList: [],
  919. oldorderFilesList: [],
  920. subLoading: false,
  921. pageLoading: false,
  922. showBut: true,
  923. partType: false,
  924. partList: [],
  925. goodsoptions: [],
  926. priceTermsList: [],
  927. paymentTermList: [],
  928. currencyList: []
  929. };
  930. },
  931. props: {
  932. detailData: {
  933. type: Object
  934. }
  935. },
  936. components: {
  937. reportDialog,
  938. feeInfo,
  939. uploadFile,
  940. customerDialog,
  941. partDialog,
  942. priceLibrary,
  943. propertyDialog
  944. },
  945. async created() {
  946. if (this.detailData.id) {
  947. this.getDetail(this.detailData.id);
  948. }
  949. this.tableOption = await this.getColumnData(
  950. this.getColumnName(5),
  951. tableOption
  952. );
  953. this.goodsOption = await this.getColumnData(
  954. this.getColumnName(28),
  955. goodsOption
  956. );
  957. if (this.detailData.status == 1) {
  958. this.option.disabled = true;
  959. this.bankOption.disabled = true;
  960. this.insuranceOption.disabled = true;
  961. this.markOption.disabled = true;
  962. }
  963. getPorts().then(res => {
  964. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  965. this.findObject(this.option.column, "portOfDestination").dicData =
  966. res.data;
  967. });
  968. this.getWorkDicts("product_properties").then(res => {
  969. this.findObject(this.tableOption.column, "itemProp").dicData =
  970. res.data.data;
  971. });
  972. this.getWorkDicts("unit").then(res => {
  973. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  974. });
  975. this.getWorkDicts("pricing_terms").then(res => {
  976. this.priceTermsList = res.data.data;
  977. });
  978. this.getWorkDicts("payment_term").then(res => {
  979. this.paymentTermList = res.data.data;
  980. });
  981. this.getWorkDicts("currency").then(res => {
  982. this.currencyList = res.data.data;
  983. });
  984. getGoods(1, 500).then(res => {
  985. this.goodsoptions = res.data.data.records;
  986. });
  987. },
  988. methods: {
  989. cellStyle() {
  990. return "padding:0;height:40px;";
  991. },
  992. rowCorpData(row) {
  993. this.data[row.index].corpName = row.cname;
  994. },
  995. priceTermsChange(row) {
  996. this.priceTermsList.forEach(e => {
  997. if (row == e.dictValue) {
  998. this.form.priceTermsDescription = e.remark;
  999. }
  1000. });
  1001. },
  1002. paymentTypeChange(row) {
  1003. this.paymentTermList.forEach(e => {
  1004. if (row == e.dictValue) {
  1005. this.form.paymentTypeDescription = e.remark;
  1006. }
  1007. });
  1008. },
  1009. getCorpData(row) {
  1010. this.form.coefficient = row.coefficient;
  1011. if (this.data.length > 0) {
  1012. this.data.forEach(e => {
  1013. e.productPrice = productCal(e.purchaseAmount, this.form.coefficient);
  1014. e.price = sellingCal(
  1015. e.productPrice,
  1016. e.partsPrice,
  1017. this.form.coefficient,
  1018. this.form.exchangeRate
  1019. );
  1020. e.amount = amountCal(
  1021. e.price,
  1022. e.orderQuantity,
  1023. e.freight,
  1024. e.insurance,
  1025. e.discount
  1026. );
  1027. });
  1028. }
  1029. },
  1030. cnameChange(row) {
  1031. this.goodsoptions.forEach(e => {
  1032. if (e.cname == row.cname) {
  1033. row.itemId = e.id;
  1034. row.code = e.code;
  1035. row.priceCategory = e.goodsTypeName;
  1036. row.itemUrl = e.url;
  1037. row.itemDescription = e.cnameDescription;
  1038. row.unit = e.unit;
  1039. }
  1040. });
  1041. },
  1042. addLibrary() {
  1043. if (!this.form.corpId) {
  1044. return this.$message.error("请选择客户名称");
  1045. }
  1046. if (!this.form.currency) {
  1047. return this.$message.error("请选择币别");
  1048. }
  1049. this.$refs.library.init(false);
  1050. },
  1051. partrePick(row, index) {
  1052. this.partList = row.partsList;
  1053. this.$refs.part.init(index);
  1054. },
  1055. importPart(rows, sum, index) {
  1056. this.data[index].partsList = rows;
  1057. this.data[index].partsPrice = sum;
  1058. // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
  1059. this.data[index].productPrice = productCal(
  1060. this.data[index].purchaseAmount,
  1061. this.form.coefficient
  1062. );
  1063. this.data[index].price = sellingCal(
  1064. this.data[index].productPrice,
  1065. this.data[index].partsPrice,
  1066. this.form.coefficient,
  1067. this.form.exchangeRate
  1068. );
  1069. this.data[index].amount = amountCal(
  1070. this.data[index].price,
  1071. this.data[index].orderQuantity,
  1072. this.data[index].freight,
  1073. this.data[index].insurance,
  1074. this.data[index].discount
  1075. );
  1076. const names = [];
  1077. const namePrices = [];
  1078. rows.map(e => {
  1079. names.push(e.goodName);
  1080. namePrices.push(e.goodName + ":" + e.amout);
  1081. });
  1082. this.data[index].partsDescribe = names.join(",");
  1083. this.data[index].partsPriceDescribe = namePrices.join(";");
  1084. this.priceChange(this.data[index]);
  1085. },
  1086. importProperty(row, index) {
  1087. const arr = [];
  1088. for (let key in row) {
  1089. if (row[key]) {
  1090. arr.push(row[key]);
  1091. }
  1092. }
  1093. this.data[index].itemProp = arr.join(",");
  1094. this.data[index].remarksOne = row.remarksOne;
  1095. this.data[index].customTwo = row.customTwo;
  1096. this.data[index].customThree = row.customThree;
  1097. this.data[index].customFour = row.customFour;
  1098. this.data[index].customFive = row.customFive;
  1099. },
  1100. partClosed() {
  1101. this.partList = [];
  1102. },
  1103. saveSell() {
  1104. if (!this.form.id) {
  1105. return this.$message.error("此单据没有提交记录,请先提交");
  1106. }
  1107. this.$confirm("是否生成采购单?", {
  1108. confirmButtonText: "确定",
  1109. cancelButtonText: "取消",
  1110. type: "warning"
  1111. }).then(() => {
  1112. saveSell(this.form.id).then(res => {
  1113. if (res.data.code == 200) {
  1114. this.$message.success("生成成功");
  1115. }
  1116. });
  1117. });
  1118. },
  1119. rePick(row, index) {
  1120. this.reData = {
  1121. ...row,
  1122. index: index
  1123. };
  1124. this.newDetails();
  1125. },
  1126. rowCell(row, index) {
  1127. if (row.$cellEdit == true) {
  1128. this.$set(row, "$cellEdit", false);
  1129. } else {
  1130. this.$set(row, "$cellEdit", true);
  1131. }
  1132. },
  1133. itemTypeFocus(row) {
  1134. this.itemtypeList = [];
  1135. getSpecification({ goodId: row.itemId }).then(res => {
  1136. const data = res.data.data;
  1137. this.itemtypeList = data.map(item => ({ value: item }));
  1138. });
  1139. },
  1140. purchaseAmountChange(row) {
  1141. row.productPrice = productCal(row.purchaseAmount, this.form.coefficient);
  1142. row.price = sellingCal(
  1143. row.productPrice,
  1144. row.partsPrice,
  1145. this.form.coefficient,
  1146. this.form.exchangeRate
  1147. );
  1148. row.amount = amountCal(
  1149. row.price,
  1150. row.orderQuantity,
  1151. row.freight,
  1152. row.insurance,
  1153. row.discount
  1154. );
  1155. },
  1156. priceChange(row) {
  1157. row.amount = amountCal(
  1158. row.price,
  1159. row.orderQuantity,
  1160. row.freight,
  1161. row.insurance,
  1162. row.discount
  1163. );
  1164. },
  1165. quantityChange(row) {
  1166. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1167. row.orderQuantity = row.actualQuantity;
  1168. this.$message.error("修改的数量不能低于发货数量");
  1169. }
  1170. if (!row.orderQuantity) {
  1171. row.orderQuantity = 0;
  1172. } else {
  1173. row.amount = amountCal(
  1174. row.price,
  1175. row.orderQuantity,
  1176. row.freight,
  1177. row.insurance,
  1178. row.discount
  1179. );
  1180. }
  1181. },
  1182. currencyChange(row) {
  1183. if (row == "CNY") {
  1184. this.form.exchangeRate = 1;
  1185. } else if (row == "USD") {
  1186. this.form.exchangeRate = 6.3843;
  1187. } else {
  1188. this.form.exchangeRate = 1;
  1189. }
  1190. if (this.data.length > 0) {
  1191. this.data.forEach(e => {
  1192. e.freight = transformCal(
  1193. e.freight,
  1194. this.oldExchange,
  1195. this.form.exchangeRate
  1196. );
  1197. e.insurance = transformCal(
  1198. e.insurance,
  1199. this.oldExchange,
  1200. this.form.exchangeRate
  1201. );
  1202. e.price = sellingCal(
  1203. e.productPrice,
  1204. e.partsPrice,
  1205. this.form.coefficient,
  1206. this.form.exchangeRate
  1207. );
  1208. e.amount = amountCal(
  1209. e.price,
  1210. e.orderQuantity,
  1211. e.freight,
  1212. e.insurance,
  1213. e.discount
  1214. );
  1215. });
  1216. }
  1217. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1218. },
  1219. exchangeRateChange(row) {
  1220. if (this.data.length > 0) {
  1221. this.data.forEach(e => {
  1222. e.freight = transformCal(e.freight, this.oldExchange, row);
  1223. e.insurance = transformCal(e.insurance, this.oldExchange, row);
  1224. e.price = sellingCal(
  1225. e.productPrice,
  1226. e.partsPrice,
  1227. this.form.coefficient,
  1228. row
  1229. );
  1230. e.amount = amountCal(
  1231. e.price,
  1232. e.orderQuantity,
  1233. e.freight,
  1234. e.insurance,
  1235. e.discount
  1236. );
  1237. });
  1238. }
  1239. this.oldExchange = this.deepClone(row);
  1240. },
  1241. discountChange(row) {
  1242. if (row.discount >= 10) {
  1243. row.discount = null;
  1244. this.$message.error("请正确输入折扣");
  1245. }
  1246. this.priceChange(row);
  1247. },
  1248. taxRateChange(row) {
  1249. if (Number(row.taxRate) >= 100) {
  1250. row.taxRate = 0;
  1251. this.$message.error("税率不能超过100%");
  1252. }
  1253. },
  1254. rowSave(row) {
  1255. this.$set(row, "$cellEdit", false);
  1256. },
  1257. rowDel(row, index) {
  1258. this.$confirm("确定删除数据?", {
  1259. confirmButtonText: "确定",
  1260. cancelButtonText: "取消",
  1261. type: "warning"
  1262. }).then(() => {
  1263. if (row.id) {
  1264. delItem(row.id).then(res => {
  1265. this.$message({
  1266. type: "success",
  1267. message: "删除成功!"
  1268. });
  1269. this.data.splice(index, 1);
  1270. });
  1271. } else {
  1272. this.$message({
  1273. type: "success",
  1274. message: "删除成功!"
  1275. });
  1276. this.data.splice(index, 1);
  1277. }
  1278. });
  1279. },
  1280. importGoods() {
  1281. if (this.reData) {
  1282. if (this.selectionList.length != 1) {
  1283. return this.$message.error("重新选择的时候只能选择一条数据");
  1284. } else {
  1285. this.selectionList.forEach(e => {
  1286. this.data.forEach((item, index) => {
  1287. if (index == this.reData.index) {
  1288. item.itemId = e.id;
  1289. item.code = e.code;
  1290. item.cname = e.cname;
  1291. item.priceCategory = e.goodsTypeName;
  1292. item.itemUrl = e.url;
  1293. item.itemProp = this.reData.itemProp;
  1294. item.remarksOne = this.reData.remarksOne;
  1295. item.customTwo = this.reData.customTwo;
  1296. item.customThree = this.reData.customThree;
  1297. item.customFour = this.reData.customFour;
  1298. item.customFive = this.reData.customFive;
  1299. item.partsList = this.reData.partsList;
  1300. item.partsPrice = this.reData.ppartsPrice;
  1301. item.itemDescription = e.cnameDescription;
  1302. item.itemType = this.reData.itemType;
  1303. item.tradeTerms = this.reData.tradeTerms;
  1304. item.price = this.reData.price;
  1305. item.orderQuantity = this.reData.orderQuantity;
  1306. item.insurance = this.reData.insurance;
  1307. item.freight = this.reData.freight;
  1308. item.discount = this.reData.discount;
  1309. item.amount = this.reData.amount;
  1310. item.taxRate = this.reData.taxRate;
  1311. item.unit = e.unit;
  1312. item.remarks = this.reData.remarks;
  1313. item.$cellEdit = true;
  1314. }
  1315. });
  1316. });
  1317. }
  1318. } else {
  1319. this.selectionList.forEach(e => {
  1320. this.data.push({
  1321. itemId: e.id,
  1322. code: e.code,
  1323. cname: e.cname,
  1324. priceCategory: e.goodsTypeName,
  1325. itemUrl: e.url,
  1326. itemProp: null,
  1327. remarksOne: null,
  1328. customTwo: null,
  1329. customThree: null,
  1330. customFour: null,
  1331. customFive: null,
  1332. itemDescription: e.cnameDescription,
  1333. partsList: [],
  1334. partsPrice: 0,
  1335. itemType: null,
  1336. tradeTerms: null,
  1337. price: 0,
  1338. orderQuantity: 0,
  1339. insurance: 0,
  1340. freight: 0,
  1341. discount: null,
  1342. amount: 0,
  1343. taxRate: 0,
  1344. unit: e.unit,
  1345. remarks: null,
  1346. $cellEdit: true
  1347. });
  1348. });
  1349. }
  1350. this.dialogVisible = false;
  1351. },
  1352. closeGoods() {
  1353. this.selectionList = [];
  1354. this.treeDeptId = "";
  1355. this.reData = null;
  1356. },
  1357. goodsSelectionChange(list) {
  1358. this.orderItemIds = [];
  1359. list.map(e => {
  1360. this.orderItemIds.push(e.id);
  1361. });
  1362. },
  1363. selectionChange(list) {
  1364. this.selectionList = list;
  1365. },
  1366. rowClick(row) {
  1367. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  1368. },
  1369. nodeClick(data) {
  1370. this.treeDeptId = data.id;
  1371. this.page.currentPage = 1;
  1372. this.onLoad(this.page);
  1373. },
  1374. //费用查询
  1375. onLoad(page, params = {}) {
  1376. this.loading = true;
  1377. getGoods(page.currentPage, page.pageSize, this.treeDeptId).then(res => {
  1378. const data = res.data.data;
  1379. this.page.total = data.total;
  1380. this.goodsList = data.records;
  1381. this.loading = false;
  1382. if (this.page.total) {
  1383. this.goodsOption.height = window.innerHeight - 350;
  1384. }
  1385. });
  1386. },
  1387. importLibray(rows) {
  1388. rows.forEach(e => {
  1389. this.data.push({
  1390. itemId: e.itemId,
  1391. code: e.code,
  1392. cname: e.cname,
  1393. priceCategory: e.goodsTypeName,
  1394. purchaseAmount: e.purchaseAmount,
  1395. itemProp: null,
  1396. remarksOne: null,
  1397. customTwo: null,
  1398. customThree: null,
  1399. customFour: null,
  1400. customFive: null,
  1401. corpId: e.corpId,
  1402. corpName: e.corpName,
  1403. itemDescription: e.cnameDescription,
  1404. partsList: [],
  1405. partsPrice: 0,
  1406. itemType: e.specs,
  1407. tradeTerms: null,
  1408. productPrice: productCal(e.purchaseAmount, this.form.coefficient),
  1409. price: sellingCal(
  1410. productCal(e.purchaseAmount, this.form.coefficient),
  1411. 0,
  1412. this.form.coefficient,
  1413. this.form.exchangeRate
  1414. ),
  1415. orderQuantity: 1,
  1416. insurance: 0,
  1417. freight: 0,
  1418. discount: null,
  1419. amount: sellingCal(
  1420. productCal(e.purchaseAmount, this.form.coefficient),
  1421. 0,
  1422. this.form.coefficient,
  1423. this.form.exchangeRate
  1424. ),
  1425. taxRate: 0,
  1426. unit: e.unit,
  1427. remarks: null,
  1428. $cellEdit: true
  1429. });
  1430. });
  1431. },
  1432. //商品明细导入
  1433. newDetails() {
  1434. if (!this.form.corpId) {
  1435. return this.$message.error("请选择客户名称");
  1436. }
  1437. this.dialogVisible = !this.dialogVisible;
  1438. },
  1439. getDetail(id) {
  1440. this.showBut = false;
  1441. this.pageLoading = true;
  1442. detail(id)
  1443. .then(res => {
  1444. this.form = res.data.data;
  1445. this.data = res.data.data.orderItemsList;
  1446. this.orderFeesList = res.data.data.orderFeesList;
  1447. this.orderFilesList = res.data.data.orderFilesList;
  1448. this.oldform = res.data.data;
  1449. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1450. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  1451. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  1452. })
  1453. .finally(() => {
  1454. this.showBut = true;
  1455. this.pageLoading = false;
  1456. });
  1457. },
  1458. //修改提交触发
  1459. editCustomer(status) {
  1460. this.$refs["form"].validate((valid, done) => {
  1461. done();
  1462. if (valid) {
  1463. if (this.data.length > 0) {
  1464. for (let i = 0; i < this.data.length; i++) {
  1465. if (this.data[i].corpId == null) {
  1466. return this.$message.error(`请输入第${i + 1}行的供应商`);
  1467. }
  1468. }
  1469. }
  1470. const orderFeesList = this.$refs.feeInfo.submitData();
  1471. for (let i = 0; i < orderFeesList.length; i++) {
  1472. if (orderFeesList[i].corpId == null) {
  1473. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  1474. }
  1475. if (orderFeesList[i].price == 0) {
  1476. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  1477. }
  1478. if (orderFeesList[i].quantity == 0) {
  1479. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  1480. }
  1481. }
  1482. const orderFilesList = this.$refs.uploadFile.submitData();
  1483. this.subLoading = true;
  1484. submit({
  1485. ...this.form,
  1486. orderItemsList: this.data,
  1487. orderFeesList: orderFeesList,
  1488. orderFilesList: orderFilesList
  1489. })
  1490. .then(res => {
  1491. this.form = res.data.data;
  1492. this.data = res.data.data.orderItemsList;
  1493. this.orderFeesList = res.data.data.orderFeesList;
  1494. this.orderFilesList = res.data.data.orderFilesList;
  1495. this.$message.success(this.form.id ? "修改成功" : "提交成功");
  1496. this.oldform = res.data.data;
  1497. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1498. this.oldorderFeesList = this.deepClone(
  1499. res.data.data.orderFeesList
  1500. );
  1501. this.oldorderFilesList = this.deepClone(
  1502. res.data.data.orderFilesList
  1503. );
  1504. if (status == "goBack") {
  1505. this.$emit("goBack");
  1506. }
  1507. })
  1508. .finally(() => {
  1509. this.subLoading = false;
  1510. });
  1511. } else {
  1512. return false;
  1513. }
  1514. });
  1515. },
  1516. //返回列表
  1517. backToList() {
  1518. let orderFeesList = this.$refs.feeInfo.submitData();
  1519. let orderFilesList = this.$refs.uploadFile.submitData();
  1520. if (
  1521. contrastObj(this.form, this.oldform) ||
  1522. contrastList(this.data, this.olddata) ||
  1523. contrastList(orderFeesList, this.oldorderFeesList) ||
  1524. contrastList(orderFilesList, this.oldorderFilesList)
  1525. ) {
  1526. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1527. confirmButtonText: "确定",
  1528. cancelButtonText: "取消",
  1529. type: "warning"
  1530. })
  1531. .then(() => {
  1532. this.editCustomer("goBack");
  1533. })
  1534. .catch(() => {
  1535. this.$emit("goBack");
  1536. });
  1537. } else {
  1538. this.$emit("goBack");
  1539. }
  1540. },
  1541. openReport() {
  1542. this.switchDialog = !this.switchDialog;
  1543. },
  1544. openProperty(row, index) {
  1545. this.$refs.property.init(row, index);
  1546. },
  1547. onClose(val) {
  1548. this.switchDialog = val;
  1549. },
  1550. getInvoice() {
  1551. if (this.$store.getters.outStatus) {
  1552. this.$alert("出口发货单存在,请保存发货单再进行操作", "温馨提示", {
  1553. confirmButtonText: "确定",
  1554. type: "warning",
  1555. callback: action => {
  1556. console.log(action);
  1557. }
  1558. });
  1559. } else {
  1560. this.inInvoice();
  1561. }
  1562. },
  1563. inInvoice() {
  1564. const data = { id: this.form.id, orderItemIds: this.orderItemIds };
  1565. deliverGoods(data).then(res => {
  1566. if (res.data.code == 200) {
  1567. this.$message.success("生成成功");
  1568. if (data) {
  1569. const data = res.data.data;
  1570. data.orderItemsList.forEach(e => {
  1571. e.actualQuantity = e.orderQuantity;
  1572. e.contractAmount = e.amount;
  1573. e.srcId = e.id;
  1574. e.specificationAndModel = e.itemType;
  1575. e.productDesc = e.itemDescription;
  1576. delete e.id;
  1577. delete e.version;
  1578. delete e.status;
  1579. delete e.createUser;
  1580. delete e.createTime;
  1581. delete e.updateUser;
  1582. delete e.updateTime;
  1583. delete e.isDeleted;
  1584. });
  1585. console.log(data);
  1586. const obj = {
  1587. corpId: data.corpId,
  1588. deliveryStatus: "录入",
  1589. srcOrderNo: data.sysNo,
  1590. orgOrderNo: data.orgOrderNo,
  1591. orderItemsList: data.orderItemsList,
  1592. orderFeesList: data.deliveryFeesList
  1593. };
  1594. this.$router.$avueRouter.closeTag("/exportTrade/invoice/index");
  1595. this.$router.push({
  1596. path: "/exportTrade/invoice/index",
  1597. query: {
  1598. pageType: "Generate",
  1599. data: JSON.stringify(obj)
  1600. }
  1601. });
  1602. }
  1603. }
  1604. });
  1605. },
  1606. async saveColumn() {
  1607. const inSave = await this.saveColumnData(
  1608. this.getColumnName(5),
  1609. this.tableOption
  1610. );
  1611. if (inSave) {
  1612. this.$message.success("保存成功");
  1613. //关闭窗口
  1614. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1615. }
  1616. },
  1617. summaryMethod({ columns, data }) {
  1618. const sums = [];
  1619. if (columns.length > 0) {
  1620. columns.forEach((item, index) => {
  1621. sums[0] = "合计";
  1622. if (item.property == "orderQuantity" || item.property == "amount") {
  1623. let qtySum = 0;
  1624. let amountSum = 0;
  1625. data.forEach(e => {
  1626. qtySum = _.add(qtySum, Number(e.orderQuantity));
  1627. amountSum = _.add(amountSum, Number(e.amount));
  1628. });
  1629. //数量总计
  1630. if (item.property == "orderQuantity") {
  1631. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  1632. }
  1633. //金额总计
  1634. if (item.property == "amount") {
  1635. sums[index] = micrometerFormat(amountSum);
  1636. }
  1637. }
  1638. });
  1639. }
  1640. return sums;
  1641. },
  1642. async saveGoodsColumn() {
  1643. const inSave = await this.saveColumnData(
  1644. this.getColumnName(28),
  1645. this.goodsOption
  1646. );
  1647. if (inSave) {
  1648. this.$message.success("保存成功");
  1649. //关闭窗口
  1650. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1651. }
  1652. }
  1653. }
  1654. };
  1655. </script>
  1656. <style lang="scss" scoped>
  1657. .trading-form ::v-deep .el-form-item {
  1658. margin-bottom: 8px !important;
  1659. }
  1660. ::v-deep .el-form-item__error {
  1661. display: none !important;
  1662. }
  1663. ::v-deep .select-component {
  1664. display: flex !important;
  1665. }
  1666. </style>