Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

consumption-record.vue 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class='content'>
  3. <view class="top-content">
  4. <view class="input">
  5. <text>车牌号:</text>
  6. <input placeholder="请输入车牌号" v-model="state.vehiclePlate" />
  7. </view>
  8. <view class="last input">
  9. <text>车牌颜色:</text>
  10. <uni-data-select v-model="state.vehiclePlateColor" :localdata="state.colorRange" @change="changeColor"
  11. :clear="false"></uni-data-select>
  12. </view>
  13. <view class="example-body">
  14. <uni-datetime-picker v-model="state.range" type="daterange" />
  15. <button size="mini" style="color: #ffffff;
  16. backgroundColor: rgb(118, 200, 77);
  17. borderColor: rgb(118, 200, 77);
  18. font-size: 26rpx;
  19. flex-shrink: 0;margin-left: 20rpx;" @click="search()">搜索</button>
  20. </view>
  21. </view>
  22. <view style="margin-top: 250rpx;">
  23. <view class='item' v-for="(item,index) in state.newList">
  24. <view>ETC卡号:{{item.cardId}}<text class="payStatus">{{item.payStatusC}}</text></view>
  25. <view>充值金额:¥{{item.rechargeMoney/100}}</view>
  26. <view>车牌号:{{item.vehiclePlate}}</view>
  27. <view>申请时间:{{item.insertTime}}</view>
  28. <view>圈存状态:{{item.statusC}}</view>
  29. <!-- 支付成功和未圈存 -->
  30. <view class="but-wrap" v-if="item.statusC =='待支付'">
  31. <text @click="pay(item.rechargeMoney,item.orderNum)">去支付</text>
  32. </view>
  33. <view class="but-wrap" v-else-if="item.statusC =='已支付' && item.chargeStatus=='未圈存'">
  34. <text @click="toTrap(item.rechargeMoney)">修复</text>
  35. <text @click="queryRefound(item.cardId,item.orderNum)">退款</text>
  36. </view>
  37. </view>
  38. <view style="text-align: center;margin: 20rpx;" v-if="state.flags">我是有底线的~</view>
  39. <view class="noContent" v-if="!state.newList.length">暂无消费明细</view>
  40. </view>
  41. </view>
  42. </template>
  43. <script lang="ts" setup>
  44. import { reactive } from "vue";
  45. import { request } from "@/utils/network/request.js";
  46. import { queryCardRecord, refundQuan, queryRefoundResult } from "@/utils/network/api.js";
  47. import { stringToJson } from "@/utils/network/encryption.js";
  48. import { onLoad, onReachBottom, onShow } from "@dcloudio/uni-app";
  49. import { getItem, StorageKeys } from "@/utils/storage";
  50. import { getCodeName } from "@/datas/queryKey.js";
  51. import {
  52. navTo, msg, timesDiff
  53. } from "@/utils/utils";
  54. const state = reactive({
  55. list: '', //所有数据
  56. newList: '', //最终展示的
  57. cardId: '',
  58. value: '',//input框里的值
  59. pageNo: 1,
  60. pageSize: 16,
  61. flags: false,
  62. vehiclePlate: "",
  63. vehiclePlateColor: "",
  64. colorRange: [],
  65. range: ['', ''],
  66. })
  67. onLoad((option : any) => {
  68. console.log("option", option)
  69. state.cardId = option.cardId;
  70. let getColor = getItem('key')['VEHICLE_COLOR_TYPE'];
  71. for (var k = 0; k < getColor.length; k++) {
  72. let obj = {};
  73. obj['value'] = getColor[k]['code']
  74. obj['text'] = getColor[k]['name']
  75. state.colorRange.push(obj)
  76. }
  77. })
  78. onShow(() => {
  79. state.pageNo = 1
  80. state.newList = []
  81. getList();
  82. })
  83. const search = () => {
  84. state.pageNo = 1
  85. state.newList = []
  86. getList();
  87. }
  88. const changeColor = (e) => {
  89. state.vehiclePlateColor = e
  90. console.log(e)
  91. }
  92. const getList = () => {
  93. const options = {
  94. type: 2,
  95. data: {
  96. 'openId': getItem('openId'),
  97. 'pageNo': state.pageNo,
  98. 'pageSize': state.pageSize,
  99. 'vehicleId': state.vehiclePlate ? state.vehiclePlate + "_" + state.vehiclePlateColor : "",
  100. 'insertTimeStart': state.range[0] ? state.range[0] + ' 00:00:00' : state.range[0],
  101. 'insertTimeEnd': state.range[1] ? state.range[1] + ' 00:00:00' : state.range[1],
  102. },
  103. method: "POST",
  104. showLoading: true,
  105. };
  106. console.log("data", state.vehiclePlate, state.vehiclePlateColor, state.range)
  107. request(queryCardRecord, options).then((res) => {
  108. let data = [...state.newList, ...stringToJson(res.bizContent).data]
  109. for (var i = 0; i < data.length; i++) {
  110. console.log("getCodeName", getCodeName('VCR_ORDER_STATUS', data[i]['status']))
  111. data[i]['payStatusC'] = getCodeName('VCR_ORDER_PAY_STATUS', data[i]['payStatus'])
  112. // 大于5分钟就不能去支付了
  113. data[i]['statusC'] = getCodeName('VCR_ORDER_STATUS', data[i]['status'])
  114. }
  115. state.newList = data
  116. console.log("交易记录", state.newList)
  117. })
  118. }
  119. // 触底加载
  120. onReachBottom(() => {
  121. if (state.newList.length < state.pageNo * 16) return state.flags = true
  122. console.log("触底了")
  123. state.pageNo++
  124. getList()
  125. })
  126. const toTrap = (rechargeMoney) => {
  127. uni.navigateTo({
  128. url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=0`
  129. })
  130. }
  131. // 退款代码
  132. const queryRefound = (cardId, orderId) => {
  133. const options = {
  134. type: 2,
  135. data: {
  136. "orderId": orderId,
  137. "cardId": cardId,
  138. "openId": getItem(StorageKeys.OpenId),
  139. },
  140. method: 'POST',
  141. showLoading: true,
  142. }
  143. console.log("refundQuan", refundQuan, options)
  144. request(refundQuan, options).then((res) => {
  145. const data = stringToJson(res.bizContent);
  146. refoundResult(cardId, orderId);
  147. console.log("222", data)
  148. })
  149. }
  150. const refoundResult = (cardId, orderId) => {
  151. const options = {
  152. type: 2,
  153. data: {
  154. "orderId": orderId,
  155. "cardId": cardId,
  156. },
  157. method: 'POST',
  158. showLoading: true,
  159. }
  160. console.log("queryRefoundResult", queryRefoundResult, options)
  161. request(queryRefoundResult, options).then((res) => {
  162. const data = stringToJson(res.bizContent);
  163. console.log("data", data)
  164. if (data.refundStatus == "SUCCESS") {
  165. } else if (data.refundStatus == "CLOSED") {
  166. msg('退款关闭')
  167. } else if (data.refundStatus == "HANDLING") {
  168. msg('退款处理中')
  169. } else if (data.refundStatus == "EXCEPTION") {
  170. msg('退款异常')
  171. }
  172. setTimeout(() => {
  173. console.log("刷新")
  174. // 刷新列表
  175. state.pageNo == 1
  176. getList();
  177. }, 1500)
  178. })
  179. }
  180. // 退款代码完成
  181. // 去支付
  182. const pay = (rechargeMoney, orderNum) => {
  183. uni.navigateTo({
  184. url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=1&&orderNum=${orderNum}`
  185. })
  186. }
  187. </script>
  188. <style scoped>
  189. .noContent {
  190. text-align: center;
  191. margin-top: 100rpx;
  192. }
  193. .content {
  194. background-color: #EEF7F7;
  195. padding: 0 30rpx;
  196. overflow: hidden;
  197. font-size: 32rpx;
  198. min-height: 100vh;
  199. }
  200. .search_wrap {
  201. display: flex;
  202. margin: 20rpx 0;
  203. }
  204. .search_wrap>input {
  205. background-color: white;
  206. width: 76%;
  207. height: 40rpx;
  208. line-height: 40rpx;
  209. padding: 10rpx 10rpx;
  210. border-radius: 10rpx 0 0 10rpx;
  211. }
  212. .item {
  213. width: 100%;
  214. border-radius: 10rpx;
  215. box-sizing: border-box;
  216. padding: 30rpx 20rpx;
  217. margin-top: 30rpx;
  218. background: white;
  219. color: black;
  220. }
  221. .time {
  222. display: flex;
  223. margin-bottom: 16rpx;
  224. justify-content: space-between;
  225. }
  226. .payStatus {
  227. color: red;
  228. float: right;
  229. }
  230. .but-wrap {
  231. display: flex;
  232. justify-content: flex-end;
  233. margin-top: 10rpx;
  234. }
  235. .but-wrap>text {
  236. border: 1px solid #00b38b;
  237. color: #00b38b;
  238. height: 50rpx;
  239. line-height: 50rpx;
  240. border-radius: 30rpx;
  241. padding: 0 24rpx;
  242. font-size: 28rpx;
  243. box-sizing: border-box;
  244. margin-left: 12rpx;
  245. }
  246. .top-content {
  247. position: fixed;
  248. left: 0;
  249. top: 0;
  250. background-color: white;
  251. width: 100%;
  252. padding: 0 20rpx 20rpx 20rpx;
  253. box-sizing: border-box;
  254. z-index: 999999;
  255. }
  256. input,
  257. .uni-input {
  258. border: 1rpx solid #ccc;
  259. padding: 0 10rpx;
  260. height: 28rpx;
  261. line-height: 28rpx;
  262. }
  263. .input {
  264. display: flex;
  265. align-items: center;
  266. margin-bottom: 16rpx;
  267. }
  268. .input>text {
  269. display: inline-block;
  270. width: 24%;
  271. }
  272. .input>input {
  273. width: 47%;
  274. margin-top: 10rpx;
  275. font-size: 30rpx;
  276. }
  277. /deep/.last .uni-stat__select {
  278. width: 360rpx;
  279. }
  280. .example-body {
  281. display: flex;
  282. align-items: center;
  283. }
  284. /deep/.uni-date {
  285. width: 73% !important;
  286. }
  287. /deep/.uni-date__x-input,
  288. /deep/.uni-select {
  289. font-size: 13px;
  290. height: 24px;
  291. line-height: 24px;
  292. }
  293. /deep/.uni-date-x {
  294. height: 56rpx !important;
  295. }
  296. </style>