request_funds.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <template>
  2. <view class="content">
  3. <view class='wrap'>
  4. <view class="xinxi" v-if="reType == 2 || expensesType == '2'" style="font-size: 28rpx; ">请款信息</view>
  5. <view class="xinxi" v-if="reType == 1 || expensesType == '1'" style="font-size: 28rpx; ">收款信息</view>
  6. <view class="c-row">
  7. <view class="title">用途</view>
  8. <view class="con-list">
  9. <view @click='show=true'>{{detailData.purpose}}
  10. <u-icon name="arrow-right" color=""></u-icon>
  11. </view>
  12. <u-picker :range="purposeList" range-key="purpose" @confirm='ltCheck($event)' v-model="show"
  13. mode="selector">
  14. </u-picker>
  15. </view>
  16. </view>
  17. <view class="c-row" v-if="detailData.purpose == '库点费用'">
  18. <view class="title">仓库名称</view>
  19. <view class="con-list">
  20. <view @click='selectWare()'>{{detailData.warehouseName?detailData.warehouseName:"请选择仓库名称"}}
  21. <u-icon name="arrow-right" color=""></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="c-row" v-if="detailData.purpose == '库点费用'&&reType == 2">
  26. <view class="title">仓储费</view>
  27. <view class="con-list">
  28. <view @click='show3=true'>{{detailData.flag}}
  29. <u-icon name="arrow-right" color=""></u-icon>
  30. </view>
  31. </view>
  32. </view>
  33. <u-picker :range="typeList1" range-key="value" @confirm='typeCheck1($event)' v-model="show3"
  34. mode="selector">
  35. </u-picker>
  36. <view class="c-row" v-if="detailData.purpose == '库点费用'">
  37. <view class="title">类型</view>
  38. <view class="con-list">
  39. <view @click='show2=true'>{{detailData.wareExpenseType?detailData.wareExpenseType:"请选择类型"}}
  40. <u-icon name="arrow-right" color=""></u-icon>
  41. </view>
  42. </view>
  43. </view>
  44. <u-picker :range="typeList" range-key="value" @confirm='typeCheck($event)' v-model="show2"
  45. mode="selector">
  46. </u-picker>
  47. <view class="c-row" v-if="detailData.purpose == '合同费用'">
  48. <view class="title">合同编号</view>
  49. <view class="con-list">
  50. <view @click='selectCon'>{{detailData.contractNo?detailData.contractNo:"请选择合同编号"}}
  51. <u-icon name="arrow-right" color=""></u-icon>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="c-row">
  56. <view class="title">费用名称</view>
  57. <view class="con-list">
  58. <input v-model='detailData.expenseName' placeholder="输入费用名称,1-15个字"></input>
  59. </view>
  60. </view>
  61. <view v-if="reType == 2 || expensesType == '2'" class="c-row">
  62. <view class="title">付款方名头</view>
  63. <view class="con-list">
  64. <input v-model='detailData.payerHeader' maxlength='25' placeholder="输入付款方名头"></input>
  65. </view>
  66. </view>
  67. <view v-show="reType == 2&&detailData.purpose=='经营性费用' || expensesType == '2'&&detailData.purpose=='经营性费用'" class="c-row">
  68. <view class="title">所属名头</view>
  69. <view class="con-list">
  70. <view @click='show1=true'>{{detailData.belongName?detailData.belongName:"请选择所属名头"}}
  71. <u-icon name="arrow-right" color=""></u-icon>
  72. </view>
  73. </view>
  74. </view>
  75. <u-picker :range="namelist" range-key="name" @confirm='confirmname($event)' v-model="show1"
  76. mode="selector">
  77. </u-picker>
  78. <view class="c-row">
  79. <view class="title">金额(元)</view>
  80. <view class="con-list">
  81. <input type='digit' v-if="reType == '2' || expensesType == '2'" v-model='detailData.amountMoney'
  82. placeholder="输入请款金额"></input>
  83. <input type='digit' v-if="reType == '1' || expensesType == '1'" v-model='detailData.amountMoney'
  84. placeholder="输入收款金额"></input>
  85. </view>
  86. </view>
  87. <view class="c-row">
  88. <view class="left">备注</view>
  89. </view>
  90. <view style='position:relative;' class="wrap no-boder">
  91. <u-input class='textarea' v-model="detailData.remark" :type="typeRemark" :border="border"
  92. placeholder="选填,不超过150字" :height="height" :auto-height="autoHeight" maxlength="150" />
  93. <view class="remark">
  94. {{detailData.remark?detailData.remark.length:'0'}}/150个字
  95. </view>
  96. </view>
  97. <view class="c-row">
  98. <view class="title">附件(选填)</view>
  99. </view>
  100. <view style="display: flex;flex-wrap: wrap;">
  101. <view v-for='(item,index) in imglist2' v-if="imglist2 && imglist2.length > 0"
  102. style="position: relative;margin-left: 20rpx;">
  103. <view class="delete_img" @click="deleteImg(index)">X</view>
  104. <image :src="item.appendixPath" mode="" style="width: 100px;height: 100px;"></image>
  105. </view>
  106. <view class="biankuang" @click="uploadClick" v-if="imglist2.length < 30">
  107. <view class="tubiao">
  108. <image class="upload" src="../../static/img/oa_office/upload.png" mode="">
  109. </image>
  110. <view class="" style="color:#8c8f98;">
  111. 选择图片
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view v-if="reType == 2 || expensesType == '2'" class='wrap margin-bottom'>
  118. <view class="xinxi" style="font-size: 28rpx; ">收款账户信息</view>
  119. <view class="c-row">
  120. <view class="title">收款方</view>
  121. <view class="con-list">
  122. <input v-model='detailData.payee' placeholder="输入收款方"></input>
  123. </view>
  124. </view>
  125. <view class="c-row">
  126. <view class="title">账户</view>
  127. <view class="con-list">
  128. <input v-model='detailData.accountNumber' placeholder="输入账户"></input>
  129. </view>
  130. </view>
  131. <view class="c-row">
  132. <view class="title">开户行</view>
  133. <view class="con-list">
  134. <input v-model='detailData.bank' placeholder="输入开户行"></input>
  135. </view>
  136. </view>
  137. <view class="c-row">
  138. <view class="title">开户支行</view>
  139. <view class="con-list">
  140. <input v-model='detailData.bankBranch' placeholder="输入开户支行"></input>
  141. </view>
  142. </view>
  143. </view>
  144. <u-toast ref="uToast" />
  145. <view class="bottom-btn">
  146. <view @click="submit()" class="btn">提交</view>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. import * as config from '../../config'
  152. export default {
  153. data() {
  154. return {
  155. show: false,
  156. show2:false,
  157. showWare: false,
  158. detailData: {
  159. flag:'否',
  160. purpose: '库点费用',
  161. remark: "",
  162. wareExpenseType:'杂费',
  163. warehouseName: '选择仓库',
  164. expenseName: '',
  165. amountMoney: '',
  166. expensesPurpose: '3',
  167. expensesType: '',
  168. // contractId: '',
  169. fieldName: '',
  170. identification: '1',
  171. costType: '3',
  172. agent: '',
  173. totalDistribution: '0',
  174. },
  175. fileList1: [],
  176. show1:false,
  177. warehouseType: '1',
  178. typeRemark: 'textarea',
  179. border: true,
  180. show3:false,
  181. imglist: [], //存
  182. imglist2: [], //展示
  183. height: 150,
  184. autoHeight: true,
  185. purposeList: [{
  186. purpose: "合同费用"
  187. },
  188. {
  189. purpose: "库点费用"
  190. },
  191. {
  192. purpose: "经营性费用"
  193. },
  194. ],
  195. typeList1:[
  196. {value: "是"},
  197. {value: "否"},
  198. ],
  199. typeList:[
  200. {value: "杂费"},
  201. {value: "水电费"},
  202. {value: "伙食费"},
  203. {value: "人工费"},
  204. {value: "物质采买"},
  205. {value: "燃料费"},
  206. {value: "加油费"},
  207. ],
  208. namelist:[
  209. {name: "黑龙江中天昊元贸易有限公司"},
  210. {name: "中天昊元-建发合营"},
  211. {name: "中天昊元-六水香合营"},
  212. {name: "中天昊元-昊友合营"},
  213. {name: "黑龙江中天昊元贸易有限公司辽宁分公司"},
  214. {name: "黑龙江众利合粮食贸易有限公司"},
  215. {name: "黑龙江欣洋粮食贸易有限公司"},
  216. {name: "黑龙江启兴粮食贸易有限公司"},
  217. {name: "黑龙江鑫满仓粮食贸易有限公司"},
  218. {name: "黑龙江谷香粮食贸易有限公司"},
  219. {name: "黑龙江益储益运粮食贸易有限公司"},
  220. {name: "黑龙江海天粮食农业发展有限公司"},
  221. {name: "黑龙江中天绿粮供应链管理有限公司"},
  222. {name: "中天昊元(海南)国际贸易有限公司"},
  223. {name: "克东县嘉达建筑装潢有限责任公司"},
  224. {name: "克东县金博粮食有限公司"},
  225. {name: "克东县安正商贸有限公司"},
  226. {name: "克东县万祥农业科技开发有限公司"},
  227. {name: "克东县万润运输有限公司"},
  228. {name: "黑龙江大金仓农业科技有限公司"},
  229. {name: "克东县华祥通讯管线工程有限公司"},
  230. {name: "黑龙江峰海粮食贸易有限公司(季度报 增值税季度)"},
  231. {name: "黑龙江鑫宝仓粮食贸易有限公司"},
  232. {name: "黑龙江中仓粮食贸易有限公司"},
  233. {name: "黑龙江晟鸿泰粮食贸易有限公司"},
  234. {name: "黑龙江新粮仓粮食贸易有限公司"},
  235. {name: "齐齐哈尔米林设备制造有限公司"},
  236. ],
  237. reType: "",
  238. flag: "",
  239. warehouseInfo: {},
  240. contractNoInfo: {},
  241. }
  242. },
  243. onLoad(options) {
  244. this.reType = options.reType
  245. this.expensesType = options.expensesType
  246. if(this.reType==2||this.expensesType==2){
  247. uni.setNavigationBarTitle({title: '请款'});
  248. }
  249. this.id = options.id
  250. if (this.id) {
  251. this.getRequest()
  252. } else {
  253. return
  254. }
  255. },
  256. onShow() {
  257. this.warehouseInfo = uni.getStorageSync('theWarehouse');
  258. if (this.warehouseInfo && this.detailData.purpose == "库点费用") {
  259. this.detailData.warehouseName = this.warehouseInfo.warehouseName
  260. this.$forceUpdate()
  261. }
  262. this.contractNoInfo = uni.getStorageSync('reContractNo');
  263. if (this.contractNoInfo && this.detailData.purpose == "合同费用") {
  264. this.detailData.contractId = this.contractNoInfo.id
  265. this.detailData.contractNo = this.contractNoInfo.contractNo
  266. this.$api.doRequest('get', 'customerInfo/getPayeeInfo', {
  267. contractNo: this.detailData.contractNo
  268. }).then(res => {
  269. this.detailData.payee=res.customerType=="企业客户"?res.compName:res.customerName
  270. this.detailData.accountNumber=res.bankCard
  271. this.detailData.bank=res.bankDeposit
  272. this.detailData.bankBranch=res.bankDepositBranch
  273. this.$forceUpdate()
  274. })
  275. }
  276. },
  277. watch: {
  278. imglist: {
  279. handler: function() {
  280. this.$api.doRequest('get', 'appendix/query/getFileList', {
  281. appendixIds: this.imglist.toString()
  282. }).then(res => {
  283. this.imglist2 = res.data.data
  284. })
  285. },
  286. deep: true
  287. }
  288. },
  289. methods: {
  290. typeCheck(e){
  291. this.detailData.wareExpenseType=this.typeList[e[0]].value
  292. },
  293. typeCheck1(e){
  294. this.detailData.flag=this.typeList1[e[0]].value
  295. },
  296. afterRead(e) {
  297. console.log(e)
  298. },
  299. async uploadClick() {
  300. let baseUrlNew = config.def().baseUrlNew
  301. let pcUserInfo = uni.getStorageSync('pcUserInfo')
  302. console.log('baseUrlNew',baseUrlNew)
  303. if(!pcUserInfo){
  304. uni.showToast({
  305. title:"登录已失效,请重新登录"
  306. })
  307. return
  308. }
  309. uni.chooseImage({
  310. count:10,
  311. success: (chooseImageRes) => {
  312. console.log('chooseImageRes',chooseImageRes)
  313. let files = []
  314. for (let item of chooseImageRes.tempFiles) {
  315. files.push({
  316. name: 'fileName',
  317. url : item.path
  318. });
  319. }
  320. console.log(files)
  321. for (let i = 0; i < files.length; i++) {
  322. uni.uploadFile({
  323. url: baseUrlNew + 'appendix/api/uploadFiles',
  324. // url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
  325. // files: files[i],
  326. filePath:files[i].url,
  327. name:files[i].name,
  328. formData: {
  329. // fileName: chooseImageRes.tempFiles[0],
  330. companyId: pcUserInfo.compId,
  331. modelId: '',
  332. vesselId: '',
  333. },
  334. success: (uploadFileRes) => {
  335. console.log(JSON.parse(uploadFileRes.data))
  336. var data = JSON.parse(uploadFileRes.data).data
  337. data.compId = pcUserInfo.compId
  338. this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
  339. newAppendixs: [data],
  340. oldAppendixIds: ""
  341. }).then(res => {
  342. this.imglist.push(res.data.data[0])
  343. console.log(res)
  344. })
  345. console.log(uploadFileRes.data);
  346. },
  347. fail(res) {
  348. console.log(res);
  349. }
  350. });
  351. }
  352. }
  353. });
  354. },
  355. deleteImg(index) {
  356. this.imglist.splice(index, 1)
  357. },
  358. calculate() {
  359. const query = uni.createSelectorQuery().in(this);
  360. query.selectAll('.left')
  361. console.log(query)
  362. },
  363. ltCheck(e) {
  364. this.detailData.purpose = this.purposeList[e[0]].purpose
  365. if (this.detailData.purpose == "合同费用") {
  366. this.detailData.expensesPurpose = "1"
  367. delete this.detailData.warehouseName
  368. } else if (this.detailData.purpose == "库点费用") {
  369. this.detailData.expensesPurpose = "3"
  370. delete this.detailData.contractNo
  371. } else {
  372. this.detailData.expensesPurpose = "5"
  373. delete this.detailData.warehouseName
  374. delete this.detailData.contractNo
  375. if(this.reType == 2){
  376. this.show1 = true
  377. }
  378. }
  379. console.log(this.detailData)
  380. },
  381. confirmname(e) {
  382. this.detailData.belongName = this.namelist[e[0]].name
  383. },
  384. selectCon() {
  385. uni.navigateTo({
  386. url: '/pages/reimbursement/selectContract'
  387. })
  388. },
  389. selectWare() {
  390. uni.navigateTo({
  391. url: '/pages/reimbursement/selectWarehouse?warehouseType=1'
  392. })
  393. },
  394. submit() {
  395. if (!this.detailData.purpose) {
  396. this.$api.msg('用途不能为空')
  397. return
  398. }
  399. if (!this.detailData.warehouseName && this.detailData.purpose == '库点费用') {
  400. this.$api.msg('请选择仓库名称')
  401. return
  402. }
  403. if (!this.detailData.contractNo && this.detailData.purpose == '合同费用') {
  404. this.$api.msg('请选择合同编号')
  405. return
  406. }
  407. if (this.expensesType == '2') {
  408. if(!this.detailData.payerHeader){
  409. this.$api.msg('付款方不能为空')
  410. return
  411. }
  412. }
  413. if (!this.detailData.amountMoney) {
  414. this.$api.msg('金额不能为空')
  415. return
  416. }
  417. var that = this
  418. var title
  419. var theInterface
  420. if (that.expensesType == '1') {
  421. title = "确定提交收款信息?"
  422. } else {
  423. title = "确定提交请款信息?"
  424. }
  425. if (that.id) {
  426. theInterface = '/expenseInfo/editInfo'
  427. that.detailData.id = that.id
  428. } else {
  429. theInterface = '/expenseInfo/api/addInfo'
  430. }
  431. uni.showModal({
  432. content: title,
  433. showCancel: true,
  434. confirmText: '提交',
  435. success: function(res) {
  436. if (res.confirm) {
  437. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  438. that.detailData.agent = uni.getStorageSync('userInfo').userName
  439. that.detailData.identification = that.detailData.identification
  440. that.detailData.costType = that.detailData.costType
  441. that.detailData.expensesType = that.reType
  442. that.detailData.fieldName = uni.getStorageSync('userInfo').userName
  443. that.detailData.totalDistribution = that.detailData.totalDistribution
  444. if (that.imglist.length > 0) {
  445. that.detailData.addressUrl = that.imglist.toString()
  446. }
  447. uni.showLoading({
  448. title: "加载中",
  449. mask: true
  450. })
  451. that.$api.doRequest('post', theInterface, that.detailData)
  452. .then(res => {
  453. if (res.data.code == 200) {
  454. uni.hideLoading()
  455. that.$api.msg('提交成功')
  456. uni.navigateBack({
  457. delta: 1
  458. });
  459. } else {
  460. that.$api.msg(res.data.message)
  461. }
  462. })
  463. }
  464. }
  465. })
  466. },
  467. //获取信息
  468. getRequest() {
  469. this.$api.doRequest('get', '/expenseInfo/ExpenseInfo', {
  470. id: this.id,
  471. }).then(res => {
  472. if (res.data.code == 200) {
  473. this.detailData = res.data.data
  474. this.imglist = this.detailData.addressUrl.split(',')
  475. }
  476. })
  477. },
  478. },
  479. }
  480. </script>
  481. <style lang='scss' scoped>
  482. page {
  483. background: #F5F6FA;
  484. }
  485. .delete_img {
  486. position: absolute;
  487. z-index: 100;
  488. left: 84px;
  489. color: #ffffff;
  490. font-size: 28rpx;
  491. border: 1px;
  492. border-radius: 5rpx;
  493. width: 32rpx;
  494. height: 32rpx;
  495. background-color: #ff0000;
  496. text-align: center;
  497. }
  498. .title_b {
  499. margin: 20rpx 20rpx 0rpx 20rpx;
  500. padding: 20rpx 10rpx 20rpx 10rpx;
  501. font-size: 18px;
  502. font-weight: 550;
  503. }
  504. .xinxi {
  505. padding: 20rpx 30rpx;
  506. }
  507. .tubiao {
  508. margin: 0 auto;
  509. text-align: center;
  510. margin-top: 35rpx;
  511. }
  512. .biankuang {
  513. border: 1px dashed #AFB3BF;
  514. border-radius: 10rpx;
  515. width: 200rpx;
  516. height: 200rpx;
  517. margin-left: 20rpx;
  518. }
  519. .upload {
  520. width: 80rpx;
  521. height: 80rpx;
  522. }
  523. .c-row {
  524. display: -webkit-box;
  525. display: -webkit-flex;
  526. display: flex;
  527. -webkit-box-align: center;
  528. -webkit-align-items: center;
  529. align-items: center;
  530. padding: 20rpx 30rpx;
  531. position: relative;
  532. }
  533. .con-list {
  534. -webkit-box-flex: 1;
  535. flex: 1;
  536. display: flex;
  537. -webkit-box-orient: vertical;
  538. -webkit-box-direction: normal;
  539. flex-direction: column;
  540. color: #303133;
  541. line-height: 20px;
  542. text-align: right;
  543. padding-right: 10px;
  544. justify-content: space-between;
  545. }
  546. .wrap {
  547. padding-bottom: 10px;
  548. font-size: 14px;
  549. background: #fff;
  550. margin: 10px;
  551. border-radius: 10px;
  552. input {
  553. font-size: 14px;
  554. }
  555. >.title {
  556. padding: 10px 16px;
  557. }
  558. }
  559. .buns_item {
  560. display: flex;
  561. padding: 80rpx 0 50rpx 0;
  562. justify-content: space-around;
  563. }
  564. .but_css {
  565. background: #22C572;
  566. width: 40%;
  567. padding: 20rpx;
  568. color: #fff;
  569. text-align: center;
  570. border-radius: 20rpx;
  571. }
  572. /deep/.u-radio-group {
  573. flex-direction: row-reverse;
  574. }
  575. .no-boder {
  576. border: 0;
  577. }
  578. .textarea {
  579. background: #F9F9FA;
  580. border: 1px solid #EEEEEE;
  581. }
  582. .remark {
  583. position: absolute;
  584. right: 10px;
  585. bottom: 20px;
  586. color: #AFB3BF;
  587. }
  588. .submit {
  589. width: 100%;
  590. background: #2c8ac5;
  591. border-radius: 10rpx;
  592. }
  593. .bottom-btn {
  594. padding: 30rpx;
  595. background: #FFFFFF;
  596. width: 100%;
  597. position: fixed;
  598. bottom: 0rpx;
  599. display: flex;
  600. z-index: 9999;
  601. }
  602. .content {
  603. overflow: hidden;
  604. }
  605. .btn {
  606. border-radius: 50rpx;
  607. padding: 20rpx 0;
  608. background: #22C572;
  609. color: #fff;
  610. font-size: 32rpx;
  611. width: 100%;
  612. box-sizing: border-box;
  613. display: flex;
  614. justify-content: center;
  615. }
  616. .margin-bottom{
  617. margin-bottom:84px;
  618. }
  619. </style>