purchaseContractCost.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  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='30%' :visible.sync="dialogVisible" :title="title" class='title_css' top="20vh">
  129. <el-form style='margin:0 auto;' ref="form" :model="deptBudgetList" label-width="100px">
  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" placeholder="请输入款项名称"></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" placeholder="请输入金额"></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" placeholder="请输入回款方"></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-input type="textarea" v-model="deptBudgetList.remark" placeholder="输入备注,不超过50个字" maxlength="50" :rows="4">
  158. </el-input>
  159. </el-form-item>
  160. <el-form-item label="附件">
  161. <el-upload ref='uploadfiles' :file-list='dataList' action="https://www.zthymaoyi.com/upload/admin" list-type="picture-card"
  162. :on-success="handlefujian" :on-remove="handleRemove" class="photo2">
  163. <i class="el-icon-plus"></i>
  164. </el-upload>
  165. </el-form-item>
  166. <el-form-item v-if='status==3' label="审核意见">
  167. <el-input type="textarea" v-model="auditMind"></el-input>
  168. </el-form-item>
  169. <el-form-item v-if='status==1' label="收款日期">
  170. <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择收款日期"
  171. value-format="yyyy-MM-dd" />
  172. </el-form-item>
  173. <el-form-item v-if='status==4' label="付款日期">
  174. <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择付款日期"
  175. value-format="yyyy-MM-dd" />
  176. </el-form-item>
  177. </el-form>
  178. <div style='text-align:center;' v-if='status==1||status==2||status==4||status==5'>
  179. <el-button @click='dialogVisible=false'>取消</el-button>
  180. <el-button @click='confirm' type="primary">提交</el-button>
  181. </div>
  182. <div style='text-align:center;' v-if='status==3'>
  183. <el-button @click='cancel'>驳回</el-button>
  184. <el-button @click='confirm' type="primary">通过</el-button>
  185. </div>
  186. </el-dialog>
  187. <el-dialog width='50%' :visible.sync="dialogVisible1" title="审核记录">
  188. <div v-for="item in recordList">
  189. <div style='width:100%;justify-content: space-between;' class='flex'>
  190. <div style='width:33.333%;text-align:center;'>{{item.operateUser}}</div>
  191. <div style='width:33.333%;text-align:center;'>{{item.dealMsg}}</div>
  192. <div style='width:33.333%;text-align:center;'>{{item.createDate}}</div>
  193. </div>
  194. <div style='width:100%;text-align:center;'>{{item.verifyRemark}}</div>
  195. </div>
  196. </el-dialog>
  197. </div>
  198. </template>
  199. <script>
  200. import {
  201. contractcost,
  202. getcontract,
  203. addcontractcost,
  204. editcontractcost,
  205. delcontractcost,
  206. payment,
  207. billoperatehis
  208. // export1,
  209. // editstatus,
  210. // billoperatehis,
  211. // deletecontract,
  212. // editInfo,
  213. } from '@/model/contarct/index'
  214. import {
  215. woekflowhandle,gettaskhistories
  216. } from '@/model/tasksport/index'
  217. import {
  218. downloadFile
  219. } from '@/utils/batchDown'
  220. import Pagination from '@/components/Pagination'
  221. import WsUpload from '@/components/WsUpload'
  222. import {
  223. dayjs,
  224. EventBus
  225. } from 'base-core-lib'
  226. export default {
  227. name: 'viewSpareMoney',
  228. components: {
  229. WsUpload,
  230. Pagination,
  231. },
  232. watch: {
  233. vesselId(val) {
  234. this.getList()
  235. },
  236. isShow(val) {
  237. this.showType = val
  238. },
  239. },
  240. data() {
  241. return {
  242. id: '',
  243. // 船舶类型
  244. monetaryKey: null,
  245. // 表格显示数据
  246. tableDate: [],
  247. size: 10,
  248. // 是否显示
  249. showType: true,
  250. // 年
  251. year: '',
  252. title:'',
  253. costType:1,
  254. seller:'',
  255. deptBudgetTotal: 0,
  256. currentPage: 1,
  257. recordList:[],
  258. pageSize: 9999,
  259. searchType: 1,
  260. dialogVisible1:false,
  261. type:'',
  262. searchTypeText: '',
  263. searchKeyWord: '',
  264. contractType: 2,
  265. dataList:[],
  266. startDate: null,
  267. endDate: null,
  268. addressUrls: [],
  269. costList:{},
  270. currectcost:{},
  271. dialogVisible:false,
  272. contractId:0,
  273. status:'',
  274. contractNo:'',
  275. disabled:false,
  276. // 提交类型
  277. submitType: true,
  278. auditMind:'',
  279. grain:0,
  280. income:0,
  281. expend:0,
  282. nograinexpend:0,
  283. staffName:localStorage.getItem('ws-pf_staffName'),
  284. paymentScreenshot:[],
  285. deptCircularPage: {},
  286. date: {
  287. year: dayjs().format('YYYY'),
  288. month: dayjs().format('MM'),
  289. },
  290. contractList: [],
  291. deptBudgetList: {},
  292. historyList: [],
  293. appendixIdss: [],
  294. compId: localStorage.getItem('ws-pf_compId'),
  295. pickerBeginDateBefore: {
  296. disabledDate: (time) => {
  297. return time.getTime() > Date.now()
  298. },
  299. },
  300. accessoryTFs: false,
  301. value1: '',
  302. value2: '',
  303. }
  304. },
  305. activated() {
  306. //cg.viewBudget
  307. //cg.viewSpareMoney
  308. // this.getVesselData();
  309. this.contractId=this.$route.query.id
  310. this.contractNo=this.$route.query.contractNo
  311. this.searchTypeText=this.$route.query.contractNo+'('+this.$route.query.status+')'
  312. this.seller=this.$route.query.seller
  313. getcontract({flag:0}).toPromise()
  314. .then((response) => {
  315. this.contractList=response
  316. // this.contractId=response[0].id
  317. // this.contractNo=response[0].contractNo
  318. // this.searchTypeText=response[0].contractNo
  319. // this.seller=response[0].seller
  320. this.getList()
  321. })
  322. this.showType = this.isShow
  323. },
  324. methods: {
  325. handlestatus(status){
  326. this.type=status
  327. this.getList()
  328. },
  329. handleedit(row){
  330. if(row.type==1){
  331. this.title='收款'
  332. }else{
  333. this.title='请款'
  334. }
  335. this.status=5
  336. this.deptBudgetList=row
  337. this.costType=row.costType
  338. if(row.addressUrl){
  339. this.dataList=[]
  340. this.paymentScreenshot=row.addressUrl.split(',')
  341. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  342. this.dataList.push({url:this.paymentScreenshot[i]})
  343. }
  344. }
  345. this.currectcost=row
  346. this.dialogVisible=true
  347. },
  348. handlerecord(row){
  349. billoperatehis({id: row.id}).toPromise()
  350. .then((response) => {
  351. this.recordList=response
  352. this.dialogVisible1=true
  353. }).catch((response) => {})
  354. },
  355. handleaudit(row){
  356. console.log(row)
  357. this.status=3
  358. this.costType=row.costType
  359. this.deptBudgetList=row
  360. this.currectcost=row
  361. if(row.addressUrl){
  362. this.dataList=[]
  363. this.paymentScreenshot=row.addressUrl.split(',')
  364. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  365. this.dataList.push({url:this.paymentScreenshot[i]})
  366. }
  367. }
  368. this.disabled=true
  369. this.dialogVisible=true
  370. },
  371. handlepayment(row){
  372. this.status=4
  373. this.costType=row.costType
  374. this.currectcost=row
  375. this.disabled=true
  376. this.deptBudgetList=row
  377. if(row.addressUrl){
  378. this.dataList=[]
  379. this.paymentScreenshot=row.addressUrl.split(',')
  380. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  381. this.dataList.push({url:this.paymentScreenshot[i]})
  382. }
  383. }
  384. this.dialogVisible=true
  385. },
  386. handlefujian(file) {
  387. // console.log(file)
  388. this.paymentScreenshot.push(file.url)
  389. // this.dialogVisible = true
  390. },
  391. handleRemove(file) {
  392. // console.log(file)
  393. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  394. if(this.paymentScreenshot[i]==response.url){
  395. this.paymentScreenshot.splice(i, 1)
  396. }
  397. }
  398. },
  399. handleSizeChange(val) {
  400. console.log(`每页 ${val} 条`)
  401. this.pageSize = val
  402. this.getList()
  403. },
  404. handleCurrentChange(val) {
  405. this.currentPage = val
  406. console.log(`当前页: ${val}`)
  407. this.getList()
  408. },
  409. selectcontract(e){
  410. for (let i = 0; i < this.contractList.length; i++) {
  411. if(this.contractList[i].contractNo==e){
  412. this.contractId=this.contractList[i].id
  413. this.contractNo=this.contractList[i].contractNo
  414. this.searchTypeText=this.contractList[i].contractNo
  415. this.seller=this.contractList[i].seller
  416. this.getList()
  417. }
  418. }
  419. },
  420. cancel(){
  421. woekflowhandle({taskId: this.currectcost.taskId,
  422. approved: false,
  423. auditMind: this.auditMind,
  424. needReapply: false,})
  425. .toPromise()
  426. .then((response) => {
  427. this.$notify.success({
  428. title: '成功',
  429. message: '驳回成功',
  430. })
  431. this.dialogVisible=false
  432. this.deptBudgetList={}
  433. this.paymentScreenshot=[]
  434. this.$refs.uploadfiles.clearFiles()
  435. this.getList()
  436. }).catch((response) => {})
  437. },
  438. confirm(){
  439. // addcontractcost()
  440. var text = ''
  441. if(this.status == 2||this.status == 1){
  442. if(!this.deptBudgetList.costName){
  443. this.$message({
  444. message: '款项名称不能为空',
  445. type: 'warning',
  446. })
  447. return
  448. }
  449. if(!this.deptBudgetList.costPrice){
  450. this.$message({
  451. message: '金额不能为空',
  452. type: 'warning',
  453. })
  454. return
  455. }
  456. if(this.deptBudgetList.costName.length<1||this.deptBudgetList.costName.length>15){
  457. this.$message({
  458. message: '费用名称输入错误',
  459. type: 'warning',
  460. })
  461. return
  462. }
  463. if(this.deptBudgetList.costPrice<0.01||this.deptBudgetList.costPrice>100000000){
  464. this.$message({
  465. message: '费用名称输入错误',
  466. type: 'warning',
  467. })
  468. return
  469. }
  470. if(String(this.deptBudgetList.costPrice).indexOf(".")!=-1){
  471. if(String(this.deptBudgetList.costPrice).substring(String(this.deptBudgetList.costPrice).indexOf(".")+1,this.deptBudgetList.costPrice.length)>2){
  472. this.$message({
  473. message: '费用名称输入错误',
  474. type: 'warning',
  475. })
  476. return
  477. }
  478. }
  479. if(this.deptBudgetList.remark&&this.deptBudgetList.remark.length<0||this.deptBudgetList.remark&&this.deptBudgetList.remark.length>50){
  480. this.$message({
  481. message: '备注不超过50字',
  482. type: 'warning',
  483. })
  484. return
  485. }
  486. }
  487. if(this.status == 1){
  488. if(this.paymentScreenshot.length==0){
  489. this.$message({
  490. message: '附件不能为空',
  491. type: 'warning',
  492. })
  493. return
  494. }
  495. }
  496. if (this.status == 2||this.status == 5&&this.currectcost.type==2) {
  497. text =
  498. '确认提交请款信息?'
  499. } else if(this.status == 1) {
  500. text = '确认提交收款信息?'
  501. } else if(this.status == 3&&this.currectcost.type==2) {
  502. text = '确认通过请款信息?'
  503. }else if(this.status == 4) {
  504. text = '确认提交付款信息?'
  505. }
  506. this.$confirm(text, '提示', {
  507. confirmButtonText: '确定',
  508. cancelButtonText: '取消',
  509. type: 'warning',
  510. })
  511. .then(() => {
  512. this.deptBudgetList.contractId=this.contractId
  513. this.deptBudgetList.contractNo=this.contractNo
  514. this.deptBudgetList.contractType=this.contractType
  515. this.deptBudgetList.costType=this.costType
  516. this.deptBudgetList.compId=this.compId
  517. this.deptBudgetList.addressUrl=this.paymentScreenshot.toString()
  518. this.deptBudgetList.personName=localStorage.getItem('ws-pf_staffName')
  519. if(this.status==1||this.status==2){
  520. this.deptBudgetList.type=this.status
  521. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  522. addcontractcost(this.deptBudgetList)
  523. .toPromise()
  524. .then((response) => {
  525. this.$notify.success({
  526. title: '成功',
  527. message: '提交成功',
  528. })
  529. this.dialogVisible=false
  530. this.deptBudgetList={}
  531. this.paymentScreenshot=[]
  532. this.$refs.uploadfiles.clearFiles()
  533. this.getList()
  534. }).catch((response) => {})
  535. }else if(this.status==5){
  536. this.deptBudgetList.type=this.currectcost.type
  537. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  538. editcontractcost(this.deptBudgetList)
  539. .toPromise()
  540. .then((response) => {
  541. this.$notify.success({
  542. title: '成功',
  543. message: '编辑成功',
  544. })
  545. this.dialogVisible=false
  546. this.deptBudgetList={}
  547. this.paymentScreenshot=[]
  548. this.$refs.uploadfiles.clearFiles()
  549. this.getList()
  550. }).catch((response) => {})
  551. }else if(this.status==3){
  552. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  553. woekflowhandle({taskId: this.currectcost.taskId,
  554. approved: true,
  555. auditMind: this.auditMind,
  556. needReapply: false,})
  557. .toPromise()
  558. .then((response) => {
  559. this.$notify.success({
  560. title: '成功',
  561. message: '通过成功',
  562. })
  563. this.dialogVisible=false
  564. this.deptBudgetList={}
  565. this.paymentScreenshot=[]
  566. this.$refs.uploadfiles.clearFiles()
  567. this.getList()
  568. }).catch((response) => {})
  569. }else if(this.status==4){
  570. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  571. payment(this.deptBudgetList)
  572. .toPromise()
  573. .then((response) => {
  574. this.$notify.success({
  575. title: '成功',
  576. message: '付款成功',
  577. })
  578. this.dialogVisible=false
  579. this.deptBudgetList={}
  580. this.paymentScreenshot=[]
  581. this.$refs.uploadfiles.clearFiles()
  582. this.getList()
  583. }).catch((response) => {})
  584. }
  585. })
  586. .catch(() => {
  587. return false
  588. })
  589. },
  590. handleAdd(status){
  591. this.status=status
  592. if(status==1){
  593. this.title='收款'
  594. }else if(status==2){
  595. this.title='请款'
  596. }
  597. this.dialogVisible=true
  598. },
  599. onChange() {
  600. this.$refs.upload
  601. .handleSaveBill()
  602. .then(async (response) => {
  603. this.deptBudgetList.addressUrl = response
  604. this.deptBudgetList.id = this.id
  605. this.deptBudgetList.flag = 1
  606. editInfo(this.deptBudgetList)
  607. .toPromise()
  608. .then((response) => {
  609. this.accessoryTFs = false
  610. this.$message.success('上传成功')
  611. this.getList()
  612. })
  613. })
  614. .catch((res) => {
  615. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  616. this.$refs.upload.clearFiles()
  617. })
  618. },
  619. getList() {
  620. contractcost({
  621. compId: localStorage.getItem('ws-pf_compId'),
  622. contractType: this.contractType,
  623. currentPage: this.currentPage,
  624. pageSize: this.pageSize,
  625. contractId:this.contractId,
  626. contractNo:this.contractNo,
  627. searchType:this.type
  628. })
  629. .toPromise()
  630. .then((response) => {
  631. var income=0,expend=0,grainincome=0,grainexpend=0,nograinexpend=0
  632. this.costList=response
  633. for (var i = 0; i < response.records.length; i++) {
  634. if(response.records[i].addressUrl){
  635. response.records[i].addressUrlArray=response.records[i].addressUrl.split(',')
  636. }
  637. // 收入
  638. if(response.records[i].type==1){
  639. income+=response.records[i].costPrice
  640. if(response.records[i].costType==1){
  641. grainincome+=response.records[i].costPrice
  642. }
  643. }
  644. // 支出
  645. if(response.records[i].type==2){
  646. expend+=response.records[i].costPrice
  647. if(response.records[i].costType==1&&response.records[i].status=='已付款'){
  648. grainexpend+=response.records[i].costPrice
  649. }else{
  650. nograinexpend+=response.records[i].costPrice
  651. }
  652. }
  653. }
  654. console.log(grainexpend,grainincome)
  655. this.income=income.toFixed(2)
  656. this.expend=expend.toFixed(2)
  657. this.grain=(grainexpend-grainincome).toFixed(2)
  658. this.nograinexpend=nograinexpend.toFixed(2)
  659. // this.deptCircularPage.currentPage = response.current
  660. // this.deptCircularPage.pageSize = response.size
  661. // this.deptBudgetTotal = response.total
  662. // this.contractList = response
  663. // for (var i = 0; i < response.records.length; i++) {
  664. // var arr = new Array()
  665. // this.addressUrls[i] = new Array()
  666. // if (this.contractList.records[i].addressUrl != null) {
  667. // arr = this.contractList.records[i].addressUrl.split(',')
  668. // this.addressUrls[i] = arr
  669. // }
  670. // }
  671. })
  672. },
  673. fujian(row) {
  674. this.id = row.id
  675. this.accessoryTFs = true
  676. this.appendixIdss = row.addressUrlArray
  677. console.log(this.appendixIdss)
  678. },
  679. handleExamine(row) {
  680. console.log(row)
  681. this.$router.push({
  682. name: 'purchaseContractExamine',
  683. query: {
  684. id: row.id,
  685. status: row.status,
  686. },
  687. })
  688. },
  689. handleEdit(row) {
  690. this.$router.push({
  691. name: 'purchaseContractEdit',
  692. query: {
  693. id: row.id,
  694. },
  695. })
  696. },
  697. // 关闭 dialog时 处理文件url 初始化upload组件
  698. history(row) {
  699. console.log(row)
  700. billoperatehis({
  701. id: row.id,
  702. })
  703. .toPromise()
  704. .then((response) => {
  705. this.historyList = response
  706. })
  707. },
  708. find() {
  709. if (this.value2) {
  710. this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
  711. this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
  712. } else {
  713. this.startDate = ''
  714. this.endDate = ''
  715. }
  716. this.currentPage = 1
  717. this.getList()
  718. },
  719. async exportlist() {
  720. const {
  721. data
  722. } = await export1({
  723. compId: localStorage.getItem('ws-pf_compId'),
  724. contractType: this.contractType,
  725. goodsType: this.goodsType,
  726. currentPage: this.currentPage,
  727. pageSize: this.pageSize,
  728. searchType: this.searchType,
  729. searchKeyWord: this.searchKeyWord,
  730. startDate: this.startDate,
  731. endDate: this.endDate,
  732. }, {}, {
  733. responseType: 'blob',
  734. }).toPromise()
  735. downloadFile({
  736. res: data,
  737. fileName: `${
  738. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  739. }_采购合同`,
  740. type: 'xls',
  741. })
  742. },
  743. // deletecontract(){},
  744. //删除
  745. handleDelete(row) {
  746. var text = ''
  747. if (row.type == 1) {
  748. text =
  749. '确认删除收款信息?'
  750. } else {
  751. text = '确认删除请款信息?'
  752. }
  753. this.$confirm(text, '提示', {
  754. confirmButtonText: '确定',
  755. cancelButtonText: '取消',
  756. type: 'warning',
  757. })
  758. .then(() => {
  759. delcontractcost({
  760. id: row.id,
  761. })
  762. .toPromise()
  763. .then((response) => {
  764. this.$notify.success({
  765. title: '成功',
  766. message: '删除成功',
  767. })
  768. this.getList()
  769. })
  770. .catch((response) => {})
  771. })
  772. .catch(() => {
  773. return false
  774. })
  775. },
  776. },
  777. }
  778. </script>
  779. <style lang="scss" scoped>
  780. /deep/.base_header_layout .grid-content{
  781. height:36px;
  782. }
  783. /deep/.title_css .el-dialog__header {
  784. text-align: center !important;
  785. border-radius: 4px;
  786. }
  787. </style>