request_funds.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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}}
  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. }
  145. this.contractNoInfo = uni.getStorageSync('reContractNo');
  146. if (this.contractNoInfo && this.detailData.purpose == "合同费用") {
  147. this.detailData.contractId = this.contractNoInfo.id
  148. this.detailData.contractNo = this.contractNoInfo.contractNo
  149. this.$forceUpdate()
  150. }
  151. },
  152. watch: {
  153. imglist: {
  154. handler: function() {
  155. this.$api.doRequest('get', 'appendix/query/getFileList', {
  156. appendixIds: this.imglist.toString()
  157. }).then(res => {
  158. this.imglist2 = res.data.data
  159. console.log(res)
  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. that.$api.doRequest('post', theInterface, that.detailData)
  281. .then(res => {
  282. if (res.data.code == 200) {
  283. that.$api.msg('提交成功')
  284. uni.navigateTo({
  285. url: '/pages/reimbursement/the_reimbursement'
  286. })
  287. } else {
  288. that.$api.msg('提交失败')
  289. }
  290. })
  291. }
  292. }
  293. })
  294. },
  295. //获取信息
  296. getRequest() {
  297. this.$api.doRequest('get', '/expenseInfo/getInfo', {
  298. id: this.id,
  299. }).then(res => {
  300. if (res.data.code == 200) {
  301. this.detailData = res.data.data
  302. this.imglist = this.detailData.addressUrl.split(',')
  303. }
  304. })
  305. },
  306. },
  307. }
  308. </script>
  309. <style lang='scss' scoped>
  310. page {
  311. background: #F5F6FA;
  312. }
  313. .delete_img {
  314. position: absolute;
  315. z-index: 100;
  316. left: 84px;
  317. color: #ffffff;
  318. font-size: 28rpx;
  319. border: 1px;
  320. border-radius: 5rpx;
  321. width: 32rpx;
  322. height: 32rpx;
  323. background-color: #ff0000;
  324. text-align: center;
  325. }
  326. .title_b {
  327. margin: 20rpx 20rpx 0rpx 20rpx;
  328. padding: 20rpx 10rpx 20rpx 10rpx;
  329. font-size: 18px;
  330. font-weight: 550;
  331. }
  332. .xinxi {
  333. padding: 20rpx 30rpx;
  334. }
  335. .tubiao {
  336. margin: 0 auto;
  337. text-align: center;
  338. margin-top: 35rpx;
  339. }
  340. .biankuang {
  341. border: 1px dashed #AFB3BF;
  342. border-radius: 10rpx;
  343. width: 200rpx;
  344. height: 200rpx;
  345. margin-left: 20rpx;
  346. }
  347. .upload {
  348. width: 80rpx;
  349. height: 80rpx;
  350. }
  351. .c-row {
  352. display: -webkit-box;
  353. display: -webkit-flex;
  354. display: flex;
  355. -webkit-box-align: center;
  356. -webkit-align-items: center;
  357. align-items: center;
  358. padding: 20rpx 30rpx;
  359. position: relative;
  360. }
  361. .con-list {
  362. -webkit-box-flex: 1;
  363. flex: 1;
  364. display: flex;
  365. -webkit-box-orient: vertical;
  366. -webkit-box-direction: normal;
  367. flex-direction: column;
  368. color: #303133;
  369. line-height: 20px;
  370. text-align: right;
  371. padding-right: 10px;
  372. justify-content: space-between;
  373. }
  374. .wrap {
  375. padding-bottom: 10px;
  376. font-size: 14px;
  377. background: #fff;
  378. margin: 10px;
  379. border-radius: 10px;
  380. input {
  381. font-size: 14px;
  382. }
  383. >.title {
  384. padding: 10px 16px;
  385. }
  386. }
  387. .buns_item {
  388. display: flex;
  389. padding: 80rpx 0 50rpx 0;
  390. justify-content: space-around;
  391. }
  392. .but_css {
  393. background: #22C572;
  394. width: 40%;
  395. padding: 20rpx;
  396. color: #fff;
  397. text-align: center;
  398. border-radius: 20rpx;
  399. }
  400. /deep/.u-radio-group {
  401. flex-direction: row-reverse;
  402. }
  403. .no-boder {
  404. border: 0;
  405. }
  406. .textarea {
  407. background: #F9F9FA;
  408. border: 1px solid #EEEEEE;
  409. }
  410. .remark {
  411. position: absolute;
  412. right: 10px;
  413. bottom: 20px;
  414. color: #AFB3BF;
  415. }
  416. .submit {
  417. width: 100%;
  418. background: #2c8ac5;
  419. border-radius: 10rpx;
  420. }
  421. .bottom-btn {
  422. padding: 30rpx;
  423. background: #FFFFFF;
  424. width: 100%;
  425. position: fixed;
  426. bottom: 0rpx;
  427. display: flex;
  428. z-index: 9999;
  429. }
  430. .content {
  431. overflow: hidden;
  432. }
  433. .btn {
  434. border-radius: 50rpx;
  435. padding: 20rpx 0;
  436. background: #22C572;
  437. color: #fff;
  438. font-size: 32rpx;
  439. width: 100%;
  440. box-sizing: border-box;
  441. display: flex;
  442. justify-content: center;
  443. }
  444. </style>