detailsPage.vue 71 KB

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