detailsPageEdit.vue 124 KB

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