diff --git a/src/views/refund/gold/addCoinRefund.vue b/src/views/refund/gold/addCoinRefund.vue index 71a96ef..1795349 100644 --- a/src/views/refund/gold/addCoinRefund.vue +++ b/src/views/refund/gold/addCoinRefund.vue @@ -3,26 +3,24 @@ import { computed, onMounted, reactive, ref, watch } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import API from '@/util/http.js' 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({ 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 = () => { if (addRefund.value.jwcode) { @@ -63,8 +61,8 @@ const cancel = function () { addRe.value.typeR = '0' } -const show = function(){ - console.log('===================================',addRefund.value.refundType) +const show = function () { + console.log('===================================', addRefund.value.refundType) } // 这是添加退款信息的接口 const add = async function () { @@ -281,19 +279,25 @@ const getGoods = async function (jwcode) { orderCodes.value = [] return; } - console.log('=======================',addRefund.value.refundType) + console.log('=======================', addRefund.value.refundType) if (addRefund.value.refundType === '商品退款') { - addRefund.value.type = 1 - } else { - addRefund.value.type = 0 - } + addRefund.value.type = 1 + } else { + addRefund.value.type = 0 + } try { const result = await API({ 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)) { // 存储完整商品数据 @@ -459,14 +463,13 @@ watch(calculatedRechargeGoods, (newVal) => { addRefund.value.sumGold = 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() -})