优化打印 优化退单
This commit is contained in:
parent
d08a629b0a
commit
64f539623f
|
|
@ -220,3 +220,16 @@ export function queryPayStatus(params) {
|
|||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单转桌
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function mergeOrder(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/order/admin/order/mergeOrder",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ export default (data) => {
|
|||
<div style="margin-top: 6px;margin-bottom: 6px;width: 100%">
|
||||
<hr/>
|
||||
</div>
|
||||
<div style="margin-top: 4px; font-size: 16px;font-weight: bold;">备注:${
|
||||
data.remark
|
||||
}</div>
|
||||
<div style="margin-top: 4px; font-size: 12px;">
|
||||
打印时间:${data.printTime}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<scanModal ref="scanModalRef" :amount="props.amount" :money="money" :orderId="props.orderId"
|
||||
:selecttype="props.selecttype" :payType="payType" :payData="payData" @success="scanCodeSuccess" />
|
||||
:selecttype="props.selecttype" :payType="payType" :payData="payData" @success="scanCodeSuccess"
|
||||
@orderExpired="emit('orderExpired')" />
|
||||
<!-- 选择挂账人员 -->
|
||||
<el-dialog title="挂账" top="1vh" v-model="showBuyer" width="90%" @closed="resetBuyerTable">
|
||||
<el-form inline>
|
||||
|
|
@ -261,7 +262,7 @@ watch(props, () => {
|
|||
money.value = formatDecimal(props.amount)
|
||||
})
|
||||
|
||||
const emit = defineEmits(["paySuccess"]);
|
||||
const emit = defineEmits(["paySuccess", 'orderExpired']);
|
||||
|
||||
const money = ref("0");
|
||||
const discountRateVlaue = ref(0)
|
||||
|
|
@ -444,6 +445,10 @@ async function confirmOrder() {
|
|||
emit("paySuccess");
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code == 701) {
|
||||
// 订单已过期需刷新购物车和订单
|
||||
emit('orderExpired')
|
||||
}
|
||||
console.log(error);
|
||||
payLoading.value = false;
|
||||
scanModalRef.value.loading = false;
|
||||
|
|
|
|||
|
|
@ -59,17 +59,11 @@ import { useUser } from "@/store/user.js";
|
|||
import { useGlobal } from '@/store/global.js'
|
||||
import { formatDecimal } from '@/utils'
|
||||
import { microPay, queryOrderStatus, microPayVip, vipPay, queryPayStatus } from '@/api/order.js'
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const store = useUser();
|
||||
const global = useGlobal()
|
||||
import {
|
||||
queryMembermember,
|
||||
createMembermember,
|
||||
membermemberScanPay,
|
||||
accountPaymember,
|
||||
} from "@/api/member/index.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
const emits = defineEmits(["success"]);
|
||||
const emits = defineEmits(["success", 'orderExpired']);
|
||||
|
||||
const props = defineProps({
|
||||
amount: {
|
||||
|
|
@ -181,6 +175,9 @@ async function submitHandle() {
|
|||
userPayWait.value = true;
|
||||
fastOrder.value = error.data
|
||||
autoCheckOrder()
|
||||
} else if (error.code == 701) {
|
||||
// 订单已过期需刷新购物车和订单
|
||||
emits('orderExpired')
|
||||
} else {
|
||||
scanCode.value = "";
|
||||
loading.value = false;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { useUser } from "@/store/user.js";
|
|||
import { useSocket } from "@/store/socket.js";
|
||||
import useStorage from "@/utils/useStorage.js";
|
||||
import { formatDecimal } from "@/utils/index.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
// 商品store + 购物车store
|
||||
export const useGoods = defineStore("goods", {
|
||||
|
|
@ -21,6 +20,7 @@ export const useGoods = defineStore("goods", {
|
|||
// tableCode: "66666666",
|
||||
// }, // 台桌信息
|
||||
tableInfo: {
|
||||
id: '',
|
||||
name: "",
|
||||
num: "",
|
||||
tableCode: "",
|
||||
|
|
@ -392,6 +392,8 @@ export const useGoods = defineStore("goods", {
|
|||
let group_text = "";
|
||||
if (val.type == "package" && item.pro_group_info) {
|
||||
group_text = JSON.parse(item.pro_group_info)
|
||||
.flat()
|
||||
.map((item) => item.goods)
|
||||
.flat()
|
||||
.map((item) => item.proName)
|
||||
.join("、");
|
||||
|
|
@ -548,7 +550,11 @@ export const useGoods = defineStore("goods", {
|
|||
|
||||
if (+val.pack_number && !val.is_temporary) {
|
||||
packFeeNumber += +val.pack_number;
|
||||
packFee += +val.pack_number * +val.packFee;
|
||||
if (+val.pack_number > number) {
|
||||
packFee += number * +val.packFee;
|
||||
} else {
|
||||
packFee += +val.pack_number * +val.packFee;
|
||||
}
|
||||
}
|
||||
|
||||
if (val.is_temporary) {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,14 @@ export const useSocket = defineStore("socket", {
|
|||
goodsStore.successClearCart();
|
||||
break;
|
||||
case "batch":
|
||||
// 打包
|
||||
// 整单打包
|
||||
this.cartInit();
|
||||
break;
|
||||
case "rottable":
|
||||
// 转桌
|
||||
useStorage.set("tableCode", data.data.new_table_code);
|
||||
goodsStore.successClearCart();
|
||||
goodsStore.historyOrderAjax(data.data.new_table_code);
|
||||
this.cartInit();
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function RandomNumBoth(Max, Min = 0) {
|
|||
* 去除字符串中除了数字和点以外的其他字符
|
||||
* @param {Object} obj
|
||||
*/
|
||||
export function clearNoNum(obj) {
|
||||
export function clearNoNum(obj) {
|
||||
// 如果用户第一位输入的是小数点,则重置输入框内容
|
||||
if (obj.value != "" && obj.value.substr(0, 1) == ".") {
|
||||
obj.value = "";
|
||||
|
|
@ -182,7 +182,7 @@ export function commOrderPrintData(orderInfo) {
|
|||
skuName: item.skuName,
|
||||
salePrice: formatDecimal(item.price),
|
||||
totalAmount: formatDecimal(+item.payAmount),
|
||||
proGroupInfo: item.proGroupInfo,
|
||||
proGroupInfo: item.proGroupInfo.map((item) => item.goods).flat(),
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -414,21 +414,24 @@ function searchHandle() {
|
|||
|
||||
// 确认选择规格回调
|
||||
function skuConfirm(params) {
|
||||
// console.log(params);
|
||||
console.log(params);
|
||||
let goodsItem = goodsStore.cartList.find(goods => goods.product_id == params.productId && goods.sku_id == params.id)
|
||||
if (goodsItem && goodsItem.id) {
|
||||
// 编辑新增
|
||||
if (params.type && params.type == 'weight') {
|
||||
if (params.goods_type == 'weight') {
|
||||
// 称重商品
|
||||
console.log('编辑称重商品');
|
||||
goodsStore.operateCart({ ...goodsItem, number: params.number }, 'edit')
|
||||
} else if (params.type && params.type == 'package') {
|
||||
} else if (params.goods_type == 'package') {
|
||||
// 添加
|
||||
console.log('添加套餐商品');
|
||||
goodsStore.addCart({ ...params })
|
||||
} else {
|
||||
goodsStore.operateCart({ ...goodsItem, number: +goodsItem.number + 1 }, 'edit')
|
||||
}
|
||||
} else {
|
||||
// 添加
|
||||
console.log('直接添加');
|
||||
if (params.type == 'weight') {
|
||||
goodsStore.addCart({ ...params, number: params.number })
|
||||
} else {
|
||||
|
|
@ -522,7 +525,7 @@ function showSkuHandle(item) {
|
|||
goodsStore.addCart({
|
||||
...item.skuList[0], lowPrice: item.skuList[0].salePrice, type: item.type,
|
||||
goods_type: 'package',
|
||||
pro_group_info: item.groupSnap.map((item) => item.goods),
|
||||
pro_group_info: item.groupSnap,
|
||||
number: item.skuList[0].suitNum
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ function show(item, type = 'add') {
|
|||
setTimeout(() => {
|
||||
goodsItem.value.groupSnap.map((item, index) => {
|
||||
item.goods.map((val, i) => {
|
||||
selectGroup[index].map(sg => {
|
||||
selectGroup[index].goods.map(sg => {
|
||||
if (val.proId == sg.proId) {
|
||||
tabRefs.value[index].toggleRowSelection(val, true)
|
||||
}
|
||||
|
|
@ -158,8 +158,9 @@ function confirmHandle() {
|
|||
|
||||
let goodIds = []
|
||||
goodsItem.value.groupSnap.map((item, index) => {
|
||||
let selectNum = tabRefs.value[index].getSelectionRows()
|
||||
goodIds.push(selectNum)
|
||||
let obj = { ...item }
|
||||
obj.goods = tabRefs.value[index].getSelectionRows()
|
||||
goodIds.push(obj)
|
||||
})
|
||||
|
||||
// 将商品数据转为一维数组返回
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
</div>
|
||||
<div class="pay_wrap">
|
||||
<payCard ref="payCardRef" :orderList="orderList" :amount="cartInfo.totalAmount"
|
||||
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" />
|
||||
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" @orderExpired="orderExpiredHnadle" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
|
||||
|
|
@ -140,6 +140,14 @@ const orderList = ref([])
|
|||
const isPrint = ref(true);
|
||||
const discountLoading = ref(false)
|
||||
|
||||
// 支付失败,订单已过期
|
||||
function orderExpiredHnadle() {
|
||||
dialogVisible.value = false
|
||||
useStorage.del('tableCode')
|
||||
socket.cartInit()
|
||||
goodsStore.successClearCart()
|
||||
}
|
||||
|
||||
// 显示员工折扣
|
||||
async function showStaffDiscountHandle() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -3,14 +3,17 @@
|
|||
<el-dialog title="转桌/并桌" width="700px" v-model="visible" @closed="onClose" top="3vh">
|
||||
<div class="scroll_y">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-position="top">
|
||||
<el-form-item label="当前台桌" v-if="goodsStore.tableInfo.id">
|
||||
{{ goodsStore.tableInfo.name }}
|
||||
</el-form-item>
|
||||
<el-form-item label="转入台桌" prop="targetTableId">
|
||||
<el-select v-model="form.targetTableId" style="width: 200px;" placeholder="请选择目标台桌">
|
||||
<el-option :label="item.name" :value="item.qrcode" v-for="item in tableList"
|
||||
:key="item.qrcode"></el-option>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in tableList"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="转入类型">
|
||||
<el-radio-group v-model="form.isFull">
|
||||
<el-form-item label="转入类型" prop="cartIds">
|
||||
<el-radio-group v-model="form.isFull" @change="tableChange">
|
||||
<el-radio :value="false" border>转桌(可将部分商品转入)</el-radio>
|
||||
<el-radio :value="true" border>并桌(并台会将全部购物车商品转入)</el-radio>
|
||||
</el-radio-group>
|
||||
|
|
@ -24,7 +27,7 @@
|
|||
<el-table-column label="价格" prop="lowPrice"></el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="已下单商品" prop="cartIds" v-if="!form.isFull">
|
||||
<el-form-item label="已下单商品" v-if="!form.isFull && goodsStore.orderList.length">
|
||||
<div v-for="item in goodsStore.orderList" style="width: 100%;">
|
||||
<div>{{ `第${item.orderNum}次下单` }}</div>
|
||||
<el-table ref="orderTableRefs" :data="item.goods" border stripe>
|
||||
|
|
@ -51,30 +54,25 @@
|
|||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { orderSwitcht } from '@/api/product.js'
|
||||
import { mergeOrder } from '@/api/order.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
import { useUser } from "@/store/user.js"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { shopTable } from "@/api/account.js";
|
||||
import useStorage from '@/utils/useStorage.js'
|
||||
import { useSocket } from '@/store/socket.js'
|
||||
|
||||
const emits = defineEmits(['success'])
|
||||
|
||||
const store = useUser()
|
||||
const socket = useSocket()
|
||||
const goodsStore = useGoods()
|
||||
const visible = ref(false)
|
||||
const cartTableRefs = ref(null)
|
||||
const orderTableRefs = ref(null)
|
||||
const orderTableRefs = ref([])
|
||||
const loading = ref(false)
|
||||
const formRef = ref(null)
|
||||
const resetForm = ref({})
|
||||
const form = ref({
|
||||
shopId: store.userInfo.shopId,
|
||||
masterId: '',
|
||||
orderId: '',
|
||||
cartIds: [],
|
||||
isFull: false,
|
||||
currentTableId: '',
|
||||
targetTableId: '',
|
||||
isFull: false,
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
|
|
@ -89,14 +87,19 @@ const rules = ref({
|
|||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
let arr = []
|
||||
props.data.map((item, index) => {
|
||||
arr.push(...tableRefs.value[index].getSelectionRows())
|
||||
})
|
||||
if (!form.value.isFull) {
|
||||
let arr = []
|
||||
arr.push(...cartTableRefs.value.getSelectionRows())
|
||||
|
||||
if (!arr.length) {
|
||||
ElMessage.error('至少选择一个商品')
|
||||
callback(new Error('至少选择一个商品'))
|
||||
goodsStore.orderList.map((item, index) => {
|
||||
arr.push(...orderTableRefs.value[index].getSelectionRows())
|
||||
})
|
||||
|
||||
if (!arr.length) {
|
||||
callback(new Error('至少选择一个商品'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
|
|
@ -106,13 +109,18 @@ const rules = ref({
|
|||
]
|
||||
})
|
||||
|
||||
// 切换道并桌时清除掉所有验证
|
||||
function tableChange(e) {
|
||||
if (e) formRef.value.clearValidate('cartIds')
|
||||
}
|
||||
|
||||
const tableList = ref([])
|
||||
// 获取台桌列表
|
||||
async function queryShopTableAjax() {
|
||||
try {
|
||||
const res = await shopTable({
|
||||
status: 'using',
|
||||
isBind: true
|
||||
// status: 'using',
|
||||
// isBind: true
|
||||
})
|
||||
tableList.value = res.records
|
||||
} catch (error) {
|
||||
|
|
@ -126,32 +134,66 @@ function confirmHandle() {
|
|||
try {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
form.value.masterId = props.data[0].info[0].masterId
|
||||
form.value.orderId = props.data[0].info[0].orderId
|
||||
form.value.currentTableId = props.data[0].info[0].tableId
|
||||
|
||||
if (!form.value.isFull) {
|
||||
let arr = []
|
||||
props.data.map((item, index) => {
|
||||
arr.push(...tableRefs.value[index].getSelectionRows())
|
||||
let targetTable = tableList.value.find(item => item.id == form.value.targetTableId)
|
||||
|
||||
let sourceOrderId = goodsStore.orderListInfo.id
|
||||
let targetOrderId = targetTable.orderId
|
||||
let targetTableCode = targetTable.tableCode
|
||||
let detailIds = []
|
||||
|
||||
if (form.value.isFull) {
|
||||
goodsStore.orderList.map((item, index) => {
|
||||
item.goods.map(val => {
|
||||
detailIds.push(val.id)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
goodsStore.orderList.map((item, index) => {
|
||||
detailIds.push(...orderTableRefs.value[index].getSelectionRows().map(item => item.id))
|
||||
})
|
||||
form.value.cartIds = arr.map(item => item.id)
|
||||
}
|
||||
|
||||
await orderSwitcht(form.value)
|
||||
loading.value = false
|
||||
|
||||
// 更新台桌信息
|
||||
// 在这里做点什么
|
||||
if (detailIds.length) {
|
||||
await mergeOrder({
|
||||
sourceOrderId: sourceOrderId, // 来源订单id
|
||||
targetOrderId: targetOrderId, // 目标台桌订单id
|
||||
targetTableCode: targetTableCode, // 目标台桌码
|
||||
detailIds: detailIds // 转台详情
|
||||
})
|
||||
if (!goodsStore.cartList.length) {
|
||||
useStorage.set('tableCode', targetTableCode)
|
||||
|
||||
goodsStore.successClearCart();
|
||||
goodsStore.historyOrderAjax(targetTableCode);
|
||||
socket.cartInit();
|
||||
}
|
||||
}
|
||||
|
||||
if (goodsStore.cartList.length) {
|
||||
let table_code = goodsStore.cartList[0].table_code
|
||||
let new_table_code = targetTable.tableCode
|
||||
let cart_id = []
|
||||
|
||||
if (form.value.isFull) {
|
||||
cart_id = goodsStore.cartList.map(item => item.id)
|
||||
} else {
|
||||
cart_id = cartTableRefs.value.getSelectionRows().map(item => item.id)
|
||||
}
|
||||
|
||||
goodsStore.operateCart({
|
||||
table_code: table_code,
|
||||
new_table_code: new_table_code,
|
||||
cart_id: cart_id
|
||||
}, 'rottable')
|
||||
}
|
||||
visible.value = false
|
||||
|
||||
emits('success', { isTemporary: true })
|
||||
}
|
||||
} catch (error) {
|
||||
loading.value = false
|
||||
console.log(error);
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +203,10 @@ function onClose() {
|
|||
}
|
||||
|
||||
function show() {
|
||||
visible.value = true
|
||||
queryShopTableAjax()
|
||||
if (goodsStore.cartList.length || goodsStore.orderList.length) {
|
||||
visible.value = true
|
||||
queryShopTableAjax()
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
|
|
|||
|
|
@ -8,9 +8,11 @@
|
|||
<span>{{ item.createTime }}</span>
|
||||
</div>
|
||||
<div class="dialog_footer_right">
|
||||
<span :class="{ active: item.amount > 0 }">
|
||||
<template v-if="item.amount > 0">+</template>
|
||||
¥{{ formatDecimal(item.amount) }}
|
||||
<span class="active" v-if="item.amount > 0">
|
||||
+¥{{ formatDecimal(item.amount) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
-¥{{ formatDecimal(+JSON.stringify(item.amount).replace('-', '')) }}
|
||||
</span>
|
||||
<span>余额:¥{{ formatDecimal(item.balance) }}</span>
|
||||
</div>
|
||||
|
|
@ -49,18 +51,33 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="退款金额" prop="amount">
|
||||
<el-input-number v-model="form.amount" :max="form.max" placeholder="请输入退款金额" />
|
||||
<el-input-number v-model="form.amount" :min="0.01" :max="form.max" placeholder="请输入" />
|
||||
<div class="tips" v-if="refundItem.giftAmount - refundItem.giftRefundAmount > 0">
|
||||
注意:一旦退款,优先扣除赠送金额</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="退款说明">
|
||||
<el-form-item label="退款说明" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入退款说明" />
|
||||
<div class="remark_tag">
|
||||
<div class="item" v-for="(item, index) in remarkTagList" :key="index"
|
||||
@click="addRmarkHandle(item)">
|
||||
{{ item }}
|
||||
</div>
|
||||
<div class="item" @click="form.remark = ''">
|
||||
<el-icon>
|
||||
<CircleClose />
|
||||
</el-icon>
|
||||
清空
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div style="padding: 0 20px 20px;">
|
||||
<el-button @click="showDialog = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="refundHandle">确定</el-button>
|
||||
<div style="padding: 0 20px 20px;width: 100%;display: flex;justify-content: space-between;">
|
||||
<el-button type="danger" @click="handleRefund">手动退款</el-button>
|
||||
<div class="btn" style="display: flex;">
|
||||
<el-button @click="showDialog = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="refundHandle">原路返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
|
@ -73,15 +90,15 @@
|
|||
<script setup>
|
||||
import md5 from "js-md5";
|
||||
import { reactive, ref } from 'vue'
|
||||
import { dayjs, ElMessage } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { formatDecimal } from '@/utils/index'
|
||||
import { shopUserChargeFlow } from '@/api/account.js'
|
||||
import { refundVipBefore, refundVip } from '@/api/order.js'
|
||||
import { returnFlow, memberqueryMemberAccount } from '@/api/member/index.js'
|
||||
import { queryPwdInfo, staffPermission } from '@/api/user.js'
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { useUser } from '@/store/user.js'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
const userStore = useUser()
|
||||
const globalStore = useGlobal()
|
||||
|
|
@ -146,12 +163,34 @@ const rules = reactive({
|
|||
required: true,
|
||||
message: '请输入退款金额'
|
||||
}
|
||||
],
|
||||
remark: [
|
||||
{
|
||||
trigger: 'blur',
|
||||
required: true,
|
||||
message: '请输入退款原因'
|
||||
}
|
||||
]
|
||||
})
|
||||
const loading = ref(false)
|
||||
const refundItem = ref({})
|
||||
const formRef = ref(null)
|
||||
const flowItem = ref({})
|
||||
const cashRefund = ref(false)
|
||||
const remarkTagList = ref([
|
||||
'点错了',
|
||||
'不要了',
|
||||
'没货了'
|
||||
])
|
||||
|
||||
// 添加备注
|
||||
function addRmarkHandle(item) {
|
||||
if (form.remark.length) {
|
||||
form.remark += `,${item}`
|
||||
} else {
|
||||
form.remark = item
|
||||
}
|
||||
}
|
||||
|
||||
// 显示充值退款
|
||||
async function showRefundHandle(item) {
|
||||
|
|
@ -201,6 +240,22 @@ function refundHandle() {
|
|||
})
|
||||
}
|
||||
|
||||
// 显示手动退款
|
||||
function handleRefund() {
|
||||
ElMessageBox.confirm('请线下手动转账给客户或现金,一旦操作完成无法修改订单状态,请慎重操作!', '注意', {
|
||||
confirmButtonText: '已在线下完成退款'
|
||||
}).then(async () => {
|
||||
cashRefund.value = true
|
||||
await userStore.getShopInfo()
|
||||
loading.value = false
|
||||
if (userStore.shopInfo.isMemberInPwd == 1) {
|
||||
takeFoodCodeRef.value.show();
|
||||
} else {
|
||||
passwordSuccess()
|
||||
}
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
// 得到退款密码
|
||||
async function passwordSuccess(e = '') {
|
||||
try {
|
||||
|
|
@ -212,7 +267,7 @@ async function passwordSuccess(e = '') {
|
|||
refAmount: form.amount,
|
||||
remark: form.remark,
|
||||
outOfRange: false,
|
||||
cashRefund: true,
|
||||
cashRefund: cashRefund.value,
|
||||
pwd: e,
|
||||
})
|
||||
ElMessage.success('退款成功')
|
||||
|
|
@ -231,6 +286,7 @@ async function passwordSuccess(e = '') {
|
|||
function show(row) {
|
||||
userInfo.value = row
|
||||
visableDialog.value = true
|
||||
cashRefund.value = false
|
||||
memberqueryMemberAccountAjax()
|
||||
}
|
||||
|
||||
|
|
@ -240,6 +296,30 @@ defineExpose({
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.remark_tag {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding-top: 10px;
|
||||
|
||||
.item {
|
||||
height: 35px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 6px 12px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
color: #555;
|
||||
|
||||
&:active {
|
||||
background-color: #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.box {
|
||||
|
||||
.box1 {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
{{ formatDecimal(item.payAmount) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex" v-for="val in item.proGroupInfo" :key="val.proId">
|
||||
<div class="flex" v-for="val in item.proGroupInfo.map(item => item.goods).flat()" :key="val.proId">
|
||||
<div class="item">>{{ val.proName }}</div>
|
||||
<div class="item">0.00</div>
|
||||
<div class="item">{{ val.number }}</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-drawer v-model="isShow" direction="rtl" size="70%">
|
||||
<el-drawer v-model="isShow" direction="rtl" size="80%">
|
||||
<template #header>
|
||||
<h4>订单号:{{ item.orderNo }}</h4>
|
||||
</template>
|
||||
|
|
@ -21,11 +21,11 @@
|
|||
<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="refundAmount" style="width: 370px;height: 42px;" placeholder="请输入退款金额"
|
||||
@input="inputChange">
|
||||
<el-input v-model="refundAmount" style="width: 400px;height: 42px;" :readonly="refundType != 3"
|
||||
placeholder="请输入退款金额" @input="inputChange">
|
||||
<template #prepend>¥</template>
|
||||
<template #append>最多可退¥{{ formatDecimal(item.payAmount - item.refundAmount, 2) }}</template>
|
||||
</el-input>
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="退款数量" width="170">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.refund_number" :disabled="refundType == 1" :min="0"
|
||||
<el-input-number v-model="scope.row.refund_number" :disabled="refundType != 2" :min="0"
|
||||
:max="formatDecimal(scope.row.num - scope.row.refundNum - scope.row.returnNum, 2, true)"
|
||||
style="width: 130px;" @change="numberChange">
|
||||
</el-input-number>
|
||||
|
|
@ -105,13 +105,20 @@
|
|||
<div class="item" v-for="(item, index) in remarkTagList" :key="index" @click="addRmarkHandle(item)">
|
||||
{{ item }}
|
||||
</div>
|
||||
<div class="item" @click="remark = ''">
|
||||
<el-icon>
|
||||
<CircleClose />
|
||||
</el-icon>
|
||||
清空
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="drawer_footer">
|
||||
<div class="btn">
|
||||
<el-button style="width: 100%;" :loading="loading" @click="handleRefund">手动退款</el-button>
|
||||
<el-button type="danger" style="width: 100%;" :loading="loading"
|
||||
@click="handleRefund">手动退款</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;" :loading="loading"
|
||||
|
|
@ -128,7 +135,7 @@ import { ref } from 'vue'
|
|||
import { useGlobal } from '@/store/global.js'
|
||||
import { formatDecimal, inputFilterFloat } from "@/utils/index.js";
|
||||
import { refundOrder, orderPrint } from '@/api/order.js'
|
||||
import { ElNotification, ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useUser } from '@/store/user.js'
|
||||
import dayjs from 'dayjs'
|
||||
|
|
@ -150,7 +157,8 @@ const remarkTagList = ref([
|
|||
'等待时间长',
|
||||
'支付错误',
|
||||
'商品不满意',
|
||||
'服务态度不满意'
|
||||
'服务态度不满意',
|
||||
'打包费'
|
||||
])
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -169,30 +177,18 @@ async function refundHandle(cash = false) {
|
|||
let rows = tableRef.value.getSelectionRows()
|
||||
if (refundType.value == 2) {
|
||||
if (!rows.length) {
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '请选择退款商品',
|
||||
type: 'error',
|
||||
})
|
||||
ElMessage.error('请选择退款商品')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (!refundAmount.value) {
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '请请输入退款金额',
|
||||
type: 'error',
|
||||
})
|
||||
ElMessage.error('请请输入退款金额')
|
||||
return
|
||||
}
|
||||
|
||||
if (!remark.value) {
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '请请输入退款原因',
|
||||
type: 'error',
|
||||
})
|
||||
ElMessage.error('请请输入退款原因')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -208,11 +204,7 @@ async function refundHandle(cash = false) {
|
|||
}
|
||||
|
||||
if (refundAmount.value <= 0) {
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '无可退金额',
|
||||
type: 'error',
|
||||
})
|
||||
ElMessage.error('无可退金额')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -227,11 +219,7 @@ async function refundHandle(cash = false) {
|
|||
|
||||
loading.value = true
|
||||
await refundOrder(data)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '退款成功',
|
||||
type: 'success',
|
||||
})
|
||||
ElMessage.success('退款成功')
|
||||
await printRefund(rows)
|
||||
isShow.value = false
|
||||
emits('success')
|
||||
|
|
@ -251,7 +239,7 @@ async function printRefund(rows) {
|
|||
loginAccount: store.userInfo.name,
|
||||
carts: [],
|
||||
amount: formatDecimal(+refundAmount.value),
|
||||
remark: item.value.remark,
|
||||
remark: remark.value,
|
||||
orderInfo: item.value,
|
||||
outNumber: item.value.id,
|
||||
createdAt: item.value.createTime,
|
||||
|
|
@ -274,11 +262,7 @@ async function printRefund(rows) {
|
|||
} else {
|
||||
// 云打印
|
||||
await orderPrint({ id: item.value.id, type: 2 })
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '云打印退款单成功',
|
||||
type: 'success',
|
||||
})
|
||||
ElMessage.success('云打印退款单成功')
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -307,7 +291,7 @@ const tabSelectChange = _.debounce(function (val) {
|
|||
|
||||
// 禁用所有行的选择
|
||||
const selectable = (row, index) => {
|
||||
return refundType.value != 1;
|
||||
return refundType.value == 2;
|
||||
};
|
||||
|
||||
// 初始化抽屉
|
||||
|
|
@ -385,6 +369,8 @@ function refundTypeChange(val) {
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
tableRef.value.clearSelection()
|
||||
refundAmount.value = ''
|
||||
modify.value = true
|
||||
break;
|
||||
default:
|
||||
|
|
@ -466,11 +452,19 @@ defineExpose({
|
|||
gap: 10px;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 6px 12px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
color: #555;
|
||||
|
||||
&:active {
|
||||
background-color: #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue