payLists.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view>
  3. <view class="swiper-wrap">
  4. <template v-if="projectFlag !== 'zhenning'">
  5. <view class="u-tabs-box">
  6. <u-tabs-swiper activeColor="#008CFF" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="100%" />
  7. </view>
  8. </template>
  9. <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" disable-touch>
  10. <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
  11. <scroll-view scroll-y style="height: 100%; width: 100%" @scrolltolower="reachBottom">
  12. <view class="page-box">
  13. <view class="pay" v-for="(payItem, index) in payList[index]" :key="index">
  14. <view v-if="item.index == 0">
  15. <view class="pay-top u-flex">
  16. <view class="pay-top-left u-flex-1">
  17. <view class="car">{{ payItem.vehicleNo }}</view>
  18. <view class="addr">{{ payItem.roadName }}</view>
  19. </view>
  20. <view class="pay-top-right">{{ payItem.orderStatus | filterOrderStatus }} </view>
  21. </view>
  22. <view class="pay-center">
  23. <view class="pay-center-item">订单编号:{{ payItem.orderId }}</view>
  24. <view class="pay-center-item" v-if="payItem.deviceType == 1">入场时间:{{ payItem.inTime || '' }} </view>
  25. <view class="pay-center-item" v-else>开始计费:{{ payItem.inTime || '' }}</view>
  26. <template v-if="payItem.deviceType == 1">
  27. <view class="pay-center-item" v-if="payItem.orderStatus == 1 && payItem.outTime"> 出场时间:{{ `未出场` }}</view>
  28. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 出场时间:{{ payItem.outTime || 0 }}</view>
  29. </template>
  30. <template v-else>
  31. <view class="pay-center-item" v-if="payItem.orderStatus == 1 && payItem.outTime"> 结束计费:{{ `未出场` }}</view>
  32. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 结束计费:{{ payItem.outTime || 0 }}</view>
  33. </template>
  34. <view class="pay-center-item" v-if="payItem.orderStatus !== 1">
  35. 免费时长:{{ payItem.freeDuration || `0天0时${free_time}分0秒` }}
  36. </view>
  37. <!-- 计费时长=停车时长-免费时长 -->
  38. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 计费时长:{{ payItem.calcDuration || 0 }} </view>
  39. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 累计停车时长:{{ payItem.duration || 0 }} </view>
  40. <view class="pay-center-item" v-if="payItem.orderStatus == 1"
  41. >预计金额:<span class="pay-amount">{{ payItem.payAmount || 0 }}</span>
  42. </view>
  43. <view class="pay-center-item" v-else
  44. >应付金额:<span class="pay-amount">{{ payItem.payAmount || 0 }}</span>
  45. </view>
  46. <view
  47. class="pay-center-item"
  48. v-if="(payItem.actualAmount || payItem.actualAmount === 0) && payItem.orderStatus !== 2 && payItem.orderStatus !== 1"
  49. >
  50. 实缴金额:<span class="pay-amount">{{ payItem.actualAmount || 0 }}</span>
  51. </view>
  52. <view class="pay-center-item">泊位号:{{ payItem.spaceName }}</view>
  53. <view class="pay-center-item" v-if="payItem.deviceType && payItem.deviceType != 1"> 车位锁设备号:{{ payItem.deviceNo }} </view>
  54. </view>
  55. <view class="pay-bottom">
  56. <u-cell-item title="去支付" @click="choosePayWay(payItem.orderId, payItem)" style="color: #008cff"> </u-cell-item>
  57. </view>
  58. </view>
  59. <view v-if="item.index == 1">
  60. <view class="pay-top u-flex">
  61. <view class="pay-top-left u-flex-1">
  62. <view class="car">{{ payItem.vehicleNo }}</view>
  63. <view class="addr">{{ payItem.parkingName }}</view>
  64. </view>
  65. <view class="pay-top-right">{{ payItem.orderStatus | filterOrderStatus }} </view>
  66. </view>
  67. <view class="pay-center">
  68. <view class="pay-center-item">订单编号:{{ payItem.orderId }}</view>
  69. <view class="pay-center-item">入场通道:{{ payItem.entranceName }}</view>
  70. <view class="pay-center-item">入场时间:{{ payItem.inTime || 0 }}</view>
  71. <view class="pay-center-item">出场通道:{{ payItem.outEntranceName }}</view>
  72. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 出场时间:{{ payItem.outTime || 0 }} </view>
  73. <view class="pay-center-item" v-if="payItem.orderStatus !== 1">
  74. 免费时长:{{ payItem.freeDuration || `0天0时${free_time}分0秒` }}
  75. </view>
  76. <!-- 计费时长=停车时长-免费时长 -->
  77. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 计费时长:{{ payItem.calcDuration || 0 }} </view>
  78. <view class="pay-center-item" v-if="payItem.orderStatus !== 1"> 累计停车时长:{{ payItem.duration || 0 }} </view>
  79. <view class="pay-center-item"
  80. >应付金额:<span class="pay-amount">{{ payItem.payAmount || 0 }}</span>
  81. </view>
  82. <view class="pay-center-item" v-if="payItem.deviceType && payItem.deviceType != 1"> 车位锁设备号:{{ payItem.deviceNo }} </view>
  83. </view>
  84. <view class="pay-bottom">
  85. <u-cell-item title="去支付" @click="choosePayWay(payItem.orderId, payItem)" style="color: #008cff"> </u-cell-item>
  86. </view>
  87. </view>
  88. </view>
  89. <u-loadmore :status="loadStatus[index]" bg-color="#F6F6FF"></u-loadmore>
  90. </view>
  91. </scroll-view>
  92. </swiper-item>
  93. </swiper>
  94. </view>
  95. <view class="bottom">
  96. <view class="bottom-total">
  97. 累计欠费<span class="total">{{ totalCount || 0 }}</span
  98. >笔,合计<span class="total">{{ totalPayAmount || 0 }}</span
  99. >元
  100. </view>
  101. <view class="button-wrap" v-if="payList.length && payList.length >= 1">
  102. <button class="button" type="primary" :disabled="!totalPayAmount" @click="confirmPrice()">全部缴费</button>
  103. </view>
  104. </view>
  105. <!-- 缴费提示-->
  106. <u-modal
  107. v-model="payTipsPop"
  108. :title-style="{ color: '#404040' }"
  109. title="缴费提示"
  110. :show-confirm-button="true"
  111. confirm-text="立即缴费"
  112. :confirm-style="{ backgroundColor: '#3397FA', color: '#fff' }"
  113. :show-cancel-button="true"
  114. cancel-text="取消"
  115. :cancel-style="{ backgroundColor: '#EBF1FF', color: '#3397FA' }"
  116. @confirm="payTipsPopConfirm"
  117. >
  118. <view class="slot-content">
  119. <view class="pay-tips">
  120. <text>{{ totalCount || 0 }}</text
  121. >场停车欠费,共 <text>{{ totalPayAmount || 0 }}</text
  122. >元
  123. </view>
  124. </view>
  125. </u-modal>
  126. <!-- 支付方式 -->
  127. <ChoosePayment
  128. ref="choosePayment"
  129. :exportFlag="exportFlag"
  130. :curOrderList="payOrderIdList"
  131. :jumpUrl="jumpUrl"
  132. @closePaymentMethod="closePaymentMethod"
  133. />
  134. <u-toast ref="uToast" />
  135. </view>
  136. </template>
  137. <script>
  138. // import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue';
  139. import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
  140. export default {
  141. components: {
  142. // PaymentMethod,
  143. ChoosePayment
  144. },
  145. data() {
  146. return {
  147. totalPayAmount: '',
  148. totalCount: '',
  149. currentPayUrl: '',
  150. payList: [[], []],
  151. list: [
  152. {
  153. index: 0,
  154. name: '路段',
  155. orderStatus: null,
  156. pageNum: 1,
  157. total: null
  158. },
  159. {
  160. index: 1,
  161. name: '停车场',
  162. orderStatus: 1,
  163. pageNum: 1,
  164. total: null
  165. }
  166. ],
  167. current: 0,
  168. swiperCurrent: 0,
  169. dx: 0,
  170. loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore'],
  171. isLoadMore: false, //是否加载中
  172. orderList: [],
  173. exportFlag: false,
  174. PayUrl: '',
  175. payTipsPop: false,
  176. payWayPop: false,
  177. // 用来筛选已经加入列表中的id集合
  178. haveIncludesIdList: [],
  179. // 订单支付id集合
  180. payOrderIdList: [],
  181. // 所有订单列表(不分页)
  182. allOrderList: [],
  183. code: null,
  184. jumpUrl: '',
  185. scene:'',
  186. compressId:'',
  187. parkType:1,//1-路段 2-停车场
  188. };
  189. },
  190. computed: {
  191. // 价格小数
  192. priceDecimal() {
  193. return (val) => {
  194. if (val !== parseInt(val)) return val.slice(-2);
  195. else return '00';
  196. };
  197. },
  198. // 价格整数
  199. priceInt() {
  200. return (val) => {
  201. if (val !== parseInt(val)) return val.split('.')[0];
  202. else return val;
  203. };
  204. }
  205. },
  206. onLoad(page) {
  207. const href = location.href.split('#');
  208. this.jumpUrl = href[0] + '#/pages/center/order/order?';
  209. this.scene = page.scene;
  210. this.compressId = page.compressId;
  211. this.parkType = page.parkType;
  212. if(this.parkType==1){
  213. this.current = 0
  214. this.swiperCurrent = 0
  215. }else if(this.parkType==2){
  216. this.swiperCurrent = 1
  217. this.current = 1
  218. }
  219. },
  220. onShow() {
  221. this.list[this.current].pageNum = 1;
  222. this.payList = [[], []];
  223. this.orderListArr(this.list[this.current], this.swiperCurrent);
  224. // this.getAllOrderList(this.swiperCurrent);
  225. },
  226. methods: {
  227. reachBottom() {
  228. if (this.payList[this.current].length >= this.list[this.current].total) {
  229. this.loadStatus.splice(this.list[this.current].index, 1, 'nomore');
  230. return;
  231. }
  232. this.loadStatus.splice(this.list[this.current].index, 1, 'loading');
  233. this.orderListArr(this.list[this.current], this.swiperCurrent);
  234. },
  235. // tab栏切换
  236. change(index) {
  237. this.swiperCurrent = index;
  238. this.current = index;
  239. //重新初始化
  240. this.haveIncludesIdList = [];
  241. this.payOrderIdList = [];
  242. this.payList = [[], []];
  243. this.list[index].pageNum = 1;
  244. if (index == 1) {
  245. this.exportFlag = true;
  246. } else {
  247. this.exportFlag = false;
  248. }
  249. this.orderListArr(this.list[index], index);
  250. // this.getAllOrderList(index);
  251. },
  252. transition({ detail: { dx } }) {
  253. this.$refs.tabs.setDx(dx);
  254. },
  255. animationfinish({ detail: { current } }) {
  256. this.$refs.tabs.setFinishCurrent(current);
  257. this.swiperCurrent = current;
  258. this.current = current;
  259. },
  260. customBack() {
  261. this.$u.route({
  262. type: 'switchTab',
  263. url: 'pages/index/index'
  264. });
  265. },
  266. /**
  267. * @description: 获取所有订单用于全部缴费
  268. * @param {*} index
  269. * @return {*}
  270. */
  271. getAllOrderList(index) {
  272. const apiName = index === 0 ? 'getOrderList' : 'getRoomParkingApi';
  273. this.$u.api[apiName]({
  274. pageSize: 1000,
  275. pageNum: 1,
  276. paying: true
  277. }).then((res) => {
  278. if (res.code === 200) {
  279. this.allOrderList = res?.data?.pageInfo?.rows ?? [];
  280. }
  281. });
  282. },
  283. /**
  284. * @description: 分页订单列表
  285. * @param {*} orderType
  286. * @param {*} index
  287. * @return {*}
  288. */
  289. orderListArr(orderType, index) {
  290. const apiName = index === 0 ? 'getOrderList' : 'getRoomParkingApi';
  291. let pageNum = orderType.pageNum; // 页码, 默认从1开始
  292. let param = {
  293. pageSize: 10000,
  294. pageNum,
  295. paying: true,
  296. };
  297. if(this.scene&&this.compressId){//路段
  298. param = Object.assign({scene:this.scene,compressId:this.compressId},param)
  299. }
  300. this.$u.api[apiName](param)
  301. .then((res) => {
  302. // 判断重复
  303. let newListFlag = true;
  304. this.allOrderList = res?.data?.pageInfo?.rows ?? [];
  305. for (const item of res.data.pageInfo.rows) {
  306. if (this.haveIncludesIdList.includes(item.orderId)) {
  307. newListFlag = false;
  308. } else {
  309. this.payList[orderType.index].push(item);
  310. }
  311. }
  312. if (newListFlag) {
  313. this.list[this.current].total = res.data.pageInfo.total;
  314. this.list[orderType.index].pageNum++;
  315. if (this.payList[this.current].length >= this.list[this.current].total) {
  316. this.loadStatus.splice(this.list[orderType.index].index, 1, 'nomore');
  317. }
  318. this.totalCount = res.data.costInfo.totalCount;
  319. this.totalPayAmount = res.data.costInfo.totalPayAmount;
  320. }
  321. })
  322. .catch((err) => {
  323. this.$refs.uToast.show({
  324. title: err.msg,
  325. type: 'error'
  326. });
  327. });
  328. },
  329. // 去支付,选择支付方式
  330. choosePayWay(orderId, item) {
  331. this.payOrderIdList = [];
  332. this.payOrderIdList.push(orderId);
  333. this.$nextTick(() => {
  334. this.$refs['choosePayment'].openPopup(item, 'single', this.current === 0 ? 'road' : 'parking');
  335. });
  336. },
  337. // 全部缴费确认
  338. confirmPrice() {
  339. let payOrderIdList = [];
  340. this.allOrderList.forEach((item) => {
  341. if (item.orderStatus !== 4 && item.payStatus !== 1) {
  342. payOrderIdList.push(item.orderId);
  343. }
  344. });
  345. this.payOrderIdList = payOrderIdList;
  346. if (this.totalCount !== 0 && this.totalPayAmount !== 0) {
  347. this.payTipsPop = true;
  348. } else {
  349. this.$refs.uToast.show({
  350. title: '没有需要支付的订单',
  351. type: 'warning'
  352. });
  353. }
  354. },
  355. // 缴费提示弹框确认
  356. payTipsPopConfirm() {
  357. this.$nextTick(() => {
  358. this.$refs['choosePayment'].openPopup({ payAmount: Number(this.totalPayAmount) }, 'multiple', this.current === 0 ? 'road' : 'parking');
  359. });
  360. },
  361. closePaymentMethod() {
  362. this.payWayPop = false;
  363. }
  364. }
  365. };
  366. </script>
  367. <style>
  368. /* #ifndef H5 */
  369. page {
  370. height: 100%;
  371. background-color: #f6f6ff;
  372. }
  373. /* #endif */
  374. </style>
  375. <style lang="scss" scoped>
  376. @import './payLists.scss';
  377. </style>