request_funds.vue 18 KB

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