Tenantbill.vue 9.9 KB

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