优化会员支付,已会员价结算
This commit is contained in:
@@ -127,6 +127,8 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
<takeFoodCode ref="takeFoodCodeRef" title="退款密码" :type="2" input-type="password" placeholder="请输入退款密码"
|
||||
@success="passwordSuccess" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -139,6 +141,7 @@ import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useUser } from '@/store/user.js'
|
||||
import dayjs from 'dayjs'
|
||||
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||
|
||||
const emits = defineEmits(['success'])
|
||||
|
||||
@@ -161,13 +164,53 @@ const remarkTagList = ref([
|
||||
'打包费'
|
||||
])
|
||||
const loading = ref(false)
|
||||
const takeFoodCodeRef = ref(null)
|
||||
const cash = ref(false)
|
||||
|
||||
// 退款密码
|
||||
async function passwordSuccess(e = '') {
|
||||
try {
|
||||
loading.value = true
|
||||
let rows = tableRef.value.getSelectionRows()
|
||||
let refundDetails = []
|
||||
if (refundType.value != 1) {
|
||||
refundDetails = tableRef.value.getSelectionRows().map(val => {
|
||||
return {
|
||||
id: val.id,
|
||||
returnAmount: val.payAmount,
|
||||
num: val.refund_number
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let data = {
|
||||
orderId: item.value.id,
|
||||
refundAmount: formatDecimal(+refundAmount.value),
|
||||
modify: modify.value,
|
||||
cash: cash.value,
|
||||
refundReason: remark.value,
|
||||
refundDetails: refundDetails,
|
||||
pwd: e,
|
||||
};
|
||||
|
||||
await refundOrder(data)
|
||||
ElMessage.success('退款成功')
|
||||
await printRefund(rows)
|
||||
isShow.value = false
|
||||
emits('success')
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 显示手动退款
|
||||
function handleRefund() {
|
||||
ElMessageBox.confirm('请线下手动转账给客户或现金,一旦操作完成无法修改订单状态,请慎重操作!', '注意', {
|
||||
confirmButtonText: '已在线下完成退款'
|
||||
}).then(() => {
|
||||
refundHandle(true)
|
||||
cash.value = true
|
||||
refundHandle()
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
@@ -192,37 +235,18 @@ async function refundHandle(cash = false) {
|
||||
return
|
||||
}
|
||||
|
||||
let refundDetails = []
|
||||
if (refundType.value != 1) {
|
||||
refundDetails = tableRef.value.getSelectionRows().map(val => {
|
||||
return {
|
||||
id: val.id,
|
||||
returnAmount: val.payAmount,
|
||||
num: val.refund_number
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (refundAmount.value <= 0) {
|
||||
ElMessage.error('无可退金额')
|
||||
return
|
||||
}
|
||||
|
||||
let data = {
|
||||
orderId: item.value.id,
|
||||
refundAmount: formatDecimal(+refundAmount.value),
|
||||
modify: modify.value,
|
||||
cash: cash,
|
||||
refundReason: remark.value,
|
||||
refundDetails: refundDetails
|
||||
};
|
||||
|
||||
loading.value = true
|
||||
await refundOrder(data)
|
||||
ElMessage.success('退款成功')
|
||||
await printRefund(rows)
|
||||
isShow.value = false
|
||||
emits('success')
|
||||
await store.getShopInfo()
|
||||
if (store.shopInfo.isReturnPwd == 1) {
|
||||
takeFoodCodeRef.value.show();
|
||||
} else {
|
||||
passwordSuccess()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -300,6 +324,7 @@ function resetDrawer() {
|
||||
refundAmount.value = ''
|
||||
refundType.value = 1
|
||||
remark.value = ''
|
||||
cash.value = false
|
||||
}
|
||||
|
||||
function show(row) {
|
||||
|
||||
Reference in New Issue
Block a user