detailsPageEdit.vue 61 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 :showBtn="true">
  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>
  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="headerSerial" slot-scope="{column}">
  154. <el-button type="primary" icon="el-icon-circle-plus-outline" circle size="mini" @click="$refs.crudContact.rowCellAdd()"></el-button>
  155. </template>
  156. <template slot="cname" slot-scope="{ row }">
  157. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  158. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  159. <span v-else>
  160. {{ row.cname }}
  161. <!-- <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>-->
  162. </span>
  163. </template>
  164. <template slot="orderQuantity" slot-scope="{ row }">
  165. <el-input
  166. v-if="row.$cellEdit"
  167. v-model.trim="row.orderQuantity"
  168. oninput='this.value=this.value.replace(/[^(\d)]/g,"")' size="small"
  169. @input="changeContractAmt(row)"
  170. ></el-input>
  171. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  172. </template>
  173. <template slot="purchaseAmount" slot-scope="{ row }">
  174. <el-select
  175. v-if="row.$cellEdit"
  176. v-model="row.purchaseAmount"
  177. @change="changeContractAmt(row)"
  178. allow-create
  179. filterable
  180. v-input-limit="2"
  181. default-first-option
  182. >
  183. <el-option
  184. v-for="(item, index) in purchasePriceOption"
  185. :key="index"
  186. :label="item.purchasePrice"
  187. :value="item.purchasePrice"></el-option>
  188. </el-select>
  189. <span v-else>{{ row.purchaseAmount | decimalFormat }}</span>
  190. </template>
  191. <template slot="amount" slot-scope="{ row }">
  192. <span>{{ row.amount | decimalFormat }}</span>
  193. </template>
  194. <template slot="actualQuantity" slot-scope="{ row }">
  195. <span>{{ row.actualQuantity | IntegerFormat }}</span>
  196. </template>
  197. <template slot="storageQuantity" slot-scope="{ row }">
  198. <span>{{ row.storageQuantity | IntegerFormat }}</span>
  199. </template>
  200. <template slot="code" slot-scope="{row,index}">
  201. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  202. <span>{{ row.code }}</span>
  203. </template>
  204. <template slot-scope="{row,index}" slot="menu">
  205. <el-button
  206. type="text"
  207. size="small"
  208. @click="rowCell(row,index)"
  209. :disabled="detailData.seeDisabled"
  210. >{{ row.$cellEdit ? '保存' : '修改' }}
  211. </el-button>
  212. <el-button
  213. size="small"
  214. icon="el-icon-delete"
  215. type="text"
  216. @click="rowDel(row, index)"
  217. :disabled="detailData.seeDisabled"
  218. v-if="!row.$cellEdit"
  219. >删 除</el-button>
  220. </template>
  221. <template slot="menuLeft" slot-scope="{size}">
  222. <el-button type="primary"
  223. icon="el-icon-plus"
  224. size="small"
  225. @click="commoditySelection"
  226. :disabled="detailData.seeDisabled"
  227. >录入明细
  228. </el-button>
  229. <el-button type="warning"
  230. icon="el-icon-plus"
  231. size="small"
  232. :disabled="selection.length < 1 || detailData.seeDisabled || form.createFreight == 1"
  233. @click="getShipmentC">生成工厂发货
  234. </el-button>
  235. <el-button type="info" :size="size" icon="el-icon-printer" @click.stop="openReport()">报 表</el-button>
  236. </template>
  237. </avue-crud>
  238. </basic-container>
  239. <fee-info
  240. ref="feeInfo"
  241. :orderFeesList="advantageProjectData"
  242. :disabled="detailData.seeDisabled"
  243. feeUrl="/trade-purchase/purchase-order/removeByFees"
  244. optionType="GN"
  245. itemType="采购"
  246. @beforeFinance="beforeFinance"
  247. :corpId="form.corpId"
  248. :tabShow="3"
  249. />
  250. <containerTitle title="附件上传"></containerTitle>
  251. <c-upload
  252. :data="bankOfDepositData"
  253. deleteUrl="/api/trade-purchase/purchase-order/removeByFiles"
  254. :enumerationValue="77"
  255. />
  256. </el-form>
  257. </div>
  258. <el-dialog
  259. title="导入商品"
  260. append-to-body
  261. class="el-dialogDeep"
  262. :visible.sync="dialogVisible"
  263. width="80%"
  264. :close-on-click-modal="false"
  265. :destroy-on-close="true"
  266. :close-on-press-escape="false"
  267. @close="closeGoods">
  268. <el-row :style="{height: rowHeight}">
  269. <el-col :span="5" style="height: 100%;overflow-y: auto">
  270. <div>
  271. <el-scrollbar>
  272. <basic-container>
  273. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  274. </basic-container>
  275. </el-scrollbar>
  276. </div>
  277. </el-col>
  278. <el-col :span="19">
  279. <basic-container>
  280. <avue-crud :option="optionTwo"
  281. :table-loading="loading"
  282. :data="goodsListShow"
  283. ref="crud"
  284. @refresh-change="refreshChange"
  285. @selection-change="selectionChange"
  286. :page.sync="page"
  287. @search-change="goodsSearch"
  288. @on-load="onLoad">
  289. <template slot="menuLeft" slot-scope="{size}">
  290. <el-tabs v-model="activeName" @tab-click="tabHandle">
  291. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  292. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  293. </el-tabs>
  294. </template>
  295. <template slot-scope="scope" slot="menu">
  296. <el-button
  297. type="text"
  298. icon="el-icon-edit"
  299. size="small"
  300. @click.stop="importStagList(scope.row,scope.index)"
  301. v-if="activeName=='searchList'"
  302. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  303. >选择
  304. </el-button>
  305. <el-button
  306. type="text"
  307. icon="el-icon-delete"
  308. size="small"
  309. @click.stop="removeStagList(scope.row,scope.index)"
  310. v-else
  311. >移除
  312. </el-button>
  313. </template>
  314. </avue-crud>
  315. </basic-container>
  316. </el-col>
  317. </el-row>
  318. <span slot="footer" class="dialog-footer">
  319. <el-button @click="dialogVisible = false">取 消</el-button>
  320. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  321. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  322. :disabled="tableData.length !== 1">导入</el-button>
  323. </span>
  324. </el-dialog>
  325. <el-dialog
  326. title="导入费用"
  327. append-to-body
  328. class="el-dialogDeep"
  329. :visible.sync="dialogCost"
  330. width="80%"
  331. :close-on-click-modal="false"
  332. :destroy-on-close="true"
  333. :close-on-press-escape="false"
  334. @close="closeFees">
  335. <el-row :style="{height: rowHeight}">
  336. <el-col :span="5" style="height: 100%;overflow-y: auto">
  337. <div>
  338. <el-scrollbar>
  339. <basic-container>
  340. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  341. </basic-container>
  342. </el-scrollbar>
  343. </div>
  344. </el-col>
  345. <el-col :span="19">
  346. <basic-container>
  347. <avue-crud :option="optionTwoCost"
  348. :table-loading="loadingCost"
  349. :data="dataCost"
  350. ref="crud"
  351. @refresh-change="refreshChangeCost"
  352. @selection-change="selectionChangeCost"
  353. :page.sync="pageCost"
  354. @searchChange="feesSearch"
  355. @on-load="onLoadCost">
  356. </avue-crud>
  357. </basic-container>
  358. </el-col>
  359. </el-row>
  360. <span slot="footer" class="dialog-footer">
  361. <el-button @click="dialogCost = false">取 消</el-button>
  362. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  363. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  364. :disabled="tableDataCost.length !== 1">导入</el-button>
  365. </span>
  366. </el-dialog>
  367. <el-dialog
  368. append-to-body
  369. title="账单"
  370. class="el-dialogDeep"
  371. :visible.sync="financialAccountDialog"
  372. width="70%"
  373. :close-on-click-modal="false"
  374. :destroy-on-close="true"
  375. :close-on-press-escape="false"
  376. v-dialog-drag
  377. >
  378. <financial-account
  379. v-if="financialAccountDialog"
  380. :billType="billType"
  381. :billData="{}"
  382. :arrList="applyPaymentList"
  383. :checkData="financeData"
  384. @choceFun="choceFun"
  385. @submit="feeSubmit"
  386. >
  387. </financial-account>
  388. </el-dialog>
  389. <el-dialog
  390. title="申请记录"
  391. append-to-body
  392. class="el-dialogDeep"
  393. :visible.sync="applicationDialog"
  394. width="60%"
  395. :close-on-click-modal="false"
  396. :destroy-on-close="true"
  397. :close-on-press-escape="false"
  398. v-dialog-drag
  399. >
  400. <bill-application
  401. :billId="form.id"
  402. @choceApplication="choceApplication"
  403. >
  404. </bill-application>
  405. </el-dialog>
  406. <report-dialog
  407. :switchDialog="switchDialog"
  408. :reportId="form.id"
  409. reportName="发货通知单"
  410. @onClose="onClose()"
  411. ></report-dialog>
  412. <el-dialog
  413. append-to-body
  414. title="审批"
  415. class="el-dialogDeep"
  416. :visible.sync="checkDialog"
  417. width="50%"
  418. :close-on-click-modal="false"
  419. :destroy-on-close="true"
  420. :close-on-press-escape="false"
  421. v-dialog-drag
  422. >
  423. <check
  424. :checkData="checkData"
  425. :checkDetail="false"
  426. :idList="[]"
  427. @choceCheckFun="choceCheckFun"
  428. >
  429. </check>
  430. </el-dialog>
  431. <el-dialog
  432. append-to-body
  433. title="审批进度"
  434. class="el-dialogDeep"
  435. :visible.sync="checkScheduleDialog"
  436. width="40%"
  437. :close-on-click-modal="false"
  438. :destroy-on-close="true"
  439. :close-on-press-escape="false"
  440. v-dialog-drag
  441. >
  442. <check-schedule
  443. :checkId="checkId"
  444. :batchNo="batchNo"
  445. @choceScheduleFun="choceScheduleFun"
  446. >
  447. </check-schedule>
  448. </el-dialog>
  449. <messagePost
  450. v-if="messageVisble"
  451. ref="messagePost"
  452. @closeDialog="closeDialog"
  453. ></messagePost>
  454. </div>
  455. </template>
  456. <script>
  457. import {
  458. typeSave,
  459. detail,
  460. corpsattn,
  461. corpsbank,
  462. corpsitem,
  463. // getList,
  464. getDeptLazyTreeS,
  465. getSysNo,
  466. generateShipment
  467. } from "@/api/basicData/purchaseOrder"
  468. import {getList} from "@/api/basicData/commodityType";
  469. import customerContact from "./configuration/customerContact.json"
  470. import advantageProject from "./configuration/advantageProject.json"
  471. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  472. import commodity from "./configuration/commodity.json"
  473. import optionTwoCost from "./configuration/mainListCost.json"
  474. import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
  475. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  476. import { contrastObj, contrastList } from "@/util/contrastData";
  477. //账单组件
  478. import ApplyPayment from "../../../components/finance/applyPayment";
  479. import billApplication from "@/components/bill/billApplication";
  480. import { getlistBankBy, pleaseCheck, } from "@/api/basicData/configuration"
  481. import feeInfo from "@/components/fee-info/main";
  482. import {
  483. isDiscount,
  484. isPercentage,
  485. micrometerFormat,
  486. IntegerFormat
  487. } from "@/util/validate";
  488. import financialAccount from "../../../components/finance/financialAccount";
  489. import reportDialog from "@/components/report-dialog/main";
  490. import check from "@/components/check/check";
  491. import checkSchedule from "@/components/check/checkSchedule";
  492. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  493. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees";
  494. export default {
  495. name: "detailsPage",
  496. props: {
  497. detailData: {
  498. type: Object,
  499. default: {
  500. seeDisabled: false
  501. }
  502. }
  503. },
  504. components:{
  505. ApplyPayment,
  506. billApplication,
  507. feeInfo,
  508. financialAccount,
  509. reportDialog,
  510. check,
  511. checkSchedule,
  512. },
  513. data() {
  514. return {
  515. configuration: {
  516. multipleChoices: false,
  517. multiple: false,
  518. collapseTags: false,
  519. placeholder: '请点击右边按钮选择',
  520. dicData: []
  521. },
  522. goodsConfiguration: {
  523. multipleChoices: false,
  524. multiple: false,
  525. collapseTags: false,
  526. placeholder: '请点击右边按钮选择',
  527. dicData: []
  528. },
  529. form: {},
  530. data: [],
  531. loadingCost: false,
  532. choiceData: false,
  533. commodityData: false,
  534. financialAccountDialog:false,
  535. dataCost: [],
  536. choiceIndex: '',
  537. dialogCost: false,
  538. treeDeptId: '',
  539. treeDeptIdCost: '',
  540. pageCost: {
  541. pageSize: 10,
  542. currentPage: 1,
  543. total: 0
  544. },
  545. page: {
  546. pageSize: 10,
  547. currentPage: 1,
  548. total: 0
  549. },
  550. loading: false,
  551. contactsForm: {},
  552. optionTwo: commodity,
  553. optionTwoCost: optionTwoCost,
  554. treeDataGoods: [],
  555. treeData: [],
  556. treeOptionCost: {
  557. nodeKey: 'id',
  558. lazy: true,
  559. treeLoad: function (node, resolve) {
  560. const parentId = (node.level === 0) ? 0 : node.data.id;
  561. getDeptLazyTree(parentId).then(res => {
  562. resolve(res.data.data.map(item => {
  563. return {
  564. ...item,
  565. leaf: !item.hasChildren
  566. }
  567. }))
  568. });
  569. },
  570. addBtn: false,
  571. menu: false,
  572. size: 'small',
  573. props: {
  574. labelText: '标题',
  575. label: 'title',
  576. value: 'value',
  577. children: 'children'
  578. }
  579. },
  580. treeOption: {
  581. nodeKey: 'id',
  582. lazy: true,
  583. treeLoad: function (node, resolve) {
  584. const parentId = (node.level === 0) ? 0 : node.data.id;
  585. getDeptLazyTreeS(parentId).then(res => {
  586. resolve(res.data.data.map(item => {
  587. return {
  588. ...item,
  589. leaf: !item.hasChildren
  590. }
  591. }))
  592. });
  593. },
  594. addBtn: false,
  595. menu: false,
  596. size: 'small',
  597. props: {
  598. labelText: '标题',
  599. label: 'title',
  600. value: 'value',
  601. children: 'children'
  602. }
  603. },
  604. billType:"申请", //账单类型
  605. billData:{}, //账单需要数据
  606. financeData: {}, // 账单请核需要的路由
  607. applyPaymentDialog:false,//生成账单组件
  608. applicationDialog: false,// 申请记录
  609. dialogVisible: false,
  610. advantageProjectForm: {},
  611. bankOfDepositForm: {},
  612. contactsData: [],
  613. advantageProjectData: [],
  614. saveLoading: false,
  615. disabled: false,
  616. bankOfDepositData: [],
  617. tableDataCost: [],
  618. dic: [],
  619. tableData: [],
  620. customerContact: {},
  621. advantageProject: {},
  622. bankOfDeposit: bankOfDeposit,
  623. basicData: {
  624. column: [
  625. {
  626. label: '供应商',
  627. prop: 'corpId',
  628. span: 16,
  629. rules: [
  630. {
  631. required: true,
  632. message: ' ',
  633. trigger: 'blur'
  634. }
  635. ]
  636. },{
  637. label: '付款方式',
  638. prop: 'paymentType',
  639. rules: [
  640. {
  641. required: true,
  642. message: ' ',
  643. trigger: 'blur'
  644. }
  645. ]
  646. },{
  647. label: '所属公司',
  648. prop: 'belongToCorpId',
  649. span: 16,
  650. rules: [
  651. {
  652. required: true,
  653. message: ' ',
  654. trigger: 'blur'
  655. }
  656. ]
  657. },{
  658. label: '要求到货日期',
  659. prop: 'requiredArrivalDate',
  660. type: 'datetime',
  661. rules: [
  662. {
  663. required: true,
  664. message: ' ',
  665. trigger: 'blur'
  666. }
  667. ]
  668. },{
  669. label: '银行账号',
  670. prop: 'banks',
  671. rules: [
  672. {
  673. required: true,
  674. message: ' ',
  675. trigger: 'blur'
  676. }
  677. ]
  678. }, {
  679. label: '公司户头',
  680. prop: 'banksAccountName',
  681. rules: [
  682. {
  683. required: false,
  684. message: ' ',
  685. trigger: 'blur'
  686. }
  687. ]
  688. }, {
  689. label: '包装要求',
  690. prop: 'packageRemarks',
  691. rules: [
  692. {
  693. required: false,
  694. message: ' ',
  695. trigger: 'blur'
  696. }
  697. ]
  698. },
  699. {
  700. label: '系统编号',
  701. prop: 'sysNo',
  702. disabled: true,
  703. rules: [
  704. {
  705. required: false,
  706. message: ' ',
  707. trigger: 'blur'
  708. }
  709. ]
  710. }, {
  711. label: '来源单号',
  712. prop: 'orgOrderNo',
  713. disabled: true,
  714. rules: [
  715. {
  716. required: false,
  717. message: ' ',
  718. trigger: 'blur'
  719. }
  720. ]
  721. },
  722. // {
  723. // label: '预估运费',
  724. // prop: 'predictOceanFreight',
  725. // type: 'number',
  726. // rules: [
  727. // {
  728. // required: false,
  729. // message: ' ',
  730. // trigger: 'blur'
  731. // }
  732. // ]
  733. // },
  734. {
  735. label: '应付金额',
  736. prop: 'debitAmount',
  737. type: 'number',
  738. disabled: true,
  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.orderItemsList? this.form.orderItemsList: []
  867. this.advantageProjectData = this.form.orderFeesList? this.form.orderFeesList: []
  868. this.bankOfDepositData = this.form.orderFilesList? this.form.orderFilesList: []
  869. if (!this.form.orderItemsList) {
  870. this.contactsData = []
  871. } else {
  872. this.contactsData = this.form.orderItemsList
  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.orderItemsList
  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.$set(this.form, 'debitAmount', 0)
  1401. this.contactsData.forEach(item => {
  1402. this.form.orderAmount = Number(this.form.orderAmount) + Number(item.amount)
  1403. this.form.debitAmount = Number(this.form.debitAmount) + Number(item.amount)
  1404. })
  1405. //商品信息
  1406. this.form.itemsVOList = this.contactsData
  1407. // this.form.orderFeesList = this.advantageProjectData
  1408. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  1409. this.form.orderFilesList = this.bankOfDepositData
  1410. if (typeof this.form.corpsTypeId == 'object') {
  1411. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1412. }
  1413. this.saveLoading = true
  1414. this.form.billType = 'CG'
  1415. this.$set(this.form, 'tradeType', 'GN')
  1416. // 如果有id解锁,没有跳过
  1417. // this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1418. typeSave(this.form).then(res => {
  1419. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1420. // this.$set(this.detailData, 'seeDisabled', true);
  1421. if (isBack) {
  1422. //成功关闭此页面回到列表页
  1423. this.$emit("goBack");
  1424. this.leaveDetailsKey(this.$route.name)
  1425. } else {
  1426. this.queryData(res.data.data)
  1427. }
  1428. if (type == '收货') {
  1429. let lsit = []
  1430. this.selection.forEach(item => {
  1431. lsit.push(item.id)
  1432. })
  1433. let data = {
  1434. id: this.form.id,
  1435. orderItemIds: lsit
  1436. }
  1437. generateShipment(data).then(res => {
  1438. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1439. this.$router.push({
  1440. path: "/businessManagement/receipt/index",
  1441. query: {form: JSON.stringify(res.data.data)},
  1442. });
  1443. })
  1444. }
  1445. }).catch(() => {
  1446. this.pageLoading = false
  1447. this.saveLoading = false
  1448. })
  1449. } else {
  1450. return false;
  1451. }
  1452. });
  1453. },
  1454. beforeBillData(bool,type){
  1455. this.applyPaymentList = [];
  1456. let arr = [];
  1457. this.billType = type
  1458. this.financeData = {
  1459. url:"/financialManagement/paymentRequest/index",
  1460. pageStatus:"this.$store.getters.pqStatus",
  1461. pageLabel:"付费申请",
  1462. checkType: 'ffsq'
  1463. }
  1464. this.contactsData.map(e => {
  1465. if (e.submitPay != 1) {
  1466. const form = {
  1467. belongCompany: this.form.belongCompany,
  1468. srcOrderno:this.form.orderNo,
  1469. itemType:"采购",
  1470. corpsName:this.form.corpsName,
  1471. corpId:this.form.corpId,
  1472. srcParentId: this.form.id,
  1473. currency: 'CNY',
  1474. exchangeRate: '1',
  1475. taxRate: '0',
  1476. accDate: this.form.businesDate,
  1477. srcType: 1, // 1.采购or销售主表货款申请 2. 采购or销售-费用明细申请 3.收发货-费用明细
  1478. tradeType: 'GN',
  1479. optionType: 'GN',
  1480. amount: e.amount,
  1481. goodName: e.cname,
  1482. price: e.purchaseAmount,
  1483. unit: e.unit,
  1484. quantity: e.orderQuantity,
  1485. srcFeesId: e.id,
  1486. costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  1487. }
  1488. arr.push(form)
  1489. }
  1490. })
  1491. let getFeeList = this.$refs.feeInfo.submitData().filter(item => item.feesType == 2 && item.submitPay != 1)
  1492. getFeeList.forEach(item => {
  1493. let form = {
  1494. srcOrderno:this.form.orderNo,
  1495. itemType:"采购",
  1496. corpsName:item.corpName,
  1497. corpId: item.corpId,
  1498. srcParentId: this.form.id,
  1499. currency: 'CNY',
  1500. exchangeRate: '1',
  1501. taxRate: '0',
  1502. accDate: this.form.businesDate,
  1503. srcType: 2,
  1504. tradeType: 'GN',
  1505. optionType: 'GN',
  1506. chargeMember: this.form.chargeMember,
  1507. parentId: this.form.id,
  1508. amount: item.amount,
  1509. costType: item.itemId,
  1510. srcFeesId: item.id,
  1511. quantity: item.quantity, // 数量
  1512. price: item.price,
  1513. }
  1514. arr.push(form)
  1515. })
  1516. this.applyPaymentList = [...arr]
  1517. if(bool){ //申请货款
  1518. // this.billData.srcId = -1
  1519. }
  1520. },
  1521. // 查看申请记录
  1522. openApplicationDialog(){
  1523. this.applicationDialog = true
  1524. },
  1525. //关闭申记录
  1526. choceApplication(){
  1527. this.applicationDialog = false
  1528. },
  1529. //申请货款
  1530. applyPayment(type){
  1531. this.beforeBillData(true,type);
  1532. this.financialAccountDialog = true;
  1533. },
  1534. //关闭账单
  1535. choceFun(){
  1536. this.financialAccountDialog = false
  1537. },
  1538. feeSubmit() {
  1539. this.queryData(this.form.id);
  1540. },
  1541. //返回列表
  1542. backToList() {
  1543. if (contrastObj(this.form, this.oldForm) ||
  1544. contrastList(this.contactsData, this.oldGoodsList) ||
  1545. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1546. contrastList(this.bankOfDepositData, this.oldUploadList)
  1547. ) {
  1548. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1549. confirmButtonText: "确定",
  1550. cancelButtonText: "取消",
  1551. type: "warning"
  1552. }).then(() => {
  1553. this.editCustomer(true)
  1554. }).catch(() => {
  1555. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1556. this.$emit("goBack");
  1557. this.leaveDetailsKey(this.$route.name)
  1558. })
  1559. } else {
  1560. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1561. this.$emit("goBack");
  1562. this.leaveDetailsKey(this.$route.name)
  1563. }
  1564. },
  1565. // 保存列设置
  1566. async saveColumn(name) {
  1567. if (name == 'goods') {
  1568. const inSave = await this.saveColumnData(
  1569. this.getColumnName(18),
  1570. this.customerContact
  1571. );
  1572. if (inSave) {
  1573. this.$message.success("保存成功");
  1574. //关闭窗口
  1575. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1576. this.$nextTick(() => {
  1577. this.$refs.crudContact.doLayout()
  1578. })
  1579. }
  1580. } else if (name === 'fees') {
  1581. const inSave = await this.saveColumnData(
  1582. this.getColumnName(19),
  1583. this.advantageProject
  1584. );
  1585. if (inSave) {
  1586. this.$message.success("保存成功");
  1587. //关闭窗口
  1588. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1589. }
  1590. }
  1591. },
  1592. async resetColumn() {
  1593. this.customerContact = customerContact
  1594. const inSave = await this.delColumnData(
  1595. this.getColumnName(18),
  1596. customerContact
  1597. );
  1598. if (inSave) {
  1599. this.$nextTick(() => {
  1600. this.$refs.crudContact.doLayout()
  1601. })
  1602. this.$message.success("重置成功");
  1603. //关闭窗口
  1604. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1605. }
  1606. },
  1607. returnBack(row) {
  1608. if (row.belongtocompany) {
  1609. // this.form.belongToCorpId = row.belongtocompany
  1610. }
  1611. this.$set(this.form, 'paymentType', row.paymentType)
  1612. this.$set(this.form, 'packageRemarks', row.packageRemarks)
  1613. getlistBankBy(row.id).then(res =>{
  1614. this.$set(this.form, 'banks', null)
  1615. this.$set(this.form, 'banksAccountName', null)
  1616. this.$set(this.form, 'accountBank', null)
  1617. this.bankList = res.data
  1618. if (this.bankList.length > 0) {
  1619. this.form.banks = this.bankList[0].accountNo
  1620. this.form.banksAccountName = this.bankList[0].accountName
  1621. this.form.accountBank = this.bankList[0].accountBank
  1622. }
  1623. })
  1624. },
  1625. // 银行账号变化
  1626. banksChange(val) {
  1627. let isTrue = false
  1628. this.bankList.forEach(item => {
  1629. if (val == item.accountNo) {
  1630. this.$set(this.form, 'banksAccountName', item.accountName)
  1631. this.$set(this.form, 'accountBank', item.accountBank)
  1632. isTrue = true
  1633. }
  1634. })
  1635. if (!isTrue) {
  1636. this.$set(this.form, 'banksAccountName', null)
  1637. this.$set(this.form, 'accountBank', null)
  1638. }
  1639. },
  1640. // 标签页切换
  1641. tabHandle(data) {
  1642. if (data.name == 'searchList') {
  1643. this.goodsListShow = this.data;
  1644. this.page.total = this.pageList.total
  1645. } else if (data.name == 'importStaging') {
  1646. this.goodsListShow = this.goodsListSave;
  1647. this.page.total = 0
  1648. }
  1649. },
  1650. removeStagList(row, index) {
  1651. this.goodsListSave.splice(row.$index, 1)
  1652. },
  1653. importStagList(row, index) {
  1654. this.goodsListSave.push(row);
  1655. },
  1656. beforeFinance(feesData,callback) {
  1657. this.advantageProjectData = feesData;
  1658. let params = {}
  1659. params.valid = true
  1660. params.parentId = this.form.id
  1661. params.srcOrderno = this.form.orderNo
  1662. callback(params)
  1663. },
  1664. // 报表
  1665. openReport() {
  1666. this.switchDialog =! this.switchDialog;
  1667. },
  1668. onClose(val) {
  1669. this.switchDialog = val;
  1670. },
  1671. //请核
  1672. pleaseCheck() {
  1673. // this.verification()
  1674. if (this.verification()) {
  1675. this.$confirm("您确定提交此次申请吗?", {
  1676. confirmButtonText: "确定",
  1677. cancelButtonText: "取消",
  1678. type: "warning"
  1679. }).then(() => {
  1680. const data = {
  1681. id : this.form.id,
  1682. checkType: 'cgqh',
  1683. url: '/businessManagement/purchaseOrder/index',
  1684. pageStatus:"this.$store.getters.domPurStatus",
  1685. pageLabel:"采购订单(N)",
  1686. checkFlag: 1,
  1687. }
  1688. this.pageLoading = true
  1689. pleaseCheck(data).then(res => {
  1690. this.$message.success('请核成功')
  1691. // this.pageLoading = false
  1692. this.saveActives = ''
  1693. this.queryData(this.form.id)
  1694. }).finally(() => {
  1695. this.pageLoading = false
  1696. })
  1697. })
  1698. } else {
  1699. }
  1700. },
  1701. verification() {
  1702. let getFeeList = this.$refs.feeInfo.submitData()
  1703. if (contrastObj(this.form, this.oldForm) ||
  1704. contrastList(this.contactsData, this.oldGoodsList) ||
  1705. // contrastList(getFeeList, this.oldFeesList) ||
  1706. contrastList(this.bankOfDepositData, this.oldUploadList)
  1707. ) {
  1708. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1709. confirmButtonText: "确定",
  1710. cancelButtonText: "取消",
  1711. type: "warning"
  1712. }).then(() => {
  1713. this.editCustomer(false)
  1714. }).catch(() => {
  1715. return false; //取消改动数据
  1716. })
  1717. } else {
  1718. return true; //没有动过数据
  1719. }
  1720. },
  1721. //打开审核
  1722. openCheckDialog(){
  1723. this.checkData = this.detailData.check
  1724. this.checkDialog = true;
  1725. },
  1726. //关闭审核
  1727. choceCheckFun(){
  1728. this.checkDialog = false;
  1729. },
  1730. choceScheduleFun(){
  1731. this.checkScheduleDialog = false
  1732. },
  1733. editHandle() {
  1734. const data = {
  1735. moduleName: 'cg',
  1736. tableName: 'business_order',
  1737. billId: this.form.id,
  1738. no: localStorage.getItem('browserID'),
  1739. billNo: this.form.orderNo
  1740. }
  1741. this.saveLoading = true
  1742. this.checkLock(data).then(res => {
  1743. if (res.data.code == 200) {
  1744. this.onLock(data).then(response => {
  1745. this.queryData(this.form.id)
  1746. })
  1747. this.inDetailsKey(this.$route.name, {
  1748. moduleName: 'cg',
  1749. tableName: 'business_order',
  1750. billId: this.form.id,
  1751. })
  1752. this.detailData.seeDisabled = false;
  1753. }
  1754. }).catch(error => {
  1755. }).finally(() => {
  1756. this.saveLoading = false
  1757. })
  1758. },
  1759. getGSName(row) {
  1760. this.form.belongCompany = row.cname
  1761. },
  1762. // 发送消息
  1763. postMessage() {
  1764. this.messageVisble = true
  1765. this.$nextTick(() => {
  1766. this.$refs.messagePost.init()
  1767. })
  1768. },
  1769. closeDialog() {
  1770. this.messageVisble = false
  1771. },
  1772. }
  1773. }
  1774. </script>
  1775. <style lang="scss" scoped>
  1776. .back-icon {
  1777. line-height: 64px;
  1778. font-size: 20px;
  1779. margin-right: 8px;
  1780. }
  1781. //.add-customer-btn {
  1782. // position: fixed;
  1783. // right: 36px;
  1784. // top: 115px;
  1785. //}
  1786. ::v-deep .el-form-item {
  1787. margin-bottom: 0;
  1788. }
  1789. .el-dialogDeep {
  1790. ::v-deep .el-dialog {
  1791. margin: 1vh auto 0 !important;
  1792. padding-bottom: 10px !important;
  1793. .el-dialog__body, .el-dialog__footer {
  1794. padding-bottom: 0 !important;
  1795. padding-top: 0 !important;
  1796. }
  1797. }
  1798. }
  1799. .print-div {
  1800. color: #000;
  1801. }
  1802. .print_table {
  1803. table {
  1804. border-right: 1px solid #000;
  1805. border-bottom: 1px solid #000;
  1806. font-size: 12px;
  1807. margin-bottom: 5px;
  1808. }
  1809. table td {
  1810. border-left: 1px solid #000;
  1811. border-top: 1px solid #000;
  1812. vertical-align: middle;
  1813. padding: 2px;
  1814. text-align: center;
  1815. }
  1816. }
  1817. .table {
  1818. border-collapse: collapse;
  1819. border-spacing: 0;
  1820. background-color: transparent;
  1821. display: table;
  1822. width: 99%;
  1823. max-width: 100%;
  1824. margin: 0 auto;
  1825. }
  1826. .table td {
  1827. text-align: left;
  1828. vertical-align: middle;
  1829. font-size: 14px;
  1830. color: #000000;
  1831. padding: 10.5px 0 10.5px 30px;
  1832. //border: 1px solid #000;
  1833. }
  1834. ::v-deep .el-form-item {
  1835. margin-bottom: 0;
  1836. }
  1837. ::v-deep .el-form-item__content{
  1838. line-height: 32px;
  1839. }
  1840. </style>