request_funds.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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. ],
  205. namelist:[
  206. {name: "黑龙江中天昊元贸易有限公司"},
  207. {name: "中天昊元-建发合营"},
  208. {name: "中天昊元-六水香合营"},
  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. ],
  234. reType: "",
  235. flag: "",
  236. warehouseInfo: {},
  237. contractNoInfo: {},
  238. }
  239. },
  240. onLoad(options) {
  241. this.reType = options.reType
  242. this.expensesType = options.expensesType
  243. if(this.reType==2||this.expensesType==2){
  244. uni.setNavigationBarTitle({title: '请款'});
  245. }
  246. this.id = options.id
  247. if (this.id) {
  248. this.getRequest()
  249. } else {
  250. return
  251. }
  252. },
  253. onShow() {
  254. this.warehouseInfo = uni.getStorageSync('theWarehouse');
  255. if (this.warehouseInfo && this.detailData.purpose == "库点费用") {
  256. this.detailData.warehouseName = this.warehouseInfo.warehouseName
  257. this.$forceUpdate()
  258. }
  259. this.contractNoInfo = uni.getStorageSync('reContractNo');
  260. if (this.contractNoInfo && this.detailData.purpose == "合同费用") {
  261. this.detailData.contractId = this.contractNoInfo.id
  262. this.detailData.contractNo = this.contractNoInfo.contractNo
  263. this.$api.doRequest('get', 'customerInfo/getPayeeInfo', {
  264. contractNo: this.detailData.contractNo
  265. }).then(res => {
  266. this.detailData.payee=res.customerType=="企业客户"?res.compName:res.customerName
  267. this.detailData.accountNumber=res.bankCard
  268. this.detailData.bank=res.bankDeposit
  269. this.detailData.bankBranch=res.bankDepositBranch
  270. this.$forceUpdate()
  271. })
  272. }
  273. },
  274. watch: {
  275. imglist: {
  276. handler: function() {
  277. this.$api.doRequest('get', 'appendix/query/getFileList', {
  278. appendixIds: this.imglist.toString()
  279. }).then(res => {
  280. this.imglist2 = res.data.data
  281. })
  282. },
  283. deep: true
  284. }
  285. },
  286. methods: {
  287. typeCheck(e){
  288. this.detailData.wareExpenseType=this.typeList[e[0]].value
  289. },
  290. typeCheck1(e){
  291. this.detailData.flag=this.typeList1[e[0]].value
  292. },
  293. afterRead(e) {
  294. console.log(e)
  295. },
  296. async uploadClick() {
  297. let baseUrlNew = config.def().baseUrlNew
  298. let pcUserInfo = uni.getStorageSync('pcUserInfo')
  299. console.log('baseUrlNew',baseUrlNew)
  300. if(!pcUserInfo){
  301. uni.showToast({
  302. title:"登录已失效,请重新登录"
  303. })
  304. return
  305. }
  306. uni.chooseImage({
  307. count:10,
  308. success: (chooseImageRes) => {
  309. console.log('chooseImageRes',chooseImageRes)
  310. let files = []
  311. for (let item of chooseImageRes.tempFiles) {
  312. files.push({
  313. name: 'fileName',
  314. url : item.path
  315. });
  316. }
  317. console.log(files)
  318. for (let i = 0; i < files.length; i++) {
  319. uni.uploadFile({
  320. url: baseUrlNew + 'appendix/api/uploadFiles',
  321. // url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
  322. // files: files[i],
  323. filePath:files[i].url,
  324. name:files[i].name,
  325. formData: {
  326. // fileName: chooseImageRes.tempFiles[0],
  327. companyId: pcUserInfo.compId,
  328. modelId: '',
  329. vesselId: '',
  330. },
  331. success: (uploadFileRes) => {
  332. console.log(JSON.parse(uploadFileRes.data))
  333. var data = JSON.parse(uploadFileRes.data).data
  334. data.compId = pcUserInfo.compId
  335. this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
  336. newAppendixs: [data],
  337. oldAppendixIds: ""
  338. }).then(res => {
  339. this.imglist.push(res.data.data[0])
  340. console.log(res)
  341. })
  342. console.log(uploadFileRes.data);
  343. },
  344. fail(res) {
  345. console.log(res);
  346. }
  347. });
  348. }
  349. }
  350. });
  351. },
  352. deleteImg(index) {
  353. this.imglist.splice(index, 1)
  354. },
  355. calculate() {
  356. const query = uni.createSelectorQuery().in(this);
  357. query.selectAll('.left')
  358. console.log(query)
  359. },
  360. ltCheck(e) {
  361. this.detailData.purpose = this.purposeList[e[0]].purpose
  362. if (this.detailData.purpose == "合同费用") {
  363. this.detailData.expensesPurpose = "1"
  364. delete this.detailData.warehouseName
  365. } else if (this.detailData.purpose == "库点费用") {
  366. this.detailData.expensesPurpose = "3"
  367. delete this.detailData.contractNo
  368. } else {
  369. this.detailData.expensesPurpose = "5"
  370. delete this.detailData.warehouseName
  371. delete this.detailData.contractNo
  372. if(this.reType == 2){
  373. this.show1 = true
  374. }
  375. }
  376. console.log(this.detailData)
  377. },
  378. confirmname(e) {
  379. this.detailData.belongName = this.namelist[e[0]].name
  380. },
  381. selectCon() {
  382. uni.navigateTo({
  383. url: '/pages/reimbursement/selectContract'
  384. })
  385. },
  386. selectWare() {
  387. uni.navigateTo({
  388. url: '/pages/reimbursement/selectWarehouse?warehouseType=1'
  389. })
  390. },
  391. submit() {
  392. if (!this.detailData.purpose) {
  393. this.$api.msg('用途不能为空')
  394. return
  395. }
  396. if (!this.detailData.warehouseName && this.detailData.purpose == '库点费用') {
  397. this.$api.msg('请选择仓库名称')
  398. return
  399. }
  400. if (!this.detailData.contractNo && this.detailData.purpose == '合同费用') {
  401. this.$api.msg('请选择合同编号')
  402. return
  403. }
  404. if (this.expensesType == '2') {
  405. if(!this.detailData.payerHeader){
  406. this.$api.msg('付款方不能为空')
  407. return
  408. }
  409. }
  410. if (!this.detailData.amountMoney) {
  411. this.$api.msg('金额不能为空')
  412. return
  413. }
  414. var that = this
  415. var title
  416. var theInterface
  417. if (that.expensesType == '1') {
  418. title = "确定提交收款信息?"
  419. } else {
  420. title = "确定提交请款信息?"
  421. }
  422. if (that.id) {
  423. theInterface = '/expenseInfo/editInfo'
  424. that.detailData.id = that.id
  425. } else {
  426. theInterface = '/expenseInfo/api/addInfo'
  427. }
  428. uni.showModal({
  429. content: title,
  430. showCancel: true,
  431. confirmText: '提交',
  432. success: function(res) {
  433. if (res.confirm) {
  434. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  435. that.detailData.agent = uni.getStorageSync('userInfo').userName
  436. that.detailData.identification = that.detailData.identification
  437. that.detailData.costType = that.detailData.costType
  438. that.detailData.expensesType = that.reType
  439. that.detailData.fieldName = uni.getStorageSync('userInfo').userName
  440. that.detailData.totalDistribution = that.detailData.totalDistribution
  441. if (that.imglist.length > 0) {
  442. that.detailData.addressUrl = that.imglist.toString()
  443. }
  444. uni.showLoading({
  445. title: "加载中",
  446. mask: true
  447. })
  448. that.$api.doRequest('post', theInterface, that.detailData)
  449. .then(res => {
  450. if (res.data.code == 200) {
  451. uni.hideLoading()
  452. that.$api.msg('提交成功')
  453. uni.navigateBack({
  454. delta: 1
  455. });
  456. } else {
  457. that.$api.msg(res.data.message)
  458. }
  459. })
  460. }
  461. }
  462. })
  463. },
  464. //获取信息
  465. getRequest() {
  466. this.$api.doRequest('get', '/expenseInfo/ExpenseInfo', {
  467. id: this.id,
  468. }).then(res => {
  469. if (res.data.code == 200) {
  470. this.detailData = res.data.data
  471. this.imglist = this.detailData.addressUrl.split(',')
  472. }
  473. })
  474. },
  475. },
  476. }
  477. </script>
  478. <style lang='scss' scoped>
  479. page {
  480. background: #F5F6FA;
  481. }
  482. .delete_img {
  483. position: absolute;
  484. z-index: 100;
  485. left: 84px;
  486. color: #ffffff;
  487. font-size: 28rpx;
  488. border: 1px;
  489. border-radius: 5rpx;
  490. width: 32rpx;
  491. height: 32rpx;
  492. background-color: #ff0000;
  493. text-align: center;
  494. }
  495. .title_b {
  496. margin: 20rpx 20rpx 0rpx 20rpx;
  497. padding: 20rpx 10rpx 20rpx 10rpx;
  498. font-size: 18px;
  499. font-weight: 550;
  500. }
  501. .xinxi {
  502. padding: 20rpx 30rpx;
  503. }
  504. .tubiao {
  505. margin: 0 auto;
  506. text-align: center;
  507. margin-top: 35rpx;
  508. }
  509. .biankuang {
  510. border: 1px dashed #AFB3BF;
  511. border-radius: 10rpx;
  512. width: 200rpx;
  513. height: 200rpx;
  514. margin-left: 20rpx;
  515. }
  516. .upload {
  517. width: 80rpx;
  518. height: 80rpx;
  519. }
  520. .c-row {
  521. display: -webkit-box;
  522. display: -webkit-flex;
  523. display: flex;
  524. -webkit-box-align: center;
  525. -webkit-align-items: center;
  526. align-items: center;
  527. padding: 20rpx 30rpx;
  528. position: relative;
  529. }
  530. .con-list {
  531. -webkit-box-flex: 1;
  532. flex: 1;
  533. display: flex;
  534. -webkit-box-orient: vertical;
  535. -webkit-box-direction: normal;
  536. flex-direction: column;
  537. color: #303133;
  538. line-height: 20px;
  539. text-align: right;
  540. padding-right: 10px;
  541. justify-content: space-between;
  542. }
  543. .wrap {
  544. padding-bottom: 10px;
  545. font-size: 14px;
  546. background: #fff;
  547. margin: 10px;
  548. border-radius: 10px;
  549. input {
  550. font-size: 14px;
  551. }
  552. >.title {
  553. padding: 10px 16px;
  554. }
  555. }
  556. .buns_item {
  557. display: flex;
  558. padding: 80rpx 0 50rpx 0;
  559. justify-content: space-around;
  560. }
  561. .but_css {
  562. background: #22C572;
  563. width: 40%;
  564. padding: 20rpx;
  565. color: #fff;
  566. text-align: center;
  567. border-radius: 20rpx;
  568. }
  569. /deep/.u-radio-group {
  570. flex-direction: row-reverse;
  571. }
  572. .no-boder {
  573. border: 0;
  574. }
  575. .textarea {
  576. background: #F9F9FA;
  577. border: 1px solid #EEEEEE;
  578. }
  579. .remark {
  580. position: absolute;
  581. right: 10px;
  582. bottom: 20px;
  583. color: #AFB3BF;
  584. }
  585. .submit {
  586. width: 100%;
  587. background: #2c8ac5;
  588. border-radius: 10rpx;
  589. }
  590. .bottom-btn {
  591. padding: 30rpx;
  592. background: #FFFFFF;
  593. width: 100%;
  594. position: fixed;
  595. bottom: 0rpx;
  596. display: flex;
  597. z-index: 9999;
  598. }
  599. .content {
  600. overflow: hidden;
  601. }
  602. .btn {
  603. border-radius: 50rpx;
  604. padding: 20rpx 0;
  605. background: #22C572;
  606. color: #fff;
  607. font-size: 32rpx;
  608. width: 100%;
  609. box-sizing: border-box;
  610. display: flex;
  611. justify-content: center;
  612. }
  613. .margin-bottom{
  614. margin-bottom:84px;
  615. }
  616. </style>