1.优化会员扫码充值订单状态查询

This commit is contained in:
gyq
2025-03-14 17:27:00 +08:00
parent 745b8675ea
commit d08a629b0a
15 changed files with 254 additions and 257 deletions

View File

@@ -203,13 +203,15 @@
<el-dialog v-model="showPackModal" title="打包数量" @open="packModalOpen" width="350">
<div class="dialog">
<div class="el-popover__title content">
<el-form ref="packNumerFormRef" :model="packNumberForm" :rules="packNumberFormRules" label-width="60px"
<el-form ref="packNumerFormRef" :model="packNumberForm" :rules="packNumberFormRules" label-width="100px"
label-position="left">
<el-form-item label="数量" prop="number">
<el-input v-model="packNumberForm.number"
<el-form-item :label="`数量${packItem.unitName}`" prop="number">
<!-- <el-input v-model="packNumberForm.number"
:placeholder="`最多输入${+packItem.number}${packItem.unitName}`" @input="packNumberInput">
<template #append>{{ packItem.unitName }}</template>
</el-input>
<template #append></template>
</el-input> -->
<el-input-number v-model="packNumberForm.number" :min="1"
:max="+packItem.number"></el-input-number>
</el-form-item>
</el-form>
</div>
@@ -347,12 +349,17 @@ async function returnOrderItemAjax(num = 1) {
function packHandle() {
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
if (item && item.id) {
if (item.number > 1) {
// 大于1时需要编辑
showPackModal.value = true
if (!item.pack_number || item.pack_number <= 0) {
if (item.number > 1) {
// 大于1时需要编辑
showPackModal.value = true
} else {
// 小于1时直接提交
goodsStore.operateCart({ ...item, pack_number: item.number }, 'edit')
}
} else {
// 小于1时直接提交
goodsStore.operateCart({ ...item, pack_number: item.number }, 'edit')
// 取消打包
goodsStore.operateCart({ ...item, pack_number: 0 }, 'edit')
}
}
}
@@ -576,14 +583,9 @@ function validatePackNumber(rule, value, callback) {
}
}
function packNumberInput(e) {
setTimeout(() => {
packNumberForm.value.number = inputFilterFloat(e)
}, 50)
}
// modal打开时
function packModalOpen() {
packNumberForm.value.number = 1
packItem.value = goodsStore.cartList[goodsStore.cartActiveIndex]
}
@@ -616,6 +618,10 @@ function packFormSubmit() {
background-color: #efefef;
border-radius: 6px;
&:active {
background-color: #d3d3d3;
}
&.disabled {
.t {

View File

@@ -31,8 +31,8 @@ const dialogVisible = ref(false)
// 恢复挂单
async function select(item) {
await goodsStore.recoverPending(item)
dialogVisible.value = false
await goodsStore.recoverPending(item)
}
function show() {

View File

@@ -190,7 +190,10 @@ async function printOrderLable(isBefore = false) {
if (printStore.deviceNoteList.length) {
// 使用本地打印机打印
const data = await getOrderByIdAjax(goodsStore.orderListInfo.id);
printStore.labelPrint(commOrderPrintData(data))
if (!isBefore) {
// 预结算不打印标签
printStore.labelPrint(commOrderPrintData(data))
}
printStore.pushReceiptData(commOrderPrintData({ ...data, isBefore: isBefore }));
} else {
// 本地没有可用打印机使用云打印机

View File

@@ -225,7 +225,7 @@ const createOrderLoading = ref(false);
function selectUser(row) {
goodsStore.vipUserInfo = { ...row }
if (store.shopInfo.isMemberPrice && row.isVip) {
goodsStore.showVipPrice = true
goodsStore.showVipPrice = 1
goodsStore.calcCartInfo()
}
}
@@ -339,7 +339,7 @@ function showTableMerging() {
// 清除会员与会员价
function clearVipUserHandle() {
goodsStore.vipUserInfo = ''
goodsStore.showVipPrice = false
goodsStore.showVipPrice = 0
goodsStore.calcCartInfo()
}
</script>

View File

@@ -17,9 +17,9 @@
<div class="btm" style="width: 80px;">
<el-button type="primary"
v-if="item.bizCode == 'cashIn' || item.bizCode == 'wechatIn' || item.bizCode == 'alipayIn'"
@click="showRefundHandle(item)" :disabled="item.refundAmount > 0">
<template v-if="item.refundAmount == 0">退款</template>
<template v-if="item.refundAmount > 0">已退</template>
@click="showRefundHandle(item)" :disabled="item.amount == item.refundAmount">
<template v-if="item.refundAmount < item.amount">退款</template>
<template v-if="item.amount == item.refundAmount">已退</template>
</el-button>
</div>
</div>
@@ -221,7 +221,7 @@ async function passwordSuccess(e = '') {
showDialog.value = false
loading.value = false
emits('refund')
// memberqueryMemberAccountAjax()
memberqueryMemberAccountAjax()
} catch (error) {
loading.value = false
console.log(error);

View File

@@ -31,7 +31,7 @@
</template>
</el-table-column>
<el-table-column label="手机" prop="phone" width="150"></el-table-column>
<el-table-column label="性别" prop="sex" width="80">
<el-table-column label="性别" prop="sex">
<template v-slot="scope">
{{ scope.row.sex == 1 ? '' : '' }}
</template>

View File

@@ -4,34 +4,34 @@
<h4>订单号{{ item.orderNo }}</h4>
</template>
<template #default>
<div class="order_info">
<!-- <div class="row"><span>订单类型</span>{{ filterLable('orderType', item.orderType) }}</div>
<!-- <div class="order_info">
<div class="row"><span>订单类型</span>{{ filterLable('orderType', item.orderType) }}</div>
<div class="row"><span>平台类型</span>{{ filterLable('platformType', item.platformType) }}</div>
<div class="row"><span>用餐模式</span>{{ filterLable('dineMode', item.dineMode) }}</div>
<div class="row"><span>订单备注</span>{{ item.remark }}</div> -->
<!-- <div class="row"><span>支付类型</span>{{ filterLable('payType', item.payType) }}</div>
<div class="row"><span>订单备注</span>{{ item.remark }}</div>
<div class="row"><span>支付类型</span>{{ filterLable('payType', item.payType) }}</div>
<div class="row"><span>支付单号</span>{{ item.payOrderNo }}</div>
<div class="row"><span>支付金额</span>{{ item.payAmount }}</div>
<div class="row"><span>支付时间</span>{{ item.paidTime }}</div>
<div class="row"><span>订单金额含折扣</span>{{ item.orderAmount }}</div>
<div class="row"><span>订单原金额不含折扣</span>{{ item.originAmount }}</div> -->
</div>
<div class="row"><span>订单原金额不含折扣</span>{{ item.originAmount }}</div>
</div> -->
<div class="table">
<div class="tab_head">
<el-radio-group v-model="refundType" @change="refundTypeChange">
<el-radio-button label="整单退" :value="1" />
<el-radio-button label="部分退" :value="2" />
<el-radio-button label="自定义" :value="3" />
<!-- <el-radio-button label="自定义" :value="3" /> -->
</el-radio-group>
<div class="amount">
<el-input v-model="customAmount" v-if="refundType == 3" style="width: 370px;height: 42px;"
placeholder="请输入退款金额" @input="inputChange">
<el-input v-model="refundAmount" style="width: 370px;height: 42px;" placeholder="请输入退款金额"
@input="inputChange">
<template #prepend></template>
<template #append>最多可退{{ formatDecimal(item.payAmount - item.refundAmount, 2) }}</template>
</el-input>
<template v-else>
<!-- <template>
退款金额{{ formatDecimal(refundType == 1 ? item.originAmount - item.refundAmount : amount) }}
</template>
</template> -->
</div>
</div>
<el-table ref="tableRef" :data="item.onGoods" brder stripe @selection-change="tabSelectChange">
@@ -45,7 +45,7 @@
<span>{{ scope.row.productName }}</span>
</div>
<div class="sku" v-if="scope.row.skuName">{{ scope.row.skuName }}</div>
<div class="sku">{{ formatDecimal(+scope.row.payAmount) }}</div>
<div class="sku">{{ formatDecimal(+scope.row.unitPrice) }}</div>
</div>
</div>
</template>
@@ -58,7 +58,8 @@
</el-table-column>
<el-table-column label="退款数量" width="170">
<template v-slot="scope">
<el-input-number v-model="scope.row.refund_number" :min="1" :max="scope.row.num"
<el-input-number v-model="scope.row.refund_number" :disabled="refundType == 1" :min="0"
:max="formatDecimal(scope.row.num - scope.row.refundNum - scope.row.returnNum, 2, true)"
style="width: 130px;" @change="numberChange">
</el-input-number>
</template>
@@ -76,7 +77,7 @@
<span>{{ scope.row.productName }}</span>
</div>
<div class="sku" v-if="scope.row.skuName">{{ scope.row.skuName }}</div>
<div class="sku">{{ formatDecimal(+scope.row.payAmount) }}</div>
<div class="sku">{{ formatDecimal(+scope.row.unitPrice) }}</div>
</div>
</div>
</template>
@@ -98,7 +99,7 @@
</el-table>
</template>
<div class="ipt">
<el-input type="textarea" rows="4" v-model="remark" placeholder="请输入退单原因" />
<el-input type="textarea" :rows="4" v-model="remark" placeholder="请输入退单原因" />
</div>
<div class="remark_tag">
<div class="item" v-for="(item, index) in remarkTagList" :key="index" @click="addRmarkHandle(item)">
@@ -122,6 +123,7 @@
</template>
<script setup>
import _ from 'lodash'
import { ref } from 'vue'
import { useGlobal } from '@/store/global.js'
import { formatDecimal, inputFilterFloat } from "@/utils/index.js";
@@ -140,8 +142,7 @@ const isShow = ref(false)
const item = ref({})
const tableRef = ref(null)
const modify = ref(false)
const amount = ref(0)
const customAmount = ref('')
const refundAmount = ref('')
const refundType = ref(1)
const remark = ref('')
const remarkTagList = ref([
@@ -166,11 +167,7 @@ function handleRefund() {
async function refundHandle(cash = false) {
try {
let rows = tableRef.value.getSelectionRows()
if (refundType.value == 1) {
tableRef.value.clearSelection()
tableRef.value.toggleAllSelection()
} else if (refundType.value == 2) {
if (refundType.value == 2) {
if (!rows.length) {
ElNotification({
title: '错误',
@@ -179,15 +176,24 @@ async function refundHandle(cash = false) {
})
return
}
} else if (refundType.value == 3) {
if (!customAmount.value) {
ElNotification({
title: '错误',
message: '请请输入退款金额',
type: 'error',
})
return
}
}
if (!refundAmount.value) {
ElNotification({
title: '错误',
message: '请请输入退款金额',
type: 'error',
})
return
}
if (!remark.value) {
ElNotification({
title: '错误',
message: '请请输入退款原因',
type: 'error',
})
return
}
let refundDetails = []
@@ -201,22 +207,7 @@ async function refundHandle(cash = false) {
})
}
let refundAmount = ''
switch (refundType.value) {
case 1:
refundAmount = item.value.orderAmount
break;
case 2:
refundAmount = amount.value
break;
case 3:
refundAmount = customAmount.value
break;
default:
break;
}
if (refundAmount <= 0) {
if (refundAmount.value <= 0) {
ElNotification({
title: '错误',
message: '无可退金额',
@@ -227,7 +218,7 @@ async function refundHandle(cash = false) {
let data = {
orderId: item.value.id,
refundAmount: refundAmount,
refundAmount: formatDecimal(+refundAmount.value),
modify: modify.value,
cash: cash,
refundReason: remark.value,
@@ -259,7 +250,7 @@ async function printRefund(rows) {
shop_name: store.shopInfo.shopName,
loginAccount: store.userInfo.name,
carts: [],
amount: item.value.orderAmount,
amount: formatDecimal(+refundAmount.value),
remark: item.value.remark,
orderInfo: item.value,
outNumber: item.value.id,
@@ -273,8 +264,8 @@ async function printRefund(rows) {
name: item.productName,
number: item.num,
skuName: item.skuName,
salePrice: formatDecimal(item.payAmount / item.num),
totalAmount: formatDecimal(item.payAmount)
salePrice: formatDecimal(+item.unitPrice),
totalAmount: formatDecimal(+item.payAmount)
}
)
})
@@ -301,12 +292,18 @@ function numberChange() {
}
// 选择退款项
function tabSelectChange(val) {
amount.value = 0
const tabSelectChange = _.debounce(function (val) {
refundAmount.value = ''
let num = 0
val.map(item => {
amount.value += item.refund_number * item.payAmount
if ((+item.refundNum + +item.returnNum) < item.num) {
num += item.refund_number * item.unitPrice
}
})
}
if (num) {
refundAmount.value = formatDecimal(num)
}
}, 100)
// 禁用所有行的选择
const selectable = (row, index) => {
@@ -316,23 +313,26 @@ const selectable = (row, index) => {
// 初始化抽屉
function resetDrawer() {
modify.value = false
amount.value = 0
customAmount.value = ''
refundAmount.value = ''
refundType.value = 1
remark.value = ''
}
function show(row) {
resetDrawer()
isShow.value = true
item.value = { ...row }
let newRow = { ...row }
remark.value = ''
let onGoods = []
let returnGoods = []
item.value.goods.map(item => {
newRow.goods.map(item => {
// 可退的最大数量,下单数量 - 已退数量 - 退菜数量
let refundMaxNum = item.num - item.refundNum - item.returnNum
if (refundMaxNum <= 0) {
item.refund_number = item.num
// 已经退过,不在允许操作
returnGoods.push(item)
} else {
@@ -342,13 +342,10 @@ function show(row) {
}
})
item.value.onGoods = onGoods
item.value.returnGoods = returnGoods
newRow.onGoods = onGoods
newRow.returnGoods = returnGoods
console.log('item.value===', item.value);
resetDrawer()
item.value = newRow
setTimeout(() => {
tableRef.value.clearSelection()
@@ -372,16 +369,20 @@ function refundTypeChange(val) {
case 1:
modify.value = false
// tableRef.value.toggleAllSelection()
// 遍历数据,将每一行设置为选中状态
item.value.goods.forEach((row) => {
item.value.onGoods.forEach((row) => {
tableRef.value.toggleRowSelection(row, true);
});
break;
case 2:
modify.value = false
tableRef.value.clearSelection()
if (item.value.onGoods.length == 1) {
item.value.onGoods.forEach((row) => {
tableRef.value.toggleRowSelection(row, true);
});
} else {
tableRef.value.clearSelection()
}
break;
case 3:
modify.value = true
@@ -392,15 +393,13 @@ function refundTypeChange(val) {
}
// 自定义退款金额输入
function inputChange(n) {
setTimeout(() => {
if (n > item.value.payAmount - item.value.refundAmount) {
customAmount.value = formatDecimal(item.value.payAmount - item.value.refundAmount, 2)
} else {
customAmount.value = inputFilterFloat(n)
}
}, 100)
}
const inputChange = _.debounce(function (n) {
if (n > item.value.payAmount - item.value.refundAmount) {
refundAmount.value = formatDecimal(item.value.payAmount - item.value.refundAmount, 2)
} else {
refundAmount.value = inputFilterFloat(n)
}
}, 300)
// 添加备注
function addRmarkHandle(item) {

View File

@@ -17,7 +17,7 @@
<div class="table_wrap">
<div class="table">
<el-table :data="tableData.list" v-loading="tableData.loading" border strip height="100%">
<el-table-column label="台桌" prop="tableName" width="80" align="center">
<el-table-column label="台桌" prop="tableName" align="center">
<template v-slot="scope">
<span v-if="scope.row.tableName">{{ scope.row.tableName }}</span>
<span v-else></span>
@@ -76,11 +76,31 @@
<div class="column">
<div class="row">
<el-button type="warning" :disabled="scope.row.status != 'unpaid'" :loading="scope.row.payLoading"
@click="orderDoneHandle(scope.row)">结算订单</el-button>
@click="orderDoneHandle(scope.row)">
<template v-if="scope.row.status == 'unpaid'">
结算订单
</template>
<template v-else>
订单完成
</template>
</el-button>
</div>
<div class="row">
<el-button type="primary" :disabled="refundState(scope.row.status)"
@click="RefundDrawerRef.show(scope.row)">订单退款</el-button>
<el-button type="primary" :disabled="refundState(scope.row)" @click="RefundDrawerRef.show(scope.row)">
<template v-if="scope.row.status == 'done'">
订单退款
</template>
<template
v-else-if="scope.row.status == 'part_refund' || (scope.row.status == 'refund' && scope.row.refundAmount < scope.row.payAmount)">
部分退单
</template>
<template v-else-if="scope.row.status == 'refund'">
已退订单
</template>
<template v-else>
不可退单
</template>
</el-button>
</div>
<div class="row">
<el-button type="success" @click="PrintDrawerRef.show(scope.row)">
@@ -173,8 +193,8 @@ function filterLable(key, type) {
}
// 过滤退款条件
function refundState(state) {
switch (state) {
function refundState(row) {
switch (row.status) {
case 'unpaid':
return true;
case 'in-production':
@@ -186,7 +206,11 @@ function refundState(state) {
case 'refunding':
return false;
case 'refund':
return true;
if (row.refundAmount < row.payAmount) {
return false
} else {
return true;
}
case 'part-refund':
return false;
case 'cancelled':