feat: 添加华夏变现、添加三方权限配置

This commit is contained in:
2026-09-22 10:09:04 +08:00
parent 2a25354ee4
commit 4e190b5879
5 changed files with 564 additions and 141 deletions
+94 -23
View File
@@ -10,9 +10,15 @@
<view class="more-trigger" @click.stop="toggleLiquidationMenu">
<uni-icons type="more-filled" color="#fff" size="34rpx" />
</view>
<view v-if="showLiquidationMenu" class="more-menu">
<view class="more-menu-item" @click.stop="goLiquidation">去变现</view>
<view class="more-menu-item" @click.stop="goWushuangLiquidation">无双变现</view>
<view v-if="showLiquidationMenu && enabledLiquidations.length" class="more-menu">
<view
v-for="item in enabledLiquidations"
:key="item.type"
class="more-menu-item"
@click.stop="goLiquidationByType(item)"
>
{{ item.title }}
</view>
</view>
</view>
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
@@ -43,15 +49,70 @@
</template>
<script setup>
import { ref } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import * as api from '@/sheep/api/home/pay';
import * as apiIndex from '@/sheep/api/index/index';
import * as incrementApi from '@/sheep/api/increment';
import goods from '@/components/goods/goods.vue';
const money_obj = ref();
const tagList = ref([]);
const showLiquidationMenu = ref(false);
const tradeChannelList = ref([]);
const LIQUIDATION_TYPE_META = {
1: { type: 1, title: '去变现', keywords: ['千里马', '去变现', '变现'] },
2: { type: 2, title: '无双变现', keywords: ['无双'] },
3: { type: 3, title: '华夏变现', keywords: ['华夏'] },
};
const matchLiquidationMeta = (channel) => {
const lt = Number(channel?.liquidationType);
if ([1, 2, 3].includes(lt) && LIQUIDATION_TYPE_META[lt]) {
return { type: lt, meta: LIQUIDATION_TYPE_META[lt] };
}
const name = String(channel?.channelName || channel?.name || '').trim();
if (!name) return null;
for (const key of Object.keys(LIQUIDATION_TYPE_META)) {
const m = LIQUIDATION_TYPE_META[key];
const keywords = Array.isArray(m?.keywords) ? m.keywords : [];
if (keywords.some((kw) => name.includes(kw))) {
return { type: Number(key), meta: m };
}
}
return null;
};
const enabledLiquidations = computed(() => {
const channels = Array.isArray(tradeChannelList.value) ? tradeChannelList.value : [];
const list = [];
const added = new Set();
channels.forEach((it) => {
if (Number(it?.status) !== 1) return;
const matched = matchLiquidationMeta(it);
if (!matched) return;
const type = matched.type;
const meta = matched.meta;
if (added.has(type)) return;
added.add(type);
list.push({
type,
title: meta.title,
channelId: it?.id ?? it?.channelId,
});
});
return list;
});
const fetchTradeChannels = async () => {
try {
const res = await incrementApi.getTradeChannelList();
if (res?.code === 0 && Array.isArray(res?.data)) {
tradeChannelList.value = res.data.filter((it) => Number(it?.status) === 1);
}
} catch (e) {}
};
//获取钱包
function getData() {
@@ -72,19 +133,18 @@
onLoad(() => {
getData();
});
onMounted(() => {
fetchTradeChannels();
});
//充值提现弹框提示去跳转
function jumpPage(typeTxt, url) {
showLiquidationMenu.value = false;
uni.showModal({
// title: '',
content: '是否去' + typeTxt,
showCancel: true,
success: (res) => {
//用户点击确定
if (res.confirm) {
uni.navigateTo({
url: url,
});
uni.navigateTo({ url: url });
}
},
});
@@ -92,14 +152,26 @@
function toggleLiquidationMenu() {
showLiquidationMenu.value = !showLiquidationMenu.value;
}
function goLiquidation() {
showLiquidationMenu.value = false;
jumpPage('变现', '/pages/home/liquidation?type=1&title=去变现');
}
function goWushuangLiquidation() {
function goLiquidationByType(item) {
showLiquidationMenu.value = false;
const type = Number(item?.type || 1);
const title = item?.title || LIQUIDATION_TYPE_META[type]?.title || '去变现';
const channelId = item?.channelId ? `&channelId=${item.channelId}` : '';
if (type === 1) {
uni.showModal({
content: '是否去' + title,
showCancel: true,
success: (res) => {
if (!res.confirm) return;
uni.navigateTo({
url: `/pages/home/liquidation?type=${type}${channelId}`,
});
},
});
return;
}
uni.navigateTo({
url: '/pages/home/liquidation?type=2&title=无双变现',
url: `/pages/home/liquidation?type=${type}${channelId}`,
});
}
</script>
@@ -107,11 +179,10 @@
<style lang="scss" scoped>
.header {
height: 318rpx;
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
margin: 32rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
position: relative;
.header-content {
padding: 80rpx 32rpx 24rpx;
@@ -144,18 +215,18 @@
.more-menu {
position: absolute;
top: 62rpx;
top: 58rpx;
right: 0;
min-width: 176rpx;
min-width: 200rpx;
padding: 10rpx;
border-radius: 18rpx;
background: rgba(26, 45, 88, 0.96);
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.18);
z-index: 10;
background: rgba(26, 45, 88, 0.98);
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.28);
z-index: 9999;
}
.more-menu-item {
height: 68rpx;
height: 64rpx;
padding: 0 24rpx;
border-radius: 14rpx;
color: #ffffff;