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