您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

consumption-record.vue 5.5KB

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class='content'>
  3. <view class='item' v-for="(item,index) in state.newList">
  4. <view>ETC卡号:{{item.cardId}}<text class="payStatus">{{item.payStatusC}}</text></view>
  5. <view>充值金额:¥{{item.rechargeMoney/100}}</view>
  6. <view>申请时间:{{item.insertTime}}</view>
  7. <view>圈存状态:{{item.statusC}}</view>
  8. <!-- 支付成功和未圈存 -->
  9. <view class="but-wrap" v-if="item.statusC =='待支付'">
  10. <text @click="pay(item.rechargeMoney,item.orderNum)">去支付</text>
  11. </view>
  12. <view class="but-wrap" v-else-if="item.statusC =='已支付' && item.chargeStatus=='未圈存'">
  13. <text @click="toTrap(item.rechargeMoney)">修复</text>
  14. <text @click="queryRefound(item.cardId,item.orderNum)">退款</text>
  15. </view>
  16. </view>
  17. <view style="text-align: center;margin: 20rpx;" v-if="state.flags">我是有底线的~</view>
  18. </view>
  19. <view class="noContent" v-if="!state.newList.length">暂无消费明细</view>
  20. </template>
  21. <script lang="ts" setup>
  22. import { reactive } from "vue";
  23. import { request } from "@/utils/network/request.js";
  24. import { queryCardRecord, refundQuan, queryRefoundResult } from "@/utils/network/api.js";
  25. import { stringToJson } from "@/utils/network/encryption.js";
  26. import { onLoad, onReachBottom, onShow } from "@dcloudio/uni-app";
  27. import { getItem, StorageKeys } from "@/utils/storage";
  28. import { getCodeName } from "@/datas/queryKey.js";
  29. import {
  30. navTo, msg, timesDiff
  31. } from "@/utils/utils";
  32. const state = reactive({
  33. list: '', //所有数据
  34. newList: '', //最终展示的
  35. cardId: '',
  36. value: '',//input框里的值
  37. pageNo: 1,
  38. pageSize: 16,
  39. flags: false,
  40. })
  41. onLoad((option : any) => {
  42. console.log("option", option)
  43. state.cardId = option.cardId;
  44. })
  45. onShow(() => {
  46. state.pageNo = 1
  47. state.newList = []
  48. getList();
  49. })
  50. const getList = () => {
  51. const options = {
  52. type: 2,
  53. data: {
  54. 'cardId': state.cardId,
  55. // 'cardId': "52011328220202137230",
  56. 'openId': getItem('openId'),
  57. 'pageNo': state.pageNo,
  58. 'pageSize': state.pageSize
  59. },
  60. method: "POST",
  61. showLoading: true,
  62. };
  63. request(queryCardRecord, options).then((res) => {
  64. let data = [...state.newList, ...stringToJson(res.bizContent).data]
  65. for (var i = 0; i < data.length; i++) {
  66. console.log("getCodeName", getCodeName('VCR_ORDER_STATUS', data[i]['status']))
  67. data[i]['payStatusC'] = getCodeName('VCR_ORDER_PAY_STATUS', data[i]['payStatus'])
  68. // 大于5分钟就不能去支付了
  69. data[i]['statusC'] = getCodeName('VCR_ORDER_STATUS', data[i]['status'])
  70. }
  71. state.newList = data
  72. console.log("交易记录", state.newList)
  73. })
  74. }
  75. // 触底加载
  76. onReachBottom(() => {
  77. if (state.newList.length < state.pageNo * 16) return state.flags = true
  78. console.log("触底了")
  79. state.pageNo++
  80. getList()
  81. })
  82. const toTrap = (rechargeMoney) => {
  83. uni.navigateTo({
  84. url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=0`
  85. })
  86. }
  87. // 退款代码
  88. const queryRefound = (cardId, orderId) => {
  89. const options = {
  90. type: 2,
  91. data: {
  92. "orderId": orderId,
  93. "cardId": cardId,
  94. "openId": getItem(StorageKeys.OpenId),
  95. },
  96. method: 'POST',
  97. showLoading: true,
  98. }
  99. console.log("refundQuan", refundQuan, options)
  100. request(refundQuan, options).then((res) => {
  101. const data = stringToJson(res.bizContent);
  102. refoundResult(cardId, orderId);
  103. console.log("222", data)
  104. })
  105. }
  106. const refoundResult = (cardId, orderId) => {
  107. const options = {
  108. type: 2,
  109. data: {
  110. "orderId": orderId,
  111. "cardId": cardId,
  112. },
  113. method: 'POST',
  114. showLoading: true,
  115. }
  116. console.log("queryRefoundResult", queryRefoundResult, options)
  117. request(queryRefoundResult, options).then((res) => {
  118. const data = stringToJson(res.bizContent);
  119. console.log("data", data)
  120. if (data.refundStatus == "SUCCESS") {
  121. } else if (data.refundStatus == "CLOSED") {
  122. msg('退款关闭')
  123. } else if (data.refundStatus == "HANDLING") {
  124. msg('退款处理中')
  125. } else if (data.refundStatus == "EXCEPTION") {
  126. msg('退款异常')
  127. }
  128. setTimeout(() => {
  129. console.log("刷新")
  130. // 刷新列表
  131. state.pageNo == 1
  132. getList();
  133. }, 1500)
  134. })
  135. }
  136. // 退款代码完成
  137. // 去支付
  138. const pay = (rechargeMoney, orderNum) => {
  139. uni.navigateTo({
  140. url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=1&&orderNum=${orderNum}`
  141. })
  142. }
  143. </script>
  144. <style scoped>
  145. .noContent {
  146. text-align: center;
  147. margin-top: 100rpx;
  148. }
  149. .content {
  150. background-color: #EEF7F7;
  151. padding: 0 30rpx;
  152. overflow: hidden;
  153. font-size: 32rpx;
  154. min-height: 100vh;
  155. }
  156. .search_wrap {
  157. display: flex;
  158. margin: 20rpx 0;
  159. }
  160. .search_wrap>input {
  161. background-color: white;
  162. width: 76%;
  163. height: 40rpx;
  164. line-height: 40rpx;
  165. padding: 10rpx 10rpx;
  166. border-radius: 10rpx 0 0 10rpx;
  167. }
  168. .item {
  169. width: 100%;
  170. border-radius: 10rpx;
  171. box-sizing: border-box;
  172. padding: 30rpx 20rpx;
  173. margin-top: 30rpx;
  174. /* background:linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%); */
  175. background: white;
  176. color: black;
  177. }
  178. .time {
  179. display: flex;
  180. margin-bottom: 16rpx;
  181. justify-content: space-between;
  182. }
  183. .payStatus {
  184. color: red;
  185. float: right;
  186. }
  187. .but-wrap {
  188. display: flex;
  189. justify-content: flex-end;
  190. margin-top: 10rpx;
  191. }
  192. .but-wrap>text {
  193. border: 1px solid #00b38b;
  194. color: #00b38b;
  195. height: 50rpx;
  196. line-height: 50rpx;
  197. border-radius: 30rpx;
  198. padding: 0 24rpx;
  199. font-size: 28rpx;
  200. box-sizing: border-box;
  201. margin-left: 12rpx;
  202. }
  203. </style>