Browse Source

新增付款币种组件

zhangyong/milestone-20250913-现金管理
ZhangYong 2 days ago
parent
commit
3d98845145
  1. 330
      src/components/MoneyManage/CurrencySelect.vue
  2. 39
      src/views/moneyManage/receiveDetail/receiveDetail.vue

330
src/components/MoneyManage/CurrencySelect.vue

@ -0,0 +1,330 @@
<template>
<div class="dropdown" ref="dropdownRef">
<!-- 下拉框触发器 -->
<div class="dropdown-toggle" @click="toggleMenu" :class="{ 'active': isOpen }">
<span class="placeholder" :style="{ color: selectedItem ? '#333' : '#A8ABB2' }">
{{ selectedItem || placeholder }}
</span>
<span class="arrow">
<el-icon>
<ArrowDown />
</el-icon>
</span>
</div>
<!-- 下拉菜单 -->
<div class="dropdown-menu" v-if="isOpen">
<!-- 搜索框 -->
<div class="search">
<input type="text" v-model="searchData" class="search-input" placeholder="查询" @focus="handleSearchFocus"
@blur="handleSearchBlur">
<el-icon class="search-icon">
<Search />
</el-icon>
<el-icon class="clear-icon" v-if="searchData" @click="clearSearch">
<CircleClose />
</el-icon>
</div>
<!-- 选项区域按钮样式 -->
<div class="menuContent">
<button class="dropdown-item" v-for="(item, index) in filteredItems" :key="index" @click="handleSelect(item)"
:class="{ 'selected': selectedItem === item }">
{{ item }}
</button>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed, watchEffect, onMounted } from 'vue';
const searchData = ref('')
const isOpen = ref(false)
const selectedItem = ref('')
const dropdownRef = ref(null)
const props = defineProps({
items: {
type: Array,
required: true,
default: () => []
},
placeholder: {
type: String,
default: '请选择支付方式'
},
modelValue: {
type: String,
default: ''
}
})
const emit = defineEmits(['update:modelValue', 'change'])
//
const toggleMenu = () => {
isOpen.value = !isOpen.value
}
//
const clearSearch = () => {
searchData.value = ''
}
//
const handleSelect = (item) => {
selectedItem.value = item
isOpen.value = false
emit('update:modelValue', item)
emit('change', item)
}
//
const handleClickOutside = (event) => {
if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
isOpen.value = false
}
}
//
const handleSearchFocus = () => {
//
}
const handleSearchBlur = () => {
//
}
//
const filteredItems = computed(() => {
if (!searchData.value) return props.items
return props.items.filter(item =>
item.toLowerCase().includes(searchData.value.toLowerCase())
)
})
// /
onMounted(() => {
document.addEventListener('click', handleClickOutside)
return () => {
document.removeEventListener('click', handleClickOutside)
}
})
//
watchEffect(() => {
selectedItem.value = props.modelValue
})
</script>
<style scoped lang="scss">
//
.dropdown {
position: relative;
width: 268px;
font-family: 'Arial', sans-serif;
}
// /
.dropdown-toggle {
border: 1px solid #e5e7eb;
padding: 4px 12px;
/* 调整内边距以匹配按钮高度 */
height: 23px;
/* 调整高度以匹配按钮 */
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
border-radius: 6px;
transition: all 0.3s ease;
.placeholder {
flex: 1;
font-size: 14px;
line-height: 18px;
color: #A8ABB2;
}
}
// +
.dropdown-toggle.active {
border-color: #678BFF;
box-shadow: 0 0 0 2px rgba(103, 139, 255, 0.1);
}
//
.arrow {
margin-left: 8px;
color: #999;
transition: transform 0.3s ease;
}
.dropdown-toggle.active .arrow {
transform: rotate(180deg);
}
//
.dropdown-menu {
position: absolute;
top: 100%; //
left: 0;
width: 100%;
border: 1px solid #678BFF;
max-height: 300px;
background-color: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border-radius: 0 0 8px 8px; //
z-index: 1000;
margin-top: 15px; //
overflow: visible;
&::before {
content: "";
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%) scaleY(0.5);
width: 30px;
height: 16px;
background: #fff;
clip-path: polygon(0 100%, 100% 100%, 50% 0);
z-index: 1001;
border: none; /* 移除原来的边框 */
}
&::after {
content: "";
position: absolute;
top: -9px; /* 比 ::before 往下一点,制造边框效果 */
left: 50%;
transform: translateX(-50%) scaleY(0.5);
width: 30px;
height: 16px;
background: #678BFF;
clip-path: polygon(0 100%, 100% 100%, 50% 0);
z-index: 1000;
}
}
//
.search {
position: sticky;
top: 0;
background-color: #FFFFFF;
z-index: 1002;
padding: 10px 14px 0px 10px;
}
// +
.search-input {
width: 100%;
height: 25px;
padding: 0 12px 0 5px;
/* 左侧留出图标空间 */
border: 1px solid #dcdfe6;
border-radius: 8px;
box-sizing: border-box;
background-color: #f8f9fa;
/* 浅灰背景匹配参考图 */
outline: none;
font-size: 12px;
transition: border-color 0.3s ease;
&::placeholder {
color: #909399;
}
&:hover {
border-color: #c0c4cc;
}
&:focus {
border-color: #678BFF;
}
}
//
.search-icon {
position: absolute;
top: 62%;
left: 50px;
transform: translateY(-50%);
color: #909399;
z-index: 1003;
}
// + hover
.clear-icon {
position: absolute;
top: 50%;
right: 20px;
transform: translateY(-50%);
color: #909399;
cursor: pointer;
z-index: 1003;
&:hover {
color: #606266;
}
}
//
.menuContent {
max-height: 200px;
/* 减去搜索框高度和尖角高度 */
overflow-y: auto;
padding: 8px;
padding: 10px 14px 12px 10px;
}
// + hover/
.dropdown-item {
width: 100%;
height: 25px;
padding: 5px 12px 5px 5px;
text-align: center;
cursor: pointer;
border: none;
border-radius: 8px;
background-color: #fff;
font-size: 12px;
margin: 5px 0;
color: #040A2D;
transition: all 0.2s ease;
&:hover {
background-color: #F3FAFE;
/* hover浅灰 */
}
&.selected {
background-color: #E5EBFE;
/* 选中浅蓝 */
color: #2741DE;
/* 选中文字蓝色 */
}
}
//
.menuContent::-webkit-scrollbar {
width: 6px;
}
.menuContent::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
.menuContent::-webkit-scrollbar-thumb {
background: #c0c4cc;
border-radius: 3px;
&:hover {
background: #909399;
}
}
</style>

