detailsPageEdit.vue 105 KB

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