detailsPage.vue 101 KB

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