源文件

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,139 @@
<template>
<view class="global-wrapper bgF2">
<view class="mch-header">
<JHeaderTitle title="创建代理商" bgColor="#f2f2f2" />
</view>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput
name="代理商全称"
:isBorder="true"
v-model:value="agentInfo.agentName"
:rules="{ name: 'agentName', rule: 'REG_NotNUll' }"
place="请输入商代理商全称"
></JInput>
<JInput
name="代理商简称"
v-model:value="agentInfo.agentShortName"
:rules="{ name: 'agentShortName', rule: 'REG_NotNUll' }"
place="请输入代理商简称"
></JInput>
<JInput
name="代理商登录名"
v-model:value="agentInfo.loginUsername"
:rules="{ name: 'loginUsername', rule: 'REG_LoginName' }"
place="字母开头6到18位"
></JInput>
<JInput name="是否允许发展下级">
<switch
:checked="agentInfo.addAgentFlag == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#7737fe"
@change="switchState($event, 'addAgentFlag')"
/>
</JInput>
<JInput name="代理商状态">
<switch
:checked="agentInfo.state == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#7737fe"
@change="switchState($event, 'state')"
/>
</JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput
name="联系人姓名"
:isBorder="true"
v-model:value="agentInfo.contactName"
:rules="{ name: 'contactName', rule: 'REG_NotNUll' }"
place="请输入联系人姓名"
></JInput>
<JInput
name="联系人手机号"
v-model:value="agentInfo.contactTel"
:rules="{ name: 'contactTel', rule: 'REG_Phone' }"
place="请输入联系人手机号"
></JInput>
<JInput name="联系人邮箱" v-model:value="agentInfo.contactEmail" place="请输入联系人邮箱"></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput name="是否发送开通提醒" :isBorder="true">
<switch
:checked="agentInfo.isNotify == 1 ? true : false"
style="margin-left: 15rpx; transform: scale(1.2)"
color="#7737FE"
@change="switchState($event, 'isNotify')"
/>
</JInput>
<JInput name="是否使用默认密码">
<switch
:checked="agentInfo.defaultPass == 1 ? true : false"
style="margin-left: 15rpx; transform: scale(1.2)"
color="#7737FE"
@change="switchState($event, 'defaultPass')"
/>
</JInput>
<JInput
name="自定义密码"
v-model:value="agentInfo.loginPassword"
:rules="{ name: 'loginPassword', rule: 'REG_NotNUll' }"
place="请输入自定义密码"
v-if="!agentInfo.defaultPass == 1"
></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput name="备注" v-model:value="agentInfo.remark" place="请输入备注"></JInput>
</JMainCard>
<JButton size="max" pd="30rpx" pdTop="0" @HandleTouch="createAgent">创建代理商</JButton>
</view>
</template>
<script setup>
import { ref, reactive } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { $addAgent, $getPasswordRules } from "@/http/apiManager.js"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle"
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"
import valid from "@/hooks/validate"
onLoad(() => {
getRules()
})
const agentInfo = reactive({
defaultPass: 1,
isNotify: 0,
state: 1,
addAgentFlag: 1,
})
const switchState = (e, v) => {
agentInfo[v] = e.detail.value ? 1 : 0
}
const rules = ref({})
const getRules = () => {
$getPasswordRules().then((res) => {
rules.value.rule = new RegExp(res.bizData.regexpRules)
rules.value.ruleText = res.bizData.errTips
})
}
const createAgent = () => {
if (validateArray(agentInfo)) {
if (!!agentInfo.contactEmail) {
if (!valid.REG_Email(agentInfo.contactEmail)) return uni.showToast({ title: "邮箱格式不正确", icon: "none" })
}
if (agentInfo.loginPassword && !rules.value.rule.test(agentInfo.loginPassword)) {
return uni.showToast({
title: rules.value.ruleText,
icon: "none",
})
}
$addAgent(agentInfo).then((res) => {
uni.showToast({
icon: "success",
title: "创建成功",
})
uni.navigateBack()
})
}
}
</script>

View File

