2 Commits

Author SHA1 Message Date
ZhangYong 58b4e1c618 产品选择组件 1 day ago
ZhangYong 3d98845145 新增付款币种组件 2 days ago
  1. 336
      src/components/MoneyManage/CurrencySelect.vue
  2. 121
      src/components/MoneyManage/ProductSelect.vue
  3. 61
      src/views/moneyManage/receiveDetail/receiveDetail.vue

336
src/components/MoneyManage/CurrencySelect.vue

@ -0,0 +1,336 @@
<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 v-show="!searchData" 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
searchData.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: 27px;
padding: 0 12px 0 5px;
/* 左侧留出图标空间 */
border: 1px solid #dcdfe6;
border-radius: 10px;
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: 62%;
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: 27px;
padding: 5px 12px 5px 5px;
text-align: center;
cursor: pointer;
border: none;
border-radius: 10px;
background-color: #fff;
font-size: 12px;
font-style: normal;
font-weight: 700;
line-height: 20px;
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>

121
src/components/MoneyManage/ProductSelect.vue

@ -0,0 +1,121 @@
<template>
<div class="productContent">
<div class="selectBox" @click="handelMenu" :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="menu" v-show="isOpen">
<div class="coin">
<div class="coinselect">
coin1
<span class="coin-arrow">
<el-icon>
<ArrowDown />
</el-icon>
</span>
</div>
<div class="coinoption">
coIn2
</div>
</div>
<div class="product">
22
</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 placeholder = ref('请选择产品')
const handelMenu = () => {
isOpen.value = !isOpen.value
}
</script>
<style scoped lang="scss">
.productContent {
position: relative;
width: 268px;
font-family: 'Arial', sans-serif;
}
.selectBox {
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;
}
}
//
.arrow {
margin-left: 8px;
color: #999;
transition: transform 0.3s ease;
}
.selectBox.active .arrow {
transform: rotate(180deg);
}
.menu {
position: absolute;
top: 100%; //
left: 0;
width: 130%;
max-height: 600px;
display: flex;
padding: 10px;
flex-direction: column;
align-items: flex-start;
gap: 10px;
flex-shrink: 0;
border-radius: 8px;
background: #E4F0FC;
box-shadow: 0 0 4px 0 #00000040;
z-index: 100;
.coin {
width: 100%;
.coinselect {
width: 100px;
height: 30px;
border: 1px solid #175BE5;
padding: 5px 0 5px 12px;
display: flex;
.coin-arrow {
margin-top: 8px;
color: #111;
}
}
}
}
</style>

61
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 fixed="right" label="操作" width="100px" v-if="activeTab != 'reject'">
<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;"
@click="openAddForm(scope.row)">编辑</span>
<span v-else-if="kefu && scope.row.orderStatus == '待审核'" style="color: #FA5A1E;"
@ -219,8 +220,7 @@
<el-input v-model="addFormData.jwcode" placeholder="请输入活动名称" />
</el-form-item>
<el-form-item label="产品名称" required>
<el-select placeholder="请选择产品名称" v-model="addFormData.rateName" clearable>
</el-select>
<ProductSelect></ProductSelect>
</el-form-item>
<el-form-item label="产品数量" required>
<div style="padding-right: 50px; display: flex;">
@ -229,15 +229,19 @@
</div>
</el-form-item>
<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="addFormData.moneytype" :items="customOptions" placeholder="请选择付款币种"
@change="handleCurrencyChange" />
</el-form-item>
<el-form-item label="付款金额" required>
<el-input v-model="addFormData.jwcode" placeholder="请输入付款金额" />
</el-form-item>
<el-form-item label="支付方式" required>
<el-select placeholder="请选择支付方式" clearable></el-select>
<CurrencySelect v-model="addFormData.paytype" :items="paytypeOptions" placeholder="请选择支付方式">
</CurrencySelect>
</el-form-item>
<el-form-item label="到账地区" required>
<CurrencySelect v-model="addFormData.MoneyAddress" :items="MoneyAddressOptions" placeholder="请选择支付方式">
</CurrencySelect>
</el-form-item>
<el-form-item label="付款时间" required>
<el-date-picker type="datetime" placement="right" v-model="addFormData.time"
@ -265,7 +269,7 @@
<span class="dialog-footer">
<el-button style="background-color: #7E91FF;" @click="closeAddForm">取消</el-button>
<el-button style="background-color: #2741DE; margin-left: 2.5vw;" type="primary"
@click="handleReject">确定</el-button>
@click="handleAddForm">确定</el-button>
</span>
</template>
</el-dialog>
@ -436,12 +440,13 @@
</div>
</template>
<script setup>
import { ref, watch } from 'vue';
import { ref, watch, computed } from 'vue';
import { ElMessage } from 'element-plus'
import API from '@/util/http.js'
import { color } from 'echarts';
import { template } from 'lodash';
import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
import ProductSelect from '@/components/MoneyManage/ProductSelect.vue'
//==================== =========================
const activeTab = ref('wait')
@ -468,7 +473,6 @@ const checkCaiwu = () => {
}
//================= ==================
const addFormData = ref({
})
const addFormisible = ref(false)
@ -476,7 +480,9 @@ const addFormisible = ref(false)
const uploadRef = ref()
const openAddForm = (row) => {
if (row) {
addFormData.value = row
addFormData.value = { ...row };
} else {
addFormData.value = {}
}
addFormisible.value = true
}
@ -484,16 +490,33 @@ const closeAddForm = () => {
addFormisible.value = false
addFormData.value = {}
}
const handleAddForm = () => {
console.log('客服新增的数据', addFormData.value);
}
//
const selectedCurrency = ref('');
const customOptions = ref(['新币', '马币', '港币', '美元', '英镑', '越南盾']);
//
const paytypeOptions = ref(["银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal", "Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款"])
const MoneyAddressOptions = ref(['马来西亚','香港','新加坡'])
const handleCurrencyChange = (option) => {
console.log('选中的币种:', option);
};
//
const textContent = ref('')
const recallDialog = ref(false)
const openRecall = (val) => {
console.log('打开弹窗',val);
console.log('打开弹窗', val);
if(val == 'refund'){
if (val == 'refund') {
textContent.value = '将要对该订单退款!'
}
if(val == 'recall'){
if (val == 'recall') {
textContent.value = '将要撤回该信息!'
}
recallDialog.value = true
@ -833,7 +856,8 @@ const tableData = [
}
.div-card2 { // card
.div-card2 {
// card
width: 100%;
margin-top: 2vh;
@ -1025,7 +1049,12 @@ const tableData = [
}
}
.moneyType {
position: relative;
width: 100%;
}
}
.dialog-footer {

Loading…
Cancel
Save