detailsPage.vue 68 KB

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