detailsPageEdit.vue 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="editHandle"
  15. type="primary"
  16. style="margin-right: 8px"
  17. :loading="saveLoading"
  18. >编 辑</el-button>
  19. <el-dropdown style="margin-right: 8px;">
  20. <el-button
  21. type="warning"
  22. size="small"
  23. >
  24. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  25. </el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item
  28. :disabled="detailData.seeDisabled || !form.id"
  29. @click.native="applyPayment('申请')"
  30. >
  31. 申请货款
  32. </el-dropdown-item>
  33. <!-- <el-dropdown-item-->
  34. <!-- @click.stop.native="applyPayment('收费')"-->
  35. <!-- :disabled="!this.form.id"-->
  36. <!-- >申请退款-->
  37. <!-- </el-dropdown-item>-->
  38. <el-dropdown-item
  39. @click.native="openApplicationDialog"
  40. :disabled="!form.id"
  41. >查看账单
  42. </el-dropdown-item>
  43. </el-dropdown-menu>
  44. </el-dropdown>
  45. <el-button type="primary"
  46. size="small"
  47. :disabled="detailData.seeDisabled || !form.id"
  48. @click="postMessage"
  49. >发送消息</el-button>
  50. <el-button
  51. size="small"
  52. class="el-button--small-yh"
  53. type="success"
  54. @click="copyOrder"
  55. :disabled="detailData.seeDisabled || !this.form.id"
  56. >
  57. 复制单据
  58. </el-button>
  59. <el-button
  60. size="small"
  61. class="el-button--small-yh"
  62. type="primary"
  63. :disabled="disabled || detailData.seeDisabled"
  64. @click="editCustomer(false)"
  65. :loading="saveLoading"
  66. >保 存
  67. </el-button>
  68. <div v-if="checkDisabled" style="float: right;margin-left: 8px">
  69. <el-button type="primary"
  70. size="small"
  71. class="el-button--small-yh"
  72. @click.stop="openCheckDialog">
  73. 审批
  74. </el-button>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="customer-main">
  79. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  80. <containerTitle title="基础资料"></containerTitle>
  81. <basic-container style="margin-bottom: 10px">
  82. <el-row>
  83. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  84. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  85. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  86. <!-- ></avue-input-tree>-->
  87. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  88. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
  89. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  90. size="small" type="date" placeholder="选择日期"
  91. :disabled="detailData.seeDisabled"/>
  92. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  93. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  94. </el-select>
  95. <crop-select
  96. v-else-if="item.prop === 'corpId'"
  97. v-model="form[item.prop]"
  98. corpType="GYS"
  99. @getCorpData="returnBack"
  100. :disabled="detailData.seeDisabled"
  101. ></crop-select>
  102. <crop-select
  103. v-else-if="item.prop === 'belongToCorpId'"
  104. v-model="form[item.prop]"
  105. corpType="GS"
  106. :disabled="detailData.seeDisabled"
  107. @getCorpData="getGSName"
  108. ></crop-select>
  109. <el-select v-else-if="item.prop === 'banks'"
  110. v-model="form[item.prop]" placeholder="请选择"
  111. clearable
  112. filterable
  113. allow-create
  114. default-first-option
  115. size="small"
  116. style="width: 100%;"
  117. @change="banksChange"
  118. :disabled="detailData.seeDisabled">
  119. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  120. </el-select>
  121. <el-input
  122. v-else-if="item.type == 'number'"
  123. placeholder="请输入"
  124. v-input-limit="2"
  125. size="small"
  126. :disabled="item.disabled || detailData.seeDisabled"
  127. v-model.trim="form[item.prop]"
  128. />
  129. <el-select v-else-if="item.prop === 'packageRemarks'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  130. <el-option v-for="(item,index) in packageOptions" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  131. </el-select>
  132. <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>
  133. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled" placeholder="请输入"></el-input>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. </basic-container>
  138. <containerTitle title="商品信息"></containerTitle>
  139. <basic-container style="margin-bottom: 10px">
  140. <avue-crud
  141. :option="customerContact"
  142. v-model="contactsForm"
  143. :data="contactsData"
  144. ref="crudContact"
  145. @row-save="rowSave"
  146. @row-click="handleRowClick"
  147. @row-update="rowUpdate"
  148. @row-del="rowDel"
  149. @selection-change="productSelection"
  150. @saveColumn="saveColumn('goods')"
  151. @resetColumn="resetColumn"
  152. >
  153. <template slot="cname" slot-scope="{ row }">
  154. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  155. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  156. <span v-else>
  157. {{ row.cname }}
  158. <!-- <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>-->
  159. </span>
  160. </template>
  161. <template slot="orderQuantity" slot-scope="{ row }">
  162. <el-input
  163. v-if="row.$cellEdit"
  164. v-model.trim="row.orderQuantity"
  165. oninput='this.value=this.value.replace(/[^(\d)]/g,"")' size="small"
  166. @input="changeContractAmt(row)"
  167. ></el-input>
  168. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  169. </template>
  170. <template slot="purchaseAmount" slot-scope="{ row }">
  171. <el-select
  172. v-if="row.$cellEdit"
  173. v-model="row.purchaseAmount"
  174. @focus="changeContractAmt(row)"
  175. allow-create
  176. filterable
  177. v-input-limit="2"
  178. default-first-option
  179. >
  180. <el-option
  181. v-for="(item, index) in purchasePriceOption"
  182. :key="index"
  183. :label="item.purchasePrice"
  184. :value="item.purchasePrice"></el-option>
  185. </el-select>
  186. <span v-else>{{ row.purchaseAmount | decimalFormat }}</span>
  187. </template>
  188. <template slot="amount" slot-scope="{ row }">
  189. <span>{{ row.amount | decimalFormat }}</span>
  190. </template>
  191. <template slot="actualQuantity" slot-scope="{ row }">
  192. <span>{{ row.actualQuantity | IntegerFormat }}</span>
  193. </template>
  194. <template slot="storageQuantity" slot-scope="{ row }">
  195. <span>{{ row.storageQuantity | IntegerFormat }}</span>
  196. </template>
  197. <template slot="code" slot-scope="{row,index}">
  198. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  199. <span>{{ row.code }}</span>
  200. </template>
  201. <template slot-scope="{row,index}" slot="menu">
  202. <el-button
  203. type="text"
  204. size="small"
  205. @click="rowCell(row,index)"
  206. :disabled="detailData.seeDisabled"
  207. >{{ row.$cellEdit ? '保存' : '修改' }}
  208. </el-button>
  209. <el-button
  210. size="small"
  211. icon="el-icon-delete"
  212. type="text"
  213. @click="rowDel(row, index)"
  214. :disabled="detailData.seeDisabled"
  215. v-if="!row.$cellEdit"
  216. >删 除</el-button>
  217. </template>
  218. <template slot="menuLeft" slot-scope="{size}">
  219. <el-button type="primary"
  220. icon="el-icon-plus"
  221. size="small"
  222. @click="commoditySelection"
  223. :disabled="detailData.seeDisabled"
  224. >录入明细
  225. </el-button>
  226. <el-button type="warning"
  227. icon="el-icon-plus"
  228. size="small"
  229. :disabled="selection.length < 1 || detailData.seeDisabled"
  230. @click="getShipmentC">生成采购确认
  231. </el-button>
  232. <el-button type="info" :size="size" icon="el-icon-printer" @click.stop="openReport()">报 表</el-button>
  233. </template>
  234. </avue-crud>
  235. </basic-container>
  236. <fee-info
  237. ref="feeInfo"
  238. :orderFeesList="advantageProjectData"
  239. :disabled="detailData.seeDisabled"
  240. feeUrl="/trade-purchase/purchase-order/removeByFees"
  241. optionType="GN"
  242. itemType="采购"
  243. @beforeFinance="beforeFinance"
  244. :corpId="form.corpId"
  245. />
  246. <containerTitle title="附件上传"></containerTitle>
  247. <c-upload
  248. :data="bankOfDepositData"
  249. deleteUrl="/api/trade-purchase/purchase-order/removeByFiles"
  250. :enumerationValue="77"
  251. />
  252. </el-form>
  253. </div>
  254. <el-dialog
  255. title="导入商品"
  256. append-to-body
  257. class="el-dialogDeep"
  258. :visible.sync="dialogVisible"
  259. width="80%"
  260. :close-on-click-modal="false"
  261. :destroy-on-close="true"
  262. :close-on-press-escape="false"
  263. @close="closeGoods">
  264. <el-row :style="{height: rowHeight}">
  265. <el-col :span="5" style="height: 100%;overflow-y: auto">
  266. <div>
  267. <el-scrollbar>
  268. <basic-container>
  269. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  270. </basic-container>
  271. </el-scrollbar>
  272. </div>
  273. </el-col>
  274. <el-col :span="19">
  275. <basic-container>
  276. <avue-crud :option="optionTwo"
  277. :table-loading="loading"
  278. :data="goodsListShow"
  279. ref="crud"
  280. @refresh-change="refreshChange"
  281. @selection-change="selectionChange"
  282. :page.sync="page"
  283. @search-change="goodsSearch"
  284. @on-load="onLoad">
  285. <template slot="menuLeft" slot-scope="{size}">
  286. <el-tabs v-model="activeName" @tab-click="tabHandle">
  287. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  288. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  289. </el-tabs>
  290. </template>
  291. <template slot-scope="scope" slot="menu">
  292. <el-button
  293. type="text"
  294. icon="el-icon-edit"
  295. size="small"
  296. @click.stop="importStagList(scope.row,scope.index)"
  297. v-if="activeName=='searchList'"
  298. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  299. >选择
  300. </el-button>
  301. <el-button
  302. type="text"
  303. icon="el-icon-delete"
  304. size="small"
  305. @click.stop="removeStagList(scope.row,scope.index)"
  306. v-else
  307. >移除
  308. </el-button>
  309. </template>
  310. </avue-crud>
  311. </basic-container>
  312. </el-col>
  313. </el-row>
  314. <span slot="footer" class="dialog-footer">
  315. <el-button @click="dialogVisible = false">取 消</el-button>
  316. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  317. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  318. :disabled="tableData.length !== 1">导入</el-button>
  319. </span>
  320. </el-dialog>
  321. <el-dialog
  322. title="导入费用"
  323. append-to-body
  324. class="el-dialogDeep"
  325. :visible.sync="dialogCost"
  326. width="80%"
  327. :close-on-click-modal="false"
  328. :destroy-on-close="true"
  329. :close-on-press-escape="false"
  330. @close="closeFees">
  331. <el-row :style="{height: rowHeight}">
  332. <el-col :span="5" style="height: 100%;overflow-y: auto">
  333. <div>
  334. <el-scrollbar>
  335. <basic-container>
  336. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  337. </basic-container>
  338. </el-scrollbar>
  339. </div>
  340. </el-col>
  341. <el-col :span="19">
  342. <basic-container>
  343. <avue-crud :option="optionTwoCost"
  344. :table-loading="loadingCost"
  345. :data="dataCost"
  346. ref="crud"
  347. @refresh-change="refreshChangeCost"
  348. @selection-change="selectionChangeCost"
  349. :page.sync="pageCost"
  350. @searchChange="feesSearch"
  351. @on-load="onLoadCost">
  352. </avue-crud>
  353. </basic-container>
  354. </el-col>
  355. </el-row>
  356. <span slot="footer" class="dialog-footer">
  357. <el-button @click="dialogCost = false">取 消</el-button>
  358. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  359. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  360. :disabled="tableDataCost.length !== 1">导入</el-button>
  361. </span>
  362. </el-dialog>
  363. <el-dialog
  364. title="账单"
  365. append-to-body
  366. class="el-dialogDeep"
  367. :visible.sync="applyPaymentDialog"
  368. width="60%"
  369. :close-on-click-modal="false"
  370. :destroy-on-close="true"
  371. :close-on-press-escape="false"
  372. v-dialog-drag
  373. >
  374. <apply-payment
  375. :billType="billType"
  376. :billData="billData"
  377. itemType="采购"
  378. @choceFun="choceFun"
  379. >
  380. </apply-payment>
  381. </el-dialog>
  382. <el-dialog
  383. append-to-body
  384. title="账单"
  385. class="el-dialogDeep"
  386. :visible.sync="financialAccountDialog"
  387. width="70%"
  388. :close-on-click-modal="false"
  389. :destroy-on-close="true"
  390. :close-on-press-escape="false"
  391. v-dialog-drag
  392. >
  393. <financial-account
  394. :billType="billType"
  395. :billData="{}"
  396. :arrList="applyPaymentList"
  397. :checkData="financeData"
  398. @choceFun="choceFun"
  399. >
  400. </financial-account>
  401. </el-dialog>
  402. <el-dialog
  403. title="申请记录"
  404. append-to-body
  405. class="el-dialogDeep"
  406. :visible.sync="applicationDialog"
  407. width="60%"
  408. :close-on-click-modal="false"
  409. :destroy-on-close="true"
  410. :close-on-press-escape="false"
  411. v-dialog-drag
  412. >
  413. <bill-application
  414. :billId="form.id"
  415. @choceApplication="choceApplication"
  416. >
  417. </bill-application>
  418. </el-dialog>
  419. <report-dialog
  420. :switchDialog="switchDialog"
  421. :reportId="form.id"
  422. reportName="发货通知单"
  423. @onClose="onClose()"
  424. ></report-dialog>
  425. <el-dialog
  426. append-to-body
  427. title="审批"
  428. class="el-dialogDeep"
  429. :visible.sync="checkDialog"
  430. width="50%"
  431. :close-on-click-modal="false"
  432. :destroy-on-close="true"
  433. :close-on-press-escape="false"
  434. v-dialog-drag
  435. >
  436. <check
  437. :checkData="checkData"
  438. :checkDetail="false"
  439. :idList="[]"
  440. @choceCheckFun="choceCheckFun"
  441. >
  442. </check>
  443. </el-dialog>
  444. <el-dialog
  445. append-to-body
  446. title="审批进度"
  447. class="el-dialogDeep"
  448. :visible.sync="checkScheduleDialog"
  449. width="40%"
  450. :close-on-click-modal="false"
  451. :destroy-on-close="true"
  452. :close-on-press-escape="false"
  453. v-dialog-drag
  454. >
  455. <check-schedule
  456. :checkId="checkId"
  457. :batchNo="batchNo"
  458. @choceScheduleFun="choceScheduleFun"
  459. >
  460. </check-schedule>
  461. </el-dialog>
  462. <messagePost
  463. v-if="messageVisble"
  464. ref="messagePost"
  465. @closeDialog="closeDialog"
  466. ></messagePost>
  467. </div>
  468. </template>
  469. <script>
  470. import {
  471. typeSave,
  472. detail,
  473. corpsattn,
  474. corpsbank,
  475. corpsitem,
  476. // getList,
  477. getDeptLazyTreeS,
  478. getSysNo,
  479. generateShipment
  480. } from "@/api/basicData/purchaseOrder"
  481. import {getList} from "@/api/basicData/commodityType";
  482. import customerContact from "./configuration/customerContact.json"
  483. import advantageProject from "./configuration/advantageProject.json"
  484. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  485. import commodity from "./configuration/commodity.json"
  486. import optionTwoCost from "./configuration/mainListCost.json"
  487. import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
  488. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  489. import { contrastObj, contrastList } from "@/util/contrastData";
  490. //账单组件
  491. import ApplyPayment from "../../../components/finance/applyPayment";
  492. import billApplication from "@/components/bill/billApplication";
  493. import { getlistBankBy, pleaseCheck, } from "@/api/basicData/configuration"
  494. import feeInfo from "@/components/fee-info/main";
  495. import {
  496. isDiscount,
  497. isPercentage,
  498. micrometerFormat,
  499. IntegerFormat
  500. } from "@/util/validate";
  501. import financialAccount from "../../../components/finance/financialAccount";
  502. import reportDialog from "@/components/report-dialog/main";
  503. import check from "@/components/check/check";
  504. import checkSchedule from "@/components/check/checkSchedule";
  505. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  506. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees";
  507. export default {
  508. name: "detailsPage",
  509. props: {
  510. detailData: {
  511. type: Object,
  512. default: {
  513. seeDisabled: false
  514. }
  515. }
  516. },
  517. components:{
  518. ApplyPayment,
  519. billApplication,
  520. feeInfo,
  521. financialAccount,
  522. reportDialog,
  523. check,
  524. checkSchedule,
  525. },
  526. data() {
  527. return {
  528. configuration: {
  529. multipleChoices: false,
  530. multiple: false,
  531. collapseTags: false,
  532. placeholder: '请点击右边按钮选择',
  533. dicData: []
  534. },
  535. goodsConfiguration: {
  536. multipleChoices: false,
  537. multiple: false,
  538. collapseTags: false,
  539. placeholder: '请点击右边按钮选择',
  540. dicData: []
  541. },
  542. form: {},
  543. data: [],
  544. loadingCost: false,
  545. choiceData: false,
  546. commodityData: false,
  547. financialAccountDialog:false,
  548. dataCost: [],
  549. choiceIndex: '',
  550. dialogCost: false,
  551. treeDeptId: '',
  552. treeDeptIdCost: '',
  553. pageCost: {
  554. pageSize: 10,
  555. currentPage: 1,
  556. total: 0
  557. },
  558. page: {
  559. pageSize: 10,
  560. currentPage: 1,
  561. total: 0
  562. },
  563. loading: false,
  564. contactsForm: {},
  565. optionTwo: commodity,
  566. optionTwoCost: optionTwoCost,
  567. treeDataGoods: [],
  568. treeData: [],
  569. treeOptionCost: {
  570. nodeKey: 'id',
  571. lazy: true,
  572. treeLoad: function (node, resolve) {
  573. const parentId = (node.level === 0) ? 0 : node.data.id;
  574. getDeptLazyTree(parentId).then(res => {
  575. resolve(res.data.data.map(item => {
  576. return {
  577. ...item,
  578. leaf: !item.hasChildren
  579. }
  580. }))
  581. });
  582. },
  583. addBtn: false,
  584. menu: false,
  585. size: 'small',
  586. props: {
  587. labelText: '标题',
  588. label: 'title',
  589. value: 'value',
  590. children: 'children'
  591. }
  592. },
  593. treeOption: {
  594. nodeKey: 'id',
  595. lazy: true,
  596. treeLoad: function (node, resolve) {
  597. const parentId = (node.level === 0) ? 0 : node.data.id;
  598. getDeptLazyTreeS(parentId).then(res => {
  599. resolve(res.data.data.map(item => {
  600. return {
  601. ...item,
  602. leaf: !item.hasChildren
  603. }
  604. }))
  605. });
  606. },
  607. addBtn: false,
  608. menu: false,
  609. size: 'small',
  610. props: {
  611. labelText: '标题',
  612. label: 'title',
  613. value: 'value',
  614. children: 'children'
  615. }
  616. },
  617. billType:"申请", //账单类型
  618. billData:{}, //账单需要数据
  619. financeData: {}, // 账单请核需要的路由
  620. applyPaymentDialog:false,//生成账单组件
  621. applicationDialog: false,// 申请记录
  622. dialogVisible: false,
  623. advantageProjectForm: {},
  624. bankOfDepositForm: {},
  625. contactsData: [],
  626. advantageProjectData: [],
  627. saveLoading: false,
  628. disabled: false,
  629. bankOfDepositData: [],
  630. tableDataCost: [],
  631. dic: [],
  632. tableData: [],
  633. customerContact: {},
  634. advantageProject: {},
  635. bankOfDeposit: bankOfDeposit,
  636. basicData: {
  637. column: [
  638. {
  639. label: '供应商',
  640. prop: 'corpId',
  641. span: 16,
  642. rules: [
  643. {
  644. required: true,
  645. message: ' ',
  646. trigger: 'blur'
  647. }
  648. ]
  649. },{
  650. label: '付款方式',
  651. prop: 'paymentType',
  652. rules: [
  653. {
  654. required: true,
  655. message: ' ',
  656. trigger: 'blur'
  657. }
  658. ]
  659. },{
  660. label: '所属公司',
  661. prop: 'belongToCorpId',
  662. span: 16,
  663. rules: [
  664. {
  665. required: true,
  666. message: ' ',
  667. trigger: 'blur'
  668. }
  669. ]
  670. },{
  671. label: '要求到货日期',
  672. prop: 'requiredArrivalDate',
  673. type: 'datetime',
  674. rules: [
  675. {
  676. required: true,
  677. message: ' ',
  678. trigger: 'blur'
  679. }
  680. ]
  681. },{
  682. label: '银行账号',
  683. prop: 'banks',
  684. rules: [
  685. {
  686. required: true,
  687. message: ' ',
  688. trigger: 'blur'
  689. }
  690. ]
  691. }, {
  692. label: '公司户头',
  693. prop: 'banksAccountName',
  694. rules: [
  695. {
  696. required: false,
  697. message: ' ',
  698. trigger: 'blur'
  699. }
  700. ]
  701. }, {
  702. label: '包装要求',
  703. prop: 'packageRemarks',
  704. rules: [
  705. {
  706. required: false,
  707. message: ' ',
  708. trigger: 'blur'
  709. }
  710. ]
  711. },
  712. {
  713. label: '系统编号',
  714. prop: 'sysNo',
  715. disabled: true,
  716. rules: [
  717. {
  718. required: false,
  719. message: ' ',
  720. trigger: 'blur'
  721. }
  722. ]
  723. }, {
  724. label: '来源单号',
  725. prop: 'orgOrderNo',
  726. disabled: true,
  727. rules: [
  728. {
  729. required: false,
  730. message: ' ',
  731. trigger: 'blur'
  732. }
  733. ]
  734. },
  735. // {
  736. // label: '预估运费',
  737. // prop: 'predictOceanFreight',
  738. // type: 'number',
  739. // rules: [
  740. // {
  741. // required: false,
  742. // message: ' ',
  743. // trigger: 'blur'
  744. // }
  745. // ]
  746. // },
  747. {
  748. label: '已付金额',
  749. prop: 'settlmentAmount',
  750. type: 'number',
  751. disabled: true,
  752. rules: [
  753. {
  754. required: false,
  755. message: ' ',
  756. trigger: 'blur'
  757. }
  758. ]
  759. },{
  760. label: "备注",
  761. span: 24,
  762. prop: "orderRemark",
  763. type: 'textarea',
  764. mock: {
  765. type: 'county'
  766. }
  767. }
  768. ]
  769. },
  770. paymentOption: [],
  771. maxFeeNum: 0,
  772. maxGoodsNum: 0,
  773. selection: [],
  774. oldForm: {
  775. orderStatus: "录入"
  776. },
  777. oldGoodsList: [],
  778. oldFeesList: [],
  779. oldUploadList: [],
  780. // 弹窗高度
  781. rowHeight: '',
  782. // 查询时loading页面
  783. pageLoading: false,
  784. // 银行账号下拉
  785. bankList: [],
  786. activeName: 'searchList',
  787. // 商品列表数据合计
  788. goodsListShow: [],
  789. // 商品列表暂存
  790. goodsListSave: [],
  791. goodsListTotal: 0,
  792. goodsListSaveTotal: 0,
  793. pageList: {
  794. pageSize: 10,
  795. currentPage: 1,
  796. total: 0
  797. },
  798. itemType: '采购',
  799. packageOptions: [],
  800. switchDialog: false,
  801. // 请核状态禁用
  802. browse: false,
  803. checkDisabled: false,
  804. checkData: {},
  805. checkDialog: false,
  806. checkScheduleDialog: false,
  807. checkId: '',
  808. batchNo:'',
  809. feesOption: [],
  810. applyPaymentList: [],
  811. messageVisble: false,
  812. purchasePriceOption: [],
  813. }
  814. },
  815. mounted() {
  816. this.$nextTick(() => {
  817. // 监听浏览器高度变化,改变表格高度
  818. window.onresize = () => {
  819. this.rowHeight = (window.innerHeight - 130) + 'px'
  820. }
  821. })
  822. },
  823. filters: {
  824. IntegerFormat(num) {
  825. return IntegerFormat(num);
  826. },
  827. decimalFormat(num) {
  828. return num ? Number(num).toFixed(2) : "0.00";
  829. },
  830. },
  831. //初始化查询
  832. async created() {
  833. this.rowHeight = (window.innerHeight - 130) + 'px'
  834. this.customerContact = customerContact
  835. // this.customerContact = await this.getColumnData(this.getColumnName(18), customerContact);
  836. this.advantageProject = await this.getColumnData(this.getColumnName(19), advantageProject);
  837. this.getWorkDicts("payment_term").then(res => {
  838. this.paymentOption = res.data.data
  839. })
  840. this.getWorkDicts("packageRemarks").then(res => {
  841. this.packageOptions = res.data.data;
  842. });
  843. feeList().then(res => {
  844. this.feesOption = res.data.data.records
  845. })
  846. if (this.detailData.check) {
  847. this.checkDisabled = true
  848. this.batchNo = this.detailData.check.batchNo
  849. }
  850. if (this.detailData.id) {
  851. this.queryData(this.detailData.id)
  852. } else if(this.detailData.copyId) {
  853. this.queryData(this.detailData.copyId, true)
  854. } else {
  855. }
  856. },
  857. watch: {
  858. },
  859. methods: {
  860. // 明细查询
  861. queryData(id, isCopy = false) {
  862. this.pageLoading = true
  863. detail(id).then(res => {
  864. this.form = res.data.data;
  865. this.browse = this.form.status > 0? true: false
  866. this.contactsData = this.form.itemsVOList? this.form.itemsVOList: []
  867. this.advantageProjectData = this.form.orderFeesList? this.form.orderFeesList: []
  868. this.bankOfDepositData = this.form.orderFilesList? this.form.orderFilesList: []
  869. if (!this.form.itemsVOList) {
  870. this.contactsData = []
  871. } else {
  872. this.contactsData = this.form.itemsVOList
  873. }
  874. // if (!this.form.orderFeesList) {
  875. // this.advantageProjectData = []
  876. // } else {
  877. // this.advantageProjectData = this.form.orderFeesList
  878. // }
  879. // if (!this.form.orderFilesList) {
  880. // this.bankOfDepositData = []
  881. // } else {
  882. // this.bankOfDepositData = this.form.orderFilesList
  883. // }
  884. if (this.form.corpsName) {
  885. this.configuration.dicData = this.form.corpsName
  886. }
  887. let feesData = []
  888. this.advantageProjectData.forEach(item => {
  889. let a = {
  890. cname: item.corpName,
  891. id: item.corpId
  892. }
  893. feesData.push(a)
  894. })
  895. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  896. // 去重
  897. this.removeRepeat()
  898. let goodsData = []
  899. this.form.orderItemsList = this.form.orderItemsList? this.form.orderItemsList: []
  900. this.form.orderItemsList.forEach(item => {
  901. let a = {
  902. cname: item.cname,
  903. }
  904. goodsData.push(a)
  905. })
  906. this.goodsConfiguration.dicData = [].concat(goodsData)
  907. this.removeGoodsRepeat()
  908. delete this.form.itemsVOList
  909. delete this.form.orderFeesList
  910. delete this.form.orderFilesList
  911. // delete this.form.corpsName
  912. // 获取最大值
  913. let num = []
  914. this.advantageProjectData.forEach(item => {
  915. num.push(item.sort)
  916. })
  917. if (num.length == 0) {
  918. this.maxFeeNum = 0;
  919. } else {
  920. this.maxFeeNum = num.reduce((a, b) => {
  921. return b > a? b: a;
  922. })
  923. }
  924. let goodsNum = []
  925. this.contactsData.forEach(item => {
  926. goodsNum.push(item.sort)
  927. })
  928. if (goodsNum.length == 0) {
  929. this.maxGoodsNum = 0;
  930. } else {
  931. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  932. return b > a? b: a;
  933. })
  934. }
  935. this.oldGoodsList = []
  936. this.oldFeesList = []
  937. this.oldUploadList = []
  938. this.oldForm = Object.assign({}, this.form)
  939. this.oldGoodsList = this.deepClone(this.contactsData)
  940. this.oldFeesList = this.deepClone(this.advantageProjectData)
  941. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  942. if (isCopy) {
  943. delete this.form.sysNo;
  944. delete this.form.id
  945. this.form.status = 0
  946. this.browse = false
  947. this.contactsData.forEach(item => {
  948. delete item.id
  949. delete item.pid
  950. delete item.itemId
  951. })
  952. this.advantageProjectData.forEach(item => {
  953. delete item.id
  954. delete item.pid
  955. })
  956. this.bankOfDepositData.forEach(item => {
  957. delete item.id
  958. delete item.pid
  959. })
  960. }
  961. }).finally(() => {
  962. this.saveLoading = false
  963. this.pageLoading = false
  964. });
  965. },
  966. copyOrder() {
  967. this.queryData(this.form.id, true)
  968. },
  969. getGoodsRow(event,row) {
  970. row.priceCategory = event.goodsTypeName
  971. row.code = event.code
  972. row.typeno = event.typeno
  973. row.itemType = event.typeno
  974. row.itemId = event.id
  975. },
  976. receiveGoodList(data) {
  977. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(data)
  978. this.removeGoodsRepeat()
  979. },
  980. getRow(event,row) {
  981. row.priceCategory = event[0].goodsTypeName
  982. row.code = event[0].code
  983. row.typeno = event[0].typeno
  984. row.itemType = event[0].typeno
  985. row.itemId = event[0].id
  986. },
  987. removeGoodsRepeat() {
  988. let obj = []
  989. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  990. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  991. return current
  992. }, [])
  993. },
  994. getShipmentC() {
  995. for (let item in this.selection) {
  996. if (!this.selection[item].id) {
  997. return this.$message.error('选中数据有新数据,请先保存')
  998. }
  999. }
  1000. if (this.$store.getters.domTakeStatus) {
  1001. this.$alert("收货单存在,请保存发货单再进行操作", "温馨提示", {
  1002. confirmButtonText: "确定",
  1003. type: "warning",
  1004. callback: action => {
  1005. console.log(action);
  1006. }
  1007. });
  1008. } else {
  1009. this.generateShipmentC();
  1010. }
  1011. },
  1012. //生成收货单
  1013. generateShipmentC() {
  1014. let lsit = []
  1015. if (contrastObj(this.form, this.oldForm) ||
  1016. contrastList(this.contactsData, this.oldGoodsList) ||
  1017. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1018. contrastList(this.bankOfDepositData, this.oldUploadList)
  1019. ) {
  1020. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1021. confirmButtonText: "确定",
  1022. cancelButtonText: "取消",
  1023. type: "warning"
  1024. }).then(async () => {
  1025. await this.editCustomer(false, '收货')
  1026. }).catch(() => {
  1027. this.$message({
  1028. type: 'info',
  1029. message: '已取消'
  1030. });
  1031. })
  1032. } else {
  1033. this.selection.forEach(item => {
  1034. lsit.push(item.id)
  1035. })
  1036. let data = {
  1037. id: this.form.id,
  1038. orderItemIds: lsit
  1039. }
  1040. generateShipment(data).then(res => {
  1041. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1042. this.$router.push({
  1043. path: "/businessManagement/receipt/index",
  1044. query: {form: JSON.stringify(res.data.data)},
  1045. });
  1046. })
  1047. }
  1048. },
  1049. //点击行可编辑
  1050. handleRowClick(row, event, column) {
  1051. },
  1052. //商品编辑
  1053. rowCell(row, index) {
  1054. if (row.$cellEdit) {
  1055. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1056. return this.$message.error('订货数量不能小于发货数量')
  1057. }
  1058. }
  1059. this.$refs.crudContact.rowCell(row, row.$index)
  1060. },
  1061. //费用编辑
  1062. rowCellTwo(row, index) {
  1063. this.$refs.crudProject.rowCell(row, row.$index)
  1064. },
  1065. //商品选中触发
  1066. productSelection(selection) {
  1067. this.selection = selection
  1068. },
  1069. //费用新增触发
  1070. costIncrease() {
  1071. this.dialogCost = !this.dialogCost
  1072. this.choiceData = false
  1073. },
  1074. //商品新增触发
  1075. commoditySelection() {
  1076. this.dialogVisible = !this.dialogVisible
  1077. this.tableData = []
  1078. this.commodityData = false
  1079. this.goodsListSave = [];
  1080. },
  1081. //点击费用明细选择触发
  1082. choice(row) {
  1083. this.dialogCost = !this.dialogCost
  1084. this.choiceData = true
  1085. this.choiceIndex = row.$index
  1086. },
  1087. //点击商品明细选择触发
  1088. commodityChoice(row) {
  1089. this.dialogVisible = !this.dialogVisible
  1090. this.commodityData = true
  1091. this.choiceIndexT = row.$index
  1092. },
  1093. //导入商品触发
  1094. importChoice() {
  1095. if (this.tableData.length === 1) {
  1096. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1097. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1098. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1099. this.contactsData[this.choiceIndexT].itemType = this.tableData[0].typeno
  1100. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1101. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1102. this.contactsData[this.choiceIndexT].orderQuantity = 0
  1103. this.contactsData[this.choiceIndexT].price = 0
  1104. this.contactsData[this.choiceIndexT].amount = 0
  1105. getPurchasePrice({code: this.contactsData[this.choiceIndexT].code}).then(res => {
  1106. if (res.data.data.length > 0) {
  1107. this.$set(this.contactsData[this.choiceIndexT], 'purchaseAmount', res.data.data[0].purchasePrice)
  1108. } else {
  1109. this.$set(this.contactsData[this.choiceIndexT], 'purchaseAmount', '0')
  1110. }
  1111. })
  1112. selectGoodsNum({
  1113. goodsId: this.tableData[0].id,
  1114. itemType: this.tableData[0].typeno
  1115. }).then(res => {
  1116. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1117. })
  1118. }
  1119. this.dialogVisible = !this.dialogVisible
  1120. this.commodityData = false
  1121. },
  1122. //费用编辑导入触发
  1123. choiceCost() {
  1124. if (this.tableDataCost.length === 1) {
  1125. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1126. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1127. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1128. }
  1129. this.dialogCost = !this.dialogCost
  1130. this.choiceData = false
  1131. },
  1132. //费用导入触发
  1133. importCost() {
  1134. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1135. if (this.tableDataCost.length > 0) {
  1136. for (let item in this.tableDataCost) {
  1137. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1138. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1139. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1140. this.maxFeeNum++
  1141. delete this.tableDataCost[item].id
  1142. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1143. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1144. }
  1145. }
  1146. this.tableDataCost = []
  1147. this.dialogCost = false
  1148. },
  1149. //确认导入触发
  1150. importGoods() {
  1151. if (this.goodsListSave.length > 0) {
  1152. for (let item in this.goodsListSave) {
  1153. getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
  1154. if (res.data.data.length > 0) {
  1155. this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  1156. } else {
  1157. this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
  1158. }
  1159. })
  1160. selectGoodsNum({
  1161. goodsId: this.goodsListSave[item].id,
  1162. itemType: this.goodsListSave[item].typeno
  1163. }).then(res => {
  1164. this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
  1165. this.goodsListSave[item].itemId = this.goodsListSave[item].id
  1166. this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
  1167. delete this.goodsListSave[item].id
  1168. this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
  1169. this.$set(this.goodsListSave[item], 'specificationAndModel', this.goodsListSave[item].typeno)
  1170. this.$set(this.goodsListSave[item], 'priceType', '一般')
  1171. this.$set(this.goodsListSave[item], 'orderQuantity', 0)
  1172. this.$set(this.goodsListSave[item], 'actualQuantity', 0)
  1173. this.goodsListSave[item].price = 0
  1174. this.goodsListSave[item].amount = 0
  1175. this.goodsListSave[item].sort = this.maxGoodsNum + 1
  1176. this.maxGoodsNum++
  1177. this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
  1178. // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
  1179. })
  1180. }
  1181. } else {
  1182. for (let item in this.tableData) {
  1183. getPurchasePrice({code: this.tableData[item].code}).then(res => {
  1184. if (res.data.data.length > 0) {
  1185. this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  1186. } else {
  1187. this.$set(this.tableData[item], 'purchaseAmount', '0')
  1188. }
  1189. })
  1190. selectGoodsNum({
  1191. goodsId: this.tableData[item].id,
  1192. itemType: this.tableData[item].typeno
  1193. }).then(res => {
  1194. this.$set(this.tableData[item], 'storageQuantity', res.data.data)
  1195. this.tableData[item].itemId = this.tableData[item].id
  1196. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1197. delete this.tableData[item].id
  1198. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
  1199. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1200. this.$set(this.tableData[item], 'priceType', '一般')
  1201. this.$set(this.tableData[item], 'orderQuantity', 0)
  1202. this.$set(this.tableData[item], 'actualQuantity', 0)
  1203. this.tableData[item].price = 0
  1204. this.tableData[item].amount = 0
  1205. this.tableData[item].sort = this.maxGoodsNum + 1
  1206. this.maxGoodsNum++
  1207. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1208. // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
  1209. })
  1210. }
  1211. }
  1212. if (this.tableData.length > 0) {
  1213. }
  1214. this.dialogVisible = false
  1215. },
  1216. closeGoods() {
  1217. this.treeDataGoods = [];
  1218. this.treeDeptId = "";
  1219. this.activeName = "searchList";
  1220. },
  1221. closeFees() {
  1222. this.treeDeptIdCost = "";
  1223. this.treeData = [];
  1224. },
  1225. //选中触发
  1226. selectionChange(list) {
  1227. this.tableData = list
  1228. },
  1229. //费用选中触发
  1230. selectionChangeCost(list) {
  1231. this.tableDataCost = list
  1232. },
  1233. //导入页左商品类型查询
  1234. nodeClick(data) {
  1235. this.treeDeptId = data.id;
  1236. this.page.currentPage = 1;
  1237. this.onLoad(this.page);
  1238. },
  1239. //导入页左费用类型查询
  1240. nodeClickCost(data) {
  1241. this.treeDeptIdCost = data.id;
  1242. this.pageCost.currentPage = 1;
  1243. this.onLoadCost(this.pageCost);
  1244. },
  1245. //刷新触发
  1246. refreshChange() {
  1247. this.treeDeptId = '';
  1248. this.page.currentPage = 1;
  1249. this.onLoad(this.page);
  1250. },
  1251. //费用刷新触发
  1252. refreshChangeCost() {
  1253. this.treeDeptIdCost = '';
  1254. this.pageCost.currentPage = 1;
  1255. this.onLoadCost(this.pageCost);
  1256. },
  1257. //新增商品信息保存触发
  1258. rowSave(row, done, loading) {
  1259. // this.contactsData.push(row)
  1260. done()
  1261. },
  1262. //修改商品信息触发
  1263. rowUpdate(row, index, done, loading) {
  1264. done(row);
  1265. },
  1266. //删除商品信息触发
  1267. rowDel(row, index, donerowDel) {
  1268. this.$confirm("确定将选择数据删除?", {
  1269. confirmButtonText: "确定",
  1270. cancelButtonText: "取消",
  1271. type: "warning"
  1272. }).then(() => {
  1273. //商品判断是否需要调用删除接口
  1274. if (row.id) {
  1275. corpsattn(row.id).then(res => {
  1276. this.$message({
  1277. type: "success",
  1278. message: "操作成功!"
  1279. });
  1280. this.contactsData.splice(row.$index, 1);
  1281. })
  1282. } else {
  1283. this.$message({
  1284. type: "success",
  1285. message: "操作成功!"
  1286. });
  1287. this.contactsData.splice(row.$index, 1);
  1288. }
  1289. })
  1290. },
  1291. //新增费用明细保存触发
  1292. rowSaveProject(row, done, loading) {
  1293. // this.advantageProjectData.push(row)
  1294. done()
  1295. },
  1296. //修改费用明细触发
  1297. rowUpdateProject(row, index, done, loading) {
  1298. done(row);
  1299. },
  1300. goodsSearch(params, done) {
  1301. this.treeDeptId = '';
  1302. this.onLoad(this.page, params);
  1303. done()
  1304. },
  1305. //商品列表查询
  1306. onLoad(page, params = {}) {
  1307. this.loading = true;
  1308. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1309. const data = res.data.data;
  1310. this.page.total = data.total;
  1311. this.data = data.records;
  1312. this.goodsListShow = data.records;
  1313. this.loading = false;
  1314. });
  1315. },
  1316. // 费用查询按钮
  1317. feesSearch(params, done) {
  1318. this.treeDeptIdCost = '';
  1319. this.onLoadCost(this.pageCost, params)
  1320. done()
  1321. },
  1322. //费用查询
  1323. onLoadCost(page, params = {}) {
  1324. this.loadingCost = true;
  1325. let queryParams = Object.assign({}, params, {
  1326. pageSize: page.pageSize,
  1327. pageNum: page.currentPage,
  1328. parentId: 0,
  1329. feesTypeId: this.treeDeptIdCost
  1330. })
  1331. customerList(queryParams).then(res => {
  1332. const data = res.data.data;
  1333. this.pageCost.total = data.total;
  1334. this.dataCost = data.records;
  1335. this.loadingCost = false;
  1336. });
  1337. },
  1338. //删除费用明细触发
  1339. rowDelProject(row, index, donerowDel) {
  1340. this.$confirm("确定将选择数据删除?", {
  1341. confirmButtonText: "确定",
  1342. cancelButtonText: "取消",
  1343. type: "warning"
  1344. }).then(() => {
  1345. //费用判断是否需要调用删除接口
  1346. if (row.id) {
  1347. corpsitem(row.id).then(res => {
  1348. this.$message({
  1349. type: "success",
  1350. message: "操作成功!"
  1351. });
  1352. this.advantageProjectData.splice(row.$index, 1);
  1353. })
  1354. } else {
  1355. this.$message({
  1356. type: "success",
  1357. message: "操作成功!"
  1358. });
  1359. this.advantageProjectData.splice(row.$index, 1);
  1360. }
  1361. })
  1362. },
  1363. // 计算费用
  1364. changeContractAmt(row) {
  1365. getPurchasePrice({code: row.code}).then(res => {
  1366. this.purchasePriceOption = res.data.data
  1367. })
  1368. let orderQuantity = 0;
  1369. let purchaseAmount = 0;
  1370. if (row.purchaseAmount) {
  1371. purchaseAmount = row.purchaseAmount;
  1372. }
  1373. if (row.orderQuantity) {
  1374. orderQuantity = row.orderQuantity;
  1375. }
  1376. this.$set(row, "amount", Number(orderQuantity) * Number(purchaseAmount)).toFixed(2);
  1377. },
  1378. // 去重
  1379. removeRepeat() {
  1380. let obj = []
  1381. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1382. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1383. return current
  1384. }, [])
  1385. },
  1386. receiveList(data){
  1387. this.configuration.dicData = this.configuration.dicData.concat(data)
  1388. this.removeRepeat()
  1389. },
  1390. //修改提交触发
  1391. editCustomer(isBack = false, type) {
  1392. this.$refs["form"].validate((valid) => {
  1393. if (valid) {
  1394. for (let item in this.contactsData) {
  1395. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  1396. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  1397. }
  1398. }
  1399. this.form.orderAmount = 0;
  1400. this.contactsData.forEach(item => {
  1401. this.form.orderAmount = Number(this.form.orderAmount) + Number(item.amount)
  1402. })
  1403. //商品信息
  1404. this.form.itemsVOList = this.contactsData
  1405. // this.form.orderFeesList = this.advantageProjectData
  1406. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  1407. this.form.orderFilesList = this.bankOfDepositData
  1408. if (typeof this.form.corpsTypeId == 'object') {
  1409. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1410. }
  1411. this.saveLoading = true
  1412. this.form.billType = 'CG'
  1413. this.$set(this.form, 'tradeType', 'GN')
  1414. // 如果有id解锁,没有跳过
  1415. // this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1416. typeSave(this.form).then(res => {
  1417. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1418. // this.$set(this.detailData, 'seeDisabled', true);
  1419. if (isBack) {
  1420. //成功关闭此页面回到列表页
  1421. this.$emit("goBack");
  1422. this.leaveDetailsKey(this.$route.name)
  1423. } else {
  1424. this.queryData(res.data.data)
  1425. }
  1426. if (type == '收货') {
  1427. let lsit = []
  1428. this.selection.forEach(item => {
  1429. lsit.push(item.id)
  1430. })
  1431. let data = {
  1432. id: this.form.id,
  1433. orderItemIds: lsit
  1434. }
  1435. generateShipment(data).then(res => {
  1436. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1437. this.$router.push({
  1438. path: "/businessManagement/receipt/index",
  1439. query: {form: JSON.stringify(res.data.data)},
  1440. });
  1441. })
  1442. }
  1443. }).catch(() => {
  1444. this.pageLoading = false
  1445. this.saveLoading = false
  1446. })
  1447. } else {
  1448. return false;
  1449. }
  1450. });
  1451. },
  1452. beforeBillData(bool,type){
  1453. this.applyPaymentList = [];
  1454. let arr = [];
  1455. this.billType = type
  1456. this.financeData = {
  1457. url:"/financialManagement/paymentRequest/index",
  1458. pageStatus:"this.$store.getters.pqStatus",
  1459. pageLabel:"付费申请",
  1460. checkType: 'ffsq'
  1461. }
  1462. //采购明细提单号 list
  1463. this.billData = {
  1464. belongCompany: this.form.belongCompany,
  1465. srcOrderno:this.form.orderNo,
  1466. itemType:"采购",
  1467. corpsName:this.form.corpsName,
  1468. corpId:this.form.corpId,
  1469. srcParentId: this.form.id,
  1470. currency: 'CNY',
  1471. exchangeRate: '1',
  1472. taxRate: '0',
  1473. accDate: this.form.businesDate,
  1474. srcType: 1, // 1.采购or销售主表货款申请 2. 采购or销售-费用明细申请 3.收发货-费用明细
  1475. tradeType: 'GN',
  1476. optionType: 'GN',
  1477. amount: this.form.orderAmount,
  1478. costType: this.feesOption.find(e => e.cname == '货款').id
  1479. }
  1480. arr.push(this.billData)
  1481. let getFeeList = this.$refs.feeInfo.submitData().filter(item => item.feesType == 2)
  1482. getFeeList.forEach(item => {
  1483. let form = {
  1484. srcOrderno:this.form.orgOrderNo,
  1485. itemType:"采购",
  1486. corpsName:item.corpName,
  1487. corpId: item.corpId,
  1488. srcParentId: this.form.id,
  1489. currency: 'CNY',
  1490. exchangeRate: '1',
  1491. taxRate: '0',
  1492. accDate: this.form.businesDate,
  1493. srcType: 2,
  1494. tradeType: 'GN',
  1495. optionType: 'GN',
  1496. chargeMember: this.form.chargeMember,
  1497. parentId: this.form.id,
  1498. amount: item.amount,
  1499. costType: item.itemId,
  1500. srcFeesId: item.id,
  1501. }
  1502. arr.push(form)
  1503. })
  1504. this.applyPaymentList = [...arr]
  1505. if(bool){ //申请货款
  1506. // this.billData.srcId = -1
  1507. }
  1508. },
  1509. // 查看申请记录
  1510. openApplicationDialog(){
  1511. this.applicationDialog = true
  1512. },
  1513. //关闭申记录
  1514. choceApplication(){
  1515. this.applicationDialog = false
  1516. },
  1517. //申请货款
  1518. applyPayment(type){
  1519. // if (contrastObj(this.form, this.oldForm) ||
  1520. // contrastList(this.contactsData, this.oldGoodsList) ||
  1521. // contrastList(this.advantageProjectData, this.oldFeesList) ||
  1522. // contrastList(this.bankOfDepositData, this.oldUploadList)
  1523. // ) {
  1524. // this.$confirm("您已改动数据,是否先保存在进行操作!", {
  1525. // confirmButtonText: "保存",
  1526. // cancelButtonText: "取消",
  1527. // type: "warning"
  1528. // }).then(() => {
  1529. // this.editCustomer();
  1530. // })
  1531. // }else{
  1532. this.beforeBillData(true,type);
  1533. this.financialAccountDialog = true;
  1534. // }
  1535. },
  1536. //关闭账单
  1537. choceFun(){
  1538. this.financialAccountDialog = false
  1539. },
  1540. //返回列表
  1541. backToList() {
  1542. if (contrastObj(this.form, this.oldForm) ||
  1543. contrastList(this.contactsData, this.oldGoodsList) ||
  1544. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1545. contrastList(this.bankOfDepositData, this.oldUploadList)
  1546. ) {
  1547. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1548. confirmButtonText: "确定",
  1549. cancelButtonText: "取消",
  1550. type: "warning"
  1551. }).then(() => {
  1552. this.editCustomer(true)
  1553. }).catch(() => {
  1554. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1555. this.$emit("goBack");
  1556. this.leaveDetailsKey(this.$route.name)
  1557. })
  1558. } else {
  1559. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1560. this.$emit("goBack");
  1561. this.leaveDetailsKey(this.$route.name)
  1562. }
  1563. },
  1564. // 保存列设置
  1565. async saveColumn(name) {
  1566. if (name == 'goods') {
  1567. const inSave = await this.saveColumnData(
  1568. this.getColumnName(18),
  1569. this.customerContact
  1570. );
  1571. if (inSave) {
  1572. this.$message.success("保存成功");
  1573. //关闭窗口
  1574. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1575. this.$nextTick(() => {
  1576. this.$refs.crudContact.doLayout()
  1577. })
  1578. }
  1579. } else if (name === 'fees') {
  1580. const inSave = await this.saveColumnData(
  1581. this.getColumnName(19),
  1582. this.advantageProject
  1583. );
  1584. if (inSave) {
  1585. this.$message.success("保存成功");
  1586. //关闭窗口
  1587. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1588. }
  1589. }
  1590. },
  1591. async resetColumn() {
  1592. this.customerContact = customerContact
  1593. const inSave = await this.delColumnData(
  1594. this.getColumnName(18),
  1595. customerContact
  1596. );
  1597. if (inSave) {
  1598. this.$nextTick(() => {
  1599. this.$refs.crudContact.doLayout()
  1600. })
  1601. this.$message.success("重置成功");
  1602. //关闭窗口
  1603. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1604. }
  1605. },
  1606. returnBack(row) {
  1607. if (row.belongtocompany) {
  1608. // this.form.belongToCorpId = row.belongtocompany
  1609. }
  1610. this.$set(this.form, 'paymentType', row.paymentType)
  1611. this.$set(this.form, 'packageRemarks', row.packageRemarks)
  1612. getlistBankBy(row.id).then(res =>{
  1613. this.$set(this.form, 'banks', null)
  1614. this.$set(this.form, 'banksAccountName', null)
  1615. this.$set(this.form, 'accountBank', null)
  1616. this.bankList = res.data
  1617. if (this.bankList.length > 0) {
  1618. this.form.banks = this.bankList[0].accountNo
  1619. this.form.banksAccountName = this.bankList[0].accountName
  1620. this.form.accountBank = this.bankList[0].accountBank
  1621. }
  1622. })
  1623. },
  1624. // 银行账号变化
  1625. banksChange(val) {
  1626. let isTrue = false
  1627. this.bankList.forEach(item => {
  1628. if (val == item.accountNo) {
  1629. this.$set(this.form, 'banksAccountName', item.accountName)
  1630. this.$set(this.form, 'accountBank', item.accountBank)
  1631. isTrue = true
  1632. }
  1633. })
  1634. if (!isTrue) {
  1635. this.$set(this.form, 'banksAccountName', null)
  1636. this.$set(this.form, 'accountBank', null)
  1637. }
  1638. },
  1639. // 标签页切换
  1640. tabHandle(data) {
  1641. if (data.name == 'searchList') {
  1642. this.goodsListShow = this.data;
  1643. this.page.total = this.pageList.total
  1644. } else if (data.name == 'importStaging') {
  1645. this.goodsListShow = this.goodsListSave;
  1646. this.page.total = 0
  1647. }
  1648. },
  1649. removeStagList(row, index) {
  1650. this.goodsListSave.splice(row.$index, 1)
  1651. },
  1652. importStagList(row, index) {
  1653. this.goodsListSave.push(row);
  1654. },
  1655. beforeFinance(feesData,callback) {
  1656. this.advantageProjectData = feesData;
  1657. let params = {}
  1658. params.valid = true
  1659. params.parentId = this.form.id
  1660. params.srcOrderno = this.form.orderNo
  1661. callback(params)
  1662. },
  1663. // 报表
  1664. openReport() {
  1665. this.switchDialog =! this.switchDialog;
  1666. },
  1667. onClose(val) {
  1668. this.switchDialog = val;
  1669. },
  1670. //请核
  1671. pleaseCheck() {
  1672. // this.verification()
  1673. if (this.verification()) {
  1674. this.$confirm("您确定提交此次申请吗?", {
  1675. confirmButtonText: "确定",
  1676. cancelButtonText: "取消",
  1677. type: "warning"
  1678. }).then(() => {
  1679. const data = {
  1680. id : this.form.id,
  1681. checkType: 'cgqh',
  1682. url: '/businessManagement/purchaseOrder/index',
  1683. pageStatus:"this.$store.getters.domPurStatus",
  1684. pageLabel:"采购订单(N)",
  1685. checkFlag: 1,
  1686. }
  1687. this.pageLoading = true
  1688. pleaseCheck(data).then(res => {
  1689. this.$message.success('请核成功')
  1690. // this.pageLoading = false
  1691. this.saveActives = ''
  1692. this.queryData(this.form.id)
  1693. }).finally(() => {
  1694. this.pageLoading = false
  1695. })
  1696. })
  1697. } else {
  1698. }
  1699. },
  1700. verification() {
  1701. let getFeeList = this.$refs.feeInfo.submitData()
  1702. if (contrastObj(this.form, this.oldForm) ||
  1703. contrastList(this.contactsData, this.oldGoodsList) ||
  1704. // contrastList(getFeeList, this.oldFeesList) ||
  1705. contrastList(this.bankOfDepositData, this.oldUploadList)
  1706. ) {
  1707. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1708. confirmButtonText: "确定",
  1709. cancelButtonText: "取消",
  1710. type: "warning"
  1711. }).then(() => {
  1712. this.editCustomer(false)
  1713. }).catch(() => {
  1714. return false; //取消改动数据
  1715. })
  1716. } else {
  1717. return true; //没有动过数据
  1718. }
  1719. },
  1720. //打开审核
  1721. openCheckDialog(){
  1722. this.checkData = this.detailData.check
  1723. this.checkDialog = true;
  1724. },
  1725. //关闭审核
  1726. choceCheckFun(){
  1727. this.checkDialog = false;
  1728. },
  1729. choceScheduleFun(){
  1730. this.checkScheduleDialog = false
  1731. },
  1732. editHandle() {
  1733. const data = {
  1734. moduleName: 'cg',
  1735. tableName: 'business_order',
  1736. billId: this.form.id,
  1737. no: localStorage.getItem('browserID'),
  1738. billNo: this.form.orderNo
  1739. }
  1740. this.saveLoading = true
  1741. this.checkLock(data).then(res => {
  1742. if (res.data.code == 200) {
  1743. this.onLock(data).then(response => {
  1744. this.queryData(this.form.id)
  1745. })
  1746. this.inDetailsKey(this.$route.name, {
  1747. moduleName: 'cg',
  1748. tableName: 'business_order',
  1749. billId: this.form.id,
  1750. })
  1751. this.detailData.seeDisabled = false;
  1752. }
  1753. }).catch(error => {
  1754. }).finally(() => {
  1755. this.saveLoading = false
  1756. })
  1757. },
  1758. getGSName(row) {
  1759. this.form.belongCompany = row.cname
  1760. },
  1761. // 发送消息
  1762. postMessage() {
  1763. this.messageVisble = true
  1764. this.$nextTick(() => {
  1765. this.$refs.messagePost.init()
  1766. })
  1767. },
  1768. closeDialog() {
  1769. this.messageVisble = false
  1770. },
  1771. }
  1772. }
  1773. </script>
  1774. <style lang="scss" scoped>
  1775. .back-icon {
  1776. line-height: 64px;
  1777. font-size: 20px;
  1778. margin-right: 8px;
  1779. }
  1780. //.add-customer-btn {
  1781. // position: fixed;
  1782. // right: 36px;
  1783. // top: 115px;
  1784. //}
  1785. ::v-deep .el-form-item {
  1786. margin-bottom: 0;
  1787. }
  1788. .el-dialogDeep {
  1789. ::v-deep .el-dialog {
  1790. margin: 1vh auto 0 !important;
  1791. padding-bottom: 10px !important;
  1792. .el-dialog__body, .el-dialog__footer {
  1793. padding-bottom: 0 !important;
  1794. padding-top: 0 !important;
  1795. }
  1796. }
  1797. }
  1798. .print-div {
  1799. color: #000;
  1800. }
  1801. .print_table {
  1802. table {
  1803. border-right: 1px solid #000;
  1804. border-bottom: 1px solid #000;
  1805. font-size: 12px;
  1806. margin-bottom: 5px;
  1807. }
  1808. table td {
  1809. border-left: 1px solid #000;
  1810. border-top: 1px solid #000;
  1811. vertical-align: middle;
  1812. padding: 2px;
  1813. text-align: center;
  1814. }
  1815. }
  1816. .table {
  1817. border-collapse: collapse;
  1818. border-spacing: 0;
  1819. background-color: transparent;
  1820. display: table;
  1821. width: 99%;
  1822. max-width: 100%;
  1823. margin: 0 auto;
  1824. }
  1825. .table td {
  1826. text-align: left;
  1827. vertical-align: middle;
  1828. font-size: 14px;
  1829. color: #000000;
  1830. padding: 10.5px 0 10.5px 30px;
  1831. //border: 1px solid #000;
  1832. }
  1833. ::v-deep .el-form-item {
  1834. margin-bottom: 0;
  1835. }
  1836. ::v-deep .el-form-item__content{
  1837. line-height: 32px;
  1838. }
  1839. </style>