|
@@ -56,7 +56,7 @@
|
|
|
<view class="list pl-30 pr-30">
|
|
<view class="list pl-30 pr-30">
|
|
|
<view
|
|
<view
|
|
|
class="item flex-align-center"
|
|
class="item flex-align-center"
|
|
|
- v-for="(item, index) in infiniteScroller.list"
|
|
|
|
|
|
|
+ v-for="(item, index) in dataList"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
@click="detail(index)"
|
|
@click="detail(index)"
|
|
|
>
|
|
>
|
|
@@ -64,11 +64,17 @@
|
|
|
<view class="fs-30 fw-500" key="title" duration="300">{{
|
|
<view class="fs-30 fw-500" key="title" duration="300">{{
|
|
|
typeMap[item.type - 1]
|
|
typeMap[item.type - 1]
|
|
|
}}</view>
|
|
}}</view>
|
|
|
- <view class="fs-24" style="color: rgba(0, 0, 0, 0.4)">余额</view>
|
|
|
|
|
|
|
+ <view v-if="item.type!==2">
|
|
|
|
|
+ <view class="fs-24" style="color: rgba(0, 0, 0, 0.4)">余额</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-else>
|
|
|
|
|
+ <text class="refund-status" :style="refundStyle(item.status)">{{refundLabel(item.status)}}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
</view>
|
|
</view>
|
|
|
<view class="ml-auto" style="text-align: right">
|
|
<view class="ml-auto" style="text-align: right">
|
|
|
<view class="fs-30 fw-500">
|
|
<view class="fs-30 fw-500">
|
|
|
- <text>{{ item.type > 1 ? "- " : "" }}{{ item.amount }}</text>
|
|
|
|
|
|
|
+ <text>{{ item.type ==3 ? "- " : "" }}{{ item.amount }}</text>
|
|
|
<text class="fs-24 ml-6">元</text>
|
|
<text class="fs-24 ml-6">元</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="fs-24" style="color: rgba(0, 0, 0, 0.4)">{{
|
|
<view class="fs-24" style="color: rgba(0, 0, 0, 0.4)">{{
|
|
@@ -101,13 +107,14 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { useInfiniteScroll } from "../../utils/infinite-scroll";
|
|
import { useInfiniteScroll } from "../../utils/infinite-scroll";
|
|
|
import { onReachBottom, onPullDownRefresh, onShow } from "@dcloudio/uni-app";
|
|
import { onReachBottom, onPullDownRefresh, onShow } from "@dcloudio/uni-app";
|
|
|
-import { fetchWallet } from "../../api/user";
|
|
|
|
|
|
|
+import { fetchWallet ,listRefund} from "../../api/user";
|
|
|
import { to } from "../../utils/navigate";
|
|
import { to } from "../../utils/navigate";
|
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
|
import { rpxToPx } from "@/utils/device";
|
|
import { rpxToPx } from "@/utils/device";
|
|
|
|
|
|
|
|
const user = ref();
|
|
const user = ref();
|
|
|
|
|
|
|
|
|
|
+const dataList =ref([])
|
|
|
const tab = ref(0);
|
|
const tab = ref(0);
|
|
|
const tabs = ref([
|
|
const tabs = ref([
|
|
|
{
|
|
{
|
|
@@ -128,8 +135,16 @@ const tabs = ref([
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
-const typeMap = ref(["充值", "提现", "消费"]);
|
|
|
|
|
-const infiniteScroller = useInfiniteScroll(10, (page) => {
|
|
|
|
|
|
|
+const refundStatusMap = ref([
|
|
|
|
|
+ {label:'退款成功 ',value:'SUCCESS',color:'#4cd964'},
|
|
|
|
|
+ {label:'退款关闭 ',value:'CLOSED',color:'#000000'},
|
|
|
|
|
+ {label:'退款处理中 ',value:'PROCESSING',color:'#007aff'},
|
|
|
|
|
+ {label:'退款异常 ',value:'ABNORMAL',color:'#dd524d'},
|
|
|
|
|
+ {label:'退款已申请 ',value:'NEW',color:'#f0ad4e'},
|
|
|
|
|
+])
|
|
|
|
|
+
|
|
|
|
|
+const typeMap = ref(["充值", "退款", "消费"]);
|
|
|
|
|
+/*const infiniteScroller = useInfiniteScroll(10, (page) => {
|
|
|
return fetchWallet(tab.value, page, 10).then((res: any) => {
|
|
return fetchWallet(tab.value, page, 10).then((res: any) => {
|
|
|
if (res && res.length) {
|
|
if (res && res.length) {
|
|
|
res.forEach((item: any) => {
|
|
res.forEach((item: any) => {
|
|
@@ -138,22 +153,29 @@ const infiniteScroller = useInfiniteScroll(10, (page) => {
|
|
|
}
|
|
}
|
|
|
return res;
|
|
return res;
|
|
|
});
|
|
});
|
|
|
-});
|
|
|
|
|
|
|
+});*/
|
|
|
const scrollViewHeight = ref(0);
|
|
const scrollViewHeight = ref(0);
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
- infiniteScroller.refresh();
|
|
|
|
|
|
|
+ // infiniteScroller.refresh();
|
|
|
|
|
+ loadData();
|
|
|
if (getApp<any>().globalData.user) {
|
|
if (getApp<any>().globalData.user) {
|
|
|
user.value = getApp<any>().globalData.user;
|
|
user.value = getApp<any>().globalData.user;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
onReachBottom(() => {
|
|
onReachBottom(() => {
|
|
|
- infiniteScroller.next();
|
|
|
|
|
|
|
+ // if(tab.value!==2){
|
|
|
|
|
+ // infiniteScroller.next();
|
|
|
|
|
+ // }
|
|
|
|
|
+ loadData();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onPullDownRefresh(() => {
|
|
onPullDownRefresh(() => {
|
|
|
- infiniteScroller.refresh();
|
|
|
|
|
|
|
+ // if(tab.value!==2){
|
|
|
|
|
+ // infiniteScroller.refresh();
|
|
|
|
|
+ // }
|
|
|
|
|
+ loadData();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const ready = (e: any) => {
|
|
const ready = (e: any) => {
|
|
@@ -162,18 +184,91 @@ const ready = (e: any) => {
|
|
|
(e.detail.navigationBarHeight + rpxToPx(380));
|
|
(e.detail.navigationBarHeight + rpxToPx(380));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const refundLabel = (value:string)=>{
|
|
|
|
|
+ return refundStatusMap.value.find((item:any)=>item.value===value)?.label
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const refundStyle = (value:string)=>{
|
|
|
|
|
+ let rf = refundStatusMap.value.find((item:any)=>item.value===value);
|
|
|
|
|
+ return setupLabelColorStyle(rf?.color)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const setupLabelColorStyle=(hex: string = "#000000", opacity = 0.2)=> {
|
|
|
|
|
+ if (!hex) {
|
|
|
|
|
+ hex = "#000000"
|
|
|
|
|
+ }
|
|
|
|
|
+ hex = hex.replace("#", "");
|
|
|
|
|
+ // Convert the hex value to RGB values
|
|
|
|
|
+ const r = parseInt(hex.substring(0, 2), 16);
|
|
|
|
|
+ const g = parseInt(hex.substring(2, 4), 16);
|
|
|
|
|
+ const b = parseInt(hex.substring(4, 6), 16);
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+/* 'text-shadow': `2px 2px 3px rgba(${r},${g},${b},${opacity})`,
|
|
|
|
|
+ 'background-color': `rgba(${r},${g},${b},${opacity})`,*/
|
|
|
|
|
+ 'color': `rgb(${r},${g},${b})`
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const changeTab = (index: number) => {
|
|
const changeTab = (index: number) => {
|
|
|
tab.value = tabs.value[index].value;
|
|
tab.value = tabs.value[index].value;
|
|
|
- infiniteScroller.refresh();
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ loadData();
|
|
|
|
|
+/* if (tab.value === 2) {
|
|
|
|
|
+ let user = getApp<any>().globalData.user;
|
|
|
|
|
+ if (user) {
|
|
|
|
|
+ listRefund({userId: user.id,pageSize:1000}).then((res: any) => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ let dataList = (res.list || []).map(item => {
|
|
|
|
|
+ item.amount = (Number(item.refund) / 100).toFixed(2);
|
|
|
|
|
+ item.type = 2;
|
|
|
|
|
+ if (item.successTime) {
|
|
|
|
|
+ item.transactionTime = item.successTime.slice(0, 3).join("-") + " " + item.successTime.slice(3, 6).join(":")
|
|
|
|
|
+ }
|
|
|
|
|
+ return item;
|
|
|
|
|
+ })
|
|
|
|
|
+ infiniteScroller.setList(dataList);
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ infiniteScroller.refresh();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }*/
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const loadData = ()=>{
|
|
|
|
|
+ if(!user)return;
|
|
|
|
|
+ if(tab.value!==2){
|
|
|
|
|
+ fetchWallet(tab.value, 1, 1000).then((res: any) => {
|
|
|
|
|
+ if (res && res.length) {
|
|
|
|
|
+ res.forEach((item: any) => {
|
|
|
|
|
+ item.amount = (Number(item.amount) / 100).toFixed(2);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ dataList.value = res;
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ listRefund({userId: user.value.id,pageSize:1000}).then((res: any) => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ let list = (res.list || []).map(item => {
|
|
|
|
|
+ item.amount = (Number(item.refund) / 100).toFixed(2);
|
|
|
|
|
+ item.type = 2;
|
|
|
|
|
+ if (item.successTime) {
|
|
|
|
|
+ item.transactionTime = item.successTime.slice(0, 3).join("-") + " " + item.successTime.slice(3, 6).join(":")
|
|
|
|
|
+ }
|
|
|
|
|
+ return item;
|
|
|
|
|
+ })
|
|
|
|
|
+ dataList.value = list;
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const detail = (index: number) => {
|
|
const detail = (index: number) => {
|
|
|
- if (!infiniteScroller.list) {
|
|
|
|
|
|
|
+ if (!dataList.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (infiniteScroller.list[index].type === 3) {
|
|
|
|
|
|
|
+ if (dataList.value[index].type === 3) {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: `/pages-charge/order/order?id=${infiniteScroller.list[index].orderNo}`,
|
|
|
|
|
|
|
+ url: `/pages-charge/order/order?id=${dataList.value[index]?.orderNo}`,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -244,4 +339,11 @@ const detail = (index: number) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.refund-status{
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ padding: 8rpx;
|
|
|
|
|
+ font-size: 22rpx;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|