|
@ -3,26 +3,24 @@ import { computed, onMounted, reactive, ref, watch } from 'vue' |
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
import API from '@/util/http.js' |
|
|
import API from '@/util/http.js' |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
// import _ from 'lodash' |
|
|
|
|
|
|
|
|
import {useAdminStore} from "@/store/index.js"; |
|
|
|
|
|
import {storeToRefs} from "pinia"; |
|
|
|
|
|
import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" |
|
|
|
|
|
import { ta } from 'element-plus/es/locales.mjs'; |
|
|
|
|
|
|
|
|
|
|
|
const adminStore = useAdminStore(); |
|
|
|
|
|
const {adminData, menuTree} = storeToRefs(adminStore); |
|
|
|
|
|
|
|
|
const addRe = ref({ |
|
|
const addRe = ref({ |
|
|
typeR: '0' |
|
|
typeR: '0' |
|
|
}) |
|
|
}) |
|
|
|
|
|
const tableData = ref([]) |
|
|
|
|
|
const pagination = ref({ |
|
|
|
|
|
pageNum: 1, |
|
|
|
|
|
pageSize: 10, |
|
|
|
|
|
total: 0 |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这是获取用户信息的接口 |
|
|
|
|
|
const adminData = ref({}) |
|
|
|
|
|
const getAdminData = async function () { |
|
|
|
|
|
try { |
|
|
|
|
|
const result = await API({ url: '/admin/userinfo', data: {} }) |
|
|
|
|
|
adminData.value = result |
|
|
|
|
|
addRefund.value.adminId = adminData.value.id |
|
|
|
|
|
console.log('请求成功', result) |
|
|
|
|
|
console.log('用户信息', user.value) |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.log('请求失败', error) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 精网号去空格 |
|
|
// 精网号去空格 |
|
|
const trimJwCode = () => { |
|
|
const trimJwCode = () => { |
|
|
if (addRefund.value.jwcode) { |
|
|
if (addRefund.value.jwcode) { |
|
@ -41,8 +39,8 @@ const addRefund = ref({ |
|
|
sumGold: 0, |
|
|
sumGold: 0, |
|
|
remark: '', |
|
|
remark: '', |
|
|
adminId: null, |
|
|
adminId: null, |
|
|
orderCode: '' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderCode: '', |
|
|
|
|
|
type: 0 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 取消按钮 |
|
|
// 取消按钮 |
|
@ -63,15 +61,20 @@ const cancel = function () { |
|
|
addRe.value.typeR = '0' |
|
|
addRe.value.typeR = '0' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const show = function () { |
|
|
|
|
|
console.log('===================================', addRefund.value.refundType) |
|
|
|
|
|
} |
|
|
// 这是添加退款信息的接口 |
|
|
// 这是添加退款信息的接口 |
|
|
const add = async function () { |
|
|
const add = async function () { |
|
|
try { |
|
|
try { |
|
|
|
|
|
|
|
|
// 更新 refundModel |
|
|
// 更新 refundModel |
|
|
addRefund.value.refundModel = parseInt(addRe.value.typeR); |
|
|
addRefund.value.refundModel = parseInt(addRe.value.typeR); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addRefund.value.refundType === '商品退款') { |
|
|
|
|
|
addRefund.value.type = 1 |
|
|
|
|
|
} else { |
|
|
|
|
|
addRefund.value.type = 0 |
|
|
|
|
|
} |
|
|
// 对提交的金币数乘以 100 |
|
|
// 对提交的金币数乘以 100 |
|
|
const processedRefund = { |
|
|
const processedRefund = { |
|
|
...addRefund.value, |
|
|
...addRefund.value, |
|
@ -86,6 +89,7 @@ const add = async function () { |
|
|
url: '/refund/add', |
|
|
url: '/refund/add', |
|
|
data: processedRefund |
|
|
data: processedRefund |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
addDisabled.value = false |
|
|
addDisabled.value = false |
|
|
if (result.code === 0) { |
|
|
if (result.code === 0) { |
|
|
ElMessage.error(result.msg) |
|
|
ElMessage.error(result.msg) |
|
@ -254,30 +258,10 @@ const getUser = async function (jwcode) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 退款类型,写死为商品退款 |
|
|
// 退款类型,写死为商品退款 |
|
|
const refundType = ref([{ value: '商品退款', label: '商品退款' }]); |
|
|
|
|
|
|
|
|
|
|
|
// 获取退款类型 |
|
|
|
|
|
// const getRefundTypes = async function () { |
|
|
|
|
|
// try { |
|
|
|
|
|
// // 发送请求获取退款类型 |
|
|
|
|
|
// const result = await API({ |
|
|
|
|
|
// url: '/refund/refundType', //这里应该写上一个退款类型的接口 |
|
|
|
|
|
// data: {} }) |
|
|
|
|
|
// console.log('退款类型请求成功', result) |
|
|
|
|
|
// // 检查返回的数据是否为数组 |
|
|
|
|
|
// if (Array.isArray(result.data)) { |
|
|
|
|
|
// // 将字符串数组转换为 { value, label } 格式 |
|
|
|
|
|
// refundType.value = result.data.map(item => ({ value: item, label: item })); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// console.error('退款类型数据格式错误', result) |
|
|
|
|
|
// ElMessage.error('退款类型数据格式错误,请联系管理员') |
|
|
|
|
|
// } |
|
|
|
|
|
// console.log('退款类型', refundType.value) |
|
|
|
|
|
// } catch (error) { |
|
|
|
|
|
// console.log('退款类型请求失败', error) |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const refundType = ref([ |
|
|
|
|
|
{ value: '商品退款', label: '商品退款' }, |
|
|
|
|
|
{ value: '金币退款', label: '金币退款' } |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
// 根据精网号查询商品 |
|
|
// 根据精网号查询商品 |
|
|
const goodsName = ref([]) // 存储所有商品信息 |
|
|
const goodsName = ref([]) // 存储所有商品信息 |
|
@ -295,12 +279,25 @@ const getGoods = async function (jwcode) { |
|
|
orderCodes.value = [] |
|
|
orderCodes.value = [] |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log('=======================', addRefund.value.refundType) |
|
|
|
|
|
if (addRefund.value.refundType === '商品退款') { |
|
|
|
|
|
addRefund.value.type = 1 |
|
|
|
|
|
} else { |
|
|
|
|
|
addRefund.value.type = 0 |
|
|
|
|
|
} |
|
|
try { |
|
|
try { |
|
|
const result = await API({ |
|
|
const result = await API({ |
|
|
url: '/refund/selectGoods', |
|
|
url: '/refund/selectGoods', |
|
|
data: { jwcode: addRefund.value.jwcode } |
|
|
|
|
|
|
|
|
data: { |
|
|
|
|
|
jwcode: addRefund.value.jwcode, |
|
|
|
|
|
type: addRefund.value.type |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
tableData.value = result.data |
|
|
|
|
|
if (result.data.length === 0) { |
|
|
|
|
|
ElMessage.error('该用户没有商品订单') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (Array.isArray(result.data)) { |
|
|
if (Array.isArray(result.data)) { |
|
|
// 存储完整商品数据 |
|
|
// 存储完整商品数据 |
|
@ -466,29 +463,29 @@ watch(calculatedRechargeGoods, (newVal) => { |
|
|
addRefund.value.sumGold = newVal |
|
|
addRefund.value.sumGold = newVal |
|
|
console.log('计算的总金币', newVal) |
|
|
console.log('计算的总金币', newVal) |
|
|
}) |
|
|
}) |
|
|
|
|
|
const handlePageSizeChange = function (val) { |
|
|
|
|
|
pagination.value.pageSize = val |
|
|
|
|
|
} |
|
|
|
|
|
const handleCurrentChange = function (val) { |
|
|
|
|
|
pagination.value.pageNum = val |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 挂载 |
|
|
|
|
|
onMounted(async function () { |
|
|
|
|
|
await getAdminData() |
|
|
|
|
|
// await getRefundTypes() |
|
|
|
|
|
// await getGoods() |
|
|
|
|
|
}) |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<div> |
|
|
|
|
|
|
|
|
<div class="father"> |
|
|
<div class="userAndForm"> |
|
|
<div class="userAndForm"> |
|
|
<div class="left"> |
|
|
<div class="left"> |
|
|
<el-form :model="addRefund" ref="Ref" :rules="rules" label-width="auto" label-position="right" |
|
|
<el-form :model="addRefund" ref="Ref" :rules="rules" label-width="auto" label-position="right" |
|
|
style="min-width: 420px" class="add-form"> |
|
|
style="min-width: 420px" class="add-form"> |
|
|
<el-form-item prop="jwcode" label="精网号"> |
|
|
<el-form-item prop="jwcode" label="精网号"> |
|
|
<el-input v-model="addRefund.jwcode" style="width: 220px" @change="getGoods(addRefund.jwcode)" /> |
|
|
|
|
|
|
|
|
<el-input v-model="addRefund.jwcode" style="width: 220px" /> |
|
|
<el-button type="primary" @click="getUser(addRefund.jwcode)" style="margin-left: 20px">查询 |
|
|
<el-button type="primary" @click="getUser(addRefund.jwcode)" style="margin-left: 20px">查询 |
|
|
</el-button> |
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item prop="refundType" label="退款类型"> |
|
|
|
|
|
<el-select v-model="addRefund.refundType" placeholder="请选择" style="width: 220px"> |
|
|
|
|
|
|
|
|
<el-form-item prop="refundType" label="退款类型" @change="show"> |
|
|
|
|
|
<el-select v-model="addRefund.refundType" placeholder="请选择" style="width: 220px" |
|
|
|
|
|
@change="getGoods(addRefund.jwcode)"> |
|
|
<el-option v-for="item in refundType" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
<el-option v-for="item in refundType" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -549,15 +546,17 @@ onMounted(async function () { |
|
|
<el-button type="primary" :disabled="addDisabled" @click="addBefore"> 提交</el-button> |
|
|
<el-button type="primary" :disabled="addDisabled" @click="addBefore"> 提交</el-button> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="right"> |
|
|
<div class="right"> |
|
|
|
|
|
<div class="right-up"> |
|
|
<!-- 客户信息栏 --> |
|
|
<!-- 客户信息栏 --> |
|
|
<el-card v-if="user.jwcode" style="width: 800px; float: right" class="customer-info"> |
|
|
|
|
|
|
|
|
<el-card v-if="user.jwcode" class="customer-info"> |
|
|
<el-form :model="user" label-width="auto" style="max-width: 1000px" label-position="left"> |
|
|
<el-form :model="user" label-width="auto" style="max-width: 1000px" label-position="left"> |
|
|
<el-text size="large" style="margin-left: 20px">客户信息</el-text> |
|
|
|
|
|
|
|
|
<el-text size="large" style="padding:30%; ">客户信息</el-text> |
|
|
|
|
|
|
|
|
<!-- 第一行:姓名 + 历史金币 --> |
|
|
<!-- 第一行:姓名 + 历史金币 --> |
|
|
<el-row style="margin-top: 20px"> |
|
|
|
|
|
|
|
|
<el-row style="margin-top: 10px;height:5vh;"> |
|
|
<el-col :span="9"> |
|
|
<el-col :span="9"> |
|
|
<el-form-item label="姓名"> |
|
|
<el-form-item label="姓名"> |
|
|
<p>{{ user.name }}</p> |
|
|
<p>{{ user.name }}</p> |
|
@ -581,7 +580,7 @@ onMounted(async function () { |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<!-- 第二行:精网号 + 当前金币(独立行) --> |
|
|
<!-- 第二行:精网号 + 当前金币(独立行) --> |
|
|
<el-row> |
|
|
|
|
|
|
|
|
<el-row style="margin-top: 1px;height:5vh;"> |
|
|
<el-col :span="9"> |
|
|
<el-col :span="9"> |
|
|
<el-form-item label="精网号"> |
|
|
<el-form-item label="精网号"> |
|
|
<p>{{ user.jwcode }}</p> |
|
|
<p>{{ user.jwcode }}</p> |
|
@ -597,20 +596,8 @@ onMounted(async function () { |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<!-- 第三行:首次充值日期 + 充值次数 --> |
|
|
|
|
|
<!-- <el-row > |
|
|
|
|
|
<el-col :span="9"> |
|
|
|
|
|
<el-form-item label="首次充值日期"> |
|
|
|
|
|
<p v-if="user.firstRecharge"> |
|
|
|
|
|
{{ moment(user.firstRecharge).format('YYYY-MM-DD HH:mm:ss') }} |
|
|
|
|
|
</p> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
|
|
</el-row> --> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 第四行:消费次数 + 所属门店 --> |
|
|
<!-- 第四行:消费次数 + 所属门店 --> |
|
|
<el-row> |
|
|
|
|
|
|
|
|
<el-row style="margin-top: 1px;height:3vh;"> |
|
|
<el-col :span="9"> |
|
|
<el-col :span="9"> |
|
|
<el-form-item label="所属门店"> |
|
|
<el-form-item label="所属门店"> |
|
|
<p>{{ user.market }}</p> |
|
|
<p>{{ user.market }}</p> |
|
@ -621,9 +608,42 @@ onMounted(async function () { |
|
|
</el-card> |
|
|
</el-card> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="right-down"> |
|
|
|
|
|
<el-card class="card" v-if="tableData.length > 0"> |
|
|
|
|
|
<el-table :data="tableData" style="height:43vh;width:50vw"> |
|
|
|
|
|
<el-table-column type="index" label="序号" width="60" /> |
|
|
|
|
|
<el-table-column prop="type" label="类型" width="120" > |
|
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
|
{{ row.orderCode.slice(3, 5) === 'CZ' ? '充值' : '消费' }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column prop="goodsName" label="商品名称" width="120" /> |
|
|
|
|
|
<el-table-column prop="orderCode" label="订单号" width="240px" show-overflow-tooltip /> |
|
|
|
|
|
<el-table-column prop="permanentGold" label="永久金币" width="120"> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
|
{{ row.permanentGold / 100 }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column prop="freeGold" label="免费金币" width="120"> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
|
{{ (row.freeGold) / 100 }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column prop="taskGold" label="任务金币" width="120"> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
|
{{ row.taskGold / 100 }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column prop="isRefund" label="订单状态" width="120" /> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
<el-pagination class="pagination" v-model:current-page="pagination.pageNum" |
|
|
|
|
|
v-model:page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" |
|
|
|
|
|
:total="pagination.total" @size-change="handlePageSizeChange" |
|
|
|
|
|
@current-change="handleCurrentChange"></el-pagination> |
|
|
|
|
|
</el-card> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
<style scoped lang="scss"> |
|
@ -631,13 +651,19 @@ p { |
|
|
margin: 0px; |
|
|
margin: 0px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.father { |
|
|
|
|
|
width: 75vw; |
|
|
|
|
|
height: 70vh; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.userAndForm { |
|
|
.userAndForm { |
|
|
width: 1150px; |
|
|
|
|
|
|
|
|
width: 25vw; |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
display: flex; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.left { |
|
|
|
|
|
|
|
|
.left { |
|
|
width: 35%; |
|
|
width: 35%; |
|
|
display: flex; |
|
|
display: flex; |
|
|
|
|
|
|
|
@ -645,21 +671,32 @@ p { |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
margin-top: 50px; |
|
|
margin-top: 50px; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.right { |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
margin-left: 20px; |
|
|
|
|
|
|
|
|
.right-up { |
|
|
|
|
|
width: 35vw; |
|
|
|
|
|
height: 20vh; |
|
|
display: flex; |
|
|
display: flex; |
|
|
|
|
|
|
|
|
.customer-info { |
|
|
.customer-info { |
|
|
width: 90%; |
|
|
width: 90%; |
|
|
display: flex; |
|
|
display: flex; |
|
|
margin-left: 20px; |
|
|
|
|
|
justify-content: center; |
|
|
justify-content: center; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
padding: 0 10px; |
|
|
padding: 0 10px; |
|
|
|
|
|
margin-left: 5vw; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.card { |
|
|
|
|
|
width: 50vw; |
|
|
|
|
|
height: 50vh; |
|
|
|
|
|
margin-left: 5vw; |
|
|
|
|
|
margin-top: 1vh; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.pagination { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
margin-top: 0.5vh; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |