detail.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button
  6. type="danger"
  7. style="border: none;background: none;color: red"
  8. icon="el-icon-arrow-left"
  9. @click="backToList"
  10. :loading="btnLoading"
  11. >返回列表</el-button
  12. >
  13. </div>
  14. <div class="add-customer-btn">
  15. <el-button
  16. v-if="checker && form.status != 3"
  17. type="primary"
  18. size="small"
  19. class="el-button--small-yh"
  20. @click.stop="openCheckDialog"
  21. >
  22. 审批
  23. </el-button>
  24. <el-button
  25. v-if="form.status > 0"
  26. @click.native="(checkScheduleDialog = true), (checkId = form.id)"
  27. type="primary"
  28. size="small"
  29. class="el-button--small-yh"
  30. >审核进度</el-button
  31. >
  32. <el-button
  33. type="primary"
  34. size="small"
  35. class="el-button--small-yh"
  36. @click.stop="openEdit"
  37. v-if="form.id && disabled"
  38. >编 辑</el-button
  39. >
  40. <!-- <el-button
  41. type="primary"
  42. v-if="!checkDisabled"
  43. :disabled="!form.id || disabled"
  44. size="small"
  45. @click="pleaseCheck"
  46. :loading="btnLoading"
  47. style="margin-right: 8px"
  48. class="el-button--small-yh"
  49. >请核</el-button
  50. > -->
  51. <!-- <el-button-->
  52. <!-- type="primary"-->
  53. <!-- size="small"-->
  54. <!-- class="el-button&#45;&#45;small-yh"-->
  55. <!-- style="margin-right: 8px;"-->
  56. <!-- @click="dealerSubmit"-->
  57. <!-- :disabled="disabled"-->
  58. <!-- :loading="btnLoading"-->
  59. <!-- v-if="form.id"-->
  60. <!-- >-->
  61. <!-- {{ form.status == 0? '确认订单': form.status == 3? '撤销订单': '' }}-->
  62. <!-- </el-button>-->
  63. <!-- <el-dropdown style="margin-right: 8px;">
  64. <el-button type="warning" size="small"
  65. >账单处理<i class="el-icon-arrow-down el-icon--right"></i
  66. ></el-button>
  67. <el-dropdown-menu slot="dropdown">
  68. <el-dropdown-item
  69. @click.native="applySettlement('申请')"
  70. :disabled="disabled"
  71. >申请货款
  72. </el-dropdown-item>
  73. </el-dropdown-menu>
  74. </el-dropdown> -->
  75. <el-button
  76. type="primary"
  77. size="small"
  78. class="el-button--small-yh"
  79. @click.stop="submitPlatform"
  80. :disabled="
  81. disabled ||
  82. form.orderStatus == '提交平台审核' ||
  83. form.orderStatus == '平台审核通过'
  84. "
  85. >提交平台</el-button
  86. >
  87. <el-button
  88. type="success"
  89. :disabled="!form.id"
  90. size="small"
  91. @click="copyDoc"
  92. :loading="btnLoading"
  93. >
  94. 复制单据
  95. </el-button>
  96. <el-button
  97. type="primary"
  98. @click="editCustomer"
  99. size="small"
  100. :loading="btnLoading"
  101. :disabled="
  102. disabled ||
  103. form.orderStatus == '提交平台审核' ||
  104. form.orderStatus == '平台审核通过'
  105. "
  106. >保存数据
  107. </el-button>
  108. </div>
  109. </div>
  110. <div class="customer-main">
  111. <containerTitle title="基础信息" />
  112. <basic-container :showBtn="true">
  113. <avue-form
  114. ref="form"
  115. class="trading-form"
  116. v-model="form"
  117. :option="option"
  118. >
  119. <template slot="corpId">
  120. <crop-select
  121. v-model="form.corpId"
  122. @getCorpData="getCorpData"
  123. corpType="GYS"
  124. :disabled="disabled || confirmDisabled || checkDisabled"
  125. ></crop-select>
  126. </template>
  127. <template slot="orderStatus">
  128. <el-input v-model="form.orderStatus" disabled></el-input>
  129. </template>
  130. <template slot="storageId">
  131. <warehouse-select
  132. v-model="form.storageId"
  133. :configuration="configurationWarehouse"
  134. :disabled="disabled || confirmDisabled || checkDisabled"
  135. />
  136. </template>
  137. </avue-form>
  138. </basic-container>
  139. <containerTitle title="商品信息" />
  140. <basic-container>
  141. <avue-crud
  142. ref="crud"
  143. :data="dataList"
  144. :option="tableOption"
  145. :page.sync="goodPage"
  146. :table-loading="goodLoading"
  147. @current-change="currentChange"
  148. @size-change="sizeChange"
  149. :cell-style="cellStyle"
  150. @saveColumn="saveColumn"
  151. @resetColumn="resetColumn"
  152. >
  153. <template slot="headerSerial" slot-scope="{ column }">
  154. <el-button
  155. type="primary"
  156. icon="el-icon-circle-plus-outline"
  157. circle
  158. size="mini"
  159. :disabled="disabled || confirmDisabled || checkDisabled"
  160. @click="$refs.crud.rowCellAdd()"
  161. ></el-button>
  162. </template>
  163. <template slot="menuLeft">
  164. <el-button
  165. type="primary"
  166. icon="el-icon-plus"
  167. size="small"
  168. @click.stop="newDetails"
  169. :disabled="disabled || confirmDisabled || checkDisabled"
  170. >录入明细</el-button
  171. >
  172. <el-button
  173. type="primary"
  174. icon="el-icon-plus"
  175. size="small"
  176. @click.stop="openPopup"
  177. :disabled="disabled || confirmDisabled || checkDisabled"
  178. >政策</el-button
  179. >
  180. <el-button
  181. type="info"
  182. icon="el-icon-printer"
  183. size="small"
  184. @click.stop="openReport()"
  185. >报表打印</el-button
  186. >
  187. <el-button
  188. type="primary"
  189. size="small"
  190. icon="el-icon-download"
  191. @click="downloadHandle"
  192. >下载模板</el-button
  193. >
  194. <el-upload
  195. :action="baseURL"
  196. :headers="headers"
  197. :disabled="disabled || confirmDisabled || checkDisabled"
  198. :on-progress="uploading"
  199. :show-file-list="false"
  200. accept=".xls,.xlsx"
  201. multiple
  202. :on-success="importTemplate"
  203. :on-error="uploadError"
  204. style="float: right"
  205. >
  206. <el-button
  207. type="primary"
  208. size="small"
  209. icon="el-icon-upload"
  210. :disabled="disabled || confirmDisabled || checkDisabled"
  211. >导 入</el-button
  212. >
  213. </el-upload>
  214. </template>
  215. <template slot="menu" slot-scope="{ row, index }">
  216. <el-button
  217. size="small"
  218. icon="el-icon-edit"
  219. type="text"
  220. @click="rowCell(row, index)"
  221. :disabled="disabled || confirmDisabled || checkDisabled"
  222. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  223. >
  224. <el-button
  225. size="small"
  226. icon="el-icon-delete"
  227. type="text"
  228. @click="rowDel(row, index)"
  229. :disabled="disabled || confirmDisabled || checkDisabled"
  230. >删除</el-button
  231. >
  232. </template>
  233. <template slot="code" slot-scope="{ row, index }">
  234. <span v-if="row.$cellEdit" style="display:flex">
  235. <el-select
  236. v-model="row.code"
  237. placeholder="请选择"
  238. filterable
  239. size="small"
  240. style="width:60%"
  241. @change="codeChange(row, index)"
  242. :disabled="!form.storageId"
  243. >
  244. <el-option
  245. v-for="item in goodsoptions"
  246. :key="item.id"
  247. :label="item.code"
  248. :value="item.code"
  249. >
  250. </el-option>
  251. </el-select>
  252. <el-button
  253. icon="el-icon-search"
  254. size="small"
  255. @click="rePick(row, index)"
  256. ></el-button>
  257. </span>
  258. <span v-else> {{ row.code }}</span>
  259. </template>
  260. <template slot="cname" slot-scope="{ row, index }">
  261. <span v-if="row.$cellEdit" style="display:flex">
  262. <el-select
  263. v-model="row.itemId"
  264. placeholder="请选择"
  265. size="small"
  266. style="width:60%"
  267. filterable
  268. @change="cnameChange(row, index)"
  269. :disabled="!form.lotNo"
  270. >
  271. <el-option
  272. v-for="item in goodsoptions"
  273. :key="item.id"
  274. :label="item.cname"
  275. :value="item.id"
  276. >
  277. </el-option>
  278. </el-select>
  279. <el-button
  280. icon="el-icon-search"
  281. size="small"
  282. @click="rePick(row, index)"
  283. ></el-button>
  284. </span>
  285. <span v-else> {{ row.cname }}</span>
  286. </template>
  287. <template slot="batch" slot-scope="{ row, index }">
  288. <span>{{ row.batch == 0 ? "否" : "是" }}</span>
  289. </template>
  290. <template slot="orderQuantity" slot-scope="{ row, index }">
  291. <el-input-number
  292. v-if="row.$cellEdit"
  293. v-model="row.orderQuantity"
  294. size="small"
  295. :controls="false"
  296. :precision="0"
  297. @input="amountChange(row)"
  298. style="width: 100%"
  299. :disabled="!form.lotNo"
  300. />
  301. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  302. </template>
  303. <template slot="price" slot-scope="{ row, index }">
  304. <el-input-number
  305. v-if="row.$cellEdit"
  306. v-model="row.price"
  307. size="small"
  308. :controls="false"
  309. :precision="2"
  310. @input="amountChange(row)"
  311. style="width: 100%"
  312. :disabled="!form.lotNo"
  313. ></el-input-number>
  314. <span v-else>{{ row.price }}</span>
  315. </template>
  316. <!-- 单位-->
  317. <template slot="unit" slot-scope="{ row, index }">
  318. <el-select
  319. v-if="row.$cellEdit"
  320. v-model="row.unit"
  321. size="small"
  322. :disabled="!form.lotNo"
  323. clearable
  324. filterable
  325. >
  326. <el-option
  327. v-for="(item, index) in unitOption"
  328. :key="index"
  329. :label="item.dictValue"
  330. :value="item.dictValue"
  331. />
  332. </el-select>
  333. <span v-else>{{ row.unit }}</span>
  334. </template>
  335. <template slot="amount" slot-scope="{ row, index }">
  336. <span>{{ row.amount | decimalFormat }}</span>
  337. </template>
  338. <template slot="storageQuantity" slot-scope="{ row, index }">
  339. <span>{{ row.storageQuantity | IntegerFormat }}</span>
  340. </template>
  341. <template slot="newJob" slot-scope="{ row, index }">
  342. <span
  343. style="color: #1e9fff;cursor: pointer"
  344. @click="openHistory(row)"
  345. >{{ row.newJob }}</span
  346. >
  347. </template>
  348. <template slot="remarks" slot-scope="{ row, index }">
  349. <el-input
  350. v-if="row.$cellEdit"
  351. v-model="row.remarks"
  352. size="small"
  353. :disabled="!form.storageId"
  354. />
  355. <span v-else>{{ row.remarks }}</span>
  356. </template>
  357. </avue-crud>
  358. </basic-container>
  359. <containerTitle title="详细信息" />
  360. <basic-container :showBtn="true">
  361. <avue-form
  362. ref="form1"
  363. class="trading-form"
  364. v-model="form"
  365. :option="detailOption"
  366. ></avue-form>
  367. </basic-container>
  368. <containerTitle title="附件管理"></containerTitle>
  369. <c-upload
  370. :data="uploadData"
  371. deleteUrl="/api/blade-client/corpsbank/update"
  372. :enumerationValue="84"
  373. :disabled="disabled || confirmDisabled || checkDisabled"
  374. />
  375. </div>
  376. <el-dialog
  377. title="导入商品"
  378. append-to-body
  379. class="el-dialogDeep"
  380. :visible.sync="dialogVisible"
  381. width="80%"
  382. :close-on-click-modal="false"
  383. :destroy-on-close="true"
  384. :close-on-press-escape="false"
  385. @close="closeGoods"
  386. top="5vh"
  387. v-dialog-drag
  388. >
  389. <span>
  390. <el-row>
  391. <el-col :span="4">
  392. <div>
  393. <el-scrollbar>
  394. <basic-container>
  395. <avue-tree
  396. :option="treeOption"
  397. @node-click="nodeClick"
  398. :style="treeStyle"
  399. />
  400. </basic-container>
  401. </el-scrollbar>
  402. </div>
  403. </el-col>
  404. <el-col :span="20">
  405. <avue-crud
  406. :option="goodsOption"
  407. :table-loading="loading"
  408. :data="goodsList"
  409. ref="goodsCrud"
  410. :search.sync="search"
  411. @search-change="searchChange"
  412. @selection-change="selectionChange"
  413. @row-click="rowClick"
  414. :page.sync="page"
  415. @on-load="onLoad"
  416. @saveColumn="saveGoodsColumn"
  417. @resetColumn="resetGoodsColumn"
  418. :cell-style="cellStyle"
  419. >
  420. <template slot="menuLeft">
  421. <el-tabs v-model="activeName" @tab-click="tabHandle">
  422. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  423. <el-tab-pane
  424. label="已选定数据"
  425. name="importStaging"
  426. ></el-tab-pane>
  427. </el-tabs>
  428. </template>
  429. <template slot-scope="scope" slot="menu">
  430. <el-button
  431. type="text"
  432. icon="el-icon-edit"
  433. size="small"
  434. @click.stop="importStagList(scope.row, scope.index)"
  435. v-if="activeName == 'searchList'"
  436. :disabled="
  437. goodsListSave.findIndex(item => item.id == scope.row.id) !==
  438. -1
  439. "
  440. >选择
  441. </el-button>
  442. <el-button
  443. type="text"
  444. icon="el-icon-delete"
  445. size="small"
  446. @click.stop="removeStagList(scope.row, scope.index)"
  447. v-else
  448. >移除
  449. </el-button>
  450. </template>
  451. </avue-crud>
  452. </el-col>
  453. </el-row>
  454. </span>
  455. <span slot="footer" class="dialog-footer">
  456. <el-button @click="dialogVisible = false">取 消</el-button>
  457. <el-button
  458. type="primary"
  459. @click="importGoods"
  460. :disabled="selectionList.length == 0 && goodsListSave.length == 0"
  461. >导入</el-button
  462. >
  463. </span>
  464. </el-dialog>
  465. <el-dialog
  466. title="政策"
  467. append-to-body
  468. class="el-dialogDeep"
  469. :visible.sync="policyVisible"
  470. width="80%"
  471. :close-on-click-modal="false"
  472. :destroy-on-close="true"
  473. :close-on-press-escape="false"
  474. @close="closePolicy"
  475. top="5vh"
  476. v-dialog-drag
  477. >
  478. <span>
  479. <avue-crud
  480. :option="policyOption"
  481. :table-loading="policyLoading"
  482. :data="policyList"
  483. @on-load="onPolicyLoad"
  484. ref="policyCrud"
  485. @selection-change="policyChange"
  486. @saveColumn="savePolicyColumn"
  487. @resetColumn="resetPolicyColumn2"
  488. :cell-style="cellStyle"
  489. >
  490. </avue-crud>
  491. </span>
  492. <span slot="footer" class="dialog-footer">
  493. <el-button @click="policyVisible = false">取 消</el-button>
  494. <el-button
  495. type="primary"
  496. @click="importPolicy"
  497. :disabled="policyselectionList.length == 0"
  498. >导入</el-button
  499. >
  500. </span>
  501. </el-dialog>
  502. <!-- 账单-->
  503. <el-dialog
  504. append-to-body
  505. title="账单"
  506. class="el-dialogDeep"
  507. :visible.sync="financialAccountDialog"
  508. width="70%"
  509. :close-on-click-modal="false"
  510. :destroy-on-close="true"
  511. :close-on-press-escape="false"
  512. v-dialog-drag
  513. >
  514. <financial-account
  515. :billType="billType"
  516. :billData="{}"
  517. :arrList="applyPaymentList"
  518. :belongCompany="form.belongToCorpId"
  519. :checkData="checkFeeData"
  520. @choceFun="choceFun"
  521. @submit="feeSubmit"
  522. />
  523. </el-dialog>
  524. <!-- 历史记录-->
  525. <view-history
  526. v-if="historyVisible"
  527. ref="history"
  528. :params="historyParams"
  529. @closeDialog="closeDialog"
  530. />
  531. <el-dialog
  532. append-to-body
  533. title="审批"
  534. class="el-dialogDeep"
  535. :visible.sync="checkDialog"
  536. width="50%"
  537. :close-on-click-modal="false"
  538. :destroy-on-close="true"
  539. :close-on-press-escape="false"
  540. v-dialog-drag
  541. >
  542. <check
  543. :checkData="checkData"
  544. :checkDetail="false"
  545. :idList="[]"
  546. @choceCheckFun="choceCheckFun"
  547. >
  548. </check>
  549. </el-dialog>
  550. <el-dialog
  551. append-to-body
  552. title="审批进度"
  553. class="el-dialogDeep"
  554. :visible.sync="checkScheduleDialog"
  555. width="40%"
  556. :close-on-click-modal="false"
  557. :destroy-on-close="true"
  558. :close-on-press-escape="false"
  559. v-dialog-drag
  560. >
  561. <check-schedule
  562. :checkId="checkId"
  563. :batchNo="batchNo"
  564. @choceScheduleFun="choceScheduleFun"
  565. >
  566. </check-schedule>
  567. </el-dialog>
  568. </div>
  569. </template>
  570. <script>
  571. import tableOption from "./config/customerContact.json";
  572. import goodsOption from "./config/commodity.json";
  573. import policyOption from "./config/policy.json";
  574. import { getDeptLazyTree, getGoods } from "@/api/basicData/customerInquiry";
  575. import { selectGoodsNum } from "@/api/basicData/inventoryAccount"; // 库存查询
  576. import { getUserInfo } from "@/api/system/user"; //登录用户信息
  577. import {
  578. dataDetail,
  579. removeGoods,
  580. typeSave,
  581. dealerSubmit,
  582. historyPrice,
  583. itemDetail,
  584. itemPolicy,
  585. createOrder
  586. } from "@/api/dealer/purchaseContract";
  587. import { IntegerFormat } from "@/util/validate";
  588. import reportDialog from "@/components/report-dialog/main";
  589. import financialAccount from "../../../components/finance/financialAccount";
  590. import check from "@/components/check/check";
  591. import checkSchedule from "@/components/check/checkSchedule";
  592. import billApplication from "@/components/bill/billApplication";
  593. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  594. import { getDetail } from "@/api/basicData/inventoryAccount";
  595. import { getToken } from "@/util/auth";
  596. import { getCurrentDate } from "@/util/date";
  597. import viewHistory from "../componet/history";
  598. import { contrastObj, contrastList } from "@/util/contrastData";
  599. export default {
  600. name: "detail",
  601. props: {
  602. detailData: {
  603. type: Object
  604. }
  605. },
  606. components: {
  607. reportDialog,
  608. billApplication,
  609. financialAccount,
  610. check,
  611. checkSchedule,
  612. viewHistory
  613. },
  614. data() {
  615. return {
  616. policyVisible: false,
  617. pageLoading: false,
  618. btnLoading: false,
  619. disabled: false,
  620. confirmDisabled: false, // 确认禁用
  621. form: {},
  622. option: {
  623. menuBtn: false,
  624. labelWidth: 100,
  625. column: [
  626. {
  627. label: "供应商",
  628. prop: "corpId",
  629. rules: [
  630. {
  631. required: true,
  632. message: " ",
  633. trigger: "change"
  634. }
  635. ],
  636. span: 16,
  637. slot: true
  638. },
  639. {
  640. label: "业务时间",
  641. prop: "businesDate",
  642. span: 8,
  643. type: "date",
  644. format: "yyyy-MM-dd",
  645. valueFormat: "yyyy-MM-dd 00:00:00",
  646. rules: [
  647. {
  648. required: true,
  649. message: "",
  650. trigger: "blur"
  651. }
  652. ]
  653. },
  654. {
  655. label: "批次号",
  656. prop: "lotNo",
  657. rules: [
  658. {
  659. required: true,
  660. message: " ",
  661. trigger: "blur"
  662. }
  663. ],
  664. span: 8,
  665. slot: true
  666. },
  667. {
  668. label: "收货仓库",
  669. prop: "storageId",
  670. span: 8,
  671. rules: [
  672. {
  673. required: true,
  674. message: " ",
  675. trigger: "change"
  676. }
  677. ]
  678. },
  679. // {
  680. // label: "平台代码",
  681. // prop: "purchaseRemark",
  682. // span: 8,
  683. // rules: [
  684. // {
  685. // required: true,
  686. // message: " ",
  687. // trigger: "blur"
  688. // }
  689. // ]
  690. // },
  691. {
  692. label: "电话",
  693. prop: "corpTel",
  694. span: 8
  695. },
  696. {
  697. label: "地址",
  698. prop: "arrivalAddress",
  699. span: 8
  700. },
  701. {
  702. label: "合同状态",
  703. prop: "orderStatus",
  704. span: 8
  705. },
  706. {
  707. label: "备注",
  708. prop: "orderRemark",
  709. type: "textarea",
  710. minRows: 2,
  711. span: 24
  712. }
  713. ]
  714. },
  715. detailOption: {
  716. menuBtn: false,
  717. labelWidth: 100,
  718. column: [
  719. {
  720. label: "系统号",
  721. prop: "sysNo",
  722. span: 8,
  723. disabled: true
  724. },
  725. {
  726. label: "打印时间",
  727. prop: "printTime",
  728. span: 8,
  729. disabled: true
  730. },
  731. {
  732. label: "打印次数",
  733. prop: "printNumber",
  734. span: 8,
  735. disabled: true
  736. },
  737. {
  738. label: "客户欠款",
  739. prop: "corpDebt",
  740. span: 8,
  741. disabled: true
  742. },
  743. {
  744. label: "总数量",
  745. prop: "orderQuantity",
  746. span: 8,
  747. disabled: true
  748. },
  749. {
  750. label: "应付金额",
  751. prop: "debitAmount",
  752. span: 8,
  753. disabled: true
  754. },
  755. {
  756. label: "总金额",
  757. prop: "amount",
  758. span: 8,
  759. disabled: true
  760. },
  761. {
  762. label: "制单人",
  763. prop: "createUserName",
  764. span: 8,
  765. disabled: true
  766. }
  767. ]
  768. },
  769. // 仓库配置
  770. configurationWarehouse: {
  771. multipleChoices: false,
  772. multiple: false,
  773. collapseTags: false,
  774. placeholder: "请点击右边按钮选择",
  775. dicData: []
  776. },
  777. dataList: [],
  778. tableOption: {},
  779. dialogVisible: false,
  780. selectionList: [],
  781. treeDeptId: null,
  782. reData: null,
  783. treeOption: {
  784. nodeKey: "id",
  785. lazy: true,
  786. treeLoad: function(node, resolve) {
  787. const parentId = node.level === 0 ? 0 : node.data.id;
  788. getDeptLazyTree(parentId).then(res => {
  789. resolve(
  790. res.data.data.map(item => {
  791. return {
  792. ...item,
  793. leaf: !item.hasChildren
  794. };
  795. })
  796. );
  797. });
  798. },
  799. addBtn: false,
  800. menu: false,
  801. size: "small",
  802. props: {
  803. label: "title",
  804. value: "value",
  805. children: "children"
  806. }
  807. },
  808. page: {
  809. pageSize: 10,
  810. currentPage: 1,
  811. total: 0
  812. },
  813. search: {},
  814. goodsList: [],
  815. loading: false,
  816. goodsOption: {},
  817. policyList: [],
  818. policyLoading: false,
  819. policyOption: {},
  820. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  821. policyselectionList: [],
  822. goodsoptions: [],
  823. uploadData: [],
  824. goodData: [], // 存储所有商品信息
  825. activeName: "searchList",
  826. // 商品列表数据合计
  827. goodsListShow: [],
  828. // 商品列表暂存
  829. goodsListSave: [],
  830. pageList: {
  831. pageSize: 10,
  832. currentPage: 1,
  833. total: 0
  834. },
  835. applyPaymentList: [],
  836. billType: "收费", //账单类型
  837. billData: {}, //账单需要数据
  838. checkFeeData: {
  839. url: "/financialManagement/paymentRequest/index",
  840. pageStatus: "this.$store.getters.pqStatus",
  841. pageLabel: "付费申请",
  842. checkType: "ffsq"
  843. },
  844. applySettlementDialog: false, //生成账单组件
  845. financialAccountDialog: false,
  846. feesOption: [],
  847. unitOption: [],
  848. baseURL: "/api/blade-purchase-sales/orderitems/importDealerOrder",
  849. headers: { "Blade-Auth": "Bearer " + getToken() },
  850. historyVisible: false,
  851. historyParams: {},
  852. goodPage: {
  853. pageSize: 10,
  854. currentPage: 1,
  855. total: 0
  856. },
  857. goodLoading: false,
  858. oldForm: {},
  859. oldDataList: [],
  860. oldUploadData: [],
  861. checkDisabled: false, // 审核状态
  862. checker: false,
  863. checkId: "",
  864. batchNo: "",
  865. checkDialog: false,
  866. checkScheduleDialog: false,
  867. checkData: {}
  868. };
  869. },
  870. async created() {
  871. this.tableOption = await this.getColumnData(
  872. this.getColumnName(82),
  873. tableOption
  874. );
  875. this.goodsOption = await this.getColumnData(
  876. this.getColumnName(83),
  877. goodsOption
  878. );
  879. this.policyOption = await this.getColumnData(
  880. this.getColumnName(141),
  881. policyOption
  882. );
  883. this.getWorkDicts("unit").then(res => {
  884. this.unitOption = res.data.data;
  885. });
  886. getGoods(1, 10).then(res => {
  887. if (res.data.data.total > 0) {
  888. this.goodsoptions = res.data.data.records;
  889. if (Math.ceil(res.data.data.total / 10) > 1) {
  890. for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
  891. getGoods(i, 10).then(e => {
  892. this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
  893. });
  894. }
  895. }
  896. }
  897. });
  898. getUserInfo().then(res => {
  899. this.$set(this.form, "createUserName", res.data.data.realName);
  900. this.$set(this.form, "createUser", res.data.data.id);
  901. });
  902. feeList().then(res => {
  903. this.feesOption = res.data.data.records;
  904. });
  905. this.$set(this.form, "businesDate", getCurrentDate());
  906. this.$set(this.form, "status", 0);
  907. if (this.detailData.query) {
  908. this.disabled = true;
  909. this.option.column.map(e => {
  910. this.$set(e, "disabled", true);
  911. });
  912. this.queryData(this.detailData.id);
  913. } else {
  914. this.dataList = [
  915. {
  916. code: null,
  917. cname: null,
  918. typeno: null,
  919. brandItem: null,
  920. specsOne: null,
  921. specsTwo: null,
  922. unit: null,
  923. storageQuantity: 0,
  924. orderQuantity: 0,
  925. size: null,
  926. price: 0,
  927. amount: 0,
  928. $cellEdit: true
  929. }
  930. ];
  931. }
  932. },
  933. filters: {
  934. IntegerFormat(num) {
  935. return IntegerFormat(num);
  936. },
  937. decimalFormat(num) {
  938. return num ? Number(num).toFixed(2) : "0.00";
  939. }
  940. },
  941. methods: {
  942. // 查询
  943. queryData(id) {
  944. this.pageLoading = true;
  945. dataDetail(id)
  946. .then(res => {
  947. this.form = res.data.data;
  948. this.getItemDetail();
  949. this.form.amount = Number(this.form.amount).toFixed(2);
  950. this.confirmDisabled = this.form.status == 3 ? true : false;
  951. this.checkDisabled = this.form.status == 3 ? true : false;
  952. if (this.confirmDisabled) {
  953. // this.option.column.map(e => {
  954. // this.$set(e, 'disabled', true)
  955. // })
  956. }
  957. this.goodData = this.form.orderItemsList
  958. ? this.form.orderItemsList
  959. : [];
  960. this.uploadData = this.form.orderFilesList
  961. ? this.form.orderFilesList
  962. : [];
  963. delete this.form.orderItemsList;
  964. delete this.form.orderFilesList;
  965. this.oldForm = { ...this.form };
  966. // this.oldDataList = [...this.dataList];
  967. this.oldUploadData = [...this.uploadData];
  968. })
  969. .finally(() => {
  970. this.pageLoading = false;
  971. });
  972. },
  973. cellStyle() {
  974. return "padding:0;height:40px;";
  975. },
  976. openEdit() {
  977. this.disabled = false;
  978. this.option.column.map(e => {
  979. if (this.confirmDisabled || this.checkDisabled) {
  980. if (e.prop == "businesDate" || e.prop == "lotNo") {
  981. this.$set(e, "disabled", true);
  982. } else {
  983. this.$set(e, "disabled", false);
  984. }
  985. } else {
  986. this.$set(e, "disabled", false);
  987. }
  988. });
  989. },
  990. copyDoc() {
  991. this.$emit("copyOrder", this.form.id);
  992. },
  993. getCorpData(row) {},
  994. //修改提交触发
  995. editCustomer(status) {
  996. this.$refs["form"].validate((valid, done) => {
  997. done();
  998. if (valid) {
  999. // 总金额计算
  1000. let amount = 0;
  1001. this.dataList.forEach(item => {
  1002. amount = Number(amount) + Number(item.amount);
  1003. });
  1004. this.$set(this.form, "debitAmount", amount.toFixed(2));
  1005. this.$set(this.form, "amount", amount.toFixed(2));
  1006. this.form.billType = "CGHT";
  1007. this.$set(this.form, "itemsVOList", this.dataList);
  1008. this.$set(this.form, "orderFilesList", this.uploadData);
  1009. this.btnLoading = true;
  1010. typeSave(this.form)
  1011. .then(res => {
  1012. this.$message({
  1013. type: "success",
  1014. message: this.form.id ? "修改成功!" : "新增成功!"
  1015. });
  1016. this.queryData(res.data.data);
  1017. })
  1018. .finally(() => {
  1019. this.btnLoading = false;
  1020. });
  1021. }
  1022. });
  1023. },
  1024. submitPlatform() {
  1025. if (!this.form.id) {
  1026. return this.$message.error("请保存数据");
  1027. }
  1028. if (this.form.generate == 1) {
  1029. return this.$message.error("提交平台已生成");
  1030. }
  1031. if (this.dataList.length == 0) {
  1032. return this.$message.error("商品信息为空");
  1033. }
  1034. this.btnLoading = true;
  1035. createOrder({ id: this.form.id })
  1036. .then(res => {
  1037. this.$message({
  1038. type: "success",
  1039. message: "提交成功!"
  1040. });
  1041. this.queryData(this.form.id);
  1042. })
  1043. .finally(() => {
  1044. this.btnLoading = false;
  1045. });
  1046. },
  1047. //返回列表
  1048. backToList() {
  1049. this.$emit("goBack");
  1050. },
  1051. async saveColumn() {
  1052. const inSave = await this.saveColumnData(
  1053. this.getColumnName(82),
  1054. this.tableOption
  1055. );
  1056. if (inSave) {
  1057. this.$message.success("保存成功");
  1058. //关闭窗口
  1059. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1060. this.$nextTick(() => {
  1061. this.$refs.crud.doLayout();
  1062. });
  1063. }
  1064. },
  1065. async resetColumn() {
  1066. this.tableOption = tableOption;
  1067. const inSave = await this.delColumnData(
  1068. this.getColumnName(82),
  1069. tableOption
  1070. );
  1071. if (inSave) {
  1072. this.$nextTick(() => {
  1073. this.$refs.crud.doLayout();
  1074. });
  1075. this.$message.success("重置成功");
  1076. //关闭窗口
  1077. setTimeout(() => {
  1078. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1079. }, 1000);
  1080. }
  1081. },
  1082. //商品明细导入
  1083. newDetails() {
  1084. this.$refs["form"].validate(valid => {
  1085. if (valid) {
  1086. this.dialogVisible = !this.dialogVisible;
  1087. }
  1088. });
  1089. // if (!this.form.corpId) {
  1090. // return this.$message.error("请选择客户名称");
  1091. // }
  1092. },
  1093. openPopup() {
  1094. this.policyVisible = true;
  1095. },
  1096. importGoods() {
  1097. let form = {};
  1098. if (this.reData) {
  1099. if (this.selectionList.length != 1) {
  1100. return this.$message.error("重新选择的时候只能选择一条数据");
  1101. } else {
  1102. this.selectionList.forEach(e => {
  1103. this.dataList.forEach(async (item, index) => {
  1104. if (index == this.reData.index) {
  1105. let historyData = await this.getHistoryData(e, 1); // 获得最新数据
  1106. if (historyData.length > 0) {
  1107. e.newJob = historyData[0].price;
  1108. e.newDate = historyData[0].businesDate;
  1109. } else {
  1110. e.newJob = null;
  1111. e.newDate = null;
  1112. }
  1113. form = await this.getStockInfo({
  1114. tradeType: "JXS",
  1115. goodsId: e.id,
  1116. storageId: this.form.storageId,
  1117. lotNo: e.batch == 1 ? this.form.lotNo : null
  1118. });
  1119. item.storageQuantity = form.stock;
  1120. item.purchaseAmount = form.purchaseAmount;
  1121. item.itemId = e.id;
  1122. item.code = e.code;
  1123. item.cname = e.cname;
  1124. item.corpId = e.corpId;
  1125. item.corpName = e.corpName;
  1126. item.brandItem = e.brandItem;
  1127. item.specsOne = e.specsOne;
  1128. item.specsTwo = e.specsTwo;
  1129. item.typeno = e.typeno;
  1130. item.unit = e.unit;
  1131. item.size = e.size;
  1132. item.lotNo = e.batch == 1 ? this.form.lotNo : null;
  1133. item.priceCategory = e.goodsTypeName;
  1134. item.newJob = e.newJob;
  1135. item.newDate = e.newDate;
  1136. item.$cellEdit = true;
  1137. }
  1138. });
  1139. });
  1140. }
  1141. } else {
  1142. if (this.goodsListSave.length > 0) {
  1143. // 暂存的有数据
  1144. this.goodsListSave.forEach(async e => {
  1145. let historyData = await this.getHistoryData(e, 1); // 获得最新数据
  1146. if (historyData.length > 0) {
  1147. e.newJob = historyData[0].price;
  1148. e.newDate = historyData[0].businesDate;
  1149. } else {
  1150. e.newJob = null;
  1151. e.newDate = null;
  1152. }
  1153. form = await this.getStockInfo({
  1154. tradeType: "JXS",
  1155. goodsId: e.id,
  1156. storageId: this.form.storageId,
  1157. lotNo: e.batch == 1 ? this.form.lotNo : null
  1158. });
  1159. e.storageQuantity = form.stock;
  1160. e.purchaseAmount = form.purchaseAmount;
  1161. this.dataList.push({
  1162. itemId: e.id,
  1163. code: e.code,
  1164. cname: e.cname,
  1165. brandItem: e.brandItem,
  1166. specsOne: e.specsOne,
  1167. specsTwo: e.specsTwo,
  1168. typeno: e.typeno,
  1169. corpId: e.corpId,
  1170. corpName: e.corpName,
  1171. unit: e.unit,
  1172. size: e.size,
  1173. price: 0,
  1174. amount: 0,
  1175. orderQuantity: 0,
  1176. storageQuantity: e.storageQuantity,
  1177. purchaseAmount: e.purchaseAmount,
  1178. newJob: e.newJob,
  1179. newDate: e.newDate,
  1180. lotNo: e.batch == 1 ? this.form.lotNo : null,
  1181. $cellEdit: true
  1182. });
  1183. });
  1184. } else {
  1185. this.selectionList.forEach(async e => {
  1186. let historyData = await this.getHistoryData(e, 1); // 获得最新数据
  1187. if (historyData.length > 0) {
  1188. e.newJob = historyData[0].price;
  1189. e.newDate = historyData[0].businesDate;
  1190. } else {
  1191. e.newJob = null;
  1192. e.newDate = null;
  1193. }
  1194. form = await this.getStockInfo({
  1195. tradeType: "JXS",
  1196. goodsId: e.id,
  1197. storageId: this.form.storageId,
  1198. lotNo: e.batch == 1 ? this.form.lotNo : null
  1199. });
  1200. e.storageQuantity = form.stock;
  1201. e.purchaseAmount = form.purchaseAmount;
  1202. this.dataList.push({
  1203. itemId: e.id,
  1204. code: e.code,
  1205. cname: e.cname,
  1206. brandItem: e.brandItem,
  1207. specsOne: e.specsOne,
  1208. specsTwo: e.specsTwo,
  1209. typeno: e.typeno,
  1210. corpId: e.corpId,
  1211. corpName: e.corpName,
  1212. unit: e.unit,
  1213. size: e.size,
  1214. price: 0,
  1215. amount: 0,
  1216. orderQuantity: 0,
  1217. storageQuantity: e.storageQuantity,
  1218. purchaseAmount: e.purchaseAmount,
  1219. newJob: e.newJob,
  1220. newDate: e.newDate,
  1221. lotNo: e.batch == 1 ? this.form.lotNo : null,
  1222. $cellEdit: true
  1223. });
  1224. });
  1225. }
  1226. }
  1227. this.dialogVisible = false;
  1228. },
  1229. importPolicy() {
  1230. this.policyselectionList.forEach(item => {
  1231. item.$cellEdit = true;
  1232. this.dataList.push(item);
  1233. });
  1234. this.policyVisible = false;
  1235. },
  1236. closeGoods() {
  1237. this.selectionList = [];
  1238. this.treeDeptId = "";
  1239. this.reData = null;
  1240. this.activeName = "searchList";
  1241. this.goodsListSave = [];
  1242. },
  1243. nodeClick(data) {
  1244. this.treeDeptId = data.id;
  1245. this.page.currentPage = 1;
  1246. this.onLoad(this.page);
  1247. },
  1248. //费用查询
  1249. onLoad(page, params = {}) {
  1250. let obj = this.deepClone(Object.assign(params, this.search));
  1251. this.loading = true;
  1252. getGoods(page.currentPage, page.pageSize, this.treeDeptId, obj)
  1253. .then(res => {
  1254. const data = res.data.data;
  1255. this.page.total = data.total;
  1256. this.goodsList = data.records;
  1257. if (this.page.total) {
  1258. this.goodsOption.height = window.innerHeight - 350;
  1259. }
  1260. })
  1261. .finally(() => {
  1262. this.loading = false;
  1263. });
  1264. },
  1265. onPolicyLoad(page, params = {}) {
  1266. let obj = this.deepClone(Object.assign(params));
  1267. this.policyLoading = true;
  1268. itemPolicy(page.currentPage, page.pageSize, obj)
  1269. .then(res => {
  1270. this.policyList = res.data.data;
  1271. })
  1272. .finally(() => {
  1273. this.policyLoading = false;
  1274. });
  1275. },
  1276. searchChange(params, done) {
  1277. this.search = this.deepClone(params);
  1278. this.onLoad(this.page, params);
  1279. done();
  1280. },
  1281. selectionChange(list) {
  1282. this.selectionList = list;
  1283. },
  1284. policyChange(list) {
  1285. this.policyselectionList = list;
  1286. },
  1287. rowClick(row) {
  1288. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  1289. },
  1290. async saveGoodsColumn() {
  1291. const inSave = await this.saveColumnData(
  1292. this.getColumnName(83),
  1293. this.goodsOption
  1294. );
  1295. if (inSave) {
  1296. this.$message.success("保存成功");
  1297. //关闭窗口
  1298. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1299. this.$nextTick(() => {
  1300. this.$refs.goodsCrud.doLayout();
  1301. });
  1302. }
  1303. },
  1304. async resetGoodsColumn() {
  1305. this.goodsOption = goodsOption;
  1306. const inSave = await this.delColumnData(
  1307. this.getColumnName(83),
  1308. goodsOption
  1309. );
  1310. if (inSave) {
  1311. this.$nextTick(() => {
  1312. this.$refs.goodsCrud.doLayout();
  1313. });
  1314. this.$message.success("重置成功");
  1315. //关闭窗口
  1316. setTimeout(() => {
  1317. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1318. }, 1000);
  1319. }
  1320. },
  1321. openReport() {},
  1322. rowCell(row, index) {
  1323. if (row.$cellEdit == true) {
  1324. this.$set(row, "$cellEdit", false);
  1325. } else {
  1326. this.$set(row, "$cellEdit", true);
  1327. }
  1328. },
  1329. rowDel(row, index) {
  1330. this.$confirm("确定删除数据?", {
  1331. confirmButtonText: "确定",
  1332. cancelButtonText: "取消",
  1333. type: "warning"
  1334. }).then(() => {
  1335. if (row.id) {
  1336. removeGoods(row.id).then(res => {
  1337. this.$message({
  1338. type: "success",
  1339. message: "删除成功!"
  1340. });
  1341. this.dataList.splice(row.$index, 1);
  1342. });
  1343. } else {
  1344. this.$message({
  1345. type: "success",
  1346. message: "删除成功!"
  1347. });
  1348. this.dataList.splice(row.$index, 1);
  1349. }
  1350. });
  1351. },
  1352. codeChange(row) {
  1353. let form = {};
  1354. this.goodsoptions.forEach(async e => {
  1355. if (e.code == row.code) {
  1356. let historyData = await this.getHistoryData(e, 1); // 获得最新数据
  1357. if (historyData.length > 0) {
  1358. e.newJob = historyData[0].price;
  1359. e.newDate = historyData[0].businesDate;
  1360. } else {
  1361. e.newJob = null;
  1362. e.newDate = null;
  1363. }
  1364. form = await this.getStockInfo({
  1365. tradeType: "JXS",
  1366. goodsId: e.id,
  1367. storageId: this.form.storageId,
  1368. lotNo: e.batch == 1 ? this.form.lotNo : null
  1369. });
  1370. e.storageQuantity = form.stock;
  1371. e.purchaseAmount = form.purchaseAmount;
  1372. row.itemId = e.id;
  1373. row.cname = e.cname;
  1374. row.code = e.code;
  1375. row.corpId = e.corpId;
  1376. row.corpName = e.corpName;
  1377. row.brandItem = e.brandItem;
  1378. row.specsOne = e.specsOne;
  1379. row.specsTwo = e.specsTwo;
  1380. row.typeno = e.typeno;
  1381. row.unit = e.unit;
  1382. row.size = e.size;
  1383. row.priceCategory = e.goodsTypeName;
  1384. row.storageQuantity = e.storageQuantity;
  1385. row.purchaseAmount = e.purchaseAmount;
  1386. row.lotNo = e.batch == 1 ? this.form.lotNo : null;
  1387. row.newJob = e.newJob;
  1388. row.newDate = e.newDate;
  1389. // row.amount = 0;
  1390. }
  1391. });
  1392. },
  1393. cnameChange(row) {
  1394. let form = {};
  1395. this.goodsoptions.forEach(async e => {
  1396. if (e.id == row.itemId) {
  1397. let historyData = await this.getHistoryData(e, 1); // 获得最新数据
  1398. if (historyData.length > 0) {
  1399. e.newJob = historyData[0].price;
  1400. e.newDate = historyData[0].businesDate;
  1401. } else {
  1402. e.newJob = null;
  1403. e.newDate = null;
  1404. }
  1405. form = await this.getStockInfo({
  1406. tradeType: "JXS",
  1407. goodsId: e.id,
  1408. storageId: this.form.storageId,
  1409. lotNo: e.batch == 1 ? this.form.lotNo : null
  1410. });
  1411. e.storageQuantity = form.stock;
  1412. e.purchaseAmount = form.purchaseAmount;
  1413. row.cname = e.cname;
  1414. row.code = e.code;
  1415. row.corpId = e.corpId;
  1416. row.corpName = e.corpName;
  1417. row.brandItem = e.brandItem;
  1418. row.specsOne = e.specsOne;
  1419. row.specsTwo = e.specsTwo;
  1420. row.typeno = e.typeno;
  1421. row.unit = e.unit;
  1422. row.size = e.size;
  1423. row.priceCategory = e.goodsTypeName;
  1424. row.storageQuantity = e.storageQuantity;
  1425. row.purchaseAmount = e.purchaseAmount;
  1426. row.lotNo = e.batch == 1 ? this.form.lotNo : null;
  1427. row.newJob = e.newJob;
  1428. row.newDate = e.newDate;
  1429. // row.amount = 0;
  1430. }
  1431. });
  1432. },
  1433. rePick(row, index) {
  1434. this.reData = {
  1435. ...row,
  1436. index: index
  1437. };
  1438. this.newDetails();
  1439. },
  1440. // 商品信息价格计算
  1441. amountChange(row) {
  1442. if (!row.orderQuantity) {
  1443. row.orderQuantity = 0;
  1444. }
  1445. if (!row.price) {
  1446. row.price = 0;
  1447. }
  1448. row.amount = Number(row.price) * Number(row.orderQuantity);
  1449. },
  1450. // 标签页切换
  1451. tabHandle(data) {
  1452. if (data.name == "searchList") {
  1453. this.goodsListShow = this.goodsList;
  1454. this.page.total = this.pageList.total;
  1455. } else if (data.name == "importStaging") {
  1456. this.goodsListShow = this.goodsListSave;
  1457. this.page.total = 0;
  1458. }
  1459. },
  1460. removeStagList(row, index) {
  1461. this.goodsListSave.splice(row.$index, 1);
  1462. },
  1463. importStagList(row, index) {
  1464. this.goodsListSave.push(row);
  1465. },
  1466. // 生成结算
  1467. applySettlement(type) {
  1468. this.beforeBillData(true, type);
  1469. this.financialAccountDialog = true;
  1470. },
  1471. //生成账单 拿到主表信息
  1472. beforeBillData(bool, type) {
  1473. this.billType = type;
  1474. this.applyPaymentList = [];
  1475. this.goodData.map(e => {
  1476. if (e.submitPay != 1) {
  1477. const form = {
  1478. srcOrderno: this.form.orderNo,
  1479. srcParentId: this.form.id,
  1480. itemType: "采购",
  1481. corpsName: this.form.corpsName,
  1482. corpId: this.form.corpId,
  1483. currency: "CNY",
  1484. exchangeRate: "1",
  1485. taxRate: "0",
  1486. accDate: this.form.businesDate,
  1487. srcType: 1,
  1488. // chargeMember: this.form.chargeMember,
  1489. parentId: this.form.id,
  1490. tradeType: "JXS",
  1491. optionType: "JXS",
  1492. amount: e.amount,
  1493. costType: this.feesOption.find(item => item.cname == "货款")
  1494. ? this.feesOption.find(item => item.cname == "货款").id
  1495. : null,
  1496. srcFeesId: e.id,
  1497. goodName: e.cname,
  1498. price: e.price,
  1499. quantity: e.orderQuantity,
  1500. unit: e.unit
  1501. };
  1502. this.applyPaymentList.push(form);
  1503. }
  1504. });
  1505. },
  1506. //关闭账单
  1507. choceFun() {
  1508. this.financialAccountDialog = false;
  1509. },
  1510. feeSubmit() {
  1511. this.queryData(this.form.id);
  1512. },
  1513. // 获得库存信息
  1514. async getStockInfo(data) {
  1515. //tradeType JXS
  1516. //goodsId
  1517. //storageId
  1518. //lotNo 批次号
  1519. let form = {};
  1520. await getDetail(data).then(res => {
  1521. const a = res.data.data
  1522. ? res.data.data
  1523. : {
  1524. stock: 0,
  1525. balanceAmount: 0,
  1526. balanceQuantity: 0
  1527. };
  1528. this.$set(
  1529. form,
  1530. "purchaseAmount",
  1531. a.balanceQuantity == 0
  1532. ? 0
  1533. : (Number(a.balanceAmount) / Number(a.balanceQuantity)).toFixed(2)
  1534. );
  1535. this.$set(form, "stock", a.balanceQuantity);
  1536. });
  1537. return form;
  1538. },
  1539. // 确认或者取消订单
  1540. dealerSubmit() {
  1541. if (this.verification()) {
  1542. let dealer;
  1543. if (this.form.status == 0) {
  1544. dealer = 1;
  1545. } else if (this.form.status == 3) {
  1546. dealer = 2;
  1547. }
  1548. this.btnLoading = true;
  1549. dealerSubmit({
  1550. id: this.form.id,
  1551. dealer
  1552. })
  1553. .then(res => {
  1554. if (res.data.code == 200) {
  1555. this.$message.success("操作成功");
  1556. this.queryData(this.form.id);
  1557. } else {
  1558. this.$message.error(res.data.msg);
  1559. }
  1560. })
  1561. .finally(() => {
  1562. this.btnLoading = false;
  1563. });
  1564. }
  1565. },
  1566. // 下载模板
  1567. downloadHandle() {
  1568. this.$confirm("是否下载模板文件?", "提示", {
  1569. confirmButtonText: "确定",
  1570. cancelButtonText: "取消",
  1571. type: "warning"
  1572. })
  1573. .then(() => {
  1574. window.open(
  1575. `/api/blade-purchase-sales/orderitems/exportDealerOrder?${
  1576. this.website.tokenHeader
  1577. }=${getToken()}`
  1578. );
  1579. })
  1580. .catch(() => {
  1581. this.$message({
  1582. type: "info",
  1583. message: "已取消"
  1584. });
  1585. });
  1586. },
  1587. //文件上传时
  1588. uploading(event, file, fileList) {
  1589. this.openFullScreen(false, "文件正在解析中");
  1590. },
  1591. importTemplate(res, file) {
  1592. this.openFullScreen(true);
  1593. res.data.forEach(item => {});
  1594. this.dataList = this.dataList.concat(res.data);
  1595. this.$message.success("导入成功");
  1596. },
  1597. uploadError(err, file, fileList) {
  1598. this.openFullScreen(true);
  1599. this.$message.error(JSON.parse(err.message).msg);
  1600. },
  1601. //遮罩层
  1602. openFullScreen(res, text) {
  1603. const loading = this.$loading({
  1604. lock: true,
  1605. text: text,
  1606. spinner: "el-icon-loading",
  1607. background: "rgba(0, 0, 0, 0.7)"
  1608. });
  1609. if (res === true) loading.close();
  1610. },
  1611. // 获得历史数据
  1612. async getHistoryData(row, typeId = null) {
  1613. let data;
  1614. const params = {
  1615. typeId,
  1616. tradeType: "JXS",
  1617. billType: "CG",
  1618. itemId: row.id
  1619. };
  1620. await historyPrice(params).then(res => {
  1621. data = res.data.data ? res.data.data : [];
  1622. });
  1623. return data;
  1624. },
  1625. openHistory(row) {
  1626. this.historyParams = {
  1627. tradeType: "JXS",
  1628. billType: "CG",
  1629. itemId: row.itemId
  1630. };
  1631. this.historyVisible = true;
  1632. this.$nextTick(() => {
  1633. this.$refs.history.init();
  1634. });
  1635. },
  1636. closeDialog() {
  1637. this.historyVisible = false;
  1638. },
  1639. // 商品明细分页处理
  1640. currentChange(val) {
  1641. this.goodPage.currentPage = val;
  1642. this.getItemDetail();
  1643. },
  1644. sizeChange(val) {
  1645. this.goodPage.currentPage = 1;
  1646. this.goodPage.pageSize = val;
  1647. this.getItemDetail();
  1648. },
  1649. getItemDetail() {
  1650. const data = {
  1651. pid: this.form.id
  1652. };
  1653. this.goodLoading = true;
  1654. itemDetail(this.goodPage.currentPage, this.goodPage.pageSize, data)
  1655. .then(res => {
  1656. this.dataList = res.data.data.records;
  1657. this.goodPage.total = res.data.data.total;
  1658. this.oldDataList = [...this.dataList];
  1659. })
  1660. .finally(() => {
  1661. this.goodLoading = false;
  1662. });
  1663. },
  1664. // 验证新旧值对比
  1665. verification() {
  1666. if (
  1667. contrastObj(this.form, this.oldForm) ||
  1668. contrastList(this.dataList, this.oldDataList) ||
  1669. contrastList(this.uploadData, this.oldUploadData)
  1670. ) {
  1671. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1672. confirmButtonText: "确定",
  1673. cancelButtonText: "取消",
  1674. type: "warning"
  1675. })
  1676. .then(() => {
  1677. this.editCustomer();
  1678. })
  1679. .catch(() => {
  1680. return false; //取消改动数据
  1681. });
  1682. } else {
  1683. return true;
  1684. }
  1685. },
  1686. // 请核
  1687. pleaseCheck() {
  1688. if (this.verification()) {
  1689. // const data = {
  1690. // id : this.form.id,
  1691. // checkType: 'xsqh',
  1692. // url: '/dealer/sales/index',
  1693. // pageStatus:"this.$store.getters.dealerSaleStatus",
  1694. // pageLabel:"销售订单(D)",
  1695. // checkFlag: 2,
  1696. // }
  1697. // this.btnLoading = true;
  1698. // pleaseCheck(data).then(res => {
  1699. // this.$message.success('请核成功')
  1700. // this.queryData(this.form.id)
  1701. // }).catch(() => {
  1702. // this.$message.error('请核失败')
  1703. // }).finally(() => {
  1704. // this.btnLoading = false;
  1705. // })
  1706. }
  1707. },
  1708. //打开审核
  1709. openCheckDialog() {
  1710. this.checkData = this.detailData.check;
  1711. this.checkDialog = true;
  1712. },
  1713. //关闭审核
  1714. choceCheckFun() {
  1715. this.checkDialog = false;
  1716. },
  1717. choceScheduleFun() {
  1718. this.checkScheduleDialog = false;
  1719. }
  1720. }
  1721. };
  1722. </script>
  1723. <style lang="scss" scoped>
  1724. .trading-form ::v-deep .el-form-item {
  1725. margin-bottom: 8px !important;
  1726. }
  1727. ::v-deep .el-form-item__error {
  1728. display: none !important;
  1729. }
  1730. ::v-deep .select-component {
  1731. display: flex !important;
  1732. }
  1733. </style>