@@ -0,0 +1,325 @@
<template>
<view class="page-wrapper global-wrapper" :class="{ 'page-show': agentInfo.state }">
<JHeaderTitle title="代理商详情" :bgColor="headerBgColor" color="#fff" imgUrl="/static/iconImg/left-white.svg" />
<image src="/static/iconImg/agent-bg-img .svg" class="bg-image" mode="scaleToFill" />
<view class="expand-header">
<image src="/static/iconImg/icon-agent-img.svg" mode="scaleToFill" />
<view class="expand-title">{{ agentInfo.agentName }}</view>
<view class="expand-phone">{{ agentInfo.agentNo }}</view>
<view class="expand-edit bgF bdR10" @tap="editAgent">
<image src="/static/iconImg/expand-edit.svg" mode="scaleToFill" />
编辑信息
</view>
</view>
<JMainCard pd="0" bgColor="rgba(0,0,0,0.1)">
<JInput name="代理商全称" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.agentName }}</text></JInput
>
<JInput name="代理商简称" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.agentShortName }}</text></JInput
>
<JInput name="代理商号" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.agentNo }}</text></JInput
>
<JInput name="联系人姓名" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.contactName }}</text></JInput
>
<JInput name="联系人手机号" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.contactTel }}</text></JInput
>
<JInput name="联系人邮箱" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.contactEmail }}</text></JInput
>
<JInput name="创建时间" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ agentInfo.createdAt?.split("-").join("/") }}</text></JInput
>
<JInput name="代理商状态" pd="0 40rpx 30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<view v-if="agentInfo.state == 1 || agentInfo.state == 0" class="dis-wrapper">
<text v-if="agentInfo.state == 1">启用</text>
<text v-else>禁用</text>
<switch
:checked="agentInfo.state == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#BF80FF"
@change="change"
/>
</view>
<view class="agent-tips" v-else
>{{ tipsList[agentInfo.state]?.text }}
<text class="tips-color" :style="{ backgroundColor: tipsList[agentInfo.state]?.bgColor }"></text>
</view>
</JInput>
</JMainCard>
<template v-if="agentInfo.state == 1 || agentInfo.state == 0">
<view class="page-title">经营统计</view>
<JMainCard pd="0" wrapPd="0 50rpx" bgColor="rgba(0,0,0,0.1)">
<ScreenTitle bdR="20rpx 20rpx 0 0" @search="searchTime" :index="index" />
<view class="mch-info">
<view class="mch-many">
<text>收款金额</text>
{{ (orderCount.payAmount / 100).toFixed(2) }}
</view>
<view class="mch-footer payCount">
<view>
<text>收款笔数</text>
{{ orderCount.payCount }}
</view>
</view>
<view class="mch-footer">
<view>
<text>退款金额</text>
{{ (orderCount.refundAmount / 100).toFixed(2) }}
</view>
<view>
<text>退款笔数</text>
{{ orderCount.refundCount }}
</view>
</view>
</view>
</JMainCard>
<JMainCard pd="8rpx" wrapPd="30rpx 50rpx " bgColor="rgba(0,0,0,0.1)">
<view class="mch-info">
<view class="mch-footer">
<view>
<text>商户总数</text>
{{ orderCount.mchAllCount }}
</view>
<view>
<text>新增商户数</text>
{{ orderCount.refundCount }}
</view>
</view>
</view>
</JMainCard>
</template>
<JButton color="#FF4D6A" bgColor="rgba(255,255,255,0.85)" size="medium" pdTop="0" @HandleTouch="deletedTips.open()"
>删除代理商</JButton
>
</view>
<JDeletedTips ref="deletedTips" @confirm="deleted" />
<JDeletedTips ref="switchTips" @confirm="confirm" @cancel="cancel" />
</template>
<script setup>
import { reactive, ref } from "vue"
import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app"
import { formatData } from "@/hooks/formatData"
import { $findAgent, $getStatic, $editAgent, $delAgent } from "@/http/apiManager.js"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
import JInput from "@/components/newComponents/JInput/JInput"
import JButton from "@/components/newComponents/JButton/JButton"
import JDeletedTips from "@/components/newComponents/JDeletedTips/JDeletedTips"
import ScreenTitle from "@/components/newComponents/ScreenTitle/ScreenTitle"
onLoad((option) => {
params.agentNo = option.agentNo
})
onShow(() => {
getAgentInfo()
})
const tipsList = reactive([
{},
{},
{
text: "认证中",
bgColor: "#FFCA80",
},
{
text: "认证驳回",
bgColor: "#FF4D6A",
},
{
text: "待认证",
bgColor: "rgba(255, 255, 255, 0.3)",
},
])
const switchTips = ref(null)
const agentInfo = ref({})
const orderCount = ref({})
const index = ref(0)
const params = {
queryDateRange: "",
countType: 3,
agentNo: "",
}
const deletedTips = ref(null)
const deleted = () => {
$delAgent(params.agentNo).then((res) => {
uni.showToast({
title: "删除成功",
icon: "success",
})
uni.navigateBack()
})
}
const getAgentInfo = () => {
getStatic()
$findAgent(params.agentNo).then(({ bizData }) => {
formatData(bizData)
agentInfo.value = bizData
})
}
const getStatic = (data) => {
$getStatic(params).then(({ bizData }) => {
orderCount.value = bizData.orderCount
orderCount.value.mchAllCount = bizData.mchCount.mchAllCount
orderCount.value.mchOnNetCount = bizData.mchCount.mchOnNetCount
})
}
const searchTime = (data) => {
index.value = data.i
if (data.val.value != "customer") {
params.queryDateRange = data?.val.value
getStatic()
}
}
let flag = undefined
const change = (e) => {
flag = true
agentInfo.value.state = e.detail.value ? 1 : 0
switchTips.value.open("确认修改吗?")
}
const confirm = () => {
flag = false
$editAgent(agentInfo.value.agentNo, { state: agentInfo.value.state }).then(() => {
uni.showToast({
title: "修改成功",
icon: "success",
})
})
}
const cancel = (val) => {
if (!flag) return
agentInfo.value.state = Number(!agentInfo.value.state)
}
function editAgent() {
uni.navigateTo({
url: "./editAgent?agentNo=" + params.agentNo,
})
}
const headerBgColor = ref("transparent")
onPageScroll((data) => {
if (data.scrollTop > 20) {
headerBgColor.value = "$primaryColor"
} else {
headerBgColor.value = "transparent"
}
})
</script>
<style lang="scss" scoped>
.page-wrapper {
position: relative;
background-color: $primaryColor;
opacity: 0;
text {
color: #fff;
}
.bg-image {
position: absolute;
top: -40rpx;
right: 0;
width: 100%;
height: 650rpx;
}
.expand-header {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50rpx;
image {
width: 93rpx;
height: 93rpx;
}
.expand-title {
width: 500rpx;
margin: 20rpx auto 0;
word-break: break-all;
text-align: center;
font-size: 33rpx;
font-weight: 700;
color: #fff;
}
.expand-phone {
margin: 30rpx 0;
color: rgba(255, 255, 255, 0.6);
font-size: 25rpx;
}
.expand-edit {
position: relative;
z-index: 30;
padding: 20rpx 41rpx;
font-size: 28rpx;
color: $primaryColor;
image {
width: 26.25rpx;
height: 26.25rpx;
}
}
}
.right-color {
color: #fff;
font-size: 30rpx;
}
.title-name {
display: block;
width: 400rpx;
}
.page-title {
padding-bottom: 30rpx;
text-align: center;
font-size: 33rpx;
color: #fff;
}
.mch-info {
padding: 60rpx;
view {
display: flex;
flex-direction: column;
}
text {
margin-bottom: 20rpx;
color: rgba(255, 255, 255, 0.6);
font-size: 25rpx;
font-weight: 500;
}
.mch-many {
color: #fff;
font-size: 56rpx;
font-weight: 700;
}
.mch-footer {
display: flex;
flex-direction: row;
view {
flex: 1;
font-size: 33rpx;
font-weight: 700;
color: #fff;
}
}
.payCount {
margin: 48rpx 0;
}
}
}
.agent-tips {
font-size: 30rpx;
color: #fff;
.tips-color {
display: inline-block;
width: 35rpx;
height: 35rpx;
margin-left: 10rpx;
vertical-align: sub;
border-radius: 50%;
background-color: #ffca80;
}
}
.page-show {
opacity: 1;
transition: opacity 0.3s linear;
}
</style>

