detailsPageEdit.vue 120 KB

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