parkingFeeList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <scroll-view
  3. class="scroll-Y"
  4. id="slideview"
  5. scroll-y
  6. lower-threshold="50"
  7. scroll-top="0"
  8. scroll-left="0"
  9. scroll-with-animation="false"
  10. enable-back-to-top="false"
  11. @scrolltolower="bindscrolltolower"
  12. >
  13. <!-- <authorize ref="authorize"></authorize>-->
  14. <!-- <ul>-->
  15. <!-- <li v-for="i in 100" :key="i">{{ i }}</li>-->
  16. <!-- </ul>-->
  17. <template>
  18. <uni-view
  19. class="choice_card"
  20. v-for="(item, index) in list"
  21. :key="index"
  22. @click="toDetail(item.orderno)"
  23. >
  24. <uni-view
  25. class="choice_card_index choice_card_index1"
  26. style="font-size: 30px; margin: 0 12px"
  27. >
  28. <uni-view style="margin-left: 6px"
  29. >{{ item.orderno + '-' + item.carno }}
  30. </uni-view>
  31. <uni-view style="color: red; margin-right: 6px"
  32. >{{ (item.servicefee / 100) | currency }}
  33. </uni-view>
  34. </uni-view>
  35. <uni-view class="choice_card_index choice_card_index2"
  36. >{{ item.parkname }}
  37. </uni-view>
  38. <uni-view class="choice_card_index choice_card_index3">
  39. <uni-view>入场时间 : {{ item.entertime }}</uni-view>
  40. <uni-view style="margin-right: 20px">
  41. <uni-icons
  42. class="align-top"
  43. color="#B3B3B3"
  44. size="14"
  45. type="arrowright"
  46. />
  47. </uni-view>
  48. </uni-view>
  49. <uni-view
  50. class="choice_card_index choice_card_index3"
  51. style="padding-bottom: 20px"
  52. >
  53. <uni-view>停车时长 : {{ item.serviceMin | parkingTime }}</uni-view>
  54. <uni-view style="margin-right: 20px">
  55. {{
  56. item.refundStatus === 1
  57. ? '已退款'
  58. : item.payStatus === 1
  59. ? '支付成功'
  60. : '支付失败'
  61. }}
  62. </uni-view>
  63. </uni-view>
  64. </uni-view>
  65. <uni-view class="notice-info">
  66. <uni-view
  67. >{{ list.length === 4 ? '查看更多' : '没有更多数据了' }}
  68. </uni-view>
  69. <uni-icons
  70. v-if="list.length === 4"
  71. type="arrowdown"
  72. size="14"
  73. color="##b5b3b3"
  74. ></uni-icons>
  75. </uni-view>
  76. </template>
  77. </scroll-view>
  78. </template>
  79. <script>
  80. // const app = getApp()
  81. import uni from '@/utils/uniHooks';
  82. const app = {};
  83. let canloading = true;
  84. let pageNum = 1;
  85. import moment from 'moment';
  86. import authorize from '@/components/authorize/authorize.vue';
  87. import { mapState } from 'vuex';
  88. export default {
  89. components: {
  90. authorize,
  91. },
  92. data() {
  93. return {
  94. list: [],
  95. };
  96. },
  97. computed: {
  98. ...mapState({
  99. mallId: (state) => state.mallId,
  100. openId: (state) => state.openid,
  101. member: (state) => state.member,
  102. }),
  103. },
  104. // 分享
  105. onShareAppMessage() {
  106. return {
  107. title: '缴费记录', // 标题
  108. path: '/pages/parkingFee/parkingFeeList?mallid=' + app.globalData.mallid,
  109. imageUrl: '', // 图标
  110. };
  111. },
  112. // 分享
  113. onShareTimeline() {
  114. return {
  115. title: '缴费记录', // 标题
  116. path: '/pages/parkingFee/parkingFeeList?mallid=' + app.globalData.mallid,
  117. imageUrl: '', // 图标
  118. };
  119. },
  120. mounted() {
  121. setTimeout(() => {
  122. uni.setNavigationBarTitle({
  123. title: "缴费记录"
  124. })
  125. }, 300)
  126. this.list = [];
  127. // 重新获取数据
  128. canloading = true;
  129. pageNum = 1;
  130. const member = uni.getStorageSync('member');
  131. console.log(114, member);
  132. if (member) {
  133. this.loadData();
  134. } /*else {
  135. this.$refs.authorize.login("/pages/parkingFee/parkingFee", () => {
  136. this.loadData()
  137. });
  138. }*/
  139. },
  140. // mounted() {
  141. // console.log(123, this.$route)
  142. // },
  143. // onReachBottom: function() {
  144. // console.log('canloading', canloading)
  145. // if (canloading) {
  146. // pageNum++
  147. // this.loadData()
  148. // }
  149. // },
  150. filters: {
  151. parkingTime(val) {
  152. const days = parseInt(val / 60 / 24);
  153. const hours = parseInt((val / 60) % 24);
  154. const minutes = parseInt(val % 60);
  155. if (days > 0) {
  156. return `${days}天 ${hours}小时 ${minutes}分钟`;
  157. }
  158. if (hours > 0) {
  159. return `${hours}小时 ${minutes}分钟`;
  160. }
  161. return `${minutes}分钟`;
  162. },
  163. },
  164. methods: {
  165. bindscrolltolower: function () {
  166. if (canloading) {
  167. pageNum++;
  168. this.loadData();
  169. }
  170. },
  171. // 获取停车记录
  172. loadData: function () {
  173. canloading = false;
  174. const params = {
  175. mallid: this.mallId,
  176. vipcode: this.member?.vipcode,
  177. openId: this.openId,
  178. page: pageNum || 1,
  179. pageSize: 4,
  180. };
  181. uni.showLoading({
  182. title: '加载中',
  183. });
  184. this.$md(params);
  185. uni.request({
  186. url: this.$baseURL + 'api/1.0/park/parkOrderList',
  187. data: params,
  188. method: 'POST',
  189. header: JSON.parse(uni.getStorageSync('handleUser')),
  190. success: (res) => {
  191. uni.hideLoading();
  192. if (res.data.code !== 0) {
  193. uni.showToast({
  194. title: res.data.msg,
  195. duration: 2000,
  196. icon: 'none',
  197. });
  198. this.initPage();
  199. } else {
  200. // 合并数据
  201. const records = res.data.data || [];
  202. if (records.length) {
  203. const list = this.list;
  204. this.list = [...list, ...records];
  205. } else {
  206. this.initPage();
  207. }
  208. }
  209. canloading = true;
  210. },
  211. fail: (err) => {
  212. uni.hideLoading();
  213. canloading = true;
  214. this.initPage();
  215. uni.showToast({
  216. title: res.data.msg,
  217. duration: 2000,
  218. icon: 'none',
  219. });
  220. },
  221. });
  222. },
  223. // 页码复原
  224. initPage: function () {
  225. pageNum--;
  226. if (pageNum <= 0) {
  227. pageNum = 0;
  228. }
  229. },
  230. // 查看详情
  231. toDetail(orderno) {
  232. this.$router.push({
  233. path: './parkingFeeDetailSuccess?orderNo=' + orderno,
  234. });
  235. },
  236. },
  237. };
  238. </script>
  239. <style lang="less" scoped>
  240. .scroll-Y {
  241. width: 100%;
  242. display: flex;
  243. flex-direction: column;
  244. height: 100vh;
  245. background: #f2f2f2;
  246. }
  247. .wrap {
  248. display: flex;
  249. flex-direction: column;
  250. width: 100%;
  251. }
  252. .parkingFeeList-item {
  253. background: #fff;
  254. display: flex;
  255. flex-direction: column;
  256. margin-top: 8px;
  257. .item {
  258. display: flex;
  259. align-items: center;
  260. justify-content: space-between;
  261. padding: 30px 36px;
  262. box-sizing: border-box;
  263. span {
  264. font-size: 16px;
  265. }
  266. }
  267. .item-bottom {
  268. border-top: 1px solid #f2f2f2;
  269. display: flex;
  270. flex-direction: column;
  271. padding: 0px 36px;
  272. box-sizing: border-box;
  273. padding-top: 8px;
  274. uni-view {
  275. display: flex;
  276. flex-direction: column;
  277. }
  278. span {
  279. color: #999;
  280. font-size: 14px;
  281. margin-bottom: 10px;
  282. }
  283. }
  284. }
  285. .choice_card {
  286. width: 92%;
  287. margin-left: 4%;
  288. margin-top: 30px;
  289. margin-bottom: 30px;
  290. border-radius: 20px;
  291. background-color: #fff;
  292. position: relative;
  293. .choice_card_index {
  294. margin-left: 18px;
  295. padding-top: 6px;
  296. padding-bottom: 6px;
  297. font-size: 28px;
  298. }
  299. .choice_card_index1 {
  300. border-bottom: 1px solid #f2f2f2;
  301. display: flex;
  302. align-items: center;
  303. padding-top: 22px;
  304. padding-bottom: 22px;
  305. justify-content: space-between;
  306. }
  307. .choice_card_index2 {
  308. padding-top: 20px;
  309. color: #808080;
  310. }
  311. .choice_card_index3 {
  312. display: flex;
  313. align-items: center;
  314. justify-content: space-between;
  315. color: #808080;
  316. }
  317. .choice_card_index4 {
  318. color: #808080;
  319. padding-bottom: 20px;
  320. }
  321. }
  322. .notice-info {
  323. text-align: center;
  324. color: #b5b3b3;
  325. padding-bottom: 30px;
  326. uni-view {
  327. margin-bottom: -7px;
  328. }
  329. }
  330. </style>