request_funds.vue 12 KB

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