request_funds.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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. filePath: chooseImageRes.tempFilePaths[0],
  179. uri : chooseImageRes.tempFilePaths[0],
  180. formData: {
  181. fileName: chooseImageRes.tempFiles[0],
  182. companyId: "2710b21efc1e4393930c5dc800010dc4",
  183. modelId: '',
  184. vesselId: '',
  185. },
  186. success: (uploadFileRes) => {
  187. console.log(uploadFileRes.data,11111111111)
  188. var data = JSON.parse(uploadFileRes.data).data
  189. this.$api.doRequest('post', '/appendix/api/saveFiles', {
  190. newAppendixs: [data],
  191. oldAppendixIds: ""
  192. }).then(res => {
  193. this.imglist.push(res.data.data[0])
  194. console.log(res)
  195. })
  196. console.log(uploadFileRes.data);
  197. }
  198. });
  199. }
  200. });
  201. },
  202. deleteImg(index) {
  203. this.imglist.splice(index, 1)
  204. },
  205. calculate() {
  206. const query = uni.createSelectorQuery().in(this);
  207. query.selectAll('.left')
  208. console.log(query)
  209. },
  210. ltCheck(e) {
  211. this.detailData.purpose = this.purposeList[e[0]].purpose
  212. if (this.detailData.purpose == "合同费用") {
  213. this.detailData.expensesPurpose = "1"
  214. delete this.detailData.warehouseName
  215. } else if (this.detailData.purpose == "库点费用") {
  216. this.detailData.expensesPurpose = "3"
  217. delete this.detailData.contractNo
  218. } else {
  219. this.detailData.expensesPurpose = "5"
  220. delete this.detailData.warehouseName
  221. delete this.detailData.contractNo
  222. }
  223. console.log(this.detailData)
  224. },
  225. selectCon() {
  226. uni.navigateTo({
  227. url: '/pages/reimbursement/selectContract'
  228. })
  229. },
  230. selectWare() {
  231. uni.navigateTo({
  232. url: '/pages/reimbursement/selectWarehouse?warehouseType=1'
  233. })
  234. },
  235. submit() {
  236. if (!this.detailData.purpose) {
  237. this.$api.msg('用途不能为空')
  238. return
  239. }
  240. if (!this.detailData.warehouseName && this.detailData.purpose == '库点费用') {
  241. this.$api.msg('请选择仓库名称')
  242. return
  243. }
  244. if (!this.detailData.contractNo && this.detailData.purpose == '合同费用') {
  245. this.$api.msg('请选择合同编号')
  246. return
  247. }
  248. if (!this.detailData.amountMoney) {
  249. this.$api.msg('金额不能为空')
  250. return
  251. }
  252. var that = this
  253. var title
  254. var theInterface
  255. if (that.expensesType == '1') {
  256. title = "确定提交收款信息?"
  257. } else {
  258. title = "确定提交请款信息?"
  259. }
  260. if (that.id) {
  261. theInterface = '/expenseInfo/editInfo'
  262. that.detailData.id = that.id
  263. } else {
  264. theInterface = '/expenseInfo/api/addInfo'
  265. }
  266. uni.showModal({
  267. content: title,
  268. showCancel: true,
  269. confirmText: '提交',
  270. success: function(res) {
  271. if (res.confirm) {
  272. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  273. that.detailData.agent = uni.getStorageSync('userInfo').userName
  274. that.detailData.identification = that.detailData.identification
  275. that.detailData.costType = that.detailData.costType
  276. that.detailData.expensesType = that.reType
  277. that.detailData.fieldName = uni.getStorageSync('userInfo').userName
  278. that.detailData.totalDistribution = that.detailData.totalDistribution
  279. if (that.imglist.length > 0) {
  280. that.detailData.addressUrl = that.imglist.toString()
  281. }
  282. uni.showLoading({
  283. title: "加载中",
  284. mask: true
  285. })
  286. that.$api.doRequest('post', theInterface, that.detailData)
  287. .then(res => {
  288. if (res.data.code == 200) {
  289. uni.hideLoading()
  290. that.$api.msg('提交成功')
  291. uni.navigateTo({
  292. url: '/pages/reimbursement/the_reimbursement'
  293. })
  294. } else {
  295. that.$api.msg('提交失败')
  296. }
  297. })
  298. }
  299. }
  300. })
  301. },
  302. //获取信息
  303. getRequest() {
  304. this.$api.doRequest('get', '/expenseInfo/ExpenseInfo', {
  305. id: this.id,
  306. }).then(res => {
  307. if (res.data.code == 200) {
  308. this.detailData = res.data.data
  309. this.imglist = this.detailData.addressUrl.split(',')
  310. }
  311. })
  312. },
  313. },
  314. }
  315. </script>
  316. <style lang='scss' scoped>
  317. page {
  318. background: #F5F6FA;
  319. }
  320. .delete_img {
  321. position: absolute;
  322. z-index: 100;
  323. left: 84px;
  324. color: #ffffff;
  325. font-size: 28rpx;
  326. border: 1px;
  327. border-radius: 5rpx;
  328. width: 32rpx;
  329. height: 32rpx;
  330. background-color: #ff0000;
  331. text-align: center;
  332. }
  333. .title_b {
  334. margin: 20rpx 20rpx 0rpx 20rpx;
  335. padding: 20rpx 10rpx 20rpx 10rpx;
  336. font-size: 18px;
  337. font-weight: 550;
  338. }
  339. .xinxi {
  340. padding: 20rpx 30rpx;
  341. }
  342. .tubiao {
  343. margin: 0 auto;
  344. text-align: center;
  345. margin-top: 35rpx;
  346. }
  347. .biankuang {
  348. border: 1px dashed #AFB3BF;
  349. border-radius: 10rpx;
  350. width: 200rpx;
  351. height: 200rpx;
  352. margin-left: 20rpx;
  353. }
  354. .upload {
  355. width: 80rpx;
  356. height: 80rpx;
  357. }
  358. .c-row {
  359. display: -webkit-box;
  360. display: -webkit-flex;
  361. display: flex;
  362. -webkit-box-align: center;
  363. -webkit-align-items: center;
  364. align-items: center;
  365. padding: 20rpx 30rpx;
  366. position: relative;
  367. }
  368. .con-list {
  369. -webkit-box-flex: 1;
  370. flex: 1;
  371. display: flex;
  372. -webkit-box-orient: vertical;
  373. -webkit-box-direction: normal;
  374. flex-direction: column;
  375. color: #303133;
  376. line-height: 20px;
  377. text-align: right;
  378. padding-right: 10px;
  379. justify-content: space-between;
  380. }
  381. .wrap {
  382. padding-bottom: 10px;
  383. font-size: 14px;
  384. background: #fff;
  385. margin: 10px;
  386. border-radius: 10px;
  387. input {
  388. font-size: 14px;
  389. }
  390. >.title {
  391. padding: 10px 16px;
  392. }
  393. }
  394. .buns_item {
  395. display: flex;
  396. padding: 80rpx 0 50rpx 0;
  397. justify-content: space-around;
  398. }
  399. .but_css {
  400. background: #22C572;
  401. width: 40%;
  402. padding: 20rpx;
  403. color: #fff;
  404. text-align: center;
  405. border-radius: 20rpx;
  406. }
  407. /deep/.u-radio-group {
  408. flex-direction: row-reverse;
  409. }
  410. .no-boder {
  411. border: 0;
  412. }
  413. .textarea {
  414. background: #F9F9FA;
  415. border: 1px solid #EEEEEE;
  416. }
  417. .remark {
  418. position: absolute;
  419. right: 10px;
  420. bottom: 20px;
  421. color: #AFB3BF;
  422. }
  423. .submit {
  424. width: 100%;
  425. background: #2c8ac5;
  426. border-radius: 10rpx;
  427. }
  428. .bottom-btn {
  429. padding: 30rpx;
  430. background: #FFFFFF;
  431. width: 100%;
  432. position: fixed;
  433. bottom: 0rpx;
  434. display: flex;
  435. z-index: 9999;
  436. }
  437. .content {
  438. overflow: hidden;
  439. }
  440. .btn {
  441. border-radius: 50rpx;
  442. padding: 20rpx 0;
  443. background: #22C572;
  444. color: #fff;
  445. font-size: 32rpx;
  446. width: 100%;
  447. box-sizing: border-box;
  448. display: flex;
  449. justify-content: center;
  450. }
  451. </style>