detailsPageEdit.vue 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="editHandle"
  15. type="primary"
  16. style="margin-right: 8px"
  17. :loading="saveLoading"
  18. >编 辑</el-button>
  19. <el-dropdown style="margin-right: 8px;">
  20. <el-button
  21. type="primary"
  22. size="small"
  23. :loading="saveLoading"
  24. >
  25. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  26. </el-button>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item :disabled="browse || detailData.seeDisabled" @click.native="pleaseCheck">请核数据</el-dropdown-item>
  29. <el-dropdown-item v-if="form.status > 0" @click.native="checkScheduleDialog = true,checkId=form.id">审核进度</el-dropdown-item>
  30. <el-dropdown-item v-if="form.status == 1" @click.native="repealCancel">撤销请核</el-dropdown-item>
  31. <el-dropdown-item v-if="checkDisabled && form.status != 3" @click.native="changeApproveOpen">特殊审批</el-dropdown-item>
  32. <el-dropdown-item v-if="form.status == 3" :disabled="detailData.seeDisabled || form.specialCheckStatus > 0" @click.native="arrearsPleaseCheck">欠款发货审批</el-dropdown-item>
  33. </el-dropdown-menu>
  34. </el-dropdown>
  35. <el-dropdown style="margin-right: 8px;">
  36. <el-button
  37. type="warning"
  38. size="small"
  39. :loading="saveLoading"
  40. >
  41. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  42. </el-button>
  43. <el-dropdown-menu slot="dropdown">
  44. <!-- <el-dropdown-item-->
  45. <!-- :disabled="detailData.seeDisabled || form.status != 3"-->
  46. <!-- @click.native="applySettlement('收费')">生成账单-->
  47. <!-- </el-dropdown-item>-->
  48. <el-dropdown-item
  49. @click.native="openApplicationDialog"
  50. :disabled="!form.id"
  51. >查看账单
  52. </el-dropdown-item>
  53. </el-dropdown-menu>
  54. </el-dropdown>
  55. <el-dropdown style="margin-right: 8px;">
  56. <el-button
  57. type="success"
  58. :loading="saveLoading"
  59. size="small"
  60. >
  61. 业务处理<i class="el-icon-arrow-down el-icon--right"></i>
  62. </el-button>
  63. <el-dropdown-menu slot="dropdown">
  64. <el-dropdown-item
  65. :disabled="detailData.seeDisabled || form.status != 3 || form.createPurchase == 1"
  66. @click.native="saveSell">生成采购
  67. </el-dropdown-item>
  68. <el-dropdown-item
  69. :disabled="detailData.seeDisabled || !this.form.id"
  70. @click.native="copyOrder"
  71. >复制单据</el-dropdown-item>
  72. </el-dropdown-menu>
  73. </el-dropdown>
  74. <el-button
  75. class="el-button--small-yh"
  76. type="primary"
  77. :disabled="disabled || detailData.seeDisabled"
  78. :loading="saveLoading"
  79. size="small"
  80. @click="editCustomer(false)"
  81. >保 存
  82. </el-button>
  83. <div v-if="checkDisabled" style="float: right;margin-left: 8px">
  84. <el-button type="primary"
  85. size="small"
  86. class="el-button--small-yh"
  87. @click.stop="openCheckDialog">
  88. 审批
  89. </el-button>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="customer-main">
  94. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  95. <containerTitle title="基础资料"></containerTitle>
  96. <basic-container :showBtn="true">
  97. <el-row>
  98. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8" :class="{isShow: item.display}">
  99. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  100. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  101. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled || browse"/>
  102. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  103. size="small" type="date" placeholder="选择日期"
  104. value-format="yyyy-MM-dd HH:mm:ss"
  105. :disabled="detailData.seeDisabled || browse"/>
  106. <crop-select
  107. v-else-if="item.prop === 'corpId'"
  108. v-model="form[item.prop]"
  109. @getCorpData="getCorpRow"
  110. corpType="KH"
  111. :disabled="detailData.seeDisabled || browse || !form.belongToCorpId"
  112. style="width: 100%"
  113. ref="KHSelect"
  114. :belongtocompany="form.belongToCorpId"
  115. ></crop-select>
  116. <crop-select
  117. v-else-if="item.prop === 'belongToCorpId'"
  118. v-model="form[item.prop]"
  119. @getCorpData="returnBack"
  120. corpType="GS"
  121. :disabled="detailData.seeDisabled || browse"
  122. ></crop-select>
  123. <crop-select
  124. v-else-if="item.prop === 'productionPlant'"
  125. v-model="form[item.prop]"
  126. @getCorpData="getPlantRow"
  127. corpType="GYS"
  128. :disabled="detailData.seeDisabled || browse"
  129. style="width: 100%"
  130. ></crop-select>
  131. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse">
  132. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  133. </el-select>
  134. <el-select v-else-if="item.prop === 'packageRemarks'" v-model="form[item.prop]" placeholder="请选择" clearable filterable allow-create default-first-option style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse">
  135. <el-option v-for="(item,index) in packageOptions" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  136. </el-select>
  137. <el-select v-else-if="item.prop === 'arrivalAddress'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse" allow-create default-first-option>
  138. <el-option v-for="(item,index) in arrivalOptions" :key="index" :label="item.label" :value="item.label"></el-option>
  139. </el-select>
  140. <el-select v-else-if="item.prop === 'shippingAddress'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse" allow-create default-first-option>
  141. <el-option v-for="(item,index) in shippingOptions" :key="index" :label="item.label" :value="item.label"></el-option>
  142. </el-select>
  143. <el-select v-else-if="item.prop === 'banks'"
  144. v-model="form[item.prop]" placeholder="请选择"
  145. clearable
  146. filterable
  147. allow-create
  148. default-first-option
  149. size="small"
  150. style="width: 100%;"
  151. @change="banksChange"
  152. :disabled="detailData.seeDisabled || browse">
  153. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  154. </el-select>
  155. <el-select v-else-if="item.prop === 'corpAttn'"
  156. v-model="form[item.prop]" placeholder="请选择"
  157. clearable
  158. filterable
  159. allow-create
  160. default-first-option
  161. size="small"
  162. style="width: 100%;"
  163. @change="corpAttnChange"
  164. :disabled="detailData.seeDisabled || browse">
  165. <el-option v-for="(item,index) in khInfoList" :key="index" :label="item.cname" :value="item.id"></el-option>
  166. </el-select>
  167. <el-input
  168. v-else-if="item.type == 'number'"
  169. placeholder="请输入"
  170. v-input-limit="2"
  171. size="small"
  172. :disabled="item.disabled || detailData.seeDisabled || browse"
  173. v-model.trim="form[item.prop]"
  174. />
  175. <span v-else-if="item.type == 'radio'">
  176. <el-radio
  177. size="small"
  178. :disabled="item.disabled || detailData.seeDisabled || browse"
  179. v-model.trim="form[item.prop]"
  180. :label="1"
  181. >是</el-radio>
  182. <el-radio
  183. size="small"
  184. :disabled="item.disabled || detailData.seeDisabled || browse"
  185. v-model.trim="form[item.prop]"
  186. :label="0"
  187. >否</el-radio>
  188. </span>
  189. <el-select v-else-if="item.prop === 'chargeMember'"
  190. v-model="form[item.prop]" placeholder="请选择"
  191. filterable
  192. size="small"
  193. style="width: 100%;"
  194. :disabled="detailData.seeDisabled || browse">
  195. <el-option v-for="(item,index) in userList" :key="index" :label="item.cname" :value="item.cname"></el-option>
  196. </el-select>
  197. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || browse"></el-input>
  198. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || browse" clearable></el-input>
  199. </el-form-item>
  200. </el-col>
  201. </el-row>
  202. </basic-container>
  203. <containerTitle title="发货信息"></containerTitle>
  204. <basic-container :showBtn="true">
  205. <el-row>
  206. <el-col v-for="(item,index) in contactInformation.column" :key="index" :span="item.span?item.span:8" :class="{isShow: item.display == false}">
  207. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  208. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled || detailData.seeDisabled || browse"/>
  209. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  210. size="small" type="date" placeholder="选择日期"
  211. value-format="yyyy-MM-dd HH:mm:ss"
  212. :disabled="detailData.seeDisabled || browse"/>
  213. <el-input
  214. v-else-if="(item.prop === 'advancePayment') || (item.prop === 'orderAmount') ||
  215. (item.prop === 'settlmentAmount') || (item.prop === 'caseOverPayment') || (item.prop === 'thisUsedProfit') ||
  216. (item.prop === 'createProfit')"
  217. v-model.trim="form[item.prop]" size="small" autocomplete="off"
  218. @change="computedCost"
  219. :disabled="detailData.seeDisabled || item.disabled || browse"
  220. v-input-limit="2"
  221. ></el-input>
  222. <el-select v-else-if="item.prop === 'orderStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || item.disabled || browse">
  223. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  224. </el-select>
  225. <el-input type="age" v-else-if="item.prop === 'grossProfitRate'" v-model.trim="form[item.prop]" size="small" autocomplete="off" placeholder="请输入" :disabled="detailData.seeDisabled || browse" v-input-limit="2">
  226. <template slot="append">%</template>
  227. </el-input>
  228. <el-input type="age" v-else-if="item.prop === 'specialOfferOf'" v-model.trim="form[item.prop]" size="small" autocomplete="off" placeholder="请输入" :disabled="detailData.seeDisabled || browse" v-input-limit="2">
  229. <template slot="append">%</template>
  230. </el-input>
  231. <el-input type="age" v-else-if="item.prop === 'largeScale'" v-model.trim="form[item.prop]" size="small" autocomplete="off" placeholder="请输入" :disabled="detailData.seeDisabled || browse" v-input-limit="2">
  232. <template slot="append">%</template>
  233. </el-input>
  234. <el-input
  235. v-else-if="item.type == 'number'"
  236. placeholder="请输入"
  237. v-input-limit="2"
  238. size="small"
  239. :disabled="item.disabled || detailData.seeDisabled || browse"
  240. v-model.trim="form[item.prop]"
  241. />
  242. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || browse"></el-input>
  243. <el-input v-else type="age" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || browse"></el-input>
  244. </el-form-item>
  245. </el-col>
  246. </el-row>
  247. </basic-container>
  248. <containerTitle title="商品信息"></containerTitle>
  249. <basic-container style="margin-bottom: 10px">
  250. <avue-crud
  251. :option="customerContact"
  252. v-model="contactsForm"
  253. :data="goodsShowData"
  254. ref="crudContact"
  255. @row-save="rowSave"
  256. @row-click="handleRowClick"
  257. @row-update="rowUpdate"
  258. @selection-change="productSelection"
  259. @row-del="rowDel"
  260. @saveColumn="saveColumn('goods')"
  261. @resetColumn="resetColumn"
  262. :summary-method="summaryMethod"
  263. :table-loading="goodsLoading"
  264. :key="index"
  265. >
  266. <template slot="headerSerial">
  267. <span class="order_number">序号</span>
  268. <el-button class="number_button" type="primary" icon="el-icon-circle-plus-outline" circle size="mini" @click="$refs.crudContact.rowCellAdd()"></el-button>
  269. </template>
  270. <!-- <template slot="corpId" slot-scope="{ row, index }">-->
  271. <!-- <crop-select-->
  272. <!-- v-if="row.$cellEdit"-->
  273. <!-- v-model="row.corpId"-->
  274. <!-- :cropIndex="index"-->
  275. <!-- corpType="GYS"-->
  276. <!-- @getCorpData="getcorpId"-->
  277. <!-- :disabled="detailData.seeDisabled || browse"-->
  278. <!-- ></crop-select>-->
  279. <!-- <span v-else>{{ row.corpName }}</span>-->
  280. <!-- </template>-->
  281. <template slot="code" slot-scope="{row}">
  282. <el-button
  283. type="text"
  284. size="mini"
  285. style="padding:4px 10px;float:left"
  286. @click="commodityChoice(row)"
  287. :disabled="detailData.seeDisabled || !row.$cellEdit || browse">选择</el-button>
  288. <span>{{ row.code }}</span>
  289. </template>
  290. <template slot="purchaseAmount" slot-scope="{ row }">
  291. <el-select
  292. v-if="row.$cellEdit"
  293. v-model="row.purchaseAmount"
  294. @focus="getPurchasePrice(row)"
  295. allow-create
  296. filterable
  297. v-input-limit="2"
  298. default-first-option
  299. >
  300. <el-option
  301. v-for="(item, index) in purchasePriceOption"
  302. :key="index"
  303. :label="item.purchasePrice"
  304. :value="item.purchasePrice"></el-option>
  305. </el-select>
  306. <span v-else>{{ row.purchaseAmount }}</span>
  307. </template>
  308. <template slot="price" slot-scope="{ row }">
  309. <el-select
  310. v-if="false"
  311. v-model="row.price"
  312. @focus="getMarketPrice(row)"
  313. @input="priceChange(row)"
  314. allow-create
  315. filterable
  316. v-input-limit="2"
  317. default-first-option
  318. >
  319. <el-option
  320. v-for="(item, index) in salesPriceOtion"
  321. :key="index"
  322. :label="item.salePrice"
  323. :value="item.salePrice"></el-option>
  324. </el-select>
  325. <span v-else>{{ row.price }}</span>
  326. </template>
  327. <template slot="amount" slot-scope="{ row }">
  328. <span>{{ row.amount | decimalFormat }}</span>
  329. </template>
  330. <template slot="actualQuantity" slot-scope="{ row }">
  331. <span>{{ row.actualQuantity | IntegerFormat }}</span>
  332. </template>
  333. <template slot="orderQuantity" slot-scope="{ row }">
  334. <el-input
  335. v-if="row.$cellEdit"
  336. v-model.trim="row.orderQuantity"
  337. oninput='this.value=this.value.replace(/[^(\d)]/g,"")'
  338. size="small"
  339. @input="quantityChange(row)"
  340. ></el-input>
  341. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  342. </template>
  343. <template slot="shopQuality" slot-scope="{ row }">
  344. <el-switch
  345. v-model="row.shopQuality"
  346. :disabled="!row.$cellEdit || shopQualityDisable"
  347. :active-value="1"
  348. :inactive-value="0"
  349. @change="(val) => shopQualityChange(val, row)"
  350. ></el-switch>
  351. </template>
  352. <template slot-scope="{row,index}" slot="menu">
  353. <el-button
  354. type="text"
  355. size="small"
  356. @click="rowCell(row,index)"
  357. :disabled="detailData.seeDisabled || browse"
  358. >{{ row.$cellEdit ? '保 存' : '修 改' }}
  359. </el-button>
  360. <el-button
  361. size="small"
  362. icon="el-icon-delete"
  363. type="text"
  364. @click="rowDel(row, index)"
  365. :disabled="detailData.seeDisabled || browse"
  366. >删 除</el-button>
  367. </template>
  368. <template slot="menuLeft" slot-scope="{size}">
  369. <el-tabs v-model="goodsActives" @tab-click="handleClick" :before-leave="beforeLeave">
  370. <el-tab-pane label="商品" name="goods" :key="'first'" :disabled="goodsDisabled">
  371. </el-tab-pane>
  372. <el-tab-pane label="赠品" name="gift" :key="'second'" :disabled="goodsDisabled">
  373. </el-tab-pane>
  374. </el-tabs>
  375. <el-button type="primary"
  376. icon="el-icon-plus"
  377. size="small"
  378. @click="commoditySelection"
  379. :disabled="detailData.seeDisabled || browse">录入明细
  380. </el-button>
  381. <el-button type="primary"
  382. icon="el-icon-plus"
  383. size="small"
  384. @click="policy"
  385. :disabled="detailData.seeDisabled || !form.corpId || browse"
  386. v-show="goodsActives == 'goods'"
  387. >政策
  388. </el-button>
  389. <!-- 禁用规则:未选择明细,未点击编辑按钮,未进行审批,已经生成过-->
  390. <el-button type="warning"
  391. icon="el-icon-plus"
  392. size="small"
  393. :disabled="selection.length < 1 || detailData.seeDisabled || !form.status || form.status < 3 || form.createFreight == 1"
  394. @click="getShipmentD"
  395. v-show="goodsActives == 'goods'">生成客户收货
  396. </el-button>
  397. <el-button type="info"
  398. :size="size"
  399. icon="el-icon-printer"
  400. @click.stop="openReport()"
  401. v-show="goodsActives == 'goods'"
  402. >报表打印</el-button>
  403. <el-button
  404. type="primary"
  405. size="small"
  406. icon="el-icon-download"
  407. @click="downloadHandle"
  408. v-show="goodsActives == 'goods'"
  409. >下载模板</el-button>
  410. <el-upload
  411. :action="baseURL"
  412. :headers="headers"
  413. :disabled="detailData.seeDisabled || browse"
  414. :on-progress="uploading"
  415. :show-file-list=false
  416. accept=".xls,.xlsx"
  417. multiple
  418. :on-success="importTemplate"
  419. :on-error="uploadError"
  420. style="float: right"
  421. >
  422. <el-button
  423. type="primary"
  424. size="small"
  425. icon="el-icon-upload"
  426. v-show="goodsActives == 'goods'"
  427. :disabled="detailData.seeDisabled || browse"
  428. >导 入</el-button>
  429. </el-upload>
  430. <el-button
  431. type="warning"
  432. icon="el-icon-refresh"
  433. size="small"
  434. @click="resetStock"
  435. >库存刷新</el-button>
  436. <el-button
  437. type="danger"
  438. icon="el-icon-delete"
  439. size="small"
  440. @click="removeList"
  441. :disabled="(selection.length == 0) || detailData.seeDisabled || browse"
  442. >删除</el-button>
  443. </template>
  444. </avue-crud>
  445. </basic-container>
  446. <fee-info
  447. ref="feeInfo"
  448. :orderFeesList="advantageProjectData"
  449. :disabled="detailData.seeDisabled || form.status >= 3"
  450. feeUrl="/blade-purchase-sales/orderfees/update"
  451. optionType="GN"
  452. itemType="销售"
  453. @beforeFinance="beforeFinance"
  454. :corpId="form.corpId"
  455. :financeDisabled="false"
  456. :tabShow="2"
  457. />
  458. <containerTitle title="上传附件"></containerTitle>
  459. <c-upload
  460. :data="bankOfDepositData"
  461. deleteUrl="/api/blade-client/corpsbank/update"
  462. :enumerationValue="77"
  463. display
  464. />
  465. </el-form>
  466. </div>
  467. <el-dialog
  468. title="导入商品"
  469. append-to-body
  470. class="el-dialogDeep"
  471. :visible.sync="dialogVisible"
  472. width="80%"
  473. :close-on-click-modal="false"
  474. :destroy-on-close="true"
  475. :close-on-press-escape="false"
  476. @close="closeGoods">
  477. <el-row :style="{height: rowHeight}">
  478. <el-col :span="5" style="height: 100%;overflow-y: auto">
  479. <div>
  480. <el-scrollbar>
  481. <basic-container>
  482. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  483. </basic-container>
  484. </el-scrollbar>
  485. </div>
  486. </el-col>
  487. <el-col :span="19">
  488. <basic-container>
  489. <avue-crud :option="optionTwo"
  490. :table-loading="loading"
  491. :data="goodsListShow"
  492. ref="crud"
  493. @refresh-change="refreshChange"
  494. @selection-change="selectionChange"
  495. @search-change="goodsSearch"
  496. :page.sync="page"
  497. @on-load="onLoad">
  498. <template slot="menuLeft">
  499. <el-tabs v-model="activeName" @tab-click="tabHandle">
  500. <el-tab-pane label="查询结果" name="searchList"/>
  501. <el-tab-pane label="已选定数据" name="importStaging"/>
  502. </el-tabs>
  503. </template>
  504. <template slot="orderQuantity" slot-scope="{row}">
  505. <el-input-number
  506. v-model="row.orderQuantity"
  507. size="small"
  508. :controls="false"
  509. :precision="0"
  510. @input="amountChange(row)"
  511. style="width: 100%"
  512. />
  513. </template>
  514. <template slot-scope="scope" slot="menu">
  515. <el-button
  516. type="text"
  517. icon="el-icon-edit"
  518. size="small"
  519. @click.stop="importStagList(scope.row,scope.index)"
  520. v-if="activeName=='searchList'"
  521. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  522. >选择</el-button>
  523. <el-button
  524. type="text"
  525. icon="el-icon-delete"
  526. size="small"
  527. @click.stop="removeStagList(scope.row,scope.index)"
  528. v-else
  529. >移除</el-button>
  530. </template>
  531. </avue-crud>
  532. </basic-container>
  533. </el-col>
  534. </el-row>
  535. <span slot="footer" class="dialog-footer">
  536. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  537. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  538. <el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading" :disabled="tableData.length !== 1">导入</el-button>
  539. </span>
  540. </el-dialog>
  541. <el-dialog
  542. title="导入政策"
  543. append-to-body
  544. class="el-dialogDeep"
  545. :visible.sync="policyDialog"
  546. width="80%"
  547. :close-on-click-modal="false"
  548. :destroy-on-close="true"
  549. :close-on-press-escape="false"
  550. @close="closePolicy">
  551. <el-row :style="{height: rowHeight}">
  552. <el-col :span="5" style="height: 100%;overflow-y: auto">
  553. <div>
  554. <el-scrollbar>
  555. <basic-container>
  556. <avue-tree :option="policyOption" :data="treeDataPolicy" @node-click="policyNodeClick"/>
  557. </basic-container>
  558. </el-scrollbar>
  559. </div>
  560. </el-col>
  561. <el-col :span="19">
  562. <el-tabs v-model="activeName" @tab-click="tabHandleTwo">
  563. <el-tab-pane label="查询结果" name="searchList"/>
  564. <el-tab-pane label="已选定数据" name="importStaging"/>
  565. </el-tabs>
  566. <containerTitle title="特价促销"></containerTitle>
  567. <basic-container style="margin-bottom: 10px">
  568. <avue-crud :option="optionPolicy"
  569. :table-loading="loadingPolicy"
  570. :data="dataPolicy"
  571. ref="crud"
  572. :key="policyIndex"
  573. @selection-change="selectionChangePolicy"
  574. :page.sync="pagePolicy">
  575. <template slot-scope="scope" slot="menu">
  576. <el-button
  577. type="text"
  578. icon="el-icon-edit"
  579. size="mini"
  580. v-if="activeName=='searchList'"
  581. @click.stop="importStagList(scope.row,scope.index,'policy')"
  582. :disabled="goodsListPolicy.findIndex(item => item.id == scope.row.id) !== -1"
  583. >选择</el-button>
  584. <el-button
  585. type="text"
  586. icon="el-icon-delete"
  587. size="small"
  588. @click.stop="removeStagList(scope.row,scope.index,'policy')"
  589. v-else
  590. >移除</el-button>
  591. </template>
  592. <template slot="menuLeft">
  593. <el-button
  594. type="info"
  595. size="mini"
  596. icon="el-icon-download"
  597. @click="downLoadPolicy"
  598. >下载模板</el-button>
  599. <el-upload
  600. :action="policyUrl+'?policyName=' + uploadPolicy.policyName + '&salesType=1'"
  601. :headers="headers"
  602. :disabled="uploadPolicy.policyName === '' || loadingPolicy"
  603. :on-progress="uploading"
  604. :show-file-list=false
  605. accept=".xls,.xlsx"
  606. multiple
  607. :on-success="successPolicy"
  608. :on-error="uploadError"
  609. style="float: right"
  610. >
  611. <el-button
  612. type="warning"
  613. size="mini"
  614. icon="el-icon-upload"
  615. :disabled="uploadPolicy.policyName === '' || loadingPolicy"
  616. :loading="loadingPolicy"
  617. >导 入</el-button>
  618. <el-button
  619. type="primary"
  620. size="mini"
  621. icon="el-icon-search"
  622. @click="policyOnLoad"
  623. :disabled="uploadPolicy.policyName === '' || loadingPolicy"
  624. :loading="loadingPolicy"
  625. >政策明细</el-button>
  626. </el-upload>
  627. </template>
  628. <template slot="orderQuantity" slot-scope="{row}">
  629. <el-input-number
  630. v-model="row.orderQuantity"
  631. size="small"
  632. :controls="false"
  633. :precision="0"
  634. style="width: 100%"
  635. placeholder="请输入"
  636. />
  637. </template>
  638. </avue-crud>
  639. </basic-container>
  640. <containerTitle title="买赠促销"></containerTitle>
  641. <basic-container>
  642. <avue-crud
  643. :option="customerBuyFree"
  644. :data="contactsDataBuyFree"
  645. @selection-change="selectionChangePolicyTwo"
  646. :table-loading="loadingPolicy"
  647. ref="crudContactE">
  648. <template slot-scope="scope" slot="menu">
  649. <el-button
  650. type="text"
  651. icon="el-icon-edit"
  652. size="mini"
  653. v-if="activeName=='searchList'"
  654. @click.stop="importStagList(scope.row,scope.index,'policy_buyAndGive')"
  655. :disabled="buyAndGiveList.findIndex(item => item.id == scope.row.id) !== -1"
  656. >选择</el-button>
  657. <el-button
  658. type="text"
  659. icon="el-icon-delete"
  660. size="small"
  661. @click.stop="removeStagList(scope.row,scope.index,'policy_buyAndGive')"
  662. v-else
  663. >移除</el-button>
  664. </template>
  665. </avue-crud>
  666. </basic-container>
  667. </el-col>
  668. </el-row>
  669. <span slot="footer" class="dialog-footer">
  670. <el-button @click="policyDialog = false">取 消</el-button>
  671. <el-button
  672. type="primary"
  673. @click="importPolicy"
  674. :disabled="policyData.length === 0 && policyDataTwo.length === 0 && goodsListPolicy.length === 0 && buyAndGiveList.length === 0"
  675. :loading="saveLoading">导入</el-button>
  676. </span>
  677. </el-dialog>
  678. <el-dialog
  679. title="导入费用"
  680. append-to-body
  681. class="el-dialogDeep"
  682. :visible.sync="dialogCost"
  683. width="80%"
  684. top="8vh"
  685. :close-on-click-modal="false"
  686. :destroy-on-close="true"
  687. :close-on-press-escape="false"
  688. @close="closeFees">
  689. <el-row :style="{height: rowHeight}">
  690. <el-col :span="5" style="height: 100%;overflow-y: auto">
  691. <div>
  692. <el-scrollbar>
  693. <basic-container>
  694. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  695. </basic-container>
  696. </el-scrollbar>
  697. </div>
  698. </el-col>
  699. <el-col :span="19">
  700. <basic-container>
  701. <avue-crud :option="optionTwoCost"
  702. :table-loading="loadingCost"
  703. :data="dataCost"
  704. ref="crud"
  705. @refresh-change="refreshChangeCost"
  706. @selection-change="selectionChangeCost"
  707. :page.sync="pageCost"
  708. @search-change="feesSearch"
  709. @on-load="onLoadCost">
  710. </avue-crud>
  711. </basic-container>
  712. </el-col>
  713. </el-row>
  714. <span slot="footer" class="dialog-footer">
  715. <el-button @click="dialogCost = false">取 消</el-button>
  716. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  717. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  718. :disabled="tableDataCost.length !== 1">导入</el-button>
  719. </span>
  720. </el-dialog>
  721. <el-dialog
  722. title="账单"
  723. append-to-body
  724. class="el-dialogDeep"
  725. :visible.sync="applySettlementDialog"
  726. width="60%"
  727. :close-on-click-modal="false"
  728. :destroy-on-close="true"
  729. :close-on-press-escape="false"
  730. v-dialog-drag
  731. >
  732. <apply-payment
  733. :billType="billType"
  734. :billData="{}"
  735. itemType="销售"
  736. :arrList="applyPaymentList"
  737. @choceFun="choceFun"
  738. >
  739. </apply-payment>
  740. </el-dialog>
  741. <report-dialog
  742. :switchDialog="switchDialog"
  743. :reportId="form.id"
  744. reportName="销售明细(N)"
  745. @onClose="onClose()"
  746. />
  747. <el-dialog
  748. append-to-body
  749. title="账单"
  750. class="el-dialogDeep"
  751. :visible.sync="financialAccountDialog"
  752. width="70%"
  753. :close-on-click-modal="false"
  754. :destroy-on-close="true"
  755. :close-on-press-escape="false"
  756. v-dialog-drag
  757. >
  758. <financial-account
  759. v-if="financialAccountDialog"
  760. :billType="billType"
  761. :billData="{}"
  762. :arrList="applyPaymentList"
  763. :belongCompany="form.belongCompany"
  764. @choceFun="choceFun"
  765. @submit="feeSubmit"
  766. >
  767. </financial-account>
  768. </el-dialog>
  769. <el-dialog
  770. title="申请记录"
  771. append-to-body
  772. class="el-dialogDeep"
  773. :visible.sync="applicationDialog"
  774. width="60%"
  775. :close-on-click-modal="false"
  776. :destroy-on-close="true"
  777. :close-on-press-escape="false"
  778. v-dialog-drag
  779. >
  780. <bill-application
  781. :billId="form.id"
  782. @choceApplication="choceApplication"
  783. >
  784. </bill-application>
  785. </el-dialog>
  786. <el-dialog
  787. append-to-body
  788. title="审批"
  789. class="el-dialogDeep"
  790. :visible.sync="checkDialog"
  791. width="50%"
  792. :close-on-click-modal="false"
  793. :destroy-on-close="true"
  794. :close-on-press-escape="false"
  795. v-dialog-drag
  796. >
  797. <check
  798. :checkData="checkData"
  799. :checkDetail="false"
  800. :idList="[]"
  801. @choceCheckFun="choceCheckFun"
  802. >
  803. </check>
  804. </el-dialog>
  805. <el-dialog
  806. append-to-body
  807. title="审批进度"
  808. class="el-dialogDeep"
  809. :visible.sync="checkScheduleDialog"
  810. width="40%"
  811. :close-on-click-modal="false"
  812. :destroy-on-close="true"
  813. :close-on-press-escape="false"
  814. v-dialog-drag
  815. >
  816. <check-schedule
  817. :checkId="checkId"
  818. :batchNo="batchNo"
  819. @choceScheduleFun="choceScheduleFun"
  820. >
  821. </check-schedule>
  822. </el-dialog>
  823. <messagePost
  824. v-if="messageVisble"
  825. ref="messagePost"
  826. @closeDialog="closeDialog"
  827. />
  828. <changeApprove
  829. v-if="changeApproveVis"
  830. ref="changeApprove"
  831. @closeDialog="closeChangeApprove"
  832. :auditId="detailData.auditId"
  833. url="/api/blade-check/auditproecess/changeAuditUser"
  834. :routerTag="routerTag"
  835. />
  836. </div>
  837. </template>
  838. <script>
  839. import {
  840. typeSave, detail, deleteDetails,
  841. corpstypeTree,
  842. corpsattn,
  843. corpsbank,
  844. corpsfiles,
  845. corpsitem,
  846. // getList,
  847. detailList,
  848. generateShipment,
  849. saveSell,
  850. getlistBankBy,
  851. getProfit,
  852. pleaseCheck,
  853. repealCancel,
  854. removeList
  855. } from "@/api/basicData/configuration"
  856. import {getList} from "@/api/basicData/commodityType";
  857. import {getCorpDetail} from "@/api/maintenance/overpayment"
  858. import {integralDetail} from "@/api/maintenance/integral"
  859. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  860. import customerContact from "./configuration/customerContact.json"
  861. import advantageProject from "./configuration/advantageProject.json"
  862. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  863. import commodity from "./configuration/commodity.json"
  864. import optionTwoCost from "./configuration/mainListCost.json"
  865. import optionPolicy from "./configuration/optionPolicy.json"
  866. import BuyFree from "./configuration/BuyFree.json"
  867. import {
  868. getDeptLazyTree,
  869. getDeptLazyTreeTwo,
  870. customerList,
  871. policyList,
  872. policyColumn
  873. } from "@/api/basicData/basicFeesDesc";
  874. import _ from "lodash";
  875. import option from "./configuration/mainList.json";
  876. import { contrastObj, contrastList } from "@/util/contrastData";
  877. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees"
  878. import customerDialog from "@/components/customer-dialog/main";
  879. //账单组件
  880. import ApplyPayment from "../../../components/finance/applyPayment";
  881. import reportDialog from "@/components/report-dialog/main";
  882. import { getToken } from "@/util/auth";
  883. import Cookies from 'js-cookie'
  884. import feeInfo from "@/components/fee-info/main";
  885. import {corpsAddrSelect, customerList as getKHList, detail as khDetail} from "@/api/basicData/customerInformation";
  886. import billApplication from "@/components/bill/billApplication";
  887. import {
  888. isDiscount,
  889. isPercentage,
  890. micrometerFormat,
  891. IntegerFormat
  892. } from "@/util/validate";
  893. import financialAccount from "../../../components/finance/financialAccount";
  894. import { gainUser, getCharge } from "@/api/basicData/customerInquiry";
  895. import check from "@/components/check/check";
  896. import checkSchedule from "@/components/check/checkSchedule";
  897. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  898. import {mapGetters} from "vuex";
  899. export default {
  900. name: "detailsPage",
  901. props: {
  902. detailData: {
  903. type: Object
  904. }
  905. },
  906. components:{
  907. customerDialog,
  908. ApplyPayment,
  909. reportDialog,
  910. feeInfo,
  911. billApplication,
  912. financialAccount,
  913. check,
  914. checkSchedule,
  915. },
  916. data() {
  917. return {
  918. saveLoading: false,
  919. disabled: false,
  920. form: {
  921. corpId: null,
  922. },
  923. billType:"收费", //账单类型
  924. billData:{}, //账单需要数据
  925. applySettlementDialog:false,//生成账单组件
  926. financialAccountDialog:false,
  927. configuration: {
  928. multipleChoices: false,
  929. multiple: false,
  930. collapseTags: false,
  931. placeholder: '请点击右边按钮选择',
  932. dicData: []
  933. },
  934. goodsConfiguration: {
  935. multipleChoices: false,
  936. multiple: false,
  937. collapseTags: false,
  938. placeholder: '请点击右边按钮选择',
  939. dicData: []
  940. },
  941. plantConfiguration: {
  942. multipleChoices: false,
  943. multiple: false,
  944. collapseTags: false,
  945. placeholder: '请点击右边按钮选择',
  946. dicData: []
  947. },
  948. companyConfiguration: {
  949. multipleChoices: false,
  950. multiple: false,
  951. collapseTags: false,
  952. placeholder: '请点击右边按钮选择',
  953. dicData: []
  954. },
  955. data: [],
  956. policyForm: {},
  957. dataPolicy: [],
  958. contactsDataBuyFree: [],
  959. loadingCost: false,
  960. customerDivide: '',
  961. choiceData: false,
  962. commodityData: false,
  963. dataCost: [],
  964. treeDataPolicy: [],
  965. treeDataGoods: [],
  966. choiceIndex: '',
  967. dialogCost: false,
  968. treeDeptId: '',
  969. treeDeptIdCost: '',
  970. treePolicyId: '',
  971. pageCost: {
  972. pageSize: 10,
  973. currentPage: 1,
  974. total: 0
  975. },
  976. page: {
  977. pageSize: 10,
  978. currentPage: 1,
  979. total: 0,
  980. pageSizes: [10,50,100,300,500]
  981. },
  982. pageList: {
  983. pageSize: 10,
  984. currentPage: 1,
  985. total: 0
  986. },
  987. pagePolicy: {
  988. pageSize: 10,
  989. currentPage: 1,
  990. total: 0
  991. },
  992. loading: false,
  993. loadingPolicy: false,
  994. contactsForm: {},
  995. optionPolicy: optionPolicy,
  996. optionTwo: commodity,
  997. optionTwoCost: optionTwoCost,
  998. customerBuyFree: BuyFree,
  999. policyOption: {
  1000. nodeKey: 'id',
  1001. lazy: true,
  1002. treeLoad: (node, resolve)=> {
  1003. const parentId = (node.level === 0) ? 0 : node.data.id;
  1004. const newTime = new Date().toLocaleString('chinese',{hour12:false}).replaceAll('/', '-')
  1005. policyColumn({newTime: newTime,parentId: parentId,corps: this.form.corpId}).then(res => {
  1006. resolve(res.data.data.map(item => {
  1007. return {
  1008. ...item,
  1009. leaf: !item.hasChildren
  1010. }
  1011. }))
  1012. });
  1013. },
  1014. addBtn: false,
  1015. menu: false,
  1016. size: 'small',
  1017. props: {
  1018. labelText: '标题',
  1019. label: 'title',
  1020. value: 'value',
  1021. children: 'children'
  1022. }
  1023. },
  1024. treeOptionCost: {
  1025. nodeKey: 'id',
  1026. lazy: true,
  1027. treeLoad: function (node, resolve) {
  1028. const parentId = (node.level === 0) ? 0 : node.data.id;
  1029. getDeptLazyTree(parentId).then(res => {
  1030. resolve(res.data.data.map(item => {
  1031. return {
  1032. ...item,
  1033. leaf: !item.hasChildren
  1034. }
  1035. }))
  1036. });
  1037. },
  1038. addBtn: false,
  1039. menu: false,
  1040. size: 'small',
  1041. props: {
  1042. labelText: '标题',
  1043. label: 'title',
  1044. value: 'value',
  1045. children: 'children'
  1046. }
  1047. },
  1048. treeOption: {
  1049. nodeKey: 'id',
  1050. lazy: true,
  1051. treeLoad: function (node, resolve) {
  1052. const parentId = (node.level === 0) ? 0 : node.data.id;
  1053. getDeptLazyTreeTwo(parentId).then(res => {
  1054. resolve(res.data.data.map(item => {
  1055. return {
  1056. ...item,
  1057. leaf: !item.hasChildren
  1058. }
  1059. }))
  1060. });
  1061. },
  1062. addBtn: false,
  1063. menu: false,
  1064. size: 'small',
  1065. props: {
  1066. labelText: '标题',
  1067. label: 'title',
  1068. value: 'value',
  1069. children: 'children'
  1070. }
  1071. },
  1072. dialogVisible: false,
  1073. policyDialog: false,
  1074. advantageProjectForm: {},
  1075. selection: [],
  1076. bankOfDepositForm: {},
  1077. contactsData: [],
  1078. advantageProjectData: [],
  1079. bankOfDepositData: [],
  1080. tableDataCost: [],
  1081. dic: [],
  1082. tableData: [],
  1083. policyData: [],
  1084. policyDataTwo: [],
  1085. customerContact: {},
  1086. advantageProject: {},
  1087. bankOfDeposit: bankOfDeposit,
  1088. contactInformation: {
  1089. column: [
  1090. {
  1091. label: '销售金额',
  1092. prop: 'orderAmount',
  1093. type: 'number',
  1094. rules: [
  1095. {
  1096. required: false,
  1097. message: ' ',
  1098. trigger: 'blur'
  1099. }
  1100. ]
  1101. }, {
  1102. label: '其他费用',
  1103. prop: 'otherAmount',
  1104. type: 'number',
  1105. rules: [
  1106. {
  1107. required: false,
  1108. message: ' ',
  1109. trigger: 'blur'
  1110. }
  1111. ]
  1112. },{
  1113. label: '总溢付款',
  1114. prop: 'overPayment',
  1115. disabled: true,
  1116. rules: [
  1117. {
  1118. required: false,
  1119. message: ' ',
  1120. trigger: 'blur'
  1121. }
  1122. ]
  1123. }, {
  1124. label: '返利余额',
  1125. prop: 'profit',
  1126. disabled: true,
  1127. rules: [
  1128. {
  1129. required: false,
  1130. message: ' ',
  1131. trigger: 'blur'
  1132. }
  1133. ]
  1134. }, {
  1135. label: '产生返利',
  1136. prop: 'createProfit',
  1137. disabled: false,
  1138. rules: [
  1139. {
  1140. required: false,
  1141. message: ' ',
  1142. trigger: 'blur'
  1143. }
  1144. ]
  1145. }, {
  1146. label: '本次使用返利',
  1147. prop: 'thisUsedProfit',
  1148. disabled: false,
  1149. rules: [
  1150. {
  1151. required: false,
  1152. message: ' ',
  1153. trigger: 'blur'
  1154. }
  1155. ]
  1156. },{
  1157. label: '应收账款',
  1158. prop: 'debitAmount',
  1159. type: 'number',
  1160. disabled: true,
  1161. rules: [
  1162. {
  1163. required: false,
  1164. message: ' ',
  1165. trigger: 'blur'
  1166. }
  1167. ]
  1168. }, {
  1169. label: '已收款',
  1170. prop: 'settlmentAmount',
  1171. disabled: true,
  1172. rules: [
  1173. {
  1174. required: false,
  1175. message: ' ',
  1176. trigger: 'blur'
  1177. }
  1178. ]
  1179. }, {
  1180. label: '应收未收款',
  1181. prop: 'balanceAmount',//无
  1182. disabled: true,
  1183. rules: [
  1184. {
  1185. required: false,
  1186. message: ' ',
  1187. trigger: 'blur'
  1188. }
  1189. ]
  1190. },
  1191. {
  1192. label: '保证金',
  1193. prop: 'deposit',
  1194. type: 'number',
  1195. rules: [
  1196. {
  1197. required: false,
  1198. message: ' ',
  1199. trigger: 'blur'
  1200. }
  1201. ]
  1202. }, {
  1203. label: '逾期账款',
  1204. prop: 'overDueAccounts',
  1205. type: 'number',
  1206. rules: [
  1207. {
  1208. required: false,
  1209. message: ' ',
  1210. trigger: 'blur'
  1211. }
  1212. ]
  1213. }, {
  1214. label: '实际发货日期',
  1215. prop: 'actualDeliveryDate',
  1216. type: 'datetime',
  1217. rules: [
  1218. {
  1219. required: false,
  1220. message: ' ',
  1221. trigger: 'blur'
  1222. }
  1223. ]
  1224. }, {
  1225. label: '合同日期',
  1226. prop: 'businesDate',
  1227. type: 'date',
  1228. rules: [
  1229. {
  1230. required: false,
  1231. message: ' ',
  1232. trigger: 'blur'
  1233. }
  1234. ]
  1235. }, {
  1236. label: '到货日期',
  1237. prop: 'arrivalDate',
  1238. type: 'datetime',
  1239. rules: [
  1240. {
  1241. required: false,
  1242. message: ' ',
  1243. trigger: 'blur'
  1244. }
  1245. ]
  1246. }, {
  1247. label: '毛利率',
  1248. prop: 'grossProfitRate',
  1249. display: true,
  1250. rules: [
  1251. {
  1252. required: false,
  1253. message: ' ',
  1254. trigger: 'blur'
  1255. }
  1256. ]
  1257. }, {
  1258. label: '毛利额',
  1259. prop: 'grossProfit',
  1260. type: 'number',
  1261. display: true,
  1262. rules: [
  1263. {
  1264. required: false,
  1265. message: ' ',
  1266. trigger: 'blur'
  1267. }
  1268. ]
  1269. }, {
  1270. label: '历史运费(元/条)',
  1271. prop: 'freightAmountHistory',
  1272. type: 'number',
  1273. rules: [
  1274. {
  1275. required: false,
  1276. message: ' ',
  1277. trigger: 'blur'
  1278. }
  1279. ]
  1280. }, {
  1281. label: '预收款日期',
  1282. type: 'datetime',
  1283. prop: 'advanceCollectionDate',
  1284. rules: [
  1285. {
  1286. required: false,
  1287. message: ' ',
  1288. trigger: 'blur'
  1289. }
  1290. ]
  1291. }, {
  1292. label: '特价占比',
  1293. prop: 'specialOfferOf',
  1294. disabled: false,
  1295. rules: [
  1296. {
  1297. required: false,
  1298. message: ' ',
  1299. trigger: 'blur'
  1300. }
  1301. ]
  1302. }, {
  1303. label: '大尺寸占比',
  1304. prop: 'largeScale',
  1305. disabled: false,
  1306. }, {
  1307. label: '单据状态',
  1308. prop: 'orderStatus',
  1309. disabled: true,
  1310. rules: [
  1311. {
  1312. required: false,
  1313. message: ' ',
  1314. trigger: 'blur'
  1315. }
  1316. ]
  1317. },{
  1318. label: '积分余额',
  1319. prop: 'pointMutiple',
  1320. disabled: true,
  1321. rules: [
  1322. {
  1323. required: false,
  1324. message: ' ',
  1325. trigger: 'blur'
  1326. }
  1327. ]
  1328. }, {
  1329. label: '赠送积分',
  1330. prop: 'presenterIntegral',
  1331. disabled: true,
  1332. rules: [
  1333. {
  1334. required: false,
  1335. message: ' ',
  1336. trigger: 'blur'
  1337. }
  1338. ]
  1339. },{
  1340. label: '兑换积分',
  1341. prop: 'convertIntegral',
  1342. disabled: true,
  1343. rules: [
  1344. {
  1345. required: false,
  1346. message: ' ',
  1347. trigger: 'blur'
  1348. }
  1349. ]
  1350. },{
  1351. label: '重量合计',
  1352. prop: 'cartonWeight',
  1353. disabled: true,
  1354. rules: [
  1355. {
  1356. required: false,
  1357. message: ' ',
  1358. trigger: 'blur'
  1359. }
  1360. ]
  1361. },{
  1362. label: '体积合计',
  1363. prop: 'cntrVolumn',
  1364. disabled: true,
  1365. rules: [
  1366. {
  1367. required: false,
  1368. message: ' ',
  1369. trigger: 'blur'
  1370. }
  1371. ]
  1372. }, {
  1373. label: '制单人',
  1374. prop: 'createUserName',
  1375. disabled: true,
  1376. rules: [
  1377. {
  1378. required: false,
  1379. message: ' ',
  1380. trigger: 'blur'
  1381. }
  1382. ]
  1383. },{
  1384. label: '制单日期',
  1385. prop: 'createTime',
  1386. type: 'datetime',
  1387. disabled:true,
  1388. rules: [
  1389. {
  1390. required: false,
  1391. message: ' ',
  1392. trigger: 'blur'
  1393. }
  1394. ]
  1395. }, {
  1396. label: '特别提醒',
  1397. prop: 'specialRemarks',
  1398. type: 'textarea',
  1399. span: 24,
  1400. rules: [
  1401. {
  1402. required: false,
  1403. message: ' ',
  1404. trigger: 'blur'
  1405. }
  1406. ]
  1407. }
  1408. ]
  1409. },
  1410. basicData: {
  1411. column: [
  1412. {
  1413. label: '所属公司',
  1414. prop: 'belongToCorpId',
  1415. span: 8,
  1416. rules: [
  1417. {
  1418. required: true,
  1419. message: ' ',
  1420. trigger: 'change'
  1421. }
  1422. ]
  1423. }, {
  1424. label: '付款方式',
  1425. prop: 'paymentType',
  1426. rules: [
  1427. {
  1428. required: true,
  1429. message: ' ',
  1430. trigger: 'change'
  1431. }
  1432. ]
  1433. },{
  1434. label: '包装要求',
  1435. prop: 'packageRemarks',
  1436. rules: [
  1437. {
  1438. required: true,
  1439. message: ' ',
  1440. trigger: 'change'
  1441. }
  1442. ]
  1443. },
  1444. {
  1445. label: '银行帐号',
  1446. prop: 'banks',
  1447. type: 'select',
  1448. rules: [
  1449. {
  1450. required: true,
  1451. message: ' ',
  1452. trigger: 'change'
  1453. }
  1454. ]
  1455. }, {
  1456. label: '公司户头',
  1457. prop: 'banksAccountName',
  1458. rules: [
  1459. {
  1460. required: false,
  1461. message: ' ',
  1462. trigger: 'blur'
  1463. }
  1464. ]
  1465. }, {
  1466. label: '开户银行',
  1467. prop: 'accountBank',
  1468. rules: [
  1469. {
  1470. required: false,
  1471. message: ' ',
  1472. trigger: 'blur'
  1473. }
  1474. ]
  1475. },
  1476. {
  1477. label: '客户全称',
  1478. prop: 'corpId',
  1479. span: 8,
  1480. rules: [
  1481. {
  1482. required: true,
  1483. message: ' ',
  1484. trigger: 'change'
  1485. }
  1486. ]
  1487. }, {
  1488. label: '到货地址',
  1489. prop: 'arrivalAddress',
  1490. span:16,
  1491. rules: [
  1492. {
  1493. required: true,
  1494. message: ' ',
  1495. trigger: 'change'
  1496. }
  1497. ]
  1498. }, {
  1499. label: '生产工厂',
  1500. prop: 'productionPlant',
  1501. span: 8,
  1502. rules: [
  1503. {
  1504. required: true,
  1505. message: ' ',
  1506. trigger: 'change'
  1507. }
  1508. ]
  1509. },
  1510. {
  1511. label: '发货地址',
  1512. prop: 'shippingAddress',
  1513. disabled: false,
  1514. span: 16,
  1515. rules: [
  1516. {
  1517. required: true,
  1518. message: ' ',
  1519. trigger: 'change'
  1520. }
  1521. ]
  1522. }, {
  1523. label: '销售订单号',
  1524. prop: 'orderNo',
  1525. disabled: true,
  1526. rules: [
  1527. {
  1528. required: false,
  1529. message: ' ',
  1530. trigger: 'blur'
  1531. }
  1532. ]
  1533. }, {
  1534. label: '主订单号',
  1535. prop: 'morderNo',
  1536. rules: [
  1537. {
  1538. required: false,
  1539. message: ' ',
  1540. trigger: 'blur'
  1541. }
  1542. ]
  1543. },
  1544. {
  1545. label: '是否收取标签费',
  1546. prop: 'isLabel',
  1547. type: 'radio',
  1548. },
  1549. {
  1550. label: '是否包运费',
  1551. prop: 'isFreight',
  1552. type: 'radio',
  1553. },
  1554. {
  1555. label: '预估运费',
  1556. prop: 'predictOceanFreight',
  1557. type: 'number',
  1558. rules: [
  1559. {
  1560. required: true,
  1561. message: ' ',
  1562. trigger: 'blur'
  1563. }
  1564. ]
  1565. },
  1566. {
  1567. label: '要求发货日期',
  1568. prop: 'requiredDeliveryDate',
  1569. type: 'date',
  1570. rules: [
  1571. {
  1572. required: false,
  1573. message: ' ',
  1574. trigger: 'blur'
  1575. }
  1576. ]
  1577. }, {
  1578. label: '要求到货日期',
  1579. prop: 'requiredArrivalDate',
  1580. type: 'date',
  1581. rules: [
  1582. {
  1583. required: false,
  1584. message: ' ',
  1585. trigger: 'blur'
  1586. }
  1587. ]
  1588. },{
  1589. label: '业务员',
  1590. prop: 'chargeMember',
  1591. rules: [
  1592. {
  1593. required: false,
  1594. message: ' ',
  1595. trigger: 'change'
  1596. }
  1597. ]
  1598. }, {
  1599. label: '联系人',
  1600. prop: 'corpAttn',
  1601. rules: [
  1602. {
  1603. required: false,
  1604. message: ' ',
  1605. trigger: 'change'
  1606. }
  1607. ]
  1608. }, {
  1609. label: '联系电话',
  1610. prop: 'corpTel',
  1611. rules: [
  1612. {
  1613. required: false,
  1614. message: ' ',
  1615. trigger: 'change'
  1616. }
  1617. ]
  1618. }, {
  1619. label: "订单备注",
  1620. type: 'textarea',
  1621. span: 24,
  1622. prop: "orderRemark",
  1623. mock: {
  1624. type: 'county'
  1625. }
  1626. }
  1627. ]
  1628. },
  1629. // 银行账号下拉
  1630. bankList: [],
  1631. paymentOption: [],
  1632. statusOption: [],
  1633. // 费用信息排序的最大值
  1634. maxFeeNum: 0,
  1635. maxGoodsNum: 0,
  1636. oldForm: {
  1637. orderStatus: "录入"
  1638. },
  1639. oldGoodsList: [],
  1640. oldGiftList: [],
  1641. oldFeesList: [],
  1642. oldUploadList: [],
  1643. // 采购价格
  1644. purchasePriceOption: [],
  1645. // 销售价格
  1646. salesPriceOtion: [],
  1647. // 弹窗高度
  1648. rowHeight: '',
  1649. // 查询时loading页面
  1650. pageLoading: false,
  1651. switchDialog: false,
  1652. // 商品信息表格loading
  1653. goodsLoading: false,
  1654. // 上传时带的参数
  1655. uploadPolicy: {
  1656. policyName: '',
  1657. salesType: 1
  1658. },
  1659. baseURL: '/api/blade-purchase-sales/orderitems/importPrice', // 商品明细上传路径
  1660. policyUrl: '/api/blade-purchase-sales/orderitems/importPolicy', // 导入政策上传路径
  1661. headers: { "Blade-Auth": 'Bearer ' + getToken()},
  1662. activeName: 'searchList',
  1663. // 商品列表数据合计
  1664. goodsListShow: [],
  1665. dataTwo: [],
  1666. dataThree: [],
  1667. // 商品列表暂存
  1668. goodsListSave: [],
  1669. goodsListPolicy: [],
  1670. buyAndGiveList: [],
  1671. goodsListTotal: 0,
  1672. goodsListSaveTotal: 0,
  1673. goodsActives: 'goods',
  1674. saveActives: '',
  1675. goodsDisabled: false,
  1676. // 赠品信息数据
  1677. giftData: [],
  1678. // 商品信息展示数据
  1679. goodsShowData: [],
  1680. arrivalOptions: [],
  1681. shippingOptions: [],
  1682. applicationDialog:false,
  1683. itemType: '销售',
  1684. packageOptions: [],
  1685. // 请核状态禁用
  1686. browse: false,
  1687. roleName: '',
  1688. userList: [],
  1689. feesOption: [],
  1690. checkDisabled: false,
  1691. checkData: {},
  1692. checkDialog: false,
  1693. checkScheduleDialog: false,
  1694. checkId: '',
  1695. batchNo:'',
  1696. applyPaymentList: [],
  1697. khInfoList: [],
  1698. messageVisble: false, //消息弹窗开关
  1699. changeApproveVis: false, // 更换审批人弹窗
  1700. arrearsCheck: false, // 是否欠款发货审批
  1701. shopQualityDisable: false, //质量胎切换禁用
  1702. index: 0,
  1703. policyIndex: 0,
  1704. routerTag: '',
  1705. }
  1706. },
  1707. mounted() {
  1708. this.$nextTick(() => {
  1709. // 监听浏览器高度变化,改变表格高度
  1710. window.onresize = () => {
  1711. this.rowHeight = (window.innerHeight - 130) + 'px'
  1712. }
  1713. this.routerTag = window.location.hash.slice(1);
  1714. })
  1715. },
  1716. filters: {
  1717. IntegerFormat(num) {
  1718. return IntegerFormat(num);
  1719. },
  1720. decimalFormat(num) {
  1721. return num ? Number(num).toFixed(2) : "0.00";
  1722. }
  1723. },
  1724. //初始化查询
  1725. async created() {
  1726. this.rowHeight = (window.innerHeight - 130) + 'px'
  1727. this.customerContact = await this.getColumnData(this.getColumnName(15), customerContact);
  1728. this.getWorkDicts("payment_term").then(res => {
  1729. this.paymentOption = res.data.data
  1730. })
  1731. this.getWorkDicts("order_status").then(res => {
  1732. this.statusOption = res.data.data
  1733. })
  1734. this.getWorkDicts("packageRemarks").then(res => {
  1735. this.packageOptions = res.data.data;
  1736. });
  1737. // 获取角色
  1738. this.roleName = localStorage.getItem('roleName')
  1739. if (!this.roleName.includes('admin') && !this.roleName.includes('assistant')) {
  1740. this.contactInformation.column.forEach(item => {
  1741. if (item.prop == 'grossProfitRate' || item.prop == 'grossProfit') item.display = false
  1742. })
  1743. }
  1744. this.judgeNew()
  1745. if (this.roleName == 'salesman') {
  1746. this.customerContact.column.forEach(item => {
  1747. if (item.prop == 'purchaseAmount') {
  1748. item.hide = true;
  1749. item.showColumn = false;
  1750. }
  1751. })
  1752. }
  1753. this.getDefault()
  1754. if (this.detailData.id) {
  1755. this.queryData(this.detailData.id)
  1756. }
  1757. if (this.detailData.check) {
  1758. this.checkDisabled = true
  1759. this.batchNo = this.detailData.check.batchNo
  1760. }
  1761. // gainUser().then(res => {
  1762. // this.userList = res.data.data;
  1763. // });
  1764. feeList().then(res => {
  1765. this.feesOption = res.data.data.records
  1766. })
  1767. if (this.detailData.seeDisabled) {
  1768. // this.bankOfDeposit.column.forEach(item => {
  1769. // item.editDisabled = true
  1770. // item.addDisabled = true
  1771. // })
  1772. }
  1773. if (this.detailData.copyId) {
  1774. this.queryData(this.detailData.copyId, true)
  1775. }
  1776. this.oldForm = Object.assign({}, this.form);
  1777. this.customerBuyFree.height = (window.innerHeight - 330) / 2;
  1778. this.optionPolicy.height = (window.innerHeight - 330) / 2;
  1779. this.customerContact.height = window.innerHeight - 240;
  1780. this.index++;
  1781. if(localStorage.getItem("roleName")=='salesman'){
  1782. this.findObject(this.customerContact.column, "purchaseAmount").hide=true;
  1783. this.findObject(this.customerContact.column, "purchaseAmount").showColumn=false;
  1784. }
  1785. },
  1786. updated() {
  1787. this.$nextTick(() => {
  1788. this.$refs.crudContact.doLayout();
  1789. })
  1790. },
  1791. methods: {
  1792. judgeNew(){
  1793. if (!this.roleName.includes('salesman')){
  1794. // for (let item of this.customerContact.column) {
  1795. // if (item.prop === 'purchaseAmount') return false
  1796. // }
  1797. // this.customerContact.column.push()
  1798. for (let item of this.optionPolicy.column) {
  1799. if (item.prop === 'purchasePrice') return false
  1800. }
  1801. // this.optionPolicy.column.push({
  1802. // "label": "采购价(元)",
  1803. // "prop": "purchasePrice",
  1804. // "index": 5,
  1805. // "width":100,
  1806. // "cell": true,
  1807. // "rules": [
  1808. // {
  1809. // "required": false,
  1810. // "message": " ",
  1811. // "trigger": "blur"
  1812. // }
  1813. // ]
  1814. // })
  1815. for (let item of this.customerBuyFree.column) {
  1816. if (item.prop === 'purchasePrice') return false
  1817. }
  1818. // this.customerBuyFree.column.push({
  1819. // "label": "采购价(元)",
  1820. // "prop": "purchasePrice",
  1821. // "index": 4,
  1822. // "width":100,
  1823. // "cell": true,
  1824. // "rules": [
  1825. // {
  1826. // "required": false,
  1827. // "message": " ",
  1828. // "trigger": "blur"
  1829. // }
  1830. // ]
  1831. // })
  1832. }
  1833. },
  1834. getGoodsRow(event,row) {
  1835. row.priceCategory = event.goodsTypeName
  1836. row.code = event.code
  1837. row.typeno = event.typeno
  1838. row.itemType = event.typeno
  1839. row.itemId = event.id
  1840. row.corpId = event.corpId
  1841. row.corpName = event.corpName
  1842. selectGoodsNum({
  1843. goodsId: event.id,
  1844. itemType: event.typeno,
  1845. tradeType: 'GN'
  1846. }).then(res => {
  1847. row.storageQuantity = res.data.data
  1848. })
  1849. row.integralMultiples = event.integralMultiples
  1850. this.quantityChange(row)
  1851. },
  1852. queryData(id, isCopy = false,other){
  1853. this.pageLoading = true
  1854. this.saveLoading = true
  1855. detail(id).then(async res => {
  1856. this.form = res.data.data;
  1857. this.browse = this.form.status > 0? true: false;
  1858. this.arrearsCheck = this.form.specialCheckStatus == 3? true: false;
  1859. await getProfit({Id: this.form.corpId}).then(res => {
  1860. this.$set(this.form, 'profit',res.data.data.surplusProfit? res.data.data.surplusProfit: '0.00')
  1861. })
  1862. this.contactsData = this.form.orderItemsList.filter(item => {
  1863. return item.goodType == 0
  1864. })
  1865. this.giftData = this.form.orderItemsList.filter(item => {
  1866. return item.goodType == 1
  1867. })
  1868. this.goodsShowData = this.giftData;
  1869. this.goodsActives = 'goods';
  1870. this.handleClick({name: this.goodsActives})
  1871. // this.contactsData = this.form.orderItemsList
  1872. this.advantageProjectData = this.form.orderFeesList
  1873. this.bankOfDepositData = this.form.orderFilesList
  1874. this.configuration.dicData = this.form.corpName
  1875. let feesData = []
  1876. this.form.orderFeesList.forEach(item => {
  1877. let a = {
  1878. cname: item.corpName,
  1879. id: item.corpId
  1880. }
  1881. feesData.push(a)
  1882. })
  1883. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1884. // 去重
  1885. this.removeRepeat()
  1886. let goodsData = []
  1887. this.form.orderItemsList.forEach(item => {
  1888. let a = {
  1889. cname: item.cname,
  1890. }
  1891. goodsData.push(a)
  1892. })
  1893. this.goodsConfiguration.dicData = [].concat(goodsData)
  1894. this.removeGoodsRepeat()
  1895. delete this.form.orderItemsList
  1896. delete this.form.orderFeesList
  1897. delete this.form.orderFilesList
  1898. // delete this.form.corpName
  1899. delete this.form.belongToCorpList
  1900. // 获取最大值
  1901. let num = []
  1902. this.advantageProjectData.forEach(item => {
  1903. num.push(item.sort)
  1904. })
  1905. if (num.length == 0) {
  1906. this.maxFeeNum = 0;
  1907. } else {
  1908. this.maxFeeNum = num.reduce((a, b) => {
  1909. return b > a? b: a;
  1910. })
  1911. }
  1912. let goodsNum = []
  1913. let purchaseAmount = 0
  1914. this.contactsData.forEach(item => {
  1915. goodsNum.push(item.sort)
  1916. purchaseAmount += Number(item.purchaseAmount)
  1917. })
  1918. if (goodsNum.length == 0) {
  1919. this.maxGoodsNum = 0;
  1920. } else {
  1921. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1922. return b > a? b: a;
  1923. })
  1924. }
  1925. this.oldForm = Object.assign({}, this.form)
  1926. this.oldGoodsList = []
  1927. this.oldGiftList = []
  1928. this.oldFeesList = []
  1929. this.oldUploadList = []
  1930. this.oldGoodsList = this.deepClone(this.contactsData)
  1931. this.oldGiftList = this.deepClone(this.giftData)
  1932. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1933. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1934. if (isCopy) {
  1935. this.$set(this.form, 'orderStatus', '录入')
  1936. this.form.status = 0
  1937. this.browse = false
  1938. delete this.form.id
  1939. delete this.form.orgOrderNo
  1940. delete this.form.orderNo
  1941. delete this.form.morderNo
  1942. delete this.form.createUserName
  1943. delete this.form.createTime
  1944. delete this.form.businesDate
  1945. this.contactsData.forEach(item => {
  1946. delete item.id
  1947. delete item.pid
  1948. })
  1949. this.goodsShowData.forEach(item => {
  1950. delete item.id
  1951. delete item.pid
  1952. })
  1953. this.giftData.forEach(item => {
  1954. delete item.id
  1955. delete item.pid
  1956. })
  1957. this.advantageProjectData = []
  1958. this.bankOfDepositData = []
  1959. this.bankOfDepositData.forEach(item => {
  1960. delete item.id
  1961. delete item.pid
  1962. })
  1963. }
  1964. if (other === 'check'){
  1965. this.pleaseCheck()
  1966. }
  1967. }).finally(() => {
  1968. this.saveLoading = false
  1969. this.pageLoading = false
  1970. });
  1971. },
  1972. getDefault() {
  1973. let date = new Date();
  1974. let year = date.getFullYear();
  1975. let month = date.getMonth() + 1;
  1976. let day = date.getDate();
  1977. if (month < 10) {
  1978. month = "0" + month;
  1979. }
  1980. if (day < 10) {
  1981. day = "0" + day;
  1982. }
  1983. let nowDate = year + "-" + month + "-" + day + ' 00:00:00';
  1984. this.$set(this.form, 'businesDate', nowDate)
  1985. this.$set(this.form, 'orderStatus', '录入')
  1986. this.$set(this.form, 'caseOverPayment', 0)
  1987. this.$set(this.form, 'overPayment', 0)
  1988. this.$set(this.form, 'orderAmount', 0)
  1989. this.$set(this.form, 'predictOceanFreight', 0)
  1990. this.$set(this.form, 'presenterIntegral' , 0)
  1991. this.$set(this.form, 'convertIntegral' , 0)
  1992. this.$set(this.form, 'profit' , 0)
  1993. this.$set(this.form, 'paymentType', '预付')
  1994. this.$set(this.form, 'thisUsedProfit' , 0)
  1995. this.$set(this.form, 'createProfit' , 0)
  1996. this.$set(this.form, 'isFreight' , 0)
  1997. this.$set(this.form, 'isLabel' , 0)
  1998. },
  1999. // 复制新单
  2000. copyOrder() {
  2001. this.saveActives = ''
  2002. this.queryData(this.form.id, true)
  2003. },
  2004. getcorpId(row) {
  2005. this.goodsShowData[row.index].corpId = row.id;
  2006. this.goodsShowData[row.index].corpName = row.cname;
  2007. },
  2008. // 采购金额获取
  2009. getPurchasePrice(row) {
  2010. getPurchasePrice({code: row.code}).then(res => {
  2011. this.purchasePriceOption = res.data.data
  2012. })
  2013. },
  2014. // 销售金额获取
  2015. getMarketPrice(row) {
  2016. getMarketPrice({code: row.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2017. this.salesPriceOtion = res.data.data
  2018. })
  2019. },
  2020. // 生成采购单
  2021. saveSell() {
  2022. let getGoodsList = []
  2023. let getGiftList = []
  2024. let getFeeList = this.$refs.feeInfo.submitData()
  2025. if (this.goodsActives == 'gift') {
  2026. getGiftList = this.goodsShowData
  2027. getGoodsList = this.contactsData
  2028. } else {
  2029. getGoodsList = this.goodsShowData
  2030. getGiftList = this.giftData
  2031. }
  2032. if (contrastObj(this.form, this.oldForm) ||
  2033. contrastList(getGoodsList, this.oldGoodsList) ||
  2034. contrastList(getGiftList, this.oldGiftList) ||
  2035. // contrastList(getFeeList, this.oldFeesList) ||
  2036. contrastList(this.bankOfDepositData, this.oldUploadList)
  2037. ) {
  2038. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  2039. confirmButtonText: "确定",
  2040. cancelButtonText: "取消",
  2041. type: "warning"
  2042. }).then(async () => {
  2043. await this.editCustomer(false, '采购')
  2044. }).catch(() => {
  2045. this.$message.info('已取消')
  2046. })
  2047. } else {
  2048. if ((Number(this.form.settlmentAmount) < Number(this.form.debitAmount)) && !this.arrearsCheck) return this.$message.error('收款未收齐,禁止生成采购单');
  2049. this.$confirm("是否生成采购单?", {
  2050. confirmButtonText: "确定",
  2051. cancelButtonText: "取消",
  2052. type: "warning"
  2053. }).then(() => {
  2054. saveSell(this.form.id).then(res => {
  2055. if (res.data.code == 200) {
  2056. this.$message.success("生成成功");
  2057. this.messageVisble = true
  2058. this.$nextTick(() => {
  2059. this.$refs.messagePost.init()
  2060. })
  2061. }
  2062. });
  2063. });
  2064. }
  2065. },
  2066. closeDialog() {
  2067. this.messageVisble = false
  2068. },
  2069. //点击行可编辑
  2070. handleRowClick(row, event, column) {
  2071. },
  2072. //商品编辑
  2073. rowCell(row, index) {
  2074. if (row.$cellEdit) {
  2075. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  2076. return this.$message.error('订货数量不能小于发货数量')
  2077. }
  2078. }
  2079. this.$refs.crudContact.rowCell(row, row.$index)
  2080. },
  2081. //费用编辑
  2082. rowCellTwo(row, index) {
  2083. this.$refs.crudProject.rowCell(row, row.$index)
  2084. },
  2085. //费用新增触发
  2086. costIncrease() {
  2087. this.dialogCost = !this.dialogCost
  2088. this.choiceData = false
  2089. },
  2090. //商品新增触发
  2091. commoditySelection() {
  2092. this.dialogVisible = !this.dialogVisible
  2093. this.tableData = []
  2094. this.commodityData = false
  2095. this.goodsListSave = [];
  2096. },
  2097. //政策价格导入
  2098. policy() {
  2099. this.$set(this.customerBuyFree,'menu',true)
  2100. this.$set(this.optionPolicy,'menu',true)
  2101. this.customerBuyFree.selection = true
  2102. this.optionPolicy.selection = true
  2103. this.activeName = 'searchList'
  2104. this.goodsListPolicy = []
  2105. this.buyAndGiveList = []
  2106. this.policyDialog = !this.policyDialog
  2107. },
  2108. // 报表
  2109. openReport() {
  2110. this.switchDialog =! this.switchDialog;
  2111. },
  2112. // 导出
  2113. exportHandle() {
  2114. this.$confirm('是否导出产品信息?', '提示', {
  2115. confirmButtonText: '确定',
  2116. cancelButtonText: '取消',
  2117. type: 'warning'
  2118. }).then(() => {
  2119. window.open(
  2120. `/api/blade-client/goodsdesc/export-out-info?${
  2121. this.website.tokenHeader
  2122. }=${getToken()}`
  2123. );
  2124. }).catch(() => {
  2125. this.$message({
  2126. type: 'info',
  2127. message: '已取消'
  2128. });
  2129. })
  2130. },
  2131. // 下载模板
  2132. downloadHandle() {
  2133. this.$confirm('是否下载模板文件?', '提示', {
  2134. confirmButtonText: '确定',
  2135. cancelButtonText: '取消',
  2136. type: 'warning'
  2137. }).then(() => {
  2138. window.open(
  2139. `/api/blade-purchase-sales/orderitems/exportPrice?${
  2140. this.website.tokenHeader
  2141. }=${getToken()}`
  2142. );
  2143. }).catch(() => {
  2144. this.$message({
  2145. type: 'info',
  2146. message: '已取消'
  2147. });
  2148. })
  2149. },
  2150. //文件上传时
  2151. uploading(event, file, fileList) {
  2152. this.openFullScreen(false, '文件正在解析中');
  2153. },
  2154. // 商品明细上传成功钩子
  2155. importTemplate(res, file) {
  2156. this.openFullScreen(true)
  2157. let goodsData = []
  2158. if(res.data.lose.length>0){
  2159. this.$message({
  2160. showClose: true,
  2161. message: '导入明细失败的大字有:'+res.data.lose.toString(),
  2162. type: 'error',
  2163. duration:10000,
  2164. });
  2165. }
  2166. res.data.list.forEach(item => {
  2167. getMarketPrice({code: item.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2168. if (response.data.data.length > 0) {
  2169. this.$set(item, 'price', response.data.data[0].salePrice)
  2170. } else {
  2171. this.$set(item, 'price', '0')
  2172. }
  2173. this.priceChange(item)
  2174. // this.$set(item, 'amount', (Number(item.price) * Number(item.orderQuantity)).toFixed(2))
  2175. })
  2176. getPurchasePrice({code: item.code}).then(response => {
  2177. if (response.data.data.length > 0) {
  2178. this.$set(item, 'purchaseAmount', response.data.data[0].purchasePrice)
  2179. } else {
  2180. this.$set(item, 'purchaseAmount', '0')
  2181. }
  2182. })
  2183. this.$set(item, 'integral', Number(item.integralMultiples) * Number(item.orderQuantity))
  2184. this.$set(item, 'actualQuantity', '0')
  2185. this.$set(item, 'purchaseAmount', '0')
  2186. this.$set(item, 'price', '0')
  2187. this.$set(item, 'amount', '0')
  2188. this.$set(item, 'sort', this.maxFeeNum + 1)
  2189. this.maxFeeNum++
  2190. let a = {
  2191. ...item,
  2192. }
  2193. goodsData.push(a)
  2194. })
  2195. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(goodsData)
  2196. this.removeGoodsRepeat()
  2197. this.goodsShowData = this.goodsShowData.concat(res.data.list)
  2198. },
  2199. // 政策导入成功钩子
  2200. successPolicy(res, file) {
  2201. this.openFullScreen(true)
  2202. if (res.data.message === "" && !res.data.message) {
  2203. this.dataPolicy = res.data.list? res.data.list: [];
  2204. this.dataPolicy.forEach(item=>{
  2205. this.$set(item, 'priceType', res.data.cname)
  2206. })
  2207. this.policyIndex++;
  2208. } else {
  2209. this.dataPolicy = res.data.list? res.data.list: [];
  2210. this.dataPolicy.forEach(item=>{
  2211. this.$set(item, 'priceType', res.data.cname)
  2212. })
  2213. this.policyIndex++;
  2214. this.$message({
  2215. showClose: true,
  2216. message:res.data.message,
  2217. type: 'error',
  2218. duration:100000,
  2219. });
  2220. }
  2221. },
  2222. uploadError(err, file, fileList) {
  2223. this.openFullScreen(true)
  2224. this.$message.error(JSON.parse(err.message).msg)
  2225. },
  2226. //遮罩层
  2227. openFullScreen(res, text) {
  2228. const loading = this.$loading({
  2229. lock: true,
  2230. text: text,
  2231. spinner: 'el-icon-loading',
  2232. background: 'rgba(0, 0, 0, 0.7)'
  2233. });
  2234. if (res === true) loading.close();
  2235. },
  2236. onClose(val) {
  2237. this.switchDialog = val;
  2238. },
  2239. getShipmentD() {
  2240. for (let item in this.selection) {
  2241. if (!this.selection[item].id) {
  2242. return this.$message.error('选中数据有新数据,请先保存')
  2243. }
  2244. }
  2245. if (this.$store.getters.inStatus) {
  2246. this.$alert("客户收货存在,请保存客户收货再进行操作", "温馨提示", {
  2247. confirmButtonText: "确定",
  2248. type: "warning",
  2249. callback: action => {
  2250. console.log(action);
  2251. }
  2252. });
  2253. } else {
  2254. this.generateShipmentD();
  2255. }
  2256. },
  2257. //生成发货单
  2258. async generateShipmentD() {
  2259. let getGoodsList = []
  2260. let getGiftList = []
  2261. let getFeeList = this.$refs.feeInfo.submitData()
  2262. if (this.goodsActives == 'gift') {
  2263. getGiftList = this.goodsShowData
  2264. getGoodsList = this.contactsData
  2265. } else {
  2266. getGoodsList = this.goodsShowData
  2267. getGiftList = this.giftData
  2268. }
  2269. if (contrastObj(this.form, this.oldForm) ||
  2270. contrastList(getGoodsList, this.oldGoodsList) ||
  2271. contrastList(getGiftList, this.oldGiftList) ||
  2272. // contrastList(getFeeList, this.oldFeesList) ||
  2273. contrastList(this.bankOfDepositData, this.oldUploadList)
  2274. ) {
  2275. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  2276. confirmButtonText: "确定",
  2277. cancelButtonText: "取消",
  2278. type: "warning"
  2279. }).then(() => {
  2280. this.editCustomer(false, '发货')
  2281. }).catch(() => {
  2282. this.$message({
  2283. type: 'info',
  2284. message: '已取消'
  2285. });
  2286. })
  2287. } else {
  2288. // if (Number(this.form.debitAmount) > Number(this.form.settlmentAmount)) {
  2289. // return this.$message.error('已收款小于未收款,不能生成客户确认单')
  2290. // }
  2291. let lsit = []
  2292. this.selection = this.selection.concat(this.giftData)
  2293. this.selection.forEach(item => {
  2294. lsit.push(item.id)
  2295. })
  2296. let data = {
  2297. id: this.form.id,
  2298. orderItemIds: lsit
  2299. }
  2300. generateShipment(data).then(res => {
  2301. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  2302. this.$router.push({
  2303. path: "/businessManagement/deliveryNotice/index",
  2304. query: {
  2305. form: JSON.stringify(res.data.data),
  2306. pageType: "Generate",
  2307. },
  2308. });
  2309. })
  2310. }
  2311. },
  2312. // 生成结算
  2313. applySettlement(type) {
  2314. let getGoodsList = []
  2315. let getGiftList = []
  2316. let getFeeList = this.$refs.feeInfo.submitData()
  2317. if (this.goodsActives == 'gift') {
  2318. getGiftList = this.goodsShowData
  2319. getGoodsList = this.contactsData
  2320. } else {
  2321. getGoodsList = this.goodsShowData
  2322. getGiftList = this.giftData
  2323. }
  2324. if (contrastObj(this.form, this.oldForm) ||
  2325. contrastList(getGoodsList, this.oldGoodsList) ||
  2326. contrastList(getGiftList, this.oldGiftList) ||
  2327. // contrastList(getFeeList, this.oldFeesList) ||
  2328. contrastList(this.bankOfDepositData, this.oldUploadList)
  2329. ) {
  2330. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  2331. confirmButtonText: "确定",
  2332. cancelButtonText: "取消",
  2333. type: "warning"
  2334. }).then(() => {
  2335. this.editCustomer(false, type)
  2336. }).catch(() => {
  2337. })
  2338. } else {
  2339. this.beforeBillData(true,type)
  2340. this.financialAccountDialog = true;
  2341. }
  2342. },
  2343. //生成账单 拿到主表信息
  2344. beforeBillData(bool,type){
  2345. this.applyPaymentList = [];
  2346. let arr = [];
  2347. this.billType = type
  2348. const data = this.goodsActives === 'gift'? this.contactsData: this.goodsShowData
  2349. data.map(e => {
  2350. if (e.submitPay != 1) {
  2351. const form = {
  2352. belongCompany: this.form.belongCompany,
  2353. srcOrderno:this.form.orgOrderNo,
  2354. itemType:"销售",
  2355. corpsName:this.form.corpName,
  2356. corpId:this.form.corpId,
  2357. srcParentId: this.form.id,
  2358. currency: 'CNY',
  2359. exchangeRate: '1',
  2360. taxRate: '0',
  2361. accDate: this.form.businesDate,
  2362. srcType: 1,
  2363. tradeType: 'GN',
  2364. optionType: 'GN',
  2365. chargeMember: this.form.chargeMember,
  2366. amount: e.amount,
  2367. quantity: e.orderQuantity, // 数量
  2368. price: e.price,
  2369. unit: e.unit,
  2370. goodName: e.cname,
  2371. srcFeesId: e.id,
  2372. costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  2373. }
  2374. arr.push(form)
  2375. }
  2376. })
  2377. let getFeeList = this.$refs.feeInfo.submitData().filter(item => item.feesType == 1 && item.submitPay != 1)
  2378. getFeeList.forEach(item => {
  2379. let form = {
  2380. srcOrderno:this.form.orgOrderNo,
  2381. itemType:"销售",
  2382. corpsName:this.form.corpName,
  2383. corpId:this.form.corpId,
  2384. srcParentId: this.form.id,
  2385. currency: 'CNY',
  2386. exchangeRate: '1',
  2387. taxRate: '0',
  2388. accDate: this.form.businesDate,
  2389. srcType: 2,
  2390. tradeType: 'GN',
  2391. optionType: 'GN',
  2392. chargeMember: this.form.chargeMember,
  2393. parentId: this.form.id,
  2394. amount: item.amount,
  2395. costType: item.itemId,
  2396. srcFeesId: item.id,
  2397. quantity: item.quantity, // 数量
  2398. price: item.price,
  2399. }
  2400. arr.push(form)
  2401. })
  2402. this.applyPaymentList = [...arr]
  2403. if(bool){ //申请货款
  2404. // this.billData.srcId = -1
  2405. }
  2406. },
  2407. //关闭账单
  2408. choceFun(){
  2409. this.financialAccountDialog = false
  2410. },
  2411. feeSubmit() {
  2412. this.saveActives = ''
  2413. this.queryData(this.form.id);
  2414. },
  2415. //商品选中触发
  2416. productSelection(selection) {
  2417. this.selection = selection
  2418. },
  2419. //点击费用明细选择触发
  2420. choice(row) {
  2421. this.dialogCost = !this.dialogCost
  2422. this.choiceData = true
  2423. this.choiceIndex = row.$index
  2424. },
  2425. // 去重
  2426. removeRepeat() {
  2427. let obj = []
  2428. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  2429. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  2430. return current
  2431. }, [])
  2432. },
  2433. removeGoodsRepeat() {
  2434. let obj = []
  2435. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  2436. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  2437. return current
  2438. }, [])
  2439. },
  2440. async getCorpRow(data) {
  2441. getCharge('KH', data.id).then(res => {
  2442. this.userList = res.data.data;
  2443. })
  2444. khDetail(data.id).then(res => {
  2445. if (res.data.data.adminProfiles) {
  2446. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  2447. let arr = [];
  2448. res.data.data.adminProfiles.forEach(e => {
  2449. arr.push(this.userList.find(item => item.id == e).cname)
  2450. })
  2451. this.$set(this.form, 'chargeMember', arr[0])
  2452. }
  2453. if (res.data.data.corpsAttnList.length > 0) {
  2454. this.khInfoList = res.data.data.corpsAttnList;
  2455. this.$set(this.form, 'corpAttn', res.data.data.corpsAttnList[0].cname);
  2456. this.$set(this.form, 'corpTel', res.data.data.corpsAttnList[0].tel);
  2457. } else {
  2458. this.khInfoList = [];
  2459. this.$set(this.form, 'corpAttn', null);
  2460. this.$set(this.form, 'corpTel', null);
  2461. }
  2462. })
  2463. if (data.belongtocompany) {
  2464. // this.form.belongToCorpId = data.belongtocompany
  2465. // this.returnBack({id: this.form.belongToCorpId})
  2466. }
  2467. getCorpDetail({corpId:data.id}).then(res => {
  2468. this.form.overPayment = res.data.data? res.data.data.balanceOverpaymen: 0
  2469. })
  2470. integralDetail({corpId:data.id}).then(res => {
  2471. this.form.pointMutiple = res.data.data? res.data.data.balancePoints: 0
  2472. })
  2473. getProfit({Id: data.id}).then(res => {
  2474. this.form.profit = res.data.data.surplusProfit? res.data.data.surplusProfit: '0.00'
  2475. })
  2476. this.arrivalOptions = [];
  2477. this.arrivalOptions = await this.corpAddr(data.id)
  2478. this.$set(this.form, 'paymentType', data.paymentType? data.paymentType: '预付')
  2479. this.$set(this.form, 'packageRemarks', data.packageRemarks? data.packageRemarks: '塑料')
  2480. if (this.arrivalOptions.length > 0) {
  2481. this.$set(this.form, 'arrivalAddress', this.arrivalOptions[0].label)
  2482. } else {
  2483. this.$set(this.form, 'arrivalAddress', null)
  2484. }
  2485. },
  2486. async getPlantRow(data) {
  2487. this.shippingOptions = [];
  2488. this.shippingOptions = await this.corpAddr(data.id)
  2489. if (this.shippingOptions.length > 0) {
  2490. this.$set(this.form, 'shippingAddress', this.shippingOptions[0].label)
  2491. } else {
  2492. this.$set(this.form, 'shippingAddress', null)
  2493. }
  2494. },
  2495. getRow(event,row) {
  2496. row.priceCategory = event[0].goodsTypeName
  2497. row.code = event[0].code
  2498. row.typeno = event[0].typeno
  2499. row.itemType = event[0].typeno
  2500. row.itemId = event[0].id
  2501. row.corpId = event[0].corpId
  2502. row.corpName = event[0].corpName
  2503. selectGoodsNum({
  2504. goodsId: event[0].id,
  2505. itemType: event[0].typeno,
  2506. tradeType: 'GN'
  2507. }).then(res => {
  2508. row.storageQuantity = res.data.data
  2509. })
  2510. row.integralMultiples = event[0].integralMultiples
  2511. this.quantityChange(row)
  2512. },
  2513. //点击商品明细选择触发
  2514. commodityChoice(row) {
  2515. this.dialogVisible = !this.dialogVisible
  2516. this.commodityData = true
  2517. this.choiceIndexT = row.$index
  2518. },
  2519. //导入商品触发
  2520. importChoice() {
  2521. // this.contactsData = this.contactsData.concat(this.tableData)
  2522. if (this.tableData.length === 1) {
  2523. this.goodsShowData[this.choiceIndexT].cname = this.tableData[0].cname
  2524. this.goodsShowData[this.choiceIndexT].code = this.tableData[0].code
  2525. this.goodsShowData[this.choiceIndexT].typeno = this.tableData[0].typeno
  2526. this.goodsShowData[this.choiceIndexT].itemType = this.tableData[0].typeno
  2527. this.goodsShowData[this.choiceIndexT].itemId = this.tableData[0].id
  2528. this.goodsShowData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  2529. this.goodsShowData[this.choiceIndexT].integralMultiples = this.tableData[0].integralMultiples
  2530. this.goodsShowData[this.choiceIndexT].corpId = this.tableData[0].corpId
  2531. this.goodsShowData[this.choiceIndexT].corpName = this.tableData[0].corpName
  2532. this.quantityChange(this.goodsShowData[this.choiceIndexT])
  2533. selectGoodsNum({
  2534. goodsId: this.tableData[0].id,
  2535. itemType: this.tableData[0].typeno,
  2536. tradeType: 'GN'
  2537. }).then(res => {
  2538. this.goodsShowData[this.choiceIndexT].storageQuantity = res.data.data
  2539. })
  2540. }
  2541. this.dialogVisible = !this.dialogVisible
  2542. this.commodityData = false
  2543. },
  2544. //费用编辑导入触发
  2545. choiceCost() {
  2546. if (this.tableDataCost.length === 1) {
  2547. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  2548. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  2549. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  2550. }
  2551. this.dialogCost = !this.dialogCost
  2552. this.choiceData = false
  2553. },
  2554. //费用导入触发
  2555. importCost() {
  2556. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  2557. if (this.tableDataCost.length > 0) {
  2558. for (let item in this.tableDataCost) {
  2559. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  2560. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  2561. this.$set(this.tableDataCost[item], 'amount', 0)
  2562. this.$set(this.tableDataCost[item], 'settlmentAmount', 0)
  2563. this.$set(this.tableDataCost[item], 'corpId', this.form.corpId)
  2564. this.tableDataCost[item].sort = this.maxFeeNum + 1
  2565. this.maxFeeNum++
  2566. delete this.tableDataCost[item].id
  2567. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  2568. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  2569. }
  2570. }
  2571. this.tableDataCost = []
  2572. this.dialogCost = false
  2573. },
  2574. //确认导入触发
  2575. async importGoods() {
  2576. if (this.goodsListSave.length > 0) {
  2577. this.goodsListSaveHandle()
  2578. } else {
  2579. if (this.tableData.length > 0) {
  2580. this.tableDataHandle()
  2581. }
  2582. }
  2583. },
  2584. goodsListSaveHandle() {
  2585. this.saveLoading = true;
  2586. for (let item in this.goodsListSave) {
  2587. getMarketPrice({code: this.goodsListSave[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2588. if (res.data.data.length > 0) {
  2589. this.$set(this.goodsListSave[item], 'price', res.data.data[0].salePrice)
  2590. } else {
  2591. this.$set(this.goodsListSave[item], 'price', '0')
  2592. }
  2593. this.priceChange(this.goodsListSave[item])
  2594. })
  2595. selectGoodsNum({
  2596. goodsId: this.goodsListSave[item].id,
  2597. itemType: this.goodsListSave[item].typeno,
  2598. tradeType: 'GN'
  2599. }).then(res => {
  2600. this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
  2601. // this.goodsListSave[item].storageQuantity = res.data.data
  2602. this.$set(this.goodsListSave[item], 'priceCategory', this.goodsListSave[item].goodsTypeName)
  2603. // this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
  2604. delete this.goodsListSave[item].goodsTypeName
  2605. this.goodsListSave[item].itemId = this.goodsListSave[item].id
  2606. this.$set(this.goodsListSave[item], 'corpName', this.goodsListSave[item].corpName)
  2607. this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
  2608. // this.$set(this.goodsListSave[item], 'orderQuantity', 1)
  2609. this.$set(this.goodsListSave[item], 'actualQuantity', 0)
  2610. this.$set(this.goodsListSave[item], 'invoiceWeight', this.goodsListSave[item].cartonWeight)
  2611. this.$set(this.goodsListSave[item], 'shopQuality', 0)
  2612. this.$set(this.goodsListSave[item], 'inputMold', 0) // 判断是商品还是政策 商品 0 特价 1 买赠2
  2613. // this.$set(this.goodsListSave[item], 'priceType', this.goodsListSave[item].policyName)
  2614. this.goodsListSave[item].amount = 0
  2615. if (this.goodsActives == "goods") {
  2616. this.$set(this.goodsListSave[item], 'goodType', 0)
  2617. } else {
  2618. this.$set(this.goodsListSave[item], 'goodType', 1)
  2619. this.$set(this.goodsListSave[item], 'integralMultiples', this.goodsListSave[item].integral)
  2620. }
  2621. this.$set(this.goodsListSave[item], 'integral', '0')
  2622. this.goodsListSave[item].sort = this.maxGoodsNum + 1
  2623. if (this.form.packageRemarks) {
  2624. this.goodsListSave[item].packageRemarks = this.form.packageRemarks
  2625. }
  2626. delete this.goodsListSave[item].id
  2627. delete this.goodsListSave[item].pid
  2628. delete this.goodsListSave[item].isDeleted
  2629. delete this.goodsListSave[item].status
  2630. delete this.goodsListSave[item].tenantId
  2631. delete this.goodsListSave[item].updateTime
  2632. delete this.goodsListSave[item].updateUser
  2633. delete this.goodsListSave[item].updateUserName
  2634. this.maxGoodsNum++
  2635. getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
  2636. if (res.data.data.length > 0) {
  2637. this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  2638. } else {
  2639. this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
  2640. }
  2641. this.quantityChange(this.goodsListSave[item])
  2642. this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
  2643. this.$nextTick(() => {
  2644. this.quantityChange(this.goodsListSave[item])
  2645. })
  2646. })
  2647. // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
  2648. })
  2649. }
  2650. this.saveLoading = false;
  2651. this.dialogVisible = false
  2652. },
  2653. tableDataHandle() {
  2654. this.saveLoading = true;
  2655. for (let item=0;item<this.tableData.length;item++) {
  2656. getMarketPrice({code: this.tableData[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2657. if (res.data.data.length > 0) {
  2658. this.$set(this.tableData[item], 'price', res.data.data[0].salePrice)
  2659. } else {
  2660. this.$set(this.tableData[item], 'price', '0')
  2661. }
  2662. this.priceChange(this.tableData[item])
  2663. })
  2664. selectGoodsNum({
  2665. goodsId: this.tableData[item].id,
  2666. itemType: this.tableData[item].typeno,
  2667. tradeType: 'GN'
  2668. }).then(res => {
  2669. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName;
  2670. this.tableData[item].storageQuantity = res.data.data;
  2671. delete this.tableData[item].goodsTypeName;
  2672. this.tableData[item].itemId = this.tableData[item].id;
  2673. this.$set(this.tableData[item], 'corpName', this.tableData[item].corpName);
  2674. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno);
  2675. // this.$set(this.tableData[item], 'orderQuantity', 1);
  2676. this.$set(this.tableData[item], 'actualQuantity', 0);
  2677. this.$set(this.tableData[item], 'shopQuality', 0);
  2678. this.$set(this.tableData[item], 'invoiceWeight', this.tableData[item].cartonWeight);
  2679. this.$set(this.tableData[item], 'inputMold', 0);
  2680. // this.$set(this.tableData[item], 'priceType', this.tableData[item].policyName);
  2681. this.tableData[item].amount = 0;
  2682. if (this.goodsActives == "goods") {
  2683. this.$set(this.tableData[item], 'goodType', 0)
  2684. } else {
  2685. this.$set(this.tableData[item], 'goodType', 1)
  2686. this.$set(this.tableData[item], 'integralMultiples', this.tableData[item].integral)
  2687. }
  2688. this.$set(this.tableData[item], 'integral', '0')
  2689. this.tableData[item].sort = this.maxGoodsNum + 1
  2690. if (this.form.packageRemarks) {
  2691. this.tableData[item].packageRemarks = this.form.packageRemarks
  2692. }
  2693. delete this.tableData[item].id
  2694. delete this.tableData[item].pid
  2695. delete this.tableData[item].isDeleted
  2696. delete this.tableData[item].status
  2697. delete this.tableData[item].tenantId
  2698. delete this.tableData[item].updateTime
  2699. delete this.tableData[item].updateUser
  2700. delete this.tableData[item].updateUserName
  2701. this.maxGoodsNum++
  2702. getPurchasePrice({code: this.tableData[item].code}).then(rest => {
  2703. if (rest.data.data.length > 0) {
  2704. this.$set(this.tableData[item], 'purchaseAmount', rest.data.data[0].purchasePrice)
  2705. } else {
  2706. this.$set(this.tableData[item], 'purchaseAmount', '0')
  2707. }
  2708. this.quantityChange(this.tableData[item])
  2709. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  2710. this.$nextTick(() => {
  2711. this.quantityChange(this.tableData[item])
  2712. })
  2713. })
  2714. // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
  2715. })
  2716. }
  2717. this.saveLoading = false;
  2718. this.dialogVisible = false
  2719. },
  2720. closeGoods() {
  2721. this.treeDataGoods = [];
  2722. this.treeDeptId = "";
  2723. this.activeName = "searchList";
  2724. },
  2725. closeFees() {
  2726. this.treeDeptIdCost = "";
  2727. this.treeData = [];
  2728. },
  2729. closePolicy() {
  2730. this.treePolicyId = '';
  2731. this.uploadPolicy.policyName = ''
  2732. this.dataPolicy = [];
  2733. this.contactsDataBuyFree = [];
  2734. this.policyData = []
  2735. this.policyDataTwo = []
  2736. },
  2737. //选中触发
  2738. selectionChange(list) {
  2739. this.tableData = list
  2740. },
  2741. //费用选中触发
  2742. selectionChangeCost(list) {
  2743. this.tableDataCost = list
  2744. },
  2745. //导入页左商品类型查询
  2746. nodeClick(data) {
  2747. this.treeDeptId = data.id;
  2748. this.page.currentPage = 1;
  2749. this.onLoad(this.page);
  2750. },
  2751. //导入页销售政策查询
  2752. policyNodeClick(data) {
  2753. this.uploadPolicy.policyName = data.id;
  2754. this.treePolicyId = data.id
  2755. // detailList(data.id).then(res => {
  2756. // //特价促销
  2757. // this.dataPolicy = res.data.data.specialItemList
  2758. // //买赠促销
  2759. // this.contactsDataBuyFree = res.data.data.presentItemList
  2760. // })
  2761. // this.policyOnLoad()
  2762. },
  2763. //导入页左费用类型查询
  2764. nodeClickCost(data) {
  2765. this.treeDeptIdCost = data.id;
  2766. this.pageCost.currentPage = 1;
  2767. this.onLoadCost(this.pageCost);
  2768. },
  2769. //刷新触发
  2770. refreshChange() {
  2771. this.treeDeptId = ''
  2772. this.page.currentPage = 1;
  2773. this.onLoad(this.page);
  2774. },
  2775. //销售政策特价促销选中触发
  2776. selectionChangePolicy(list) {
  2777. this.policyData = list
  2778. // this.policyData.forEach(item => {
  2779. // this.$set(item, 'price', item.specialOffer)
  2780. // })
  2781. if (this.policyData.length > 0) {
  2782. this.customerBuyFree.selection = false
  2783. this.customerBuyFree.menu = false
  2784. } else {
  2785. this.customerBuyFree.selection = true
  2786. this.customerBuyFree.menu = true
  2787. }
  2788. },
  2789. //销售政策买赠促销选中触发
  2790. selectionChangePolicyTwo(list) {
  2791. this.policyDataTwo = list
  2792. // this.policyDataTwo.forEach(item => {
  2793. // this.$set(item, 'price', item.salePrice)
  2794. // })
  2795. if (this.policyDataTwo.length > 0) {
  2796. this.optionPolicy.selection = false
  2797. this.optionPolicy.menu = false
  2798. } else {
  2799. this.optionPolicy.selection = true
  2800. this.optionPolicy.menu = true
  2801. }
  2802. },
  2803. //匹配id去重
  2804. deWeightFour(arr) {
  2805. let arrTemp = [];
  2806. arr = arr.reduce(function (a, b) {
  2807. if ( arrTemp.indexOf(b.id+b.id)==-1 ) {
  2808. a.push(b)
  2809. arrTemp.push(b.id+b.id)
  2810. }
  2811. return a
  2812. }, [])
  2813. return arr
  2814. },
  2815. //导入商品政策
  2816. importPolicy() {
  2817. let list = []
  2818. if (this.buyAndGiveList.length > 0 || this.goodsListPolicy > 0){
  2819. list = this.deepClone(this.buyAndGiveList.concat(this.goodsListPolicy))
  2820. }else {
  2821. list = this.deepClone(this.policyData.concat(this.policyDataTwo))
  2822. }
  2823. // list = this.deWeightFour(list)
  2824. let listLength = this.policyDataTwo.length + this.buyAndGiveList.length
  2825. // 买赠额外加一条
  2826. let buyFree = []
  2827. if (this.policyDataTwo.length > 0 || this.goodsListPolicy.length > 0 || this.buyAndGiveList.length >0) {
  2828. buyFree = this.deepClone((this.policyDataTwo.concat(this.goodsListPolicy)).concat(this.buyAndGiveList))
  2829. }
  2830. for (let item in list) {
  2831. if (this.policyData.length > 0 || this.buyAndGiveList > 0) {
  2832. if (!list[item].specialOffer) {
  2833. getMarketPrice({code: list[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2834. if (response.data.data.length > 0) {
  2835. this.$set(list[item], 'price', response.data.data[0].salePrice)
  2836. } else {
  2837. this.$set(list[item], 'price', '0')
  2838. }
  2839. this.priceChange(list[item])
  2840. })
  2841. } else {
  2842. this.$set(list[item], 'price', list[item].specialOffer)
  2843. this.priceChange(list[item])
  2844. }
  2845. this.$set(list[item], 'inputMold', 1)
  2846. this.$set(list[item], 'goodType', 0)
  2847. } else {
  2848. if (!list[item].salePrice) {
  2849. getMarketPrice({code: list[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2850. if (response.data.data.length > 0) {
  2851. this.$set(list[item], 'price', response.data.data[0].salePrice)
  2852. } else {
  2853. this.$set(list[item], 'price', '0')
  2854. }
  2855. this.priceChange(list[item])
  2856. })
  2857. } else {
  2858. this.$set(list[item], 'price', list[item].salePrice)
  2859. this.priceChange(list[item])
  2860. }
  2861. this.$set(list[item], 'inputMold', 2)
  2862. this.$set(buyFree[item], 'inputMold', 2)
  2863. this.$set(buyFree[item], 'price', '0')
  2864. this.$set(buyFree[item], 'orderQuantity', list[item].salesVolume)
  2865. this.$set(buyFree[item], 'itemType', list[item].typeno)
  2866. this.$set(list[item], 'goodType', 0)
  2867. }
  2868. selectGoodsNum({
  2869. goodsId: list[item].itemId,
  2870. itemType: list[item].typeno,
  2871. tradeType: 'GN'
  2872. }).then(res => {
  2873. this.$set(list[item], 'storageQuantity', res.data.data)
  2874. if (listLength != 0) {
  2875. this.$set(buyFree[item], 'storageQuantity', res.data.data)
  2876. }
  2877. this.$set(list[item], 'goodType', 0)
  2878. this.$set(list[item], 'itemType', list[item].typeno)
  2879. this.$set(list[item], 'actualQuantity', 0)
  2880. this.$set(list[item], 'orderQuantity', list[item].orderQuantity? list[item].orderQuantity: 0)
  2881. // this.$set(list[item], 'amount', 0)
  2882. this.$set(list[item], 'priceCategory', list[item].productCategory)
  2883. if(this.policyForm.cname){
  2884. this.$set(list[item], 'priceType', this.policyForm.cname)
  2885. }
  2886. this.$set(list[item], 'cname', list[item].productCategory)
  2887. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  2888. console.log(list[item])
  2889. this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
  2890. // 积分
  2891. this.$set(list[item], 'integralMultiples', 0)
  2892. this.$set(list[item], 'integral', 0)
  2893. this.$set(list[item], 'shopQuality', 0)
  2894. if (listLength != 0) {
  2895. this.$set(buyFree[item], 'actualQuantity', 0)
  2896. this.$set(buyFree[item], 'orderQuantity', 0)
  2897. // this.$set(buyFree[item], 'amount', 0)
  2898. this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
  2899. this.$set(buyFree[item], 'priceType', this.policyForm.cname)
  2900. this.$set(buyFree[item], 'cname', list[item].productCategory)
  2901. this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
  2902. this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
  2903. // 积分
  2904. this.$set(buyFree[item], 'integralMultiples', 0)
  2905. this.$set(buyFree[item], 'integral', 0)
  2906. this.$set(buyFree[item], 'shopQuality', 0)
  2907. this.$set(buyFree[item], 'goodType', 0)
  2908. this.maxGoodsNum++
  2909. delete buyFree[item].id
  2910. delete buyFree[item].pid
  2911. delete buyFree[item].isDeleted
  2912. delete buyFree[item].status
  2913. delete buyFree[item].tenantId
  2914. delete buyFree[item].updateTime
  2915. delete buyFree[item].updateUser
  2916. delete buyFree[item].updateUserName
  2917. }
  2918. delete list[item].id
  2919. delete list[item].pid
  2920. delete list[item].isDeleted
  2921. delete list[item].status
  2922. delete list[item].tenantId
  2923. delete list[item].updateTime
  2924. delete list[item].updateUser
  2925. delete list[item].updateUserName
  2926. this.maxGoodsNum++
  2927. this.$refs.crudContact.rowCellAdd(list[item]);
  2928. this.$nextTick(() => {
  2929. this.quantityChange(list[item])
  2930. })
  2931. if (listLength != 0) {
  2932. this.$refs.crudContact.rowCellAdd(buyFree[item]);
  2933. this.quantityChange(buyFree[item])
  2934. }
  2935. })
  2936. }
  2937. this.policyDialog = false
  2938. },
  2939. //费用刷新触发
  2940. refreshChangeCost() {
  2941. this.treeDeptIdCost = '';
  2942. this.pageCost.currentPage = 1;
  2943. this.onLoadCost(this.pageCost);
  2944. },
  2945. //新增商品信息保存触发
  2946. rowSave(row, done, loading) {
  2947. // this.contactsData.push(row)
  2948. done()
  2949. },
  2950. //修改商品信息触发
  2951. rowUpdate(row, index, done, loading) {
  2952. done(row);
  2953. },
  2954. //删除商品信息触发
  2955. rowDel(row, index, donerowDel) {
  2956. this.$confirm("确定将选择数据删除?", {
  2957. confirmButtonText: "确定",
  2958. cancelButtonText: "取消",
  2959. type: "warning"
  2960. }).then(() => {
  2961. //商品判断是否需要调用删除接口
  2962. if (row.id) {
  2963. corpsattn(row.id).then(res => {
  2964. this.$message({
  2965. type: "success",
  2966. message: "操作成功!"
  2967. });
  2968. this.goodsShowData.splice(row.$index, 1);
  2969. if (this.goodsActives == 'goods') {
  2970. this.form.presenterIntegral = 0;
  2971. this.form.orderAmount = 0;
  2972. this.goodsShowData.forEach(item => {
  2973. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  2974. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  2975. })
  2976. this.computedCost()
  2977. } else {
  2978. this.form.convertIntegral = 0;
  2979. this.goodsShowData.forEach(item => {
  2980. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  2981. })
  2982. }
  2983. })
  2984. } else {
  2985. this.$message({
  2986. type: "success",
  2987. message: "操作成功!"
  2988. });
  2989. this.goodsShowData.splice(row.$index, 1);
  2990. if (this.goodsActives == 'goods') {
  2991. this.form.presenterIntegral = 0;
  2992. this.form.orderAmount = 0;
  2993. this.goodsShowData.forEach(item => {
  2994. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  2995. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  2996. })
  2997. this.computedCost()
  2998. } else {
  2999. this.form.convertIntegral = 0;
  3000. this.goodsShowData.forEach(item => {
  3001. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  3002. })
  3003. }
  3004. }
  3005. })
  3006. },
  3007. // 批量删除
  3008. removeList() {
  3009. const isId = this.selection.filter(item => item.id);
  3010. const noId = this.selection.filter(item => !item.id);
  3011. const ids = []
  3012. isId.forEach(e => ids.push(e.id));
  3013. this.$confirm("确定将选择数据删除?", {
  3014. confirmButtonText: "确定",
  3015. cancelButtonText: "取消",
  3016. type: "warning"
  3017. }).then(() => {
  3018. this.goodsLoading = true;
  3019. if (ids.length > 0) {
  3020. removeList(ids.join(',')).then(res => {
  3021. this.selection.forEach(item => {
  3022. const index = this.goodsShowData.findIndex(e => e == item);
  3023. this.goodsShowData.splice(index, 1);
  3024. })
  3025. this.$message.success('删除成功')
  3026. }).finally(() => {
  3027. this.goodsLoading = false;
  3028. })
  3029. } else {
  3030. this.selection.forEach(item => {
  3031. const index = this.goodsShowData.findIndex(e => e == item);
  3032. this.goodsShowData.splice(index, 1);
  3033. })
  3034. this.$message.success('删除成功')
  3035. this.goodsLoading = false;
  3036. }
  3037. })
  3038. },
  3039. //新增费用明细保存触发
  3040. rowSaveProject(row, done, loading) {
  3041. // this.advantageProjectData.push(row)
  3042. done()
  3043. },
  3044. //修改费用明细触发
  3045. rowUpdateProject(row, index, done, loading) {
  3046. done(row);
  3047. },
  3048. policyOnLoad(params = {}) {
  3049. this.loadingPolicy = true;
  3050. this.policyForm = {};
  3051. detailList(this.treePolicyId).then(res => {
  3052. this.policyForm = res.data.data;
  3053. //特价促销
  3054. if(res.data.data.specialItemList) {
  3055. this.dataPolicy = res.data.data.specialItemList
  3056. this.dataPolicy.forEach(item => {
  3057. this.$set(item, 'orderQuantity', 0);
  3058. })
  3059. } else {
  3060. this.dataPolicy = []
  3061. }
  3062. //买赠促销
  3063. if (res.data.data.presentItemList) {
  3064. this.contactsDataBuyFree = res.data.data.presentItemList
  3065. } else {
  3066. this.contactsDataBuyFree = []
  3067. }
  3068. }).finally(() => {
  3069. this.loadingPolicy = false;
  3070. })
  3071. },
  3072. //
  3073. goodsSearch(params, done) {
  3074. this.treeDeptId = ''
  3075. params = {
  3076. ...params,
  3077. artsVision: this.form.belongToCorpId
  3078. }
  3079. this.onLoad(this.page, params);
  3080. done()
  3081. },
  3082. //商品列表查询
  3083. onLoad(page, params = {artsVision: this.form.belongToCorpId}) {
  3084. this.loading = true;
  3085. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
  3086. const data = res.data.data;
  3087. this.page.total = data.total;
  3088. this.pageList.total = data.total
  3089. this.data = data.records;
  3090. this.goodsListShow = data.records;
  3091. this.loading = false;
  3092. });
  3093. },
  3094. // 费用查询按钮
  3095. feesSearch(params, done) {
  3096. this.treeDeptIdCost = '';
  3097. this.onLoadCost(this.pageCost, params)
  3098. done()
  3099. },
  3100. //费用查询
  3101. onLoadCost(page, params = {}) {
  3102. this.loadingCost = true;
  3103. let queryParams = Object.assign({}, params, {
  3104. pageSize: page.pageSize,
  3105. pageNum: page.currentPage,
  3106. parentId: 0,
  3107. feesTypeId: this.treeDeptIdCost
  3108. })
  3109. customerList(queryParams).then(res => {
  3110. const data = res.data.data;
  3111. this.pageCost.total = data.total;
  3112. this.dataCost = data.records;
  3113. this.loadingCost = false;
  3114. });
  3115. },
  3116. //删除费用明细触发
  3117. rowDelProject(row, index, donerowDel) {
  3118. this.$confirm("确定将选择数据删除?", {
  3119. confirmButtonText: "确定",
  3120. cancelButtonText: "取消",
  3121. type: "warning"
  3122. }).then(() => {
  3123. //费用判断是否需要调用删除接口
  3124. if (row.id) {
  3125. corpsitem(row.id).then(res => {
  3126. this.$message.success("操作成功!");
  3127. this.advantageProjectData.splice(row.$index, 1);
  3128. })
  3129. } else {
  3130. this.$message.success("操作成功!");
  3131. this.advantageProjectData.splice(row.$index, 1);
  3132. }
  3133. })
  3134. },
  3135. //修改提交触发
  3136. async editCustomer(isBack = false, type,other) {
  3137. this.$refs["form"].validate(async (valid) => {
  3138. if (valid) {
  3139. const length = this.goodsActives === 'gift' ? this.contactsData.length : this.goodsShowData.length
  3140. const length1 = this.goodsActives === 'goods' ? this.giftData : this.goodsShowData
  3141. for (let i = 0; i < length; i++) {
  3142. const data = this.goodsActives === 'gift' ? this.contactsData : this.goodsShowData;
  3143. if (Number(data[i].orderQuantity) > Number(data[i].storageQuantity)) {
  3144. return this.$message.error('商品信息第' + (Number(i) + 1) + '行订货数量大于库存数量')
  3145. }
  3146. if (Number(data[i].purchaseAmount) === 0) {
  3147. return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为0')
  3148. }
  3149. if (!Number(data[i].purchaseAmount)) {
  3150. return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为空')
  3151. }
  3152. }
  3153. let integral = 0;//积分
  3154. if (length1) {
  3155. length1.forEach(item => {
  3156. integral += Number(item.integral)
  3157. })
  3158. }
  3159. if (Number(this.form.pointMutiple) < Number(integral)) return this.$message.error('积分余额不足')
  3160. //商品信息
  3161. if (this.goodsActives == 'gift') {
  3162. this.form.orderItemsList = this.goodsShowData.concat(this.contactsData)
  3163. } else {
  3164. this.form.orderItemsList = this.goodsShowData.concat(this.giftData)
  3165. }
  3166. // 判断是否能保存
  3167. let goodsData = this.form.orderItemsList.filter(item => item.goodType == 0)
  3168. // 计算特价占比
  3169. let allNum = 0; // 总数量
  3170. let specialNum = 0; // 特价数量
  3171. let sizeNum = 0; // 大尺寸数量
  3172. goodsData.forEach(item => allNum += Number(item.orderQuantity));
  3173. // inputMold判断是商品还是政策 商品 0 特价 1 买赠2,isSpecial 0正常 1特价
  3174. goodsData.filter(item => item.inputMold === 1 && item.isSpecial === 1).forEach(item => specialNum += Number(item.orderQuantity));
  3175. goodsData.filter(item => Number(item.size) >= 17).forEach(item => sizeNum += Number(item.orderQuantity));
  3176. this.$set(this.form, 'specialOfferOf', allNum == 0 ? '0.00' : (specialNum / allNum * 100).toFixed(2));
  3177. this.$set(this.form, 'largeScale', allNum == 0 ? '0.00' : (sizeNum / allNum * 100).toFixed(2));
  3178. for (let item in goodsData) {
  3179. if (Number(goodsData[item].orderQuantity) > Number(goodsData[item].storageQuantity)) {
  3180. return this.$message.error('商品信息第' + (parseInt(item) + 1) + '行订货数量不能超过库存')
  3181. }
  3182. }
  3183. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  3184. let packFee;
  3185. if (this.form.packageRemarks && this.form.packageRemarks !== '无包装' && this.form.packageRemarks !== '不包装') {
  3186. let arr = this.form.orderFeesList.filter(item => item.feesType == 1)
  3187. packFee = arr.findIndex(item => item.feeName == '包装费')
  3188. }
  3189. if (packFee == -1) {
  3190. return this.$message.error('费用明细未有包装费')
  3191. }
  3192. // 产生返利、本次使用返利为空 默认为0
  3193. this.form.createProfit = this.form.createProfit ? this.form.createProfit : 0
  3194. this.form.thisUsedProfit = this.form.thisUsedProfit ? this.form.thisUsedProfit : 0
  3195. // 计算毛利额
  3196. this.$set(this.form, 'orderAmount', 0)
  3197. // 成本价
  3198. let purchaseAmount = 0
  3199. if (this.form.orderAmount && this.form.settlmentAmount) {
  3200. this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
  3201. }
  3202. // 销售金额
  3203. this.form.orderAmount = 0;
  3204. // 计算销售金额
  3205. console.log(this.form.orderItemsList)
  3206. this.form.orderItemsList.forEach(item => {
  3207. if (item.goodType == 0) {
  3208. if (item.purchaseAmount) {
  3209. purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
  3210. }
  3211. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3212. }
  3213. })
  3214. // 判断订货数量不能小于等于0
  3215. for (let item in this.form.orderItemsList) {
  3216. if (Number(this.form.orderItemsList[item].orderQuantity) <= 0) {
  3217. return this.$message.error('订货数量不能小于等于0')
  3218. }
  3219. }
  3220. // this.form.orderFeesList = this.advantageProjectData
  3221. this.form.orderFilesList = this.bankOfDepositData
  3222. if (typeof this.form.corpsTypeId == 'object') {
  3223. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  3224. }
  3225. this.form.billType = 'XS'
  3226. // 如果有id解锁,没有跳过
  3227. // this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3228. this.saveLoading = true
  3229. await this.computedCost()
  3230. typeSave(this.form).then(res => {
  3231. // this.$set(this.detailData, 'seeDisabled', true);
  3232. if (!other) {
  3233. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  3234. }
  3235. if (isBack) {
  3236. //成功关闭此页面回到列表页
  3237. this.$emit("goBack");
  3238. this.leaveDetailsKey(this.$route.name)
  3239. } else {
  3240. this.saveActives = ''
  3241. this.queryData(res.data.data.id, false, other)
  3242. }
  3243. if (type == '发货') {
  3244. let lsit = []
  3245. this.selection = this.selection.concat(this.giftData)
  3246. this.selection.forEach(item => {
  3247. lsit.push(item.id)
  3248. })
  3249. let data = {
  3250. id: this.form.id,
  3251. orderItemIds: lsit
  3252. }
  3253. generateShipment(data).then(res => {
  3254. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  3255. this.$router.push({
  3256. path: "/businessManagement/deliveryNotice/index",
  3257. query: {form: JSON.stringify(res.data.data), pageType: "Generate",},
  3258. });
  3259. })
  3260. } else if (type == '采购') {
  3261. if ((Number(this.form.settlmentAmount) < Number(this.form.debitAmount)) && !this.arrearsCheck) return this.$message.error('收款未收齐,禁止生成采购单');
  3262. this.$confirm("是否生成采购单?", {
  3263. confirmButtonText: "确定",
  3264. cancelButtonText: "取消",
  3265. type: "warning"
  3266. }).then(() => {
  3267. saveSell(this.form.id).then(res => {
  3268. if (res.data.code == 200) {
  3269. this.$message.success("生成成功");
  3270. this.messageVisble = true
  3271. this.$nextTick(() => {
  3272. this.$refs.messagePost.init()
  3273. })
  3274. }
  3275. });
  3276. });
  3277. } else if (type == '收费') {
  3278. this.beforeBillData(true, type)
  3279. this.applySettlementDialog = true;
  3280. }
  3281. }).finally(() => {
  3282. this.saveLoading = false
  3283. })
  3284. } else {
  3285. return this.$message.error('存在漏填必填项,请补全');
  3286. }
  3287. });
  3288. },
  3289. // 计算应收未收款
  3290. computedCost() {
  3291. // if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
  3292. // this.form.caseOverPayment = 0;
  3293. // return this.$message.error('本次使用的溢付款不能超过总溢付款')
  3294. // }
  3295. if (Number(this.form.thisUsedProfit) > Number(this.form.profit)) {
  3296. this.form.thisUsedProfit = 0;
  3297. return this.$message.error('本次使用的返利不能超过返利余额')
  3298. }
  3299. // 销售金额
  3300. let orderAmount = this.form.orderAmount? this.form.orderAmount: 0
  3301. // 已收款
  3302. let settlmentAmount = this.form.settlmentAmount? this.form.settlmentAmount: 0
  3303. // 本次溢付款
  3304. // let caseOverPayment = this.form.caseOverPayment? this.form.caseOverPayment: 0
  3305. // 本次试用返利
  3306. let thisUsedProfit = this.form.thisUsedProfit? this.form.thisUsedProfit: 0
  3307. let feeAmountD = 0; //费用明细应收
  3308. let feeAmountC = 0; //费用明细应付
  3309. this.$refs.feeInfo.submitData().filter(item => item.feesType == 1).forEach(item => {
  3310. feeAmountD += Number(item.amount)
  3311. })
  3312. this.$refs.feeInfo.submitData().filter(item => item.feesType == 2).forEach(item => {
  3313. feeAmountC += Number(item.amount)
  3314. })
  3315. this.$set(this.form, 'debitAmount', ((Number(orderAmount) - Number(thisUsedProfit) + Number(feeAmountD) - Number(feeAmountC)).toFixed(2)))
  3316. this.$set(this.form, "balanceAmount", (Number(this.form.debitAmount) - Number(settlmentAmount)).toFixed(2));
  3317. },
  3318. quantityChange(row) {
  3319. if (!row.orderQuantity) {
  3320. row.orderQuantity = 0;
  3321. } else {
  3322. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  3323. row.amount = (row.price * row.orderQuantity).toFixed(2)
  3324. }
  3325. if (!row.integralMultiples) {
  3326. row.integralMultiples = 0
  3327. }
  3328. row.integral = (Number(row.orderQuantity) * Number(row.integralMultiples)).toFixed(2)
  3329. if (this.goodsActives == 'goods') {
  3330. // 计算销售金额
  3331. this.form.orderAmount = 0
  3332. // 计算赠送积分
  3333. this.form.presenterIntegral = 0;
  3334. this.goodsShowData.forEach(item => {
  3335. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3336. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  3337. })
  3338. this.computedCost()
  3339. } else {
  3340. this.form.convertIntegral = 0;
  3341. this.goodsShowData.forEach(item => {
  3342. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  3343. })
  3344. }
  3345. },
  3346. priceChange(row) {
  3347. if (!row.price) {
  3348. row.price = 0;
  3349. row.amount = '0.00'
  3350. } else {
  3351. row.amount = (row.price * row.orderQuantity).toFixed(2)
  3352. }
  3353. if (this.goodsActives == 'goods') {
  3354. // 计算销售金额
  3355. this.form.orderAmount = 0
  3356. this.goodsShowData.forEach(item => {
  3357. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3358. })
  3359. this.computedCost()
  3360. }
  3361. },
  3362. //返回列表
  3363. backToList() {
  3364. let getGoodsList = []
  3365. let getGiftList = []
  3366. let getFeeList = this.$refs.feeInfo.submitData()
  3367. if (this.goodsActives == 'gift') {
  3368. getGiftList = this.goodsShowData
  3369. getGoodsList = this.contactsData
  3370. } else {
  3371. getGoodsList = this.goodsShowData
  3372. getGiftList = this.giftData
  3373. }
  3374. if (contrastObj(this.form, this.oldForm) ||
  3375. contrastList(getGoodsList, this.oldGoodsList) ||
  3376. contrastList(getGiftList, this.oldGiftList) ||
  3377. // contrastList(getFeeList, this.oldFeesList) ||
  3378. contrastList(this.bankOfDepositData, this.oldUploadList)
  3379. ) {
  3380. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  3381. confirmButtonText: "确定",
  3382. cancelButtonText: "取消",
  3383. type: "warning"
  3384. }).then(() => {
  3385. this.editCustomer(true)
  3386. }).catch(() => {
  3387. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3388. this.$emit("goBack");
  3389. this.leaveDetailsKey(this.$route.name)
  3390. })
  3391. } else {
  3392. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3393. this.$emit("goBack");
  3394. this.leaveDetailsKey(this.$route.name)
  3395. }
  3396. },
  3397. // 保存列设置
  3398. async saveColumn(name) {
  3399. if (name == 'goods') {
  3400. const inSave = await this.saveColumnData(
  3401. this.getColumnName(15),
  3402. this.customerContact
  3403. );
  3404. if (inSave) {
  3405. this.$message.success("保存成功");
  3406. //关闭窗口
  3407. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  3408. this.$nextTick(() => {
  3409. this.$refs.crudContact.doLayout()
  3410. })
  3411. }
  3412. } else if (name === 'fees') {
  3413. const inSave = await this.saveColumnData(
  3414. this.getColumnName(16),
  3415. this.advantageProject
  3416. );
  3417. if (inSave) {
  3418. this.$message.success("保存成功");
  3419. //关闭窗口
  3420. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  3421. }
  3422. }
  3423. },
  3424. async resetColumn() {
  3425. this.customerContact = customerContact
  3426. const inSave = await this.delColumnData(
  3427. this.getColumnName(15),
  3428. customerContact
  3429. );
  3430. if (inSave) {
  3431. this.$nextTick(() => {
  3432. this.$refs.crudContact.doLayout()
  3433. })
  3434. this.$message.success("重置成功");
  3435. this.judgeNew()
  3436. //关闭窗口
  3437. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  3438. }
  3439. },
  3440. returnBack(row) {
  3441. console.log(row)
  3442. this.$refs.KHSelect[0].updateData(row.id)
  3443. getKHList({corpType: 'KH', belongtocompany: row.id}).then(res => {
  3444. //注释自动带出客户全称
  3445. // this.form.corpId = res.data.data.records.length > 0? res.data.data.records[0].id: null
  3446. // if (this.form.corpId) {
  3447. // this.getCorpRow({adminProfiles: res.data.data.records[0].adminProfiles,
  3448. // id: res.data.data.records[0].id,
  3449. // packageRemarks: res.data.data.records[0].packageRemarks,
  3450. // paymentType: res.data.data.records[0].paymentType})
  3451. // }
  3452. })
  3453. getKHList({corpType: 'GYS', belongtocompany: row.id}).then(res => {
  3454. this.form.productionPlant = res.data.data.records.length > 0? res.data.data.records[0].id: null;
  3455. if (this.form.productionPlant) {
  3456. this.getPlantRow({id: this.form.productionPlant})
  3457. }
  3458. })
  3459. this.form.belongCompany = row.cname
  3460. getlistBankBy(row.id).then(res =>{
  3461. this.$set(this.form, 'banks', null)
  3462. this.$set(this.form, 'banksAccountName', null)
  3463. this.$set(this.form, 'accountBank', null)
  3464. this.bankList = res.data
  3465. if (this.bankList.length > 0) {
  3466. this.form.banks = this.bankList[0].accountNo
  3467. this.form.banksAccountName = this.bankList[0].accountName
  3468. this.form.accountBank = this.bankList[0].accountBank
  3469. }
  3470. })
  3471. },
  3472. // 银行账号变化
  3473. banksChange(val) {
  3474. let isTrue = false
  3475. this.bankList.forEach(item => {
  3476. if (val == item.accountNo) {
  3477. this.$set(this.form, 'banksAccountName', item.accountName)
  3478. this.$set(this.form, 'accountBank', item.accountBank)
  3479. isTrue = true
  3480. }
  3481. })
  3482. if (!isTrue) {
  3483. this.$set(this.form, 'banksAccountName', null)
  3484. this.$set(this.form, 'accountBank', null)
  3485. }
  3486. },
  3487. // 联系人变化
  3488. corpAttnChange(val) {
  3489. let isTrue = false
  3490. this.khInfoList.forEach(item => {
  3491. if (val == item.id) {
  3492. this.$set(this.form, 'corpTel', item.tel)
  3493. isTrue = true
  3494. }
  3495. })
  3496. if (!isTrue) {
  3497. this.$set(this.form, 'corpTel', null)
  3498. }
  3499. },
  3500. // 合计计算
  3501. summaryMethod({ columns, data }) {
  3502. const sums = [];
  3503. if (columns.length > 0) {
  3504. columns.forEach((item, index) => {
  3505. sums[0] = '合计'
  3506. if (
  3507. item.property == "amount" ||
  3508. item.property == "orderQuantity" ||
  3509. item.property == "actualQuantity" ||
  3510. item.property == "integral" ||
  3511. item.property == "cartonWeight" ||
  3512. item.property == "cntrVolumn"
  3513. ) {
  3514. let amountSum = 0;
  3515. let orderQuantitySum = 0;
  3516. let actualQuantitySum = 0;
  3517. let integralSum = 0;
  3518. let cartonWeight = 0;
  3519. let cntrVolumn = 0;
  3520. if (this.selection.length > 0) {
  3521. this.selection.forEach(e => {
  3522. amountSum = _.add(amountSum, Number(e.amount));
  3523. orderQuantitySum = _.add(orderQuantitySum, Number(e.orderQuantity));
  3524. actualQuantitySum = _.add(actualQuantitySum, Number(e.actualQuantity));
  3525. integralSum = _.add(integralSum, Number(e.integral));
  3526. cartonWeight = _.add(cartonWeight, Number(e.cartonWeight));
  3527. cntrVolumn = _.add(cntrVolumn, Number(e.cntrVolumn));
  3528. })
  3529. }else {{
  3530. this.goodsShowData.forEach(e => {
  3531. amountSum = _.add(amountSum, Number(e.amount));
  3532. orderQuantitySum = _.add(orderQuantitySum, Number(e.orderQuantity));
  3533. actualQuantitySum = _.add(actualQuantitySum, Number(e.actualQuantity));
  3534. integralSum = _.add(integralSum, Number(e.integral));
  3535. cartonWeight = _.add(cartonWeight, Number(e.cartonWeight));
  3536. cntrVolumn = _.add(cntrVolumn, Number(e.cntrVolumn));
  3537. })
  3538. }}
  3539. // 订货数量合计
  3540. if (item.property == "orderQuantity") {
  3541. sums[index] = orderQuantitySum ? orderQuantitySum.toFixed(0) : "0";
  3542. }
  3543. // 发货数量合计
  3544. if (item.property == "actualQuantity") {
  3545. sums[index] = actualQuantitySum ? actualQuantitySum.toFixed(0) : "0";
  3546. }
  3547. // 金额合计
  3548. if (item.property == "amount") {
  3549. sums[index] = amountSum ? amountSum.toFixed(2) : "0.00";
  3550. }
  3551. // 积分合计
  3552. if (item.property == "integral") {
  3553. sums[index] = integralSum ? integralSum.toFixed(2) : "0.00";
  3554. }
  3555. // 重量合计
  3556. if (item.property == "cartonWeight") {
  3557. sums[index] = cartonWeight ? cartonWeight.toFixed(2) : "0.00";
  3558. }
  3559. // 体积合计
  3560. if (item.property == "cntrVolumn") {
  3561. sums[index] = cntrVolumn ? cntrVolumn.toFixed(2) : "0.00";
  3562. }
  3563. }
  3564. })
  3565. }
  3566. return sums;
  3567. },
  3568. // 标签页切换
  3569. tabHandle(data) {
  3570. if (data.name == 'searchList') {
  3571. this.goodsListShow = this.data;
  3572. this.page.total = this.pageList.total
  3573. } else if (data.name == 'importStaging') {
  3574. this.goodsListShow = this.goodsListSave;
  3575. this.page.total = 0
  3576. }
  3577. },
  3578. // 政策标签页切换
  3579. tabHandleTwo(data) {
  3580. if (data.name == 'searchList') {
  3581. this.dataPolicy = this.dataTwo;
  3582. this.contactsDataBuyFree = this.dataThree;
  3583. } else if (data.name == 'importStaging') {
  3584. this.dataTwo = this.dataPolicy;
  3585. this.dataPolicy = this.goodsListPolicy;
  3586. this.dataThree = this.contactsDataBuyFree;
  3587. this.contactsDataBuyFree = this.buyAndGiveList;
  3588. }
  3589. },
  3590. removeStagList(row, index,type) {
  3591. if (type === 'policy'){
  3592. this.goodsListPolicy.splice(row.$index, 1)
  3593. if (this.goodsListPolicy.length == 0){
  3594. this.customerBuyFree.selection = true
  3595. this.optionPolicy.selection = true
  3596. this.$set(this.customerBuyFree,'menu',true)
  3597. }
  3598. }else if (type === 'policy_buyAndGive'){
  3599. this.buyAndGiveList.splice(row.$index, 1)
  3600. if (this.buyAndGiveList.length == 0){
  3601. this.customerBuyFree.selection = true
  3602. this.optionPolicy.selection = true
  3603. this.$set(this.optionPolicy,'menu',true)
  3604. }
  3605. }else {
  3606. this.goodsListSave.splice(row.$index, 1)
  3607. }
  3608. },
  3609. importStagList(row, index,type) {
  3610. if (type === 'policy'){
  3611. this.goodsListPolicy.push(row);
  3612. if (this.goodsListPolicy.length>0){
  3613. this.customerBuyFree.selection = false
  3614. this.optionPolicy.selection = true
  3615. this.$set(this.customerBuyFree,'menu',false)
  3616. }
  3617. }else if (type === 'policy_buyAndGive'){
  3618. this.buyAndGiveList.push(row);
  3619. if (this.buyAndGiveList.length>0){
  3620. this.customerBuyFree.selection = true
  3621. this.optionPolicy.selection = false
  3622. this.$set(this.optionPolicy,'menu',false)
  3623. }
  3624. }else {
  3625. this.goodsListSave.push(row);
  3626. }
  3627. },
  3628. // 商品信息标签页切换
  3629. handleClick(data) {
  3630. if (this.saveActives == data.name) return
  3631. this.saveActives = data.name
  3632. this.goodsDisabled = true
  3633. if (data.name == 'goods') {
  3634. this.giftData = this.goodsShowData.filter(item => item.goodType == 1)
  3635. // 显示
  3636. this.customerContact.column.forEach(item => {
  3637. if (item.prop == 'integralMultiples') item.label = '积分倍数'
  3638. if (item.prop == 'integral') item.label = '赠送积分'
  3639. if (item.prop == 'orderQuantity') item.label = '订货数量'
  3640. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  3641. || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
  3642. || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
  3643. || item.prop == 'shopQuality'
  3644. ) {
  3645. item.hide = false;
  3646. item.showColumn = true;
  3647. if (!this.permission.show_purPrice) {
  3648. if (item.prop == 'purchaseAmount') {
  3649. item.hide = true;
  3650. item.showColumn = false;
  3651. }
  3652. }
  3653. }
  3654. })
  3655. // contactsData它是商品的数组 giftData它是赠品的数组 goodsShowData它是展示页面的数组一共三个
  3656. this.goodsShowData = this.deepClone(this.contactsData);
  3657. setTimeout(() => {
  3658. this.goodsDisabled = false
  3659. },500)
  3660. } else {
  3661. // 隐藏字段
  3662. this.contactsData = this.goodsShowData.filter(item => item.goodType == 0)
  3663. this.customerContact.column.forEach(item => {
  3664. if (item.prop == 'deliveryAmount') item.label = '积分'
  3665. if (item.prop == 'actualQuantity') item.label = '数量'
  3666. if (item.prop == 'integralMultiples') item.label = '积分'
  3667. if (item.prop == 'integral') item.label = '兑换积分'
  3668. if (item.prop == 'orderQuantity') item.label = '数量'
  3669. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  3670. || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
  3671. || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
  3672. || item.prop == 'shopQuality'
  3673. ) {
  3674. item.hide = true;
  3675. item.showColumn = false;
  3676. }
  3677. })
  3678. // this.giftData=this.goodsShowData.filter(e=>e.typegood==1)
  3679. this.goodsShowData = this.deepClone(this.giftData);
  3680. setTimeout(() => {
  3681. this.goodsDisabled = false
  3682. },500)
  3683. }
  3684. },
  3685. // 切换之前
  3686. beforeLeave(activeName, oldActiveName) {
  3687. },
  3688. // 查看账单
  3689. // 查看申请记录
  3690. openApplicationDialog(){
  3691. this.applicationDialog = true
  3692. },
  3693. //关闭记录
  3694. choceApplication(){
  3695. this.applicationDialog = false
  3696. },
  3697. //费用明细回调
  3698. beforeFinance(feesData,callback){
  3699. this.advantageProjectData = feesData;
  3700. let params = {}
  3701. //暂时默认通过 之后优化
  3702. params.valid = true
  3703. params.parentId = this.form.id
  3704. params.srcOrderno = this.form.orderNo
  3705. callback(params)
  3706. },
  3707. // 请核
  3708. pleaseCheck() {
  3709. if (!this.form.id){
  3710. return this.editCustomer(false,'','check')
  3711. }
  3712. const giftList = this.goodsActives == 'gift'? this.goodsShowData: this.giftData
  3713. if (this.verification()) {
  3714. this.$confirm(giftList.length == 0?"此单没有赠品,确定提交此次审批吗?": "您确定提交此次申请吗?", {
  3715. confirmButtonText: "确定",
  3716. cancelButtonText: "取消",
  3717. type: "warning"
  3718. }).then(() => {
  3719. const data = {
  3720. id : this.form.id,
  3721. checkType: 'xsqh',
  3722. url: '/businessManagement/salesOrder/index',
  3723. pageStatus:"this.$store.getters.domSaleStatus",
  3724. pageLabel:"销售订单(N)",
  3725. checkFlag: 2,
  3726. }
  3727. this.pageLoading = true
  3728. this.saveLoading = true
  3729. pleaseCheck(data).then(res => {
  3730. this.$message.success('请核成功')
  3731. this.saveActives = ''
  3732. this.queryData(this.form.id)
  3733. }).finally(() => {
  3734. this.pageLoading = false
  3735. this.saveLoading = false
  3736. })
  3737. })
  3738. }
  3739. },
  3740. repealCancel(){
  3741. this.$confirm("您确定撤回此次申请吗?", {
  3742. confirmButtonText: "确定",
  3743. cancelButtonText: "取消",
  3744. type: "warning"
  3745. }).then(() => {
  3746. const data = {
  3747. id : this.form.id,
  3748. checkType: 'xsqh',
  3749. pageLabel:"销售订单(N)",
  3750. checkFlag: 2,
  3751. }
  3752. this.pageLoading = true
  3753. this.saveLoading = true
  3754. repealCancel(data).then(res => {
  3755. this.$message.success('撤回成功')
  3756. this.saveActives = ''
  3757. this.queryData(this.form.id)
  3758. }).finally(() => {
  3759. this.pageLoading = false
  3760. this.saveLoading = false
  3761. })
  3762. })
  3763. },
  3764. // 欠款发货审批
  3765. arrearsPleaseCheck() {
  3766. if (this.verification()) {
  3767. const data = {
  3768. id : this.form.id,
  3769. checkType: 'xstpqh',
  3770. url: '/businessManagement/salesOrder/index',
  3771. pageStatus:"this.$store.getters.domSaleStatus",
  3772. pageLabel:"销售订单(N)",
  3773. checkFlag: 3
  3774. }
  3775. this.pageLoading = true
  3776. this.saveLoading = true
  3777. pleaseCheck(data).then(res => {
  3778. this.$message.success('请核成功')
  3779. this.saveActives = ''
  3780. this.queryData(this.form.id)
  3781. }).finally(() => {
  3782. this.pageLoading = false
  3783. this.saveLoading = false
  3784. })
  3785. }
  3786. },
  3787. // 验证新旧值对比
  3788. verification() {
  3789. let getGoodsList = []
  3790. let getGiftList = []
  3791. let getFeeList = this.$refs.feeInfo.submitData()
  3792. // this.goodsShowData.findIndex(item => item.goodType == 0) == -1
  3793. if (this.goodsActives == 'gift') {
  3794. getGiftList = this.goodsShowData
  3795. getGoodsList = this.contactsData
  3796. } else {
  3797. getGoodsList = this.goodsShowData
  3798. getGiftList = this.giftData
  3799. }
  3800. if (contrastObj(this.form, this.oldForm) ||
  3801. contrastList(getGoodsList, this.oldGoodsList) ||
  3802. contrastList(getGiftList, this.oldGiftList) ||
  3803. // contrastList(getFeeList, this.oldFeesList) ||
  3804. contrastList(this.bankOfDepositData, this.oldUploadList)
  3805. ) {
  3806. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  3807. confirmButtonText: "确定",
  3808. cancelButtonText: "取消",
  3809. type: "warning"
  3810. }).then(() => {
  3811. this.editCustomer(false)
  3812. }).catch(() => {
  3813. return false; //取消改动数据
  3814. })
  3815. } else {
  3816. return true; //没有动过数据
  3817. }
  3818. },
  3819. //打开审核
  3820. openCheckDialog(){
  3821. this.checkData = this.detailData.check
  3822. this.checkDialog = true;
  3823. },
  3824. //关闭审核
  3825. choceCheckFun(){
  3826. this.checkDialog = false;
  3827. },
  3828. choceScheduleFun(){
  3829. this.checkScheduleDialog = false
  3830. },
  3831. shopQualityChange(val, row) {
  3832. // (val == 1) && (row.price = 0)
  3833. if (val == 0) {
  3834. this.shopQualityDisable = true;
  3835. getMarketPrice({code: row.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  3836. if (res.data.data.length > 0) {
  3837. this.$set(row, 'price', res.data.data[0].salePrice)
  3838. } else {
  3839. this.$set(row, 'price', '0')
  3840. }
  3841. this.priceChange(row)
  3842. }).finally(() => {
  3843. this.shopQualityDisable = false;
  3844. })
  3845. } else if(val == 1) {
  3846. row.price = 0
  3847. this.priceChange(row)
  3848. }
  3849. },
  3850. editHandle() {
  3851. const data = {
  3852. moduleName: 'xs',
  3853. tableName: 'business_order',
  3854. billId: this.form.id,
  3855. no: localStorage.getItem('browserID'),
  3856. billNo: this.form.orderNo
  3857. }
  3858. this.saveLoading = true
  3859. this.checkLock(data).then(res => {
  3860. if (res.data.code == 200) {
  3861. this.onLock(data).then(response => {
  3862. this.saveActives = ''
  3863. this.queryData(this.form.id)
  3864. })
  3865. this.inDetailsKey(this.$route.name, {
  3866. moduleName: 'xs',
  3867. tableName: 'business_order',
  3868. billId: this.form.id,
  3869. })
  3870. this.detailData.seeDisabled = false;
  3871. }
  3872. }).catch(error => {
  3873. }).finally(() => {
  3874. this.saveLoading = false
  3875. })
  3876. },
  3877. cellStyle() {
  3878. return "padding:0;height:40px;";
  3879. },
  3880. changeApproveOpen() {
  3881. this.changeApproveVis = true
  3882. this.$nextTick(() => {
  3883. this.$refs.changeApprove.init()
  3884. })
  3885. },
  3886. closeChangeApprove() {
  3887. this.changeApproveVis = false
  3888. },
  3889. // 商品信息价格计算
  3890. amountChange(row) {
  3891. if (!row.orderQuantity) {
  3892. row.orderQuantity = 0;
  3893. }
  3894. if (!row.price) {
  3895. row.price = 0;
  3896. }
  3897. row.amount = Number(row.price) * Number(row.orderQuantity)
  3898. },
  3899. // 库存刷新
  3900. resetStock() {
  3901. this.goodsShowData.forEach(item => {
  3902. selectGoodsNum({
  3903. goodsId: item.itemId,
  3904. itemType: item.itemType? item.itemType: item.typeno,
  3905. tradeType: 'GN',
  3906. storageId: this.form.storageId
  3907. }).then(res => {
  3908. item.storageQuantity = res.data.data
  3909. })
  3910. })
  3911. this.$message.success('刷新成功')
  3912. },
  3913. // 导入政策下载模板
  3914. downLoadPolicy() {
  3915. this.$confirm('是否下载模板文件?', '提示', {
  3916. confirmButtonText: '确定',
  3917. cancelButtonText: '取消',
  3918. type: 'warning'
  3919. }).then(() => {
  3920. window.open(
  3921. `/api/blade-purchase-sales/orderitems/policy?${
  3922. this.website.tokenHeader
  3923. }=${getToken()}`
  3924. );
  3925. })
  3926. },
  3927. },
  3928. computed: {
  3929. ...mapGetters(["userInfo", "permission"])
  3930. },
  3931. watch: {
  3932. customerContact(oldVal, newVal) {
  3933. if (!this.permission.show_purPrice) {
  3934. oldVal.column.forEach(item => {
  3935. if (item.prop == 'purchaseAmount') {
  3936. item.hide = true;
  3937. item.showColumn = false;
  3938. }
  3939. })
  3940. }
  3941. if (this.roleName.includes('业务员')) {
  3942. oldVal.column.forEach(item => {
  3943. if (item.prop == 'purchaseAmount') {
  3944. item.hide = true;
  3945. item.showColumn = false;
  3946. }
  3947. })
  3948. }else {
  3949. oldVal.column.forEach(item => {
  3950. if (item.prop == 'purchaseAmount') {
  3951. item.hide = false;
  3952. item.showColumn = true;
  3953. }
  3954. })
  3955. }
  3956. }
  3957. }
  3958. }
  3959. </script>
  3960. <style lang="scss" scoped>
  3961. //.customer-head {
  3962. // position: fixed;
  3963. // top: 105px;
  3964. // width: 100%;
  3965. // margin-left: -10px;
  3966. // height: 62px;
  3967. // background: #ffffff;
  3968. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  3969. // z-index: 999;
  3970. // /* display: flex;
  3971. // justify-content: left; */
  3972. //}
  3973. //
  3974. //.customer-back {
  3975. // cursor: pointer;
  3976. // line-height: 62px;
  3977. // font-size: 16px;
  3978. // color: #323233;
  3979. // font-weight: 400;
  3980. //}
  3981. .back-icon {
  3982. line-height: 64px;
  3983. font-size: 20px;
  3984. margin-right: 8px;
  3985. }
  3986. //.add-customer-btn {
  3987. // position: fixed;
  3988. // right: 36px;
  3989. // top: 115px;
  3990. //}
  3991. ::v-deep .el-form-item {
  3992. margin-bottom: 0;
  3993. }
  3994. .el-dialogDeep {
  3995. ::v-deep .el-dialog {
  3996. margin: 1vh auto 0 !important;
  3997. padding-bottom: 10px !important;
  3998. .el-dialog__body, .el-dialog__footer {
  3999. padding-bottom: 0 !important;
  4000. padding-top: 0 !important;
  4001. }
  4002. }
  4003. }
  4004. .print-div {
  4005. color: #000;
  4006. }
  4007. .print_table {
  4008. table {
  4009. border-right: 1px solid #000;
  4010. border-bottom: 1px solid #000;
  4011. font-size: 12px;
  4012. margin-bottom: 5px;
  4013. }
  4014. table td {
  4015. border-left: 1px solid #000;
  4016. border-top: 1px solid #000;
  4017. vertical-align: middle;
  4018. padding: 2px;
  4019. text-align: center;
  4020. }
  4021. }
  4022. .table {
  4023. border-collapse: collapse;
  4024. border-spacing: 0;
  4025. background-color: transparent;
  4026. display: table;
  4027. width: 99%;
  4028. max-width: 100%;
  4029. margin: 0 auto;
  4030. }
  4031. .table td {
  4032. text-align: left;
  4033. vertical-align: middle;
  4034. font-size: 14px;
  4035. color: #000000;
  4036. padding: 10.5px 0 10.5px 30px;
  4037. //border: 1px solid #000;
  4038. }
  4039. ::v-deep .el-form-item {
  4040. margin-bottom: 0;
  4041. }
  4042. ::v-deep .el-form-item__content{
  4043. line-height: 32px;
  4044. }
  4045. .isShow {
  4046. display: none;
  4047. }
  4048. .order_number:hover {
  4049. display: none;
  4050. }
  4051. .number_button {
  4052. display: none;
  4053. }
  4054. .order_number:hover + .number_button {
  4055. display: block;
  4056. }
  4057. </style>