feat: 添加华夏变现、添加三方权限配置
This commit is contained in:
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
"name" : "优购商城",
|
"name" : "优购商城",
|
||||||
"appid" : "__UNI__8B19741",
|
"appid" : "__UNI__8B19741",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.7.3",
|
"versionName" : "1.7.5",
|
||||||
"versionCode" : 173,
|
"versionCode" : 175,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"privacy" : {
|
"privacy" : {
|
||||||
|
|||||||
+217
-66
@@ -32,6 +32,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="tip-text">{{ amountTipText }}</view>
|
<view class="tip-text">{{ amountTipText }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card code-card">
|
<view class="card code-card">
|
||||||
<view class=" code-row--mobile">
|
<view class=" code-row--mobile">
|
||||||
<view class="code-label size28">手机号</view>
|
<view class="code-label size28">手机号</view>
|
||||||
@@ -44,8 +45,18 @@
|
|||||||
:maxlength="11"
|
:maxlength="11"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="isHuaxiaType && showHuaxiaMobileTip"
|
||||||
|
:class="[
|
||||||
|
'huaxia-mobile-tip',
|
||||||
|
{ 'huaxia-mobile-tip--verified': isHuaxiaMobileVerified },
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{ isHuaxiaMobileVerified ? '账户核验完成' : '请正确输入华夏手机号' }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="card code-card">
|
|
||||||
|
<view v-if="requireSmsCode" class="card code-card">
|
||||||
<view class="code-row">
|
<view class="code-row">
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
v-model="smsCode"
|
v-model="smsCode"
|
||||||
@@ -78,7 +89,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, watch, onBeforeUnmount } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
import * as payApi from '@/sheep/api/home/pay';
|
import * as payApi from '@/sheep/api/home/pay';
|
||||||
import * as incrementApi from '@/sheep/api/increment';
|
import * as incrementApi from '@/sheep/api/increment';
|
||||||
@@ -94,10 +105,86 @@
|
|||||||
let smsTimer = null;
|
let smsTimer = null;
|
||||||
const submitting = ref(false);
|
const submitting = ref(false);
|
||||||
const liquidationType = ref(1);
|
const liquidationType = ref(1);
|
||||||
const pageTitle = ref('去变现');
|
const channelId = ref(null);
|
||||||
|
const pageTitle = computed(
|
||||||
|
() =>
|
||||||
|
({
|
||||||
|
1: '去变现',
|
||||||
|
2: '无双变现',
|
||||||
|
3: '华夏变现',
|
||||||
|
}[Number(liquidationType.value)] || '去变现'),
|
||||||
|
);
|
||||||
const integerOnly = computed(() => Number(liquidationType.value) === 2);
|
const integerOnly = computed(() => Number(liquidationType.value) === 2);
|
||||||
|
const isHuaxiaType = computed(() => Number(liquidationType.value) === 3);
|
||||||
|
const requireSmsCode = computed(() => !isHuaxiaType.value);
|
||||||
const amountPlaceholder = computed(() => (integerOnly.value ? '00' : '00.00'));
|
const amountPlaceholder = computed(() => (integerOnly.value ? '00' : '00.00'));
|
||||||
const amountTipText = computed(() => (integerOnly.value ? '请输入整数变现金额' : '请输入去变现数量'));
|
const amountTipText = computed(() =>
|
||||||
|
integerOnly.value ? '请输入整数变现金额' : isHuaxiaType.value ? '请输入变现金额' : '请输入去变现数量'
|
||||||
|
);
|
||||||
|
|
||||||
|
const huaxiaMobileRegistered = ref(null);
|
||||||
|
const checkingHuaxiaMobile = ref(false);
|
||||||
|
let huaxiaCheckTimer = null;
|
||||||
|
const isHuaxiaMobileVerified = computed(
|
||||||
|
() => huaxiaMobileRegistered.value === true,
|
||||||
|
);
|
||||||
|
const showHuaxiaMobileTip = computed(() => {
|
||||||
|
if (!isHuaxiaType.value) return false;
|
||||||
|
const mobile = String(smsMobile.value || '').trim();
|
||||||
|
if (!isMobileValid(mobile)) return false;
|
||||||
|
if (checkingHuaxiaMobile.value) return false;
|
||||||
|
return (
|
||||||
|
huaxiaMobileRegistered.value === false ||
|
||||||
|
huaxiaMobileRegistered.value === true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const isMobileValid = (val) => /^1\d{10}$/.test(String(val ?? '').trim());
|
||||||
|
|
||||||
|
const checkHuaxiaMobile = async (mobile) => {
|
||||||
|
if (!isHuaxiaType.value || !isMobileValid(mobile)) return;
|
||||||
|
checkingHuaxiaMobile.value = true;
|
||||||
|
try {
|
||||||
|
const params = { mobile };
|
||||||
|
if (channelId.value != null && channelId.value !== '') {
|
||||||
|
params.channelId = Number(channelId.value);
|
||||||
|
}
|
||||||
|
const res = await incrementApi
|
||||||
|
.checkHuaxiaMobile(params)
|
||||||
|
.catch(() => ({ code: -1, data: false }));
|
||||||
|
if (res?.code === 0) {
|
||||||
|
huaxiaMobileRegistered.value = !!res?.data;
|
||||||
|
} else {
|
||||||
|
huaxiaMobileRegistered.value = null;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
checkingHuaxiaMobile.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => smsMobile.value,
|
||||||
|
(val) => {
|
||||||
|
huaxiaMobileRegistered.value = null;
|
||||||
|
if (huaxiaCheckTimer) {
|
||||||
|
clearTimeout(huaxiaCheckTimer);
|
||||||
|
huaxiaCheckTimer = null;
|
||||||
|
}
|
||||||
|
const mobile = String(val || '').trim();
|
||||||
|
if (!isHuaxiaType.value) return;
|
||||||
|
if (!isMobileValid(mobile)) return;
|
||||||
|
huaxiaCheckTimer = setTimeout(() => {
|
||||||
|
checkHuaxiaMobile(mobile);
|
||||||
|
}, 300);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const stopCountdown = () => {
|
||||||
|
if (smsTimer) {
|
||||||
|
clearInterval(smsTimer);
|
||||||
|
smsTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const sanitizeAmountInput = (val) => {
|
const sanitizeAmountInput = (val) => {
|
||||||
let next = String(val ?? '').replace(integerOnly.value ? /[^\d]/g : /[^\d.]/g, '');
|
let next = String(val ?? '').replace(integerOnly.value ? /[^\d]/g : /[^\d.]/g, '');
|
||||||
@@ -149,66 +236,9 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async () => {
|
|
||||||
if (submitting.value) return;
|
|
||||||
const amt = amountNumber.value;
|
|
||||||
if (!amt) {
|
|
||||||
sheep.$helper.toast(integerOnly.value ? '请输入整数变现金额' : '请输入去变现数量');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (integerOnly.value && !Number.isInteger(amt)) {
|
|
||||||
sheep.$helper.toast('无双变现金额只能输入整数');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (amt > availableYuan.value) {
|
|
||||||
sheep.$helper.toast('变现金额不能大于钱包余额');
|
|
||||||
amount.value = availableYuan.value > 0
|
|
||||||
? integerOnly.value
|
|
||||||
? String(Math.floor(availableYuan.value))
|
|
||||||
: String(availableYuan.value.toFixed(2))
|
|
||||||
: '0';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!String(smsCode.value || '').trim()) {
|
|
||||||
sheep.$helper.toast('请输入验证码');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const mobile = resolveMobile();
|
|
||||||
if (!mobile) return;
|
|
||||||
const money = Math.round(amt * 100);
|
|
||||||
const payload = { money, mobile, scene: smsScene, code: smsCode.value, type: liquidationType.value };
|
|
||||||
submitting.value = true;
|
|
||||||
try {
|
|
||||||
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
|
|
||||||
if (res?.code === 0) {
|
|
||||||
sheep.$helper.toast('变现成功,请等待审核');
|
|
||||||
amount.value = '';
|
|
||||||
smsCode.value = '';
|
|
||||||
refreshWallet();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (res?.code === 1006001000) {
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '您还未实名认证,是否前往实名认证?',
|
|
||||||
cancelText: '取消',
|
|
||||||
confirmText: '去认证',
|
|
||||||
success: (modalRes) => {
|
|
||||||
if (!modalRes?.confirm) return;
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/public/realname',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
submitting.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const resolveMobile = () => {
|
const resolveMobile = () => {
|
||||||
const mobile = String(smsMobile.value || '').trim();
|
const mobile = String(smsMobile.value || '').trim();
|
||||||
if (!/^1\d{10}$/.test(mobile)) {
|
if (!isMobileValid(mobile)) {
|
||||||
sheep.$helper.toast('请输入正确手机号');
|
sheep.$helper.toast('请输入正确手机号');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -216,6 +246,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sendSmsCode = async () => {
|
const sendSmsCode = async () => {
|
||||||
|
if (isHuaxiaType.value) return;
|
||||||
if (smsCountdown.value > 0) return;
|
if (smsCountdown.value > 0) return;
|
||||||
const amt = amountNumber.value;
|
const amt = amountNumber.value;
|
||||||
if (!amt) {
|
if (!amt) {
|
||||||
@@ -246,6 +277,83 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (submitting.value) return;
|
||||||
|
const amt = amountNumber.value;
|
||||||
|
if (!amt) {
|
||||||
|
sheep.$helper.toast(integerOnly.value ? '请输入整数变现金额' : (isHuaxiaType.value ? '请输入变现金额' : '请输入去变现数量'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (integerOnly.value && !Number.isInteger(amt)) {
|
||||||
|
sheep.$helper.toast('无双变现金额只能输入整数');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (amt > availableYuan.value) {
|
||||||
|
sheep.$helper.toast('变现金额不能大于钱包余额');
|
||||||
|
amount.value = availableYuan.value > 0
|
||||||
|
? integerOnly.value
|
||||||
|
? String(Math.floor(availableYuan.value))
|
||||||
|
: String(availableYuan.value.toFixed(2))
|
||||||
|
: '0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const mobile = resolveMobile();
|
||||||
|
if (!mobile) return;
|
||||||
|
if (isHuaxiaType.value) {
|
||||||
|
if (huaxiaMobileRegistered.value === null || checkingHuaxiaMobile.value) {
|
||||||
|
await checkHuaxiaMobile(mobile);
|
||||||
|
}
|
||||||
|
if (huaxiaMobileRegistered.value === false) {
|
||||||
|
sheep.$helper.toast('请正确输入华夏手机号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requireSmsCode.value) {
|
||||||
|
if (!String(smsCode.value || '').trim()) {
|
||||||
|
sheep.$helper.toast('请输入验证码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const money = Math.round(amt * 100);
|
||||||
|
const payload = { money, mobile, type: liquidationType.value };
|
||||||
|
if (requireSmsCode.value) {
|
||||||
|
payload.scene = smsScene;
|
||||||
|
payload.code = String(smsCode.value || '').trim();
|
||||||
|
}
|
||||||
|
if (channelId.value != null && channelId.value !== '') {
|
||||||
|
payload.channelId = Number(channelId.value);
|
||||||
|
}
|
||||||
|
submitting.value = true;
|
||||||
|
try {
|
||||||
|
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
|
||||||
|
if (res?.code === 0) {
|
||||||
|
sheep.$helper.toast('变现成功,请等待审核');
|
||||||
|
amount.value = '';
|
||||||
|
smsCode.value = '';
|
||||||
|
refreshWallet();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (res?.code === 1006001000) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您还未实名认证,是否前往实名认证?',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '去认证',
|
||||||
|
success: (modalRes) => {
|
||||||
|
if (!modalRes?.confirm) return;
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/public/realname',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else if (res?.msg) {
|
||||||
|
sheep.$helper.toast(res.msg);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
submitting.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const goRecord = () => {
|
const goRecord = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/home/liquidationRecord?type=${liquidationType.value}`,
|
url: `/pages/home/liquidationRecord?type=${liquidationType.value}`,
|
||||||
@@ -254,15 +362,46 @@
|
|||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
const nextType = Number(options?.type || 1);
|
const nextType = Number(options?.type || 1);
|
||||||
liquidationType.value = nextType === 2 ? 2 : 1;
|
liquidationType.value = [1, 2, 3].includes(nextType) ? nextType : 1;
|
||||||
pageTitle.value = liquidationType.value === 2 ? '无双变现' : String(options?.title || '去变现');
|
if (options?.channelId != null && options?.channelId !== '') {
|
||||||
|
channelId.value = Number(options.channelId);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
uni.setNavigationBarTitle({ title: pageTitle.value });
|
||||||
|
} catch (e) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
watch(
|
||||||
|
() => liquidationType.value,
|
||||||
|
() => {
|
||||||
|
try {
|
||||||
|
uni.setNavigationBarTitle({ title: pageTitle.value });
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
onShow(async () => {
|
||||||
refreshWallet();
|
refreshWallet();
|
||||||
const userStore = sheep.$store('user');
|
const userStore = sheep.$store('user');
|
||||||
|
try {
|
||||||
|
await userStore.getInfo();
|
||||||
|
} catch (e) {}
|
||||||
const mobile = userStore?.userInfo?.mobile;
|
const mobile = userStore?.userInfo?.mobile;
|
||||||
if (!smsMobile.value && mobile) smsMobile.value = mobile;
|
if (mobile && !smsMobile.value) smsMobile.value = mobile;
|
||||||
|
if (isHuaxiaType.value) {
|
||||||
|
const curMobile = String(smsMobile.value || '').trim();
|
||||||
|
if (isMobileValid(curMobile)) {
|
||||||
|
await checkHuaxiaMobile(curMobile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
stopCountdown();
|
||||||
|
if (huaxiaCheckTimer) {
|
||||||
|
clearTimeout(huaxiaCheckTimer);
|
||||||
|
huaxiaCheckTimer = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -401,6 +540,18 @@
|
|||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.huaxia-mobile-tip {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
padding-left: 4rpx;
|
||||||
|
color: #ff4d4f;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
|
||||||
|
&.huaxia-mobile-tip--verified {
|
||||||
|
color: #12b46b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tip-card {
|
.tip-card {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
padding: 28rpx;
|
padding: 28rpx;
|
||||||
|
|||||||
+94
-23
@@ -10,9 +10,15 @@
|
|||||||
<view class="more-trigger" @click.stop="toggleLiquidationMenu">
|
<view class="more-trigger" @click.stop="toggleLiquidationMenu">
|
||||||
<uni-icons type="more-filled" color="#fff" size="34rpx" />
|
<uni-icons type="more-filled" color="#fff" size="34rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view v-if="showLiquidationMenu" class="more-menu">
|
<view v-if="showLiquidationMenu && enabledLiquidations.length" class="more-menu">
|
||||||
<view class="more-menu-item" @click.stop="goLiquidation">去变现</view>
|
<view
|
||||||
<view class="more-menu-item" @click.stop="goWushuangLiquidation">无双变现</view>
|
v-for="item in enabledLiquidations"
|
||||||
|
:key="item.type"
|
||||||
|
class="more-menu-item"
|
||||||
|
@click.stop="goLiquidationByType(item)"
|
||||||
|
>
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
|
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
|
||||||
@@ -43,15 +49,70 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import * as api from '@/sheep/api/home/pay';
|
import * as api from '@/sheep/api/home/pay';
|
||||||
import * as apiIndex from '@/sheep/api/index/index';
|
import * as apiIndex from '@/sheep/api/index/index';
|
||||||
|
import * as incrementApi from '@/sheep/api/increment';
|
||||||
import goods from '@/components/goods/goods.vue';
|
import goods from '@/components/goods/goods.vue';
|
||||||
|
|
||||||
const money_obj = ref();
|
const money_obj = ref();
|
||||||
const tagList = ref([]);
|
const tagList = ref([]);
|
||||||
const showLiquidationMenu = ref(false);
|
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() {
|
function getData() {
|
||||||
@@ -72,19 +133,18 @@
|
|||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
getData();
|
getData();
|
||||||
});
|
});
|
||||||
|
onMounted(() => {
|
||||||
|
fetchTradeChannels();
|
||||||
|
});
|
||||||
//充值提现弹框提示去跳转
|
//充值提现弹框提示去跳转
|
||||||
function jumpPage(typeTxt, url) {
|
function jumpPage(typeTxt, url) {
|
||||||
showLiquidationMenu.value = false;
|
showLiquidationMenu.value = false;
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
// title: '',
|
|
||||||
content: '是否去' + typeTxt,
|
content: '是否去' + typeTxt,
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
//用户点击确定
|
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({ url: url });
|
||||||
url: url,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -92,14 +152,26 @@
|
|||||||
function toggleLiquidationMenu() {
|
function toggleLiquidationMenu() {
|
||||||
showLiquidationMenu.value = !showLiquidationMenu.value;
|
showLiquidationMenu.value = !showLiquidationMenu.value;
|
||||||
}
|
}
|
||||||
function goLiquidation() {
|
function goLiquidationByType(item) {
|
||||||
showLiquidationMenu.value = false;
|
|
||||||
jumpPage('变现', '/pages/home/liquidation?type=1&title=去变现');
|
|
||||||
}
|
|
||||||
function goWushuangLiquidation() {
|
|
||||||
showLiquidationMenu.value = false;
|
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({
|
uni.navigateTo({
|
||||||
url: '/pages/home/liquidation?type=2&title=无双变现',
|
url: `/pages/home/liquidation?type=${type}${channelId}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -107,11 +179,10 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.header {
|
.header {
|
||||||
height: 318rpx;
|
height: 318rpx;
|
||||||
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
|
|
||||||
margin: 32rpx;
|
margin: 32rpx;
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
overflow: hidden;
|
position: relative;
|
||||||
|
|
||||||
.header-content {
|
.header-content {
|
||||||
padding: 80rpx 32rpx 24rpx;
|
padding: 80rpx 32rpx 24rpx;
|
||||||
@@ -144,18 +215,18 @@
|
|||||||
|
|
||||||
.more-menu {
|
.more-menu {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 62rpx;
|
top: 58rpx;
|
||||||
right: 0;
|
right: 0;
|
||||||
min-width: 176rpx;
|
min-width: 200rpx;
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
background: rgba(26, 45, 88, 0.96);
|
background: rgba(26, 45, 88, 0.98);
|
||||||
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.18);
|
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.28);
|
||||||
z-index: 10;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-menu-item {
|
.more-menu-item {
|
||||||
height: 68rpx;
|
height: 64rpx;
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
border-radius: 14rpx;
|
border-radius: 14rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
|||||||
+228
-50
@@ -110,7 +110,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="showThirdPartyServiceCard" class="card card5 third-party-card bg24">
|
<view
|
||||||
|
v-if="showThirdPartyServiceCard"
|
||||||
|
class="card card5 third-party-card bg24"
|
||||||
|
>
|
||||||
<view class="card_title">第三方服务</view>
|
<view class="card_title">第三方服务</view>
|
||||||
|
|
||||||
<view class="flex-center card5_con wrap ju-flex-start">
|
<view class="flex-center card5_con wrap ju-flex-start">
|
||||||
@@ -118,10 +121,10 @@
|
|||||||
class="flex-center flex-column card5_item"
|
class="flex-center flex-column card5_item"
|
||||||
v-for="(v, i) in thirdPartyServiceList"
|
v-for="(v, i) in thirdPartyServiceList"
|
||||||
:key="i"
|
:key="i"
|
||||||
@click="openThirdPartyService(v)"
|
@click="onThirdPartyServiceClick(v)"
|
||||||
>
|
>
|
||||||
<view class="card5_icon third-party-icon m-b-18 w_84 h_84">
|
<view class="card5_icon third-party-icon m-b-18 w_84 h_84">
|
||||||
<image :src="v.icon" mode="scaleToFill" />
|
<image :src="getThirdPartyIcon(v.icon)" mode="scaleToFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="card5_name size28 color_3">{{ v.name }}</view>
|
<view class="card5_name size28 color_3">{{ v.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -134,9 +137,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import cardTabber from '@/components/card_tabber/card_tabber.vue';
|
import cardTabber from '@/components/card_tabber/card_tabber.vue';
|
||||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick, computed } from 'vue';
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
getCurrentInstance,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
computed,
|
||||||
|
} from 'vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import { getWallet } from '@/sheep/api/home/pay';
|
import { getWallet } from '@/sheep/api/home/pay';
|
||||||
|
import * as incrementApi from '@/sheep/api/increment';
|
||||||
import UserApi from '@/sheep/api/member/user';
|
import UserApi from '@/sheep/api/member/user';
|
||||||
|
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
@@ -176,20 +189,6 @@
|
|||||||
url: '/pages/home/pointsDetail?type=1',
|
url: '/pages/home/pointsDetail?type=1',
|
||||||
color: '#0ED72C',
|
color: '#0ED72C',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// id: 2,
|
|
||||||
// name: '佣金',
|
|
||||||
// value: 'commission_num',
|
|
||||||
// unit: '元',
|
|
||||||
// url: '/pages/home/pointsDetail?type=2',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 3,
|
|
||||||
// name: '代理收益',
|
|
||||||
// value: 'agency_income',
|
|
||||||
// unit: '元',
|
|
||||||
// url: '/pages/home/pointsDetail?type=3',
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
name: '消费金',
|
name: '消费金',
|
||||||
@@ -272,40 +271,157 @@
|
|||||||
url: '/pages/public/setting',
|
url: '/pages/public/setting',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const showThirdPartyServiceCard = true;
|
|
||||||
let thirdPartyServiceList = ref([
|
|
||||||
{
|
|
||||||
name: '无双',
|
|
||||||
icon: '/static/icon/web/wushuang.png',
|
|
||||||
title: '无双',
|
|
||||||
url: 'https://shop.wushuange.com/web/#/pages/store/index?store_id=5',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const goReal = () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/public/realname?status=' + realStatus.value,
|
|
||||||
// query: obj,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const go = (path, obj) => {
|
|
||||||
if (!path) {
|
|
||||||
// 打电话
|
|
||||||
|
|
||||||
// uni.makePhoneCall({
|
const LIQUIDATION_TYPE_META = {
|
||||||
// phoneNumber: '4000621698',
|
2: {
|
||||||
// });
|
name: '无双',
|
||||||
uni.showToast({
|
title: '无双',
|
||||||
title: '功能开发中, 敬请期待',
|
icon: '/static/icon/web/wushuang.png',
|
||||||
icon: 'none',
|
keywords: ['无双'],
|
||||||
});
|
},
|
||||||
return;
|
3: {
|
||||||
} else {
|
name: '华夏',
|
||||||
uni.navigateTo({
|
title: '华夏',
|
||||||
url: path,
|
inlineIcon: true,
|
||||||
query: obj,
|
keywords: ['华夏'],
|
||||||
});
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const matchChannelMeta = (channel) => {
|
||||||
|
const lt = Number(channel?.liquidationType);
|
||||||
|
if ([2, 3].includes(lt) && LIQUIDATION_TYPE_META[lt]) {
|
||||||
|
return { liquidationType: 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 { liquidationType: Number(key), meta: m };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const WUSHUANG_DEFAULT_STORE_ID = 5;
|
||||||
|
const resolveWushuangStoreId = () => WUSHUANG_DEFAULT_STORE_ID;
|
||||||
|
const buildWushuangStoreUrl = (fallbackBaseUrl) => {
|
||||||
|
const id = resolveWushuangStoreId();
|
||||||
|
if (!id) return '';
|
||||||
|
let base = String(fallbackBaseUrl || '').trim().replace(/`/g, '').trim();
|
||||||
|
const tail = `/web/#/pages/store/index?store_id=${id}`;
|
||||||
|
if (/^https?:\/\//i.test(base)) {
|
||||||
|
const cleanBase = base.replace(/\/+$/, '');
|
||||||
|
return cleanBase + tail;
|
||||||
|
}
|
||||||
|
return `https://shop.wushuange.com${tail}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildHuaxiaInlineIcon = () => {
|
||||||
|
const svg =
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 84 84">' +
|
||||||
|
'<circle cx="42" cy="42" r="42" fill="#18b37b"/>' +
|
||||||
|
'<text x="42" y="42" font-family="PingFang SC,Helvetica Neue,Microsoft YaHei,Arial,sans-serif" font-weight="700" font-size="30" fill="#ffffff" text-anchor="middle" dominant-baseline="middle">华夏</text>' +
|
||||||
|
'</svg>';
|
||||||
|
return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg);
|
||||||
|
};
|
||||||
|
|
||||||
|
const tradeChannelList = ref([]);
|
||||||
|
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) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalizeChannelUrl = (raw, liquidationType) => {
|
||||||
|
let base = String(raw || '').trim().replace(/`/g, '').trim();
|
||||||
|
if (!base) return '';
|
||||||
|
if (Number(liquidationType) === 2) {
|
||||||
|
return buildWushuangStoreUrl(base);
|
||||||
|
}
|
||||||
|
return base;
|
||||||
|
};
|
||||||
|
|
||||||
|
const showThirdPartyServiceCard = computed(
|
||||||
|
() => thirdPartyServiceList.value.length > 0,
|
||||||
|
);
|
||||||
|
const thirdPartyServiceList = computed(() => {
|
||||||
|
const list = [];
|
||||||
|
const added = new Set();
|
||||||
|
const channels = Array.isArray(tradeChannelList.value) ? tradeChannelList.value : [];
|
||||||
|
channels.forEach((it) => {
|
||||||
|
if (Number(it?.status) !== 1) return;
|
||||||
|
const matched = matchChannelMeta(it);
|
||||||
|
if (!matched) return;
|
||||||
|
const lt = matched.liquidationType;
|
||||||
|
const meta = matched.meta;
|
||||||
|
if (added.has(lt)) return;
|
||||||
|
let url = '';
|
||||||
|
if (lt !== 3) {
|
||||||
|
url = normalizeChannelUrl(it?.baseUrl || it?.url, lt);
|
||||||
|
if (!url) return;
|
||||||
|
}
|
||||||
|
added.add(lt);
|
||||||
|
const item = {
|
||||||
|
name: meta.name,
|
||||||
|
title: meta.title,
|
||||||
|
url,
|
||||||
|
liquidationType: lt,
|
||||||
|
channelId: it?.id ?? it?.channelId,
|
||||||
|
channelBaseUrl: String(it?.baseUrl || it?.url || '').trim(),
|
||||||
|
};
|
||||||
|
if (meta.inlineIcon) {
|
||||||
|
item.icon = buildHuaxiaInlineIcon();
|
||||||
|
} else if (meta.icon) {
|
||||||
|
item.icon = meta.icon;
|
||||||
|
}
|
||||||
|
list.push(item);
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
|
||||||
|
const getThirdPartyIcon = (icon) => {
|
||||||
|
const iconText = String(icon || '');
|
||||||
|
if (iconText.startsWith('data:') || iconText.startsWith('/')) {
|
||||||
|
return iconText;
|
||||||
|
}
|
||||||
|
return iconText;
|
||||||
|
};
|
||||||
|
|
||||||
|
const showModalAsync = (options) =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
uni.showModal({
|
||||||
|
...(options || {}),
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: () => resolve({ confirm: false, cancel: true }),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const pendingThirdPartyItem = ref(null);
|
||||||
|
const ensureRealNameOrRedirect = async (item) => {
|
||||||
|
if (Number(realStatus.value || dataInfo.value?.realStatus) === 1) return true;
|
||||||
|
pendingThirdPartyItem.value = item || null;
|
||||||
|
const res = await showModalAsync({
|
||||||
|
title: '实名认证提示',
|
||||||
|
content: '使用华夏服务需先完成实名认证,是否前往认证?',
|
||||||
|
confirmText: '去认证',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmColor: '#2c8cfa',
|
||||||
|
});
|
||||||
|
if (!res?.confirm) {
|
||||||
|
pendingThirdPartyItem.value = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/public/realname?status=0',
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
const openThirdPartyService = (item) => {
|
const openThirdPartyService = (item) => {
|
||||||
if (!item?.url) return;
|
if (!item?.url) return;
|
||||||
const title = encodeURIComponent(item.title || item.name || '第三方服务');
|
const title = encodeURIComponent(item.title || item.name || '第三方服务');
|
||||||
@@ -328,6 +444,60 @@
|
|||||||
}
|
}
|
||||||
openWebview();
|
openWebview();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onThirdPartyServiceClick = async (item) => {
|
||||||
|
if (!item) return;
|
||||||
|
const isHuaxia =
|
||||||
|
Number(item?.liquidationType) === 3 || String(item?.name || '') === '华夏';
|
||||||
|
if (isHuaxia) {
|
||||||
|
const ok = await ensureRealNameOrRedirect(item);
|
||||||
|
if (!ok) return;
|
||||||
|
const query = {};
|
||||||
|
if (item?.channelId != null && item?.channelId !== '') {
|
||||||
|
query.channelId = Number(item.channelId);
|
||||||
|
}
|
||||||
|
const regRes = await incrementApi
|
||||||
|
.checkHuaxiaRegister(query)
|
||||||
|
.catch(() => ({ code: -1 }));
|
||||||
|
if (regRes?.code !== 0) {
|
||||||
|
if (regRes?.msg) {
|
||||||
|
uni.showToast({ title: regRes.msg, icon: 'none' });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = regRes?.data || {};
|
||||||
|
const url = typeof data === 'string'
|
||||||
|
? String(data).trim()
|
||||||
|
: String(data?.url || data?.redirectUrl || '').trim();
|
||||||
|
if (!url) {
|
||||||
|
uni.showToast({ title: '跳转链接为空', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openThirdPartyService({ ...item, url });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openThirdPartyService(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
const goReal = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/public/realname?status=' + realStatus.value,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const go = (path, obj) => {
|
||||||
|
if (!path) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '功能开发中, 敬请期待',
|
||||||
|
icon: 'none',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: path,
|
||||||
|
query: obj,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
const updateAvatar = async (avatar) => {
|
const updateAvatar = async (avatar) => {
|
||||||
if (!avatar) return;
|
if (!avatar) return;
|
||||||
const res = await UserApi.updateUser({
|
const res = await UserApi.updateUser({
|
||||||
@@ -404,9 +574,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
fetchTradeChannels();
|
||||||
|
});
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
getData();
|
getData();
|
||||||
getNumData();
|
getNumData();
|
||||||
|
if (pendingThirdPartyItem.value && Number(realStatus.value || 0) === 1) {
|
||||||
|
const next = pendingThirdPartyItem.value;
|
||||||
|
pendingThirdPartyItem.value = null;
|
||||||
|
nextTick(() => onThirdPartyServiceClick(next));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -149,3 +149,26 @@ export const walletLiquidationRecordPage = (params: any) => {
|
|||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function checkHuaxiaMobile(params: any) {
|
||||||
|
return request({
|
||||||
|
url: '/trade/wallet-liquidation-record/check-huaxia-mobile',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkHuaxiaRegister(params?: any) {
|
||||||
|
return request({
|
||||||
|
url: '/trade/wallet-liquidation-record/check-huaxia-register',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTradeChannelList = () => {
|
||||||
|
return request({
|
||||||
|
url: '/trade/channel/get',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user