detailsPage.vue 68 KB

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