detailsPageEdit.vue 143 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090
  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.createFreightUser
  1899. delete this.form.createPurchaseUser
  1900. delete this.form.createPurchaseTime
  1901. delete this.form.createFreightTime
  1902. delete this.form.createFreight
  1903. delete this.form.createPurchase
  1904. delete this.form.specialCheckTime
  1905. delete this.form.specialCheckUser
  1906. delete this.form.specialCheckStatus
  1907. delete this.form.specialCheck
  1908. // delete this.form.corpName
  1909. delete this.form.belongToCorpList
  1910. // 获取最大值
  1911. let num = []
  1912. this.advantageProjectData.forEach(item => {
  1913. num.push(item.sort)
  1914. })
  1915. if (num.length == 0) {
  1916. this.maxFeeNum = 0;
  1917. } else {
  1918. this.maxFeeNum = num.reduce((a, b) => {
  1919. return b > a? b: a;
  1920. })
  1921. }
  1922. let goodsNum = []
  1923. let purchaseAmount = 0
  1924. this.contactsData.forEach(item => {
  1925. goodsNum.push(item.sort)
  1926. purchaseAmount += Number(item.purchaseAmount)
  1927. })
  1928. if (goodsNum.length == 0) {
  1929. this.maxGoodsNum = 0;
  1930. } else {
  1931. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1932. return b > a? b: a;
  1933. })
  1934. }
  1935. this.oldForm = Object.assign({}, this.form)
  1936. this.oldGoodsList = []
  1937. this.oldGiftList = []
  1938. this.oldFeesList = []
  1939. this.oldUploadList = []
  1940. this.oldGoodsList = this.deepClone(this.contactsData)
  1941. this.oldGiftList = this.deepClone(this.giftData)
  1942. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1943. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1944. if (isCopy) {
  1945. this.$set(this.form, 'orderStatus', '录入')
  1946. this.form.status = 0
  1947. this.browse = false
  1948. delete this.form.id
  1949. delete this.form.orgOrderNo
  1950. delete this.form.orderNo
  1951. delete this.form.morderNo
  1952. delete this.form.createUserName
  1953. delete this.form.createTime
  1954. delete this.form.businesDate
  1955. this.contactsData.forEach(item => {
  1956. delete item.id
  1957. delete item.pid
  1958. })
  1959. this.goodsShowData.forEach(item => {
  1960. delete item.id
  1961. delete item.pid
  1962. })
  1963. this.giftData.forEach(item => {
  1964. delete item.id
  1965. delete item.pid
  1966. })
  1967. this.advantageProjectData = []
  1968. this.bankOfDepositData = []
  1969. this.bankOfDepositData.forEach(item => {
  1970. delete item.id
  1971. delete item.pid
  1972. })
  1973. }
  1974. if (other === 'check'){
  1975. this.pleaseCheck()
  1976. }
  1977. }).finally(() => {
  1978. this.saveLoading = false
  1979. this.pageLoading = false
  1980. });
  1981. },
  1982. getDefault() {
  1983. let date = new Date();
  1984. let year = date.getFullYear();
  1985. let month = date.getMonth() + 1;
  1986. let day = date.getDate();
  1987. if (month < 10) {
  1988. month = "0" + month;
  1989. }
  1990. if (day < 10) {
  1991. day = "0" + day;
  1992. }
  1993. let nowDate = year + "-" + month + "-" + day + ' 00:00:00';
  1994. this.$set(this.form, 'businesDate', nowDate)
  1995. this.$set(this.form, 'orderStatus', '录入')
  1996. this.$set(this.form, 'caseOverPayment', 0)
  1997. this.$set(this.form, 'overPayment', 0)
  1998. this.$set(this.form, 'orderAmount', 0)
  1999. this.$set(this.form, 'predictOceanFreight', 0)
  2000. this.$set(this.form, 'presenterIntegral' , 0)
  2001. this.$set(this.form, 'convertIntegral' , 0)
  2002. this.$set(this.form, 'profit' , 0)
  2003. this.$set(this.form, 'paymentType', '预付')
  2004. this.$set(this.form, 'thisUsedProfit' , 0)
  2005. this.$set(this.form, 'createProfit' , 0)
  2006. this.$set(this.form, 'isFreight' , 0)
  2007. this.$set(this.form, 'isLabel' , 0)
  2008. },
  2009. // 复制新单
  2010. copyOrder() {
  2011. this.saveActives = ''
  2012. this.queryData(this.form.id, true)
  2013. },
  2014. getcorpId(row) {
  2015. this.goodsShowData[row.index].corpId = row.id;
  2016. this.goodsShowData[row.index].corpName = row.cname;
  2017. },
  2018. // 采购金额获取
  2019. getPurchasePrice(row) {
  2020. getPurchasePrice({code: row.code}).then(res => {
  2021. this.purchasePriceOption = res.data.data
  2022. })
  2023. },
  2024. // 销售金额获取
  2025. getMarketPrice(row) {
  2026. getMarketPrice({code: row.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2027. this.salesPriceOtion = res.data.data
  2028. })
  2029. },
  2030. // 生成采购单
  2031. saveSell() {
  2032. let getGoodsList = []
  2033. let getGiftList = []
  2034. let getFeeList = this.$refs.feeInfo.submitData()
  2035. if (this.goodsActives == 'gift') {
  2036. getGiftList = this.goodsShowData
  2037. getGoodsList = this.contactsData
  2038. } else {
  2039. getGoodsList = this.goodsShowData
  2040. getGiftList = this.giftData
  2041. }
  2042. if (contrastObj(this.form, this.oldForm) ||
  2043. contrastList(getGoodsList, this.oldGoodsList) ||
  2044. contrastList(getGiftList, this.oldGiftList) ||
  2045. // contrastList(getFeeList, this.oldFeesList) ||
  2046. contrastList(this.bankOfDepositData, this.oldUploadList)
  2047. ) {
  2048. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  2049. confirmButtonText: "确定",
  2050. cancelButtonText: "取消",
  2051. type: "warning"
  2052. }).then(async () => {
  2053. await this.editCustomer(false, '采购')
  2054. }).catch(() => {
  2055. this.$message.info('已取消')
  2056. })
  2057. } else {
  2058. if ((Number(this.form.settlmentAmount) < Number(this.form.debitAmount)) && !this.arrearsCheck) return this.$message.error('收款未收齐,禁止生成采购单');
  2059. this.$confirm("是否生成采购单?", {
  2060. confirmButtonText: "确定",
  2061. cancelButtonText: "取消",
  2062. type: "warning"
  2063. }).then(() => {
  2064. saveSell(this.form.id).then(res => {
  2065. if (res.data.code == 200) {
  2066. this.$message.success("生成成功");
  2067. this.messageVisble = true
  2068. this.$nextTick(() => {
  2069. this.$refs.messagePost.init()
  2070. })
  2071. }
  2072. });
  2073. });
  2074. }
  2075. },
  2076. closeDialog() {
  2077. this.messageVisble = false
  2078. },
  2079. //点击行可编辑
  2080. handleRowClick(row, event, column) {
  2081. },
  2082. //商品编辑
  2083. rowCell(row, index) {
  2084. if (row.$cellEdit) {
  2085. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  2086. return this.$message.error('订货数量不能小于发货数量')
  2087. }
  2088. }
  2089. this.$refs.crudContact.rowCell(row, row.$index)
  2090. },
  2091. //费用编辑
  2092. rowCellTwo(row, index) {
  2093. this.$refs.crudProject.rowCell(row, row.$index)
  2094. },
  2095. //费用新增触发
  2096. costIncrease() {
  2097. this.dialogCost = !this.dialogCost
  2098. this.choiceData = false
  2099. },
  2100. //商品新增触发
  2101. commoditySelection() {
  2102. this.dialogVisible = !this.dialogVisible
  2103. this.tableData = []
  2104. this.commodityData = false
  2105. this.goodsListSave = [];
  2106. },
  2107. //政策价格导入
  2108. policy() {
  2109. this.$set(this.customerBuyFree,'menu',true)
  2110. this.$set(this.optionPolicy,'menu',true)
  2111. this.customerBuyFree.selection = true
  2112. this.optionPolicy.selection = true
  2113. this.activeName = 'searchList'
  2114. this.goodsListPolicy = []
  2115. this.buyAndGiveList = []
  2116. this.policyDialog = !this.policyDialog
  2117. },
  2118. // 报表
  2119. openReport() {
  2120. this.switchDialog =! this.switchDialog;
  2121. },
  2122. // 导出
  2123. exportHandle() {
  2124. this.$confirm('是否导出产品信息?', '提示', {
  2125. confirmButtonText: '确定',
  2126. cancelButtonText: '取消',
  2127. type: 'warning'
  2128. }).then(() => {
  2129. window.open(
  2130. `/api/blade-client/goodsdesc/export-out-info?${
  2131. this.website.tokenHeader
  2132. }=${getToken()}`
  2133. );
  2134. }).catch(() => {
  2135. this.$message({
  2136. type: 'info',
  2137. message: '已取消'
  2138. });
  2139. })
  2140. },
  2141. // 下载模板
  2142. downloadHandle() {
  2143. this.$confirm('是否下载模板文件?', '提示', {
  2144. confirmButtonText: '确定',
  2145. cancelButtonText: '取消',
  2146. type: 'warning'
  2147. }).then(() => {
  2148. window.open(
  2149. `/api/blade-purchase-sales/orderitems/exportPrice?${
  2150. this.website.tokenHeader
  2151. }=${getToken()}`
  2152. );
  2153. }).catch(() => {
  2154. this.$message({
  2155. type: 'info',
  2156. message: '已取消'
  2157. });
  2158. })
  2159. },
  2160. //文件上传时
  2161. uploading(event, file, fileList) {
  2162. this.openFullScreen(false, '文件正在解析中');
  2163. },
  2164. // 商品明细上传成功钩子
  2165. importTemplate(res, file) {
  2166. this.openFullScreen(true)
  2167. let goodsData = []
  2168. if(res.data.lose.length>0){
  2169. this.$message({
  2170. showClose: true,
  2171. message: '导入明细失败的大字有:'+res.data.lose.toString(),
  2172. type: 'error',
  2173. duration:10000,
  2174. });
  2175. }
  2176. res.data.list.forEach(item => {
  2177. getMarketPrice({code: item.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2178. if (response.data.data.length > 0) {
  2179. this.$set(item, 'price', response.data.data[0].salePrice)
  2180. } else {
  2181. this.$set(item, 'price', '0')
  2182. }
  2183. this.priceChange(item)
  2184. // this.$set(item, 'amount', (Number(item.price) * Number(item.orderQuantity)).toFixed(2))
  2185. })
  2186. getPurchasePrice({code: item.code}).then(response => {
  2187. if (response.data.data.length > 0) {
  2188. this.$set(item, 'purchaseAmount', response.data.data[0].purchasePrice)
  2189. } else {
  2190. this.$set(item, 'purchaseAmount', '0')
  2191. }
  2192. })
  2193. this.$set(item, 'integral', Number(item.integralMultiples) * Number(item.orderQuantity))
  2194. this.$set(item, 'actualQuantity', '0')
  2195. this.$set(item, 'purchaseAmount', '0')
  2196. this.$set(item, 'price', '0')
  2197. this.$set(item, 'amount', '0')
  2198. this.$set(item, 'sort', this.maxFeeNum + 1)
  2199. this.maxFeeNum++
  2200. let a = {
  2201. ...item,
  2202. }
  2203. goodsData.push(a)
  2204. })
  2205. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(goodsData)
  2206. this.removeGoodsRepeat()
  2207. this.goodsShowData = this.goodsShowData.concat(res.data.list)
  2208. },
  2209. // 政策导入成功钩子
  2210. successPolicy(res, file) {
  2211. this.openFullScreen(true)
  2212. if (res.data.message === "" && !res.data.message) {
  2213. this.dataPolicy = res.data.list? res.data.list: [];
  2214. this.dataPolicy.forEach(item=>{
  2215. this.$set(item, 'priceType', res.data.cname)
  2216. })
  2217. this.policyIndex++;
  2218. } else {
  2219. this.dataPolicy = res.data.list? res.data.list: [];
  2220. this.dataPolicy.forEach(item=>{
  2221. this.$set(item, 'priceType', res.data.cname)
  2222. })
  2223. this.policyIndex++;
  2224. this.$message({
  2225. showClose: true,
  2226. message:res.data.message,
  2227. type: 'error',
  2228. duration:100000,
  2229. });
  2230. }
  2231. },
  2232. uploadError(err, file, fileList) {
  2233. this.openFullScreen(true)
  2234. this.$message.error(JSON.parse(err.message).msg)
  2235. },
  2236. //遮罩层
  2237. openFullScreen(res, text) {
  2238. const loading = this.$loading({
  2239. lock: true,
  2240. text: text,
  2241. spinner: 'el-icon-loading',
  2242. background: 'rgba(0, 0, 0, 0.7)'
  2243. });
  2244. if (res === true) loading.close();
  2245. },
  2246. onClose(val) {
  2247. this.switchDialog = val;
  2248. },
  2249. getShipmentD() {
  2250. for (let item in this.selection) {
  2251. if (!this.selection[item].id) {
  2252. return this.$message.error('选中数据有新数据,请先保存')
  2253. }
  2254. }
  2255. if (this.$store.getters.inStatus) {
  2256. this.$alert("客户收货存在,请保存客户收货再进行操作", "温馨提示", {
  2257. confirmButtonText: "确定",
  2258. type: "warning",
  2259. callback: action => {
  2260. console.log(action);
  2261. }
  2262. });
  2263. } else {
  2264. this.generateShipmentD();
  2265. }
  2266. },
  2267. //生成发货单
  2268. async generateShipmentD() {
  2269. let getGoodsList = []
  2270. let getGiftList = []
  2271. let getFeeList = this.$refs.feeInfo.submitData()
  2272. if (this.goodsActives == 'gift') {
  2273. getGiftList = this.goodsShowData
  2274. getGoodsList = this.contactsData
  2275. } else {
  2276. getGoodsList = this.goodsShowData
  2277. getGiftList = this.giftData
  2278. }
  2279. if (contrastObj(this.form, this.oldForm) ||
  2280. contrastList(getGoodsList, this.oldGoodsList) ||
  2281. contrastList(getGiftList, this.oldGiftList) ||
  2282. // contrastList(getFeeList, this.oldFeesList) ||
  2283. contrastList(this.bankOfDepositData, this.oldUploadList)
  2284. ) {
  2285. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  2286. confirmButtonText: "确定",
  2287. cancelButtonText: "取消",
  2288. type: "warning"
  2289. }).then(() => {
  2290. this.editCustomer(false, '发货')
  2291. }).catch(() => {
  2292. this.$message({
  2293. type: 'info',
  2294. message: '已取消'
  2295. });
  2296. })
  2297. } else {
  2298. // if (Number(this.form.debitAmount) > Number(this.form.settlmentAmount)) {
  2299. // return this.$message.error('已收款小于未收款,不能生成客户确认单')
  2300. // }
  2301. let lsit = []
  2302. this.selection = this.selection.concat(this.giftData)
  2303. this.selection.forEach(item => {
  2304. lsit.push(item.id)
  2305. })
  2306. let data = {
  2307. id: this.form.id,
  2308. orderItemIds: lsit
  2309. }
  2310. generateShipment(data).then(res => {
  2311. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  2312. this.$router.push({
  2313. path: "/businessManagement/deliveryNotice/index",
  2314. query: {
  2315. form: JSON.stringify(res.data.data),
  2316. pageType: "Generate",
  2317. },
  2318. });
  2319. })
  2320. }
  2321. },
  2322. // 生成结算
  2323. applySettlement(type) {
  2324. let getGoodsList = []
  2325. let getGiftList = []
  2326. let getFeeList = this.$refs.feeInfo.submitData()
  2327. if (this.goodsActives == 'gift') {
  2328. getGiftList = this.goodsShowData
  2329. getGoodsList = this.contactsData
  2330. } else {
  2331. getGoodsList = this.goodsShowData
  2332. getGiftList = this.giftData
  2333. }
  2334. if (contrastObj(this.form, this.oldForm) ||
  2335. contrastList(getGoodsList, this.oldGoodsList) ||
  2336. contrastList(getGiftList, this.oldGiftList) ||
  2337. // contrastList(getFeeList, this.oldFeesList) ||
  2338. contrastList(this.bankOfDepositData, this.oldUploadList)
  2339. ) {
  2340. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  2341. confirmButtonText: "确定",
  2342. cancelButtonText: "取消",
  2343. type: "warning"
  2344. }).then(() => {
  2345. this.editCustomer(false, type)
  2346. }).catch(() => {
  2347. })
  2348. } else {
  2349. this.beforeBillData(true,type)
  2350. this.financialAccountDialog = true;
  2351. }
  2352. },
  2353. //生成账单 拿到主表信息
  2354. beforeBillData(bool,type){
  2355. this.applyPaymentList = [];
  2356. let arr = [];
  2357. this.billType = type
  2358. const data = this.goodsActives === 'gift'? this.contactsData: this.goodsShowData
  2359. data.map(e => {
  2360. if (e.submitPay != 1) {
  2361. const form = {
  2362. belongCompany: this.form.belongCompany,
  2363. srcOrderno:this.form.orgOrderNo,
  2364. itemType:"销售",
  2365. corpsName:this.form.corpName,
  2366. corpId:this.form.corpId,
  2367. srcParentId: this.form.id,
  2368. currency: 'CNY',
  2369. exchangeRate: '1',
  2370. taxRate: '0',
  2371. accDate: this.form.businesDate,
  2372. srcType: 1,
  2373. tradeType: 'GN',
  2374. optionType: 'GN',
  2375. chargeMember: this.form.chargeMember,
  2376. amount: e.amount,
  2377. quantity: e.orderQuantity, // 数量
  2378. price: e.price,
  2379. unit: e.unit,
  2380. goodName: e.cname,
  2381. srcFeesId: e.id,
  2382. costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  2383. }
  2384. arr.push(form)
  2385. }
  2386. })
  2387. let getFeeList = this.$refs.feeInfo.submitData().filter(item => item.feesType == 1 && item.submitPay != 1)
  2388. getFeeList.forEach(item => {
  2389. let form = {
  2390. srcOrderno:this.form.orgOrderNo,
  2391. itemType:"销售",
  2392. corpsName:this.form.corpName,
  2393. corpId:this.form.corpId,
  2394. srcParentId: this.form.id,
  2395. currency: 'CNY',
  2396. exchangeRate: '1',
  2397. taxRate: '0',
  2398. accDate: this.form.businesDate,
  2399. srcType: 2,
  2400. tradeType: 'GN',
  2401. optionType: 'GN',
  2402. chargeMember: this.form.chargeMember,
  2403. parentId: this.form.id,
  2404. amount: item.amount,
  2405. costType: item.itemId,
  2406. srcFeesId: item.id,
  2407. quantity: item.quantity, // 数量
  2408. price: item.price,
  2409. }
  2410. arr.push(form)
  2411. })
  2412. this.applyPaymentList = [...arr]
  2413. if(bool){ //申请货款
  2414. // this.billData.srcId = -1
  2415. }
  2416. },
  2417. //关闭账单
  2418. choceFun(){
  2419. this.financialAccountDialog = false
  2420. },
  2421. feeSubmit() {
  2422. this.saveActives = ''
  2423. this.queryData(this.form.id);
  2424. },
  2425. //商品选中触发
  2426. productSelection(selection) {
  2427. this.selection = selection
  2428. },
  2429. //点击费用明细选择触发
  2430. choice(row) {
  2431. this.dialogCost = !this.dialogCost
  2432. this.choiceData = true
  2433. this.choiceIndex = row.$index
  2434. },
  2435. // 去重
  2436. removeRepeat() {
  2437. let obj = []
  2438. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  2439. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  2440. return current
  2441. }, [])
  2442. },
  2443. removeGoodsRepeat() {
  2444. let obj = []
  2445. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  2446. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  2447. return current
  2448. }, [])
  2449. },
  2450. async getCorpRow(data) {
  2451. getCharge('KH', data.id).then(res => {
  2452. this.userList = res.data.data;
  2453. })
  2454. khDetail(data.id).then(res => {
  2455. if (res.data.data.adminProfiles) {
  2456. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  2457. let arr = [];
  2458. res.data.data.adminProfiles.forEach(e => {
  2459. arr.push(this.userList.find(item => item.id == e).cname)
  2460. })
  2461. this.$set(this.form, 'chargeMember', arr[0])
  2462. }
  2463. if (res.data.data.corpsAttnList.length > 0) {
  2464. this.khInfoList = res.data.data.corpsAttnList;
  2465. this.$set(this.form, 'corpAttn', res.data.data.corpsAttnList[0].cname);
  2466. this.$set(this.form, 'corpTel', res.data.data.corpsAttnList[0].tel);
  2467. } else {
  2468. this.khInfoList = [];
  2469. this.$set(this.form, 'corpAttn', null);
  2470. this.$set(this.form, 'corpTel', null);
  2471. }
  2472. })
  2473. if (data.belongtocompany) {
  2474. // this.form.belongToCorpId = data.belongtocompany
  2475. // this.returnBack({id: this.form.belongToCorpId})
  2476. }
  2477. getCorpDetail({corpId:data.id}).then(res => {
  2478. this.form.overPayment = res.data.data? res.data.data.balanceOverpaymen: 0
  2479. })
  2480. integralDetail({corpId:data.id}).then(res => {
  2481. this.form.pointMutiple = res.data.data? res.data.data.balancePoints: 0
  2482. })
  2483. getProfit({Id: data.id}).then(res => {
  2484. this.form.profit = res.data.data.surplusProfit? res.data.data.surplusProfit: '0.00'
  2485. })
  2486. this.arrivalOptions = [];
  2487. this.arrivalOptions = await this.corpAddr(data.id)
  2488. this.$set(this.form, 'paymentType', data.paymentType? data.paymentType: '预付')
  2489. this.$set(this.form, 'packageRemarks', data.packageRemarks? data.packageRemarks: '塑料')
  2490. if (this.arrivalOptions.length > 0) {
  2491. this.$set(this.form, 'arrivalAddress', this.arrivalOptions[0].label)
  2492. } else {
  2493. this.$set(this.form, 'arrivalAddress', null)
  2494. }
  2495. },
  2496. async getPlantRow(data) {
  2497. this.shippingOptions = [];
  2498. this.shippingOptions = await this.corpAddr(data.id)
  2499. if (this.shippingOptions.length > 0) {
  2500. this.$set(this.form, 'shippingAddress', this.shippingOptions[0].label)
  2501. } else {
  2502. this.$set(this.form, 'shippingAddress', null)
  2503. }
  2504. },
  2505. getRow(event,row) {
  2506. row.priceCategory = event[0].goodsTypeName
  2507. row.code = event[0].code
  2508. row.typeno = event[0].typeno
  2509. row.itemType = event[0].typeno
  2510. row.itemId = event[0].id
  2511. row.corpId = event[0].corpId
  2512. row.corpName = event[0].corpName
  2513. selectGoodsNum({
  2514. goodsId: event[0].id,
  2515. itemType: event[0].typeno,
  2516. tradeType: 'GN'
  2517. }).then(res => {
  2518. row.storageQuantity = res.data.data
  2519. })
  2520. row.integralMultiples = event[0].integralMultiples
  2521. this.quantityChange(row)
  2522. },
  2523. //点击商品明细选择触发
  2524. commodityChoice(row) {
  2525. this.dialogVisible = !this.dialogVisible
  2526. this.commodityData = true
  2527. this.choiceIndexT = row.$index
  2528. },
  2529. //导入商品触发
  2530. importChoice() {
  2531. // this.contactsData = this.contactsData.concat(this.tableData)
  2532. if (this.tableData.length === 1) {
  2533. this.goodsShowData[this.choiceIndexT].cname = this.tableData[0].cname
  2534. this.goodsShowData[this.choiceIndexT].code = this.tableData[0].code
  2535. this.goodsShowData[this.choiceIndexT].typeno = this.tableData[0].typeno
  2536. this.goodsShowData[this.choiceIndexT].itemType = this.tableData[0].typeno
  2537. this.goodsShowData[this.choiceIndexT].itemId = this.tableData[0].id
  2538. this.goodsShowData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  2539. this.goodsShowData[this.choiceIndexT].integralMultiples = this.tableData[0].integralMultiples
  2540. this.goodsShowData[this.choiceIndexT].corpId = this.tableData[0].corpId
  2541. this.goodsShowData[this.choiceIndexT].corpName = this.tableData[0].corpName
  2542. this.quantityChange(this.goodsShowData[this.choiceIndexT])
  2543. selectGoodsNum({
  2544. goodsId: this.tableData[0].id,
  2545. itemType: this.tableData[0].typeno,
  2546. tradeType: 'GN'
  2547. }).then(res => {
  2548. this.goodsShowData[this.choiceIndexT].storageQuantity = res.data.data
  2549. })
  2550. }
  2551. this.dialogVisible = !this.dialogVisible
  2552. this.commodityData = false
  2553. },
  2554. //费用编辑导入触发
  2555. choiceCost() {
  2556. if (this.tableDataCost.length === 1) {
  2557. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  2558. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  2559. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  2560. }
  2561. this.dialogCost = !this.dialogCost
  2562. this.choiceData = false
  2563. },
  2564. //费用导入触发
  2565. importCost() {
  2566. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  2567. if (this.tableDataCost.length > 0) {
  2568. for (let item in this.tableDataCost) {
  2569. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  2570. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  2571. this.$set(this.tableDataCost[item], 'amount', 0)
  2572. this.$set(this.tableDataCost[item], 'settlmentAmount', 0)
  2573. this.$set(this.tableDataCost[item], 'corpId', this.form.corpId)
  2574. this.tableDataCost[item].sort = this.maxFeeNum + 1
  2575. this.maxFeeNum++
  2576. delete this.tableDataCost[item].id
  2577. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  2578. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  2579. }
  2580. }
  2581. this.tableDataCost = []
  2582. this.dialogCost = false
  2583. },
  2584. //确认导入触发
  2585. async importGoods() {
  2586. if (this.goodsListSave.length > 0) {
  2587. this.goodsListSaveHandle()
  2588. } else {
  2589. if (this.tableData.length > 0) {
  2590. this.tableDataHandle()
  2591. }
  2592. }
  2593. },
  2594. goodsListSaveHandle() {
  2595. this.saveLoading = true;
  2596. for (let item in this.goodsListSave) {
  2597. getMarketPrice({code: this.goodsListSave[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2598. if (res.data.data.length > 0) {
  2599. this.$set(this.goodsListSave[item], 'price', res.data.data[0].salePrice)
  2600. } else {
  2601. this.$set(this.goodsListSave[item], 'price', '0')
  2602. }
  2603. this.priceChange(this.goodsListSave[item])
  2604. })
  2605. selectGoodsNum({
  2606. goodsId: this.goodsListSave[item].id,
  2607. itemType: this.goodsListSave[item].typeno,
  2608. tradeType: 'GN'
  2609. }).then(res => {
  2610. this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
  2611. // this.goodsListSave[item].storageQuantity = res.data.data
  2612. this.$set(this.goodsListSave[item], 'priceCategory', this.goodsListSave[item].goodsTypeName)
  2613. // this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
  2614. delete this.goodsListSave[item].goodsTypeName
  2615. this.goodsListSave[item].itemId = this.goodsListSave[item].id
  2616. this.$set(this.goodsListSave[item], 'corpName', this.goodsListSave[item].corpName)
  2617. this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
  2618. // this.$set(this.goodsListSave[item], 'orderQuantity', 1)
  2619. this.$set(this.goodsListSave[item], 'actualQuantity', 0)
  2620. this.$set(this.goodsListSave[item], 'invoiceWeight', this.goodsListSave[item].cartonWeight)
  2621. this.$set(this.goodsListSave[item], 'shopQuality', 0)
  2622. this.$set(this.goodsListSave[item], 'inputMold', 0) // 判断是商品还是政策 商品 0 特价 1 买赠2
  2623. // this.$set(this.goodsListSave[item], 'priceType', this.goodsListSave[item].policyName)
  2624. this.goodsListSave[item].amount = 0
  2625. if (this.goodsActives == "goods") {
  2626. this.$set(this.goodsListSave[item], 'goodType', 0)
  2627. } else {
  2628. this.$set(this.goodsListSave[item], 'goodType', 1)
  2629. this.$set(this.goodsListSave[item], 'integralMultiples', this.goodsListSave[item].integral)
  2630. }
  2631. this.$set(this.goodsListSave[item], 'integral', '0')
  2632. this.goodsListSave[item].sort = this.maxGoodsNum + 1
  2633. if (this.form.packageRemarks) {
  2634. this.goodsListSave[item].packageRemarks = this.form.packageRemarks
  2635. }
  2636. delete this.goodsListSave[item].id
  2637. delete this.goodsListSave[item].pid
  2638. delete this.goodsListSave[item].isDeleted
  2639. delete this.goodsListSave[item].status
  2640. delete this.goodsListSave[item].tenantId
  2641. delete this.goodsListSave[item].updateTime
  2642. delete this.goodsListSave[item].updateUser
  2643. delete this.goodsListSave[item].updateUserName
  2644. this.maxGoodsNum++
  2645. getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
  2646. if (res.data.data.length > 0) {
  2647. this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  2648. } else {
  2649. this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
  2650. }
  2651. this.quantityChange(this.goodsListSave[item])
  2652. this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
  2653. this.$nextTick(() => {
  2654. this.quantityChange(this.goodsListSave[item])
  2655. })
  2656. })
  2657. // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
  2658. })
  2659. }
  2660. this.saveLoading = false;
  2661. this.dialogVisible = false
  2662. },
  2663. tableDataHandle() {
  2664. this.saveLoading = true;
  2665. for (let item=0;item<this.tableData.length;item++) {
  2666. getMarketPrice({code: this.tableData[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  2667. if (res.data.data.length > 0) {
  2668. this.$set(this.tableData[item], 'price', res.data.data[0].salePrice)
  2669. } else {
  2670. this.$set(this.tableData[item], 'price', '0')
  2671. }
  2672. this.priceChange(this.tableData[item])
  2673. })
  2674. selectGoodsNum({
  2675. goodsId: this.tableData[item].id,
  2676. itemType: this.tableData[item].typeno,
  2677. tradeType: 'GN'
  2678. }).then(res => {
  2679. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName;
  2680. this.tableData[item].storageQuantity = res.data.data;
  2681. delete this.tableData[item].goodsTypeName;
  2682. this.tableData[item].itemId = this.tableData[item].id;
  2683. this.$set(this.tableData[item], 'corpName', this.tableData[item].corpName);
  2684. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno);
  2685. // this.$set(this.tableData[item], 'orderQuantity', 1);
  2686. this.$set(this.tableData[item], 'actualQuantity', 0);
  2687. this.$set(this.tableData[item], 'shopQuality', 0);
  2688. this.$set(this.tableData[item], 'invoiceWeight', this.tableData[item].cartonWeight);
  2689. this.$set(this.tableData[item], 'inputMold', 0);
  2690. // this.$set(this.tableData[item], 'priceType', this.tableData[item].policyName);
  2691. this.tableData[item].amount = 0;
  2692. if (this.goodsActives == "goods") {
  2693. this.$set(this.tableData[item], 'goodType', 0)
  2694. } else {
  2695. this.$set(this.tableData[item], 'goodType', 1)
  2696. this.$set(this.tableData[item], 'integralMultiples', this.tableData[item].integral)
  2697. }
  2698. this.$set(this.tableData[item], 'integral', '0')
  2699. this.tableData[item].sort = this.maxGoodsNum + 1
  2700. if (this.form.packageRemarks) {
  2701. this.tableData[item].packageRemarks = this.form.packageRemarks
  2702. }
  2703. delete this.tableData[item].id
  2704. delete this.tableData[item].pid
  2705. delete this.tableData[item].isDeleted
  2706. delete this.tableData[item].status
  2707. delete this.tableData[item].tenantId
  2708. delete this.tableData[item].updateTime
  2709. delete this.tableData[item].updateUser
  2710. delete this.tableData[item].updateUserName
  2711. this.maxGoodsNum++
  2712. getPurchasePrice({code: this.tableData[item].code}).then(rest => {
  2713. if (rest.data.data.length > 0) {
  2714. this.$set(this.tableData[item], 'purchaseAmount', rest.data.data[0].purchasePrice)
  2715. } else {
  2716. this.$set(this.tableData[item], 'purchaseAmount', '0')
  2717. }
  2718. this.quantityChange(this.tableData[item])
  2719. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  2720. this.$nextTick(() => {
  2721. this.quantityChange(this.tableData[item])
  2722. })
  2723. })
  2724. // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
  2725. })
  2726. }
  2727. this.saveLoading = false;
  2728. this.dialogVisible = false
  2729. },
  2730. closeGoods() {
  2731. this.treeDataGoods = [];
  2732. this.treeDeptId = "";
  2733. this.activeName = "searchList";
  2734. },
  2735. closeFees() {
  2736. this.treeDeptIdCost = "";
  2737. this.treeData = [];
  2738. },
  2739. closePolicy() {
  2740. this.treePolicyId = '';
  2741. this.uploadPolicy.policyName = ''
  2742. this.dataPolicy = [];
  2743. this.contactsDataBuyFree = [];
  2744. this.policyData = []
  2745. this.policyDataTwo = []
  2746. },
  2747. //选中触发
  2748. selectionChange(list) {
  2749. this.tableData = list
  2750. },
  2751. //费用选中触发
  2752. selectionChangeCost(list) {
  2753. this.tableDataCost = list
  2754. },
  2755. //导入页左商品类型查询
  2756. nodeClick(data) {
  2757. this.treeDeptId = data.id;
  2758. this.page.currentPage = 1;
  2759. this.onLoad(this.page);
  2760. },
  2761. //导入页销售政策查询
  2762. policyNodeClick(data) {
  2763. this.uploadPolicy.policyName = data.id;
  2764. this.treePolicyId = data.id
  2765. // detailList(data.id).then(res => {
  2766. // //特价促销
  2767. // this.dataPolicy = res.data.data.specialItemList
  2768. // //买赠促销
  2769. // this.contactsDataBuyFree = res.data.data.presentItemList
  2770. // })
  2771. // this.policyOnLoad()
  2772. },
  2773. //导入页左费用类型查询
  2774. nodeClickCost(data) {
  2775. this.treeDeptIdCost = data.id;
  2776. this.pageCost.currentPage = 1;
  2777. this.onLoadCost(this.pageCost);
  2778. },
  2779. //刷新触发
  2780. refreshChange() {
  2781. this.treeDeptId = ''
  2782. this.page.currentPage = 1;
  2783. this.onLoad(this.page);
  2784. },
  2785. //销售政策特价促销选中触发
  2786. selectionChangePolicy(list) {
  2787. this.policyData = list
  2788. // this.policyData.forEach(item => {
  2789. // this.$set(item, 'price', item.specialOffer)
  2790. // })
  2791. if (this.policyData.length > 0) {
  2792. this.customerBuyFree.selection = false
  2793. this.customerBuyFree.menu = false
  2794. } else {
  2795. this.customerBuyFree.selection = true
  2796. this.customerBuyFree.menu = true
  2797. }
  2798. },
  2799. //销售政策买赠促销选中触发
  2800. selectionChangePolicyTwo(list) {
  2801. this.policyDataTwo = list
  2802. // this.policyDataTwo.forEach(item => {
  2803. // this.$set(item, 'price', item.salePrice)
  2804. // })
  2805. if (this.policyDataTwo.length > 0) {
  2806. this.optionPolicy.selection = false
  2807. this.optionPolicy.menu = false
  2808. } else {
  2809. this.optionPolicy.selection = true
  2810. this.optionPolicy.menu = true
  2811. }
  2812. },
  2813. //匹配id去重
  2814. deWeightFour(arr) {
  2815. let arrTemp = [];
  2816. arr = arr.reduce(function (a, b) {
  2817. if ( arrTemp.indexOf(b.id+b.id)==-1 ) {
  2818. a.push(b)
  2819. arrTemp.push(b.id+b.id)
  2820. }
  2821. return a
  2822. }, [])
  2823. return arr
  2824. },
  2825. //导入商品政策
  2826. importPolicy() {
  2827. let list = []
  2828. if (this.buyAndGiveList.length > 0 || this.goodsListPolicy > 0){
  2829. list = this.deepClone(this.buyAndGiveList.concat(this.goodsListPolicy))
  2830. }else {
  2831. list = this.deepClone(this.policyData.concat(this.policyDataTwo))
  2832. }
  2833. // list = this.deWeightFour(list)
  2834. let listLength = this.policyDataTwo.length + this.buyAndGiveList.length
  2835. // 买赠额外加一条
  2836. let buyFree = []
  2837. if (this.policyDataTwo.length > 0 || this.goodsListPolicy.length > 0 || this.buyAndGiveList.length >0) {
  2838. buyFree = this.deepClone((this.policyDataTwo.concat(this.goodsListPolicy)).concat(this.buyAndGiveList))
  2839. }
  2840. for (let item in list) {
  2841. if (this.policyData.length > 0 || this.buyAndGiveList > 0) {
  2842. if (!list[item].specialOffer) {
  2843. getMarketPrice({code: list[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2844. if (response.data.data.length > 0) {
  2845. this.$set(list[item], 'price', response.data.data[0].salePrice)
  2846. } else {
  2847. this.$set(list[item], 'price', '0')
  2848. }
  2849. this.priceChange(list[item])
  2850. })
  2851. } else {
  2852. this.$set(list[item], 'price', list[item].specialOffer)
  2853. this.priceChange(list[item])
  2854. }
  2855. this.$set(list[item], 'inputMold', 1)
  2856. this.$set(list[item], 'goodType', 0)
  2857. } else {
  2858. if (!list[item].salePrice) {
  2859. getMarketPrice({code: list[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
  2860. if (response.data.data.length > 0) {
  2861. this.$set(list[item], 'price', response.data.data[0].salePrice)
  2862. } else {
  2863. this.$set(list[item], 'price', '0')
  2864. }
  2865. this.priceChange(list[item])
  2866. })
  2867. } else {
  2868. this.$set(list[item], 'price', list[item].salePrice)
  2869. this.priceChange(list[item])
  2870. }
  2871. this.$set(list[item], 'inputMold', 2)
  2872. this.$set(buyFree[item], 'inputMold', 2)
  2873. this.$set(buyFree[item], 'price', '0')
  2874. this.$set(buyFree[item], 'orderQuantity', list[item].salesVolume)
  2875. this.$set(buyFree[item], 'itemType', list[item].typeno)
  2876. this.$set(list[item], 'goodType', 0)
  2877. }
  2878. selectGoodsNum({
  2879. goodsId: list[item].itemId,
  2880. itemType: list[item].typeno,
  2881. tradeType: 'GN'
  2882. }).then(res => {
  2883. this.$set(list[item], 'storageQuantity', res.data.data)
  2884. if (listLength != 0) {
  2885. this.$set(buyFree[item], 'storageQuantity', res.data.data)
  2886. }
  2887. this.$set(list[item], 'goodType', 0)
  2888. this.$set(list[item], 'itemType', list[item].typeno)
  2889. this.$set(list[item], 'actualQuantity', 0)
  2890. this.$set(list[item], 'orderQuantity', list[item].orderQuantity? list[item].orderQuantity: 0)
  2891. // this.$set(list[item], 'amount', 0)
  2892. this.$set(list[item], 'priceCategory', list[item].productCategory)
  2893. if(this.policyForm.cname){
  2894. this.$set(list[item], 'priceType', this.policyForm.cname)
  2895. }
  2896. this.$set(list[item], 'cname', list[item].productCategory)
  2897. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  2898. console.log(list[item])
  2899. this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
  2900. // 积分
  2901. this.$set(list[item], 'integralMultiples', 0)
  2902. this.$set(list[item], 'integral', 0)
  2903. this.$set(list[item], 'shopQuality', 0)
  2904. if (listLength != 0) {
  2905. this.$set(buyFree[item], 'actualQuantity', 0)
  2906. this.$set(buyFree[item], 'orderQuantity', 0)
  2907. // this.$set(buyFree[item], 'amount', 0)
  2908. this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
  2909. this.$set(buyFree[item], 'priceType', this.policyForm.cname)
  2910. this.$set(buyFree[item], 'cname', list[item].productCategory)
  2911. this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
  2912. this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
  2913. // 积分
  2914. this.$set(buyFree[item], 'integralMultiples', 0)
  2915. this.$set(buyFree[item], 'integral', 0)
  2916. this.$set(buyFree[item], 'shopQuality', 0)
  2917. this.$set(buyFree[item], 'goodType', 0)
  2918. this.maxGoodsNum++
  2919. delete buyFree[item].id
  2920. delete buyFree[item].pid
  2921. delete buyFree[item].isDeleted
  2922. delete buyFree[item].status
  2923. delete buyFree[item].tenantId
  2924. delete buyFree[item].updateTime
  2925. delete buyFree[item].updateUser
  2926. delete buyFree[item].updateUserName
  2927. }
  2928. delete list[item].id
  2929. delete list[item].pid
  2930. delete list[item].isDeleted
  2931. delete list[item].status
  2932. delete list[item].tenantId
  2933. delete list[item].updateTime
  2934. delete list[item].updateUser
  2935. delete list[item].updateUserName
  2936. this.maxGoodsNum++
  2937. this.$refs.crudContact.rowCellAdd(list[item]);
  2938. this.$nextTick(() => {
  2939. this.quantityChange(list[item])
  2940. })
  2941. if (listLength != 0) {
  2942. this.$refs.crudContact.rowCellAdd(buyFree[item]);
  2943. this.quantityChange(buyFree[item])
  2944. }
  2945. })
  2946. }
  2947. this.policyDialog = false
  2948. },
  2949. //费用刷新触发
  2950. refreshChangeCost() {
  2951. this.treeDeptIdCost = '';
  2952. this.pageCost.currentPage = 1;
  2953. this.onLoadCost(this.pageCost);
  2954. },
  2955. //新增商品信息保存触发
  2956. rowSave(row, done, loading) {
  2957. // this.contactsData.push(row)
  2958. done()
  2959. },
  2960. //修改商品信息触发
  2961. rowUpdate(row, index, done, loading) {
  2962. done(row);
  2963. },
  2964. //删除商品信息触发
  2965. rowDel(row, index, donerowDel) {
  2966. this.$confirm("确定将选择数据删除?", {
  2967. confirmButtonText: "确定",
  2968. cancelButtonText: "取消",
  2969. type: "warning"
  2970. }).then(() => {
  2971. //商品判断是否需要调用删除接口
  2972. if (row.id) {
  2973. corpsattn(row.id).then(res => {
  2974. this.$message({
  2975. type: "success",
  2976. message: "操作成功!"
  2977. });
  2978. this.goodsShowData.splice(row.$index, 1);
  2979. if (this.goodsActives == 'goods') {
  2980. this.form.presenterIntegral = 0;
  2981. this.form.orderAmount = 0;
  2982. this.goodsShowData.forEach(item => {
  2983. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  2984. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  2985. })
  2986. this.computedCost()
  2987. } else {
  2988. this.form.convertIntegral = 0;
  2989. this.goodsShowData.forEach(item => {
  2990. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  2991. })
  2992. }
  2993. })
  2994. } else {
  2995. this.$message({
  2996. type: "success",
  2997. message: "操作成功!"
  2998. });
  2999. this.goodsShowData.splice(row.$index, 1);
  3000. if (this.goodsActives == 'goods') {
  3001. this.form.presenterIntegral = 0;
  3002. this.form.orderAmount = 0;
  3003. this.goodsShowData.forEach(item => {
  3004. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3005. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  3006. })
  3007. this.computedCost()
  3008. } else {
  3009. this.form.convertIntegral = 0;
  3010. this.goodsShowData.forEach(item => {
  3011. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  3012. })
  3013. }
  3014. }
  3015. })
  3016. },
  3017. // 批量删除
  3018. removeList() {
  3019. const isId = this.selection.filter(item => item.id);
  3020. const noId = this.selection.filter(item => !item.id);
  3021. const ids = []
  3022. isId.forEach(e => ids.push(e.id));
  3023. this.$confirm("确定将选择数据删除?", {
  3024. confirmButtonText: "确定",
  3025. cancelButtonText: "取消",
  3026. type: "warning"
  3027. }).then(() => {
  3028. this.goodsLoading = true;
  3029. if (ids.length > 0) {
  3030. removeList(ids.join(',')).then(res => {
  3031. this.selection.forEach(item => {
  3032. const index = this.goodsShowData.findIndex(e => e == item);
  3033. this.goodsShowData.splice(index, 1);
  3034. })
  3035. this.$message.success('删除成功')
  3036. }).finally(() => {
  3037. this.goodsLoading = false;
  3038. })
  3039. } else {
  3040. this.selection.forEach(item => {
  3041. const index = this.goodsShowData.findIndex(e => e == item);
  3042. this.goodsShowData.splice(index, 1);
  3043. })
  3044. this.$message.success('删除成功')
  3045. this.goodsLoading = false;
  3046. }
  3047. })
  3048. },
  3049. //新增费用明细保存触发
  3050. rowSaveProject(row, done, loading) {
  3051. // this.advantageProjectData.push(row)
  3052. done()
  3053. },
  3054. //修改费用明细触发
  3055. rowUpdateProject(row, index, done, loading) {
  3056. done(row);
  3057. },
  3058. policyOnLoad(params = {}) {
  3059. this.loadingPolicy = true;
  3060. this.policyForm = {};
  3061. detailList(this.treePolicyId).then(res => {
  3062. this.policyForm = res.data.data;
  3063. //特价促销
  3064. if(res.data.data.specialItemList) {
  3065. this.dataPolicy = res.data.data.specialItemList
  3066. this.dataPolicy.forEach(item => {
  3067. this.$set(item, 'orderQuantity', 0);
  3068. })
  3069. } else {
  3070. this.dataPolicy = []
  3071. }
  3072. //买赠促销
  3073. if (res.data.data.presentItemList) {
  3074. this.contactsDataBuyFree = res.data.data.presentItemList
  3075. } else {
  3076. this.contactsDataBuyFree = []
  3077. }
  3078. }).finally(() => {
  3079. this.loadingPolicy = false;
  3080. })
  3081. },
  3082. //
  3083. goodsSearch(params, done) {
  3084. this.treeDeptId = ''
  3085. params = {
  3086. ...params,
  3087. artsVision: this.form.belongToCorpId
  3088. }
  3089. this.onLoad(this.page, params);
  3090. done()
  3091. },
  3092. //商品列表查询
  3093. onLoad(page, params = {artsVision: this.form.belongToCorpId}) {
  3094. this.loading = true;
  3095. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
  3096. const data = res.data.data;
  3097. this.page.total = data.total;
  3098. this.pageList.total = data.total
  3099. this.data = data.records;
  3100. this.goodsListShow = data.records;
  3101. this.loading = false;
  3102. });
  3103. },
  3104. // 费用查询按钮
  3105. feesSearch(params, done) {
  3106. this.treeDeptIdCost = '';
  3107. this.onLoadCost(this.pageCost, params)
  3108. done()
  3109. },
  3110. //费用查询
  3111. onLoadCost(page, params = {}) {
  3112. this.loadingCost = true;
  3113. let queryParams = Object.assign({}, params, {
  3114. pageSize: page.pageSize,
  3115. pageNum: page.currentPage,
  3116. parentId: 0,
  3117. feesTypeId: this.treeDeptIdCost
  3118. })
  3119. customerList(queryParams).then(res => {
  3120. const data = res.data.data;
  3121. this.pageCost.total = data.total;
  3122. this.dataCost = data.records;
  3123. this.loadingCost = false;
  3124. });
  3125. },
  3126. //删除费用明细触发
  3127. rowDelProject(row, index, donerowDel) {
  3128. this.$confirm("确定将选择数据删除?", {
  3129. confirmButtonText: "确定",
  3130. cancelButtonText: "取消",
  3131. type: "warning"
  3132. }).then(() => {
  3133. //费用判断是否需要调用删除接口
  3134. if (row.id) {
  3135. corpsitem(row.id).then(res => {
  3136. this.$message.success("操作成功!");
  3137. this.advantageProjectData.splice(row.$index, 1);
  3138. })
  3139. } else {
  3140. this.$message.success("操作成功!");
  3141. this.advantageProjectData.splice(row.$index, 1);
  3142. }
  3143. })
  3144. },
  3145. //修改提交触发
  3146. async editCustomer(isBack = false, type,other) {
  3147. this.$refs["form"].validate(async (valid) => {
  3148. if (valid) {
  3149. const length = this.goodsActives === 'gift' ? this.contactsData.length : this.goodsShowData.length
  3150. const length1 = this.goodsActives === 'goods' ? this.giftData : this.goodsShowData
  3151. for (let i = 0; i < length; i++) {
  3152. const data = this.goodsActives === 'gift' ? this.contactsData : this.goodsShowData;
  3153. if (Number(data[i].orderQuantity) > Number(data[i].storageQuantity)) {
  3154. return this.$message.error('商品信息第' + (Number(i) + 1) + '行订货数量大于库存数量')
  3155. }
  3156. if (Number(data[i].purchaseAmount) === 0) {
  3157. return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为0')
  3158. }
  3159. if (!Number(data[i].purchaseAmount)) {
  3160. return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为空')
  3161. }
  3162. }
  3163. let integral = 0;//积分
  3164. if (length1) {
  3165. length1.forEach(item => {
  3166. integral += Number(item.integral)
  3167. })
  3168. }
  3169. if (Number(this.form.pointMutiple) < Number(integral)) return this.$message.error('积分余额不足')
  3170. //商品信息
  3171. if (this.goodsActives == 'gift') {
  3172. this.form.orderItemsList = this.goodsShowData.concat(this.contactsData)
  3173. } else {
  3174. this.form.orderItemsList = this.goodsShowData.concat(this.giftData)
  3175. }
  3176. // 判断是否能保存
  3177. let goodsData = this.form.orderItemsList.filter(item => item.goodType == 0)
  3178. // 计算特价占比
  3179. let allNum = 0; // 总数量
  3180. let specialNum = 0; // 特价数量
  3181. let sizeNum = 0; // 大尺寸数量
  3182. goodsData.forEach(item => allNum += Number(item.orderQuantity));
  3183. // inputMold判断是商品还是政策 商品 0 特价 1 买赠2,isSpecial 0正常 1特价
  3184. goodsData.filter(item => item.inputMold === 1 && item.isSpecial === 1).forEach(item => specialNum += Number(item.orderQuantity));
  3185. goodsData.filter(item => Number(item.size) >= 17).forEach(item => sizeNum += Number(item.orderQuantity));
  3186. this.$set(this.form, 'specialOfferOf', allNum == 0 ? '0.00' : (specialNum / allNum * 100).toFixed(2));
  3187. this.$set(this.form, 'largeScale', allNum == 0 ? '0.00' : (sizeNum / allNum * 100).toFixed(2));
  3188. for (let item in goodsData) {
  3189. if (Number(goodsData[item].orderQuantity) > Number(goodsData[item].storageQuantity)) {
  3190. return this.$message.error('商品信息第' + (parseInt(item) + 1) + '行订货数量不能超过库存')
  3191. }
  3192. }
  3193. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  3194. let packFee;
  3195. if (this.form.packageRemarks && this.form.packageRemarks !== '无包装' && this.form.packageRemarks !== '不包装') {
  3196. let arr = this.form.orderFeesList.filter(item => item.feesType == 1)
  3197. packFee = arr.findIndex(item => item.feeName == '包装费')
  3198. }
  3199. if (packFee == -1) {
  3200. return this.$message.error('费用明细未有包装费')
  3201. }
  3202. // 产生返利、本次使用返利为空 默认为0
  3203. this.form.createProfit = this.form.createProfit ? this.form.createProfit : 0
  3204. this.form.thisUsedProfit = this.form.thisUsedProfit ? this.form.thisUsedProfit : 0
  3205. // 计算毛利额
  3206. this.$set(this.form, 'orderAmount', 0)
  3207. // 成本价
  3208. let purchaseAmount = 0
  3209. if (this.form.orderAmount && this.form.settlmentAmount) {
  3210. this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
  3211. }
  3212. // 销售金额
  3213. this.form.orderAmount = 0;
  3214. // 计算销售金额
  3215. console.log(this.form.orderItemsList)
  3216. this.form.orderItemsList.forEach(item => {
  3217. if (item.goodType == 0) {
  3218. if (item.purchaseAmount) {
  3219. purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
  3220. }
  3221. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3222. }
  3223. })
  3224. // 判断订货数量不能小于等于0
  3225. for (let item in this.form.orderItemsList) {
  3226. if (Number(this.form.orderItemsList[item].orderQuantity) <= 0) {
  3227. return this.$message.error('订货数量不能小于等于0')
  3228. }
  3229. }
  3230. // this.form.orderFeesList = this.advantageProjectData
  3231. this.form.orderFilesList = this.bankOfDepositData
  3232. if (typeof this.form.corpsTypeId == 'object') {
  3233. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  3234. }
  3235. this.form.billType = 'XS'
  3236. // 如果有id解锁,没有跳过
  3237. // this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3238. this.saveLoading = true
  3239. await this.computedCost()
  3240. typeSave(this.form).then(res => {
  3241. // this.$set(this.detailData, 'seeDisabled', true);
  3242. if (!other) {
  3243. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  3244. }
  3245. if (isBack) {
  3246. //成功关闭此页面回到列表页
  3247. this.$emit("goBack");
  3248. this.leaveDetailsKey(this.$route.name)
  3249. } else {
  3250. this.saveActives = ''
  3251. this.queryData(res.data.data.id, false, other)
  3252. }
  3253. if (type == '发货') {
  3254. let lsit = []
  3255. this.selection = this.selection.concat(this.giftData)
  3256. this.selection.forEach(item => {
  3257. lsit.push(item.id)
  3258. })
  3259. let data = {
  3260. id: this.form.id,
  3261. orderItemIds: lsit
  3262. }
  3263. generateShipment(data).then(res => {
  3264. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  3265. this.$router.push({
  3266. path: "/businessManagement/deliveryNotice/index",
  3267. query: {form: JSON.stringify(res.data.data), pageType: "Generate",},
  3268. });
  3269. })
  3270. } else if (type == '采购') {
  3271. if ((Number(this.form.settlmentAmount) < Number(this.form.debitAmount)) && !this.arrearsCheck) return this.$message.error('收款未收齐,禁止生成采购单');
  3272. this.$confirm("是否生成采购单?", {
  3273. confirmButtonText: "确定",
  3274. cancelButtonText: "取消",
  3275. type: "warning"
  3276. }).then(() => {
  3277. saveSell(this.form.id).then(res => {
  3278. if (res.data.code == 200) {
  3279. this.$message.success("生成成功");
  3280. this.messageVisble = true
  3281. this.$nextTick(() => {
  3282. this.$refs.messagePost.init()
  3283. })
  3284. }
  3285. });
  3286. });
  3287. } else if (type == '收费') {
  3288. this.beforeBillData(true, type)
  3289. this.applySettlementDialog = true;
  3290. }
  3291. }).finally(() => {
  3292. this.saveLoading = false
  3293. })
  3294. } else {
  3295. return this.$message.error('存在漏填必填项,请补全');
  3296. }
  3297. });
  3298. },
  3299. // 计算应收未收款
  3300. computedCost() {
  3301. // if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
  3302. // this.form.caseOverPayment = 0;
  3303. // return this.$message.error('本次使用的溢付款不能超过总溢付款')
  3304. // }
  3305. if (Number(this.form.thisUsedProfit) > Number(this.form.profit)) {
  3306. this.form.thisUsedProfit = 0;
  3307. return this.$message.error('本次使用的返利不能超过返利余额')
  3308. }
  3309. // 销售金额
  3310. let orderAmount = this.form.orderAmount? this.form.orderAmount: 0
  3311. // 已收款
  3312. let settlmentAmount = this.form.settlmentAmount? this.form.settlmentAmount: 0
  3313. // 本次溢付款
  3314. // let caseOverPayment = this.form.caseOverPayment? this.form.caseOverPayment: 0
  3315. // 本次试用返利
  3316. let thisUsedProfit = this.form.thisUsedProfit? this.form.thisUsedProfit: 0
  3317. let feeAmountD = 0; //费用明细应收
  3318. let feeAmountC = 0; //费用明细应付
  3319. this.$refs.feeInfo.submitData().filter(item => item.feesType == 1).forEach(item => {
  3320. feeAmountD += Number(item.amount)
  3321. })
  3322. this.$refs.feeInfo.submitData().filter(item => item.feesType == 2).forEach(item => {
  3323. feeAmountC += Number(item.amount)
  3324. })
  3325. this.$set(this.form, 'debitAmount', ((Number(orderAmount) - Number(thisUsedProfit) + Number(feeAmountD) - Number(feeAmountC)).toFixed(2)))
  3326. this.$set(this.form, "balanceAmount", (Number(this.form.debitAmount) - Number(settlmentAmount)).toFixed(2));
  3327. },
  3328. quantityChange(row) {
  3329. if (!row.orderQuantity) {
  3330. row.orderQuantity = 0;
  3331. } else {
  3332. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  3333. row.amount = (row.price * row.orderQuantity).toFixed(2)
  3334. }
  3335. if (!row.integralMultiples) {
  3336. row.integralMultiples = 0
  3337. }
  3338. row.integral = (Number(row.orderQuantity) * Number(row.integralMultiples)).toFixed(2)
  3339. if (this.goodsActives == 'goods') {
  3340. // 计算销售金额
  3341. this.form.orderAmount = 0
  3342. // 计算赠送积分
  3343. this.form.presenterIntegral = 0;
  3344. this.goodsShowData.forEach(item => {
  3345. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3346. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  3347. })
  3348. this.computedCost()
  3349. } else {
  3350. this.form.convertIntegral = 0;
  3351. this.goodsShowData.forEach(item => {
  3352. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  3353. })
  3354. }
  3355. },
  3356. priceChange(row) {
  3357. if (!row.price) {
  3358. row.price = 0;
  3359. row.amount = '0.00'
  3360. } else {
  3361. row.amount = (row.price * row.orderQuantity).toFixed(2)
  3362. }
  3363. if (this.goodsActives == 'goods') {
  3364. // 计算销售金额
  3365. this.form.orderAmount = 0
  3366. this.goodsShowData.forEach(item => {
  3367. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  3368. })
  3369. this.computedCost()
  3370. }
  3371. },
  3372. //返回列表
  3373. backToList() {
  3374. let getGoodsList = []
  3375. let getGiftList = []
  3376. let getFeeList = this.$refs.feeInfo.submitData()
  3377. if (this.goodsActives == 'gift') {
  3378. getGiftList = this.goodsShowData
  3379. getGoodsList = this.contactsData
  3380. } else {
  3381. getGoodsList = this.goodsShowData
  3382. getGiftList = this.giftData
  3383. }
  3384. if (contrastObj(this.form, this.oldForm) ||
  3385. contrastList(getGoodsList, this.oldGoodsList) ||
  3386. contrastList(getGiftList, this.oldGiftList) ||
  3387. // contrastList(getFeeList, this.oldFeesList) ||
  3388. contrastList(this.bankOfDepositData, this.oldUploadList)
  3389. ) {
  3390. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  3391. confirmButtonText: "确定",
  3392. cancelButtonText: "取消",
  3393. type: "warning"
  3394. }).then(() => {
  3395. this.editCustomer(true)
  3396. }).catch(() => {
  3397. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3398. this.$emit("goBack");
  3399. this.leaveDetailsKey(this.$route.name)
  3400. })
  3401. } else {
  3402. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
  3403. this.$emit("goBack");
  3404. this.leaveDetailsKey(this.$route.name)
  3405. }
  3406. },
  3407. // 保存列设置
  3408. async saveColumn(name) {
  3409. if (name == 'goods') {
  3410. const inSave = await this.saveColumnData(
  3411. this.getColumnName(15),
  3412. this.customerContact
  3413. );
  3414. if (inSave) {
  3415. this.$message.success("保存成功");
  3416. //关闭窗口
  3417. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  3418. this.$nextTick(() => {
  3419. this.$refs.crudContact.doLayout()
  3420. })
  3421. }
  3422. } else if (name === 'fees') {
  3423. const inSave = await this.saveColumnData(
  3424. this.getColumnName(16),
  3425. this.advantageProject
  3426. );
  3427. if (inSave) {
  3428. this.$message.success("保存成功");
  3429. //关闭窗口
  3430. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  3431. }
  3432. }
  3433. },
  3434. async resetColumn() {
  3435. this.customerContact = customerContact
  3436. const inSave = await this.delColumnData(
  3437. this.getColumnName(15),
  3438. customerContact
  3439. );
  3440. if (inSave) {
  3441. this.$nextTick(() => {
  3442. this.$refs.crudContact.doLayout()
  3443. })
  3444. this.$message.success("重置成功");
  3445. this.judgeNew()
  3446. //关闭窗口
  3447. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  3448. }
  3449. },
  3450. returnBack(row) {
  3451. console.log(row)
  3452. this.$refs.KHSelect[0].updateData(row.id)
  3453. getKHList({corpType: 'KH', belongtocompany: row.id}).then(res => {
  3454. //注释自动带出客户全称
  3455. // this.form.corpId = res.data.data.records.length > 0? res.data.data.records[0].id: null
  3456. // if (this.form.corpId) {
  3457. // this.getCorpRow({adminProfiles: res.data.data.records[0].adminProfiles,
  3458. // id: res.data.data.records[0].id,
  3459. // packageRemarks: res.data.data.records[0].packageRemarks,
  3460. // paymentType: res.data.data.records[0].paymentType})
  3461. // }
  3462. })
  3463. getKHList({corpType: 'GYS', belongtocompany: row.id}).then(res => {
  3464. this.form.productionPlant = res.data.data.records.length > 0? res.data.data.records[0].id: null;
  3465. if (this.form.productionPlant) {
  3466. this.getPlantRow({id: this.form.productionPlant})
  3467. }
  3468. })
  3469. this.form.belongCompany = row.cname
  3470. getlistBankBy(row.id).then(res =>{
  3471. this.$set(this.form, 'banks', null)
  3472. this.$set(this.form, 'banksAccountName', null)
  3473. this.$set(this.form, 'accountBank', null)
  3474. this.bankList = res.data
  3475. if (this.bankList.length > 0) {
  3476. this.form.banks = this.bankList[0].accountNo
  3477. this.form.banksAccountName = this.bankList[0].accountName
  3478. this.form.accountBank = this.bankList[0].accountBank
  3479. }
  3480. })
  3481. },
  3482. // 银行账号变化
  3483. banksChange(val) {
  3484. let isTrue = false
  3485. this.bankList.forEach(item => {
  3486. if (val == item.accountNo) {
  3487. this.$set(this.form, 'banksAccountName', item.accountName)
  3488. this.$set(this.form, 'accountBank', item.accountBank)
  3489. isTrue = true
  3490. }
  3491. })
  3492. if (!isTrue) {
  3493. this.$set(this.form, 'banksAccountName', null)
  3494. this.$set(this.form, 'accountBank', null)
  3495. }
  3496. },
  3497. // 联系人变化
  3498. corpAttnChange(val) {
  3499. let isTrue = false
  3500. this.khInfoList.forEach(item => {
  3501. if (val == item.id) {
  3502. this.$set(this.form, 'corpTel', item.tel)
  3503. isTrue = true
  3504. }
  3505. })
  3506. if (!isTrue) {
  3507. this.$set(this.form, 'corpTel', null)
  3508. }
  3509. },
  3510. // 合计计算
  3511. summaryMethod({ columns, data }) {
  3512. const sums = [];
  3513. if (columns.length > 0) {
  3514. columns.forEach((item, index) => {
  3515. sums[0] = '合计'
  3516. if (
  3517. item.property == "amount" ||
  3518. item.property == "orderQuantity" ||
  3519. item.property == "actualQuantity" ||
  3520. item.property == "integral" ||
  3521. item.property == "cartonWeight" ||
  3522. item.property == "cntrVolumn"
  3523. ) {
  3524. let amountSum = 0;
  3525. let orderQuantitySum = 0;
  3526. let actualQuantitySum = 0;
  3527. let integralSum = 0;
  3528. let cartonWeight = 0;
  3529. let cntrVolumn = 0;
  3530. if (this.selection.length > 0) {
  3531. this.selection.forEach(e => {
  3532. amountSum = _.add(amountSum, Number(e.amount));
  3533. orderQuantitySum = _.add(orderQuantitySum, Number(e.orderQuantity));
  3534. actualQuantitySum = _.add(actualQuantitySum, Number(e.actualQuantity));
  3535. integralSum = _.add(integralSum, Number(e.integral));
  3536. cartonWeight = _.add(cartonWeight, Number(e.cartonWeight));
  3537. cntrVolumn = _.add(cntrVolumn, Number(e.cntrVolumn));
  3538. })
  3539. }else {{
  3540. this.goodsShowData.forEach(e => {
  3541. amountSum = _.add(amountSum, Number(e.amount));
  3542. orderQuantitySum = _.add(orderQuantitySum, Number(e.orderQuantity));
  3543. actualQuantitySum = _.add(actualQuantitySum, Number(e.actualQuantity));
  3544. integralSum = _.add(integralSum, Number(e.integral));
  3545. cartonWeight = _.add(cartonWeight, Number(e.cartonWeight));
  3546. cntrVolumn = _.add(cntrVolumn, Number(e.cntrVolumn));
  3547. })
  3548. }}
  3549. // 订货数量合计
  3550. if (item.property == "orderQuantity") {
  3551. sums[index] = orderQuantitySum ? orderQuantitySum.toFixed(0) : "0";
  3552. }
  3553. // 发货数量合计
  3554. if (item.property == "actualQuantity") {
  3555. sums[index] = actualQuantitySum ? actualQuantitySum.toFixed(0) : "0";
  3556. }
  3557. // 金额合计
  3558. if (item.property == "amount") {
  3559. sums[index] = amountSum ? amountSum.toFixed(2) : "0.00";
  3560. }
  3561. // 积分合计
  3562. if (item.property == "integral") {
  3563. sums[index] = integralSum ? integralSum.toFixed(2) : "0.00";
  3564. }
  3565. // 重量合计
  3566. if (item.property == "cartonWeight") {
  3567. sums[index] = cartonWeight ? cartonWeight.toFixed(2) : "0.00";
  3568. }
  3569. // 体积合计
  3570. if (item.property == "cntrVolumn") {
  3571. sums[index] = cntrVolumn ? cntrVolumn.toFixed(5) : "0.00000";
  3572. }
  3573. }
  3574. })
  3575. }
  3576. return sums;
  3577. },
  3578. // 标签页切换
  3579. tabHandle(data) {
  3580. if (data.name == 'searchList') {
  3581. this.goodsListShow = this.data;
  3582. this.page.total = this.pageList.total
  3583. } else if (data.name == 'importStaging') {
  3584. this.goodsListShow = this.goodsListSave;
  3585. this.page.total = 0
  3586. }
  3587. },
  3588. // 政策标签页切换
  3589. tabHandleTwo(data) {
  3590. if (data.name == 'searchList') {
  3591. this.dataPolicy = this.dataTwo;
  3592. this.contactsDataBuyFree = this.dataThree;
  3593. } else if (data.name == 'importStaging') {
  3594. this.dataTwo = this.dataPolicy;
  3595. this.dataPolicy = this.goodsListPolicy;
  3596. this.dataThree = this.contactsDataBuyFree;
  3597. this.contactsDataBuyFree = this.buyAndGiveList;
  3598. }
  3599. },
  3600. removeStagList(row, index,type) {
  3601. if (type === 'policy'){
  3602. this.goodsListPolicy.splice(row.$index, 1)
  3603. if (this.goodsListPolicy.length == 0){
  3604. this.customerBuyFree.selection = true
  3605. this.optionPolicy.selection = true
  3606. this.$set(this.customerBuyFree,'menu',true)
  3607. }
  3608. }else if (type === 'policy_buyAndGive'){
  3609. this.buyAndGiveList.splice(row.$index, 1)
  3610. if (this.buyAndGiveList.length == 0){
  3611. this.customerBuyFree.selection = true
  3612. this.optionPolicy.selection = true
  3613. this.$set(this.optionPolicy,'menu',true)
  3614. }
  3615. }else {
  3616. this.goodsListSave.splice(row.$index, 1)
  3617. }
  3618. },
  3619. importStagList(row, index,type) {
  3620. if (type === 'policy'){
  3621. this.goodsListPolicy.push(row);
  3622. if (this.goodsListPolicy.length>0){
  3623. this.customerBuyFree.selection = false
  3624. this.optionPolicy.selection = true
  3625. this.$set(this.customerBuyFree,'menu',false)
  3626. }
  3627. }else if (type === 'policy_buyAndGive'){
  3628. this.buyAndGiveList.push(row);
  3629. if (this.buyAndGiveList.length>0){
  3630. this.customerBuyFree.selection = true
  3631. this.optionPolicy.selection = false
  3632. this.$set(this.optionPolicy,'menu',false)
  3633. }
  3634. }else {
  3635. this.goodsListSave.push(row);
  3636. }
  3637. },
  3638. // 商品信息标签页切换
  3639. handleClick(data) {
  3640. if (this.saveActives == data.name) return
  3641. this.saveActives = data.name
  3642. this.goodsDisabled = true
  3643. if (data.name == 'goods') {
  3644. this.giftData = this.goodsShowData.filter(item => item.goodType == 1)
  3645. // 显示
  3646. this.customerContact.column.forEach(item => {
  3647. if (item.prop == 'integralMultiples') item.label = '积分倍数'
  3648. if (item.prop == 'integral') item.label = '赠送积分'
  3649. if (item.prop == 'orderQuantity') item.label = '订货数量'
  3650. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  3651. || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
  3652. || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
  3653. || item.prop == 'shopQuality'
  3654. ) {
  3655. item.hide = false;
  3656. item.showColumn = true;
  3657. if (!this.permission.show_purPrice) {
  3658. if (item.prop == 'purchaseAmount') {
  3659. item.hide = true;
  3660. item.showColumn = false;
  3661. }
  3662. }
  3663. }
  3664. })
  3665. // contactsData它是商品的数组 giftData它是赠品的数组 goodsShowData它是展示页面的数组一共三个
  3666. this.goodsShowData = this.deepClone(this.contactsData);
  3667. setTimeout(() => {
  3668. this.goodsDisabled = false
  3669. },500)
  3670. } else {
  3671. // 隐藏字段
  3672. this.contactsData = this.goodsShowData.filter(item => item.goodType == 0)
  3673. this.customerContact.column.forEach(item => {
  3674. if (item.prop == 'deliveryAmount') item.label = '积分'
  3675. if (item.prop == 'actualQuantity') item.label = '数量'
  3676. if (item.prop == 'integralMultiples') item.label = '积分'
  3677. if (item.prop == 'integral') item.label = '兑换积分'
  3678. if (item.prop == 'orderQuantity') item.label = '数量'
  3679. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  3680. || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
  3681. || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
  3682. || item.prop == 'shopQuality'
  3683. ) {
  3684. item.hide = true;
  3685. item.showColumn = false;
  3686. }
  3687. })
  3688. // this.giftData=this.goodsShowData.filter(e=>e.typegood==1)
  3689. this.goodsShowData = this.deepClone(this.giftData);
  3690. setTimeout(() => {
  3691. this.goodsDisabled = false
  3692. },500)
  3693. }
  3694. },
  3695. // 切换之前
  3696. beforeLeave(activeName, oldActiveName) {
  3697. },
  3698. // 查看账单
  3699. // 查看申请记录
  3700. openApplicationDialog(){
  3701. this.applicationDialog = true
  3702. },
  3703. //关闭记录
  3704. choceApplication(){
  3705. this.applicationDialog = false
  3706. },
  3707. //费用明细回调
  3708. beforeFinance(feesData,callback){
  3709. this.advantageProjectData = feesData;
  3710. let params = {}
  3711. //暂时默认通过 之后优化
  3712. params.valid = true
  3713. params.parentId = this.form.id
  3714. params.srcOrderno = this.form.orderNo
  3715. callback(params)
  3716. },
  3717. // 请核
  3718. pleaseCheck() {
  3719. if (!this.form.id){
  3720. return this.editCustomer(false,'','check')
  3721. }
  3722. const giftList = this.goodsActives == 'gift'? this.goodsShowData: this.giftData
  3723. if (this.verification()) {
  3724. this.$confirm(giftList.length == 0?"此单没有赠品,确定提交此次审批吗?": "您确定提交此次申请吗?", {
  3725. confirmButtonText: "确定",
  3726. cancelButtonText: "取消",
  3727. type: "warning"
  3728. }).then(() => {
  3729. const data = {
  3730. id : this.form.id,
  3731. checkType: 'xsqh',
  3732. url: '/businessManagement/salesOrder/index',
  3733. pageStatus:"this.$store.getters.domSaleStatus",
  3734. pageLabel:"销售订单(N)",
  3735. checkFlag: 2,
  3736. }
  3737. this.pageLoading = true
  3738. this.saveLoading = true
  3739. pleaseCheck(data).then(res => {
  3740. this.$message.success('请核成功')
  3741. this.saveActives = ''
  3742. this.queryData(this.form.id)
  3743. }).finally(() => {
  3744. this.pageLoading = false
  3745. this.saveLoading = false
  3746. })
  3747. })
  3748. }
  3749. },
  3750. repealCancel(){
  3751. this.$confirm("您确定撤回此次申请吗?", {
  3752. confirmButtonText: "确定",
  3753. cancelButtonText: "取消",
  3754. type: "warning"
  3755. }).then(() => {
  3756. const data = {
  3757. id : this.form.id,
  3758. checkType: 'xsqh',
  3759. pageLabel:"销售订单(N)",
  3760. checkFlag: 2,
  3761. }
  3762. this.pageLoading = true
  3763. this.saveLoading = true
  3764. repealCancel(data).then(res => {
  3765. this.$message.success('撤回成功')
  3766. this.saveActives = ''
  3767. this.queryData(this.form.id)
  3768. }).finally(() => {
  3769. this.pageLoading = false
  3770. this.saveLoading = false
  3771. })
  3772. })
  3773. },
  3774. // 欠款发货审批
  3775. arrearsPleaseCheck() {
  3776. if (this.verification()) {
  3777. const data = {
  3778. id : this.form.id,
  3779. checkType: 'xstpqh',
  3780. url: '/businessManagement/salesOrder/index',
  3781. pageStatus:"this.$store.getters.domSaleStatus",
  3782. pageLabel:"销售订单(N)",
  3783. checkFlag: 3
  3784. }
  3785. this.pageLoading = true
  3786. this.saveLoading = true
  3787. pleaseCheck(data).then(res => {
  3788. this.$message.success('请核成功')
  3789. this.saveActives = ''
  3790. this.queryData(this.form.id)
  3791. }).finally(() => {
  3792. this.pageLoading = false
  3793. this.saveLoading = false
  3794. })
  3795. }
  3796. },
  3797. // 验证新旧值对比
  3798. verification() {
  3799. let getGoodsList = []
  3800. let getGiftList = []
  3801. let getFeeList = this.$refs.feeInfo.submitData()
  3802. // this.goodsShowData.findIndex(item => item.goodType == 0) == -1
  3803. if (this.goodsActives == 'gift') {
  3804. getGiftList = this.goodsShowData
  3805. getGoodsList = this.contactsData
  3806. } else {
  3807. getGoodsList = this.goodsShowData
  3808. getGiftList = this.giftData
  3809. }
  3810. if (contrastObj(this.form, this.oldForm) ||
  3811. contrastList(getGoodsList, this.oldGoodsList) ||
  3812. contrastList(getGiftList, this.oldGiftList) ||
  3813. // contrastList(getFeeList, this.oldFeesList) ||
  3814. contrastList(this.bankOfDepositData, this.oldUploadList)
  3815. ) {
  3816. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  3817. confirmButtonText: "确定",
  3818. cancelButtonText: "取消",
  3819. type: "warning"
  3820. }).then(() => {
  3821. this.editCustomer(false)
  3822. }).catch(() => {
  3823. return false; //取消改动数据
  3824. })
  3825. } else {
  3826. return true; //没有动过数据
  3827. }
  3828. },
  3829. //打开审核
  3830. openCheckDialog(){
  3831. this.checkData = this.detailData.check
  3832. this.checkDialog = true;
  3833. },
  3834. //关闭审核
  3835. choceCheckFun(){
  3836. this.checkDialog = false;
  3837. },
  3838. choceScheduleFun(){
  3839. this.checkScheduleDialog = false
  3840. },
  3841. shopQualityChange(val, row) {
  3842. // (val == 1) && (row.price = 0)
  3843. if (val == 0) {
  3844. this.shopQualityDisable = true;
  3845. getMarketPrice({code: row.code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(res => {
  3846. if (res.data.data.length > 0) {
  3847. this.$set(row, 'price', res.data.data[0].salePrice)
  3848. } else {
  3849. this.$set(row, 'price', '0')
  3850. }
  3851. this.priceChange(row)
  3852. }).finally(() => {
  3853. this.shopQualityDisable = false;
  3854. })
  3855. } else if(val == 1) {
  3856. row.price = 0
  3857. this.priceChange(row)
  3858. }
  3859. },
  3860. editHandle() {
  3861. const data = {
  3862. moduleName: 'xs',
  3863. tableName: 'business_order',
  3864. billId: this.form.id,
  3865. no: localStorage.getItem('browserID'),
  3866. billNo: this.form.orderNo
  3867. }
  3868. this.saveLoading = true
  3869. this.checkLock(data).then(res => {
  3870. if (res.data.code == 200) {
  3871. this.onLock(data).then(response => {
  3872. this.saveActives = ''
  3873. this.queryData(this.form.id)
  3874. })
  3875. this.inDetailsKey(this.$route.name, {
  3876. moduleName: 'xs',
  3877. tableName: 'business_order',
  3878. billId: this.form.id,
  3879. })
  3880. this.detailData.seeDisabled = false;
  3881. }
  3882. }).catch(error => {
  3883. }).finally(() => {
  3884. this.saveLoading = false
  3885. })
  3886. },
  3887. cellStyle() {
  3888. return "padding:0;height:40px;";
  3889. },
  3890. changeApproveOpen() {
  3891. this.changeApproveVis = true
  3892. this.$nextTick(() => {
  3893. this.$refs.changeApprove.init()
  3894. })
  3895. },
  3896. closeChangeApprove() {
  3897. this.changeApproveVis = false
  3898. },
  3899. // 商品信息价格计算
  3900. amountChange(row) {
  3901. if (!row.orderQuantity) {
  3902. row.orderQuantity = 0;
  3903. }
  3904. if (!row.price) {
  3905. row.price = 0;
  3906. }
  3907. row.amount = Number(row.price) * Number(row.orderQuantity)
  3908. },
  3909. // 库存刷新
  3910. resetStock() {
  3911. this.goodsShowData.forEach(item => {
  3912. selectGoodsNum({
  3913. goodsId: item.itemId,
  3914. itemType: item.itemType? item.itemType: item.typeno,
  3915. tradeType: 'GN',
  3916. storageId: this.form.storageId
  3917. }).then(res => {
  3918. item.storageQuantity = res.data.data
  3919. })
  3920. })
  3921. this.$message.success('刷新成功')
  3922. },
  3923. // 导入政策下载模板
  3924. downLoadPolicy() {
  3925. this.$confirm('是否下载模板文件?', '提示', {
  3926. confirmButtonText: '确定',
  3927. cancelButtonText: '取消',
  3928. type: 'warning'
  3929. }).then(() => {
  3930. window.open(
  3931. `/api/blade-purchase-sales/orderitems/policy?${
  3932. this.website.tokenHeader
  3933. }=${getToken()}`
  3934. );
  3935. })
  3936. },
  3937. },
  3938. computed: {
  3939. ...mapGetters(["userInfo", "permission"])
  3940. },
  3941. watch: {
  3942. customerContact(oldVal, newVal) {
  3943. if (!this.permission.show_purPrice) {
  3944. oldVal.column.forEach(item => {
  3945. if (item.prop == 'purchaseAmount') {
  3946. item.hide = true;
  3947. item.showColumn = false;
  3948. }
  3949. })
  3950. }
  3951. if (this.roleName.includes('业务员')) {
  3952. oldVal.column.forEach(item => {
  3953. if (item.prop == 'purchaseAmount') {
  3954. item.hide = true;
  3955. item.showColumn = false;
  3956. }
  3957. })
  3958. }else {
  3959. oldVal.column.forEach(item => {
  3960. if (item.prop == 'purchaseAmount') {
  3961. item.hide = false;
  3962. item.showColumn = true;
  3963. }
  3964. })
  3965. }
  3966. }
  3967. }
  3968. }
  3969. </script>
  3970. <style lang="scss" scoped>
  3971. //.customer-head {
  3972. // position: fixed;
  3973. // top: 105px;
  3974. // width: 100%;
  3975. // margin-left: -10px;
  3976. // height: 62px;
  3977. // background: #ffffff;
  3978. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  3979. // z-index: 999;
  3980. // /* display: flex;
  3981. // justify-content: left; */
  3982. //}
  3983. //
  3984. //.customer-back {
  3985. // cursor: pointer;
  3986. // line-height: 62px;
  3987. // font-size: 16px;
  3988. // color: #323233;
  3989. // font-weight: 400;
  3990. //}
  3991. .back-icon {
  3992. line-height: 64px;
  3993. font-size: 20px;
  3994. margin-right: 8px;
  3995. }
  3996. //.add-customer-btn {
  3997. // position: fixed;
  3998. // right: 36px;
  3999. // top: 115px;
  4000. //}
  4001. ::v-deep .el-form-item {
  4002. margin-bottom: 0;
  4003. }
  4004. .el-dialogDeep {
  4005. ::v-deep .el-dialog {
  4006. margin: 1vh auto 0 !important;
  4007. padding-bottom: 10px !important;
  4008. .el-dialog__body, .el-dialog__footer {
  4009. padding-bottom: 0 !important;
  4010. padding-top: 0 !important;
  4011. }
  4012. }
  4013. }
  4014. .print-div {
  4015. color: #000;
  4016. }
  4017. .print_table {
  4018. table {
  4019. border-right: 1px solid #000;
  4020. border-bottom: 1px solid #000;
  4021. font-size: 12px;
  4022. margin-bottom: 5px;
  4023. }
  4024. table td {
  4025. border-left: 1px solid #000;
  4026. border-top: 1px solid #000;
  4027. vertical-align: middle;
  4028. padding: 2px;
  4029. text-align: center;
  4030. }
  4031. }
  4032. .table {
  4033. border-collapse: collapse;
  4034. border-spacing: 0;
  4035. background-color: transparent;
  4036. display: table;
  4037. width: 99%;
  4038. max-width: 100%;
  4039. margin: 0 auto;
  4040. }
  4041. .table td {
  4042. text-align: left;
  4043. vertical-align: middle;
  4044. font-size: 14px;
  4045. color: #000000;
  4046. padding: 10.5px 0 10.5px 30px;
  4047. //border: 1px solid #000;
  4048. }
  4049. ::v-deep .el-form-item {
  4050. margin-bottom: 0;
  4051. }
  4052. ::v-deep .el-form-item__content{
  4053. line-height: 32px;
  4054. }
  4055. .isShow {
  4056. display: none;
  4057. }
  4058. .order_number:hover {
  4059. display: none;
  4060. }
  4061. .number_button {
  4062. display: none;
  4063. }
  4064. .order_number:hover + .number_button {
  4065. display: block;
  4066. }
  4067. </style>