salesContractCost.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;'>买方:{{buger}}</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. buger:'',
  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: 1,
  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.buger=this.$route.query.buger
  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. gettaskhistories({ businessKey: row.id,
  348. workflowId: row.workflowId}).toPromise()
  349. .then((response) => {
  350. this.recordList=response
  351. this.dialogVisible1=true
  352. }).catch((response) => {})
  353. },
  354. handleaudit(row){
  355. console.log(row)
  356. this.status=3
  357. this.costType=row.costType
  358. this.deptBudgetList=row
  359. this.currectcost=row
  360. if(row.addressUrl){
  361. this.dataList=[]
  362. this.paymentScreenshot=row.addressUrl.split(',')
  363. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  364. this.dataList.push({url:this.paymentScreenshot[i]})
  365. }
  366. }
  367. this.disabled=true
  368. this.dialogVisible=true
  369. },
  370. handlepayment(row){
  371. this.status=4
  372. this.costType=row.costType
  373. this.currectcost=row
  374. this.disabled=true
  375. this.deptBudgetList=row
  376. if(row.addressUrl){
  377. this.dataList=[]
  378. this.paymentScreenshot=row.addressUrl.split(',')
  379. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  380. this.dataList.push({url:this.paymentScreenshot[i]})
  381. }
  382. }
  383. this.dialogVisible=true
  384. },
  385. handlefujian(file) {
  386. // console.log(file)
  387. this.paymentScreenshot.push(file.url)
  388. // this.dialogVisible = true
  389. },
  390. handleRemove(file) {
  391. // console.log(file)
  392. for (let i = 0; i < this.paymentScreenshot.length; i++) {
  393. if(this.paymentScreenshot[i]==response.url){
  394. this.paymentScreenshot.splice(i, 1)
  395. }
  396. }
  397. },
  398. handleSizeChange(val) {
  399. console.log(`每页 ${val} 条`)
  400. this.pageSize = val
  401. this.getList()
  402. },
  403. handleCurrentChange(val) {
  404. this.currentPage = val
  405. console.log(`当前页: ${val}`)
  406. this.getList()
  407. },
  408. selectcontract(e){
  409. for (let i = 0; i < this.contractList.length; i++) {
  410. if(this.contractList[i].contractNo==e){
  411. this.contractId=this.contractList[i].id
  412. this.contractNo=this.contractList[i].contractNo
  413. this.searchTypeText=this.contractList[i].contractNo
  414. this.buger=this.contractList[i].buger
  415. this.getList()
  416. }
  417. }
  418. },
  419. cancel(){
  420. woekflowhandle({taskId: this.currectcost.taskId,
  421. approved: false,
  422. auditMind: this.auditMind,
  423. needReapply: false,})
  424. .toPromise()
  425. .then((response) => {
  426. this.$notify.success({
  427. title: '成功',
  428. message: '驳回成功',
  429. })
  430. this.dialogVisible=false
  431. this.deptBudgetList={}
  432. this.paymentScreenshot=[]
  433. this.$refs.uploadfiles.clearFiles()
  434. this.getList()
  435. }).catch((response) => {})
  436. },
  437. confirm(){
  438. // addcontractcost()
  439. var text = ''
  440. if(this.status == 2||this.status == 1){
  441. if(!this.deptBudgetList.costName){
  442. this.$message({
  443. message: '款项名称不能为空',
  444. type: 'warning',
  445. })
  446. return
  447. }
  448. if(!this.deptBudgetList.costPrice){
  449. this.$message({
  450. message: '金额不能为空',
  451. type: 'warning',
  452. })
  453. return
  454. }
  455. if(this.deptBudgetList.costName.length<1||this.deptBudgetList.costName.length>15){
  456. this.$message({
  457. message: '费用名称输入错误',
  458. type: 'warning',
  459. })
  460. return
  461. }
  462. if(this.deptBudgetList.costPrice<0.01||this.deptBudgetList.costPrice>100000000){
  463. this.$message({
  464. message: '费用名称输入错误',
  465. type: 'warning',
  466. })
  467. return
  468. }
  469. if(String(this.deptBudgetList.costPrice).indexOf(".")!=-1){
  470. if(String(this.deptBudgetList.costPrice).substring(String(this.deptBudgetList.costPrice).indexOf(".")+1,this.deptBudgetList.costPrice.length)>2){
  471. this.$message({
  472. message: '费用名称输入错误',
  473. type: 'warning',
  474. })
  475. return
  476. }
  477. }
  478. if(this.deptBudgetList.remark&&this.deptBudgetList.remark.length<0||this.deptBudgetList.remark&&this.deptBudgetList.remark.length>50){
  479. this.$message({
  480. message: '备注不超过50字',
  481. type: 'warning',
  482. })
  483. return
  484. }
  485. }
  486. if(this.status == 1){
  487. if(this.paymentScreenshot.length==0){
  488. this.$message({
  489. message: '附件不能为空',
  490. type: 'warning',
  491. })
  492. return
  493. }
  494. }
  495. if (this.status == 2||this.status == 5&&this.currectcost.type==2) {
  496. text =
  497. '确认提交请款信息?'
  498. } else if(this.status == 1) {
  499. text = '确认提交收款信息?'
  500. } else if(this.status == 3&&this.currectcost.type==2) {
  501. text = '确认通过请款信息?'
  502. }else if(this.status == 4) {
  503. text = '确认提交付款信息?'
  504. }
  505. this.$confirm(text, '提示', {
  506. confirmButtonText: '确定',
  507. cancelButtonText: '取消',
  508. type: 'warning',
  509. })
  510. .then(() => {
  511. this.deptBudgetList.contractId=this.contractId
  512. this.deptBudgetList.contractNo=this.contractNo
  513. this.deptBudgetList.contractType=this.contractType
  514. this.deptBudgetList.costType=this.costType
  515. this.deptBudgetList.compId=this.compId
  516. this.deptBudgetList.addressUrl=this.paymentScreenshot.toString()
  517. this.deptBudgetList.personName=localStorage.getItem('ws-pf_staffName')
  518. if(this.status==1||this.status==2){
  519. this.deptBudgetList.type=this.status
  520. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  521. addcontractcost(this.deptBudgetList)
  522. .toPromise()
  523. .then((response) => {
  524. this.$notify.success({
  525. title: '成功',
  526. message: '提交成功',
  527. })
  528. this.dialogVisible=false
  529. this.deptBudgetList={}
  530. this.paymentScreenshot=[]
  531. this.$refs.uploadfiles.clearFiles()
  532. this.getList()
  533. }).catch((response) => {})
  534. }else if(this.status==5){
  535. this.deptBudgetList.type=this.currectcost.type
  536. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  537. editcontractcost(this.deptBudgetList)
  538. .toPromise()
  539. .then((response) => {
  540. this.$notify.success({
  541. title: '成功',
  542. message: '编辑成功',
  543. })
  544. this.dialogVisible=false
  545. this.deptBudgetList={}
  546. this.paymentScreenshot=[]
  547. this.$refs.uploadfiles.clearFiles()
  548. this.getList()
  549. }).catch((response) => {})
  550. }else if(this.status==3){
  551. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  552. woekflowhandle({taskId: this.currectcost.taskId,
  553. approved: true,
  554. auditMind: this.auditMind,
  555. needReapply: false,})
  556. .toPromise()
  557. .then((response) => {
  558. this.$notify.success({
  559. title: '成功',
  560. message: '通过成功',
  561. })
  562. this.dialogVisible=false
  563. this.deptBudgetList={}
  564. this.paymentScreenshot=[]
  565. this.$refs.uploadfiles.clearFiles()
  566. this.getList()
  567. }).catch((response) => {})
  568. }else if(this.status==4){
  569. // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
  570. payment(this.deptBudgetList)
  571. .toPromise()
  572. .then((response) => {
  573. this.$notify.success({
  574. title: '成功',
  575. message: '付款成功',
  576. })
  577. this.dialogVisible=false
  578. this.deptBudgetList={}
  579. this.paymentScreenshot=[]
  580. this.$refs.uploadfiles.clearFiles()
  581. this.getList()
  582. }).catch((response) => {})
  583. }
  584. })
  585. .catch(() => {
  586. return false
  587. })
  588. },
  589. handleAdd(status){
  590. this.status=status
  591. if(status==1){
  592. this.title='收款'
  593. }else if(status==2){
  594. this.title='请款'
  595. }
  596. this.dialogVisible=true
  597. },
  598. onChange() {
  599. this.$refs.upload
  600. .handleSaveBill()
  601. .then(async (response) => {
  602. this.deptBudgetList.addressUrl = response
  603. this.deptBudgetList.id = this.id
  604. this.deptBudgetList.flag = 1
  605. editInfo(this.deptBudgetList)
  606. .toPromise()
  607. .then((response) => {
  608. this.accessoryTFs = false
  609. this.$message.success('上传成功')
  610. this.getList()
  611. })
  612. })
  613. .catch((res) => {
  614. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  615. this.$refs.upload.clearFiles()
  616. })
  617. },
  618. getList() {
  619. contractcost({
  620. compId: localStorage.getItem('ws-pf_compId'),
  621. contractType: this.contractType,
  622. currentPage: this.currentPage,
  623. pageSize: this.pageSize,
  624. contractId:this.contractId,
  625. contractNo:this.contractNo,
  626. searchType:this.type
  627. })
  628. .toPromise()
  629. .then((response) => {
  630. var income=0,expend=0,grainincome=0,grainexpend=0,nograinexpend=0
  631. this.costList=response
  632. for (var i = 0; i < response.records.length; i++) {
  633. if(response.records[i].addressUrl){
  634. response.records[i].addressUrlArray=response.records[i].addressUrl.split(',')
  635. }
  636. // 收入
  637. if(response.records[i].type==1){
  638. income+=response.records[i].costPrice
  639. if(response.records[i].costType==1){
  640. grainincome+=response.records[i].costPrice
  641. }
  642. }
  643. // 支出
  644. if(response.records[i].type==2){
  645. expend+=response.records[i].costPrice
  646. if(response.records[i].costType==1&&response.records[i].status=='已付款'){
  647. grainexpend+=response.records[i].costPrice
  648. }else{
  649. nograinexpend+=response.records[i].costPrice
  650. }
  651. }
  652. }
  653. console.log(grainexpend,grainincome)
  654. this.income=income.toFixed(2)
  655. this.expend=expend.toFixed(2)
  656. this.grain=(grainincome-grainexpend).toFixed(2)
  657. this.nograinexpend=nograinexpend.toFixed(2)
  658. // this.deptCircularPage.currentPage = response.current
  659. // this.deptCircularPage.pageSize = response.size
  660. // this.deptBudgetTotal = response.total
  661. // this.contractList = response
  662. // for (var i = 0; i < response.records.length; i++) {
  663. // var arr = new Array()
  664. // this.addressUrls[i] = new Array()
  665. // if (this.contractList.records[i].addressUrl != null) {
  666. // arr = this.contractList.records[i].addressUrl.split(',')
  667. // this.addressUrls[i] = arr
  668. // }
  669. // }
  670. })
  671. },
  672. fujian(row) {
  673. this.id = row.id
  674. this.accessoryTFs = true
  675. this.appendixIdss = row.addressUrlArray
  676. console.log(this.appendixIdss)
  677. },
  678. handleExamine(row) {
  679. console.log(row)
  680. this.$router.push({
  681. name: 'purchaseContractExamine',
  682. query: {
  683. id: row.id,
  684. status: row.status,
  685. },
  686. })
  687. },
  688. handleEdit(row) {
  689. this.$router.push({
  690. name: 'purchaseContractEdit',
  691. query: {
  692. id: row.id,
  693. },
  694. })
  695. },
  696. // 关闭 dialog时 处理文件url 初始化upload组件
  697. history(row) {
  698. console.log(row)
  699. billoperatehis({
  700. id: row.id,
  701. })
  702. .toPromise()
  703. .then((response) => {
  704. this.historyList = response
  705. })
  706. },
  707. find() {
  708. if (this.value2) {
  709. this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
  710. this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
  711. } else {
  712. this.startDate = ''
  713. this.endDate = ''
  714. }
  715. this.currentPage = 1
  716. this.getList()
  717. },
  718. async exportlist() {
  719. const {
  720. data
  721. } = await export1({
  722. compId: localStorage.getItem('ws-pf_compId'),
  723. contractType: this.contractType,
  724. goodsType: this.goodsType,
  725. currentPage: this.currentPage,
  726. pageSize: this.pageSize,
  727. searchType: this.searchType,
  728. searchKeyWord: this.searchKeyWord,
  729. startDate: this.startDate,
  730. endDate: this.endDate,
  731. }, {}, {
  732. responseType: 'blob',
  733. }).toPromise()
  734. downloadFile({
  735. res: data,
  736. fileName: `${
  737. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  738. }_采购合同`,
  739. type: 'xls',
  740. })
  741. },
  742. // deletecontract(){},
  743. //删除
  744. handleDelete(row) {
  745. var text = ''
  746. if (row.type == 1) {
  747. text =
  748. '确认删除收款信息?'
  749. } else {
  750. text = '确认删除请款信息?'
  751. }
  752. this.$confirm(text, '提示', {
  753. confirmButtonText: '确定',
  754. cancelButtonText: '取消',
  755. type: 'warning',
  756. })
  757. .then(() => {
  758. delcontractcost({
  759. id: row.id,
  760. })
  761. .toPromise()
  762. .then((response) => {
  763. this.$notify.success({
  764. title: '成功',
  765. message: '删除成功',
  766. })
  767. this.getList()
  768. })
  769. .catch((response) => {})
  770. })
  771. .catch(() => {
  772. return false
  773. })
  774. },
  775. },
  776. }
  777. </script>
  778. <style lang="scss" scoped>
  779. /deep/.base_header_layout .grid-content{
  780. height:36px;
  781. }
  782. </style>