源文件

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,125 @@
<template>
<view class="bgF2 global-wrapper">
<view class="mch-header">
<JHeaderTitle title="创建商户" bgColor="#f2f2f2" />
</view>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput
name="商户全称"
:isBorder="true"
v-model:value="mchInfo.mchName"
:rules="{ name: 'mchName', rule: 'REG_NotNUll' }"
place="请输入商户全称"
></JInput>
<JInput
name="商户简称"
v-model:value="mchInfo.mchShortName"
:rules="{ name: 'mchShortName', rule: 'REG_NotNUll' }"
place="请输入商户简称"
></JInput>
<JInput
name="商户登录名"
v-model:value="mchInfo.loginUsername"
:rules="{ name: 'loginUsername', rule: 'REG_LoginName' }"
place="字母开头6到18位"
></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput
name="联系人姓名"
:isBorder="true"
v-model:value="mchInfo.contactName"
:rules="{ name: 'contactName', rule: 'REG_NotNUll' }"
place="请输入联系人姓名"
></JInput>
<JInput
name="联系人手机号"
v-model:value="mchInfo.contactTel"
:rules="{ name: 'contactTel', rule: 'REG_Phone' }"
place="请输入联系人手机号"
></JInput>
<JInput name="联系人邮箱" v-model:value="mchInfo.contactEmail" place="请输入联系人邮箱"></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput name="是否发送开通提醒" :isBorder="true">
<switch
:checked="mchInfo.isNotify == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#7737fe"
@change="switchState($event, 'isNotify')"
/>
</JInput>
<JInput name="是否使用默认密码">
<switch
:checked="mchInfo.defaultPass == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#7737fe"
@change="switchState($event, 'defaultPass')"
/>
</JInput>
<JInput
name="自定义密码"
v-model:value="mchInfo.loginPassword"
:rules="{ name: 'loginPassword', rule: 'REG_NotNUll' }"
place="请输入自定义密码"
v-if="!mchInfo.defaultPass"
></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="15rpx 30rpx">
<JInput name="备注" v-model:value="mchInfo.remark" place="请输入备注"></JInput>
</JMainCard>
<JButton pd="15rpx 30rpx 50rpx 30rpx" bottom="50rpx" @HandleTouch="createMch">创建商户</JButton>
</view>
</template>
<script setup>
import { ref, reactive } from "vue"
import { $addMer, $getPasswordRules } from "@/http/apiManager.js"
import { 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 { validateArray } from "@/hooks/rules"
import valid from "@/hooks/validate"
onLoad(() => {
getRules()
})
const mchInfo = reactive({
defaultPass: 1,
isNotify: 0,
state: 1,
})
const switchState = (e, v) => {
mchInfo.value[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 createMch = () => {
if (!!mchInfo.contactEmail) {
if (!valid.REG_Email(mchInfo.contactEmail)) return uni.showToast({ title: "邮箱格式不正确", icon: "none" })
}
if (validateArray(mchInfo)) {
if (mchInfo.loginPassword && !rules.value.rule.test(mchInfo.passwordType)) {
return uni.showToast({
title: rules.value.ruleText,
icon: "none",
})
}
$addMer(mchInfo).then((res) => {
if (res.code === 0) {
uni.showToast({
icon: "success",
title: "添加成功",
})
uni.navigateBack()
}
})
}
}
</script>

View File

@@ -0,0 +1,119 @@
<template>
<view class="page-wrapper bgF2 global-wrapper">
<JHeaderTitle title="编辑商户信息" bgColor="#f2f2f2" />
<JMainCard wrapPd="0 30rpx" pd="0">
<JInput
v-model:value="mchInfo.mchName"
name="用户名称"
place="请输入商户名称"
:rules="{ name: 'mchName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
<JInput
v-model:value="mchInfo.mchShortName"
name="商户简称"
place="请输入商户简称"
:rules="{ name: 'mchShortName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
</JMainCard>
<JMainCard wrapPd="30rpx" pd="0">
<JInput
v-model:value="mchInfo.contactName"
name="联系人姓名"
place="请输入联系人姓名"
:rules="{ name: 'contactName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
<JInput v-model:value="mchInfo.contactEmail" name="联系人邮箱" place="请输入联系人邮箱" :isBorder="true"></JInput>
</JMainCard>
<JMainCard wrapPd="0 30rpx" pd="0">
<JInput v-model:value="mchInfo.remark" name="备注" place="请输入备注" :isBorder="true"></JInput>
</JMainCard>
<JButton pd="30rpx" @HandleTouch="saveMch" pdTop="30rpx">保存</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 { $editMer, $findMer } from "@/http/apiManager.js"
import { validateArray } from "@/hooks/rules" //校验函数
onLoad((options) => {
if (options.mchNo) return getInfo(options.mchNo)
})
const mchInfo = ref({})
const getInfo = (val) => {
$findMer(val).then(({ bizData }) => {
mchInfo.value = bizData
})
}
const saveMch = () => {
if (validateArray(mchInfo.value)) {
$editMer(mchInfo.value.mchNo, mchInfo.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>

View File

@@ -0,0 +1,260 @@
<template>
<view class="page-wrapper">
<JHeaderTitle title="商户详情" :bgColor="headerBgColor" color="#fff" imgUrl="/static/iconImg/left-white.svg" />
<image src="/static/iconImg/mch-bg-Img.svg" class="bg-image" mode="scaleToFill" />
<view class="expand-header">
<image src="/static/iconImg/icon-mch.svg" mode="scaleToFill" />
<view class="expand-title">{{ mchInfo.mchName }}</view>
<view class="expand-phone">{{ mchInfo.mchNo }}</view>
<view class="expand-edit bgF bdR10" @tap="editMch">
<image src="/static/iconImg/expand-edit.svg" mode="scaleToFill" />
编辑信息
</view>
</view>
<JMainCard pd="0" bgColor="rgba(0,0,0,0.1)">
<JInput name="商户全称" pd="40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.mchName }}</text></JInput
>
<JInput name="商户简称" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.mchShortName }}</text></JInput
>
<JInput name="用户号" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.mchNo }}</text></JInput
>
<JInput name="联系人姓名" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.contactName }}</text></JInput
>
<JInput name="联系人手机号" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.contactTel }}</text></JInput
>
<JInput name="联系人邮箱" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.contactEmail }}</text></JInput
>
<JInput name="创建时间" pd="30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ mchInfo.createdAt?.split("-").join("/") }}</text></JInput
>
<JInput name="商户状态" pd="0 40rpx 30rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<view class="dis-wrapper">
<text v-if="mchInfo.state == 1">启用</text>
<text v-else>禁用</text>
<switch
:checked="mchInfo.state == 1 ? true : false"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#BF80FF"
@change="change"
/>
</view>
</JInput>
</JMainCard>
<view class="page-title">经营统计</view>
<JMainCard pd="0" wrapPd="0 50rpx" bgColor="rgba(0,0,0,0.1)">
<ScreenTitle bdR="20rpx 20rpx 0 0" :index="index" @search="getStatic" />
<view class="mch-info">
<view class="mch-many">
<text>收款金额</text>
{{ (orderCount.payAmount / 100).toFixed(2) }}
</view>
<view class="mch-footer">
<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>
<JButton color="#FF4D6A" bgColor="rgba(255,255,255,0.85)" size="max" pdTop="0" @HandleTouch="deletedTips.open()"
>删除商户</JButton
>
</view>
<JDeletedTips ref="deletedTips" @confirm="deleted" />
<JDeletedTips ref="switchTips" @confirm="confirm" @cancel="cancel" />
</template>
<script setup>
import { ref } from "vue"
import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app"
import { $getQRcodeList, $findMer, $getQRcode, $delMchInfo, $getStatic, $editMer } 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.mchNo = option.mchNo
})
onShow(() => {
getMchInfo()
})
const switchTips = ref(null)
const mchInfo = ref({})
const orderCount = ref({})
const index = ref(0)
const params = {
queryDateRange: "",
countType: 1,
mchNo: "",
}
const deletedTips = ref(null)
const deleted = () => {
$delMchInfo(params.mchNo).then((res) => {
uni.showToast({
title: "删除成功",
icon: "success",
})
uni.navigateBack()
})
}
const getMchInfo = () => {
getStatic()
$findMer(params.mchNo).then(({ bizData }) => {
mchInfo.value = bizData
})
}
const getStatic = (data) => {
if (data) {
index.value = data.i
if (data.val.value != "customer") {
params.queryDateRange = data?.val.value
}
}
$getStatic(params).then(({ bizData }) => {
orderCount.value = bizData.orderCount
})
}
let flag = undefined
const change = (e) => {
flag = true
mchInfo.value.state = e.detail.value ? 1 : 0
switchTips.value.open("确认修改吗?")
}
const confirm = () => {
flag = false
$editMer(mchInfo.value.mchNo, { state: mchInfo.value.state }).then(() => {
uni.showToast({
title: "修改成功",
icon: "success",
})
})
}
const cancel = (val) => {
if (!flag) return
mchInfo.value.state = Number(!mchInfo.value.state)
}
const editMch = () => {
uni.navigateTo({
url: "./editMerchant?mchNo=" + params.mchNo,
})
}
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;
width: 100%;
min-height: 100%;
background-color: $primaryColor;
text {
color: #fff;
font-weight: 400;
}
.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 {
margin-top: 20rpx;
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: 40;
padding: 20rpx 41rpx;
font-size: 28rpx;
color: $primaryColor;
image {
width: 26.25rpx;
height: 26.25rpx;
}
}
}
.right-color {
color: #fff;
font-size: 30rpx;
}
.page-title {
margin-bottom: 30rpx;
text-align: center;
font-size: 33rpx;
color: #fff;
}
.mch-info {
border-top: 1rpx solid rgba(0, 0, 0, 0.1);
padding: 60rpx;
view {
display: flex;
flex-direction: column;
}
text {
margin-bottom: 20rpx;
color: rgba(255, 255, 255, 0.6);
font-size: 25rpx;
}
.mch-many {
color: #fff;
font-size: 56rpx;
font-weight: 700;
}
.mch-footer {
display: flex;
flex-direction: row;
margin-top: 50rpx;
view {
flex: 1;
font-size: 33rpx;
font-weight: 700;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,101 @@
<template>
<view class="mch-wrapper bgF2">
<view class="mch-header">
<JHeaderTitle title="商户管理" bgColor="#f2f2f2" />
<JSearchInput
@search="searchList"
place="搜索商户名、用户号、联系人手机号"
@resetSearch="searchList"
ref="search"
></JSearchInput>
</view>
<block v-for="(v, i) in useDataResult.dataList" :key="v.agentNo">
<JPreview
:title="v.mchName"
:qrcId="v.mchNo"
:img="imgList[v.state]"
:spot="v.state === 1 ? '#7737FE':'#B2B2B2'"
:status="v.state === 1 ? '已启用' : '已禁用'"
:isLast="useDataResult.dataList.length - 1 == i"
@tap="toDetail(v.mchNo)"
></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="createMch">创建商户</JButton>
</view>
</view>
</template>
<script setup>
import { ref, reactive, watch, onMounted } from "vue"
import { onBackPress, onShow } from "@dcloudio/uni-app"
import { $getMerList } from "@/http/apiManager.js"
import useGetList from "@/hooks/useList.js"
import JButton from "@/components/newComponents/JButton/JButton.vue"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle.vue"
import JSearchInput from "@/components/newComponents/JSearchInput/JSearchInput.vue"
import JPreview from "@/components/newComponents/JPreview/JPreview.vue"
import jeepayListNull from "@/components/jeepayListNull/jeepayListNull"
const { useDataResult, getList } = useGetList({
requestFun: $getMerList,
})
// 获取搜索组件暴露出来的数据
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({ unionMchInfo: data })
}
const imgList = reactive(["/static/navImg/disable-shangdian.svg", "/static/navImg/nav-shangdian.svg"])
// 跳转创建商户
const createMch = () => {
uni.navigateTo({
url: "./addMch",
})
}
function toDetail(mchNo) {
uni.navigateTo({
url: "./merchantDetail?mchNo=" + mchNo,
})
}
</script>
<style lang="scss" scoped>
.mch-wrapper {
width: 100%;
min-height: 100vh;
.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>