detailsPageEdit.vue 117 KB

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