123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <template>
- <view class='content'>
- <view class="top-content">
- <view class="input">
- <text>车牌号:</text>
- <input placeholder="请输入车牌号" v-model="state.vehiclePlate" />
- </view>
- <view class="last input">
- <text>车牌颜色:</text>
- <uni-data-select v-model="state.vehiclePlateColor" :localdata="state.colorRange" @change="changeColor"
- :clear="false"></uni-data-select>
- </view>
- <view class="example-body">
- <uni-datetime-picker v-model="state.range" type="daterange" />
- <button size="mini" style="color: #ffffff;
- backgroundColor: rgb(118, 200, 77);
- borderColor: rgb(118, 200, 77);
- font-size: 26rpx;
- flex-shrink: 0;margin-left: 20rpx;" @click="search()">搜索</button>
- </view>
- </view>
- <view style="margin-top: 250rpx;">
- <view class='item' v-for="(item,index) in state.newList">
- <view>ETC卡号:{{item.cardId}}<text class="payStatus">{{item.statusC}}</text></view>
- <view>充值金额:¥{{item.rechargeMoney/100}}</view>
- <view>车牌号:{{item.vehiclePlate}}</view>
- <view>车牌颜色:{{item.vehiclePlateColorC}}</view>
- <view>创建时间:{{item.insertTime}}</view>
- <view>圈存状态:{{item.chargeStatus}}</view>
- <!-- 支付成功和未圈存 -->
- <view class="but-wrap" v-if="item.statusC =='待支付'">
- <text @click="pay(item.rechargeMoney,item.orderNum)">去支付</text>
- </view>
- <view class="but-wrap" v-else-if="item.statusC =='已支付' && item.chargeStatus=='未圈存'">
- <text @click="toTrap(item.rechargeMoney)">修复</text>
- <text @click="queryRefound(item.cardId,item.orderNum)">退款</text>
-
- </view>
- </view>
- <view style="text-align: center;margin: 20rpx;" v-if="state.flags">我是有底线的~</view>
- <view class="noContent" v-if="!state.newList.length">暂无消费明细</view>
- </view>
-
- </view>
- </template>
-
- <script lang="ts" setup>
- import { reactive } from "vue";
- import { request } from "@/utils/network/request.js";
- import { queryCardRecord, refundQuan, queryRefoundResult } from "@/utils/network/api.js";
- import { stringToJson } from "@/utils/network/encryption.js";
- import { onLoad, onReachBottom, onShow } from "@dcloudio/uni-app";
- import { getItem, StorageKeys } from "@/utils/storage";
- import { getCodeName } from "@/datas/queryKey.js";
- import {
- navTo, msg, timesDiff
- } from "@/utils/utils";
- import { getVehiclePlateColor } from "@/datas/vehiclePlateColor";
- const state = reactive({
- list: '', //所有数据
- newList: '', //最终展示的
- cardId: '',
- value: '',//input框里的值
- pageNo: 1,
- pageSize: 16,
- flags: false,
- vehiclePlate: "",
- vehiclePlateColor: "",
- colorRange: [],
- range: ['', ''],
- })
- onLoad((option : any) => {
- console.log("option", option)
- state.cardId = option.cardId;
- let getColor = getItem('key')['VEHICLE_COLOR_TYPE'];
- for (var k = 0; k < getColor.length; k++) {
- let obj = {};
- obj['value'] = getColor[k]['code']
- obj['text'] = getColor[k]['name']
- state.colorRange.push(obj)
- }
- })
- onShow(() => {
- state.pageNo = 1
- state.newList = []
- getList();
- })
- const search = () => {
- state.pageNo = 1
- state.newList = []
- getList();
- }
- const changeColor = (e) => {
- state.vehiclePlateColor = e
- console.log(e)
- }
- const getList = () => {
- if (state.vehiclePlate) {
- if (!state.vehiclePlateColor) {
- msg('请选择车牌颜色')
- return;
- }
- }
- if (state.vehiclePlateColor) {
- if (!state.vehiclePlate) {
- msg('请输入车牌')
- return;
- }
- }
- const options = {
- type: 2,
- data: {
- 'openId': getItem('openId'),
- 'pageNo': state.pageNo,
- 'pageSize': state.pageSize,
- 'vehicleId': state.vehiclePlate ? state.vehiclePlate + "_" + state.vehiclePlateColor : "",
- 'insertTimeStart': state.range[0] ? state.range[0] + ' 00:00:00' : state.range[0],
- 'insertTimeEnd': state.range[1] ? state.range[1] + ' 00:00:00' : state.range[1],
- 'cardId': state.cardId
- },
- method: "POST",
- showLoading: true,
- };
- console.log("data", state.vehiclePlate, state.vehiclePlateColor, state.range)
- request(queryCardRecord, options).then((res) => {
- let data = [...state.newList, ...stringToJson(res.bizContent).data]
- for (var i = 0; i < data.length; i++) {
- console.log("getCodeName", getCodeName('VCR_ORDER_STATUS', data[i]['status']))
- data[i]['payStatusC'] = getCodeName('VCR_ORDER_PAY_STATUS', data[i]['payStatus'])
- // 大于5分钟就不能去支付了
- data[i]['statusC'] = getCodeName('VCR_ORDER_STATUS', data[i]['status'])
- data[i]['vehiclePlateColorC'] = getVehiclePlateColor(data[i]['vehiclePlateColor'])
- }
- state.newList = data
- console.log("交易记录", state.newList)
- })
- }
-
- // 触底加载
- onReachBottom(() => {
- if (state.newList.length < state.pageNo * 16) return state.flags = true
- console.log("触底了")
- state.pageNo++
- getList()
- })
- const toTrap = (rechargeMoney) => {
- uni.navigateTo({
- url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=0`
- })
- }
- // 退款代码
- const queryRefound = (cardId, orderId) => {
- const options = {
- type: 2,
- data: {
- "orderId": orderId,
- "cardId": cardId,
- "openId": getItem(StorageKeys.OpenId),
- },
- method: 'POST',
- showLoading: true,
- }
- console.log("refundQuan", refundQuan, options)
- request(refundQuan, options).then((res) => {
- const data = stringToJson(res.bizContent);
- refoundResult(cardId, orderId);
- console.log("222", data)
- })
- }
- const refoundResult = (cardId, orderId) => {
- const options = {
- type: 2,
- data: {
- "orderId": orderId,
- "cardId": cardId,
- },
- method: 'POST',
- showLoading: true,
- }
- console.log("queryRefoundResult", queryRefoundResult, options)
- request(queryRefoundResult, options).then((res) => {
- const data = stringToJson(res.bizContent);
- console.log("data", data)
- if (data.refundStatus == "SUCCESS") {
-
- } else if (data.refundStatus == "CLOSED") {
- msg('退款关闭')
- } else if (data.refundStatus == "HANDLING") {
- msg('退款处理中')
- } else if (data.refundStatus == "EXCEPTION") {
- msg('退款异常')
- }
- setTimeout(() => {
- console.log("刷新")
- // 刷新列表
- state.pageNo == 1
- state.newList = []
- getList();
- }, 1500)
-
- })
- }
- // 退款代码完成
- // 去支付
- const pay = (rechargeMoney, orderNum) => {
- uni.navigateTo({
- url: `/subpackage/personal-center/trapping-and-repairing/recharge-pay?rechargeMoney=${rechargeMoney}&&payMoney=1&&orderNum=${orderNum}`
- })
- }
- </script>
-
- <style scoped>
- .noContent {
- text-align: center;
- margin-top: 100rpx;
- }
-
- .content {
- background-color: #EEF7F7;
- padding: 0 30rpx;
- overflow: hidden;
- font-size: 32rpx;
- min-height: 100vh;
- }
-
- .search_wrap {
- display: flex;
- margin: 20rpx 0;
- }
-
- .search_wrap>input {
- background-color: white;
- width: 76%;
- height: 40rpx;
- line-height: 40rpx;
- padding: 10rpx 10rpx;
- border-radius: 10rpx 0 0 10rpx;
- }
-
- .item {
- width: 100%;
- border-radius: 10rpx;
- box-sizing: border-box;
- padding: 30rpx 20rpx;
- margin-top: 30rpx;
- background: white;
- color: black;
- }
-
- .time {
- display: flex;
- margin-bottom: 16rpx;
- justify-content: space-between;
- }
-
- .payStatus {
- color: red;
- float: right;
- }
-
- .but-wrap {
- display: flex;
- justify-content: flex-end;
- margin-top: 10rpx;
- }
-
- .but-wrap>text {
- border: 1px solid #00b38b;
- color: #00b38b;
- height: 50rpx;
- line-height: 50rpx;
- border-radius: 30rpx;
- padding: 0 24rpx;
- font-size: 28rpx;
- box-sizing: border-box;
- margin-left: 12rpx;
- }
-
- .top-content {
- position: fixed;
- left: 0;
- top: 0;
- background-color: white;
- width: 100%;
- padding: 0 20rpx 20rpx 20rpx;
- box-sizing: border-box;
- z-index: 999999;
- }
-
- input,
- .uni-input {
- border: 1rpx solid #ccc;
- padding: 0 10rpx;
- height: 28rpx;
- line-height: 28rpx;
- }
-
-
- .input {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- }
-
- .input>text {
- display: inline-block;
- width: 24%;
- }
-
- .input>input {
- width: 47%;
- margin-top: 10rpx;
- font-size: 30rpx;
- }
-
- /deep/.last .uni-stat__select {
- width: 360rpx;
- }
-
- .example-body {
- display: flex;
- align-items: center;
- }
-
-
-
- /deep/.uni-date {
- width: 73% !important;
- }
-
- /deep/.uni-date__x-input,
- /deep/.uni-select {
- font-size: 13px;
- height: 24px;
- line-height: 24px;
- }
-
- /deep/.uni-date-x {
- height: 56rpx !important;
- }
- </style>
|