request_funds.vue 17 KB

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