Tenantbill.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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" :itemHeight="80" :columns="columnstype" keyName="label" @confirm="confirmtype" @cancel='canceltype'>
  80. </u-picker>
  81. <u-picker :show="showfloor" :itemHeight="80" 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',[e])
  191. .then(res => {
  192. if (res.data.code == 0) {
  193. uni.showToast({
  194. title: '催费成功',
  195. icon: 'none',
  196. duration: 1500
  197. })
  198. } else {
  199. uni.showToast({
  200. title: res.data.msg,
  201. icon: 'none',
  202. duration: 1500
  203. })
  204. }
  205. })
  206. },
  207. scrolltolower() {
  208. if (this.pd) {
  209. this.getalldata();
  210. } else {
  211. return
  212. }
  213. },
  214. getalldata() {
  215. this.$api.get('/billinfo/paypage', this.dataForm)
  216. .then(res => {
  217. this.totalnumber = res.data.data.total;
  218. if (res.data.data.list.length != 0) {
  219. this.indexList.push(...res.data.data.list);
  220. this.dataForm.page = this.dataForm.page + 1;
  221. this.pd = true;
  222. } else {
  223. uni.showToast({
  224. title: '暂无更多数据了',
  225. icon: 'none',
  226. duration: 1500
  227. })
  228. this.pd = false;
  229. }
  230. })
  231. },
  232. canceltype() {
  233. this.showtype = false;
  234. },
  235. confirmtype(e) {
  236. console.log('111111111111111111', e.value[0])
  237. this.showtype = false;
  238. this.mytype = e.value[0].label;
  239. this.dataForm.status = e.value[0].id;
  240. this.indexList = [];
  241. this.dataForm.page = 1;
  242. this.getalldata();
  243. },
  244. typechange() {
  245. this.showtype = true;
  246. },
  247. dateChange(e) {
  248. this.myday = e.target.value;
  249. this.dataForm.cycle = e.target.value;
  250. this.dataForm.page = 1;
  251. this.indexList = [];
  252. this.getalldata();
  253. },
  254. getDate(type) {
  255. const date = new Date();
  256. let year = date.getFullYear();
  257. let month = date.getMonth() ;
  258. if (type === 'start') {
  259. year = year - 60;
  260. } else if (type === 'end') {
  261. year = year + 2;
  262. }
  263. month = month > 9 ? month : '0' + month;
  264. // day = day > 9 ? day : '0' + day;
  265. return `${year}-${month}`;
  266. },
  267. getfloor() {
  268. this.$api.get('/control/getOrgStructureTree/', {})
  269. .then(res => {
  270. if (res.data.code == 0) {
  271. this.dataForm.projectId = res.data.data[0].orgId;
  272. this.mytitle = res.data.data[0].orgName;
  273. this.alldata = res.data.data[0].childrenList;
  274. //console.log('111111111111111111', res.data.data[0].childrenList)
  275. this.columns = [
  276. res.data.data[0].childrenList,
  277. res.data.data[0].childrenList[0].childrenList
  278. ]
  279. let allfloor = [];
  280. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  281. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  282. }
  283. // console.log('111111111111111111',allfloor)
  284. this.columnData = allfloor;
  285. this.indexList = [];
  286. this.dataForm.page = 1;
  287. this.getalldata();
  288. } else {
  289. this.showdct = true
  290. }
  291. })
  292. },
  293. floorchange() {
  294. this.showfloor = true;
  295. },
  296. changeHandler(e) {
  297. const {
  298. columnIndex,
  299. index,
  300. // 微信小程序无法将picker实例传出来,只能通过ref操作
  301. picker = this.$refs.uPicker
  302. } = e
  303. if (columnIndex === 0) {
  304. this.loading = true
  305. picker.setColumnValues(1, this.columnData[index])
  306. this.loading = false
  307. }
  308. // this.getalldata();
  309. },
  310. confirmfloor(e) {
  311. console.log('222222', e.value)
  312. this.mytitle = e.value[0].orgName + e.value[1].orgName;
  313. this.dataForm.buildingId = e.value[0].orgId;
  314. this.dataForm.storeyId = e.value[1].orgId;
  315. this.indexList = [];
  316. this.dataForm.page = 1;
  317. this.showfloor = false;
  318. this.getalldata();
  319. },
  320. cancelfloor() {
  321. this.showfloor = false;
  322. },
  323. }
  324. }
  325. </script>
  326. <style lang="scss">
  327. .Currentamount {
  328. padding-left: 30rpx;
  329. height: 50rpx;
  330. line-height: 50rpx;
  331. color: #BCB3A7;
  332. span {
  333. color: #FA5555;
  334. padding-left: 9rpx;
  335. }
  336. }
  337. .Callfee {
  338. width: 100rpx;
  339. height: 45rpx;
  340. text-align: center;
  341. line-height: 45rpx;
  342. color: #5C8FFF;
  343. border: 1px solid #5C8FFF;
  344. font-size: 22rpx;
  345. position: absolute;
  346. bottom: 10rpx;
  347. right: 10px;
  348. font-weight: bold;
  349. }
  350. .companylist {
  351. margin: 20rpx 30rpx;
  352. background: #fff;
  353. height: 230rpx;
  354. border-radius: 10px;
  355. position: relative;
  356. h3 {
  357. height: 70rpx;
  358. line-height: 70rpx;
  359. padding-left: 30rpx;
  360. }
  361. }
  362. .settled {
  363. background-color: #09C700;
  364. width: 100rpx;
  365. height: 40rpx;
  366. text-align: center;
  367. line-height: 40rpx;
  368. color: #fff;
  369. font-size: 14rpx;
  370. position: absolute;
  371. top: 0px;
  372. right: 0px;
  373. border-top-right-radius: 10rpx;
  374. border-bottom-left-radius: 10rpx;
  375. }
  376. .outstanding {
  377. background-color: #FA5555;
  378. width: 100rpx;
  379. height: 40rpx;
  380. text-align: center;
  381. line-height: 40rpx;
  382. color: #fff;
  383. font-size: 14rpx;
  384. position: absolute;
  385. top: 0px;
  386. right: 0px;
  387. border-top-right-radius: 10rpx;
  388. border-bottom-left-radius: 10rpx;
  389. }
  390. .billall {}
  391. .topbill {
  392. display: flex;
  393. justify-content: space-around;
  394. align-items: center;
  395. height: 100rpx;
  396. background-color: #e6e6e6;
  397. }
  398. .topbilledit {
  399. display: flex;
  400. justify-content: space-around;
  401. align-items: center;
  402. }
  403. .changetime1 {
  404. padding-right: 10rpx;
  405. }
  406. </style>