purchaseContractCost.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. <!--现货采购合同费用-->
  2. <!--2019年5月30日 20:25:16 by jlx-->
  3. <template>
  4. <div>
  5. <BaseHeaderLayout :leftSpan="8">
  6. <template slot="left">
  7. <el-select style='width:200px;' filterable v-model="searchTypeText" placeholder="" class="typeselect" @change="selectcontract"
  8. :value="searchType">
  9. <el-option v-for="item in contractList" :key="item.id" :label="item.contractNo+'('+item.status+')'" :value="item.contractNo"
  10. style="color: #8890b1" />
  11. </el-select>
  12. <span style='padding-left:10px;'>卖方:{{seller}}</span>
  13. </template>
  14. <template slot="right">
  15. </template>
  16. </BaseHeaderLayout>
  17. <BaseHeaderLayout :leftSpan="16">
  18. <template slot="left">
  19. <ws-button :type="type==''?'primary':''" @click="handlestatus('')">全部</ws-button>
  20. <ws-button :type="type=='1'?'primary':''" @click="handlestatus(1)">收入</ws-button>
  21. <ws-button :type="type=='2'?'primary':''" @click="handlestatus(2)">支出</ws-button>
  22. <span style='padding-left:10px;'>粮款:{{grain}}</span>
  23. <span style='padding-left:10px;'>合计收入:{{income}}</span>
  24. <span style='padding-left:10px;'>合计支出:{{expend}}</span>
  25. <span style='padding-left:10px;'>付款中:{{nograinexpend}}</span>
  26. </template>
  27. <template slot="right">
  28. <!-- <ws-button type="primary" @click="handleAdd()"
  29. v-hasPermission="`contractManagement.buyContract.buyContractInfo.add`">运费</ws-button> -->
  30. <ws-button type="primary" @click="handleAdd(2)"
  31. v-hasPermission="`contractManagement.nonContract.nonContractInfo.add`">请款</ws-button>
  32. <ws-button type="primary" @click="handleAdd(1)"
  33. v-hasPermission="`contractManagement.nonContract.nonContractInfo.add`">收款</ws-button>
  34. </template>
  35. </BaseHeaderLayout>
  36. <el-table class="wenzi" :data="costList.records" style="width: 100%; margin-top: 10px"
  37. height="calc(100% - 105px)">
  38. <el-table-column type="index" label="序号">
  39. <template scope="scope">
  40. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  41. <span v-else>{{ scope.$index + 1 }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="type" label="类型" width="150">
  45. <template slot-scope="scope">
  46. <span v-if='scope.row.type==1&&scope.row.costType==1'>收入(粮)</span>
  47. <span v-if='scope.row.type==1&&scope.row.costType!=1'>收入</span>
  48. <span v-if='scope.row.type==2&&scope.row.costType==1'>支出(粮)</span>
  49. <span v-if='scope.row.type==2&&scope.row.costType!=1'>支出</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="costName" label="款项名称" width="80">
  53. </el-table-column>
  54. <!-- <el-table-column prop="grade" label="品级" width="80">
  55. <template slot-scope="scope">
  56. <span v-if="scope.row.grade == '一等品'" class="top-grade">{{
  57. scope.row.grade
  58. }}</span>
  59. <span v-if="scope.row.grade == '二等品'" class="second-class">{{
  60. scope.row.grade
  61. }}</span>
  62. <span v-if="scope.row.grade == '三等品'" class="third-class">{{
  63. scope.row.grade
  64. }}</span>
  65. <span v-if="scope.row.grade == '等外'" class="substandard">{{
  66. scope.row.grade
  67. }}</span>
  68. </template>
  69. </el-table-column> -->
  70. <el-table-column width='130' prop="costPrice" label="款项金额(元)">
  71. </el-table-column>
  72. <el-table-column prop="addressUrl" label="附件">
  73. <template slot-scope="scope">
  74. <img width="18" height="20" style="vertical-align: text-top; position: relative; top: -1px"
  75. src="../../../public/img/fujian.png" @click="fujian(scope.row)" alt="" />
  76. <span v-if="scope.row.addressUrlArray != null">
  77. {{
  78. scope.row.addressUrlArray.length == 0
  79. ? ''
  80. : scope.row.addressUrlArray.length
  81. }}
  82. </span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column width='130' prop="personName" label="请款人/收款人">
  86. </el-table-column>
  87. <el-table-column width='130' prop="payee" label="回款方">
  88. </el-table-column>
  89. <el-table-column width='130' prop="payDeadline" label="支付日期">
  90. </el-table-column>
  91. <el-table-column width='130' prop="createDate" label="录入日期">
  92. </el-table-column>
  93. <el-table-column width='130' prop="status" label="状态">
  94. <template slot-scope="scope">
  95. <span v-if='scope.row.approveStatus'>{{scope.row.approveStatus}}</span><span v-else>{{scope.row.status}}</span>
  96. <i @click="handlerecord(scope.row)" class="el-icon-s-claim"></i>
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="address" label="操作" width="360">
  100. <template slot-scope="scope">
  101. <div v-if='scope.row.type==2'>
  102. <div style='display:inline-block;' v-if='scope.row.taskId'>
  103. <ws-button type="primary" @click="handleaudit(scope.row)">审核</ws-button>
  104. </div>
  105. <div style='display:inline-block;' v-if='scope.row.status=="未付款"'>
  106. <ws-button type="primary" @click="handlepayment(scope.row)"
  107. v-hasPermission="`contractManagement.nonContract.nonContractInfo.status`">付款</ws-button>
  108. </div>
  109. <div style='display:inline-block;' v-if='scope.row.personName==staffName'>
  110. <ws-button type="primary" @click="handleedit(scope.row)"
  111. v-hasPermission="`contractManagement.nonContract.nonContractInfo.edit`">编辑</ws-button>
  112. </div>
  113. <div style='display:inline-block;' v-if='scope.row.status=="已驳回"&&scope.row.personName==staffName'>
  114. <ws-button type="danger" @click="handleDelete(scope.row)" v-hasPermission="`contractManagement.nonContract.nonContractInfo.delete`">删除</ws-button>
  115. </div>
  116. </div>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  121. :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
  122. </el-pagination>
  123. <WinseaContentModal v-model="accessoryTFs" :title="$t('system.noticeCircular.information')">
  124. <div v-if='appendixIdss.length>0'>
  125. <img style='border:1px solid #ccc;' v-for='item in appendixIdss' :src="item" alt="">
  126. </div>
  127. </WinseaContentModal>
  128. <el-dialog width='50%' :visible.sync="dialogVisible" :title="title" >
  129. <el-form style='width:50%;margin:0 auto;text-align:center;' ref="form" :model="deptBudgetList" label-width="130px">
  130. <el-form-item v-if='status==1||status==2||status==5' label="类型">
  131. <el-radio-group v-model="costType">
  132. <el-radio :label="1">粮款</el-radio>
  133. <el-radio :label="2">非粮款</el-radio>
  134. </el-radio-group>
  135. </el-form-item>
  136. <el-form-item v-else label="类型">
  137. <ws-select :disabled="disabled" v-model="costType" placeholder="" class="typeselect"
  138. :value="costType">
  139. <ws-option key="1" label="粮款" value="1" style="color: #8890b1" />
  140. <ws-option key="2" label="非粮款" value="2" style="color: #8890b1" />
  141. </ws-select>
  142. </el-form-item>
  143. <el-form-item label="款项名称">
  144. <el-input :disabled='disabled' v-model="deptBudgetList.costName"></el-input>
  145. </el-form-item>
  146. <!-- <el-form-item label="费用名称">
  147. <el-input :disabled='disabled' v-model="deptBudgetList.costName"></el-input>
  148. </el-form-item> -->
  149. <el-form-item label="金额(元)">
  150. <el-input :disabled='disabled' v-model="deptBudgetList.costPrice"></el-input>
  151. </el-form-item>
  152. <el-form-item v-if='status==1||currectcost.type==1' label="回款方">
  153. <el-input :disabled='disabled' v-model="deptBudgetList.payee"></el-input>
  154. </el-form-item>
  155. <el-form-item label="备注">
  156. <el-input :disabled='disabled' type="textarea" v-model="deptBudgetList.remark"></el-input>
  157. </el-form-item>
  158. <el-form-item label="附件">
  159. <el-upload ref='uploadfiles' :file-list='dataList' action="https://www.zthymaoyi.com/upload/admin" list-type="picture-card"
  160. :on-success="handlefujian" :on-remove="handleRemove" class="photo2">
  161. <i class="el-icon-plus"></i>
  162. </el-upload>
  163. </el-form-item>
  164. <el-form-item v-if='status==3' label="审核意见">
  165. <el-input type="textarea" v-model="auditMind"></el-input>
  166. </el-form-item>
  167. <el-form-item v-if='status==1' label="收款日期">
  168. <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择收款日期"
  169. value-format="yyyy-MM-dd" />
  170. </el-form-item>
  171. <el-form-item v-if='status==4' label="付款日期">
  172. <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择付款日期"
  173. value-format="yyyy-MM-dd" />
  174. </el-form-item>
  175. </el-form>
  176. <div v-if='status==1||status==2||status==4||status==5'>
  177. <el-button @click='dialogVisible=false'>取消</el-button>
  178. <el-button @click='confirm' type="primary">提交</el-button>
  179. </div>
  180. <div v-if='status==3'>
  181. <el-button @click='cancel'>驳回</el-button>
  182. <el-button @click='confirm' type="primary">通过</el-button>
  183. </div>
  184. </el-dialog>
  185. <el-dialog width='50%' :visible.sync="dialogVisible1" title="审核记录" >
  186. <div v-for="item in recordList">
  187. <div style='width:100%;justify-content: space-between;' class='flex'>
  188. <div>{{item.operateUser}}</div>
  189. <div>{{item.dealMsg}}</div>
  190. <div>{{item.createDate}}</div>
  191. </div>
  192. <div style='width:100%;text-align:center;'>{{item.verifyRemark}}</div>
  193. </div>
  194. </el-dialog>
  195. </div>
  196. </template>
  197. <script>
  198. import {
  199. contractcost,
  200. getcontract,
  201. addcontractcost,
  202. editcontractcost,
  203. delcontractcost,
  204. payment,
  205. billoperatehis
  206. // export1,
  207. // editstatus,
  208. // billoperatehis,
  209. // deletecontract,
  210. // editInfo,
  211. } from '@/model/contarct/index'
  212. import {
  213. woekflowhandle,gettaskhistories
  214. } from '@/model/tasksport/index'
  215. import {
  216. downloadFile
  217. } from '@/utils/batchDown'
  218. import Pagination from '@/components/Pagination'
  219. import WsUpload from '@/components/WsUpload'
  220. import {
  221. dayjs,
  222. EventBus
  223. } from 'base-core-lib'
  224. export default {
  225. name: 'viewSpareMoney',
  226. components: {
  227. WsUpload,
  228. Pagination,
  229. },
  230. watch: {
  231. vesselId(val) {
  232. this.getList()
  233. },
  234. isShow(val) {
  235. this.showType = val
  236. },
  237. },
  238. data() {
  239. return {
  240. id: '',
  241. // 船舶类型
  242. monetaryKey: null,
  243. // 表格显示数据
  244. tableDate: [],
  245. size: 10,
  246. // 是否显示
  247. showType: true,
  248. // 年
  249. year: '',
  250. title:'',
  251. costType:1,
  252. seller:'',
  253. deptBudgetTotal: 0,
  254. currentPage: 1,
  255. recordList:[],
  256. pageSize: 9999,
  257. searchType: 1,
  258. dialogVisible1:false,
  259. type:'',
  260. searchTypeText: '',
  261. searchKeyWord: '',
  262. contractType: 2,
  263. dataList:[],
  264. startDate: null,
  265. endDate: null,
  266. addressUrls: [],
  267. costList:{},
  268. currectcost:{},
  269. dialogVisible:false,
  270. contractId:0,
  271. status:'',
  272. contractNo:'',
  273. disabled:false,
  274. // 提交类型
  275. submitType: true,
  276. auditMind:'',
  277. grain:0,
  278. income:0,
  279. expend:0,
  280. nograinexpend:0,
  281. staffName:localStorage.getItem('ws-pf_staffName'),
  282. paymentScreenshot:[],
  283. deptCircularPage: {},
  284. date: {
  285. year: dayjs().format('YYYY'),
  286. month: dayjs().format('MM'),
  287. },
  288. contractList: [],
  289. deptBudgetList: {},
  290. historyList: [],
  291. appendixIdss: [],
  292. compId: localStorage.getItem('ws-pf_compId'),
  293. pickerBeginDateBefore: {
  294. disabledDate: (time) => {
  295. return time.getTime() > Date.now()
  296. },
  297. },
  298. accessoryTFs: false,
  299. value1: '',
  300. value2: '',
  301. }
  302. },
  303. activated() {
  304. //cg.viewBudget
  305. //cg.viewSpareMoney
  306. // this.getVesselData();
  307. this.contractId=this.$route.query.id
  308. this.contractNo=this.$route.query.contractNo
  309. this.searchTypeText=this.$route.query.contractNo+'('+this.$route.query.status+')'
  310. this.seller=this.$route.query.seller
  311. getcontract({flag:0}).toPromise()
  312. .then((response) => {
  313. this.contractList=response
  314. // this.contractId=response[0].id
  315. // this.contractNo=response[0].contractNo
  316. // this.searchTypeText=response[0].contractNo
  317. // this.seller=response[0].seller
  318. this.getList()
  319. })
  320. this.showType = this.isShow
  321. },
  322. methods: {
  323. handlestatus(status){
  324. this.type=status
  325. this.getList()
  326. },
  327. handleedit(row){
  328. if(row.type==1){
  329. this.title='收款'
  330. }else{
  331. this.title='请款'
  332. }
  333. this.status=5
  334. this.deptBudgetList=row
  335. this.costType=row.costType
  336. if(row.addressUrl){
  337. this.dataList=[]
  338. this.paymentScreenshot=row.addressUrl.split(',')
  339. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  340. this.dataList.push({url:this.paymentScreenshot[i]})
  341. }
  342. }
  343. this.currectcost=row
  344. this.dialogVisible=true
  345. },
  346. handlerecord(row){
  347. billoperatehis({id: row.id}).toPromise()
  348. .then((response) => {
  349. this.recordList=response
  350. this.dialogVisible1=true
  351. }).catch((response) => {})
  352. },
  353. handleaudit(row){
  354. console.log(row)
  355. this.status=3
  356. this.costType=row.costType
  357. this.deptBudgetList=row
  358. this.currectcost=row
  359. if(row.addressUrl){
  360. this.dataList=[]
  361. this.paymentScreenshot=row.addressUrl.split(',')
  362. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  363. this.dataList.push({url:this.paymentScreenshot[i]})
  364. }
  365. }
  366. this.disabled=true
  367. this.dialogVisible=true
  368. },
  369. handlepayment(row){
  370. this.status=4
  371. this.costType=row.costType
  372. this.currectcost=row
  373. this.disabled=true
  374. this.deptBudgetList=row
  375. if(row.addressUrl){
  376. this.dataList=[]
  377. this.paymentScreenshot=row.addressUrl.split(',')
  378. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  379. this.dataList.push({url:this.paymentScreenshot[i]})
  380. }
  381. }
  382. this.dialogVisible=true
  383. },
  384. handlefujian(file) {
  385. // console.log(file)
  386. this.paymentScreenshot.push(file.url)
  387. // this.dialogVisible = true
  388. },
  389. handleRemove(file) {
  390. // console.log(file)
  391. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  392. if(this.paymentScreenshot[i]==response.url){
  393. this.paymentScreenshot.splice(i, 1)
  394. }
  395. }
  396. },
  397. handleSizeChange(val) {
  398. console.log(`每页 ${val} 条`)
  399. this.pageSize = val
  400. this.getList()
  401. },
  402. handleCurrentChange(val) {
  403. this.currentPage = val
  404. console.log(`当前页: ${val}`)
  405. this.getList()
  406. },
  407. selectcontract(e){
  408. for (let i = 0; i < this.contractList.length; i++) {
  409. if(this.contractList[i].contractNo==e){
  410. this.contractId=this.contractList[i].id
  411. this.contractNo=this.contractList[i].contractNo
  412. this.searchTypeText=this.contractList[i].contractNo
  413. this.seller=this.contractList[i].seller
  414. this.getList()
  415. }
  416. }
  417. },
  418. cancel(){
  419. woekflowhandle({taskId: this.currectcost.taskId,
  420. approved: false,
  421. auditMind: this.auditMind,
  422. needReapply: false,})
  423. .toPromise()
  424. .then((response) => {
  425. this.$notify.success({
  426. title: '成功',
  427. message: '驳回成功',
  428. })
  429. this.dialogVisible=false
  430. this.deptBudgetList={}
  431. this.paymentScreenshot=[]
  432. this.$refs.uploadfiles.clearFiles()
  433. this.getList()
  434. }).catch((response) => {})
  435. },
  436. confirm(){
  437. // addcontractcost()
  438. var text = ''
  439. if(this.status == 2||this.status == 1){
  440. if(!this.deptBudgetList.costName){
  441. this.$message({
  442. message: '款项名称不能为空',
  443. type: 'warning',
  444. })
  445. return
  446. }
  447. if(!this.deptBudgetList.costPrice){
  448. this.$message({
  449. message: '金额不能为空',
  450. type: 'warning',
  451. })
  452. return
  453. }
  454. if(this.deptBudgetList.costName.length<1||this.deptBudgetList.costName.length>15){
  455. this.$message({
  456. message: '费用名称输入错误',
  457. type: 'warning',
  458. })
  459. return
  460. }
  461. if(this.deptBudgetList.costPrice<0.01||this.deptBudgetList.costPrice>100000000){
  462. this.$message({
  463. message: '费用名称输入错误',
  464. type: 'warning',
  465. })
  466. return
  467. }
  468. if(String(this.deptBudgetList.costPrice).indexOf(".")!=-1){
  469. if(String(this.deptBudgetList.costPrice).substring(String(this.deptBudgetList.costPrice).indexOf(".")+1,this.deptBudgetList.costPrice.length)>2){
  470. this.$message({
  471. message: '费用名称输入错误',
  472. type: 'warning',
  473. })
  474. return
  475. }
  476. }
  477. if(this.deptBudgetList.remark&&this.deptBudgetList.remark.length<0||this.deptBudgetList.remark&&this.deptBudgetList.remark.length>50){
  478. this.$message({
  479. message: '备注不超过50字',
  480. type: 'warning',
  481. })
  482. return
  483. }
  484. }
  485. if(this.status == 1){
  486. if(this.paymentScreenshot.length==0){
  487. this.$message({
  488. message: '附件不能为空',
  489. type: 'warning',
  490. })
  491. return
  492. }
  493. }
  494. if (this.status == 2||this.status == 5&&this.currectcost.type==2) {
  495. text =
  496. '确认提交请款信息?'
  497. } else if(this.status == 1) {
  498. text = '确认提交收款信息?'
  499. } else if(this.status == 3&&this.currectcost.type==2) {
  500. text = '确认通过请款信息?'
  501. }else if(this.status == 4) {
  502. text = '确认提交付款信息?'
  503. }
  504. this.$confirm(text, '提示', {
  505. confirmButtonText: '确定',
  506. cancelButtonText: '取消',
  507. type: 'warning',
  508. })
  509. .then(() => {
  510. this.deptBudgetList.contractId=this.contractId
  511. this.deptBudgetList.contractNo=this.contractNo
  512. this.deptBudgetList.contractType=this.contractType
  513. this.deptBudgetList.costType=this.costType
  514. this.deptBudgetList.compId=this.compId
  515. this.deptBudgetList.addressUrl=this.paymentScreenshot.toString()
  516. this.deptBudgetList.personName=localStorage.getItem('ws-pf_staffName')
  517. if(this.status==1||this.status==2){
  518. this.deptBudgetList.type=this.status
  519. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  520. addcontractcost(this.deptBudgetList)
  521. .toPromise()
  522. .then((response) => {
  523. this.$notify.success({
  524. title: '成功',
  525. message: '提交成功',
  526. })
  527. this.dialogVisible=false
  528. this.deptBudgetList={}
  529. this.paymentScreenshot=[]
  530. this.$refs.uploadfiles.clearFiles()
  531. this.getList()
  532. }).catch((response) => {})
  533. }else if(this.status==5){
  534. this.deptBudgetList.type=this.currectcost.type
  535. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  536. editcontractcost(this.deptBudgetList)
  537. .toPromise()
  538. .then((response) => {
  539. this.$notify.success({
  540. title: '成功',
  541. message: '编辑成功',
  542. })
  543. this.dialogVisible=false
  544. this.deptBudgetList={}
  545. this.paymentScreenshot=[]
  546. this.$refs.uploadfiles.clearFiles()
  547. this.getList()
  548. }).catch((response) => {})
  549. }else if(this.status==3){
  550. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  551. woekflowhandle({taskId: this.currectcost.taskId,
  552. approved: true,
  553. auditMind: this.auditMind,
  554. needReapply: false,})
  555. .toPromise()
  556. .then((response) => {
  557. this.$notify.success({
  558. title: '成功',
  559. message: '通过成功',
  560. })
  561. this.dialogVisible=false
  562. this.deptBudgetList={}
  563. this.paymentScreenshot=[]
  564. this.$refs.uploadfiles.clearFiles()
  565. this.getList()
  566. }).catch((response) => {})
  567. }else if(this.status==4){
  568. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  569. payment(this.deptBudgetList)
  570. .toPromise()
  571. .then((response) => {
  572. this.$notify.success({
  573. title: '成功',
  574. message: '付款成功',
  575. })
  576. this.dialogVisible=false
  577. this.deptBudgetList={}
  578. this.paymentScreenshot=[]
  579. this.$refs.uploadfiles.clearFiles()
  580. this.getList()
  581. }).catch((response) => {})
  582. }
  583. })
  584. .catch(() => {
  585. return false
  586. })
  587. },
  588. handleAdd(status){
  589. this.status=status
  590. if(status==1){
  591. this.title='收款'
  592. }else if(status==2){
  593. this.title='请款'
  594. }
  595. this.dialogVisible=true
  596. },
  597. onChange() {
  598. this.$refs.upload
  599. .handleSaveBill()
  600. .then(async (response) => {
  601. this.deptBudgetList.addressUrl = response
  602. this.deptBudgetList.id = this.id
  603. this.deptBudgetList.flag = 1
  604. editInfo(this.deptBudgetList)
  605. .toPromise()
  606. .then((response) => {
  607. this.accessoryTFs = false
  608. this.$message.success('上传成功')
  609. this.getList()
  610. })
  611. })
  612. .catch((res) => {
  613. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  614. this.$refs.upload.clearFiles()
  615. })
  616. },
  617. getList() {
  618. contractcost({
  619. compId: localStorage.getItem('ws-pf_compId'),
  620. contractType: this.contractType,
  621. currentPage: this.currentPage,
  622. pageSize: this.pageSize,
  623. contractId:this.contractId,
  624. contractNo:this.contractNo,
  625. searchType:this.type
  626. })
  627. .toPromise()
  628. .then((response) => {
  629. var income=0,expend=0,grainincome=0,grainexpend=0,nograinexpend=0
  630. this.costList=response
  631. for (var i = 0; i < response.records.length; i++) {
  632. if(response.records[i].addressUrl){
  633. response.records[i].addressUrlArray=response.records[i].addressUrl.split(',')
  634. }
  635. // 收入
  636. if(response.records[i].type==1){
  637. income+=response.records[i].costPrice
  638. if(response.records[i].costType==1){
  639. grainincome+=response.records[i].costPrice
  640. }
  641. }
  642. // 支出
  643. if(response.records[i].type==2){
  644. expend+=response.records[i].costPrice
  645. if(response.records[i].costType==1&&response.records[i].status=='已付款'){
  646. grainexpend+=response.records[i].costPrice
  647. }else{
  648. nograinexpend+=response.records[i].costPrice
  649. }
  650. }
  651. }
  652. console.log(grainexpend,grainincome)
  653. this.income=income.toFixed(2)
  654. this.expend=expend.toFixed(2)
  655. this.grain=(grainexpend-grainincome).toFixed(2)
  656. this.nograinexpend=nograinexpend.toFixed(2)
  657. // this.deptCircularPage.currentPage = response.current
  658. // this.deptCircularPage.pageSize = response.size
  659. // this.deptBudgetTotal = response.total
  660. // this.contractList = response
  661. // for (var i = 0; i < response.records.length; i++) {
  662. // var arr = new Array()
  663. // this.addressUrls[i] = new Array()
  664. // if (this.contractList.records[i].addressUrl != null) {
  665. // arr = this.contractList.records[i].addressUrl.split(',')
  666. // this.addressUrls[i] = arr
  667. // }
  668. // }
  669. })
  670. },
  671. fujian(row) {
  672. this.id = row.id
  673. this.accessoryTFs = true
  674. this.appendixIdss = row.addressUrlArray
  675. console.log(this.appendixIdss)
  676. },
  677. handleExamine(row) {
  678. console.log(row)
  679. this.$router.push({
  680. name: 'purchaseContractExamine',
  681. query: {
  682. id: row.id,
  683. status: row.status,
  684. },
  685. })
  686. },
  687. handleEdit(row) {
  688. this.$router.push({
  689. name: 'purchaseContractEdit',
  690. query: {
  691. id: row.id,
  692. },
  693. })
  694. },
  695. // 关闭 dialog时 处理文件url 初始化upload组件
  696. history(row) {
  697. console.log(row)
  698. billoperatehis({
  699. id: row.id,
  700. })
  701. .toPromise()
  702. .then((response) => {
  703. this.historyList = response
  704. })
  705. },
  706. find() {
  707. if (this.value2) {
  708. this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
  709. this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
  710. } else {
  711. this.startDate = ''
  712. this.endDate = ''
  713. }
  714. this.currentPage = 1
  715. this.getList()
  716. },
  717. async exportlist() {
  718. const {
  719. data
  720. } = await export1({
  721. compId: localStorage.getItem('ws-pf_compId'),
  722. contractType: this.contractType,
  723. goodsType: this.goodsType,
  724. currentPage: this.currentPage,
  725. pageSize: this.pageSize,
  726. searchType: this.searchType,
  727. searchKeyWord: this.searchKeyWord,
  728. startDate: this.startDate,
  729. endDate: this.endDate,
  730. }, {}, {
  731. responseType: 'blob',
  732. }).toPromise()
  733. downloadFile({
  734. res: data,
  735. fileName: `${
  736. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  737. }_采购合同`,
  738. type: 'xls',
  739. })
  740. },
  741. // deletecontract(){},
  742. //删除
  743. handleDelete(row) {
  744. var text = ''
  745. if (row.type == 1) {
  746. text =
  747. '确认删除收款信息?'
  748. } else {
  749. text = '确认删除请款信息?'
  750. }
  751. this.$confirm(text, '提示', {
  752. confirmButtonText: '确定',
  753. cancelButtonText: '取消',
  754. type: 'warning',
  755. })
  756. .then(() => {
  757. delcontractcost({
  758. id: row.id,
  759. })
  760. .toPromise()
  761. .then((response) => {
  762. this.$notify.success({
  763. title: '成功',
  764. message: '删除成功',
  765. })
  766. this.getList()
  767. })
  768. .catch((response) => {})
  769. })
  770. .catch(() => {
  771. return false
  772. })
  773. },
  774. },
  775. }
  776. </script>
  777. <style lang="scss" scoped>
  778. /deep/.base_header_layout .grid-content{
  779. height:36px;
  780. }
  781. </style>