detailsPageEdit.vue 119 KB

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