detailsPageEdit.vue 129 KB

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