detailsPage.vue 71 KB

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