request_funds.vue 14 KB

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