request_funds.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view>
  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. <u-button type="primary" class="submit" hover-class="none" @click="submit()">提交</u-button>
  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. debugger
  265. uni.showModal({
  266. content: title,
  267. showCancel: true,
  268. confirmText: '提交',
  269. success: function(res) {
  270. if (res.confirm) {
  271. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  272. that.detailData.agent = uni.getStorageSync('userInfo').userName
  273. that.detailData.identification = that.detailData.identification
  274. that.detailData.costType = that.detailData.costType
  275. that.detailData.expensesType = that.reType
  276. that.detailData.fieldName = uni.getStorageSync('userInfo').userName
  277. that.detailData.totalDistribution = that.detailData.totalDistribution
  278. if (that.imglist.length > 0) {
  279. that.detailData.addressUrl = that.imglist.toString()
  280. }
  281. that.$api.doRequest('post', theInterface, that.detailData)
  282. .then(res => {
  283. if (res.data.code == 200) {
  284. that.$api.msg('提交成功')
  285. uni.navigateTo({
  286. url: '/pages/reimbursement/the_reimbursement'
  287. })
  288. } else {
  289. that.$api.msg('提交失败')
  290. }
  291. })
  292. }
  293. }
  294. })
  295. },
  296. //获取信息
  297. getRequest() {
  298. this.$api.doRequest('get', '/expenseInfo/getInfo', {
  299. id: this.id,
  300. }).then(res => {
  301. if (res.data.code == 200) {
  302. this.detailData = res.data.data
  303. this.imglist = this.detailData.addressUrl.split(',')
  304. }
  305. })
  306. },
  307. },
  308. }
  309. </script>
  310. <style lang='scss' scoped>
  311. page {
  312. background: #F5F6FA;
  313. }
  314. .delete_img {
  315. position: absolute;
  316. z-index: 100;
  317. left: 84px;
  318. color: #ffffff;
  319. font-size: 28rpx;
  320. border: 1px;
  321. border-radius: 5rpx;
  322. width: 32rpx;
  323. height: 32rpx;
  324. background-color: #ff0000;
  325. text-align: center;
  326. }
  327. .title_b {
  328. margin: 20rpx 20rpx 0rpx 20rpx;
  329. padding: 20rpx 10rpx 20rpx 10rpx;
  330. font-size: 18px;
  331. font-weight: 550;
  332. }
  333. .xinxi {
  334. padding: 20rpx 30rpx;
  335. }
  336. .tubiao {
  337. margin: 0 auto;
  338. text-align: center;
  339. margin-top: 35rpx;
  340. }
  341. .biankuang {
  342. border: 1px dashed #AFB3BF;
  343. border-radius: 10rpx;
  344. width: 200rpx;
  345. height: 200rpx;
  346. margin-left: 20rpx;
  347. }
  348. .upload {
  349. width: 80rpx;
  350. height: 80rpx;
  351. }
  352. .c-row {
  353. display: -webkit-box;
  354. display: -webkit-flex;
  355. display: flex;
  356. -webkit-box-align: center;
  357. -webkit-align-items: center;
  358. align-items: center;
  359. padding: 20rpx 30rpx;
  360. position: relative;
  361. }
  362. .con-list {
  363. -webkit-box-flex: 1;
  364. flex: 1;
  365. display: flex;
  366. -webkit-box-orient: vertical;
  367. -webkit-box-direction: normal;
  368. flex-direction: column;
  369. color: #303133;
  370. line-height: 20px;
  371. text-align: right;
  372. padding-right: 10px;
  373. justify-content: space-between;
  374. }
  375. .wrap {
  376. padding-bottom: 10px;
  377. font-size: 14px;
  378. background: #fff;
  379. margin: 10px;
  380. border-radius: 10px;
  381. input {
  382. font-size: 14px;
  383. }
  384. >.title {
  385. padding: 10px 16px;
  386. }
  387. }
  388. .buns_item {
  389. display: flex;
  390. padding: 80rpx 0 50rpx 0;
  391. justify-content: space-around;
  392. }
  393. .but_css {
  394. background: #22C572;
  395. width: 40%;
  396. padding: 20rpx;
  397. color: #fff;
  398. text-align: center;
  399. border-radius: 20rpx;
  400. }
  401. /deep/.u-radio-group {
  402. flex-direction: row-reverse;
  403. }
  404. .no-boder {
  405. border: 0;
  406. }
  407. .textarea {
  408. background: #F9F9FA;
  409. border: 1px solid #EEEEEE;
  410. }
  411. .remark {
  412. position: absolute;
  413. right: 10px;
  414. bottom: 20px;
  415. color: #AFB3BF;
  416. }
  417. .submit {
  418. width: 100%;
  419. background: #2c8ac5;
  420. border-radius: 10rpx;
  421. }
  422. .bottom-btn {
  423. padding: 30rpx;
  424. background: #FFFFFF;
  425. width: 100%;
  426. position: fixed;
  427. bottom: 0rpx;
  428. display: flex;
  429. z-index: 9999;
  430. }
  431. </style>