detailsPageEdit.vue 101 KB

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