shangfutong-ui/jeepay-ui-uapp-agent/pageWork/merchantManagement/merchantDetail.vue

261 lines
7.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>