detailsPageEdit.vue 118 KB

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