detailsPageEdit.vue 123 KB

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