View File

@@ -0,0 +1,106 @@
<template>
<view class="store-wrapper global-wrapper">
<view class="mch-header">
<JHeaderTitle title="代理商管理" bgColor="#f2f2f2" />
<JSearchInput
@search="searchList"
@resetSearch="searchList"
ref="search"
place="搜索代理商名称、代理商号、手机号"
>
</JSearchInput>
</view>
<block v-for="v in useDataResult.dataList" :key="v.agentNo">
<JPreview
:title="v.agentName"
:qrcId="v.agentNo"
:img="imgList[v.state == 1 ? 1 : 0]"
:spot="tipsList[v.state].bgColor"
:status="tipsList[v.state].text"
:isLast="useDataResult.dataList.length - 1 == i"
@tap="toDetail(v.agentNo)"
></JPreview>
</block>
<jeepayListNull :isShow="true" :list="useDataResult.dataList.length" />
<view class="button-block"></view>
<view class="mch-footers">
<JButton pd="30rpx 30rpx 50rpx 30rpx" pdTop="0" @HandleTouch="toPage">创建代理商</JButton>
</view>
</view>
</template>
<script setup>
import { ref, reactive, watch, onMounted } from "vue"
import { onBackPress, onShow } from "@dcloudio/uni-app"
import { $getAgentList, $editAgent } from "@/http/apiManager.js"
import useGetList from "@/hooks/useList.js"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle.vue" //自定义导航栏
import JSearchInput from "@/components/newComponents/JSearchInput/JSearchInput.vue" //自定义搜索框
import JButton from "@/components/newComponents/JButton/JButton.vue" //自定义按钮
import JPreview from "@/components/newComponents/JPreview/JPreview.vue" //列表展示
import jeepayListNull from "@/components/jeepayListNull/jeepayListNull" //最后一条数据提示
const { useDataResult, getList } = useGetList({
requestFun: $getAgentList,
})
// 图片列表
const imgList = reactive(["/static/navImg/disable-dailishang.svg", "/static/navImg/nav-dailishang.svg"])
const tipsList = reactive([
{ text: "已禁用", bgColor: "#B2B2B2" },
{ text: "已启用", bgColor: "#7737FE" },
{ text: "认证中", bgColor: "#FFCA80" },
{ text: "认证驳回", bgColor: "#FF4D6A" },
{ text: "待认证", bgColor: "rgba(255, 255, 255, 0.3)" },
])
// 返回前清除搜索数据
const search = ref()
onBackPress(() => {
if (search.value.searchText != "") {
search.value.searchText = ""
list(search.value.searchText)
return true
} else {
return false
}
})
// 搜索回调
const searchList = (data) => {
if (data === "reset") data = ""
getList({ unionAgentInfo: data })
}
// 详情
const toDetail = (agentNo) => {
uni.navigateTo({
url: "./agentDetail?agentNo=" + agentNo,
})
}
// 跳转 添加代理商
const toPage = () => {
uni.navigateTo({
url: "./addAgent",
})
}
</script>
<style lang="scss" scoped>
.store-wrapper {
width: 100%;
.mch-header {
position: sticky;
top: 0;
z-index: 100;
background-color: #f2f2f2;
}
.button-block {
height: 210rpx;
}
.mch-footers {
position: fixed;
left: 0;
right: 0;
bottom: 0;
backdrop-filter: blur(30px);
border-top: 1px solid rgba($color: #000000, $alpha: 0.1);
}
}
</style>

View File

@@ -0,0 +1,124 @@
<template>
<view class="page-wrapper global-wrapper bgF2">
<JHeaderTitle title="编辑代理商信息" bgColor="#f2f2f2" />
<JMainCard pd="0" wrapPd="30rpx">
<JInput
v-model:value="agentInfo.agentName"
name="代理商全称"
place="请输入代理商全称"
:rules="{ name: 'agentName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
<JInput
v-model:value="agentInfo.agentShortName"
name="代理商简称"
place="请输入代理商简称"
:rules="{ name: 'agentShortName', rule: 'REG_NotNUll' }"
></JInput>
</JMainCard>
<JMainCard wrapPd="0 30rpx" pd="0">
<JInput
v-model:value="agentInfo.contactName"
name="联系人姓名"
place="请输入联系人姓名"
:rules="{ name: 'contactName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
<JInput
v-model:value="agentInfo.contactTel"
name="联系人手机号"
place="请输入联系人手机号"
:rules="{ name: 'contactTel', rule: 'REG_NotNUll' }"
></JInput>
<JInput v-model:value="agentInfo.contactEmail" name="联系人邮箱" place="请输入联系人邮箱"></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="30rpx">
<JInput v-model:value="agentInfo.remark" name="备注" place="请输入备注" :isBorder="true"></JInput>
</JMainCard>
<JButton size="max" pd="30rpx" @HandleTouch="saveAgent" pdTop="0">保存</JButton>
</view>
</template>
<script setup>
import { ref, reactive, nextTick } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
import JInput from "@/components/newComponents/JInput/JInput"
import JButton from "@/components/newComponents/JButton/JButton"
import { $editAgent, $findAgent } from "@/http/apiManager.js"
import { validateArray } from "@/hooks/rules" //校验函数
onLoad((options) => {
if (options.agentNo) return getInfo(options.agentNo)
})
const agentInfo = ref({})
const getInfo = (val) => {
$findAgent(val).then(({ bizData }) => {
agentInfo.value = bizData
})
}
const saveAgent = () => {
if (validateArray(agentInfo.value)) {
$editAgent(agentInfo.value.agentNo, agentInfo.value).then((res) => {
uni.showToast({
title: "保存成功",
icon: "success",
})
uni.navigateBack()
})
}
}
</script>
<style lang="scss" scoped>
.page-wrapper {
.place-text {
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 33rpx;
color: #a6a6a6;
image {
width: 40rpx;
height: 40rpx;
transform: translateX(20rpx);
}
}
.selected-text {
color: #000;
}
}
.team-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 40rpx;
height: 40rpx;
}
view {
display: flex;
align-items: center;
image {
width: 93rpx;
height: 93rpx;
margin-right: 15rpx;
}
view {
display: flex;
flex-direction: column;
align-items: flex-start;
font-size: 33rpx;
font-weight: 700;
text {
margin-top: 10rpx;
font-size: 25rpx;
font-weight: 500;
color: #8c8c8c;
}
}
}
}
</style>