detailsPage.vue 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090
  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
  15. type="primary"
  16. size="small"
  17. v-if="detailData.status == 1"
  18. class="el-button--small-yh "
  19. @click.stop="openEdit"
  20. >编辑
  21. </el-button>
  22. <el-button type="info" @click="saveSell" size="small"
  23. >生成销售单</el-button
  24. >
  25. <el-button
  26. type="success"
  27. :disabled="!form.id"
  28. size="small"
  29. @click="copyDoc"
  30. >
  31. 复制单据
  32. </el-button>
  33. <el-button
  34. type="primary"
  35. :disabled="disabled"
  36. @click="editCustomer"
  37. :loading="subLoading"
  38. v-if="detailData.status != 1"
  39. size="small"
  40. >保存数据
  41. </el-button>
  42. </div>
  43. </div>
  44. <div class="customer-main">
  45. <containerTitle title="基础信息"></containerTitle>
  46. <basic-container :showBtn="true">
  47. <avue-form
  48. ref="form"
  49. class="trading-form"
  50. v-model="form"
  51. :option="option"
  52. >
  53. <template slot="portOfLoad">
  54. <port-info
  55. v-model="form.portOfLoad"
  56. :disabled="detailData.status == 1"
  57. />
  58. </template>
  59. <template slot="portOfDestination">
  60. <port-info
  61. v-model="form.portOfDestination"
  62. :disabled="detailData.status == 1"
  63. />
  64. </template>
  65. <template slot="corpId">
  66. <crop-select
  67. v-model="form.corpId"
  68. @getCorpData="getCorpData"
  69. corpType="KH"
  70. :disabled="detailData.status == 1"
  71. ></crop-select>
  72. </template>
  73. <template slot="corpAttn">
  74. <el-select
  75. size="small"
  76. v-model="form.corpAttn"
  77. placeholder="请选择"
  78. @change="corpAttnChange"
  79. clearable
  80. :disabled="detailData.status == 1"
  81. >
  82. <el-option
  83. v-for="item in corpsattns"
  84. :key="item.id"
  85. :label="item.cname"
  86. :value="item.cname"
  87. >
  88. </el-option>
  89. </el-select>
  90. </template>
  91. <template slot="belongToCorpId">
  92. <crop-select
  93. v-model="form.belongToCorpId"
  94. corpType="GS"
  95. :disabled="detailData.status == 1"
  96. ></crop-select>
  97. </template>
  98. <template slot="priceTerms">
  99. <el-select
  100. size="small"
  101. v-model="form.priceTerms"
  102. placeholder="请选择"
  103. @change="priceTermsChange"
  104. clearable
  105. :disabled="detailData.status == 1"
  106. >
  107. <el-option
  108. v-for="item in priceTermsList"
  109. :key="item.id"
  110. :label="item.dictValue"
  111. :value="item.dictValue"
  112. >
  113. </el-option>
  114. </el-select>
  115. </template>
  116. <template slot="paymentType">
  117. <el-select
  118. size="small"
  119. v-model="form.paymentType"
  120. placeholder="请选择"
  121. @change="paymentTypeChange"
  122. clearable
  123. :disabled="detailData.status == 1"
  124. >
  125. <el-option
  126. v-for="item in paymentTermList"
  127. :key="item.id"
  128. :label="item.dictValue"
  129. :value="item.dictValue"
  130. >
  131. </el-option>
  132. </el-select>
  133. </template>
  134. <template slot="currency">
  135. <el-select
  136. size="small"
  137. v-model="form.currency"
  138. placeholder="请选择"
  139. @change="currencyChange"
  140. :disabled="detailData.status == 1"
  141. >
  142. <el-option
  143. v-for="item in currencyList"
  144. :key="item.id"
  145. :label="item.dictValue"
  146. :value="item.dictValue"
  147. >
  148. </el-option>
  149. </el-select>
  150. </template>
  151. <template slot="exchangeRate">
  152. <el-input
  153. size="small"
  154. v-model="form.exchangeRate"
  155. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  156. placeholder="请输入 汇率"
  157. :disabled="detailData.status == 1"
  158. @change="exchangeRateChange"
  159. />
  160. </template>
  161. <template slot="boxPile">
  162. <el-select
  163. size="small"
  164. v-model="form.boxPile"
  165. placeholder="请选择"
  166. clearable
  167. filterable
  168. :disabled="detailData.status == 1"
  169. >
  170. <el-option
  171. v-for="item in allBoxs"
  172. :key="item.id"
  173. :label="item.name"
  174. :value="item.name"
  175. >
  176. </el-option>
  177. </el-select>
  178. </template>
  179. <template slot="boxNumber">
  180. <el-input
  181. size="small"
  182. v-model="form.boxNumber"
  183. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  184. placeholder="请输入 箱量"
  185. :disabled="detailData.status == 1"
  186. />
  187. </template>
  188. <template slot="minOrder">
  189. <el-input
  190. size="small"
  191. v-model="form.minOrder"
  192. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  193. placeholder="请输入 起订量"
  194. :disabled="detailData.status == 1"
  195. />
  196. </template>
  197. <template slot="predictOceanFreight">
  198. <el-input
  199. size="small"
  200. v-model="form.predictOceanFreight"
  201. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  202. placeholder="请输入 预计海运费"
  203. :disabled="detailData.status == 1"
  204. />
  205. </template>
  206. <template slot="referenceOceanFreight">
  207. <el-input
  208. size="small"
  209. v-model="form.referenceOceanFreight"
  210. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  211. placeholder="请输入 参考海运费"
  212. :disabled="detailData.status == 1"
  213. />
  214. </template>
  215. <template slot="oceanFreight">
  216. <el-input
  217. size="small"
  218. v-model="form.oceanFreight"
  219. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  220. placeholder="请输入 实际海运费"
  221. :disabled="detailData.status == 1"
  222. />
  223. </template>
  224. </avue-form>
  225. </basic-container>
  226. <containerTitle title="商品信息"></containerTitle>
  227. <basic-container>
  228. <avue-crud
  229. ref="crud"
  230. :data="data"
  231. :option="tableOption"
  232. @row-del="rowDel"
  233. :summary-method="summaryMethod"
  234. @saveColumn="saveColumn"
  235. @resetColumn="resetColumn"
  236. :cell-style="cellStyle"
  237. >
  238. <template slot="menuLeft">
  239. <el-button
  240. type="primary"
  241. icon="el-icon-plus"
  242. size="small"
  243. @click.stop="newDetails"
  244. :disabled="detailData.status == 1"
  245. >录入明细</el-button
  246. >
  247. <el-button
  248. type="primary"
  249. icon="el-icon-plus"
  250. size="small"
  251. @click.stop="addLibrary"
  252. :disabled="detailData.status == 1"
  253. >出口价格库</el-button
  254. >
  255. <el-button
  256. type="info"
  257. icon="el-icon-printer"
  258. size="small"
  259. @click.stop="openReport()"
  260. >报 表</el-button
  261. >
  262. <el-button
  263. type="info"
  264. size="small"
  265. @click.stop="savePurchase"
  266. :disabled="detailData.status == 1"
  267. >采购询价</el-button
  268. >
  269. <el-button
  270. type="info"
  271. size="small"
  272. @click.stop="saveShipping"
  273. :disabled="detailData.status == 1"
  274. >船务询价</el-button
  275. >
  276. </template>
  277. <template slot="menu" slot-scope="{ row, index }">
  278. <el-button
  279. size="small"
  280. icon="el-icon-edit"
  281. type="text"
  282. @click="rowCell(row, index)"
  283. :disabled="disabled || detailData.status == 1"
  284. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  285. >
  286. <el-button
  287. size="small"
  288. icon="el-icon-delete"
  289. type="text"
  290. @click="rowDel(row, index)"
  291. :disabled="detailData.status == 1"
  292. >删除</el-button
  293. >
  294. </template>
  295. <template slot="itemType" slot-scope="{ row }">
  296. <el-select
  297. v-if="row.$cellEdit"
  298. v-model="row.itemType"
  299. filterable
  300. allow-create
  301. default-first-option
  302. placeholder="请输入"
  303. size="small"
  304. @focus="itemTypeFocus(row)"
  305. >
  306. <el-option
  307. v-for="(item, index) in itemtypeList"
  308. :key="index"
  309. :label="item.value"
  310. :value="item.value"
  311. >
  312. </el-option>
  313. </el-select>
  314. <span v-else>{{ row.itemType }}</span>
  315. </template>
  316. <template slot="itemProp" slot-scope="{ row, index }">
  317. <span v-if="row.$cellEdit" style="display:flex">
  318. <el-input
  319. v-model="row.itemProp"
  320. size="small"
  321. placeholder="请点击右边按钮"
  322. ></el-input>
  323. <el-button
  324. icon="el-icon-edit"
  325. size="mini"
  326. @click="openProperty(row, index)"
  327. ></el-button>
  328. </span>
  329. <span v-else>{{ row.itemProp }}</span>
  330. </template>
  331. <template slot="cname" slot-scope="{ row, index }">
  332. <span v-if="row.$cellEdit" style="display:flex">
  333. <el-select
  334. v-model="row.itemId"
  335. placeholder="请选择"
  336. size="small"
  337. style="width:60%"
  338. @change="cnameChange(row, index)"
  339. >
  340. <el-option
  341. v-for="item in goodsoptions"
  342. :key="item.id"
  343. :label="item.cname"
  344. :value="item.id"
  345. >
  346. </el-option>
  347. </el-select>
  348. <el-button
  349. icon="el-icon-search"
  350. size="small"
  351. @click="rePick(row, index)"
  352. ></el-button>
  353. </span>
  354. <span v-else> {{ row.cname }}</span>
  355. </template>
  356. <template slot="partsDescribe" slot-scope="{ row, index }">
  357. <span v-if="row.$cellEdit" style="display:flex">
  358. <el-input
  359. v-model="row.partsDescribe"
  360. size="small"
  361. placeholder="请点击右边按钮"
  362. ></el-input>
  363. <el-button
  364. icon="el-icon-edit"
  365. size="mini"
  366. @click="partrePick(row, index)"
  367. ></el-button>
  368. </span>
  369. <span v-else>{{ row.partsDescribe }}</span>
  370. </template>
  371. <template slot="priorityReferrer" slot-scope="{ row }">
  372. <el-checkbox
  373. :disabled="!row.$cellEdit"
  374. v-model="row.priorityReferrer"
  375. :true-label="1"
  376. :false-label="0"
  377. />
  378. </template>
  379. <template slot="corpId" slot-scope="{ row, index }">
  380. <crop-select
  381. v-show="row.$cellEdit"
  382. v-model="row.corpId"
  383. :cropIndex="index"
  384. @getCorpData="rowCorpData"
  385. corpType="GYS"
  386. ></crop-select>
  387. <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
  388. </template>
  389. <template slot="purchaseCost" slot-scope="{ row }">
  390. <el-input
  391. v-if="row.$cellEdit"
  392. v-model="row.purchaseCost"
  393. size="small"
  394. placeholder="请输入"
  395. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  396. ></el-input>
  397. <span v-else>{{ row.purchaseCost | micrometerFormat }}</span>
  398. </template>
  399. <template slot="purchaseAmount" slot-scope="{ row }">
  400. <el-input
  401. v-if="row.$cellEdit"
  402. v-model="row.purchaseAmount"
  403. size="small"
  404. placeholder="请输入"
  405. @change="purchaseAmountChange(row)"
  406. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  407. ></el-input>
  408. <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
  409. </template>
  410. <template slot="price" slot-scope="{ row }">
  411. <el-input
  412. v-if="row.$cellEdit"
  413. v-model="row.price"
  414. size="small"
  415. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  416. @change="priceChange(row)"
  417. ></el-input>
  418. <span v-else>{{ row.price | micrometerFormat }}</span>
  419. </template>
  420. <template slot="amount" slot-scope="{ row }">
  421. <span>{{ row.amount | micrometerFormat }}</span>
  422. </template>
  423. <template slot="orderQuantity" slot-scope="{ row }">
  424. <el-input
  425. v-if="row.$cellEdit"
  426. v-model="row.orderQuantity"
  427. size="small"
  428. oninput='this.value=this.value.replace(/[^(\d)]/g,"")'
  429. @change="priceChange(row)"
  430. ></el-input>
  431. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  432. </template>
  433. <template slot="discount" slot-scope="{ row }">
  434. <el-input
  435. v-if="row.$cellEdit"
  436. v-model="row.discount"
  437. size="small"
  438. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  439. @change="discountChange(row)"
  440. ></el-input>
  441. <span v-else>{{ row.discount | isDiscount }}</span>
  442. </template>
  443. <template slot="insurance" slot-scope="{ row }">
  444. <el-input
  445. v-if="row.$cellEdit"
  446. v-model="row.insurance"
  447. size="small"
  448. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  449. @change="priceChange(row)"
  450. ></el-input>
  451. <span v-else>{{ row.insurance | micrometerFormat }}</span>
  452. </template>
  453. <template slot="freight" slot-scope="{ row }">
  454. <el-input
  455. v-if="row.$cellEdit"
  456. v-model="row.freight"
  457. size="small"
  458. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  459. @change="priceChange(row)"
  460. ></el-input>
  461. <span v-else>{{ row.freight | micrometerFormat }}</span>
  462. </template>
  463. <template slot="taxRate" slot-scope="{ row }">
  464. <el-input
  465. v-if="row.$cellEdit"
  466. v-model="row.taxRate"
  467. size="small"
  468. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  469. @change="taxRateChange(row)"
  470. ></el-input>
  471. <span v-else>{{ row.taxRate | isPercentage }}</span>
  472. </template>
  473. <template slot="itemMargin" slot-scope="{ row }">
  474. <span>{{ row.itemMargin | isPercentage }}</span>
  475. </template>
  476. </avue-crud>
  477. </basic-container>
  478. <fee-info
  479. ref="feeInfo"
  480. :orderFeesList="orderFeesList"
  481. :disabled="detailData.status == 1"
  482. feeUrl="/blade-purchase-sales/orderfees/update"
  483. optionType="CK"
  484. itemType="报价"
  485. @beforeFinance="beforeFinance"
  486. :corpId="form.corpId"
  487. />
  488. <containerTitle title="合同附件"></containerTitle>
  489. <c-upload
  490. typeUpload="CK"
  491. :data="orderFilesList"
  492. :disabled="detailData.status == 1"
  493. :enumerationValue="76"
  494. deleteUrl="/blade-purchase-sales/orderfiles/update"
  495. />
  496. </div>
  497. <el-dialog
  498. title="导入商品"
  499. append-to-body
  500. class="el-dialogDeep"
  501. :visible.sync="dialogVisible"
  502. width="80%"
  503. :close-on-click-modal="false"
  504. :destroy-on-close="true"
  505. :close-on-press-escape="false"
  506. @close="closeGoods"
  507. top="5vh"
  508. v-dialog-drag
  509. >
  510. <span>
  511. <el-row>
  512. <el-col :span="4">
  513. <div>
  514. <el-scrollbar>
  515. <basic-container>
  516. <avue-tree
  517. :option="treeOption"
  518. @node-click="nodeClick"
  519. :style="treeStyle"
  520. />
  521. </basic-container>
  522. </el-scrollbar>
  523. </div>
  524. </el-col>
  525. <el-col :span="20">
  526. <avue-crud
  527. :option="goodsOption"
  528. :table-loading="loading"
  529. :data="goodsList"
  530. ref="goodsCrud"
  531. :search.sync="search"
  532. @search-change="searchChange"
  533. @refresh-change="refreshChange"
  534. @selection-change="selectionChange"
  535. @row-click="rowClick"
  536. :page.sync="page"
  537. @on-load="onLoad"
  538. @saveColumn="saveGoodsColumn"
  539. @resetColumn="resetGoodsColumn"
  540. :cell-style="cellStyle"
  541. ></avue-crud>
  542. </el-col>
  543. </el-row>
  544. </span>
  545. <span slot="footer" class="dialog-footer">
  546. <el-button @click="dialogVisible = false">取 消</el-button>
  547. <el-button
  548. type="primary"
  549. @click="importGoods"
  550. :disabled="selectionList.length == 0"
  551. >导入</el-button
  552. >
  553. </span>
  554. </el-dialog>
  555. <report-dialog
  556. :switchDialog="switchDialog"
  557. :reportId="form.id"
  558. reportName="报价单明细(E)"
  559. @onClose="onClose()"
  560. ></report-dialog>
  561. <part-dialog
  562. ref="part"
  563. :partList="partList"
  564. @importPart="importPart"
  565. @partClosed="partClosed"
  566. />
  567. <property-dialog ref="property" @importProperty="importProperty" />
  568. <price-library ref="library" @importLibray="importLibray" />
  569. </div>
  570. </template>
  571. <script>
  572. import tableOption from "./config/customerContact.json";
  573. import goodsOption from "./config/commodity.json";
  574. import feeInfo from "@/components/fee-info/main";
  575. import customerDialog from "@/components/customer-dialog/main";
  576. import partDialog from "@/components/part-dialog/main";
  577. import propertyDialog from "@/components/property-dialog/main";
  578. import {
  579. detail,
  580. submit,
  581. delItem,
  582. getDeptLazyTree,
  583. getGoods,
  584. savePurchase,
  585. saveShipping,
  586. getPorts,
  587. getSpecification,
  588. saveSell,
  589. getPricedetail
  590. } from "@/api/basicData/customerInquiry";
  591. import { getAllBoxs } from "@/api/basicData/portinformation";
  592. import { getCorpsattn } from "@/api/basicData/customerInformation";
  593. import reportDialog from "@/components/report-dialog/main";
  594. import priceLibrary from "@/components/price-Library/main";
  595. import {
  596. isDiscount,
  597. isPercentage,
  598. micrometerFormat,
  599. IntegerFormat
  600. } from "@/util/validate";
  601. import { contrastObj, contrastList } from "@/util/contrastData";
  602. import { dateFormat } from "@/util/date";
  603. import {
  604. productCal,
  605. sellingCal,
  606. amountCal,
  607. transformCal,
  608. grossProfitCal,
  609. STGPCal,
  610. numCal,
  611. costsCal,
  612. costCal
  613. } from "@/util/calculate";
  614. import _ from "lodash";
  615. export default {
  616. name: "detailsPageEdit",
  617. data() {
  618. return {
  619. show: true,
  620. oldExchange: null,
  621. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  622. itemtypeList: [],
  623. switchDialog: false,
  624. form: {
  625. orderStatus: "录入",
  626. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  627. currency: "USD"
  628. },
  629. disabled: false,
  630. dialogVisible: false,
  631. tableOption: {},
  632. option: {
  633. menuBtn: false,
  634. labelWidth: 100,
  635. column: [
  636. {
  637. label: "客户名称",
  638. prop: "corpId",
  639. rules: [
  640. {
  641. required: true,
  642. message: "",
  643. trigger: "blur"
  644. }
  645. ],
  646. span: 16,
  647. slot: true
  648. },
  649. {
  650. label: "系统号",
  651. prop: "sysNo",
  652. span: 8,
  653. disabled: true
  654. },
  655. {
  656. label: "联系人",
  657. prop: "corpAttn",
  658. span: 8
  659. },
  660. {
  661. label: "电话",
  662. prop: "corpTel",
  663. span: 8
  664. },
  665. {
  666. label: "订单状态",
  667. prop: "orderStatus",
  668. span: 8,
  669. type: "select",
  670. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  671. props: {
  672. label: "dictValue",
  673. value: "dictValue"
  674. }
  675. },
  676. {
  677. label: "公司主体",
  678. prop: "belongToCorpId",
  679. span: 16,
  680. row: true
  681. },
  682. {
  683. label: "起运港",
  684. prop: "portOfLoad",
  685. span: 8,
  686. type: "select",
  687. filterable: true,
  688. rules: [
  689. {
  690. required: true,
  691. message: "",
  692. trigger: "blur"
  693. }
  694. ],
  695. dicData: [],
  696. props: {
  697. label: "name",
  698. value: "name"
  699. }
  700. },
  701. {
  702. label: "目的港",
  703. prop: "portOfDestination",
  704. span: 8,
  705. type: "select",
  706. filterable: true,
  707. rules: [
  708. {
  709. required: true,
  710. message: "",
  711. trigger: "blur"
  712. }
  713. ],
  714. dicData: [],
  715. props: {
  716. label: "name",
  717. value: "name"
  718. }
  719. },
  720. {
  721. label: "运输方式",
  722. prop: "transport",
  723. span: 8,
  724. type: "select",
  725. dicUrl: "/api/blade-system/dict-biz/dictionary?code=mode_transport",
  726. props: {
  727. label: "dictValue",
  728. value: "dictValue"
  729. }
  730. },
  731. {
  732. label: "价格条款",
  733. prop: "priceTerms",
  734. span: 8
  735. // type: "select",
  736. // dicData:[],
  737. // props: {
  738. // label: "dictValue",
  739. // value: "dictValue"
  740. // }
  741. },
  742. {
  743. label: "条款说明",
  744. prop: "priceTermsDescription",
  745. span: 16
  746. },
  747. {
  748. label: "收款方式",
  749. prop: "paymentType",
  750. span: 8
  751. // type: "select",
  752. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_term",
  753. // props: {
  754. // label: "dictValue",
  755. // value: "dictValue"
  756. // }
  757. },
  758. {
  759. label: "收款说明",
  760. prop: "paymentTypeDescription",
  761. span: 16
  762. },
  763. {
  764. label: "报价日期",
  765. prop: "businesDate",
  766. span: 8,
  767. type: "date",
  768. format: "yyyy-MM-dd",
  769. valueFormat: "yyyy-MM-dd 00:00:00",
  770. rules: [
  771. {
  772. required: true,
  773. message: "",
  774. trigger: "blur"
  775. }
  776. ]
  777. },
  778. {
  779. label: "有效日期",
  780. prop: "dateValidity",
  781. span: 8,
  782. type: "date",
  783. format: "yyyy-MM-dd",
  784. valueFormat: "yyyy-MM-dd 00:00:00",
  785. rules: [
  786. {
  787. required: true,
  788. message: "",
  789. trigger: "blur"
  790. }
  791. ]
  792. },
  793. {
  794. label: "报价单号",
  795. prop: "orderNo",
  796. span: 8
  797. },
  798. {
  799. label: "币别",
  800. prop: "currency",
  801. span: 8,
  802. rules: [
  803. {
  804. required: true,
  805. message: "",
  806. trigger: "blur"
  807. }
  808. ]
  809. },
  810. {
  811. label: "汇率",
  812. prop: "exchangeRate",
  813. span: 8,
  814. row: true,
  815. rules: [
  816. {
  817. required: true,
  818. message: "",
  819. trigger: "blur"
  820. }
  821. ]
  822. },
  823. {
  824. label: "箱型",
  825. prop: "boxPile",
  826. span: 8
  827. },
  828. {
  829. label: "箱量",
  830. prop: "boxNumber",
  831. span: 8
  832. },
  833. {
  834. label: "起订量",
  835. prop: "minOrder",
  836. span: 8
  837. },
  838. {
  839. label: "预计海运费",
  840. prop: "predictOceanFreight",
  841. span: 8
  842. },
  843. {
  844. label: "参考海运费",
  845. prop: "referenceOceanFreight",
  846. span: 8
  847. },
  848. {
  849. label: "实际海运费",
  850. prop: "oceanFreight",
  851. span: 8
  852. },
  853. {
  854. label: "产品毛利",
  855. prop: "grossProfit",
  856. span: 8,
  857. disabled: true
  858. },
  859. {
  860. label: "产品利率",
  861. prop: "grossProfitRate",
  862. span: 8,
  863. append: "%",
  864. disabled: true
  865. },
  866. {
  867. label: "单票毛利",
  868. prop: "singleTicketMargin",
  869. span: 8,
  870. disabled: true
  871. },
  872. {
  873. label: "备注",
  874. prop: "orderRemark",
  875. type: "textarea",
  876. minRows: 2,
  877. span: 8
  878. },
  879. {
  880. label: "采购备注",
  881. prop: "purchaseRemark",
  882. type: "textarea",
  883. minRows: 2,
  884. span: 8
  885. },
  886. {
  887. label: "船务备注",
  888. prop: "shippingRemark",
  889. type: "textarea",
  890. minRows: 2,
  891. span: 8
  892. }
  893. ]
  894. },
  895. treeOption: {
  896. nodeKey: "id",
  897. lazy: true,
  898. treeLoad: function(node, resolve) {
  899. const parentId = node.level === 0 ? 0 : node.data.id;
  900. getDeptLazyTree(parentId).then(res => {
  901. resolve(
  902. res.data.data.map(item => {
  903. return {
  904. ...item,
  905. leaf: !item.hasChildren
  906. };
  907. })
  908. );
  909. });
  910. },
  911. addBtn: false,
  912. menu: false,
  913. size: "small",
  914. props: {
  915. label: "title",
  916. value: "value",
  917. children: "children"
  918. }
  919. },
  920. page: {
  921. pageSize: 10,
  922. currentPage: 1,
  923. total: 0
  924. },
  925. goodsOption: {},
  926. data: [],
  927. goodsList: [],
  928. selectionList: [],
  929. treeDeptId: null,
  930. orderFeesList: [],
  931. orderFilesList: [],
  932. oldform: {
  933. orderStatus: "录入",
  934. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  935. currency: "USD"
  936. },
  937. olddata: [],
  938. oldorderFeesList: [],
  939. oldorderFilesList: [],
  940. reData: null,
  941. loading: false,
  942. subLoading: false,
  943. pageLoading: false,
  944. showBut: true,
  945. partList: [],
  946. goodsoptions: [],
  947. priceTermsList: [],
  948. paymentTermList: [],
  949. currencyList: [],
  950. corpsattns: [],
  951. allBoxs: [],
  952. search: {}
  953. };
  954. },
  955. props: {
  956. detailData: {
  957. type: Object
  958. }
  959. },
  960. components: {
  961. reportDialog,
  962. feeInfo,
  963. customerDialog,
  964. partDialog,
  965. priceLibrary,
  966. propertyDialog
  967. },
  968. async created() {
  969. if (this.detailData.id) {
  970. this.getDetail(this.detailData.id);
  971. }
  972. this.tableOption = await this.getColumnData(
  973. this.getColumnName(1),
  974. tableOption
  975. );
  976. this.goodsOption = await this.getColumnData(
  977. this.getColumnName(26),
  978. goodsOption
  979. );
  980. if (this.detailData.status == 1) {
  981. this.option.disabled = true;
  982. }
  983. this.getWorkDicts("product_properties").then(res => {
  984. this.findObject(this.tableOption.column, "itemProp").dicData =
  985. res.data.data;
  986. });
  987. this.getWorkDicts("unit").then(res => {
  988. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  989. });
  990. this.getWorkDicts("pricing_terms").then(res => {
  991. this.priceTermsList = res.data.data;
  992. });
  993. this.getWorkDicts("payment_term").then(res => {
  994. this.paymentTermList = res.data.data;
  995. });
  996. this.getWorkDicts("currency").then(res => {
  997. this.currencyList = res.data.data;
  998. if (!this.detailData.id) {
  999. this.currencyList.forEach(e => {
  1000. if (e.dictValue == "USD") {
  1001. this.form.exchangeRate = e.remark;
  1002. this.oldform.exchangeRate = e.remark;
  1003. this.oldExchange = e.remark;
  1004. }
  1005. });
  1006. }
  1007. });
  1008. getPorts().then(res => {
  1009. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  1010. this.findObject(this.option.column, "portOfDestination").dicData =
  1011. res.data;
  1012. });
  1013. getAllBoxs().then(res => {
  1014. this.allBoxs = res.data.data;
  1015. });
  1016. getGoods(1, 500).then(res => {
  1017. this.goodsoptions = res.data.data.records;
  1018. });
  1019. },
  1020. filters: {
  1021. isDiscount(val) {
  1022. return isDiscount(val);
  1023. },
  1024. isPercentage(val) {
  1025. return isPercentage(val);
  1026. },
  1027. micrometerFormat(val) {
  1028. return micrometerFormat(val);
  1029. },
  1030. IntegerFormat(num) {
  1031. return IntegerFormat(num);
  1032. }
  1033. },
  1034. methods: {
  1035. cellStyle() {
  1036. return "padding:0;height:40px;";
  1037. },
  1038. copyDoc() {
  1039. this.$emit("copyOrder", this.form.id);
  1040. },
  1041. getCorpData(row) {
  1042. this.form.corpAttn = null;
  1043. this.form.corpTel = null;
  1044. this.form.coefficient = row.coefficient;
  1045. if (this.data.length > 0) {
  1046. this.data.forEach(e => {
  1047. e.productPrice = productCal(
  1048. e.purchaseAmount,
  1049. e.partsPrice,
  1050. this.form.coefficient
  1051. );
  1052. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  1053. e.amount = amountCal(
  1054. e.price,
  1055. e.orderQuantity,
  1056. e.freight,
  1057. e.insurance,
  1058. e.discount
  1059. );
  1060. e.itemMargin = grossProfitCal(
  1061. e.purchaseAmount,
  1062. e.partsPrice,
  1063. e.price,
  1064. this.form.exchangeRate
  1065. );
  1066. });
  1067. }
  1068. },
  1069. corpAttnChange() {
  1070. this.corpsattns.forEach(e => {
  1071. if (this.form.corpId == e.pid) {
  1072. this.form.corpTel = e.tel;
  1073. }
  1074. });
  1075. },
  1076. rowCorpData(row) {
  1077. this.data[row.index].corpName = row.cname;
  1078. },
  1079. priceTermsChange(row) {
  1080. if (!this.form.priceTermsDescription) {
  1081. if (row == "FOB" || row == "EXW") {
  1082. this.form.priceTermsDescription = this.form.portOfLoad;
  1083. } else {
  1084. this.form.priceTermsDescription = this.form.portOfDestination;
  1085. }
  1086. }
  1087. },
  1088. paymentTypeChange(row) {
  1089. this.paymentTermList.forEach(e => {
  1090. if (row == e.dictValue) {
  1091. this.form.paymentTypeDescription = e.remark;
  1092. }
  1093. });
  1094. },
  1095. addLibrary() {
  1096. if (!this.form.corpId) {
  1097. return this.$message.error("请选择客户名称");
  1098. }
  1099. if (!this.form.currency) {
  1100. return this.$message.error("请选择币别");
  1101. }
  1102. this.$refs.library.init(false);
  1103. },
  1104. cnameChange(row) {
  1105. this.goodsoptions.forEach(e => {
  1106. if (e.id == row.itemId) {
  1107. row.cname = e.cname;
  1108. row.code = e.code;
  1109. row.corpId = e.corpId;
  1110. row.corpName = e.corpName;
  1111. row.priceCategory = e.goodsTypeName;
  1112. row.itemUrl = e.url;
  1113. row.itemDescription = e.cnameDescription;
  1114. row.unit = e.unit;
  1115. row.purchaseAmount = 0;
  1116. row.productPrice = productCal(
  1117. 0,
  1118. row.partsPrice,
  1119. this.form.coefficient
  1120. );
  1121. row.price = sellingCal(
  1122. productCal(0, row.partsPrice, this.form.coefficient),
  1123. this.form.exchangeRate
  1124. );
  1125. row.amount = amountCal(
  1126. sellingCal(
  1127. productCal(0, row.partsPrice, this.form.coefficient),
  1128. this.form.exchangeRate
  1129. ),
  1130. row.orderQuantity,
  1131. row.freight,
  1132. row.insurance,
  1133. row.discount
  1134. );
  1135. row.itemMargin = grossProfitCal(
  1136. 0,
  1137. row.partsPrice,
  1138. sellingCal(
  1139. productCal(0, row.partsPrice, this.form.coefficient),
  1140. this.form.exchangeRate
  1141. ),
  1142. this.form.exchangeRate
  1143. );
  1144. }
  1145. });
  1146. getPricedetail({ itemId: row.itemId, corpId: row.corpId }).then(res => {
  1147. if (res.data.data) {
  1148. this.goodsoptions.forEach(e => {
  1149. if (e.id == row.itemId) {
  1150. row.purchaseAmount = res.data.data.purchaseAmount;
  1151. row.productPrice = productCal(
  1152. res.data.data.purchaseAmount,
  1153. row.partsPrice,
  1154. this.form.coefficient
  1155. );
  1156. row.price = sellingCal(
  1157. productCal(
  1158. res.data.data.purchaseAmount,
  1159. row.partsPrice,
  1160. this.form.coefficient
  1161. ),
  1162. this.form.exchangeRate
  1163. );
  1164. row.amount = amountCal(
  1165. sellingCal(
  1166. productCal(
  1167. res.data.data.purchaseAmount,
  1168. row.partsPrice,
  1169. this.form.coefficient
  1170. ),
  1171. this.form.exchangeRate
  1172. ),
  1173. row.orderQuantity,
  1174. row.freight,
  1175. row.insurance,
  1176. row.discount
  1177. );
  1178. row.itemMargin = grossProfitCal(
  1179. res.data.data.purchaseAmount,
  1180. row.partsPrice,
  1181. sellingCal(
  1182. productCal(
  1183. res.data.data.purchaseAmount,
  1184. row.partsPrice,
  1185. this.form.coefficient
  1186. ),
  1187. this.form.exchangeRate
  1188. ),
  1189. this.form.exchangeRate
  1190. );
  1191. }
  1192. });
  1193. }
  1194. });
  1195. },
  1196. saveSell() {
  1197. if (!this.form.id) {
  1198. return this.$message.error("此单据没有提交记录,请先提交");
  1199. }
  1200. this.$confirm("是否生成销售单?", {
  1201. confirmButtonText: "确定",
  1202. cancelButtonText: "取消",
  1203. type: "warning"
  1204. }).then(() => {
  1205. saveSell(this.form.id).then(res => {
  1206. if (res.data.code == 200) {
  1207. this.$message.success("生成成功");
  1208. this.getDetail(this.form.id);
  1209. }
  1210. });
  1211. });
  1212. },
  1213. rePick(row, index) {
  1214. this.reData = {
  1215. ...row,
  1216. index: index
  1217. };
  1218. this.newDetails();
  1219. },
  1220. partrePick(row, index) {
  1221. this.partList = row.partsList;
  1222. this.$refs.part.init(index);
  1223. },
  1224. importPart(rows, sum, index) {
  1225. this.data[index].partsList = rows;
  1226. this.data[index].partsPrice = sum;
  1227. // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
  1228. this.data[index].productPrice = productCal(
  1229. this.data[index].purchaseAmount,
  1230. this.data[index].partsPrice,
  1231. this.form.coefficient
  1232. );
  1233. this.data[index].price = sellingCal(
  1234. this.data[index].productPrice,
  1235. this.form.exchangeRate
  1236. );
  1237. this.data[index].amount = amountCal(
  1238. this.data[index].price,
  1239. this.data[index].orderQuantity,
  1240. this.data[index].freight,
  1241. this.data[index].insurance,
  1242. this.data[index].discount
  1243. );
  1244. this.data[index].itemMargin = grossProfitCal(
  1245. this.data[index].purchaseAmount,
  1246. this.data[index].partsPrice,
  1247. this.data[index].price,
  1248. this.form.exchangeRate
  1249. );
  1250. const names = [];
  1251. const namePrices = [];
  1252. let costsSum = 0;
  1253. rows.map(e => {
  1254. if (e.ename) {
  1255. names.push(e.ename);
  1256. }
  1257. namePrices.push((e.goodName ? e.goodName : "") + ":" + e.amout);
  1258. costsSum = costsCal(costsSum, e.partsCost, e.goodNumber);
  1259. });
  1260. this.data[index].partsDescribe = names.join(",");
  1261. this.data[index].partsPriceDescribe = namePrices.join(";");
  1262. this.data[index].partsCost = costsSum;
  1263. this.priceChange(this.data[index]);
  1264. },
  1265. importProperty(row, index) {
  1266. const arr = [];
  1267. for (let key in row) {
  1268. if (row[key]) {
  1269. arr.push(row[key]);
  1270. }
  1271. }
  1272. this.data[index].itemProp = arr.join(",");
  1273. this.data[index].remarksOne = row.remarksOne;
  1274. this.data[index].customTwo = row.customTwo;
  1275. this.data[index].customThree = row.customThree;
  1276. this.data[index].customFour = row.customFour;
  1277. this.data[index].customFive = row.customFive;
  1278. },
  1279. partClosed() {
  1280. this.partList = [];
  1281. },
  1282. rowCell(row, index) {
  1283. if (row.$cellEdit == true) {
  1284. this.$set(row, "$cellEdit", false);
  1285. } else {
  1286. this.$set(row, "$cellEdit", true);
  1287. }
  1288. },
  1289. itemTypeFocus(row) {
  1290. this.itemtypeList = [];
  1291. getSpecification({ goodId: row.itemId }).then(res => {
  1292. const data = res.data.data;
  1293. this.itemtypeList = data.map(item => ({ value: item }));
  1294. });
  1295. },
  1296. purchaseAmountChange(row) {
  1297. row.productPrice = productCal(
  1298. row.purchaseAmount,
  1299. row.partsPrice,
  1300. this.form.coefficient
  1301. );
  1302. row.price = sellingCal(row.productPrice, this.form.exchangeRate);
  1303. row.amount = amountCal(
  1304. row.price,
  1305. row.orderQuantity,
  1306. row.freight,
  1307. row.insurance,
  1308. row.discount
  1309. );
  1310. row.itemMargin = grossProfitCal(
  1311. row.purchaseAmount,
  1312. row.partsPrice,
  1313. row.price,
  1314. this.form.exchangeRate
  1315. );
  1316. },
  1317. priceChange(row) {
  1318. row.amount = amountCal(
  1319. row.price,
  1320. row.orderQuantity,
  1321. row.freight,
  1322. row.insurance,
  1323. row.discount
  1324. );
  1325. row.itemMargin = grossProfitCal(
  1326. row.purchaseAmount,
  1327. row.partsPrice,
  1328. row.price,
  1329. this.form.exchangeRate
  1330. );
  1331. },
  1332. currencyChange(row) {
  1333. this.currencyList.forEach(e => {
  1334. if (e.dictValue == row) {
  1335. this.form.exchangeRate = e.remark;
  1336. }
  1337. });
  1338. if (this.data.length > 0) {
  1339. this.data.forEach(e => {
  1340. e.freight = transformCal(
  1341. e.freight,
  1342. this.oldExchange,
  1343. this.form.exchangeRate
  1344. );
  1345. e.insurance = transformCal(
  1346. e.insurance,
  1347. this.oldExchange,
  1348. this.form.exchangeRate
  1349. );
  1350. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  1351. e.amount = amountCal(
  1352. e.price,
  1353. e.orderQuantity,
  1354. e.freight,
  1355. e.insurance,
  1356. e.discount
  1357. );
  1358. e.itemMargin = grossProfitCal(
  1359. e.purchaseAmount,
  1360. e.partsPrice,
  1361. e.price,
  1362. this.form.exchangeRate
  1363. );
  1364. e.exchangeRate = this.form.exchangeRate;
  1365. });
  1366. }
  1367. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1368. },
  1369. exchangeRateChange(row) {
  1370. if (this.data.length > 0) {
  1371. this.data.forEach(e => {
  1372. e.freight = transformCal(e.freight, this.oldExchange, row);
  1373. e.insurance = transformCal(e.insurance, this.oldExchange, row);
  1374. e.price = sellingCal(e.productPrice, row);
  1375. e.amount = amountCal(
  1376. e.price,
  1377. e.orderQuantity,
  1378. e.freight,
  1379. e.insurance,
  1380. e.discount
  1381. );
  1382. e.itemMargin = grossProfitCal(
  1383. e.purchaseAmount,
  1384. e.partsPrice,
  1385. e.price,
  1386. this.form.exchangeRate
  1387. );
  1388. e.exchangeRate = this.form.exchangeRate;
  1389. });
  1390. }
  1391. this.oldExchange = this.deepClone(row);
  1392. },
  1393. discountChange(row) {
  1394. if (row.discount >= 10) {
  1395. row.discount = null;
  1396. this.$message.error("请正确输入折扣");
  1397. }
  1398. this.priceChange(row);
  1399. },
  1400. taxRateChange(row) {
  1401. if (row.taxRate > 100) {
  1402. row.taxRate = 0;
  1403. this.$message.error("请正确输入税率");
  1404. }
  1405. },
  1406. saveShipping() {
  1407. if (!this.form.id) {
  1408. return this.$message.error("此单据没有提交记录,请先提交");
  1409. }
  1410. this.$confirm("是否生成船务询价单?", {
  1411. confirmButtonText: "确定",
  1412. cancelButtonText: "取消",
  1413. type: "warning"
  1414. }).then(() => {
  1415. saveShipping(this.form.id).then(res => {
  1416. if (res.data.code == 200) {
  1417. this.$message.success("生成成功");
  1418. }
  1419. });
  1420. });
  1421. },
  1422. savePurchase() {
  1423. if (!this.form.id) {
  1424. return this.$message.error("此单据没有提交记录,请先提交");
  1425. }
  1426. this.$confirm("是否生成采购询价单?", {
  1427. confirmButtonText: "确定",
  1428. cancelButtonText: "取消",
  1429. type: "warning"
  1430. }).then(() => {
  1431. savePurchase(this.form.id).then(res => {
  1432. if (res.data.code == 200) {
  1433. this.$message.success("生成成功");
  1434. }
  1435. });
  1436. });
  1437. },
  1438. rowSave(row) {
  1439. this.$set(row, "$cellEdit", false);
  1440. },
  1441. rowDel(row, index) {
  1442. this.$confirm("确定删除数据?", {
  1443. confirmButtonText: "确定",
  1444. cancelButtonText: "取消",
  1445. type: "warning"
  1446. }).then(() => {
  1447. if (row.id) {
  1448. delItem(row.id).then(res => {
  1449. this.$message({
  1450. type: "success",
  1451. message: "删除成功!"
  1452. });
  1453. this.data.splice(index, 1);
  1454. });
  1455. } else {
  1456. this.$message({
  1457. type: "success",
  1458. message: "删除成功!"
  1459. });
  1460. this.data.splice(index, 1);
  1461. }
  1462. });
  1463. },
  1464. importGoods() {
  1465. if (this.reData) {
  1466. if (this.selectionList.length != 1) {
  1467. return this.$message.error("重新选择的时候只能选择一条数据");
  1468. } else {
  1469. this.selectionList.forEach(e => {
  1470. this.data.forEach((item, index) => {
  1471. if (index == this.reData.index) {
  1472. item.itemId = e.id;
  1473. item.code = e.code;
  1474. item.cname = e.cname;
  1475. item.ename = e.ename;
  1476. item.corpId = e.corpId;
  1477. item.corpName = e.corpName;
  1478. item.priceCategory = e.goodsTypeName;
  1479. item.itemUrl = e.url;
  1480. item.itemProp = this.reData.itemProp;
  1481. item.remarksOne = this.reData.remarksOne;
  1482. item.customTwo = this.reData.customTwo;
  1483. item.customThree = this.reData.customThree;
  1484. item.customFour = this.reData.customFour;
  1485. item.customFive = this.reData.customFive;
  1486. item.partsList = this.reData.partsList;
  1487. item.partsPrice = this.reData.partsPrice;
  1488. item.itemDescription = e.cnameDescription;
  1489. item.itemType = this.reData.itemType;
  1490. item.tradeTerms = this.reData.tradeTerms;
  1491. item.partsDescribe = this.reData.partsDescribe;
  1492. item.purchaseCost = 0;
  1493. item.purchaseAmount = 0;
  1494. item.productPrice = productCal(
  1495. 0,
  1496. this.reData.partsPrice,
  1497. this.form.coefficient
  1498. );
  1499. item.price = sellingCal(
  1500. productCal(0, this.reData.partsPrice, this.form.coefficient),
  1501. this.form.exchangeRate
  1502. );
  1503. item.orderQuantity = this.reData.orderQuantity;
  1504. item.insurance = this.reData.insurance;
  1505. item.freight = this.reData.freight;
  1506. item.discount = this.reData.discount;
  1507. item.amount = amountCal(
  1508. sellingCal(
  1509. productCal(
  1510. 0,
  1511. this.reData.partsPrice,
  1512. this.form.coefficient
  1513. ),
  1514. this.form.exchangeRate
  1515. ),
  1516. this.reData.orderQuantity,
  1517. this.reData.freight,
  1518. this.reData.insurance,
  1519. this.reData.discount
  1520. );
  1521. item.taxRate = this.reData.taxRate;
  1522. item.itemMargin = grossProfitCal(
  1523. 0,
  1524. this.reData.partsPrice,
  1525. sellingCal(
  1526. productCal(
  1527. 0,
  1528. this.reData.partsPrice,
  1529. this.form.coefficient
  1530. ),
  1531. this.form.exchangeRate
  1532. ),
  1533. this.form.exchangeRate
  1534. );
  1535. item.unit = e.unit;
  1536. item.remarks = this.reData.remarks;
  1537. item.exchangeRate = this.reData.exchangeRate;
  1538. item.$cellEdit = true;
  1539. }
  1540. });
  1541. });
  1542. }
  1543. } else {
  1544. this.selectionList.forEach(e => {
  1545. this.data.push({
  1546. itemId: e.id,
  1547. code: e.code,
  1548. cname: e.cname,
  1549. ename: e.ename,
  1550. corpId: e.corpId,
  1551. corpName: e.corpName,
  1552. priceCategory: e.goodsTypeName,
  1553. itemUrl: e.url,
  1554. itemProp: null,
  1555. remarksOne: null,
  1556. customTwo: null,
  1557. customThree: null,
  1558. customFour: null,
  1559. customFive: null,
  1560. itemDescription: e.cnameDescription,
  1561. partsList: [],
  1562. partsPrice: 0,
  1563. itemType: null,
  1564. tradeTerms: null,
  1565. purchaseCost: 0,
  1566. purchaseAmount: 0,
  1567. price: 0,
  1568. orderQuantity: 0,
  1569. insurance: 0,
  1570. freight: 0,
  1571. discount: null,
  1572. amount: 0,
  1573. taxRate: 0,
  1574. unit: e.unit,
  1575. itemMargin: 0,
  1576. remarks: null,
  1577. exchangeRate: this.form.exchangeRate,
  1578. partsDescribe: null,
  1579. $cellEdit: true
  1580. });
  1581. });
  1582. }
  1583. this.dialogVisible = false;
  1584. },
  1585. closeGoods() {
  1586. this.selectionList = [];
  1587. this.treeDeptId = "";
  1588. this.reData = null;
  1589. },
  1590. selectionChange(list) {
  1591. this.selectionList = list;
  1592. },
  1593. rowClick(row) {
  1594. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  1595. },
  1596. nodeClick(data) {
  1597. this.treeDeptId = data.id;
  1598. this.page.currentPage = 1;
  1599. this.onLoad(this.page);
  1600. },
  1601. searchChange(params, done) {
  1602. this.search = this.deepClone(params);
  1603. this.onLoad(this.page, params);
  1604. done();
  1605. },
  1606. //费用查询
  1607. onLoad(page, params = {}) {
  1608. let obj = this.deepClone(Object.assign(params, this.search));
  1609. this.loading = true;
  1610. getGoods(page.currentPage, page.pageSize, this.treeDeptId, obj)
  1611. .then(res => {
  1612. const data = res.data.data;
  1613. this.page.total = data.total;
  1614. this.goodsList = data.records;
  1615. if (this.page.total) {
  1616. this.goodsOption.height = window.innerHeight - 350;
  1617. }
  1618. })
  1619. .finally(() => {
  1620. this.loading = false;
  1621. });
  1622. },
  1623. importLibray(rows) {
  1624. rows.forEach(e => {
  1625. console.log(e);
  1626. this.data.push({
  1627. itemId: e.itemId,
  1628. code: e.code,
  1629. cname: e.cname,
  1630. ename: e.ename,
  1631. priceCategory: e.goodsTypeName,
  1632. purchaseCost: costCal(e.price, e.taxRate),
  1633. purchaseAmount: e.purchaseAmount,
  1634. itemProp: null,
  1635. remarksOne: null,
  1636. customTwo: null,
  1637. customThree: null,
  1638. customFour: null,
  1639. customFive: null,
  1640. corpId: e.corpId,
  1641. corpName: e.corpName,
  1642. itemDescription: e.cnameDescription,
  1643. partsList: [],
  1644. partsPrice: 0,
  1645. itemType: e.specs,
  1646. tradeTerms: null,
  1647. productPrice: productCal(e.purchaseAmount, 0, this.form.coefficient),
  1648. price: sellingCal(
  1649. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1650. this.form.exchangeRate
  1651. ),
  1652. orderQuantity: 1,
  1653. insurance: 0,
  1654. freight: 0,
  1655. discount: null,
  1656. amount: sellingCal(
  1657. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1658. this.form.exchangeRate
  1659. ),
  1660. taxRate: 0,
  1661. unit: e.unit,
  1662. itemMargin: grossProfitCal(
  1663. e.purchaseAmount,
  1664. 0,
  1665. sellingCal(
  1666. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1667. this.form.exchangeRate
  1668. ),
  1669. this.form.exchangeRate
  1670. ),
  1671. partsDescribe: null,
  1672. remarks: null,
  1673. exchangeRate: this.form.exchangeRate,
  1674. $cellEdit: true
  1675. });
  1676. });
  1677. },
  1678. //商品明细导入
  1679. newDetails() {
  1680. if (!this.form.corpId) {
  1681. return this.$message.error("请选择客户名称");
  1682. }
  1683. this.dialogVisible = !this.dialogVisible;
  1684. },
  1685. getDetail(id) {
  1686. this.loading = true;
  1687. this.showBut = false;
  1688. this.pageLoading = true;
  1689. detail(id)
  1690. .then(res => {
  1691. if (this.detailData.status == "copy") {
  1692. delete res.data.data.id;
  1693. delete res.data.data.sysNo;
  1694. delete res.data.data.orderNo;
  1695. delete res.data.data.orgOrderNo;
  1696. delete res.data.data.createTime;
  1697. delete res.data.data.createUser;
  1698. delete res.data.data.createUserName;
  1699. delete res.data.data.updateTime;
  1700. delete res.data.data.updateUser;
  1701. delete res.data.data.updateUserName;
  1702. delete res.data.data.morderNo;
  1703. delete res.data.data.status;
  1704. delete res.data.data.ifEnquiry;
  1705. delete res.data.data.ifShipping;
  1706. res.data.data.orderStatus = "录入";
  1707. res.data.data.orderItemsList.forEach(e => {
  1708. delete e.id;
  1709. delete e.pid;
  1710. delete e.createTime;
  1711. delete e.createUser;
  1712. delete e.updateTime;
  1713. delete e.updateUser;
  1714. delete e.orgOrderNo;
  1715. delete e.srcId;
  1716. delete e.status;
  1717. delete e.isDeleted;
  1718. });
  1719. res.data.data.orderFeesList.forEach(e => {
  1720. delete e.id;
  1721. delete e.pid;
  1722. delete e.createTime;
  1723. delete e.createUser;
  1724. delete e.updateTime;
  1725. delete e.updateUser;
  1726. delete e.status;
  1727. delete e.isDeleted;
  1728. });
  1729. res.data.data.orderFilesList.forEach(e => {
  1730. delete e.id;
  1731. delete e.pid;
  1732. delete e.createTime;
  1733. delete e.createUser;
  1734. delete e.updateTime;
  1735. delete e.updateUser;
  1736. delete e.status;
  1737. delete e.isDeleted;
  1738. });
  1739. }
  1740. this.form = res.data.data;
  1741. this.data = res.data.data.orderItemsList;
  1742. this.orderFeesList = res.data.data.orderFeesList;
  1743. this.orderFilesList = res.data.data.orderFilesList;
  1744. this.oldform = res.data.data;
  1745. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1746. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  1747. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  1748. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1749. })
  1750. .finally(() => {
  1751. this.loading = false;
  1752. this.showBut = true;
  1753. this.pageLoading = false;
  1754. });
  1755. },
  1756. //修改提交触发
  1757. editCustomer(status) {
  1758. this.$refs["form"].validate((valid, done) => {
  1759. done();
  1760. if (valid) {
  1761. let orderFeesList = this.$refs.feeInfo.submitData();
  1762. let amountSum = 0;
  1763. let reSum = 0;
  1764. let costSum = 0;
  1765. let paySum = 0;
  1766. if (this.data.length > 0) {
  1767. for (let i = 0; i < this.data.length; i++) {
  1768. if (this.data[i].corpId == null) {
  1769. return this.$message.error(`请输入第${i + 1}行的供应商`);
  1770. }
  1771. amountSum = _.add(
  1772. amountSum,
  1773. _.multiply(
  1774. numCal(this.data[i].amount),
  1775. numCal(this.data[i].exchangeRate)
  1776. )
  1777. );
  1778. costSum = _.add(
  1779. costSum,
  1780. _.multiply(
  1781. _.add(
  1782. numCal(this.data[i].purchaseAmount),
  1783. numCal(this.data[i].partsPrice)
  1784. ),
  1785. numCal(this.data[i].orderQuantity)
  1786. )
  1787. );
  1788. }
  1789. this.data.forEach(e => {
  1790. const ename = e.ename ? e.ename : "";
  1791. const itemProp = e.itemProp ? e.itemProp : "";
  1792. const partsDescribe = e.partsDescribe ? e.partsDescribe : "";
  1793. e.productRemark = ename + "\n" + itemProp + " " + partsDescribe;
  1794. });
  1795. }
  1796. for (let i = 0; i < orderFeesList.length; i++) {
  1797. if (orderFeesList[i].corpId == null) {
  1798. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  1799. }
  1800. if (orderFeesList[i].price == 0) {
  1801. return this.$message.error(`请正确输入第${i + 1}行的销售价`);
  1802. }
  1803. if (orderFeesList[i].orderQuantity == 0) {
  1804. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  1805. }
  1806. if (!orderFeesList[i].currency) {
  1807. return this.$message.error(`请正确选择第${i + 1}行的币别`);
  1808. }
  1809. if (!orderFeesList[i].exchangeRate) {
  1810. return this.$message.error(`请正确输入第${i + 1}行的汇率`);
  1811. }
  1812. if (orderFeesList[i].feesType == 1) {
  1813. reSum = _.add(
  1814. reSum,
  1815. _.multiply(
  1816. numCal(orderFeesList[i].amount),
  1817. numCal(orderFeesList[i].exchangeRate)
  1818. )
  1819. );
  1820. }
  1821. if (orderFeesList[i].feesType == 2) {
  1822. paySum = _.add(
  1823. paySum,
  1824. _.multiply(
  1825. numCal(orderFeesList[i].amount),
  1826. numCal(orderFeesList[i].exchangeRate)
  1827. )
  1828. );
  1829. }
  1830. }
  1831. this.form.singleTicketMargin = STGPCal(
  1832. amountSum,
  1833. reSum,
  1834. costSum,
  1835. paySum
  1836. );
  1837. this.subLoading = true;
  1838. submit({
  1839. ...this.form,
  1840. orderItemsList: this.data,
  1841. orderFeesList: orderFeesList,
  1842. orderFilesList: this.orderFilesList
  1843. })
  1844. .then(res => {
  1845. if (res.data.code == 200) {
  1846. this.$message.success("保存成功");
  1847. this.form = res.data.data;
  1848. this.data = res.data.data.orderItemsList;
  1849. this.orderFeesList = res.data.data.orderFeesList;
  1850. this.orderFilesList = res.data.data.orderFilesList;
  1851. this.oldform = res.data.data;
  1852. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1853. this.oldorderFeesList = this.deepClone(
  1854. res.data.data.orderFeesList
  1855. );
  1856. this.oldorderFilesList = this.deepClone(
  1857. res.data.data.orderFilesList
  1858. );
  1859. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1860. if (status == "goBack") {
  1861. if (this.form.id) {
  1862. this.unLock({
  1863. moduleName: "bj",
  1864. tableName: "business_order",
  1865. billId: this.form.id,
  1866. billNo: this.form.orgOrderNo
  1867. });
  1868. }
  1869. this.$emit("goBack");
  1870. this.leaveDetailsKey(this.$route.name);
  1871. }
  1872. }
  1873. })
  1874. .finally(() => {
  1875. this.subLoading = false;
  1876. });
  1877. } else {
  1878. return false;
  1879. }
  1880. });
  1881. },
  1882. //返回列表
  1883. backToList() {
  1884. let orderFeesList = this.$refs.feeInfo.submitData();
  1885. if (
  1886. contrastObj(this.form, this.oldform) ||
  1887. contrastList(this.data, this.olddata) ||
  1888. contrastList(orderFeesList, this.oldorderFeesList) ||
  1889. contrastList(this.orderFilesList, this.oldorderFilesList)
  1890. ) {
  1891. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1892. confirmButtonText: "确定",
  1893. cancelButtonText: "取消",
  1894. type: "warning"
  1895. })
  1896. .then(() => {
  1897. this.editCustomer("goBack");
  1898. })
  1899. .catch(() => {
  1900. if (this.form.id) {
  1901. this.unLock({
  1902. moduleName: "bj",
  1903. tableName: "business_order",
  1904. billId: this.form.id,
  1905. billNo: this.form.orgOrderNo
  1906. });
  1907. }
  1908. this.$emit("goBack");
  1909. this.leaveDetailsKey(this.$route.name);
  1910. });
  1911. } else {
  1912. if (this.form.id) {
  1913. this.unLock({
  1914. moduleName: "bj",
  1915. tableName: "business_order",
  1916. billId: this.form.id,
  1917. billNo: this.form.orgOrderNo
  1918. });
  1919. }
  1920. this.$emit("goBack");
  1921. this.leaveDetailsKey(this.$route.name);
  1922. }
  1923. },
  1924. openReport() {
  1925. this.switchDialog = !this.switchDialog;
  1926. },
  1927. openProperty(row, index) {
  1928. this.$refs.property.init(row, index);
  1929. },
  1930. onClose(val) {
  1931. this.switchDialog = val;
  1932. },
  1933. summaryMethod({ columns, data }) {
  1934. const sums = [];
  1935. if (columns.length > 0) {
  1936. columns.forEach((item, index) => {
  1937. sums[0] = "合计";
  1938. if (
  1939. item.property == "orderQuantity" ||
  1940. item.property == "amount" ||
  1941. item.property == "insurance" ||
  1942. item.property == "freight"
  1943. ) {
  1944. let qtySum = 0;
  1945. let amountSum = 0;
  1946. let insuranceSum = 0;
  1947. let freightSum = 0;
  1948. data.forEach(e => {
  1949. qtySum = _.add(qtySum, Number(e.orderQuantity));
  1950. amountSum = _.add(amountSum, Number(e.amount));
  1951. insuranceSum = _.add(insuranceSum, Number(e.insurance));
  1952. freightSum = _.add(freightSum, Number(e.freight));
  1953. });
  1954. //数量总计
  1955. if (item.property == "orderQuantity") {
  1956. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  1957. }
  1958. //金额总计
  1959. if (item.property == "amount") {
  1960. sums[index] = micrometerFormat(amountSum);
  1961. }
  1962. //保险总计
  1963. if (item.property == "insurance") {
  1964. sums[index] = micrometerFormat(insuranceSum);
  1965. }
  1966. //运费总计
  1967. if (item.property == "freight") {
  1968. sums[index] = micrometerFormat(freightSum);
  1969. }
  1970. }
  1971. });
  1972. }
  1973. return sums;
  1974. },
  1975. //费用明细回调
  1976. beforeFinance(feesData, callback) {
  1977. this.advantageProjectData = feesData;
  1978. let params = {};
  1979. //暂时默认通过 之后优化
  1980. params.valid = true;
  1981. params.parentId = this.form.id;
  1982. params.srcOrderno = this.form.orderNo;
  1983. callback(params);
  1984. },
  1985. openEdit() {
  1986. const data = {
  1987. moduleName: "bj",
  1988. tableName: "business_order",
  1989. billId: this.form.id,
  1990. no: localStorage.getItem("browserID"),
  1991. billNo: this.form.orgOrderNo
  1992. };
  1993. this.inDetailsKey(this.$route.name, {
  1994. moduleName: "bj",
  1995. tableName: "business_order",
  1996. billId: this.form.id,
  1997. billNo: this.form.orgOrderNo
  1998. });
  1999. this.checkLock(data).then(res => {
  2000. if (res.data.code == 200) {
  2001. this.onLock(data).then(res => {
  2002. if (res.data.code == 200) {
  2003. this.detailData.status = 2;
  2004. this.option = this.$options.data().option;
  2005. }
  2006. });
  2007. }
  2008. });
  2009. },
  2010. async saveColumn() {
  2011. const inSave = await this.saveColumnData(
  2012. this.getColumnName(1),
  2013. this.tableOption
  2014. );
  2015. if (inSave) {
  2016. this.$message.success("保存成功");
  2017. //关闭窗口
  2018. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  2019. }
  2020. },
  2021. async resetColumn() {
  2022. this.tableOption = tableOption;
  2023. const inSave = await this.delColumnData(
  2024. this.getColumnName(1),
  2025. tableOption
  2026. );
  2027. if (inSave) {
  2028. this.$message.success("重置成功");
  2029. //关闭窗口
  2030. setTimeout(() => {
  2031. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  2032. }, 1000);
  2033. }
  2034. },
  2035. async saveGoodsColumn() {
  2036. const inSave = await this.saveColumnData(
  2037. this.getColumnName(26),
  2038. this.goodsOption
  2039. );
  2040. if (inSave) {
  2041. this.$message.success("保存成功");
  2042. //关闭窗口
  2043. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  2044. }
  2045. },
  2046. async resetGoodsColumn() {
  2047. this.goodsOption = goodsOption;
  2048. const inSave = await this.delColumnData(
  2049. this.getColumnName(26),
  2050. goodsOption
  2051. );
  2052. if (inSave) {
  2053. this.$message.success("重置成功");
  2054. //关闭窗口
  2055. setTimeout(() => {
  2056. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  2057. }, 1000);
  2058. }
  2059. }
  2060. },
  2061. watch: {
  2062. "form.corpId": function(id) {
  2063. if (id) {
  2064. this.corpsattns = [];
  2065. getCorpsattn({ pid: id }).then(res => {
  2066. this.corpsattns = res.data.data.records;
  2067. });
  2068. }
  2069. }
  2070. }
  2071. };
  2072. </script>
  2073. <style lang="scss" scoped>
  2074. .trading-form ::v-deep .el-form-item {
  2075. margin-bottom: 8px !important;
  2076. }
  2077. ::v-deep .el-form-item__error {
  2078. display: none !important;
  2079. }
  2080. ::v-deep .select-component {
  2081. display: flex !important;
  2082. }
  2083. </style>