collectionManagement.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <!--收款管理-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="12">
  5. <template slot="left">
  6. <ws-button :type="searchType == 3 ? 'primary' : ''" @click="handlestatus(3)">待收款</ws-button>
  7. <ws-button :type="searchType == 4 ? 'primary' : ''" @click="handlestatus(4)">已收款</ws-button>
  8. <ws-button :type="searchType == '' ? 'primary' : ''" @click="handlestatus('')">全部</ws-button>
  9. <ws-button type="primary" @click="adopt" v-hasPermission=" `outbound.collectionOut.view`">备注</ws-button>
  10. <ws-button type="primary" @click="collect" v-hasPermission=" `outbound.collectionOut.new`">收款</ws-button>
  11. </template>
  12. <template slot="right">
  13. <el-col style="text-align: right; line-height: 60px; padding-right: 10px">
  14. <div class="el-input el-input--small el-input--suffix">
  15. <el-select v-model="contractNo" placeholder="请选择合同" clearable filterable @change="contractchange"
  16. maxlength="500" type="input" class="findValue">
  17. <el-option v-if="item.listStatus" v-for="item in options" :key="item.constKey"
  18. :label="item.contractNo + '(' + item.listStatus + ')'" :value="item.contractNo" />
  19. <el-option v-if="!item.listStatus" v-for="item in options" :key="item.constKey" :label="item.contractNo"
  20. :value="item.contractNo" />
  21. </el-select>
  22. </div>
  23. </el-col>
  24. </template>
  25. </BaseHeaderLayout>
  26. <el-table :data="collectList" style="width: 100%; margin-top: 20px" ref="collectList" border height="calc(100% - 110px)"
  27. @selection-change="handleSelectionChange">
  28. <el-table-column :selectable="selectInit" type="selection" width="55"></el-table-column>
  29. <el-table-column type="index" label="序号" width="50">
  30. <template scope="scope">
  31. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  32. <span v-else>{{ scope.$index + 1 }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column class="table_td" prop="carNo" label="车牌号"></el-table-column>
  36. <el-table-column class="table_td" prop="goodsName" label="货名"></el-table-column>
  37. <el-table-column class="table_td" prop="grossWeight" label="毛重(公斤)"></el-table-column>
  38. <el-table-column class="table_td" prop="tare" label="皮重(公斤)"></el-table-column>
  39. <el-table-column class="table_td" prop="netWeight" label="净重(公斤)"></el-table-column>
  40. <el-table-column class="table_td" prop="contractPrice" label="合同单价(元/公斤)" width="150"></el-table-column>
  41. <el-table-column width='150' class="table_td" prop="calculationCollectable" label="计算应收(元)"></el-table-column>
  42. <el-table-column class="table_td" width='200' prop="actualCollectionment" label="实际应收(元)">
  43. <template slot-scope="scope">
  44. <div class="inputChenge">
  45. <!-- readonly -->
  46. <el-input v-model="scope.row.actualCollectionment" v-if="scope.row.identification == 'true'"></el-input>
  47. <div v-if="scope.row.identification == 'false'" class="inputs">
  48. {{ scope.row.actualCollectionment }}
  49. </div>
  50. </div>
  51. <img width="17" height="18" style="vertical-align: text-top; position: relative; top: -1px"
  52. src="../../../public/img/edit.png" @click="whether(scope.row)" v-if="scope.row.identification == 'false'"
  53. alt="" />
  54. <i class="el-icon-check" style="line-height: 29px; margin-left: 10px"
  55. v-if="scope.row.identification == 'true'" @click="varietyClick(scope.row)"></i>
  56. <!-- <div>—</div> -->
  57. </template>
  58. </el-table-column>
  59. <el-table-column class="table_td" prop="amountEdCollectionable" label="已收款(元)">
  60. <template slot-scope="scope">
  61. <div @click="cellClick(scope.row)">{{scope.row.amountEdCollectionable}}</div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column class="table_td" prop="collectionDate" width="90" label="收款时间"></el-table-column>
  65. <el-table-column class="table_td" prop="status" label="状态"></el-table-column>
  66. <el-table-column class="table_td" prop="collectionEdPayable" label="操作" width="200"><template scope="scope">
  67. <el-button @click="collectment(2,scope.row)" v-hasPermission="`outbound.collectionOut.weight`">查看</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <el-dialog :visible.sync="isShowImgList" title="收款截图">
  72. <div v-for="(item,index) in imgList" :key="index" class="imgList-style">
  73. <img :src="item" alt="" class="img">
  74. </div>
  75. </el-dialog>
  76. <!-- 收款 -->
  77. <el-dialog width="25%" title="收款" :visible.sync="collectForm" :append-to-body="true">
  78. <el-form :model="form">
  79. <el-form-item label="未收金额(元)" :label-width="formLabelWidth">
  80. <el-input type='number' v-model="allmoney1" autocomplete="off" class="deal"></el-input>
  81. </el-form-item>
  82. <el-form-item label="本次收款金额(元)" :label-width="formLabelWidth">
  83. <el-input type='number' v-model="collectmoney" autocomplete="off" placeholder="请输入本次收款金额" class="deal"></el-input>
  84. </el-form-item>
  85. <el-form-item label="收款日期" prop="collectionDate" :label-width="formLabelWidth" class="deal">
  86. <ws-date-picker v-model="collectionDate" type="date" placeholder="请选择收款日期" value-format="yyyy-MM-dd"
  87. class="deal" />
  88. </el-form-item>
  89. <el-form-item label="上传收款截图" :label-width="formLabelWidth">
  90. <el-upload :action="global.uploadPath" list-type="picture-card"
  91. :on-success="handlePictureCardPreview1" :on-remove="handleRemove" class="photo2">
  92. <i class="el-icon-plus"></i>
  93. </el-upload>
  94. <el-dialog :visible.sync="dialogVisible">
  95. <img width="100%" :src="collectionScreenshot" alt="" />
  96. </el-dialog>
  97. </el-form-item>
  98. </el-form>
  99. <div slot="footer" class="dialog-footer">
  100. <el-button @click="collectForm = false">取 消</el-button>
  101. <el-button type="primary" @click="collectSubmit">提 交</el-button>
  102. </div>
  103. </el-dialog>
  104. <!--备注-->
  105. <el-dialog width="25%" title="备注" :visible.sync="collectForm1" :append-to-body="true">
  106. <el-form :model="form">
  107. <div class="beizhu">
  108. <el-input v-model="remarks" autocomplete="off" placeholder="备注信息,不超过1000字" class="deal"></el-input>
  109. </div>
  110. </el-form>
  111. <div slot="footer" class="dialog-footer">
  112. <el-button @click="collectForm1 = false">取 消</el-button>
  113. <el-button type="primary" @click="adoptRemarks()">保存</el-button>
  114. </div>
  115. </el-dialog>
  116. <!-- <houseSelfCollectPrint v-show="false"></houseSelfCollectPrint> -->
  117. <div style="text-align: center">
  118. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  119. :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper"
  120. :total="deptBudgetTotal">
  121. </el-pagination>
  122. </div>
  123. </div>
  124. </template>
  125. <script>
  126. import {
  127. getcollection,
  128. editcollect,
  129. remarksAdd,
  130. moneyCollection,
  131. contractList
  132. } from '@/model/outboundManagement/index'
  133. export default {
  134. watch: {},
  135. data() {
  136. return {
  137. imgList: [],
  138. isShowImgList: false,
  139. //分页
  140. currentPage: 1,
  141. pageSize: 10,
  142. allmoney1: 0,
  143. deptCircularPage: {},
  144. deptBudgetTotal: 0,
  145. warehouseList: [{
  146. collectionEdPayable: '快收款',
  147. }, ],
  148. options: [],
  149. contractNoList: [],
  150. contractNo: '全部合同',
  151. dialogVisible: false,
  152. form: {},
  153. compId: localStorage.getItem('ws-pf_compId'),
  154. collectForm: false,
  155. collectForm1: false,
  156. managementType: 3,
  157. remarks: '',
  158. money: 0,
  159. // id:'',
  160. collectmoney: 0,
  161. paymentManagementList: [],
  162. collectionManagement: {
  163. paymentManagementList: [],
  164. remarks: '',
  165. },
  166. collectList: [],
  167. collectionDate: '',
  168. collectionScreenshot: '',
  169. amountEdCollectionable: '',
  170. actualCollectionment: '',
  171. // collectDate: '',
  172. calculationCollectable: '',
  173. searchType: '',
  174. searchTypeText: '',
  175. formLabelWidth: '120px',
  176. searchKeyWord: '',
  177. value1: '', //收款日期
  178. modification: [],
  179. }
  180. },
  181. activated() {
  182. this.getList()
  183. },
  184. methods: {
  185. cellClick(row) {
  186. this.imgList = row.collectionScreenshot.split('$')
  187. this.isShowImgList = true
  188. // console.log(val)
  189. // console.log(val2)
  190. // console.log(val3)
  191. // console.log(event)
  192. console.log(row)
  193. },
  194. contractchange(e) {
  195. this.contractNo = e
  196. this.getList()
  197. },
  198. //修改实际应收
  199. varietyClick(row) {
  200. if (
  201. row.actualCollectionment < 0 ||
  202. row.actualCollectionment > 1000000 ||
  203. (String(row.actualCollectionment).indexOf('.') != -1 &&
  204. String(row.actualCollectionment).length -
  205. (String(row.actualCollectionment).indexOf('.') + 1) >
  206. 2)
  207. ) {
  208. this.$message({
  209. message: '实际应收输入错误',
  210. type: 'warning',
  211. })
  212. return
  213. }
  214. if (!row.actualCollectionment) {
  215. this.$message({
  216. message: '实际应收不能为空',
  217. type: 'warning',
  218. })
  219. return
  220. }
  221. if (row.actualCollectionment < row.amountEdCollectionable) {
  222. this.$message({
  223. message: '实际应收不能小于已收款',
  224. type: 'warning',
  225. })
  226. return
  227. }
  228. this.$confirm(`确定要修改实际应收?`, {
  229. confirmButtonText: '确定',
  230. cancelButtonText: '取消',
  231. type: 'warning',
  232. })
  233. .then(() => {
  234. editcollect({
  235. actualCollectionment: row.actualCollectionment,
  236. amountNotCollectable: row.actualCollectionment - row.amountEdCollectionable,
  237. id: row.id,
  238. })
  239. .toPromise()
  240. .then((response) => {
  241. this.$notify.success({
  242. title: '成功',
  243. message: '修改成功',
  244. })
  245. this.getList()
  246. })
  247. .catch((response) => {})
  248. })
  249. .catch(() => {
  250. return false
  251. })
  252. },
  253. whether(row) {
  254. row.identification = 'true'
  255. },
  256. handlestatus(status) {
  257. this.searchType = status
  258. this.getList()
  259. },
  260. // ,relationId :row.relationId
  261. collectment(index, row) {
  262. this.$router.push({
  263. path: 'collectionment',
  264. query: {
  265. type: index,
  266. id: row.id,
  267. relationId: row.relationId,
  268. compId: localStorage.getItem('ws-pf_compId')
  269. }
  270. })
  271. // this.$router.push({ path: 'settlement', query: { type: index,id: row.id,waterMin:data1.waterMin} })
  272. },
  273. collect() {
  274. this.allmoney1 = 0
  275. if (this.modification.length == 0) {
  276. this.$message.warning('请选择一条要收款的条目')
  277. } else {
  278. for (var i = 0; i < this.modification.length; i++) {
  279. this.allmoney1 += this.modification[i].actualCollectionment - this.modification[i].amountEdCollectionable
  280. }
  281. this.collectForm = true
  282. }
  283. },
  284. collectSubmit() {
  285. if (!this.collectionScreenshot) {
  286. this.$message({
  287. message: '请上传收款截图',
  288. type: 'warning',
  289. })
  290. return
  291. }
  292. this.$confirm(`确定提交收款信息?`, {
  293. cancelButtonText: '取消',
  294. confirmButtonText: '确定',
  295. type: 'warning',
  296. }).then(() => {
  297. moneyCollection({
  298. paymentManagementList: this.modification,
  299. money: this.collectmoney,
  300. collectionDate: this.collectionDate,
  301. collectionScreenshot: this.collectionScreenshot,
  302. })
  303. .toPromise()
  304. .then((response) => {
  305. this.$message.success('收款成功')
  306. this.collectmoney = ''
  307. this.collectionDate = ''
  308. this.collectionScreenshot = ''
  309. this.collectForm = false
  310. this.getList()
  311. })
  312. })
  313. },
  314. //添加备注信息
  315. adopt() {
  316. this.remarks = this.remarks
  317. this.paymentManagementList = this.collectList[0].paymentManagementList
  318. if (this.modification.length == 0) {
  319. this.$message.warning('请选择要备注的条目')
  320. } else {
  321. this.collectForm1 = true
  322. }
  323. },
  324. adoptRemarks() {
  325. this.collectionManagement.remarks = this.remarks
  326. this.$confirm(`确定要保存备注信息?`, {
  327. confirmButtonText: '确定',
  328. cancelButtonText: '取消',
  329. type: 'warning',
  330. })
  331. .then(() => {
  332. remarksAdd({
  333. paymentManagementList: this.modification,
  334. remarks: this.remarks
  335. })
  336. .toPromise()
  337. .then(() => {
  338. this.collectForm1 = false
  339. this.$message.success('添加备注信息成功')
  340. this.paymentManagementList = {}
  341. this.getList()
  342. })
  343. .catch(() => {
  344. return false
  345. })
  346. })
  347. },
  348. handlePictureCardPreview1(file) {
  349. this.collectionScreenshot = file.data.url
  350. },
  351. dataFilter(val) {
  352. // console.log(val,"名")
  353. this.contractNo = val
  354. if (val) {
  355. //val存在
  356. this.options = this.contractNoList.filter(item => {
  357. if (
  358. !!~item.contractNo.indexOf(val) ||
  359. !!~item.contractNo.toUpperCase().indexOf(val.toUpperCase())
  360. ) {
  361. return true
  362. }
  363. })
  364. } else {
  365. //val为空时,还原数组
  366. this.options = this.contractNoList
  367. }
  368. },
  369. selectInit(row) {
  370. //在这里一定要记得类型匹配的上。
  371. if (row.approveStatus == null) {
  372. return true
  373. } else if (row.approveStatus != null) {
  374. if (row.taskId == null) {
  375. return false
  376. } else {
  377. return true
  378. }
  379. }
  380. },
  381. getList() {
  382. getcollection({
  383. managementType: this.managementType,
  384. currentPage: this.currentPage,
  385. pageSize: this.pageSize,
  386. searchKeyWord: this.searchKeyWord,
  387. searchType: this.searchType,
  388. warehouseName: this.warehouseName,
  389. contractNo: this.contractNo,
  390. }).toPromise().then((response) => {
  391. for (var i = 0; i < response.records.length; i++) {
  392. response.records[i].identification = 'false'
  393. response.records[i].contractPrice = response.records[i].contractPrice * 1000
  394. }
  395. this.collectList = response.records
  396. this.deptBudgetTotal = response.total
  397. })
  398. contractList({
  399. compId: localStorage.getItem('ws-pf_compId'),
  400. currentPage: this.currentPage,
  401. pageSize: this.pageSize,
  402. })
  403. .toPromise()
  404. .then((response) => {
  405. this.contractNoList = response
  406. this.contractNoList.unshift({
  407. contractNo: '全部合同'
  408. })
  409. this.options = this.contractNoList
  410. console.log(this.options[0].listStatus)
  411. })
  412. },
  413. handleRemove(file) {
  414. console.log(file)
  415. },
  416. handleSelectionChange(val) {
  417. this.modification = val
  418. },
  419. selecttaskType() {},
  420. handleSizeChange(val) {
  421. console.log(`每页 ${val} 条`)
  422. this.pageSize = val
  423. this.getList()
  424. },
  425. handleCurrentChange(val) {
  426. this.currentPage = val
  427. console.log(`当前页: ${val}`)
  428. this.getList()
  429. },
  430. },
  431. }
  432. </script>
  433. <style lang="scss" scoped>
  434. .ws-info-table {
  435. border: none;
  436. }
  437. .ws-info-table .el-form-item {
  438. width: 50%;
  439. border: none;
  440. }
  441. /deep/.ws-info-table .el-form-item .el-form-item__label {
  442. width: 30%;
  443. text-align: center;
  444. background: #ffffff;
  445. color: #8890b1;
  446. }
  447. /deep/.ws-info-table .el-form-item .el-form-item__content {
  448. border: none;
  449. }
  450. .title {
  451. font-size: 16px;
  452. font-weight: 600;
  453. }
  454. .formItem {
  455. width: 70% !important;
  456. }
  457. /deep/.el-table .el-table__header .cell,
  458. .el-table .el-table__body .cell {
  459. text-align: center;
  460. }
  461. /deep/.el-table--enable-row-transition .el-table__body td {
  462. text-align: center;
  463. }
  464. /deep/.beizhu .el-input--small .el-input__inner {
  465. height: 220px;
  466. line-height: 28px;
  467. }
  468. .inputChenge {
  469. width: 40%;
  470. display: inline-flex;
  471. }
  472. .deal {
  473. width: 66%;
  474. }
  475. .inputs {
  476. margin: 0 auto;
  477. }
  478. .el-col-8 {
  479. width: 33.33333%;
  480. }
  481. /deep/.findValue .el-input__inner {
  482. border-top-right-radius: 0px;
  483. border-bottom-right-radius: 0px;
  484. width: 385px;
  485. }
  486. /deep/.el-select .el-input .el-input--small .el-input--suffix {
  487. display: block;
  488. font-size: 13px;
  489. margin-left: -67px;
  490. }
  491. .imgList-style {
  492. width: 50%;
  493. display: inline-block;
  494. .img {
  495. width: 100%;
  496. height: 300px;
  497. }
  498. }
  499. </style>