源文件

This commit is contained in:
gyq
2024-05-23 14:39:33 +08:00
commit a1128dd791
2997 changed files with 500069 additions and 0 deletions

View File

@@ -0,0 +1,222 @@
<template>
<JPopup ref="popup" dir="center" type="center">
<JMainCard v-if="take.amount">
<view class="take-header"
><image src="/static/iconImg/icon-close-X.svg" mode="scaleToFill" @tap="popup.close()" /> 请输入支付密码
</view>
<view class="take-num">
提现
<view>{{ take.amount }}</view>
</view>
<block v-for="(v, i) in takeInfo" :key="i">
<view class="take-info">
{{ v.text }}
<view class="take-value">{{ v.value }}</view>
</view>
</block>
<verificationCodeStyle
@getInputVerification="getInputVerification"
:latticeNum="6"
ciphertextSty="1"
ref="verCode"
></verificationCodeStyle>
</JMainCard>
</JPopup>
</template>
<script setup>
import { ref, reactive, onMounted, getCurrentInstance } from "vue"
import { Base64 } from "js-base64"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { $getAmountFee, $getAcountInfo, $putApplition, $statistics, $isSipw } from "@/http/apiManager.js"
import { horn } from "@/hooks/handleMoney"
import JPopup from "@/components/newComponents/JPopup/JPopup"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
import JButton from "@/components/newComponents/JButton/JButton"
import verificationCodeStyle from "@/components/verification-code-style2/verification-code-style2"
const take = ref({})
const popup = ref()
const { ctx } = getCurrentInstance()
const takeInfo = reactive([
{
text: "提现手续费",
value: "",
},
{
text: "预计到账",
value: "",
},
{
text: "提现账户类型",
value: "",
},
{
text: "提现账户",
value: "",
},
])
const settAccountType = reactive({
BANK_PRIVATE: "对私账户",
BANK_PUBLIC: "对公账户",
WX_CASH: "个人微信",
ALIPAY_CASH: "个人支付宝",
})
const getInputVerification = (val) => {
if (val.length >= 6) {
take.value.sipw = Base64.encode(val)
launchTake()
}
}
const open = (val) => {
take.value = val
takeInfo[2].value = settAccountType[val.settAccountType]
takeInfo[3].value = account(val.settAccountNo)
calculationFee()
popup.value.open()
}
const account = (val) => {
if (!val) return
return val.slice(0, 3) + "****" + val.slice(-4)
}
// 计算手续费
function calculationFee() {
$getAmountFee()
.then(({ bizData }) => {
if (bizData.freeLimit !== 0) {
//如果在额度限度里手续费为0
if (take.value.amount <= bizData.freeLimit / 100) {
takeInfo[0].value = "¥" + 0
} else {
console.log(3)
//如果超过限制额度
if (bizData.feeType === "FIX") {
//若是固定额度
takeInfo[0].value = "¥" + bizData.fixFee / 100
} else if (bizData.feeType === "SINGLE") {
//若是费率
takeInfo[0].value = "¥" + (bizData.feeRate * take.value.amount).toFixed(2)
} else if (bizData.feeType === "FIXANDRATE") {
//若是固定+费率
takeInfo[0].value = "¥" + ((bizData.fixFee / 100) + (bizData.feeRate * take.value.amount)).toFixed(2)
}
}
} else {
//如果额度为0则计算费率
if (bizData.feeType === "FIX") {
takeInfo[0].value = "¥" + bizData.fixFee / 100
} else if (bizData.feeType === "SINGLE") {
//若是费率
takeInfo[0].value = "¥" + (bizData.feeRate * take.value.amount).toFixed(2)
} else if (bizData.feeType === "FIXANDRATE") {
//若是固定+费率
takeInfo[0].value = "¥" + ((bizData.fixFee / 100) + (bizData.feeRate * take.value.amount)).toFixed(2)
}
}
takeInfo[1].value = (take.value.amount - takeInfo[0].value.split("¥")[1]).toFixed(2)
if (takeInfo[1].value <= 0) {
uni.showToast({
title: "提现金额不足",
icon: "none",
})
}
takeInfo[1].value = "¥" + takeInfo[1].value
})
.catch((err) => {
console.log(err)
})
}
// 发起提现
const launchTake = () => {
uni.showLoading({
title: "提交中",
mask: true,
})
const data = {
amount: take.value.amount,
applyRemark: take.value.applyRemark,
settAccountType: take.value.settAccountType,
settAccountNo: take.value.settAccountNo,
settAccountName: take.value.contactName,
settAccountBank: take.value.settAccountBank,
settAccountTelphone: take.value.contactTel,
sipw: take.value.sipw,
settCertImg: take.value.settCertImg,
applyRemark: take.value.applyRemark,
contactName: take.value.contactName,
contactTel: take.value.contactTel,
}
$putApplition(data)
.then((res) => {
if (!take.value.rid) {
uni.navigateBack({
success: () => {
uni.showToast({
title: "提交成功",
icon: "success",
})
},
})
} else {
uni.navigateBack({
delta: 2,
success: () => {
uni.showToast({
title: "提交成功",
icon: "success",
})
},
})
}
uni.hideLoading()
popup.value.close()
})
.catch(() => {
ctx.$refs.verCode.cleanVal()
take.value.sipw = ""
})
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
.take-header {
position: relative;
text-align: center;
font-size: 30rpx;
font-weight: 700;
image {
position: absolute;
top: 8rpx;
left: 0;
width: 26rpx;
height: 26rpx;
}
}
.take-num {
text-align: center;
margin-top: 40rpx;
font-size: 33rpx;
color: #666;
view {
margin-top: 15rpx;
padding-bottom: 35rpx;
font-size: 57rpx;
font-weight: 700;
color: #000;
border-bottom: 1rpx solid #e6e6e6;
}
}
.take-info {
display: flex;
justify-content: space-between;
font-size: 28rpx;
color: #a6a6a6;
margin: 20rpx 0;
.take-value {
color: #000000;
}
}
</style>

View File

@@ -0,0 +1,56 @@
<template>
<JPopup ref="popup" type="center" dir="center">
<JMainCard>
<view class="s-tips bdR10"> 暂未设置支付密码请前往设置支付密码 </view>
<view class="s-button">
<view class="bdR10 cancel" @tap="popup.close()">取消</view>
<view class="bdR10 to-pwd" @tap="toPwd">前往设置</view>
</view>
</JMainCard>
</JPopup>
</template>
<script setup>
import { ref } from "vue"
import JPopup from "@/components/newComponents/JPopup/JPopup"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
const popup = ref(null)
const toPwd = () => {
popup.value.close()
uni.navigateTo({
url: "/pageWork/setUp/takeMoneyPwd",
})
}
const open = () => {
popup.value.open()
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
.s-tips {
padding: 35rpx;
background-color: #f2f2f2;
font-size: 30rpx;
color: #666;
}
.s-button {
display: flex;
justify-content: space-between;
text-align: center;
margin-top: 30rpx;
view {
flex: 1;
padding: 20rpx 0;
}
.to-pwd {
margin-left: 20rpx;
background-color: $primaryColor;
color: #fff;
}
.cancel {
color: #666;
background-color: #f2f2f2;
}
}
</style>

View File

@@ -0,0 +1,74 @@
<template>
<JPopup ref="popup">
<JMainCard pd="0" wrapPd="30rpx">
<JInput
name="联系人姓名"
:rules="{ name: 'name', rule: 'REG_NotNUll' }"
v-model:value="userInfo.name"
place="请输入联系人姓名"
:isBorder="true"
@focusShow="flag = true"
@focusNone="flag = false"
></JInput>
<JInput
name="联系人电话"
:rules="{ name: 'phone', rule: 'REG_NotNUll' }"
type="number"
v-model:value="userInfo.phone"
place="请输入联系人电话"
@focusShow="flagT = true"
@focusNone="flagT = false"
></JInput>
<view class="confirm bgF2" @tap="toUSer">确认</view>
</JMainCard>
<JButton pd="0 30rpx 30rpx 30rpx" bgColor="#f2f2f2" color="#000" bottom="0" pdTop="0" @HandleTouch="popup.close()"
>取消</JButton
>
<view class="height-block" v-if="flagT || flag"></view>
</JPopup>
</template>
<script setup>
import { reactive, ref } from "vue"
import JPopup from "@/components/newComponents/JPopup/JPopup"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
import JInput from "@/components//newComponents/JInput/JInput"
import JButton from "@/components//newComponents/JButton/JButton"
import { validateArray } from "@/hooks/rules"
const emits = defineEmits(["userContact"])
const popup = ref()
const userInfo = reactive({})
const open = (val) => {
if (val) {
userInfo.name = val.contactName
userInfo.phone = val.contactTel
}
popup.value.open()
}
const flag = ref(false)
const flagT = ref(false)
const toUSer = () => {
if (validateArray(userInfo)) {
emits("userContact", userInfo)
uni.setStorageSync("contactInfo", userInfo)
popup.value.close()
}
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
.confirm {
display: flex;
justify-content: center;
align-items: center;
height: 110rpx;
text-align: center;
color: $primaryColor;
font-size: 33rpx;
}
.height-block {
height: 25vh;
}
</style>

View File

@@ -0,0 +1,227 @@
<template>
<JHeaderTitle title="发起提现" bgColor="#f2f2f2"></JHeaderTitle>
<view class="user-contact bgF2 afterBdR32">
提现联系人
<view class="user-name">
<view
@tap="contact.open({ contactName: tackInfo.contactName, contactTel: tackInfo.contactTel })"
:class="{ 'user-weight': tackInfo.contactName }"
>{{ tackInfo.contactName ? tackInfo.contactName : "暂未设置联系人" }}
<image src="/static/iconImg/right-arrow.svg" mode="scaleToFill"
/></view>
<image v-if="!tackInfo.contactTel" src="/static/iconImg/user-contact.svg" mode="scaleToFill" />
<template v-else>{{ tackInfo.contactTel }}</template>
</view>
</view>
<view class="money-main">
<view class="money-title">提现金额</view>
<view class="money-input">
<input type="digit" v-model="tackInfo.amount" :maxlength="maxlength" @input="check" />
()
</view>
<view class="money-balance">可提现{{ tackInfo.allowTakeAmount }}<text @tap="allIn">全部提现</text></view>
<view class="money-upload">
<JUpLoad name="申请资料(请上传发票等凭证图片)" pd="0" pdLeft="0" fontSize="28rpx" v-model:value="settCertImg" borderNone>222</JUpLoad>
</view>
<view class="money-remarks">
<JInput
name="备注"
pd="40rpx 0"
place="请输入备注"
:maxlength="17"
size="28rpx"
v-model:value="tackInfo.applyRemark"
:isBorder="true"
></JInput>
</view>
</view>
<JButton pd="30rpx 60rpx 50rpx 60rpx " pdTop="40rpx" @HandleTouch="createTack">发起提现</JButton>
<USerContact ref="contact" @userContact="userContact"></USerContact>
<ConfirmTake ref="tack"></ConfirmTake>
<SipwTips ref="sipw" />
</template>
<script setup>
import { reactive, ref, watchEffect } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import {
$getAmountFee,
$getAcountInfo,
$putApplition,
$statistics,
$getCashoutDetail,
$isSipw,
} from "@/http/apiManager.js"
import { horn } from "@/hooks/handleMoney"
import valid from "@/hooks/validate"
import JHeaderTitle from "@/components//newComponents/JHeaderTitle/JHeaderTitle"
import JInput from "@/components//newComponents/JInput/JInput"
import JUpLoad from "@/components//newComponents/JUpLoad/JUpLoad"
import JButton from "@/components//newComponents/JButton/JButton"
import USerContact from "./components/UserContact.vue"
import ConfirmTake from "./components/ConfirmTake"
import SipwTips from "./components/SipwTips.vue"
onLoad((options) => {
if (options.rid) {
rid = options.rid
getWithInfo(options.rid)
} else {
getTack()
}
})
const settCertImg = ref()
const contact = ref(null)
const tack = ref(null)
const sipw = ref(null)
const tackInfo = ref({
amount: "",
})
const maxlength = ref(10)
let rid = undefined
const getTack = () => {
$statistics().then(({ bizData }) => {
tackInfo.value.allowTakeAmount = horn(bizData.allowTakeAmount)
})
if (rid) return false
$getAcountInfo().then(({ bizData }) => {
tackInfo.value = bizData
const contactInfo = uni.getStorageSync("contactInfo")
if (contactInfo.name) {
tackInfo.value.contactName = contactInfo.name
tackInfo.value.contactTel = contactInfo.phone
}
})
}
// 展业宝提现记录页进入的位置↓↓↓
const getWithInfo = (rid) => {
$getCashoutDetail(rid).then(({ bizData }) => {
tackInfo.value = bizData
tackInfo.value.contactName = bizData.settAccountName
tackInfo.value.contactTel = bizData.settAccountTelphone
tackInfo.value.amount = (bizData.applyAmount / 100).toFixed(2)
tackInfo.value.allowTakeAmount = horn(bizData.allowTakeAmount)
tackInfo.value.rid = rid
})
}
const userContact = (val) => {
tackInfo.value.contactName = val.name
tackInfo.value.contactTel = val.phone
}
const allIn = () => {
tackInfo.value.amount = tackInfo.value.allowTakeAmount
}
const createTack = () => {
tackInfo.value.settCertImg = settCertImg.value
if (!valid.takeMoney(tackInfo.value.amount)) return errorMsg("请检查输入提现金额数据")
if (Number(tackInfo.value.amount) > Number(tackInfo.value.allowTakeAmount))
return errorMsg("提现金额不得大于可提现金额")
if (!tackInfo.value.contactName || !tackInfo.value.contactTel) return errorMsg("请输入联系人姓名和手机号")
if (tackInfo.value.contactTel.length != 11) return errorMsg("请检查联系人手机号格式")
if (tackInfo.value.amount <= 0 || !tackInfo.value.amount) return errorMsg("请输入提现金额并且提现金额不能为0")
isPwd()
}
// 判断是否设置支付密码
const isPwd = () => {
$isSipw().then(({ bizData }) => {
if (bizData) {
tack.value.open(tackInfo.value)
} else {
sipw.value.open()
}
})
}
const check = (e) => {
let value = e.detail.value
let dot = value.indexOf(".") //包含小数点
let reg = /^[0-9]+$/ //正整数
if (dot > -1) {
maxlength.value = dot + 3 //长度是小数点后两位
if (value.length > dot + 3) {
}
}
if (reg.test(value)) {
//如果是正整数不包含小数点
maxlength.value = 10
}
}
const errorMsg = (title) => {
uni.showToast({
title,
icon: "none",
mask: true,
})
}
</script>
<style lang="scss" scoped>
.user-contact {
position: relative;
display: flex;
align-items: flex-start;
font-size: 28rpx;
color: rgba(77, 77, 77, 1);
padding: 60rpx 60rpx 107rpx 60rpx;
.user-name {
flex: 1;
margin-left: 48rpx;
color: rgba(145, 145, 145, 1);
image {
width: 40rpx;
height: 40rpx;
}
view {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 11rpx;
}
.user-weight {
font-weight: 700;
color: #000;
}
}
}
.money-main {
padding: 0 60rpx;
.money-title {
font-size: 28rpx;
color: #4d4d4d;
}
.money-input {
display: flex;
align-items: center;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
input {
flex: 1;
height: 100rpx;
font-size: 57rpx;
font-weight: 700;
color: $primaryColor;
}
}
.money-balance {
margin-top: 20rpx;
font-size: 28rpx;
text {
margin-left: 15rpx;
color: $primaryColor;
}
}
.money-upload {
padding: 90rpx 0 30rpx 0;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
}
.money-remarks {
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
}
}
</style>