detailsPageEdit.vue 115 KB

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