wip: 4.0
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-16 14:27:57 +08:00
parent b09c1d9537
commit 8f3b158032
72 changed files with 3931 additions and 2161 deletions

View File

@@ -21,17 +21,18 @@ page {
.box {
margin: auto;
background-image: url("../../static/ewm.png");
background-image: url('../../static/ewm.png');
background-size: 100% 100%;
width: 608px;
height: 457px;
position: relative;
.qrcode {
.img {
position: absolute;
width: 280px;
height: 280px;
top: 14%;
right: 9%;
top: 66px;
right: 55px;
}
}
}
}

View File

@@ -5,9 +5,7 @@
<view class="desc">请在这里扫码</view>
</view>
<view class="box">
<!-- <image :src="`https://api.pwmqr.com/qrcode/create?url=${code}`"></image> -->
<!-- <view ref="qrcode" id="qrcode"></view> -->
<canvas class="qrcode" canvas-id="qrcode" id="qrcode"></canvas>
<image class="img" :src="dataUrl" />
</view>
</view>
</template>
@@ -16,22 +14,22 @@
import { onUnmounted, ref } from "vue";
import Taro from "@tarojs/taro";
import { getAfterOrder } from "@/api/admin";
import UQRCode from "uqrcodejs";
const time_id = ref();
const dataUrl = ref("");
const info = ref<any>({});
Taro.useLoad((e) => {
info.value = e;
getCode();
dataUrl.value = Taro.getStorageSync("pay_code");
time_id.value = setInterval(async () => {
const { data } = await getAfterOrder({
bid: info.value.bid,
oid: info.value.oid,
});
if (data.data.status !== 0 && data.data.status !== 2) {
clearInterval(time_id.value);
Taro.showToast({
title: "支付成功",
icon: "success",
@@ -46,23 +44,14 @@ Taro.useLoad((e) => {
}, 1000);
});
const getCode = () => {
var qr = new UQRCode();
qr.data = Taro.getStorageSync("pay_code");
qr.size = 160;
qr.margin = 5;
qr.make();
const canvasContext = Taro.createCanvasContext("qrcode");
qr.canvasContext = canvasContext;
qr.drawCanvas();
};
Taro.useDidHide(() => {
clearInterval(time_id.value);
Taro.removeStorageSync("pay_code");
});
onUnmounted(() => {
clearInterval(time_id.value);
Taro.removeStorageSync("pay_code");
});
</script>

View File

@@ -1,71 +1,77 @@
<template>
<view>
<view class="header">
<view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</view>
</view>
<view class="card">
<view class="center" v-for="(itm, idx) in info.OrderGoods" :key="idx">
<view class="top">
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods.name }} </view>
<view class="right">
<view v-if="info.pay_type === 1">{{ itm.pay_price }}</view>
<view v-else>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view>
</view>
</view>
</view>
<view class="line"></view>
<view class="bom" style="text-align: right">
{{ info.count }}件商品,支付方式:{{
info.pay_type === 1 ? "微信" : "积分"
}},实付:
<text style="color: red">{{
info.pay_type === 1 ? `${info.price}` : `${info.exchange}积分`
}}</text>
</view>
</view>
<!-- 订单信息 -->
<nut-cell-group>
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
<nut-cell>
<template #default>
<view class="center-box">
<view
class="top"
v-for="(item, index) in info.OrderGoods"
:key="index">
<image class="mr-10" :src="item.Goods?.cover" />
<view class="flex-1">
<view class="title">{{ item.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ item.pay_price }}</view>
<view>{{ item.pay_integral }}积分</view>
</view>
</view>
<view class="right">
<view>x{{ item.number }}</view>
</view>
</view>
<view
class="flex justify-between items-center mt-2 mb-2 text-[25px]">
<view class="text-[#9C9C9C]">{{ `${info.count}件商品` }}</view>
<view
>{{ info.status !== 0 ? '实' : '应' }}付款{{
info.pay_type === 1 ? '(元): ' : '(积分): '
}}{{ info.pay_type === 1 ? info.price : info.exchange }}</view
>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group>
<nut-cell-group>
<nut-cell title="订单号:" :desc="info.oid"></nut-cell>
<nut-cell
title="订单状态:"
:desc="
info.status === 0
? '待付款'
: info.status === 1
? '待使用'
: info.status === 2
? '已使用'
: '已失效'
">
</nut-cell>
<nut-cell title="下单用户:" :desc="info.User?.nickName"></nut-cell>
<nut-cell title="用户手机号:" :desc="info.User?.phone"></nut-cell>
<nut-cell title="下单时间:" :desc="info.add_time"></nut-cell>
<nut-cell title="核销时间:" :desc="info.User?.phone"></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人员:"
:desc="info.CancelUser?.nickName"
></nut-cell>
:desc="info.CancelUser?.nickName"></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人手机号:"
:desc="info.CancelUser?.phone"
></nut-cell>
:desc="info.CancelUser?.phone"></nut-cell>
</nut-cell-group>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { computed, ref } from "vue";
import Taro from '@tarojs/taro';
import {ref} from 'vue';
const info = ref<any>({});
Taro.useLoad(() => {
info.value = Taro.getStorageSync("ver_order_info");
console.log(info.value);
});
const orderStatus = computed(() => {
switch (info.value.status) {
case 1:
return "待核销";
case 2:
return "已核销";
case 3:
return "已失效";
}
info.value = Taro.getStorageSync('ver_order_info');
});
</script>
@@ -148,6 +154,7 @@ page {
display: flex;
justify-content: space-between;
// align-items: flex-start;
margin-bottom: 10px;
image {
width: 150px;
@@ -172,4 +179,41 @@ page {
}
}
}
.center-box {
display: flex;
flex-direction: column;
width: 100%;
.top {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
image {
width: 150px;
height: 150px;
border-radius: 10rpx;
margin-right: 10px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
}
</style>

View File

@@ -1,29 +1,94 @@
.tabs-1 {
display: flex;
box-sizing: border-box;
justify-content: space-between;
justify-content: space-evenly;
align-items: center;
background-color: #fff;
padding: 10px;
overflow-x: scroll;
// padding: 10px;
.item {
display: flex;
flex-direction: column;
align-items: center;
.line {
margin-top: 10px auto;
margin: 10px auto;
width: 50px;
height: 5px;
height: 8px;
border-radius: 15px;
}
}
}
// .order-card {
// width: 95%;
// box-sizing: border-box;
// margin: 15px auto;
// background-color: #fff;
// border-radius: 10px;
// padding: 20px;
// .line {
// width: 100%;
// height: 1px;
// background-color: #f5f5f5;
// margin: 10px;
// }
// .top {
// // display: flex;
// // justify-content: space-between;
// // align-items: center;
// .name {
// font-weight: bold;
// }
// .sub {
// color: #999;
// font-size: 30px;
// }
// }
// .btn {
// display: flex;
// justify-content: flex-end;
// align-items: center;
// }
// .center {
// .top {
// display: flex;
// justify-content: space-between;
// // align-items: flex-start;
// image {
// width: 150px;
// height: 150px;
// border-radius: 10px;
// }
// .title {
// margin-left: 10px;
// display: -webkit-box;
// overflow: hidden;
// -webkit-line-clamp: 2;
// -webkit-box-orient: vertical;
// text-overflow: ellipsis;
// width: 350px;
// }
// .right {
// margin-left: 10px;
// font-size: 28px;
// text-align: right;
// }
// }
// }
// }
.order-card {
width: 95%;
box-sizing: border-box;
margin: 15px auto;
background-color: #fff;
border-radius: 10px;
padding: 20px;
.line {
@@ -34,18 +99,9 @@
}
.top {
// display: flex;
// justify-content: space-between;
// align-items: center;
.name {
font-weight: bold;
}
.sub {
color: #999;
font-size: 30px;
}
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
@@ -55,19 +111,20 @@
}
.center {
// margin-bottom: 10px;
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
// justify-content: space-between;
align-items: flex-start;
image {
width: 150px;
height: 150px;
border-radius: 10px;
border-radius: 15px;
margin-right: 10px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
@@ -80,6 +137,7 @@
margin-left: 10px;
font-size: 28px;
text-align: right;
color: #9c9c9c;
}
}
}

View File

@@ -5,15 +5,18 @@
class="item"
v-for="(item, index) in opt"
:key="index"
@click="tabChange(item.value)"
>
<view>{{ item.text }}</view>
@click="tabChange(item.value)">
<view
:style="{
color: item.value === tabVal ? '#333333' : '#9C9C9C',
}"
>{{ item.text }}</view
>
<view
class="line"
:style="{
backgroundColor: item.value === tabVal ? 'red' : '',
}"
></view>
backgroundColor: item.value === tabVal ? '#FFD940' : '',
}"></view>
</view>
</view>
<view v-if="dataList.length > 0">
@@ -21,73 +24,87 @@
class="order-card"
v-for="(item, index) in dataList"
:key="index"
@click="toDetailPage(item)"
>
@click="toDetailPage(item)">
<view class="top">
<view class="name">订单号:{{ item.oid }}</view>
<!-- <view class="sub">下单时间{{ item.add_time }}</view> -->
<view class="sub" v-if="item.status !== 3">核销时间:{{ item.cancel_time || "待核销" }}</view>
<!-- <view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view> -->
<view class="text-[#9C9C9C] text-[25px]">订单号{{ item.oid }}</view>
<view
:style="{
color:
item.status === 0
? '#FF850A'
: item.status === 1
? '#F83D3D'
: item.status === 2
? '#333333'
: '#9C9C9C',
}"
>{{
item.status === 0
? '待付款'
: item.status === 1
? '待使用'
: item.status === 2
? '已使用'
: '已失效'
}}
</view>
</view>
<view class="line"></view>
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top">
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods.name }} </view>
<image class="mr-10" :src="itm.Goods.cover" />
<view class="flex-1">
<view class="title">{{ itm.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
</view>
</view>
<view class="right">
<view v-if="item.pay_type === 1">{{ itm.pay_price }}</view>
<view v-else>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view>
</view>
</view>
</view>
<view class="line"></view>
<view class="bom" style="text-align: right">
{{ item.count }}件商品,支付方式:{{
item.pay_type === 1 ? "微信" : "积分"
}},实付:
<text style="color: red">{{
item.pay_type === 1 ? `${item.price}` : `${item.exchange}积分`
}}</text>
<view
class="flex justify-between items-center mt-2 mb-2 text-[25px]"
v-if="item.status !== 0">
<text class="text-[#9C9C9C]">{{ item.count }}件商品</text>
<view
>{{ item.status !== 0 ? '实' : '应' }}付款{{
item.pay_type === 1 ? '(元): ' : '(积分): '
}}{{ item.pay_type === 1 ? item.price : item.exchange }}</view
>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
<nut-empty v-else description="暂无订单"></nut-empty>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { getActiveOrderList } from "../../../../api/admin";
import {ref} from 'vue';
import Taro from '@tarojs/taro';
import {getActiveOrderList} from '../../../../api/admin';
const opt = ref([
{
text: "全部",
text: '全部',
value: 0,
},
{
text: "待付款",
text: '待付款',
value: 1,
},
{
text: "待核销",
text: '待核销',
value: 2,
},
{
text: "已核销",
text: '已核销',
value: 3,
},
{
text: "已失效",
text: '已失效',
value: 4,
},
]);
@@ -96,42 +113,63 @@ const tabVal = ref(0);
const dataList = ref<any>([]);
Taro.useLoad((options) => {
const pageOpt = ref({
page: 1,
total: 0,
});
Taro.useLoad(options => {
tabVal.value = Number(options.type);
getData();
});
const getData = async () => {
Taro.showLoading({
title: '加载中',
});
try {
const user_info = Taro.getStorageSync("userInfo");
const user_info = Taro.getStorageSync('userInfo');
const data = {
bid: user_info.data.bid,
status: tabVal.value,
PageNum: pageOpt.value.page,
PageSize: 10,
};
const res = await getActiveOrderList(data);
dataList.value = res.data.data;
dataList.value.push(...res.data.data);
pageOpt.value.total = res.data.total || 0;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
}
Taro.hideLoading();
};
const tabChange = (e: number) => {
console.log(e);
tabVal.value = e;
getData();
};
const toDetailPage = (item: any) => {
Taro.setStorageSync("ver_order_info", item);
Taro.setStorageSync('ver_order_info', item);
Taro.navigateTo({
url: "/pages/admin/order_manage/detail/index",
url: '/pages/admin/order_manage/detail/index',
});
};
Taro.useReachBottom(() => {
if (pageOpt.value.total === dataList.value.length)
return Taro.showToast({
title: '没有更多数据了',
icon: 'none',
});
pageOpt.value.page++;
getData();
});
</script>
<style lang="scss">
@import "./index.scss";
@import './index.scss';
</style>

View File

@@ -106,6 +106,7 @@
<nut-calendar
v-model:visible="isVisible"
type="range"
:default-value="pickerVal"
:start-date="date_start"
@close="isVisible = false"
@choose="setChooseValue"
@@ -193,11 +194,17 @@ const opts = ref<any>({
],
});
const pickerVal = ref<any>([])
Taro.useLoad((options) => {
where.value.type = options.type === "price" ? 1 : 2;
time.value = options.time;
setTime(options.time);
// getData();
pickerVal.value = [
dayjs().format('YYYY-MM-DD'),
dayjs().format('YYYY-MM-DD'),
];
});
const setTime = (type: string) => {

View File

@@ -1,13 +1,17 @@
<template>
<view>
<view class="card">
<nut-button block type="primary" @click="scanCode">扫码核销</nut-button>
<image
class="image"
@tap="scanCode"
src="http://p1.meituan.net/csc/696924dda634f05689dabdfbb18e88cc13551.png" />
<view class="mt-2 text-[#7A7A7A]">扫描二维码核销</view>
</view>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import Taro from '@tarojs/taro';
// url参数转对象
// const urlParse = (url: string) => {
@@ -28,8 +32,8 @@ import Taro from "@tarojs/taro";
const scanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: async (res) => {
scanType: ['qrCode'],
success: async res => {
try {
Taro.navigateTo({
url: `/pages/admin/verify/verify_list/index?oid=${res.result}`,
@@ -37,7 +41,7 @@ const scanCode = () => {
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
}
},
@@ -48,9 +52,9 @@ const scanCode = () => {
<style lang="scss">
page {
background-color: #f5f5f5;
background-image: url("~@/static/admin/cancellation-header.png");
background-image: url('http://p0.meituan.net/csc/e6ff5582788af2023f49241afe22fc89391851.png');
background-repeat: no-repeat;
background-size: 100% 30%;
background-size: 100% 25%;
}
.card {
@@ -59,10 +63,16 @@ page {
box-sizing: border-box;
background-color: #fff;
margin: 300px auto;
border-radius: 10px;
border-radius: 33px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 100px;
.image {
width: 150px;
height: 150px;
}
}
</style>

View File

@@ -0,0 +1,38 @@
.card {
padding: 20rpx;
background-color: #fff;
margin: 20px auto;
.container {
display: flex;
justify-content: space-between;
.image {
width: 150px;
height: 150px;
border-radius: 15px;
margin-right: 20px;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.title {
margin-bottom: 10px;
}
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
}
.nut-button {
border-radius: 20px;
}

View File

@@ -1,49 +1,71 @@
<template>
<view>
<view class="card">
<view>订单号{{ goodInfo.oid }}</view>
<view class="text-[#7A7A7A]">订单号{{ goodInfo.oid }}</view>
<view class="line"></view>
<view
class="container"
v-for="(item, index) in goodInfo.OrderGoods"
:key="index"
>
<image class="image" :src="item.Goods.cover" mode="widthFix"></image>
:key="index">
<image class="image" :src="item.Goods.cover"></image>
<view class="info">
<view class="title">商品名称{{ item.Goods.name }}</view>
<view class="title">描述{{ item.Goods.profile }}</view>
<view class="num"
>数量: <text style="color: red">{{ item.number }}</text></view
>
<view class="title">{{ item.Goods.name }}</view>
<view class="text-[#7A7A7A] text-[22px]">{{
item.Goods.profile || '此商品暂无描述'
}}</view>
</view>
<view></view>
<view class="text-[#9C9C9C]">x{{ item.number }}</view>
</view>
<view class="line"></view>
<text>支付方式{{ goodInfo.pay_type === 1 ? "微信" : "积分" }}</text
>
<text
>总计{{
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
}}</text
>
<view class="line"></view>
<view class="cz">
<view
class="flex justify-between items-center mt-3 mb-2 text-[25px]"
style="text-align: right">
<text class="text-[#9C9C9C] text-left"
>{{ goodInfo.count }}件商品</text
>
<text class="flex-1"
>{{ goodInfo.status !== 0 ? '实' : '应' }}付款{{
goodInfo.pay_type === 1 ? '(元): ' : '(积分): '
}}{{
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
}}</text
>
</view>
<!-- <view class="line"></view> -->
<!-- <view class="cz">
<nut-button size="small" type="primary" @click="subVerify"
>确定核销</nut-button
>
</view>
</view> -->
</view>
<nut-cell-group>
<nut-cell title="订单信息"></nut-cell>
<nut-cell
title="下单时间:"
:desc="goodInfo.add_time?.slice(0, 19)"></nut-cell>
<nut-cell title="下单号码:" :desc="goodInfo.User?.phone"></nut-cell>
<nut-cell title="下单用户:" :desc="goodInfo.User?.nickName"></nut-cell>
<nut-cell
title="付款方式:"
:desc="getPayType(goodInfo.pay_type)"></nut-cell>
</nut-cell-group>
<view class="w-[90%] mt-[40px] m-auto">
<nut-button type="primary" shape="square" block @click="subVerify"
>确定核销</nut-button
>
</view>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { getActiveVerifyList, activeOrderVerify } from "@/api/admin";
import { ref } from "vue";
import Taro from '@tarojs/taro';
import {getActiveVerifyList, activeOrderVerify} from '@/api/admin';
import {ref} from 'vue';
const opt = ref<any>({});
Taro.useLoad((options) => {
Taro.useLoad(options => {
opt.value = options;
getData(options);
});
@@ -51,15 +73,15 @@ Taro.useLoad((options) => {
const goodInfo = ref<any>({});
const getData = async (options: any) => {
const merInfo = Taro.getStorageSync("mer_info");
const merInfo = Taro.getStorageSync('mer_info');
const res = await getActiveVerifyList({
oid: options.oid,
bid: merInfo.bid,
});
if (!res.data.data.oid) {
Taro.showToast({
title: "没有此订单",
icon: "none",
title: '没有此订单',
icon: 'none',
});
setTimeout(() => {
Taro.navigateBack({
@@ -78,7 +100,7 @@ const subVerify = async () => {
});
Taro.showToast({
title: res.msg,
icon: "none",
icon: 'none',
});
setTimeout(() => {
Taro.navigateBack({
@@ -88,49 +110,26 @@ const subVerify = async () => {
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
throw error;
}
};
const getPayType = (type: number) => {
switch (type) {
case 1:
return '微信线上支付';
case 2:
return '平台积分支付';
case 3:
return '天才小猪支付';
default:
return '未知';
}
};
</script>
<style lang="scss">
.card {
padding: 20rpx;
background-color: #fff;
margin: 10px auto;
width: 90%;
border-radius: 7px;
.container {
display: flex;
image {
width: 150px;
height: 150px;
border-radius: 7px;
display: block;
}
.info {
margin-left: 20px;
}
.title {
margin-bottom: 10px;
}
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
.cz {
text-align: right;
}
}
@import './index.scss';
</style>

View File

@@ -1,3 +1,4 @@
export default definePageConfig({
navigationBarTitleText: "收益提现",
navigationBarTitleText: '收益提现',
enablePullDownRefresh: true,
});

View File

@@ -0,0 +1,125 @@
.text-red {
color: red;
}
.data {
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding: 10px;
.pagination {
margin: 10px auto;
}
}
.tag {
width: 100%;
padding: 5px 8px;
color: white;
border-radius: 8px;
margin: 0 auto;
}
.success {
color: #4fc08d;
}
.danger {
color: #df3526;
}
.warning {
color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
.card {
margin: 20px auto;
background-image: url('http://p0.meituan.net/csc/902ecf4ba9765a8200817d58a3a5a655172781.png');
background-size: 100% 100%;
width: 95%;
height: 250px;
border-radius: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
.container {
color: #fff;
padding: 45px 100px;
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
.line {
width: 1px;
height: 50px;
background-color: #ff9c9c;
}
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
color: #8a1717;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
background-color: rgba(255, 255, 255, 0.2);
padding: 10px 30px;
height: 150px;
}
}
.formCard {
width: 95%;
margin: auto;
border-radius: 20px;
background-color: #fff;
padding: 20px;
--nut-cell-box-shadow: none;
--nut-cell-padding: 10px 5px;
}
.nut-button {
border-radius: 20px;
border: none;
}
.title {
margin: 20px;
display: flex;
align-items: center;
.title-line {
width: 8px;
height: 35px;
background-color: #df3526;
border-radius: 20px;
margin-right: 10px;
}
}
.list {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #333333;
.item {
width: 95%;
background-color: #fff;
margin-bottom: 10px;
border-radius: 15px;
padding: 25px;
}
}

View File

@@ -1,100 +1,40 @@
<script lang="ts" setup>
import { ref, h } from "vue";
import Taro from "@tarojs/taro";
import { getWithdrawList, addWithdraw } from "@/api/admin";
import {ref, h} from 'vue';
import Taro from '@tarojs/taro';
import {getWithdrawList, addWithdraw} from '@/api/admin';
const user_info = Taro.getStorageSync("userInfo");
const user_info = ref<any>({});
const mer_info = ref<any>({});
const row = ref(0);
const formRef = ref();
const basicData = ref({
num: "",
num: '',
});
const showPreview = ref(false);
const visible1 = ref(false);
const imgData = ref([
{
src: "",
src: '',
},
]);
const columns = ref([
{
title: "时间",
key: "add_time",
align: "center",
},
{
title: "提现金额",
key: "integral",
align: "center",
render: (row: { integral: number }) => {
return h("view", {}, row.integral);
},
},
{
title: "审核状态",
key: "status",
align: "center",
render: (row: { status: number }) => {
return h(
"view",
{
class: `tag ${
row.status === 1
? "success"
: row.status === 2
? "danger"
: "warning"
}`,
},
{
default: () =>
row.status === 1
? "已打款"
: row.status === 2
? "已拒绝"
: "待审核",
}
);
},
},
{
title: "备注",
key: "img",
align: "center",
render: (row: { status_img: string }) => {
return h("img", {
class: "image",
onClick: () => {
imgData.value[0].src = row.status_img;
showPreview.value = true;
},
src: row.status_img,
});
},
},
]);
const data = ref([]);
const data = ref<any>([]);
const pagination = ref({
page: 1,
itemsPerPage: 5,
showPageSize: 5,
totalItems: 0,
change: (page: number) => {
pagination.value.page = page;
getData();
},
total: 0,
});
const hideFn = () => {
showPreview.value = false;
};
Taro.useLoad(() => {
user_info.value = Taro.getStorageSync('userInfo');
mer_info.value = Taro.getStorageSync('mer_info');
getData();
});
@@ -102,11 +42,11 @@ const getData = async () => {
try {
const res = await getWithdrawList({
PageNum: pagination.value.page,
PageSize: pagination.value.showPageSize,
Bid: user_info.data.bid,
PageSize: 10,
Bid: user_info.value.data.bid,
});
data.value = res.data.data || [];
pagination.value.totalItems = res.data.total;
data.value.push(...res.data.data);
pagination.value.total = res.data.total;
row.value = res.data.integral || 0;
} catch (e) {
throw e;
@@ -115,111 +55,220 @@ const getData = async () => {
const add = async () => {
try {
if (Number(basicData.value.num) === 0)
return Taro.showToast({
title: "提现积分需大于0",
icon: "none",
});
const res = await addWithdraw({
Bid: user_info.data.bid,
Number: Number(basicData.value.num),
formRef.value?.validate().then(async ({valid}) => {
if (valid) {
const res = await addWithdraw({
Bid: user_info.value.data.bid,
Number: Number(basicData.value.num),
});
Taro.showToast({
title: res.msg,
icon: 'none',
});
basicData.value.num = '';
await getData();
}
});
Taro.showToast({
title: res.msg,
icon: "none",
});
await getData();
} catch (e) {
throw e;
}
};
const rules = ref({
num: [
{
message: '请填写提现积分',
validator: (value, _) => {
console.log(value);
if (!value) {
return false;
} else {
return true;
}
},
},
{
message: '提现积分最低为100',
validator: (value, _) => {
if (Number(value) < 100) {
return false;
} else {
return true;
}
},
},
{
message: '提现积分不能大于可提现积分',
validator: (value, _) => {
if (Number(value) > row.value) {
return false;
} else {
return true;
}
},
},
],
});
const openPreview = item => {
imgData.value[0].src = item.status_img;
showPreview.value = true;
};
const closePreview = () => {
showPreview.value = false;
imgData.value[0].src = '';
};
Taro.usePullDownRefresh(() => {
pagination.value.page = 1;
getData();
Taro.stopPullDownRefresh();
});
Taro.useReachBottom(() => {
if (pagination.value.total === data.value.length)
return Taro.showToast({
title: '没有更多数据了',
icon: 'none',
});
pagination.value.page++;
getData();
});
</script>
<template>
<view>
<nut-form>
<nut-form-item label="提现积分:">
<nut-input
v-model="basicData.num"
class="nut-input-text"
placeholder="请输入提现积分"
type="text"
/>
</nut-form-item>
<nut-form-item>
<view class="card">
<view class="container">
<view class="">
<view class="font-bold text-[35px]">{{ row }}</view>
<view class="text-[25px] mt-2">可提现积分</view>
</view>
<view class="line"></view>
<view class="">
<view class="font-bold text-[35px]">{{
(row / 100 - (row / 100) * 0.138).toFixed(2)
}}</view>
<view class="text-[25px] mt-2">实际到账</view>
</view>
</view>
<view class="footer">
<text>到账方式</text>
<!-- <text>{{
`${mer_info.bank}(${mer_info.bank_card?.substring(
mer_info.bank_card.length - 4,
)})`
}}</text> -->
<text>银行卡汇款</text>
</view>
</view>
<view class="formCard">
<view class="flex justify-between">
<text>积分提现</text>
<view class="flex items-center" @click="visible1 = true">
<image
class="w-[25px] h-[25px]"
src="http://p1.meituan.net/csc/5437a800f4ed4a49f14984494c1c3077994.png"></image>
<view class="text-[#EC4443] text-[20px] ml-1">提现疑问</view>
</view>
</view>
<nut-form ref="formRef" :model-value="basicData" :rules="rules">
<nut-form-item prop="num">
<nut-input
v-model="basicData.num"
class="nut-input-text"
placeholder="请输入提现积分"
type="text">
<template #right>
<text
class="text-[#EC4443] text-[25px]"
@tap="basicData.num = row.toString()"
>全部</text
>
</template>
</nut-input>
</nut-form-item>
</nut-form>
<nut-button block type="primary" @click="add">立即提现</nut-button>
</view>
<view class="title">
<view class="title-line"></view>
<view class="title-text">提现记录</view>
</view>
<view class="list" v-if="data.length > 0">
<view class="item" v-for="(item, index) in data" :key="index">
<view class="flex justify-between items-center">
<view class="text-[25px] text-[#9C9C9C]">到账金额</view>
<view
class="text-[27px]"
:class="
item.status === 1
? 'success'
: item.status === 1
? 'danger'
: 'warning'
"
>{{
item.status === 1
? '已打款'
: item.status === 2
? '已拒绝'
: '待审核'
}}</view
>
</view>
<view>
当前可提现积分
<text class="text-red">{{ row }}</text>
<view class="mt-3 mb-3 text-[35px]">{{ item.number }}</view>
<view class="text-[25px] mb-1">提现积分{{ item.integral }}</view>
<view class="text-[25px] mb-1"
>信息服务费{{ item.commission }}</view
>
<view class="text-[25px] mb-1"
>手续费{{ item.commission_number }}%</view
>
<view class="text-[25px] mb-1">时间{{ item.add_time }}</view>
<view v-if="item.status === 2" class="text-[25px] text-[#9C9C9C]"
>备注</view
>
<view
v-if="item.status === 1"
class="text-[23px] mt-2 text-[#df3526]"
@click="openPreview(item)"
>点我查看回执单</view
>
</view>
<view style="margin-top: 10px">
实际到账
<text class="text-red">{{ (row / 100).toFixed(2) }}</text>
</view>
</nut-form-item>
<nut-form-item>
<nut-button block type="primary" @click="add">立即提现</nut-button>
</nut-form-item>
</nut-form>
<view v-if="data.length > 0">
<view class="data">
<nut-table :columns="columns" :data="data"></nut-table>
<nut-pagination
class="pagination"
v-model="pagination.page"
:total-items="pagination.totalItems"
:items-per-page="pagination.itemsPerPage"
:show-page-size="pagination.showPageSize"
@change="pagination.change"
:bordered="false"
/>
</view>
</view>
<nut-empty v-else description="暂无提现记录"></nut-empty>
<!-- 图片预览 -->
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn" />
<nut-image-preview
:show="showPreview"
:images="imgData"
@close="closePreview" />
<nut-dialog
title="提现疑问?"
content="这是基础弹框。"
ok-text="我已知晓"
:no-cancel-btn="true"
v-model:visible="visible1">
<template #default>
<text>
积分和人民币兑换比例为
<text class="text-[#F83D3D]">100:1</text>
平台收取<text class="text-[#F83D3D]">10%服务费</text><text
class="text-[#F83D3D]"
>0.038%手续费</text
>
</text>
</template>
</nut-dialog>
</view>
</template>
<style lang="scss">
.text-red {
color: red;
}
.data {
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding: 10px;
.pagination {
margin: 10px auto;
}
}
.tag {
width: 100%;
padding: 5px 8px;
color: white;
border-radius: 8px;
margin: 0 auto;
}
.success {
background-color: #4fc08d;
}
.danger {
background-color: #df3526;
}
.warning {
background-color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
@import './index.scss';
</style>