storageContractRecord.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <!--代储合同记录-->
  2. <template>
  3. <div>
  4. <div class="top-btn">
  5. <div class="right">
  6. <el-date-picker class="date-select" size="small" style="margin: 0 10px 0 0" value-format="yyyy-MM-dd"
  7. v-model="value2" @change="datechange" type="daterange" align="right" unlink-panels range-separator="至"
  8. start-placeholder="结算时间起" end-placeholder="结算时间止" :picker-options="pickerOptions">
  9. </el-date-picker>
  10. <!-- -->
  11. <el-button type='primary' @click='addRecord' v-if="isSHowAddRecordBtn">生成代储记录</el-button>
  12. <el-button type="primary" @click="exportlist"
  13. v-hasPermission="`contractManagement.dsContract.dsContractInfo.export`" v-if="isSHowExportBtn">导出
  14. </el-button>
  15. <el-button type="primary" @click="collectMoney"
  16. v-hasPermission="`contractManagement.dsContract.dsContractInfo.shou`" v-if="isSHowExportBtn">收费
  17. </el-button>
  18. <el-button type='primary' @click='collectMoneyRecord' v-if="isSHowExportBtn">收费记录</el-button>
  19. </div>
  20. </div>
  21. <div class="content-top">
  22. <div class="content-top-item">合同编号:{{routeData.contractNo}}</div>
  23. <div class="content-top-item">买方:{{routeData.buyer}}</div>
  24. <div class="content-top-item">合同量:{{routeData.weight}}</div>
  25. <div class="content-top-item">已完成量:{{routeData.completedQuantity}}</div>
  26. <div class="content-top-item">应收代储费:{{routeData.total}}</div>
  27. <div class="content-top-item">已收代储费:{{routeData.received}}</div>
  28. </div>
  29. <div v-show="isShowRecord">
  30. <el-table :data="recordList" ref="table" style="width: 100%; margin-top: 20px" border height="calc(100% - 190px)">
  31. <el-table-column type="index" label="序号">
  32. <template scope="scope">
  33. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  34. <span v-else>{{ scope.$index + 1 }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column class="table_td" prop="goodsName" label="货名"></el-table-column>
  38. <el-table-column class="table_td" prop="storageFeeDate" label="日期" width="150"></el-table-column>
  39. <el-table-column class="table_td" prop="storageVolume" label="当日入库量(吨)"></el-table-column>
  40. <el-table-column class="table_td" prop="deliveryVolume" label="当日出库量(吨)"></el-table-column>
  41. <el-table-column class="table_td" prop="dailyBillingReserves" label="当日计费储量(吨)"></el-table-column>
  42. <el-table-column class="table_td" prop="storageFee" label="代储费(元/吨天)"></el-table-column>
  43. <el-table-column class="table_td" prop="receivable" label="应收(元)"></el-table-column>
  44. <el-table-column class="table_td" prop="collectionEdPayable" label="操作" width="300">
  45. <template scope="scope">
  46. <el-button @click="storageFeeLook(scope.row)">代储费</el-button>
  47. <el-button @click="warehousingLook(scope.row)">入库</el-button>
  48. <el-button @click="stop(scope.row)" v-if="scope.row.endFlag==0">终止</el-button>
  49. <el-button @click="cancelTermination(scope.row)" v-if="scope.row.endFlag==1&&scope.$index==0">取消终止
  50. </el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  55. :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper"
  56. :total="deptBudgetTotal">
  57. </el-pagination>
  58. </div>
  59. <!-- 修改代储费 -->
  60. <el-dialog :visible.sync="editStorageFee" :append-to-body="true" title="修改代储费" class="sk-dialog"
  61. width="400px!important">
  62. <div class="sf-dialog">
  63. <div class="row">
  64. <div class="left">代储费(元/吨·天)</div>
  65. <div class="right">
  66. <el-input type="number" @mousewheel.native.prevent v-model="editRecordObj.storageFee" placeholder="请输入代储费"
  67. maxlength="100" size="small" />
  68. </div>
  69. </div>
  70. <div class="row">
  71. <div class="left">起用日期</div>
  72. <div class="right">
  73. <el-input type="text" @mousewheel.native.prevent v-model="recordObj.storageFeeStartdate" placeholder=""
  74. maxlength="100" size="small" disabled />
  75. </div>
  76. </div>
  77. <div class="row row-last">
  78. <el-button @click="editStorageFee = false">取消</el-button>
  79. <el-button @click="editStorageFeeSubmit" type='primary'>提交</el-button>
  80. </div>
  81. </div>
  82. </el-dialog>
  83. <!-- 入库 -->
  84. <el-dialog :visible.sync="editWarehousing" :append-to-body="true" title="修改入库量" class="sk-dialog"
  85. width="400px!important">
  86. <div class="sf-dialog">
  87. <div class="row">
  88. <div class="left">当日入库量(吨)</div>
  89. <div class="right">
  90. <el-input type="number" @mousewheel.native.prevent v-model="editWarehousingObj.storageVolume"
  91. placeholder="请输入入库量" maxlength="100" size="small" />
  92. </div>
  93. </div>
  94. <div class="row">
  95. <div class="left">入库日期</div>
  96. <div class="right">
  97. <el-input type="text" @mousewheel.native.prevent v-model="rowData.storageFeeDate" placeholder=""
  98. maxlength="100" size="small" disabled />
  99. </div>
  100. </div>
  101. <div class="row row-last">
  102. <el-button @click="editWarehousing = false">取消</el-button>
  103. <el-button @click="editWarehousingSubmit" type='primary'>提交</el-button>
  104. </div>
  105. </div>
  106. </el-dialog>
  107. <!-- 生成记录 -->
  108. <el-dialog :visible.sync="addRecoredDialog" :append-to-body="true" title="生成记录" class="scjl-dialog"
  109. width="400px!important">
  110. <div class="sf-dialog">
  111. <div class="row">
  112. <div class="left">代储费(元/吨·天)</div>
  113. <div class="right">
  114. <el-input type="number" @mousewheel.native.prevent v-model="recordObj.storageFee" placeholder=""
  115. maxlength="100" size="small" disabled />
  116. </div>
  117. </div>
  118. <div class="row">
  119. <div class="left">起算日期</div>
  120. <div class="right">
  121. <el-input type="text" @mousewheel.native.prevent v-model="recordObj.storageFeeStartdate" placeholder=""
  122. maxlength="100" size="small" disabled />
  123. </div>
  124. </div>
  125. <div class="row">
  126. <div class="left">预计截止日期</div>
  127. <div class="right">
  128. <el-input type="text" @mousewheel.native.prevent v-model="recordObj.storageFeeEnddate" placeholder=""
  129. maxlength="100" size="small" disabled />
  130. </div>
  131. </div>
  132. <div class="row">
  133. <div class="left">起算重量(吨)</div>
  134. <div class="right">
  135. <el-input type="number" @mousewheel.native.prevent v-model="recordObj.storageFeeWeight" placeholder=""
  136. maxlength="100" size="small" disabled />
  137. </div>
  138. </div>
  139. <div class="row row-last">
  140. <el-button @click="addRecoredDialog = false">取消</el-button>
  141. <el-button @click="addRecoredSubmit" type='primary'>提交</el-button>
  142. </div>
  143. </div>
  144. </el-dialog>
  145. <!-- 收费 -->
  146. <el-dialog :visible.sync="collectForm" :append-to-body="true" title="收费" class="sk-dialog">
  147. <div class="sf-dialog">
  148. <div class="row">
  149. <div class="left">金额(元)</div>
  150. <div class="right">
  151. <el-input type="number" @mousewheel.native.prevent v-model="chargeObj.amountMoney"
  152. placeholder="请输入本次收款金额(元)" maxlength="100" size="small" />
  153. </div>
  154. </div>
  155. <div class="row">
  156. <div class="left">收款日期</div>
  157. <div class="right">
  158. <el-date-picker v-model="chargeObj.collectionDate" type="date" placeholder="选择日期"></el-date-picker>
  159. </div>
  160. </div>
  161. <div class="row">
  162. <div class="left">收款截图</div>
  163. <el-upload class="avatar-uploader" action="https://www.zthymaoyi.com/upload/admin" :show-file-list="false"
  164. :on-success="handleAvatarSuccess">
  165. <div v-if='imageUrl.length>0'>
  166. <div style='display:inline-block;' v-for='item in imageUrl'>
  167. <img :src="item" class="avatar" />
  168. </div>
  169. </div>
  170. <i class="el-icon-plus avatar-uploader-icon"></i>
  171. </el-upload>
  172. </div>
  173. <div class="row row-last">
  174. <el-button @click="collectForm = false">取消</el-button>
  175. <el-button @click="collectSubmit" type='primary'>提交</el-button>
  176. </div>
  177. </div>
  178. </el-dialog>
  179. <!-- 收费记录 -->
  180. <el-dialog :visible.sync="dialogVisible" title="收费记录" class="sfjl-dialog">
  181. <el-table :data="sfRecordList" ref="table" style="width: 100%; margin-top: 20px" border
  182. height="calc(100% - 190px)">
  183. <el-table-column type="index" label="序号">
  184. <template scope="scope">
  185. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  186. <span v-else>{{ scope.$index + 1 }}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column class="table_td" prop="amountMoney" label="金额(元)"></el-table-column>
  190. <el-table-column class="table_td" prop="collectionDate" label="收费日期"></el-table-column>
  191. <el-table-column class="table_td" prop="updateDate" label="操作日期"></el-table-column>
  192. <el-table-column class="table_td" prop="operator" label="操作人"></el-table-column>
  193. <el-table-column class="table_td" prop="collectionScreenshot" label="附件">
  194. <template slot-scope="scope">
  195. <img width="18" height="20" style="vertical-align: text-top; position: relative; top: -1px"
  196. src="../../../public/img/fujian.png" @click="fujian(scope.row)" alt="" />
  197. <span v-if="scope.row.addressUrlArray != null">
  198. {{scope.row.addressUrlArray.length == 0? "":scope.row.addressUrlArray.length}}
  199. </span>
  200. </template>
  201. </el-table-column>
  202. </el-table>
  203. <WinseaContentModal v-model="accessoryTFs" :title="$t('system.noticeCircular.information')"
  204. @on-cancel="handleClose">
  205. <div class="image-list">
  206. <el-image v-for="(item,index) in fjImageList" style="width: 100px; height: 100px" :src="item" fit="fill"
  207. :preview-src-list="fjImageList"></el-image>
  208. </div>
  209. </WinseaContentModal>
  210. <div class="close-sfju-dialog">
  211. <el-button type='primary' @click='dialogVisible=false'>关闭</el-button>
  212. </div>
  213. </el-dialog>
  214. </div>
  215. </template>
  216. <script>
  217. import {
  218. dayjs,
  219. EventBus
  220. } from 'base-core-lib'
  221. import {
  222. downloadFile
  223. } from '@/utils/batchDown'
  224. import {
  225. storageFeeRecordList,
  226. addStorageFeeRecord,
  227. editStorageRecordInfo,
  228. storageFeeRecordCharge,
  229. feeRecord,
  230. stopStorageFeeRecord,
  231. exportStorageFee
  232. } from '@/model/contarct/index'
  233. import download from '../../components/WsDownload/download'
  234. import WsUpload from '@/components/WsUpload'
  235. export default {
  236. components: {
  237. WsUpload
  238. },
  239. watch: {},
  240. data() {
  241. return {
  242. date: {
  243. year: dayjs().format('YYYY'),
  244. month: dayjs().format('MM'),
  245. },
  246. termination: true,
  247. fjImageList: [],
  248. sfRecordList: [],
  249. //公司id,合同id,金额,收费截图,收费日期,操作人
  250. chargeObj: {
  251. compId: '',
  252. contractId: '',
  253. amountMoney: '',
  254. collectionScreenshot: '',
  255. collectionDate: "",
  256. operator: '',
  257. },
  258. editWarehousingObj: {
  259. id: '',
  260. storageVolume: '',
  261. },
  262. editRecordObj: {
  263. id: '',
  264. storageFee: '',
  265. flag: 1
  266. },
  267. pickerOptions: {},
  268. isSHowExportBtn: false,
  269. isSHowAddRecordBtn: false,
  270. recordObj: {
  271. storageFeeStartdate: ''
  272. },
  273. editWarehousing: false,
  274. editStorageFee: false,
  275. addRecoredDialog: false,
  276. compId: localStorage.getItem('ws-pf_compId'),
  277. id: '',
  278. accessoryTFs: false,
  279. appendixIdss: [],
  280. isShowRecord: false,
  281. collectForm: false,
  282. routeData: {},
  283. //分页
  284. currentPage: 1,
  285. pageSize: 10,
  286. recordList: [],
  287. deptCircularPage: {},
  288. deptBudgetTotal: 0,
  289. dialogVisible: false,
  290. //上传截图路径
  291. imageUrl: [],
  292. rowData: {},
  293. value2: [],
  294. }
  295. },
  296. destroyed: function() {
  297. this.editWarehousing = false
  298. this.editStorageFee = false
  299. this.addRecoredDialog = false
  300. this.isShowRecord = false
  301. },
  302. mounted() {
  303. let that = this
  304. this.routeData = {
  305. contractNo: this.$route.query.contractNo,
  306. compId: localStorage.getItem('ws-pf_compId'),
  307. buyer: this.$route.query.buyer,
  308. weight: this.$route.query.weight,
  309. completedQuantity: this.$route.query.completedQuantity,
  310. total: this.$route.query.total,
  311. received: this.$route.query.received,
  312. storageFee: this.$route.query.storageFee,
  313. storageFeeStartdate: this.$route.query.storageFeeStartdate,
  314. storageFeeEnddate: this.$route.query.storageFeeEnddate,
  315. storageFeeWeight: this.$route.query.storageFeeWeight,
  316. status: this.$route.query.status
  317. }
  318. this.recordObj = {
  319. storageFee: this.$route.query.storageFee,
  320. storageFeeStartdate: this.$route.query.storageFeeStartdate,
  321. storageFeeEnddate: this.$route.query.storageFeeEnddate,
  322. storageFeeWeight: this.$route.query.storageFeeWeight,
  323. }
  324. this.value2 = [this.$route.query.storageFeeStartdate, this.$route.query.storageFeeEnddate]
  325. this.pickerOptions = {
  326. disabledDate(time) {
  327. return (time.getTime() < (new Date(that.recordObj.storageFeeStartdate).getTime() - 86400000)) || (time
  328. .getTime() >
  329. new Date(that.recordObj.storageFeeEnddate).getTime())
  330. }
  331. }
  332. this.getList()
  333. },
  334. methods: {
  335. // 收费记录附件
  336. fujian(row) {
  337. this.id = row.id
  338. this.accessoryTFs = true
  339. this.appendixIdss = row.collectionScreenshot
  340. console.log(this.appendixIdss)
  341. },
  342. // 代储费
  343. storageFeeLook(row) {
  344. if (this.routeData.status == '已完成') {
  345. this.$message({
  346. message: '合同已完成,不可操作!',
  347. type: 'warning',
  348. })
  349. return
  350. }
  351. this.editRecordObj.id = row.id;
  352. this.editRecordObj.storageFee = row.storageFee
  353. this.editStorageFee = true
  354. // this.customerInfo = true
  355. // this.viewLock = true
  356. // this.getCustomerNumberCard(row)
  357. },
  358. // 入库
  359. warehousingLook(row) {
  360. if (this.routeData.status == '已完成') {
  361. this.$message({
  362. message: '合同已完成,不可操作!',
  363. type: 'warning',
  364. })
  365. return
  366. }
  367. this.rowData = row
  368. this.editWarehousingObj = {
  369. id: row.id,
  370. storageVolume: row.storageVolume,
  371. }
  372. this.editWarehousing = true
  373. // this.getCustomerNumberCard(row)
  374. },
  375. // 修改代储费
  376. editStorageFeeSubmit() {
  377. if (!this.editRecordObj.storageFee && this.editRecordObj.storageFee != 0) {
  378. this.$message({
  379. message: '代储费不能为空!',
  380. type: 'warning',
  381. })
  382. return
  383. }
  384. this.editRecordObj.storageFee = Number(this.editRecordObj.storageFee)
  385. if (this.editRecordObj.storageFee < 0 || this.editRecordObj.storageFee > 1000) {
  386. this.$message({
  387. message: '代储费输入错误,0-1000之间数字!',
  388. type: 'warning',
  389. })
  390. return
  391. }
  392. if (this.editRecordObj.storageFee.toString().indexOf('.') > -1) {
  393. if (this.editRecordObj.storageFee.toString().split('.')[1].length > 2) {
  394. this.$message({
  395. message: '代储费输入错误,最多保留两位小数!',
  396. type: 'warning',
  397. })
  398. return
  399. }
  400. }
  401. editStorageRecordInfo(this.editRecordObj)
  402. .toPromise()
  403. .then((response) => {
  404. this.$message.success('修改成功!')
  405. this.editStorageFee = false
  406. this.getList()
  407. })
  408. },
  409. // 修改入库量
  410. editWarehousingSubmit() {
  411. if (!this.editWarehousingObj.storageVolume && this.editWarehousingObj.storageVolume != 0) {
  412. this.$message({
  413. message: '入库量不能为空!',
  414. type: 'warning',
  415. })
  416. return
  417. }
  418. this.editWarehousingObj.storageVolume = Number(this.editWarehousingObj.storageVolume)
  419. if (this.editWarehousingObj.storageVolume < 0 || this.editWarehousingObj.storageVolume > 200000) {
  420. this.$message({
  421. message: '入库量输入错误,0-200000之间数字!',
  422. type: 'warning',
  423. })
  424. return
  425. }
  426. if (this.editWarehousingObj.storageVolume.toString().indexOf('.') > -1) {
  427. if (this.editWarehousingObj.storageVolume.toString().split('.')[1].length > 3) {
  428. this.$message({
  429. message: '代储费输入错误,最多保留三位小数!',
  430. type: 'warning',
  431. })
  432. return
  433. }
  434. }
  435. editStorageRecordInfo(this.editWarehousingObj)
  436. .toPromise()
  437. .then((response) => {
  438. this.$message.success('修改成功!')
  439. this.editWarehousing = false
  440. this.getList()
  441. })
  442. },
  443. // 收费记录
  444. collectMoneyRecord() {
  445. feeRecord({
  446. contractId: this.$route.query.contractId
  447. })
  448. .toPromise()
  449. .then((response) => {
  450. this.sfRecordList = response
  451. for (let i = 0; i < response.length; i++) {
  452. response[i].addressUrlArray = response[i].collectionScreenshot.split(',')
  453. this.fjImageList = response[i].collectionScreenshot.split(',')
  454. }
  455. // this.$message.success('修改成功!')
  456. // this.editWarehousing = false
  457. // this.getList()
  458. })
  459. this.dialogVisible = true
  460. },
  461. // 取消终止
  462. cancelTermination(row) {
  463. if (this.routeData.status == '已完成') {
  464. this.$message({
  465. message: '合同已完成,不可操作!',
  466. type: 'warning',
  467. })
  468. return
  469. }
  470. //判断当前时间是在预计终止前还是后
  471. let _stopData = new Date(this.$route.query.storageFeeEnddate).getTime()
  472. let _rowTime = new Date(row.storageFeeDate).getTime()
  473. if (_rowTime - _stopData < 0) {
  474. this.$confirm(
  475. '确定取消终止,继续收费?',
  476. '提示', {
  477. confirmButtonText: '确定',
  478. cancelButtonText: '取消',
  479. type: 'warning',
  480. }
  481. )
  482. .then(() => {
  483. addStorageFeeRecord({
  484. contractNo: this.$route.query.contractNo,
  485. })
  486. .toPromise()
  487. .then((response) => {
  488. this.$message.success('操作成功!')
  489. this.getList()
  490. })
  491. })
  492. .catch(() => {
  493. this.$message.success('操作失败!')
  494. return false
  495. })
  496. } else {
  497. this.$confirm(
  498. '已达到预计终止日期,如需继续收费请前往合同修改终止日期?',
  499. '提示', {
  500. confirmButtonText: '去修改',
  501. cancelButtonText: '取消',
  502. type: 'warning',
  503. }
  504. )
  505. .then(() => {
  506. // addStorageFeeRecord({
  507. // contractNo: this.$route.query.contractNo,
  508. // })
  509. // .toPromise()
  510. // .then((response) => {
  511. // this.$message.success('操作成功!')
  512. // this.getList()
  513. // })
  514. })
  515. .catch(() => {
  516. // this.$message.success('操作失败!')
  517. return false
  518. })
  519. }
  520. },
  521. // 终止
  522. stop(row) {
  523. if (this.routeData.status == '已完成') {
  524. this.$message({
  525. message: '合同已完成,不可操作!',
  526. type: 'warning',
  527. })
  528. return
  529. }
  530. // this.$confirm(
  531. // '已达到预计终止日期,如需继续收费请前往合同修改终止日期?',
  532. // '提示', {
  533. // confirmButtonText: '确定',
  534. // cancelButtonText: '取消',
  535. // type: 'warning',
  536. // }
  537. // )
  538. // .then(() => {
  539. // })
  540. // .catch(() => {
  541. // return false
  542. // })
  543. this.$confirm(
  544. row.storageFeeDate + '之后将不在计费,是否确定终止?',
  545. '提示', {
  546. confirmButtonText: '确定',
  547. cancelButtonText: '取消',
  548. type: 'warning',
  549. }
  550. )
  551. .then(() => {
  552. stopStorageFeeRecord({
  553. id: row.id,
  554. endFlag: 1,
  555. flag: 2
  556. })
  557. .toPromise()
  558. .then((response) => {
  559. this.$message.success('终止成功!')
  560. this.termination = false
  561. this.getList()
  562. })
  563. })
  564. .catch(() => {
  565. return false
  566. })
  567. },
  568. //生成代储费记录
  569. addRecord() {
  570. console.log(111)
  571. this.addRecoredDialog = true
  572. },
  573. // 时间筛选
  574. datechange() {
  575. this.getList()
  576. },
  577. // 导出
  578. async exportlist() {
  579. let _data = {
  580. compId: localStorage.getItem('ws-pf_compId'),
  581. contractNo: this.routeData.contractNo
  582. }
  583. const {
  584. data
  585. } = await exportStorageFee(
  586. _data, {}, {
  587. responseType: 'blob',
  588. }
  589. ).toPromise()
  590. downloadFile({
  591. res: data,
  592. fileName: `${
  593. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  594. }代储费信息`,
  595. type: 'xls',
  596. })
  597. },
  598. //上传付款截图
  599. handleAvatarSuccess(e) {
  600. this.imageUrl.push(e.url)
  601. },
  602. // 查询列表
  603. getList() {
  604. storageFeeRecordList({
  605. compId: localStorage.getItem('ws-pf_compId'),
  606. contractNo: this.$route.query.contractNo,
  607. currentPage: this.currentPage,
  608. pageSize: this.pageSize,
  609. })
  610. .toPromise()
  611. .then((response) => {
  612. this.recordList = response.records
  613. if (response.records.length > 0) {
  614. this.isSHowExportBtn = true
  615. this.isShowRecord = true
  616. } else {
  617. this.isSHowAddRecordBtn = true
  618. }
  619. })
  620. },
  621. dateFormat(fmt, date) {
  622. let ret
  623. const opt = {
  624. 'Y+': date.getFullYear().toString(), // 年
  625. 'm+': (date.getMonth() + 1).toString(), // 月
  626. 'd+': date.getDate().toString(), // 日
  627. 'H+': date.getHours().toString(), // 时
  628. // "M+": date.getMinutes().toString(), // 分
  629. // "S+": date.getSeconds().toString() // 秒
  630. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  631. }
  632. for (let k in opt) {
  633. ret = new RegExp('(' + k + ')').exec(fmt)
  634. if (ret) {
  635. fmt = fmt.replace(
  636. ret[1],
  637. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  638. )
  639. }
  640. }
  641. return fmt
  642. },
  643. // 收款
  644. collectMoney() {
  645. if (this.routeData.status == '已完成') {
  646. this.$message({
  647. message: '合同已完成,不可操作!',
  648. type: 'warning',
  649. })
  650. return
  651. }
  652. this.chargeObj = {
  653. compId: localStorage.getItem('ws-pf_compId'),
  654. contractId: this.$route.query.contractId,
  655. operator: localStorage.getItem('ws-pf_staffName'),
  656. collectionDate: this.dateFormat('YYYY-mm-dd', new Date())
  657. }
  658. this.collectForm = true
  659. },
  660. // 生成记录提交
  661. addRecoredSubmit() {
  662. this.$confirm(
  663. '提交后起算日期和起算重量不可修改,是否确定提交?',
  664. '提示', {
  665. confirmButtonText: '确定',
  666. cancelButtonText: '取消',
  667. type: 'warning',
  668. }
  669. )
  670. .then(() => {
  671. // // 添加记录
  672. addStorageFeeRecord({
  673. contractNo: this.$route.query.contractNo,
  674. })
  675. .toPromise()
  676. .then((response) => {
  677. this.getList()
  678. })
  679. this.addRecoredDialog = false
  680. this.isShowRecord = true
  681. })
  682. .catch(() => {
  683. return false
  684. })
  685. },
  686. // 收费提交
  687. collectSubmit() {
  688. if (!this.chargeObj.amountMoney && this.chargeObj.amountMoney != 0) {
  689. this.$message({
  690. message: '金额不能为空!',
  691. type: 'warning',
  692. })
  693. return
  694. }
  695. this.chargeObj.amountMoney = Number(this.chargeObj.amountMoney)
  696. if (this.chargeObj.amountMoney < 0 || this.chargeObj.amountMoney > 1000000) {
  697. this.$message({
  698. message: '金额输入错误,0-1000000之间数字!',
  699. type: 'warning',
  700. })
  701. return
  702. }
  703. if (this.chargeObj.amountMoney.toString().indexOf('.') > -1) {
  704. if (this.chargeObj.amountMoney.toString().split('.')[1].length > 2) {
  705. this.$message({
  706. message: '代储费输入错误,最多保留三位小数!',
  707. type: 'warning',
  708. })
  709. return
  710. }
  711. }
  712. if (!this.imageUrl) {
  713. this.$message({
  714. message: '请上传收费截图',
  715. type: 'warning',
  716. })
  717. return
  718. }
  719. this.chargeObj.collectionScreenshot = this.imageUrl.toString()
  720. this.$confirm(`确定提交收费信息?`, {
  721. cancelButtonText: '取消',
  722. confirmButtonText: '确定',
  723. type: 'warning',
  724. }).then(() => {
  725. storageFeeRecordCharge(this.chargeObj)
  726. .toPromise()
  727. .then((response) => {
  728. this.$message.success('收费成功!')
  729. this.chargeObj = {}
  730. this.collectForm = false
  731. this.getList()
  732. })
  733. })
  734. },
  735. handleSizeChange(val) {
  736. console.log(`每页 ${val} 条`)
  737. this.pageSize = val
  738. this.getList()
  739. },
  740. handleCurrentChange(val) {
  741. this.currentPage = val
  742. console.log(`当前页: ${val}`)
  743. this.getList()
  744. },
  745. }
  746. }
  747. </script>
  748. <style lang="scss" scoped>
  749. .avatar-uploader {
  750. position: relative;
  751. width: 80px;
  752. }
  753. .avatar-uploader .el-upload {
  754. border: 1px dashed #d9d9d9;
  755. border-radius: 6px;
  756. cursor: pointer;
  757. position: relative;
  758. overflow: hidden;
  759. width: 80px;
  760. }
  761. .avatar-uploader .el-upload:hover {
  762. border-color: #409eff;
  763. }
  764. .avatar-uploader-icon {
  765. font-size: 28px;
  766. color: #8c939d;
  767. width: 80px;
  768. height: 80px;
  769. line-height: 80px;
  770. text-align: center;
  771. border: 1px solid #8890b1;
  772. border-radius: 5px;
  773. }
  774. .avatar {
  775. width: 80px;
  776. height: 80px;
  777. border: 1px solid #8890b1;
  778. border-radius: 5px;
  779. display: block;
  780. }
  781. .top-btn {
  782. display: flex;
  783. justify-content: space-between;
  784. .el-date-editor {
  785. width: 220px !important;
  786. }
  787. .date-select {
  788. width: 240px;
  789. }
  790. }
  791. .top-btn-two {
  792. margin-top: 20px;
  793. .left {
  794. display: flex;
  795. }
  796. }
  797. .content-top {
  798. display: flex;
  799. margin-top: 20px;
  800. }
  801. .customer-item {
  802. margin-bottom: 0;
  803. display: flex;
  804. }
  805. .el-form-item__content {
  806. width: 100%;
  807. margin-left: 0 !important;
  808. }
  809. /deep/.el-form-item__content {
  810. margin-left: 0 !important;
  811. width: 200px;
  812. }
  813. .content-top-item {
  814. // background: red;
  815. margin-right: 20px;
  816. }
  817. .el-pagination {
  818. text-align: center;
  819. }
  820. .top-btn /deep/.el-date-editor {
  821. width: 300px !important;
  822. }
  823. .sk-dialog {
  824. /deep/.el-dialog {
  825. width: 300px !important;
  826. }
  827. }
  828. .sf-dialog {
  829. .row {
  830. display: flex;
  831. justify-content: space-between;
  832. align-items: center;
  833. margin: 10px 0;
  834. .right {
  835. width: 200px;
  836. }
  837. }
  838. .row-last {
  839. justify-content: space-around;
  840. }
  841. }
  842. .close-sfju-dialog {
  843. width: 100%;
  844. margin: 10px;
  845. display: flex;
  846. justify-content: center;
  847. align-items: center;
  848. }
  849. </style>