完成智慧充值模块

This commit is contained in:
gyq
2025-11-24 10:53:19 +08:00
parent e4f5cc8519
commit 046437ce54
14 changed files with 1342 additions and 1132 deletions

View File

@@ -73,76 +73,8 @@
</view>
</template>
<template v-if="tabsCurrent === 2">
<view class="bg-fff u-font-28">
<view class="box-shadow u-relative">
<view class="u-flex u-row-between u-p-30 u-relative">
<view class="u-flex u-col-center" @tap="timeToggle">
<text class="color-main">充值时间</text>
<view class="icon-down u-m-l-6">
<uni-icons type="right" :color="$utils.ColorMain" size="16"></uni-icons>
</view>
</view>
<view class="u-flex u-col-center" @tap="showStatusToggle">
<text :class="{ 'color-main': nowStatusIndex >= 1 }">状态</text>
<view class="icon-down u-m-l-6">
<uni-icons type="right" :color="nowStatusIndex >= 1 ? $utils.ColorMain : '#000'" size="16"></uni-icons>
</view>
</view>
<view style="width: 164rpx"></view>
<view class="search-box">
<view class="search-btn u-flex" @tap="showSearch" :style="{ width: searchShow ? '690rpx' : '164rpx' }">
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
<view class="u-flex-1 u-p-l-10">
<input v-model="keyword" @confirm="searchConfirm" type="text" placeholder-style="font-size:28rpx;" placeholder="搜索" />
</view>
<view @tap.stop="hideSearch" v-if="searchShow">取消</view>
</view>
</view>
</view>
<view :style="{ height: showStatus ? statusHeight : 0 }" class="tranistion status overflow-hide">
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between" v-for="(item, index) in status" :key="index">
<view :class="{ 'color-main': nowStatusIndex === index }">{{ item }}</view>
<uni-icons v-if="nowStatusIndex === index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
</view>
<view :style="{ height: statusBootom + 'px' }"></view>
</view>
</view>
</view>
<view class="u-flex u-p-30">
<view class="time-area u-font-24 color-main u-flex">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.start"></uni-dateformat>
<text class="u-p-l-10 u-p-r-10"></text>
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.end"></uni-dateformat>
</view>
</view>
<view class="u-p-30">
<view class="recoreds color-fff">
<view class="u-font-32">数据统计</view>
<view class="u-flex u-row-between u-m-t-48">
<view class="u-flex u-flex-col u-row-center u-col-center">
<view>充值总额</view>
<view class="u-font-32 u-m-t-10">0.00</view>
</view>
<view style="margin-left: 240rpx" class="u-flex u-flex-col u-row-center u-col-center">
<view>充值人次</view>
<view class="u-font-32 u-m-t-10">0</view>
</view>
</view>
<view class="u-flex u-row-between u-m-t-30">
<view class="u-flex u-flex-col u-row-center u-col-center">
<view>退款总额</view>
<view class="u-font-32 u-m-t-10">0.00</view>
</view>
<view style="margin-left: 240rpx" class="u-flex u-flex-col u-row-center u-col-center">
<view>退款金额</view>
<view class="u-font-32 u-m-t-10">0</view>
</view>
</view>
</view>
</view>
<rechargeRecord />
</template>
<my-model ref="model" :desc="modelData.desc"></my-model>
<my-date-pickerview @confirm="datePickerConfirm" ref="datePicker"></my-date-pickerview>
</view>
@@ -157,36 +89,51 @@ import myButton from '@/components/my-components/my-button.vue';
import myModel from '@/components/my-components/my-model.vue';
import myDatePickerview from '@/components/my-components/my-date-pickerview';
import rechargeItem from './components/recharge-item.vue';
import rechargeRecord from './components/rechargeRerord.vue';
import $util from '@/commons/utils/getDateArea.js';
import go from '@/commons/utils/go.js';
import { shopRechargePost, shopRechargeGet } from '@/http/api/market/index.js';
import { onLoad } from '@dcloudio/uni-app';
import { shopRechargePost, shopRechargeGet, shopUserFlow } from '@/http/api/market/index.js';
import { onShow } from '@dcloudio/uni-app';
const model = ref(null);
const modelData = reactive({
desc: ''
});
function rechargeItemDel(e) {
modelData.desc = `确定删除【${Number(e.data.price).toFixed(2)}】面额吗?`;
model.value.open();
console.log(e);
uni.showModal({
title: '注意',
content: '确定要删除该充值面额吗?',
success: async (res) => {
try {
if (res.confirm) {
settingForm.value.rechargeDetailList.splice(e.index, 1);
uni.showLoading({
title: '删除中...'
});
await shopRechargePost(settingForm.value);
uni.showToast({
title: '删除成功',
icon: 'none'
});
}
} catch (error) {
console.log(error);
}
setTimeout(() => {
uni.hideLoading();
}, 500);
}
});
// modelData.desc = `确定删除【${Number(e.data.price).toFixed(2)}】面额吗?`;
// model.value.open();
// console.log(e);
}
function toAddRecharge() {
go.to('PAGES_RECHARGE_ADD_RECHARGE');
}
const rechargeLists = ref([
{
id: 1,
price: 200,
desc: '20.00元、2张券'
},
{
id: 2,
price: 500,
desc: '60.00元、4张券'
}
]);
const rechargeLists = ref([]);
let mustBindPhone = ref(true);
const nowDate = new Date();
@@ -218,7 +165,16 @@ function useTypeChange(e) {
async function shopRechargeGetAjax() {
try {
const res = await shopRechargeGet();
res.rechargeDetailList.forEach((item) => {
item.couponInfoList.forEach((val) => {
if (val.coupon && val.coupon !== null) {
val.id = val.coupon.id;
val.title = val.coupon.title;
}
});
});
settingForm.value = res;
rechargeLists.value = res.rechargeDetailList;
} catch (error) {
console.log(error);
}
@@ -291,7 +247,7 @@ function datePickerConfirm(e) {
filters.time.end = e.end;
}
onLoad(() => {
onShow(() => {
shopRechargeGetAjax();
});
</script>