deposit-apply-surrender.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <div>
  3. <div class="sty">
  4. <el-page-header content="申请退押" @back="goBack" />
  5. </div>
  6. <el-divider />
  7. <h3>工程项目信息</h3>
  8. <el-divider />
  9. <div class="diy-table-1">
  10. <el-form ref="form" :model="details">
  11. <el-row :gutter="0">
  12. <el-col :xs="12" :sm="8" :lg="8" class="item">
  13. <div class="label">工程登录编号</div>
  14. <div class="value">{{ details.refEnginRecordNo }}</div>
  15. </el-col>
  16. <el-col :xs="12" :sm="8" :lg="8" class="item">
  17. <div class="label">项目类别</div>
  18. <div class="value">{{ details.refProjectCategory }}</div>
  19. </el-col>
  20. <el-col :xs="12" :sm="8" :lg="8" class="item">
  21. <div class="label">行业类别</div>
  22. <div class="value">{{ details.refTradeCategory }}</div>
  23. </el-col>
  24. <el-col :xs="12" :sm="8" :lg="8" class="item">
  25. <div class="label">区域</div>
  26. <div class="value">{{ details.refRegionWork }}</div>
  27. </el-col>
  28. <el-col :xs="12" :sm="8" :lg="8" class="item">
  29. <div class="label">工程编号</div>
  30. <div class="value">{{ details.refProjectNo }}</div>
  31. </el-col>
  32. <el-col :xs="24" :sm="24" :lg="8" class="item">
  33. <div class="label">经销商名称</div>
  34. <div class="value">{{ details.customerName }}</div>
  35. </el-col>
  36. <el-col :xs="24" :sm="24" :lg="8" class="item">
  37. <div class="label">经销商编码</div>
  38. <div class="value">{{ details.customerNumber }}</div>
  39. </el-col>
  40. <el-col :xs="24" :sm="24" :lg="8" class="item">
  41. <div class="label">工程登录类型</div>
  42. <div class="value">{{ details.refPromiseStatus }}</div>
  43. </el-col>
  44. <el-col :xs="24" :sm="24" :lg="8" class="item">
  45. <div class="label">联系人</div>
  46. <div class="value">{{ details.refLinkman }}</div>
  47. </el-col>
  48. <el-col :xs="24" :sm="24" :lg="8" class="item">
  49. <div class="label">固定电话</div>
  50. <div class="value">{{ details.refTel }}</div>
  51. </el-col>
  52. <el-col :xs="24" :sm="24" :lg="16" class="item">
  53. <div class="label">跨区厂编号</div>
  54. <div class="value">
  55. <!-- {{ details.refFactoryNo }}-->
  56. <el-form-item prop="refFactoryNo">
  57. <el-input
  58. v-model="details.refFactoryNo"
  59. placeholder="跨区厂编号"
  60. size="small"
  61. />
  62. </el-form-item>
  63. </div>
  64. </el-col>
  65. <el-col :xs="24" :sm="24" :lg="16" class="item">
  66. <div class="label">移动电话</div>
  67. <div class="value">{{ details.refPhone }}</div>
  68. </el-col>
  69. <el-col :xs="24" :sm="24" :lg="8" class="item">
  70. <div class="label">押金总额</div>
  71. <div class="value">{{ details.depositAmount }}</div>
  72. </el-col>
  73. <el-col :xs="24" :sm="24" :lg="24" class="item">
  74. <div class="label">工程差价总额</div>
  75. <div class="value">{{ details.depositDiffAmount }}</div>
  76. </el-col>
  77. <el-col :xs="24" :sm="24" :lg="24" class="item" v-if="!isCustomer">
  78. <div class="label">格力备注</div>
  79. <div class="value">
  80. <el-input v-model=" details.geLiInerNote" placeholder="格力备注" ></el-input>
  81. </div>
  82. </el-col>
  83. <el-col :xs="24" :sm="24" :lg="24" class="item">
  84. <div class="label">使用单位</div>
  85. <div class="value">{{ details.refUseUnit }}</div>
  86. </el-col>
  87. <el-col :xs="24" :sm="24" :lg="24" class="item">
  88. <div class="label">安装时间</div>
  89. <div class="value" style="padding: 0">
  90. <el-form-item prop="installDate">
  91. <el-date-picker
  92. v-model="details.installDate"
  93. type="datetime"
  94. placeholder="安装时间"
  95. default-time="00:00:00"
  96. value-format="yyyy-MM-dd HH:mm:ss"
  97. />
  98. </el-form-item>
  99. </div>
  100. </el-col>
  101. <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
  102. <div class="label">寄厂日期</div>
  103. <div class="value" style="padding: 0">
  104. <el-form-item prop="sendFactoryDate">
  105. <el-date-picker
  106. v-model="details.sendFactoryDate"
  107. type="datetime"
  108. placeholder="寄厂日期"
  109. default-time="00:00:00"
  110. value-format="yyyy-MM-dd HH:mm:ss"
  111. >
  112. </el-date-picker>
  113. </el-form-item>
  114. </div>
  115. </el-col> -->
  116. </el-row>
  117. </el-form>
  118. </div>
  119. <h3>货品信息</h3>
  120. <el-divider />
  121. <!-- 列表 -->
  122. <div class="mymain-container">
  123. <div class="table">
  124. <el-table
  125. v-loading="listLoading"
  126. :data="details.items"
  127. element-loading-text="Loading"
  128. border
  129. fit
  130. show-summary
  131. highlight-current-row
  132. stripe
  133. :summary-method="$getSummaries"
  134. >
  135. <el-table-column
  136. align="center"
  137. label="物料编码"
  138. prop="materialNumber"
  139. min-width="160"
  140. show-overflow-tooltip
  141. />
  142. <el-table-column
  143. align="center"
  144. label="产品编码"
  145. prop="materialOldNumber"
  146. min-width="160"
  147. show-overflow-tooltip
  148. />
  149. <el-table-column
  150. align="center"
  151. label="产品名称"
  152. prop="materialName"
  153. min-width="160"
  154. show-overflow-tooltip
  155. />
  156. <el-table-column
  157. align="center"
  158. label="规格型号"
  159. prop="specification"
  160. min-width="160"
  161. show-overflow-tooltip
  162. />
  163. <el-table-column align="left" label="实装物料编号" prop="realMaterialNumber" min-width="150" show-overflow-tooltip></el-table-column>
  164. <el-table-column align="left" label="实装厂产品编码" prop="realMaterialOldNumber" min-width="200" show-overflow-tooltip></el-table-column>
  165. <el-table-column align="left" label="实装规格型号" prop="realSpecification" min-width="300" show-overflow-tooltip></el-table-column>
  166. <el-table-column
  167. align="center"
  168. label="单价"
  169. prop="price"
  170. min-width="160"
  171. show-overflow-tooltip
  172. />
  173. <el-table-column
  174. align="center"
  175. label="数量"
  176. prop="qty"
  177. min-width="160"
  178. show-overflow-tooltip
  179. />
  180. <el-table-column
  181. align="right"
  182. label="金额"
  183. prop="totalAmount"
  184. min-width="160"
  185. show-overflow-tooltip
  186. >
  187. <template slot-scope="scope">
  188. {{ scope.row.totalAmount | numToFixed }}
  189. </template>
  190. </el-table-column>
  191. <el-table-column
  192. align="center"
  193. label="押金数量"
  194. prop="hasSendQty"
  195. min-width="160"
  196. show-overflow-tooltip
  197. />
  198. <el-table-column
  199. align="center"
  200. label="发货数量"
  201. prop="orderHasSendQty"
  202. min-width="160"
  203. show-overflow-tooltip
  204. />
  205. <el-table-column
  206. align="right"
  207. label="合同数量"
  208. prop="contractQty"
  209. min-width="160"
  210. show-overflow-tooltip
  211. >
  212. <template slot-scope="scope">
  213. <el-input
  214. class="inpt"
  215. v-model.number="scope.row.contractQty"
  216. size="mini"
  217. clearable
  218. ></el-input>
  219. </template>
  220. </el-table-column>
  221. <el-table-column
  222. align="right"
  223. label="合同单价"
  224. prop="contractPrice"
  225. min-width="160"
  226. show-overflow-tooltip
  227. >
  228. <template slot-scope="scope">
  229. <el-input
  230. class="inpt"
  231. v-model.number="scope.row.contractPrice"
  232. size="mini"
  233. clearable
  234. ></el-input>
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. align="right"
  239. label="合同金额"
  240. prop="contractAmount"
  241. min-width="160"
  242. show-overflow-tooltip
  243. >
  244. <template slot-scope="scope">
  245. <div >
  246. {{comTotal(scope.row.contractQty,scope.row.contractPrice)}}
  247. </div>
  248. </template>
  249. </el-table-column>
  250. <el-table-column
  251. align="right"
  252. label="押金金额"
  253. prop="depositAmount"
  254. min-width="160"
  255. show-overflow-tooltip
  256. >
  257. <template slot-scope="scope">
  258. {{ scope.row.depositAmount | numToFixed }}
  259. </template>
  260. </el-table-column>
  261. <el-table-column
  262. align="center"
  263. label="上交资料"
  264. prop="dataQty"
  265. min-width="160"
  266. show-overflow-tooltip
  267. >
  268. <template slot-scope="scope">
  269. <el-input
  270. @blur="setDataQty($event,scope.row)"
  271. class="inpt"
  272. v-model.number="scope.row.dataQty"
  273. size="mini"
  274. clearable
  275. ></el-input>
  276. </template>
  277. </el-table-column>
  278. <el-table-column
  279. align="right"
  280. label="收差金额"
  281. prop="diffAmount"
  282. min-width="160"
  283. show-overflow-tooltip
  284. >
  285. <template slot-scope="scope">
  286. {{ scope.row.diffAmount | numToFixed }}
  287. </template>
  288. </el-table-column>
  289. <el-table-column
  290. align="right"
  291. label="收差政策价格"
  292. prop="diffPolicyPrice"
  293. min-width="200"
  294. show-overflow-tooltip
  295. >
  296. <template slot-scope="scope">
  297. {{ scope.row.diffPolicyPrice | numToFixed }}
  298. </template>
  299. </el-table-column>
  300. </el-table>
  301. </div>
  302. </div>
  303. <h3>上传资料</h3>
  304. <el-divider />
  305. <!-- 筛选条件 -->
  306. <div>
  307. <el-form
  308. ref="form"
  309. :model="details"
  310. label-width="100px"
  311. size="small"
  312. label-position="left"
  313. >
  314. <el-row :gutter="20">
  315. <el-col :xs="24" :sm="12" :lg="24">
  316. <el-form-item label="工程验收资料" prop="">
  317. <imageUpload :file-list="fileList" :multiple="true" :start-restricting="true" :restrict-filename="restrictFilename" />
  318. </el-form-item>
  319. </el-col>
  320. <el-col :xs="24" :sm="12" :lg="24" v-if="details.dataList && details.dataList.length">
  321. <!-- 列表 -->
  322. <div class="mymain-container">
  323. <div class="table">
  324. <el-table
  325. v-loading="listLoading"
  326. :data="details.dataList"
  327. element-loading-text="Loading"
  328. border
  329. fit
  330. highlight-current-row
  331. stripe
  332. >
  333. <el-table-column
  334. align="center"
  335. label="资料描述"
  336. prop="dataDescribe"
  337. min-width="160"
  338. show-overflow-tooltip
  339. />
  340. <el-table-column
  341. align="center"
  342. label="原文件名"
  343. prop="fileName"
  344. min-width="160"
  345. show-overflow-tooltip
  346. />
  347. <el-table-column
  348. align="center"
  349. label="缩略图"
  350. prop="fileUrl"
  351. min-width="160"
  352. show-overflow-tooltip
  353. >
  354. <template slot-scope="scope">
  355. <el-image
  356. v-if="checkFileType(scope.row.fileUrl) == 'image'"
  357. ref="img"
  358. :src="imageURL + scope.row.fileUrl"
  359. style="width: 120px; height: 120px"
  360. fit="cover"
  361. :preview-src-list="[imageURL + scope.row.fileUrl]"
  362. />
  363. <img
  364. v-if="checkFileType(scope.row.fileUrl) == 'word'"
  365. class="file"
  366. src="@/assets/common/word.png"
  367. >
  368. <img
  369. v-if="checkFileType(scope.row.fileUrl) == 'excel'"
  370. class="file"
  371. src="@/assets/common/excel.png"
  372. >
  373. <img
  374. v-if="checkFileType(scope.row.fileUrl) == 'ppt'"
  375. class="file"
  376. src="@/assets/common/ppt.png"
  377. >
  378. <img
  379. v-if="checkFileType(scope.row.fileUrl) == 'pdf'"
  380. class="file"
  381. style="cursor: pointer;"
  382. src="@/assets/common/pdf.png"
  383. @click="openPdf(scope.row.fileUrl)"
  384. >
  385. <img
  386. v-if="checkFileType(scope.row.fileUrl) == 'file'"
  387. class="file aaa"
  388. src="@/assets/common/zip.jpeg"
  389. >
  390. </template>
  391. </el-table-column>
  392. <el-table-column
  393. align="center"
  394. label="下载文件名称"
  395. prop="fileName"
  396. min-width="160"
  397. show-overflow-tooltip
  398. >
  399. <template slot-scope="scope">
  400. {{ "资料_" + scope.row.fileName }}
  401. </template>
  402. </el-table-column>
  403. <el-table-column
  404. align="center"
  405. label="操作"
  406. min-width="160"
  407. show-overflow-tooltip
  408. >
  409. <template slot-scope="scope">
  410. <el-button
  411. type="text"
  412. class="textColor"
  413. @click="downLoadFn(scope.row.fileUrl,scope.row.fileName)"
  414. >下载</el-button>
  415. <el-popconfirm
  416. style="margin-left: 10px"
  417. title="这是一段内容确定删除吗?"
  418. @onConfirm="delFile(scope.$index)"
  419. >
  420. <el-button type="text" slot="reference">删除</el-button>
  421. </el-popconfirm>
  422. </template>
  423. </el-table-column>
  424. </el-table>
  425. </div>
  426. </div>
  427. </el-col>
  428. <el-col :xs="24" :sm="12" :lg="6">
  429. <el-form-item label="申请人" prop="submitName">
  430. <el-input
  431. v-model="details.submitName"
  432. readonly
  433. placeholder="请输入"
  434. />
  435. </el-form-item>
  436. </el-col>
  437. <el-col :xs="24" :sm="12" :lg="6">
  438. <el-form-item label="申请日期" prop="submitTime">
  439. <el-date-picker
  440. v-model="details.submitTime"
  441. readonly
  442. class="dateStyle"
  443. type="datetime"
  444. placeholder="选择日期"
  445. default-time="00:00:00"
  446. value-format="yyyy-MM-dd HH:mm:ss"
  447. />
  448. </el-form-item>
  449. </el-col>
  450. <el-col :xs="24" :sm="12" :lg="18">
  451. <el-form-item label="申请退押" prop="applyNote">
  452. <el-input
  453. v-model="details.applyNote"
  454. type="textarea"
  455. placeholder="请输入"
  456. class="textareaStyle"
  457. />
  458. </el-form-item>
  459. </el-col>
  460. <el-col :xs="24" :sm="12" :lg="18" v-if="details.checkBy && details.checkDate">
  461. <el-form-item label="验收说明
  462. " prop="checkNote">
  463. <el-input
  464. v-model="details.checkNote"
  465. disabled
  466. type="textarea"
  467. placeholder="请输入验收说明
  468. "
  469. class="textareaStyle"
  470. />
  471. </el-form-item>
  472. </el-col>
  473. <el-col :xs="24" :sm="24" :lg="24">
  474. <el-form-item label="">
  475. <el-button
  476. type="primary"
  477. size="small"
  478. @click="handleSvse"
  479. >保存</el-button>
  480. <el-button
  481. type="primary"
  482. size="small"
  483. @click="handleReset"
  484. >重置</el-button>
  485. </el-form-item>
  486. </el-col>
  487. </el-row>
  488. </el-form>
  489. </div>
  490. </div>
  491. </template>
  492. <script>
  493. import { applyDeposit, geDetail,computeDiff } from '@/api/engin_deposit.js'
  494. import imageUpload from '@/components/Common/image-upload.vue'
  495. import { downloadFiles, downloadPdf } from '@/utils/util'
  496. import { getFileUrl } from '@/api/common'
  497. export default {
  498. components: {
  499. imageUpload
  500. },
  501. data() {
  502. return {
  503. isDis: true,
  504. listLoading: false,
  505. baseURL: '',
  506. fileList: [],
  507. details: {},
  508. restrictFilename: [
  509. '结算单', '合同', '明细表', '审核表', '收据', '发票', '照片','相片'
  510. ],
  511. }
  512. },
  513. computed:{
  514. isCustomer(){
  515. return this.$store.getters.customerId && this.$store.getters.customerNumber
  516. },
  517. comTotal(){
  518. return (qty,price)=>{
  519. return Number(qty) * Number(price)
  520. }
  521. }
  522. },
  523. watch:{
  524. "details.items": {
  525. handler(newValue, oldValue) {
  526. if (newValue && newValue.length) {
  527. newValue.forEach((item, index) => {
  528. item.contractAmount = Number(item.contractQty) * Number(item.contractPrice)
  529. });
  530. }
  531. this.details.items = newValue;
  532. },
  533. immediate: true,
  534. deep: true,
  535. },
  536. },
  537. created() {
  538. this.imageURL = this.$imageUrl
  539. this.geDetail()
  540. },
  541. methods: {
  542. geDetail(){
  543. geDetail({ id: this.$parent.depositManageId }).then((res) => {
  544. let arr = []
  545. res.data.items.forEach((item) => {
  546. if (Number(item.qty)>0) {
  547. arr.push(item)
  548. }
  549. // item.number = (item.qty*100 - item.directTransferQty*100 - item.retiredQty*100) / 100;
  550. item.sums1 = ['orderHasSendQty', 'dataQty', 'qty',"hasSendQty","contractQty"]
  551. item.sums2 = ['totalAmount', 'diffAmount', 'price','depositAmount', "contractPrice","comTotal",
  552. "contractAmount",]
  553. })
  554. res.data.items = arr
  555. this.details = res.data
  556. })
  557. },
  558. // 计算收差金额
  559. setDataQty(e,row){
  560. if(!row.dataQty) return
  561. row.saleTypeId = this.details.saleTypeId
  562. computeDiff(row).then(res=>{
  563. row.diffAmount = res.data.diffAmount
  564. row.diffPolicyPrice = res.data.diffPolicyPrice
  565. // this.$successMsg('已计算收差金额')
  566. })
  567. }
  568. ,
  569. goBack() {
  570. this.$parent.showPage = 1
  571. },
  572. handleSvse() {
  573. const arr = []
  574. if (!this.details.installDate) {
  575. this.$errorMsg('请选择安装时间')
  576. return
  577. }
  578. if (this.isCustomer) {
  579. for (let i = 0; i < this.details.items.length; i++) {
  580. this.details.items[i].contractAmount = this.details.items[i].contractQty * this.details.items[i].contractPrice
  581. if (!this.details.items[i].contractAmount) {
  582. return this.$errorMsg('合同单价、合同数量不能为空')
  583. }
  584. }
  585. }
  586. this.fileList.forEach((el) => {
  587. if (this.details.dataList.length){
  588. this.details.dataList.forEach((i,e)=>{
  589. console.log(i.fileName==el.name)
  590. if (el.name === i.fileName){
  591. this.details.dataList.splice(e,1)
  592. }
  593. })
  594. }
  595. arr.push({
  596. dataDescribe: el.name,
  597. enginOrderNo: this.details.refProjectNo,
  598. fileName: el.name,
  599. fileUrl: el.url
  600. })
  601. })
  602. applyDeposit({
  603. ...this.details,
  604. dataList:[...arr,...this.details.dataList]
  605. }).then((res) => {
  606. this.$successMsg('申请成功')
  607. this.$parent.showPage = 1
  608. this.$parent.deduction = ''
  609. this.$parent.getList()
  610. })
  611. },
  612. delFile(index){
  613. this.details.dataList.splice(index,1)
  614. this.$successMsg('删除成功')
  615. },
  616. handleReset() {
  617. this.$refs.form.resetFields()
  618. },
  619. // 批量下载
  620. async batchDownloadFn() {
  621. downloadFiles('deposit-manage/downZip', { parentId: this.$parent.depositManageId })
  622. },
  623. // 下载
  624. downLoadFn(v, fileName) {
  625. if (this.checkFileType(v) === 'pdf') {
  626. downloadPdf(this.$imageUrl + v, fileName)
  627. return
  628. }
  629.   downloadFiles("common/file/getStream", { key: v, fileName:fileName});
  630. // getFileUrl({ key: v }).then((res) => {
  631. // window.open(res.data)
  632. // })
  633. },
  634. openPdf(pdfUrl) {
  635. window.open(this.$imageUrl + pdfUrl)
  636. },
  637. // 检查文件类型
  638. checkFileType(url) {
  639. if (!url) return ''
  640. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  641. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  642. return 'image'
  643. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  644. return 'word'
  645. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  646. return 'excel'
  647. } else if (
  648. ['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)
  649. ) {
  650. return 'ppt'
  651. } else if (['pdf'].includes(fileSuffix)) {
  652. return 'pdf'
  653. } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
  654. return 'file'
  655. } else {
  656. return ''
  657. }
  658. },
  659. }
  660. }
  661. </script>
  662. <style lang="scss" scoped>
  663. .aaa {
  664. height: 64px;
  665. width: 64px;
  666. }
  667. .gdzl {
  668. display: inline-block;
  669. }
  670. ::v-deep .textareaStyle {
  671. .el-textarea__inner {
  672. resize: none;
  673. height: 100px;
  674. }
  675. }
  676. .dateStyle {
  677. width: 100%;
  678. }
  679. ::v-deep .el-input__prefix {
  680. display: none;
  681. left: 65px !important;
  682. -webkit-transition: all 0.3s;
  683. transition: all 0.3s;
  684. }
  685. ::v-deep .el-date-editor.el-input {
  686. width: 100%;
  687. box-sizing: border-box;
  688. padding-left: 10px;
  689. }
  690. .diy-table-1 {
  691. ::v-deep .el-form-item {
  692. margin: 0;
  693. }
  694. ::v-deep .el-input__suffix {
  695. right: -15px;
  696. -webkit-transition: all 0.3s;
  697. transition: all 0.3s;
  698. }
  699. }
  700. .value{
  701. overflow: hidden;
  702. }
  703. </style>