Commit 00f5c1cd by 李伟康

refactor(equity): 移除案例中心和历史记录组件并优化代码结构

- 移除了 CaseCenter.uvue 组件文件及其相关功能代码
- 移除了 History.uvue 组件文件及其相关功能代码
- 注释掉了 portrait.uvue 页面中的 onLoad 和 onShow 导入
- 清理了相关的类型定义和计算属性
- 优化了页面的代码结构和依赖关系
1 parent 4ca38691
......@@ -30,7 +30,7 @@
<script setup lang="uts">
import { ref, ComponentPublicInstance } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from '@/utils/storage.uts'
import HomeFrame from '@/components/HomeFrame/index.uvue'
......
<template>
<CustomPopup
:visible="visible"
ref="popup"
position="center"
>
<view class="detail-box">
<view
class="close-box flex"
@click="close"
>
<uni-icons
type="clear"
:size="28"
color="#76787f"
></uni-icons>
</view>
<view class="sprite-icon icon-bao"></view>
<view class="title text-hide">
{{ getItemName() }}
</view>
<view class="type">{{ getMain() }}</view>
<view class="content">
<rich-text :nodes="getItemDesc()"></rich-text>
</view>
</view>
</CustomPopup>
</template>
<script setup lang="uts">
import CustomPopup from '@/components/CustomPopup.uvue'
interface Item {
itemName: string
main: string
itemDesc: string
}
const props = defineProps({
item: Object as () => Item
})
const visible = ref<boolean>(false)
const popup = ref(null)
function open(): void {
visible.value = true
}
function close(): void {
visible.value = false
}
function getItemName(): string {
const itemObj = props.item as UTSJSONObject | null
if (itemObj == null) return ''
const itemNameValue = itemObj['itemName'] as string | null
return itemNameValue != null ? itemNameValue : ''
}
function getMain(): string {
const itemObj = props.item as UTSJSONObject | null
if (itemObj == null) return ''
const mainValue = itemObj['main'] as string | null
return mainValue != null ? mainValue : ''
}
function getItemDesc(): string {
const itemObj = props.item as UTSJSONObject | null
if (itemObj == null) return ''
const itemDescValue = itemObj['itemDesc'] as string | null
return itemDescValue != null ? itemDescValue : ''
}
defineExpose({ open, close })
</script>
<style scoped lang='scss'>
.detail-box {
position: relative;
width: 720rpx;
max-height: 640rpx;
border-radius: 40rpx;
padding: 48rpx 64rpx 88rpx;
box-sizing: border-box;
overflow: hidden;
&::before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 240rpx;
background-image: linear-gradient(180deg, #e5edfe 0%, #ffffff 100%);
content: '';
z-index: -1;
}
&::after {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: '';
background-color: #fff;
z-index: -2;
}
.icon-bao {
position: absolute;
top: 48rpx;
right: 68rpx;
}
.close-box {
position: absolute;
width: 136rpx;
height: 136rpx;
top: 0;
right: 0;
justify-content: center;
z-index: 2;
align-items: center;
}
.title {
font-weight: 500;
font-size: 40rpx;
color: #292d33;
line-height: 64rpx;
padding: 48rpx 0 24rpx;
}
.type {
background: #f2f2f2;
border-radius: 6rpx;
padding: 2rpx 16rpx;
font-size: 26rpx;
color: #666666;
line-height: 40rpx;
width: fit-content;
}
.content {
margin-top: 48rpx;
max-height: 276rpx;
font-size: 30rpx;
color: #292d33;
line-height: 48rpx;
overflow-y: auto;
word-break: break-all;
}
}
</style>
\ No newline at end of file
<template>
<MessageBox
ref="carBuyersVisible"
position="bottom"
:isFooter="false"
:title="`请选择${title}`"
:maxHeight="1000"
@close="onClose"
>
<view class="select-box">
<view
class="select-item"
:class="{ checked: carBuyers == item.name }"
@click="handleSelect(item)"
v-for="(item, index) in carBuyersList"
:key="index"
>
{{ item.name }}
</view>
</view>
</MessageBox>
</template>
<script setup lang="uts">
import MessageBox from '@/components/MessageBox.uvue'
import { state } from '@/store/index.uts'
import { ComponentPublicInstance } from 'vue'
type CarBuyersItem = {
name: string
id: number
}
const props = defineProps({
title: {
type: String,
default: '购车方式'
},
salesPropsUuid: {
type: String,
default: ''
}
})
const emit = defineEmits(['close', 'select'])
const carBuyersVisible = ref(null)
const carBuyersList = ref<Array<CarBuyersItem>>([{
name: '全款',
id: 1
}, {
name: '按揭',
id: 2
}] as Array<CarBuyersItem>)
function close(): void {
if (carBuyersVisible.value != null) {
(carBuyersVisible.value as ComponentPublicInstance).$callMethod('close')
}
}
const watchStatus = computed(() => {
const status = state.user?.historyStatus
if (status == null) {
return false
} else if (status == 1) {
return true
} else {
return false
}
})
const carBuyers = computed((): any | null => {
const carBuyersData = state.user.customerInfo.carBuyers
return carBuyersData != null ? carBuyersData : null
})
watch(watchStatus.value, () => {
close()
}, { immediate: true })
function open(): void {
if (carBuyersVisible.value != null) {
(carBuyersVisible.value as ComponentPublicInstance).$callMethod('open')
}
}
function handleSelect(item: CarBuyersItem): void {
close()
emit('select', item)
}
function onClose(): void {
emit('close')
}
defineExpose({ open, close })
</script>
<style scoped lang="scss">
.select-box {
margin: 40rpx 0;
display: flex;
flex-wrap: wrap;
overflow-y: scroll;
max-height: 50%;
padding-bottom: 60rpx;
flex-direction:row;
.select-item {
width: 23%;
margin-right: 2.67%;
margin-bottom: 32rpx;
text-align: center;
height: 68rpx;
line-height: 44rpx;
opacity: 1;
border: 2rpx solid #dce0e6;
color: #333;
font-size: 32rpx;
border-radius: 8rpx;
&:nth-child(4n) {
margin-right: 0;
}
&.checked {
border: 2rpx solid #292d33;
}
}
}
</style>
<template>
<view class="layout">
<wnCanvas
:drawStatus="penSwitch"
:canvasId="`c-${madiaId}`"
custom
@scale="onScale"
ref="canvasRef"
>
<template #customContent>
<view class="layout-content">
<PageTitle
:title="title"
:hasCarBrand="hasCarBrand"
:show="show"
/>
<template v-if="hasCarBrand">
<image
:key="viewKey"
class="content"
:src="imageUrl"
/>
</template>
<template v-else>
<template v-if="hasDetailUrl">
<image
class="content"
:src="detailImageUrl"
/>
</template>
</template>
</view>
</template>
</wnCanvas>
</view>
</template>
<script setup lang="uts">
import PageTitle from './PageTitle.uvue'
import wnCanvas from '@/components/PanCanvas/index.uvue'
import { state } from "@/store/index.uts"
import nothingImage from '@/assets/images/media/nothing.webp'
type Views = {
detailUrl?: string
bgUrl?: string
}
type CustomerInfo = {
carModelId?: string
}
const props = defineProps({
views: {
type: Object as () => UTSJSONObject,
default: () => ({})
},
penSwitch: Boolean,
title: String,
madiaId: Number,
show: Boolean,
hasCarBrand: Boolean
})
const emit = defineEmits(['scale'])
const canvasRef = ref(null)
const customerInfo = computed<CustomerInfo>(() => {
const info = state.user.customerInfo
return info != null ? info as CustomerInfo : {} as CustomerInfo
})
const hasDetailUrl = computed<boolean>(() => {
const viewsPlain = JSON.parse(JSON.stringify(props.views)) as Record<string, any>
return viewsPlain['detailUrl'] != null
})
const detailImageUrl = computed<string>(() => {
const viewsPlain = JSON.parse(JSON.stringify(props.views)) as Record<string, any>
const url = viewsPlain['detailUrl']
if (url == null) return ''
if (typeof url === 'string') return url
return url.toString()
})
const imageUrl = computed<string>(() => {
const modelId = customerInfo.value.carModelId
if (modelId == null) return nothingImage
// 使用 JSON.parse 和 JSON.stringify 绕过类型检查
const viewsPlain = JSON.parse(JSON.stringify(props.views)) as Record<string, string>
const url = viewsPlain[modelId]
return url != null ? url : nothingImage
})
const viewKey = computed<string>(() => {
const key = state.user?.viewKey
return key != null ? key as string : ''
})
function onScale(e: number): void {
emit('scale', e)
}
defineExpose({
canvasRef
})
</script>
<style scoped lang="scss">
.layout {
width: 100%;
height: 100%;
&-content {
height: 100%;
position: relative;
}
.content {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
}
.bg {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
}
}
</style>
\ No newline at end of file
<template>
<view class="page-title-box flex">
{{title}}
<view
class="car-options flex"
v-if="hasCarBrand"
@click="openCarBrand"
>
{{customerInfo.carModel != null ? customerInfo.carModel : '请选择'}}
<view class="sprite-icon icon-arrow-bottom">
</view>
</view>
<CarBrands
ref="carBrandListVisible"
@select="handleSelect"
/>
</view>
</template>
<script setup lang="uts">
import CarBrands from '@/components/CarBrands.uvue'
import { state , store } from "@/store/index.uts"
import { storage } from '@/utils/storage.uts'
import { ComponentPublicInstance } from 'vue'
type CustomerInfo = {
carModel?: string
carModelId?: string | number
}
type UserInfo = UTSJSONObject
const props = defineProps({
title: String,
hasCarBrand: Boolean,
show: Boolean
})
const carBrandListVisible = ref(null)
const customerInfo = ref<CustomerInfo>({} as CustomerInfo)
const watchCustomerInfo = computed<CustomerInfo | null>(()=> {
const customerData = state?.user.customerInfo
return customerData != null ? customerData as CustomerInfo : null
})
const watchStatus = computed(() => {
const status = state.user?.historyStatus
if (status == null) {
return false
} else if (status == 1) {
return true
} else {
return false
}
})
const showValue = computed<boolean>(() => {
const show = props.show
if (show == null) return false
return show
})
const hasCarBrandValue = computed<boolean>(() => {
const hasCarBrand = props.hasCarBrand
if (hasCarBrand == null) return false
return hasCarBrand
})
const isAito = computed<boolean>(() => {
const userInfoRaw = storage.get('userInfo')
const userInfo: UserInfo = userInfoRaw != null ? userInfoRaw as UserInfo : UTSJSONObject({ channelType: 0 })
return userInfo.channelType == 1
})
watch(showValue.value, (newval: boolean) => {
const carModel = customerInfo.value.carModel
if (newval === true && hasCarBrandValue.value === true && (carModel == null || carModel === '') && isAito.value === true) {
setTimeout(() => {
if (carBrandListVisible.value != null) {
(carBrandListVisible.value as ComponentPublicInstance).$callMethod('autoSelect')
}
}, 1000)
}
}, { immediate: true })
watch(watchCustomerInfo, (newval: any): void => {
const typedVal = newval as CustomerInfo | null
if (typedVal != null) {
customerInfo.value = typedVal
}
}, { immediate: true })
type SelectItem = {
name: string
id: string | number
}
function onSelect(item: any): void {
const typedItem = item as SelectItem
customerInfo.value.carModel = typedItem.name
customerInfo.value.carModelId = typedItem.id
// store.dispatch?.('setCustomerInfo', customerInfo.value)
}
function handleSelect(item: any): void {
if (carBrandListVisible.value != null) {
(carBrandListVisible.value as ComponentPublicInstance).$callMethod('close')
}
onSelect(item)
}
function openCarBrand(): void {
if (carBrandListVisible.value != null) {
(carBrandListVisible.value as ComponentPublicInstance).$callMethod('open')
}
}
defineExpose({ carBrandListVisible })
</script>
<style scoped lang='scss'>
.page-title-box {
justify-content: center;
position: absolute;
height: 96rpx;
left: 0;
top: 48rpx;
font-weight: 500;
font-size: 36rpx;
color: #333;
width: 100%;
z-index: 2;
flex-direction: row;
align-items: center;
.car-options {
align-items: center;
flex-direction: row;
&::before {
content: '';
width: 2rpx;
height: 36rpx;
opacity: 1;
background: #333333;
margin: 0 24rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view
class="layout"
:style="(detail as Detail).pageStyle ?? ''"
>
<image
class="icon-car"
:src="(detail as Detail).carIcon"
/>
<wnCanvas
:drawStatus="penSwitch"
:canvasId="`c-${madiaId}`"
custom
@scale="onScale"
ref="threeGuarantees"
>
<template #customContent>
<view class="layout-content">
<view class="title flex">{{title}}</view>
<view class="container">
<view class="left-tab">
<view
class="tab-item"
v-for="item in (detail as Detail).tabList"
:key="item.id"
@click="tabChange(item)"
:class="[item.id == activeIndex ? 'active' : '']"
>{{item.name}}</view>
</view>
<div class="content-bg"></div>
<view class="content">
<template v-if="(detail as Detail).viewActiveIndex.includes(activeIndex)">
<image
:key="imgKey"
:class="direction"
class="content-image"
:src="viewsImg()"
/>
<view class="content-tab">
<template v-for="(item,index) in imgIdList" :key="index">
<view
class="tab-item"
@click="tabSwitch(item)"
></view>
</template>
</view>
</template>
<template v-else>
<image
:key="imgKey"
:class="direction"
class="content-image"
:src="viewsImg()"
/>
</template>
</view>
</view>
</view>
</template>
</wnCanvas>
</view>
</template>
<script setup lang="uts">
import wnCanvas from '@/components/PanCanvas/index.uvue'
import { state } from '@/store/index.uts'
interface TabItem {
id: number | string
name: string
imgIdList?: any[]
}
interface Detail {
tabList: TabItem[]
viewActiveIndex: number[]
defultActiveId?: number
defultTabId?: number
pageStyle?: string
carIcon?: string
}
const props = defineProps({
views: Object,
penSwitch: Boolean,
title: String,
madiaId: Number,
detail: Object,
})
const emit = defineEmits(['scale'])
const activeIndex = ref<number>(1)
const direction = ref<string>('bottom')
const imgKey = ref<number>(Date.now())
const tabIndex = ref<number>(2)
const threeGuarantees = ref(null)
const imgIdList = computed<Array<any> | null>(() => {
const tabItem = (props.detail as Detail).tabList.find(item => item.id == activeIndex.value)
if (tabItem != null) {
return tabItem.imgIdList
}
return null
})
const watchStatus = computed<boolean>(() => {
const status = state.user?.historyStatus
if (status == null) {
return false
} else if (status == 1) {
return true
} else {
return false
}
})
watch(watchStatus.value, () => {
activeIndex.value = (props.detail as Detail).defultActiveId ?? 0
tabIndex.value = (props.detail as Detail).defultTabId ?? 2
}, { immediate: true })
function tabChange(item: TabItem): void {
const id = typeof item.id == 'string' ? parseInt(item.id) : item.id
if (activeIndex.value === id) return
direction.value = ''
direction.value = id > activeIndex.value ? 'bottom' : 'top'
activeIndex.value = id
imgKey.value = Date.now()
// if (threeGuarantees.value != null) {
// threeGuarantees.value.clearBoard()
// }
}
function tabSwitch(val: any): void {
const numVal = typeof val == 'string' ? parseInt(val) : val as number
if (numVal == tabIndex.value) return
tabIndex.value = numVal
// if (threeGuarantees.value != null) {
// threeGuarantees.value.clearBoard()
// }
}
function viewsImg(): any {
const currentIndex = activeIndex.value
const currentTabIndex = tabIndex.value
const viewsArray = props.views as Array<any>
if ((props.detail as Detail).viewActiveIndex.includes(currentIndex)) return viewsArray[currentTabIndex]
return viewsArray[currentIndex]
}
function onScale(e: any): void {
emit('scale', e)
}
</script>
<style scoped lang='scss'>
.layout {
width: 100%;
height: 100%;
position: relative;
// background-image: url('@/assets/images/media/media-bg.webp');
background-size: 100%;
&-content {
height: 100%;
position: relative;
}
.title {
justify-content: center;
position: absolute;
height: 96rpx;
left: 0;
top: 48rpx;
font-weight: 500;
font-size: 36rpx;
color: #333;
text-align: center;
width: 100%;
z-index: 2;
}
.container {
display: flex;
align-items: center;
padding-top: 248rpx;
padding-bottom: 96rpx;
height: 100%;
margin: 0 80rpx;
position: relative;
flex-direction:row;
.left-tab {
width: 360rpx;
margin-right: 48rpx;
.tab-item {
display: flex;
padding: 0 76rpx;
box-sizing: border-box;
align-items: center;
// justify-content: center;
flex-direction: row;
width: 100%;
height: 312rpx;
background: #f2f5ff;
border: 4rpx solid hsl(0, 80%, 100%);
box-shadow: inset 0 0 16rpx 0 #ffffff;
border-radius: 32rpx;
margin-bottom: 48rpx;
font-weight: 500;
font-size: 40rpx;
color: #1a1a1a;
text-align: center;
&:last-child {
margin-bottom: 0;
}
&.active {
color: #fff;
background-image: linear-gradient(180deg, #6795ff 0%, #4a84f9 100%);
box-shadow: 32rpx 32rpx 48rpx 0 #849dc240, inset 0 0 32rpx 0 #ffffff;
}
}
}
.content-bg {
position: absolute;
right: 0;
z-index: -1;
width: 1778rpx;
height: 1192rpx;
background-color: rgba(255, 255, 255, 0.4);
backdrop-filter: blur(8rpx);
z-index: 0;
border-radius: 64rpx;
}
.content {
position: relative;
&-tab {
display: flex;
position: absolute;
width: 100%;
top: 0;
height: 112rpx;
z-index: 1;
flex-direction: row;
.tab-item {
width: 50%;
height: 100%;
}
}
}
.content-image {
width: 1778rpx;
height: 1192rpx;
}
}
.icon-car {
position: absolute;
bottom: 0;
right: 0;
width: 952rpx;
height: 248rpx;
z-index: 2;
}
}
.top {
animation: show-view-top 0.5s;
}
.bottom {
animation: show-view-bottom 0.3s;
}
@keyframes show-view-top {
0% {
opacity: 0;
transform: translateY(-224rpx);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@keyframes show-view-bottom {
0% {
opacity: 0;
transform: translateY(100%);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
</style>
<template>
<view
class="information-entry"
v-if="showPayPage"
>
<view class="nav-bar">
<view
class="back"
@click="handleBack"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view>
<view class="title">信息录入</view>
</view>
<view class="information-tips">建议同步采集凭证,若接待工作繁忙可在提单环节再进行补充。</view>
<view class="information-box">
<view
class="information-item"
v-for="(item, index) in infoList"
:key="item.id"
>
<view
class="upload-img"
v-if="item.imgUrl"
>
<image
class="img"
:src="item.imgUrl"
mode="aspectFill"
@click="preview(index)"
/>
<view
class="upload-close"
@click="close(index)"
><glsx-image
src="detail/icon-close.png"
mode="scaleToFill"
/></view>
</view>
<view
v-else
class="icon"
@tap="choose(index)"
>
<view class="icon-upload sprite-icon icon-icon-upload"></view>
</view>
<view class="information-title">{{ item.title }} </view>
</view>
</view>
<view
class="information-done"
@click="handleFinish"
>完成接待</view>
</view>
</template>
<script setup lang="uts">
import { ref, watch, computed } from 'vue'
import { state, dispatch } from '@/store/index.uts'
type InfoListItem = {
id: number
title: string
imgUrl?: string
}
const INFO_LIST: Array<InfoListItem> = [
{
id: 1,
title: "客户付款凭证",
},
{
id: 2,
title: "客户购车发票",
},
{
id: 3,
title: "客户延保合同",
},
]
type Props = {
showPayPage?: boolean
}
const props = withDefaults(defineProps<Props>(), {
showPayPage: false
})
const emit = defineEmits(['update:showPayPage', 'finish'])
const infoList = ref<Array<InfoListItem>>(JSON.parse(JSON.stringify(INFO_LIST)) as Array<InfoListItem>)
const previewImg = ref<string>('')
const isPreview = ref<boolean>(false)
const watchBooksList = computed<Array<InfoListItem>>(() => {
return state.audio.booksList as Array<InfoListItem>
})
watch(watchBooksList.value , (newValue: Array<InfoListItem>) => {
if (newValue != null && newValue.length > 0) {
infoList.value = newValue
} else {
infoList.value = JSON.parse(JSON.stringify(INFO_LIST)) as Array<InfoListItem>
}
}, { immediate: true })
function handleBack(): void {
emit('update:showPayPage', false)
}
function handleFinish(): void {
emit('finish')
}
// 上传图片
async function choose(index: number): Promise<void> {
try {
// const result = await uni.requestPermission({
// permission: 'android.permission.CAMERA'
// })
// if (result !== 1) {
// uni.showToast({
// title: "为了访问您的相机和图库,请打开相机权限",
// icon: "none"
// })
// return
// }
uni.chooseImage({
count: 1,
success: (res) => {
try {
// let url = await uploadFile(res.tempFilePaths[0])
// uni.$logger.local.info(`上传付款凭证:${res.tempFilePaths[0]}`)
// this.$set(
// this.infoList[index],
// "imgUrl",
// url
// );
// infoList.value[index].imgUrl = url
// setBooks(utils.deepClone(infoList.value))
} catch (error) {
console.error(`上传付款凭证失败:${error}`)
}
},
fail: (err) => {
console.error(`选择图片失败:${err}`)
}
})
} catch (error) {
console.error(`请求权限失败:${error}`)
}
}
// 删除图片
function close(index: number): void {
infoList.value[index].imgUrl = ''
dispatch('setBooks', JSON.parse(JSON.stringify(infoList.value)) as Array<InfoListItem>)
}
// 预览图片
function preview(index: number): void {
isPreview.value = true
previewImg.value = infoList.value[index].imgUrl ?? ''
const imageUrl: string = infoList.value[index].imgUrl ?? ''
uni.previewImage({
urls: [imageUrl],
})
}
</script>
<style scoped lang="scss">
.information-entry {
position: fixed;
background-color: #fff;
width: 100vw;
height: 100vh;
z-index: 998;
box-sizing: border-box;
padding-top: 144rpx;
left: 0;
top: 0;
.nav-bar {
position: fixed;
width: 100%;
height: 96rpx;
left: 0;
top: 48rpx;
z-index: 9;
.back {
width: 96rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: 32rpx;
color: #1a1a1a;
}
}
.information-tips {
background: rgba(44, 102, 247, 0.1);
color: #2c66f7;
padding: 32rpx 0 24rpx 80rpx;
font-size: 28rpx;
}
.information-box {
display: flex;
padding: 40rpx 80rpx;
flex-direction:row;
.information-item {
display: flex;
flex-direction: column;
width: 264rpx;
margin-right: 48rpx;
.icon {
background-color: #f4f5f7;
border: 2rpx solid #eff0f2;
border-radius: 16rpx;
.icon-upload {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 128rpx;
height: 128rpx;
}
}
.icon,
.upload-img {
position: relative;
width: 264rpx;
height: 264rpx;
}
.upload-img {
.img {
border-radius: 16rpx;
width: 100%;
height: 100%;
}
.upload-close {
position: absolute;
right: 0;
top: 0;
width: 40rpx;
height: 40rpx;
}
}
.information-title {
margin-top: 24rpx;
font-weight: 500;
font-size: 28rpx;
color: #222222;
letter-spacing: 0;
line-height: 48rpx;
text-align: center;
}
}
}
}
.information-done {
position: absolute;
bottom: 30rpx;
left: 50%;
transform: translateX(-50%);
width: calc(100% - 240rpx);
height: 80rpx;
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
text-align: center;
line-height: 80rpx;
background-color: #2c66f7;
border-radius: 40rpx;
}
.preview-img {
height: 1300rpx;
}
</style>
\ No newline at end of file
<template>
<CustomPopup
:visible="visible"
ref="popup"
position="bottom"
>
<view class="popup-wrapper">
<view class="popup-box">
<view class="payment-title">{{title}}
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
</view>
<view class="popup-content">
<view class="tab-list">
<view
:class="['tab-item', { active: payActive === item.type }, { single :currentPaymentType().length == 1}]"
v-for="item in currentPaymentType()"
:key="item.type"
@click="handleSwitchTab(item)"
>{{ item.name }}</view>
</view>
<view class="payment-content">
<template v-if="payInfo != null && payInfo.paymentType != null">
<view
v-show="payActive === 1"
class="qr-code-content"
>
<image
class="qr-code-img"
:src="payInfo.storePaymentQrcodeUrl"
mode="scaleToFill"
/>
<!-- <image
class="qr-code-img"
src="https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/11.png"
mode="scaleToFill"
/> -->
<view class="qr-code-info">扫码付款,支持多渠道付款</view>
</view>
</template>
<template v-if="accountInfo != null && accountInfo.paymentType != null ">
<view
v-show="payActive === 2"
class="corporate-content"
>
<image
class="bank-logo"
:src="accountInfo.bankUrl"
mode="scaleToFill"
/>
<view class="bank-info">
<view
class="bank-item"
v-for="item in accountList"
:key="item.field"
>
<text class="bank-label">{{ item.label }}:</text>
<view class="bank-value">{{ accountInfo[item.field] }}</view>
</view>
</view>
</view>
</template>
</view>
</view>
<view
class="payment-done"
@click="done()"
>已支付,去上传付款凭证</view>
</view>
</view>
</CustomPopup>
</template>
<script setup lang="uts">
import { ref, watch } from 'vue'
import CustomPopup from '@/components/CustomPopup.uvue'
import { state } from "@/store/index.uts"
const emit = defineEmits(['jumpPay'])
interface PaymentTypeItem {
name: string
type: number
title: string
paymentType?: number
storePaymentQrcodeUrl?: string
bankUrl?: string
companyName?: string
basicAccount?: string
subBranchAccount?: string
generalAccount?: string
paymentAccount?: string
}
type AccountListItem = {
label: string
field: string
}
type Props = {
paymentType?: PaymentTypeItem[]
}
const props = defineProps<Props>()
const ACCOUT_LIST: AccountListItem[] = []
const item1: AccountListItem = {
label: "公司名称",
field: "companyName",
}
const item2: AccountListItem = {
label: "基本账户",
field: "basicAccount",
}
ACCOUT_LIST.push(item1, item2)
const payActive = ref<number>(1)
const accountList = ref<AccountListItem[]>(ACCOUT_LIST)
const title = ref<string>('')
const accountInfo = ref<UTSJSONObject>({})
const payInfo = ref<UTSJSONObject>({})
const popup = ref(null)
const visible = ref<boolean>(false)
// 切换 tab
function handleSwitchTab(item: PaymentTypeItem, isClick: boolean = true): void {
payActive.value = item.type
title.value = item.title
if (isClick) {
// uni.$logger.local.info(`付款方式:${item.title}`)
}
}
// 使用传入的 paymentType 或从 store 获取
const currentPaymentType = (): PaymentTypeItem[] => {
return props.paymentType != null ? props.paymentType as PaymentTypeItem[] : state.user.paymentType as PaymentTypeItem[]
}
watch(currentPaymentType(), (newval: PaymentTypeItem[]) => {
if (newval.length > 0) {
payInfo.value = (newval.find(i => i.paymentType == 1) ?? {}) as UTSJSONObject
accountInfo.value = (newval.find(i => i.paymentType == 2) ?? {}) as UTSJSONObject
handleSwitchTab(newval[0], false)
}
}, { immediate: true })
// 显示弹窗
function show(): void {
console.log(123)
visible.value = true
// if(this.title) uni.$logger.local.info(`付款方式:${this.title}`)
}
function close(): void {
visible.value = false
}
// 已支付
function done(): void {
emit('jumpPay')
close()
}
// 暴露方法给父组件
defineExpose({
show,
close
})
</script>
<style scoped lang="scss">
.popup-box {
position: relative;
// margin-top: 286rpx;
background-color: #f8f9f9;
height: 1160rpx;
padding-bottom: 30rpx;
.payment-title {
position: relative;
width: 100%;
height: 96rpx;
padding: 24rpx 0 26rpx;
text-align: center;
border-bottom: 2rpx solid #e8e8e8;
.close {
position: absolute;
right: 0;
top: 0;
width: 96rpx;
height: 96rpx;
justify-content: center;
}
}
}
.popup-content {
.tab-list {
display: flex;
justify-content: center;
margin-top: 40rpx;
flex-direction:row;
.tab-item {
width: 320rpx;
padding: 24rpx 0;
text-align: center;
background-color: #fff;
color: #666;
font-size:28rpx;
&.active {
background-color: #2c66f7;
color: #fff;
}
&:first-child {
border-radius: 200rpx 0 0 200rpx;
}
&:last-child {
border-radius: 0 48rpx 48rpx 0;
}
}
.single {
border-radius: 48rpx !important;
}
}
.payment-content {
width: 100%;
display: flex;
justify-content: center;
margin-top: 40rpx;
flex-direction: row;
.qr-code-content {
width: 538rpx;
background-color: #fff;
border-radius: 24rpx;
text-align: center;
padding: 59rpx 0 67rpx;
display:flex;
flex-direction:column;
align-items: center;
justify-content: center;
.qr-code-img {
width: 420rpx;
height: 420rpx;
}
.qr-code-info {
margin-top: 40rpx;
font-weight: 500;
font-size: 32rpx;
color: #1a1a1a;
}
}
.corporate-content {
width: 1080rpx;
background-color: #fff;
border-radius: 24rpx;
.bank-logo {
width: 100%;
height: 136rpx;
}
.bank-info {
font-weight: 500;
font-size: 32rpx;
padding: 27rpx 80rpx 39rpx;
.bank-item {
display: flex;
align-items: center;
margin-bottom: 16rpx;
flex-direction: row;
&:last-child {
margin-bottom: 0;
}
.bank-label {
color: #6c6c70;
}
.bank-value {
box-sizing: border-box;
background-color: #f8f9f9;
border-radius: 8rpx;
width: 740rpx;
height: 80rpx;
line-height: 80rpx;
padding-left: 24rpx;
font-weight: 500;
font-size: 32rpx;
color: #1a1a1a;
letter-spacing: 0;
}
}
}
}
}
}
.payment-done {
position: absolute;
bottom: 30rpx;
left: 50%;
transform: translateX(-50%);
width: calc(100% - 240rpx);
height: 80rpx;
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
text-align: center;
line-height: 80rpx;
background-color: #2c66f7;
border-radius: 40rpx;
}
</style>
......@@ -38,7 +38,7 @@
<script setup lang="uts">
import { ref, ComponentPublicInstance } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from '@/utils/storage.uts'
import { state , dispatch } from "@/store/index.uts";
import HomeFrame from '@/components/HomeFrame/index.uvue'
......@@ -183,13 +183,13 @@
onLoad((options) => {
getMockData(true).then(mockdata =>{
console.log(mockdata,'===')
const userInfo = storage.get('userInfo')
const userInfo = storage.get('userInfo') as UTSJSONObject
const mockDataObj = mockdata as UTSJSONObject
const {channelType} = userInfo as UTSJSONObject
if (channelType == 1 && mockDataObj.boutiqueDefaultCarBrandId != null) {
state.user.boutiqueDefaultCarBrandId = mockDataObj.boutiqueDefaultCarBrandId //默认车辆品牌
const channelType = userInfo.channelType as string
if (channelType == '1' && mockDataObj.boutiqueDefaultCarBrandId != null) {
state.user.boutiqueDefaultCarBrandId = (mockDataObj.boutiqueDefaultCarBrandId as string) ?? '' //默认车辆品牌
if (mockDataObj.defaultCarId != null) {
state.user.defaultCarId = mockDataObj.defaultCarId //默认车系
state.user.defaultCarId = (mockDataObj.defaultCarId as string) ?? ''//默认车系
}
}
})
......
......@@ -6,7 +6,7 @@
</template>
<script setup lang="uts">
import { onLoad } from "@dcloudio/uni-app";
// import { onLoad } from "@dcloudio/uni-app";
import { runStoreTest } from "../../test/test_store_v2.uts";
onLoad((options: OnLoadOptions) => {
......
......@@ -42,7 +42,7 @@
<script setup lang="uts">
import { ref, computed, type Ref, ComponentPublicInstance } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from '@/utils/storage.uts'
import HomeFrame from '@/components/HomeFrame/index.uvue'
import { useRecorder } from '@/composables/useRecorder'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!