detailsPage.vue 103 KB

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