Tenantbill.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="page">
  3. <view class="contain">
  4. <u-cell-group class="toptemplate" style="flex:0">
  5. <u-cell :title="mytitle" @click="floorchange">
  6. <u-icon slot="icon" size="40" color="#fff" name="map"></u-icon>
  7. <u-icon slot="right-icon" size="40" color="#fff" name="search"></u-icon>
  8. </u-cell>
  9. </u-cell-group>
  10. <view class="topbill">
  11. <view class="topbilledit">
  12. <view class="changetime1">
  13. <picker mode="date" :value="myday" fields="month" @change="dateChange">
  14. <view class="selestDate">{{myday}}</view>
  15. </picker>
  16. </view>
  17. <view class="changetime2">
  18. <u-icon name="arrow-down-fill" color="#999" size="20"></u-icon>
  19. </view>
  20. </view>
  21. <view class="topbilledit" @click="typechange">
  22. <view class="changetime1">
  23. {{mytype}}
  24. </view>
  25. <view class="changetime2">
  26. <u-icon name="arrow-down-fill" color="#999" size="20"></u-icon>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="u-listdata">
  31. <view style="padding:16rpx 0 16rpx 32rpx">
  32. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  33. </view>
  34. <u-list @scrolltolower="scrolltolower" :pagingEnabled='true' style="height:400px;flex:1;">
  35. <u-list-item v-for="(item, index) in indexList" :key="index">
  36. <view class="companylist" @click="seedetail(item)">
  37. <view class="settled outstanding" v-if="item.status==1">
  38. 已结清
  39. </view>
  40. <view class="outstanding" v-if="item.status==0">
  41. 未结清
  42. </view>
  43. <h3>{{item.name}}</h3>
  44. <view class="Currentamount">
  45. 本期金额: <span>¥{{item.feeTotal}}</span>
  46. </view>
  47. <view class="Currentamount">
  48. 账户余额:¥{{item.balance}}
  49. </view>
  50. <view class="Currentamount">
  51. 联系电话: {{item.tel}}
  52. </view>
  53. </view>
  54. </u-list-item>
  55. </u-list>
  56. </view>
  57. </view>
  58. <u-picker :show="showtype" :itemHeight="80" :columns="columnstype" keyName="label" @confirm="confirmtype"
  59. @cancel='canceltype'>
  60. </u-picker>
  61. <u-picker :show="showfloor" :itemHeight="80" ref="uPicker" :loading="loading" @confirm="confirmfloor"
  62. @cancel='cancelfloor' :columns="columns" keyName="orgName" @change="changeHandler"></u-picker>
  63. <u-notify ref="uNotify" :show="showdct" message="服务器请求失败"></u-notify>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. components: {},
  69. data() {
  70. const currentDate = this.getDate({
  71. format: 'yyyy-mm'
  72. })
  73. return {
  74. totalnumber: 0,
  75. indexList: [],
  76. dataForm: {
  77. projectId: "",
  78. buildingId: "",
  79. storeyId: "",
  80. cycle: "",
  81. status: "",
  82. page: 1,
  83. limit: 10,
  84. },
  85. showtype: false,
  86. showdct: false,
  87. mytitle: '',
  88. alldata: [],
  89. showfloor: false,
  90. loading: false,
  91. columns: [],
  92. pd: true,
  93. columnData: [],
  94. myday: '',
  95. mytype: '全部',
  96. showPicker: false,
  97. myday: currentDate,
  98. columnstype: [
  99. [{
  100. label: '全部',
  101. id: ''
  102. }, {
  103. label: '未结清',
  104. id: 0
  105. },
  106. {
  107. label: '已结清',
  108. id: 1
  109. }
  110. ]
  111. ],
  112. }
  113. },
  114. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  115. onLoad() {
  116. this.getfloor();
  117. },
  118. //监听页面隐藏
  119. onHide() {},
  120. //监听窗口尺寸变化
  121. onResize() {},
  122. //监听页面卸载
  123. onUnload() {},
  124. //监听用户下拉动作,一般用于下拉刷新
  125. onPullDownRefresh() {},
  126. methods: {
  127. seedetail(e) {
  128. let faltesdata = {
  129. name: e.name,
  130. id: e.id,
  131. cycle: e.cycle
  132. }
  133. uni.navigateTo({
  134. url: "/pages/Workorder/Tenantbill/companybill/companybill?para=" + encodeURIComponent(JSON
  135. .stringify(faltesdata))
  136. })
  137. },
  138. scrolltolower() {
  139. if (this.pd) {
  140. this.getalldata();
  141. } else {
  142. return
  143. }
  144. },
  145. getalldata() {
  146. this.$api.get('/billinfo/paypage', this.dataForm)
  147. .then(res => {
  148. this.totalnumber = res.data.data.total;
  149. if (res.data.data.list.length != 0) {
  150. this.indexList.push(...res.data.data.list);
  151. this.dataForm.page = this.dataForm.page + 1;
  152. this.pd = true;
  153. } else {
  154. uni.showToast({
  155. title: '暂无更多数据了',
  156. icon: 'none',
  157. duration: 1500
  158. })
  159. this.pd = false;
  160. }
  161. })
  162. },
  163. canceltype() {
  164. this.showtype = false;
  165. },
  166. confirmtype(e) {
  167. this.showtype = false;
  168. this.mytype = e.value[0].label;
  169. this.dataForm.status = e.value[0].id;
  170. this.indexList = [];
  171. this.dataForm.page = 1;
  172. this.getalldata();
  173. },
  174. typechange() {
  175. this.showtype = true;
  176. },
  177. dateChange(e) {
  178. this.myday = e.target.value;
  179. this.dataForm.cycle = e.target.value;
  180. this.dataForm.page = 1;
  181. this.indexList = [];
  182. this.getalldata();
  183. },
  184. getDate(type) {
  185. const date = new Date();
  186. let year = date.getFullYear();
  187. let month = date.getMonth();
  188. if (type === 'start') {
  189. year = year - 60;
  190. } else if (type === 'end') {
  191. year = year + 2;
  192. }
  193. month = month > 9 ? month : '0' + month;
  194. // day = day > 9 ? day : '0' + day;
  195. return `${year}-${month}`;
  196. },
  197. getfloor() {
  198. this.$api.get('/control/getOrgStructureTree/', {})
  199. .then(res => {
  200. if (res.data.code == 0) {
  201. this.dataForm.projectId = res.data.data[0].orgId;
  202. this.mytitle = res.data.data[0].orgName;
  203. this.alldata = res.data.data[0].childrenList;
  204. this.columns = [
  205. res.data.data[0].childrenList,
  206. res.data.data[0].childrenList[0].childrenList
  207. ]
  208. let allfloor = [];
  209. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  210. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  211. }
  212. this.columnData = allfloor;
  213. this.indexList = [];
  214. this.dataForm.page = 1;
  215. this.getalldata();
  216. } else {
  217. this.showdct = true
  218. }
  219. })
  220. },
  221. floorchange() {
  222. this.showfloor = true;
  223. },
  224. changeHandler(e) {
  225. const {
  226. columnIndex,
  227. index,
  228. // 微信小程序无法将picker实例传出来,只能通过ref操作
  229. picker = this.$refs.uPicker
  230. } = e
  231. if (columnIndex === 0) {
  232. this.loading = true
  233. picker.setColumnValues(1, this.columnData[index])
  234. this.loading = false
  235. }
  236. },
  237. confirmfloor(e) {
  238. this.mytitle = e.value[0].orgName + e.value[1].orgName;
  239. this.dataForm.buildingId = e.value[0].orgId;
  240. this.dataForm.storeyId = e.value[1].orgId;
  241. this.indexList = [];
  242. this.dataForm.page = 1;
  243. this.showfloor = false;
  244. this.getalldata();
  245. },
  246. cancelfloor() {
  247. this.showfloor = false;
  248. },
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. .companylist {
  254. margin: 24rpx 32rpx 0;
  255. background: #fff;
  256. padding: 24rpx 32rpx ;
  257. border-radius: 8rpx;
  258. position: relative;
  259. h3 {
  260. margin-bottom: 24rpx;
  261. }
  262. .Currentamount {
  263. line-height: 40rpx;
  264. margin-bottom: 6rpx;
  265. color: #999;
  266. span {
  267. color: #FA5555;
  268. padding-left: 9rpx;
  269. }
  270. }
  271. .outstanding{
  272. position: absolute;
  273. width:96rpx;
  274. height: 48rpx;
  275. border-radius: 0 8rpx 0 20rpx;
  276. right:0;
  277. line-height: 48rpx;
  278. text-align: center;
  279. top:0;
  280. z-index: 1;
  281. font-size: 22rpx;
  282. background-color:#FA5555 ;
  283. color: #fff;
  284. &.settled{
  285. background-color:#09C700 ;
  286. }
  287. }
  288. }
  289. .topbill {
  290. display: flex;
  291. justify-content: space-around;
  292. align-items: center;
  293. height: 88rpx;
  294. background-color: #fff;
  295. .topbilledit {
  296. display: flex;
  297. justify-content: space-around;
  298. align-items: center;
  299. }
  300. .changetime1 {
  301. padding-right: 10rpx;
  302. }
  303. }
  304. .page {
  305. height: 100%;
  306. overflow: hidden;
  307. .contain {
  308. height: 100%;
  309. padding: 0;
  310. display: flex;
  311. flex-direction: column;
  312. .u-listdata {
  313. height: 400px;
  314. flex: 1;
  315. display: flex;
  316. flex-direction: column;
  317. }
  318. }
  319. }
  320. </style>