39
src/views/moneyManage/receiveDetail/receiveDetail.vue

@ -169,7 +169,8 @@
<el-table-column v-if="kefu" fixed="right" prop="orderStatus" label="订单状态" width="100px" /> <el-table-column v-if="kefu" fixed="right" prop="orderStatus" label="订单状态" width="100px" />
<el-table-column fixed="right" label="操作" width="100px" v-if="activeTab != 'reject'"> <el-table-column fixed="right" label="操作" width="100px" v-if="activeTab != 'reject'">
<template #default=scope> <template #default=scope>
<span v-if="kefu && scope.row.orderStatus == '已通过'" style="color: #FA5A1E;" @click="openRecall('refund')">退款</span>
<span v-if="kefu && scope.row.orderStatus == '已通过'" style="color: #FA5A1E;"
@click="openRecall('refund')">退款</span>
<span v-else-if="kefu && scope.row.orderStatus == '已撤回'" style="color: #2741DE;" <span v-else-if="kefu && scope.row.orderStatus == '已撤回'" style="color: #2741DE;"
@click="openAddForm(scope.row)">编辑</span> @click="openAddForm(scope.row)">编辑</span>
<span v-else-if="kefu && scope.row.orderStatus == '待审核'" style="color: #FA5A1E;" <span v-else-if="kefu && scope.row.orderStatus == '待审核'" style="color: #FA5A1E;"
@ -229,9 +230,8 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="付款币种" required> <el-form-item label="付款币种" required>
<el-select placeholder="请选择付款币种" v-model="addFormData.moneyType" clearable>
<el-option v-for="item in payModel" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<CurrencySelect v-model="selectedCurrency" :items="customOptions" placeholder="请选择付款币种"
@change="handleCurrencyChange" />
</el-form-item> </el-form-item>
<el-form-item label="付款金额" required> <el-form-item label="付款金额" required>
<el-input v-model="addFormData.jwcode" placeholder="请输入付款金额" /> <el-input v-model="addFormData.jwcode" placeholder="请输入付款金额" />
@ -436,12 +436,12 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, watch } from 'vue';
import { ref, watch, computed } from 'vue';
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
import { color } from 'echarts'; import { color } from 'echarts';
import { template } from 'lodash'; import { template } from 'lodash';
import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
//==================== ========================= //==================== =========================
const activeTab = ref('wait') const activeTab = ref('wait')
@ -468,7 +468,6 @@ const checkCaiwu = () => {
} }
//================= ================== //================= ==================
const addFormData = ref({ const addFormData = ref({
}) })
const addFormisible = ref(false) const addFormisible = ref(false)
@ -476,7 +475,9 @@ const addFormisible = ref(false)
const uploadRef = ref() const uploadRef = ref()
const openAddForm = (row) => { const openAddForm = (row) => {
if (row) { if (row) {
addFormData.value = row
addFormData.value = { ...row };
} else {
addFormData.value = {}
} }
addFormisible.value = true addFormisible.value = true
} }
@ -484,16 +485,24 @@ const closeAddForm = () => {
addFormisible.value = false addFormisible.value = false
addFormData.value = {} addFormData.value = {}
} }
//
const selectedCurrency = ref('');
const customOptions = ref(['新币', '马币', '港币', '美元', '英镑', '越南盾']);
const handleCurrencyChange = (option) => {
console.log('选中的币种:', option);
};
// //
const textContent = ref('') const textContent = ref('')
const recallDialog = ref(false) const recallDialog = ref(false)
const openRecall = (val) => { const openRecall = (val) => {
console.log('打开弹窗',val);
console.log('打开弹窗', val);
if(val == 'refund'){
if (val == 'refund') {
textContent.value = '将要对该订单退款!' textContent.value = '将要对该订单退款!'
} }
if(val == 'recall'){
if (val == 'recall') {
textContent.value = '将要撤回该信息!' textContent.value = '将要撤回该信息!'
} }
recallDialog.value = true recallDialog.value = true
@ -833,7 +842,8 @@ const tableData = [
} }
.div-card2 { // card
.div-card2 {
// card
width: 100%; width: 100%;
margin-top: 2vh; margin-top: 2vh;
@ -1025,8 +1035,13 @@ const tableData = [
} }
} }
.moneyType {
position: relative;
width: 100%;
} }
}
.dialog-footer { .dialog-footer {
display: flex; display: flex;

Loading…
Cancel
Save