companybill.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <view class="page">
  3. <u-tabs :list="tabs" @click="sectionChange" style="background-color: #fff;" :current=current
  4. :itemStyle="{'width':'375rpx','padding':'24rpx'}" lineHeight="2px" lineWidth="30px"></u-tabs>
  5. <view class="contain" v-show="cdshow==true">
  6. <view class="nodata" v-if="nodata==true">
  7. 暂无数据
  8. </view>
  9. <template v-if="nodata==false">
  10. <!-- <view style="padding:16rpx 0 16rpx 32rpx">
  11. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  12. </view> -->
  13. <view class="paisong" style="margin-top: 16rpx;" v-for="(item,index) in billLists">
  14. <u-icon name="arrow-up" @click="item.showMore=false" class="iconBtn" size="20px"
  15. v-if="item.showMore" color="#999"></u-icon>
  16. <u-icon name="arrow-down" @click="item.showMore=true" class="iconBtn" size="22px" color="#999"
  17. v-else></u-icon>
  18. <view class="title">
  19. {{item.costType | getDictLab(that)}}: <span><text class="txt">¥{{item.amount}}</text>
  20. <text class="status s1" v-if='item.status==1'>
  21. 已支付
  22. </text>
  23. <text class="status s2" v-if='item.status==2'>
  24. 待支付
  25. </text>
  26. <text class="status s3" v-if='item.status==3'>
  27. 支付失败
  28. </text></span>
  29. </view>
  30. <template v-if="item.showMore">
  31. <view class="subtit" style="margin-top: 16rpx;" v-for="subItem in item.billLists"
  32. :key="subItem.id">
  33. <template v-if="item.costType!='PropertyFee'">
  34. {{subItem.equipName}}:{{subItem.amount}}
  35. </template>
  36. <template v-else>
  37. {{subItem.costType| getDictLab2(that)}}:{{subItem.amount}}
  38. </template>
  39. </view>
  40. </template>
  41. </view>
  42. </template>
  43. </view>
  44. <!-- 缴费记录 -->
  45. <view class="contain" v-show="cdshow==false">
  46. <view class="topbilledit" @click="typechange">
  47. <view class="changetime1">
  48. {{expensedata}}
  49. </view>
  50. <view class="changetime2">
  51. <u-icon name="arrow-down-fill" color="#999" size="20"></u-icon>
  52. </view>
  53. </view>
  54. <!-- 列表 -->
  55. <view class="nodata" v-if="jfnodata==true">
  56. 暂无数据
  57. </view>
  58. <view class="u-listdata" v-if="jfnodata==false">
  59. <view style="padding:16rpx 0 16rpx 32rpx">
  60. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  61. </view>
  62. <u-list @scrolltolower="scrolltolower" :pagingEnabled='true'
  63. style="height:400px;flex:1;padding-bottom: 49px;">
  64. <u-list-item v-for="(item, index) in indexList" :key="index">
  65. <view class="paisong2">
  66. <view class="status" v-if="item.type=='Subsidy'">
  67. 补助
  68. </view>
  69. <view class="status s2" v-if="item.type=='PreStorage'">
  70. 预存
  71. </view>
  72. <view class="status s3" v-if="item.type=='Refund'">
  73. 退费
  74. </view>
  75. <view class="status s4" v-if="item.type=='Water'">
  76. 水费
  77. </view>
  78. <view class="status s4" v-if="item.type=='Elec'">
  79. 电费
  80. </view>
  81. <view class="status s4" v-if="item.type=='PropertyFee'">
  82. 物业费
  83. </view>
  84. <view class="title">{{item.tenantInfo.name}}</view>
  85. <view class="subtit">
  86. 扣缴金额: <span>¥{{item.amount}}</span>
  87. </view>
  88. <view class="subtit">
  89. 账户余额: {{item.surplus}}
  90. </view>
  91. <view class="subtit">
  92. 租户电话:¥{{item.tenantInfo.tel}}
  93. </view>
  94. <view class="subtit">
  95. 操作人: {{item.creator}}
  96. </view>
  97. <view class="subtit">
  98. 扣缴时间: {{item.createDate}}
  99. </view>
  100. </view>
  101. </u-list-item>
  102. </u-list>
  103. </view>
  104. </view>
  105. <view class="Predeposit">
  106. <span @click="prestore('预存')">预存</span>
  107. <span @click="prestore('补助')">补助</span>
  108. </view>
  109. <u-picker :show="showtype" :itemHeight="80" :columns="columnstype" keyName="dictLabel" @confirm="confirmtype"
  110. @cancel='canceltype'> </u-picker>
  111. <u-popup :show="showpayjine" @close="closepay1" mode="bottom" :round="10" :closeable=true
  112. :closeOnClickOverlay=true>
  113. <view class="paytall1" style="padding-bottom: 20rpx;">
  114. <view class="hejitop">
  115. {{prestorename}}
  116. </view>
  117. <view class="zhifufs">
  118. <u--form labelWidth="30" labelPosition="left" :model="model1" :rules="rules" ref="uForm">
  119. <u-form-item label="¥" prop="userInfo.amount" ref="item1">
  120. <u--input v-model="model1.userInfo.amount" border="none" placeholder="点击输入金额"></u--input>
  121. </u-form-item>
  122. </u--form>
  123. </view>
  124. <view style="margin:0 32rpx">
  125. <u-button type="primary" text="确认支付" @click="Confirmationpaymentjine"></u-button>
  126. </view>
  127. </view>
  128. </u-popup>
  129. <view class="canys" v-if="zhifucanvas">
  130. <h4>请用微信扫码二维码</h4>
  131. <canvas class="zhifucanvas" canvas-id='canvas'></canvas>
  132. <view class="guanbi">
  133. <u-button type="primary" :plain="true" style="border:none" text="关闭" @click="guanbi"></u-button>
  134. </view>
  135. </view>
  136. <u-notify ref="uNotify" message=""></u-notify>
  137. </view>
  138. </template>
  139. <script>
  140. import qs from 'qs'
  141. var QRCode = require('@/utils/qrcode.js');
  142. const BaseApi = require("@/http/baseApi.js");
  143. export default {
  144. data() {
  145. return {
  146. that: this,
  147. billstype: [],
  148. columnstype: [],
  149. PropertyTypedata: [],
  150. billLists: [],
  151. tabs: [{
  152. name: '账单明细',
  153. }, {
  154. name: '扣缴记录'
  155. }],
  156. zhifucanvas: false,
  157. prestorename: '',
  158. model1: {
  159. userInfo: {
  160. amount: '',
  161. },
  162. },
  163. rules: {
  164. 'userInfo.amount': {
  165. type: 'string',
  166. required: true,
  167. message: '请填写预存金额',
  168. trigger: ['blur', 'change']
  169. },
  170. },
  171. showpayjine: false,
  172. totalnumber: 0,
  173. jfnodata: false,
  174. showtype: false,
  175. cdshow: true,
  176. fatherparameter: {},
  177. expensedata: '全部',
  178. list: ['账单明细', '缴费记录', ],
  179. current: 0,
  180. dataForm: {
  181. tenantId: "",
  182. costCycle: "",
  183. type: "",
  184. page: 1,
  185. limit: 10,
  186. },
  187. indexList: [],
  188. payStatusList: [],
  189. zddata: {
  190. amount: '',
  191. dtf: '',
  192. ktf: '',
  193. glf: '',
  194. },
  195. nodata: true,
  196. pd: true,
  197. jfpost: {
  198. tenantId: "",
  199. costCycle: "",
  200. type: "",
  201. page: 1,
  202. limit: 10,
  203. },
  204. }
  205. },
  206. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  207. onLoad: function(options) {
  208. //option为object类型,会序列化上个页面传递的参数
  209. this.fatherparameter = JSON.parse(decodeURIComponent(options.para));
  210. uni.setNavigationBarTitle({
  211. title: this.fatherparameter.name
  212. })
  213. this.dataForm.tenantId = this.fatherparameter.id;
  214. this.dataForm.costCycle = this.fatherparameter.cycle;
  215. this.dataForm.page = 1;
  216. this.jfpost.tenantId = this.fatherparameter.id;
  217. this.jfpost.costCycle = this.fatherparameter.cycle;
  218. this.jfpost.page = 1;
  219. this.getalldata();
  220. var getDictDataList = uni.getStorageSync('getDictDataList');
  221. this.billstype = getDictDataList.filter((item) => item.dictType == 'PayType');
  222. this.columnstype = [this.billstype[0].dataList];
  223. this.PropertyTypedata = getDictDataList.filter((item) => item.dictType == 'PropertyType');
  224. console.log(this.columnstype)
  225. },
  226. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  227. onReady() {},
  228. //监听页面隐藏
  229. onHide() {},
  230. //监听窗口尺寸变化
  231. onResize() {},
  232. //监听页面卸载
  233. onUnload() {},
  234. //监听用户下拉动作,一般用于下拉刷新
  235. onPullDownRefresh() {},
  236. filters: {
  237. getDictLab(v, that) {
  238. let val = that.billstype[0].dataList.filter((item) => item.dictValue == v);
  239. if (val && val[0]) {
  240. return val[0].dictLabel;
  241. }
  242. },
  243. getDictLab2(v, that) {
  244. let val = that.PropertyTypedata[0].dataList.filter((item) => item.dictValue == v);
  245. if (val && val[0]) {
  246. return val[0].dictLabel || '11';
  247. }
  248. }
  249. },
  250. methods: {
  251. // 创建订单
  252. createOrder(postdata, type) {
  253. uni.request({
  254. url: BaseApi.BaseApi + '/pay/createOrder',
  255. method: "POST",
  256. data: postdata,
  257. header: {
  258. 'content-type': 'application/x-www-form-urlencoded',
  259. "token": uni.getStorageSync('tokendata'),
  260. },
  261. success: (res) => {
  262. if (type) {
  263. let qrcode = new QRCode('canvas', {
  264. text: res.data.codeUrl, // weixin://wxpay/bizpayurl?pr=sZz****
  265. width: 213,
  266. height: 213,
  267. colorDark: "black",
  268. colorLight: "white",
  269. correctLevel: QRCode.CorrectLevel.H,
  270. });
  271. if (this.prestorename == '补助') {
  272. } else {
  273. }
  274. }
  275. }
  276. });
  277. },
  278. //预存和补助按钮点击
  279. prestore(e) {
  280. this.showpayjine = true;
  281. this.prestorename = e;
  282. },
  283. //确认支付预存和补助
  284. Confirmationpaymentjine() {
  285. this.$refs.uForm.validate().then(res => {
  286. this.showpayjine = false;
  287. if (this.prestorename == '预存') {
  288. this.prestoredata(this.model1.userInfo.amount)
  289. } else if (this.prestorename == '补助') {
  290. this.subsidydata(this.model1.userInfo.amount)
  291. }
  292. }).catch(errors => {
  293. uni.$u.toast('校验失败');
  294. })
  295. },
  296. //预存
  297. prestoredata(e) {
  298. this.zhifucanvas = true;
  299. this.showpayjine = false;
  300. let postdata = {
  301. totalFee: e,
  302. tenantId: this.dataForm.tenantId,
  303. tradeType: 'NATIVE',
  304. billIds: ''
  305. }
  306. this.createOrder(postdata, 1);
  307. },
  308. //补助
  309. subsidydata(e) {
  310. this.zhifucanvas = true;
  311. this.showpayjine = false;
  312. let postdata = {
  313. totalFee: e,
  314. tenantId: this.fatherparameter.id,
  315. tradeType: 'NATIVE',
  316. billIds: ''
  317. }
  318. this.createOrder(postdata, 1);
  319. },
  320. closepay1() {
  321. this.showpayjine = false
  322. },
  323. //微信二维码关闭
  324. guanbi() {
  325. this.zhifucanvas = false;
  326. this.getjfdata();
  327. },
  328. //取消预存
  329. canceltype() {
  330. this.showtype = false;
  331. },
  332. //类型查询确定
  333. confirmtype(e) {
  334. this.showtype = false;
  335. this.expensedata = e.value[0].dictLabel;
  336. if (e.value[0].dictLabel == '全部') {
  337. this.jfpost.type = '';
  338. } else {
  339. this.jfpost.type = e.value[0].dictValue;
  340. }
  341. this.indexList = [];
  342. this.jfpost.page = 1;
  343. this.getjfdata();
  344. },
  345. //类型查询
  346. typechange() {
  347. this.showtype = true;
  348. },
  349. //tab 切换
  350. sectionChange(val) {
  351. this.current = val.index;
  352. if (val.index == 0) {
  353. this.cdshow = true;
  354. } else if (val.index == 1) {
  355. this.cdshow = false;
  356. this.indexList = [];
  357. this.jfpost.page = 1;
  358. this.getjfdata();
  359. }
  360. },
  361. //加载更多
  362. scrolltolower() {
  363. if (this.pd) {
  364. this.getjfdata();
  365. } else {
  366. return
  367. }
  368. },
  369. //扣缴记录
  370. getjfdata() {
  371. this.$api.get('/payrecord/page', this.jfpost)
  372. .then(res => {
  373. this.totalnumber = res.data.data.total;
  374. if (res.data.data.list.length != 0) {
  375. this.indexList.push(...res.data.data.list);
  376. this.jfpost.page = this.jfpost.page + 1;
  377. this.pd = true;
  378. this.jfnodata = false;
  379. } else {
  380. uni.showToast({
  381. title: '暂无更多数据了',
  382. icon: 'none',
  383. duration: 1500
  384. })
  385. this.pd = false;
  386. }
  387. })
  388. },
  389. //账单明细
  390. getalldata() {
  391. this.$api.post('/billinfo/billDetail', this.dataForm)
  392. .then(res => {
  393. this.totalnumber = res.data.data.total;
  394. this.zddata = {};
  395. if (res.data.data.length == 0) {
  396. this.nodata = true;
  397. } else {
  398. for (let i = 0; i < res.data.data.length; i++) {
  399. res.data.data[i].showMore = false;
  400. }
  401. this.nodata = false;
  402. this.billLists = res.data.data;
  403. }
  404. })
  405. },
  406. }
  407. }
  408. </script>
  409. <style lang="scss">
  410. .Predeposit {
  411. position: fixed;
  412. bottom: 0;
  413. left: 0;
  414. right: 0;
  415. height: 98rpx;
  416. z-index: 2;
  417. line-height: 98rpx;
  418. width: 750rpx;
  419. background-color: #fff;
  420. text-align: center;
  421. color: #2E69EB;
  422. box-shadow: 0 -6px 12px 0 rgba(153, 153, 153, 0.10);
  423. display: flex;
  424. align-items: center;
  425. justify-content: space-around;
  426. }
  427. .nodata {
  428. text-align: center;
  429. padding-top: 400rpx;
  430. }
  431. .zhifucanvas {
  432. width: 400rpx;
  433. height: 400rpx;
  434. margin: 0 auto;
  435. }
  436. .canys {
  437. width: 500rpx;
  438. height: 600rpx;
  439. position: fixed;
  440. top: 30%;
  441. left: 0;
  442. right: 0;
  443. margin: 0 auto;
  444. background: #e6e6e6;
  445. h4 {
  446. width: 500rpx;
  447. text-align: center;
  448. height: 80rpx;
  449. line-height: 80rpx;
  450. }
  451. }
  452. .guanbi {
  453. margin-top: 50rpx;
  454. }
  455. .zhifufs {
  456. padding: 10rpx 60rpx 30px;
  457. ::v-deep .u-radio-label--right {
  458. margin-top: 30rpx;
  459. }
  460. ::v-deep .uni-input-placeholder {
  461. text-align: left
  462. }
  463. ::v-deep .u-radio__icon-wrap {
  464. width: 40rpx !important;
  465. height: 40rpx !important;
  466. }
  467. ::v-deep .u-radio__text {
  468. font-size: 32rpx !important;
  469. }
  470. }
  471. .hejitop {
  472. text-align: center;
  473. border-bottom: 1px solid #eee;
  474. padding: 48rpx 0 24rpx;
  475. font-size: 32rpx;
  476. }
  477. .paytall {
  478. padding: 12px 0;
  479. }
  480. .heji span {
  481. color: #ED3A25;
  482. }
  483. .likezhifu {
  484. margin-left: 20rpx;
  485. margin-right: 30rpx;
  486. }
  487. .zhifu {
  488. position: fixed;
  489. right: 0;
  490. bottom: 0;
  491. left: 0;
  492. height: 98rpx;
  493. background-color: #fff;
  494. display: flex;
  495. align-items: center;
  496. justify-content: flex-end;
  497. .zhifuright {
  498. display: flex;
  499. align-items: center;
  500. justify-content: flex-end;
  501. }
  502. }
  503. .page {
  504. height: 100%;
  505. overflow: hidden;
  506. .contain {
  507. height: calc(100% - 44px);
  508. padding: 0;
  509. display: flex;
  510. flex-direction: column;
  511. .u-listdata {
  512. height: 400px;
  513. flex: 1;
  514. display: flex;
  515. flex-direction: column;
  516. }
  517. }
  518. }
  519. .paisong,
  520. .paisong2 {
  521. display: flex;
  522. flex-direction: column;
  523. justify-content: center;
  524. background-color: #fff;
  525. margin: 0 16px 24rpx;
  526. padding: 12px 16px 12px 34px;
  527. border-radius: 4px;
  528. position: relative;
  529. .iconBtn {
  530. position: absolute;
  531. top: 32rpx;
  532. right: 32rpx;
  533. z-index: 1;
  534. }
  535. .title {
  536. font-size: 32rpx;
  537. color: #0C1935;
  538. margin-bottom: 16rpx;
  539. span {
  540. position: relative;
  541. }
  542. .txt {
  543. color: #FA5555;
  544. font-weight: 600;
  545. }
  546. .status {
  547. width: 50px;
  548. padding: 3px 3px 10px 3px;
  549. text-align: center;
  550. font-size: 13px;
  551. color: #fff;
  552. background-color: #09C700;
  553. border-radius: 11px;
  554. position: absolute;
  555. right: -50px;
  556. top: -10px;
  557. transform: scale(0.8);
  558. &.s1 {
  559. background: url('@/static/imgs/paySuccess.png') no-repeat;
  560. background-size: 100%;
  561. }
  562. &.s2 {
  563. background: url('@/static/imgs/payerror.png') no-repeat;
  564. background-size: 100%;
  565. }
  566. }
  567. }
  568. .subtit {
  569. color: #9DA0AC;
  570. margin-bottom: 6rpx;
  571. }
  572. .check {
  573. position: absolute;
  574. left: 20rpx;
  575. top: 32rpx;
  576. z-index: 1;
  577. font-size: 0;
  578. transform: scale(.7)
  579. }
  580. }
  581. .paisong2 {
  582. display: flex;
  583. flex-direction: column;
  584. justify-content: center;
  585. background-color: #fff;
  586. margin: 0 16px 24rpx;
  587. padding: 12px 16px;
  588. border-radius: 4px;
  589. position: relative;
  590. .status {
  591. position: absolute;
  592. width: 96rpx;
  593. height: 48rpx;
  594. border-radius: 0 8rpx 0 20rpx;
  595. right: 0;
  596. line-height: 48rpx;
  597. text-align: center;
  598. top: 0;
  599. z-index: 1;
  600. font-size: 22rpx;
  601. background-color: #30D3A2;
  602. color: #fff;
  603. &.s2 {
  604. background-color: #09C700;
  605. }
  606. &.s3 {
  607. background-color: #FA5555;
  608. }
  609. &.s4 {
  610. background-color: #FF9C27;
  611. }
  612. }
  613. }
  614. .topbilledit {
  615. display: flex;
  616. justify-content: center;
  617. align-items: center;
  618. background: #fff;
  619. height: 88rpx;
  620. }
  621. .changetime2 {
  622. padding-left: 10rpx;
  623. }
  624. </style>