Tenantbill.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view class="billall">
  3. <u-cell-group class="toptemplate">
  4. <u-cell :title="mytitle" @click="floorchange">
  5. <u-icon slot="icon" size="40" color="#fff" name="map"></u-icon>
  6. <u-icon slot="right-icon" size="40" color="#fff" name="search"></u-icon>
  7. </u-cell>
  8. </u-cell-group>
  9. <view class="topbill">
  10. <view class="topbilledit">
  11. <view class="changetime1">
  12. <picker mode="date" :value="myday" fields="month" @change="dateChange">
  13. <view class="selestDate">{{myday}}</view>
  14. </picker>
  15. </view>
  16. <view class="changetime2">
  17. <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
  18. </view>
  19. </view>
  20. <view class="topbilledit" @click="typechange">
  21. <view class="changetime1">
  22. {{mytype}}
  23. </view>
  24. <view class="changetime2">
  25. <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 列表 -->
  30. <!-- <t-table>
  31. <t-tr>
  32. <t-th>序号</t-th>
  33. <t-th>姓名</t-th>
  34. <t-th>年龄</t-th>
  35. <t-th>爱好</t-th>
  36. <t-th>操作</t-th>
  37. </t-tr>
  38. <t-tr v-for="item in tableList" :key="item.id">
  39. <t-td>{{ item.id + 1 }}</t-td>
  40. <t-td>{{ item.name }}</t-td>
  41. <t-td>{{ item.age }}</t-td>
  42. <t-td>{{ item.hobby }}</t-td>
  43. <t-td align="left"> <u-button @click="edit(item)" size="small" type="primary" :plain="true" text="编辑"></u-button></t-td>
  44. </t-tr>
  45. </t-table> -->
  46. <view class="u-listdata">
  47. <view style="padding:10rpx 0 0 30rpx">
  48. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  49. </view>
  50. <u-list @scrolltolower="scrolltolower" :pagingEnabled='true'>
  51. <u-list-item v-for="(item, index) in indexList" :key="index">
  52. <view class="companylist" @click="seedetail(item)">
  53. <view class="settled" v-if="item.status==1">
  54. 已结清
  55. </view>
  56. <view class="outstanding" v-if="item.status==0">
  57. 未结清
  58. </view>
  59. <h3>{{item.name}}</h3>
  60. <view class="Currentamount">
  61. 本期金额: <span>¥{{item.feeTotal}}</span>
  62. </view>
  63. <view class="Currentamount">
  64. 欠费天数: {{item.elecAmount}}
  65. </view>
  66. <view class="Currentamount">
  67. 账户余额:¥{{item.balance}}
  68. </view>
  69. <view class="Currentamount">
  70. 联系电话: {{item.tel}}
  71. </view>
  72. <view class="Callfee" v-if="item.status==0" @click.stop="handleClick(item.id)">
  73. 催费
  74. </view>
  75. </view>
  76. </u-list-item>
  77. </u-list>
  78. </view>
  79. <u-picker :show="showtype" :columns="columnstype" keyName="label" @confirm="confirmtype" @cancel='canceltype'>
  80. </u-picker>
  81. <u-picker :show="showfloor" ref="uPicker" :loading="loading" @confirm="confirmfloor" @cancel='cancelfloor'
  82. :columns="columns" keyName="orgName" @change="changeHandler"></u-picker>
  83. <u-notify ref="uNotify" :show="showdct" message="服务器请求失败"></u-notify>
  84. </view>
  85. </template>
  86. <script>
  87. // import tTable from '@/components/t-table/t-table.vue';
  88. // import tTh from '@/components/t-table/t-th.vue';
  89. // import tTr from '@/components/t-table/t-tr.vue';
  90. // import tTd from '@/components/t-table/t-td.vue';
  91. export default {
  92. components: {
  93. // tTable,
  94. // tTh,
  95. // tTr,
  96. // tTd
  97. },
  98. data() {
  99. const currentDate = this.getDate({
  100. format: 'yyyy-mm'
  101. })
  102. return {
  103. totalnumber: 0,
  104. setyesno: true,
  105. // tableList: [{
  106. // id: 0,
  107. // name: '张三',
  108. // age: '19',
  109. // hobby: '游泳'
  110. // },
  111. // {
  112. // id: 1,
  113. // name: '李四',
  114. // age: '21',
  115. // hobby: '绘画'
  116. // },
  117. // ],
  118. indexList: [],
  119. dataList: [],
  120. dataForm: {
  121. projectId: "",
  122. buildingId: "",
  123. storeyId: "",
  124. cycle: "",
  125. status: "",
  126. page: 1,
  127. limit: 10,
  128. },
  129. showtype: false,
  130. showdct: false,
  131. mytitle: '',
  132. alldata: [],
  133. showfloor: false,
  134. loading: false,
  135. columns: [],
  136. pd: true,
  137. columnData: [],
  138. myday: '',
  139. mytype: '全部',
  140. showPicker: false,
  141. myday: currentDate,
  142. columnstype: [
  143. [{
  144. label: '全部',
  145. id: ''
  146. }, {
  147. label: '未结清',
  148. id: 0
  149. },
  150. {
  151. label: '已结清',
  152. id: 1
  153. }
  154. ]
  155. ],
  156. }
  157. },
  158. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  159. onLoad() {
  160. this.getfloor();
  161. },
  162. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  163. onReady() {
  164. // 微信小程序需要用此写法
  165. },
  166. //监听页面隐藏
  167. onHide() {},
  168. //监听窗口尺寸变化
  169. onResize() {},
  170. //监听页面卸载
  171. onUnload() {},
  172. //监听用户下拉动作,一般用于下拉刷新
  173. onPullDownRefresh() {},
  174. methods: {
  175. seedetail(e) {
  176. // console.log('222',e)
  177. let faltesdata = {
  178. name: e.name,
  179. id: e.id,
  180. cycle: e.cycle
  181. }
  182. // console.log('111111111111111111',faltesdata)
  183. uni.navigateTo({
  184. url: "/pages/Workorder/Tenantbill/companybill/companybill?para=" + encodeURIComponent(JSON
  185. .stringify(faltesdata))
  186. })
  187. },
  188. handleClick(e) {
  189. console.log('111111111111111111', e)
  190. this.$api.post('/expeditrecord/charge', {
  191. data: e
  192. })
  193. .then(res => {
  194. if (res.data.code == 0) {
  195. uni.showToast({
  196. title: '催费成功',
  197. icon: 'none',
  198. duration: 1500
  199. })
  200. } else {
  201. uni.showToast({
  202. title: res.data.msg,
  203. icon: 'none',
  204. duration: 1500
  205. })
  206. }
  207. })
  208. },
  209. scrolltolower() {
  210. if (this.pd) {
  211. this.getalldata();
  212. } else {
  213. return
  214. }
  215. },
  216. getalldata() {
  217. this.$api.get('/billinfo/paypage', this.dataForm)
  218. .then(res => {
  219. this.totalnumber = res.data.data.total;
  220. if (res.data.data.list.length != 0) {
  221. this.indexList.push(...res.data.data.list);
  222. this.dataForm.page = this.dataForm.page + 1;
  223. this.pd = true;
  224. } else {
  225. uni.showToast({
  226. title: '暂无更多数据了',
  227. icon: 'none',
  228. duration: 1500
  229. })
  230. this.pd = false;
  231. }
  232. })
  233. },
  234. canceltype() {
  235. this.showtype = false;
  236. },
  237. confirmtype(e) {
  238. // console.log('111111111111111111', e.value[0])
  239. this.showtype = false;
  240. this.mytype = e.value[0].label;
  241. this.dataForm.cycle = e.value[0].id;
  242. this.indexList = [];
  243. this.dataForm.page = 1;
  244. this.getalldata();
  245. },
  246. typechange() {
  247. this.showtype = true;
  248. },
  249. dateChange(e) {
  250. this.myday = e.target.value;
  251. this.dataForm.cycle = e.target.value;
  252. this.dataForm.page = 1;
  253. this.indexList = [];
  254. this.getalldata();
  255. },
  256. getDate(type) {
  257. const date = new Date();
  258. let year = date.getFullYear();
  259. let month = date.getMonth() + 1;
  260. if (type === 'start') {
  261. year = year - 60;
  262. } else if (type === 'end') {
  263. year = year + 2;
  264. }
  265. month = month > 9 ? month : '0' + month;
  266. // day = day > 9 ? day : '0' + day;
  267. return `${year}-${month}`;
  268. },
  269. getfloor() {
  270. this.$api.get('/control/getOrgStructureTree/', {})
  271. .then(res => {
  272. if (res.data.code == 0) {
  273. this.dataForm.projectId = res.data.data[0].orgId;
  274. this.mytitle = res.data.data[0].orgName;
  275. this.alldata = res.data.data[0].childrenList;
  276. //console.log('111111111111111111', res.data.data[0].childrenList)
  277. this.columns = [
  278. res.data.data[0].childrenList,
  279. res.data.data[0].childrenList[0].childrenList
  280. ]
  281. let allfloor = [];
  282. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  283. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  284. }
  285. // console.log('111111111111111111',allfloor)
  286. this.columnData = allfloor;
  287. this.indexList = [];
  288. this.dataForm.page = 1;
  289. this.getalldata();
  290. } else {
  291. this.showdct = true
  292. }
  293. })
  294. },
  295. floorchange() {
  296. this.showfloor = true;
  297. },
  298. changeHandler(e) {
  299. const {
  300. columnIndex,
  301. index,
  302. // 微信小程序无法将picker实例传出来,只能通过ref操作
  303. picker = this.$refs.uPicker
  304. } = e
  305. if (columnIndex === 0) {
  306. this.loading = true
  307. picker.setColumnValues(1, this.columnData[index])
  308. this.loading = false
  309. }
  310. // this.getalldata();
  311. },
  312. confirmfloor(e) {
  313. console.log('222222', e.value)
  314. this.mytitle = e.value[0].orgName + e.value[1].orgName;
  315. this.dataForm.buildingId = e.value[0].orgId;
  316. this.dataForm.storeyId = e.value[1].orgId;
  317. this.indexList = [];
  318. this.dataForm.page = 1;
  319. this.showfloor = false;
  320. this.getalldata();
  321. },
  322. cancelfloor() {
  323. this.showfloor = false;
  324. },
  325. }
  326. }
  327. </script>
  328. <style lang="scss">
  329. .Currentamount {
  330. padding-left: 30rpx;
  331. height: 50rpx;
  332. line-height: 50rpx;
  333. color: #BCB3A7;
  334. span {
  335. color: #FA5555;
  336. padding-left: 9rpx;
  337. }
  338. }
  339. .Callfee {
  340. width: 100rpx;
  341. height: 45rpx;
  342. text-align: center;
  343. line-height: 45rpx;
  344. color: #5C8FFF;
  345. border: 1px solid #5C8FFF;
  346. font-size: 22rpx;
  347. position: absolute;
  348. bottom: 10rpx;
  349. right: 10px;
  350. font-weight: bold;
  351. }
  352. .companylist {
  353. margin: 20rpx 30rpx;
  354. background: #fff;
  355. height: 280rpx;
  356. border-radius: 10px;
  357. position: relative;
  358. h3 {
  359. height: 70rpx;
  360. line-height: 70rpx;
  361. padding-left: 30rpx;
  362. }
  363. }
  364. .settled {
  365. background-color: #09C700;
  366. width: 100rpx;
  367. height: 40rpx;
  368. text-align: center;
  369. line-height: 40rpx;
  370. color: #fff;
  371. font-size: 14rpx;
  372. position: absolute;
  373. top: 0px;
  374. right: 0px;
  375. border-top-right-radius: 10rpx;
  376. border-bottom-left-radius: 10rpx;
  377. }
  378. .outstanding {
  379. background-color: #FA5555;
  380. width: 100rpx;
  381. height: 40rpx;
  382. text-align: center;
  383. line-height: 40rpx;
  384. color: #fff;
  385. font-size: 14rpx;
  386. position: absolute;
  387. top: 0px;
  388. right: 0px;
  389. border-top-right-radius: 10rpx;
  390. border-bottom-left-radius: 10rpx;
  391. }
  392. .billall {}
  393. .topbill {
  394. display: flex;
  395. justify-content: space-around;
  396. align-items: center;
  397. height: 100rpx;
  398. background-color: #e6e6e6;
  399. }
  400. .topbilledit {
  401. display: flex;
  402. justify-content: space-around;
  403. align-items: center;
  404. }
  405. .changetime1 {
  406. padding-right: 10rpx;
  407. }
  408. </style>