detailsPageEdit.vue 142 KB

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