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