1.优化会员扫码充值订单状态查询
This commit is contained in:
@@ -171,7 +171,7 @@ async function findCouponAjax() {
|
||||
} else {
|
||||
let arr = []
|
||||
let ids = props.orderList.map(item => item.productId)
|
||||
res.map(item => {
|
||||
res && res.map(item => {
|
||||
if (ids.includes(item.proId)) {
|
||||
let pro = props.orderList.find(val => val.productId == item.proId)
|
||||
arr.push({
|
||||
@@ -193,9 +193,7 @@ function show(userId) {
|
||||
showDialog.value = true
|
||||
query.value.userId = userId
|
||||
findCouponAjax()
|
||||
|
||||
console.log('couponModal.orderList===', props.orderList);
|
||||
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
@@ -69,36 +69,6 @@
|
||||
</div>
|
||||
<scanModal ref="scanModalRef" :amount="props.amount" :money="money" :orderId="props.orderId"
|
||||
:selecttype="props.selecttype" :payType="payType" :payData="payData" @success="scanCodeSuccess" />
|
||||
<el-dialog :title="`选择会员`" top="3vh" v-model="showDialog" width="80%">
|
||||
<el-form inline>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入手机号搜索会员" v-model="tableData.phone" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getMemberList">搜索</el-button>
|
||||
<el-button @click="resetTable">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="tableData.list" height="440px" border stripe v-loading="tableData.loading">
|
||||
<el-table-column prop="name" label="昵称" width="120px" />
|
||||
<el-table-column prop="telephone" label="手机" width="150px" />
|
||||
<el-table-column prop="code" label="编号" width="120px" />
|
||||
<el-table-column prop="level" label="等级" />
|
||||
<el-table-column prop="levelConsume" label="积分" />
|
||||
<el-table-column prop="amount" label="余额" width="100px">
|
||||
<template v-slot="scope">
|
||||
¥{{ formatDecimal(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120px">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" @click="toHomeMember(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination layout="prev, pager, next, total" background style="margin-top: 20px"
|
||||
:total="Number(tableData.total)" v-model:current-page="tableData.page" @current-change="getMemberList" />
|
||||
</el-dialog>
|
||||
<!-- 选择挂账人员 -->
|
||||
<el-dialog title="挂账" top="1vh" v-model="showBuyer" width="90%" @closed="resetBuyerTable">
|
||||
<el-form inline>
|
||||
@@ -362,10 +332,10 @@ async function payCreditPayHandle(row) {
|
||||
buyerTable.loading = false;
|
||||
emit("paySuccess");
|
||||
} catch (error) {
|
||||
buyerTable.loading = false;
|
||||
payLoading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
buyerTable.loading = false;
|
||||
payLoading.value = false;
|
||||
}
|
||||
// 显示选择挂账人 end
|
||||
|
||||
@@ -374,6 +344,27 @@ function scanCodeSuccess() {
|
||||
emit("paySuccess");
|
||||
}
|
||||
|
||||
// 会员支付
|
||||
async function vipPayAjax(row) {
|
||||
try {
|
||||
if (row.amount < money.value) {
|
||||
ElMessage.error('余额不足')
|
||||
return
|
||||
}
|
||||
|
||||
payData.value.payType = 'userPay'
|
||||
payData.value.shopUserId = row.id
|
||||
payData.value.checkOrderPay.userId = row.userId
|
||||
payLoading.value = true;
|
||||
|
||||
await vipPay(payData.value)
|
||||
emit("paySuccess");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
payLoading.value = false;
|
||||
}
|
||||
|
||||
// 切换支付类型
|
||||
async function payTypeChange(index, item) {
|
||||
try {
|
||||
@@ -384,9 +375,12 @@ async function payTypeChange(index, item) {
|
||||
if (item.payType == "scanCode") {
|
||||
scanModalRef.value.show();
|
||||
}
|
||||
if (item.payType == "vipPay") {
|
||||
showDialog.value = true;
|
||||
getMemberList();
|
||||
if (item.payType == "member-account") {
|
||||
if (goodsStore.vipUserInfo.id) {
|
||||
// await vipPayAjax(goodsStore.vipUserInfo)
|
||||
} else {
|
||||
SelectVipUserRef.value.show()
|
||||
}
|
||||
}
|
||||
if (item.payType == "buyer") {
|
||||
showBuyerHandle();
|
||||
@@ -434,11 +428,14 @@ async function confirmOrder() {
|
||||
} else {
|
||||
}
|
||||
break
|
||||
case "vipPay":
|
||||
case "member-account":
|
||||
// 会员支付
|
||||
console.log("使用会员id支付");
|
||||
payLoading.value = false;
|
||||
showDialog.value = true;
|
||||
if (goodsStore.vipUserInfo.id) {
|
||||
await vipPayAjax(goodsStore.vipUserInfo)
|
||||
} else {
|
||||
SelectVipUserRef.value.show()
|
||||
}
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
@@ -500,66 +497,6 @@ async function queryPayTypeAjax() {
|
||||
}
|
||||
}
|
||||
|
||||
const showDialog = ref(false);
|
||||
const tableData = reactive({
|
||||
phone: "",
|
||||
loading: false,
|
||||
list: [],
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 重置表格
|
||||
function resetTable() {
|
||||
tableData.phone = "";
|
||||
tableData.page = 1;
|
||||
getMemberList();
|
||||
}
|
||||
|
||||
// 获取会员列表
|
||||
async function getMemberList() {
|
||||
try {
|
||||
tableData.loading = true;
|
||||
const res = await queryMembermember({
|
||||
shopId: store.userInfo.shopId,
|
||||
phone: tableData.phone,
|
||||
page: tableData.page,
|
||||
pageSize: tableData.size,
|
||||
isFlag: 1,
|
||||
});
|
||||
tableData.loading = false;
|
||||
tableData.list = res.list;
|
||||
tableData.total = res.total;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 选择会员去下单
|
||||
async function toHomeMember(row) {
|
||||
try {
|
||||
showDialog.value = false;
|
||||
payLoading.value = true;
|
||||
const res = await vipPay({
|
||||
orderId: props.orderId,
|
||||
vipUserId: row.id,
|
||||
payAmount: props.discount > 0 ? money.value : "",
|
||||
discountAmount:
|
||||
props.discount > 0 ? formatDecimal(props.amount - money.value) : "",
|
||||
});
|
||||
global.setOrderTable();
|
||||
global.setOrderMember();
|
||||
|
||||
payLoading.value = false;
|
||||
ElMessage.success("支付成功");
|
||||
emit("paySuccess");
|
||||
} catch (error) {
|
||||
payLoading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 取消折扣
|
||||
function cancelDiscount() {
|
||||
discountRateVlaue.value = 0
|
||||
@@ -607,31 +544,29 @@ function clearCouponUser() {
|
||||
}
|
||||
|
||||
// 折扣格式化
|
||||
function discountInput(e) {
|
||||
const discountInput = _.debounce(function (e) {
|
||||
couponForm.value.amount = couponForm.value.originAmount
|
||||
setTimeout(() => {
|
||||
couponForm.value.discountRatio = inputFilterFloat(e)
|
||||
if (couponForm.value.discountRatio > 9.9) {
|
||||
couponForm.value.discountRatio = 9.9
|
||||
}
|
||||
if (couponForm.value.discountRatio < 0.1) {
|
||||
couponForm.value.discountRatio = 0.1
|
||||
}
|
||||
couponForm.value.discountRatio = inputFilterFloat(e)
|
||||
if (couponForm.value.discountRatio > 9.9) {
|
||||
couponForm.value.discountRatio = 9.9
|
||||
}
|
||||
if (couponForm.value.discountRatio < 0.1) {
|
||||
couponForm.value.discountRatio = 0.1
|
||||
}
|
||||
|
||||
if (couponForm.value.discountRatio) {
|
||||
couponForm.value.amount = formatDecimal(couponForm.value.amount * (couponForm.value.discountRatio / couponFormDiscountRate.value))
|
||||
} else {
|
||||
couponForm.value.amount = formatDecimal(+couponForm.value.originAmount)
|
||||
}
|
||||
if (couponForm.value.discountRatio) {
|
||||
couponForm.value.amount = formatDecimal(couponForm.value.amount * (couponForm.value.discountRatio / couponFormDiscountRate.value))
|
||||
} else {
|
||||
couponForm.value.amount = formatDecimal(+couponForm.value.originAmount)
|
||||
}
|
||||
|
||||
// 将优惠券/积分所有设置初始化
|
||||
couponResList1.value = []
|
||||
couponResList2.value = []
|
||||
// 将优惠券/积分所有设置初始化
|
||||
couponResList1.value = []
|
||||
couponResList2.value = []
|
||||
|
||||
couponForm.value.pointsNum = ''
|
||||
pointOptions.value.amount = 0
|
||||
}, 50)
|
||||
}
|
||||
couponForm.value.pointsNum = ''
|
||||
pointOptions.value.amount = 0
|
||||
}, 500)
|
||||
|
||||
// 积分输入格式化
|
||||
function pointInput(e) {
|
||||
@@ -704,19 +639,29 @@ function resetCouponFormHandle() {
|
||||
}
|
||||
|
||||
// 选择会员完成后
|
||||
function selectUserHandle(row) {
|
||||
couponFormUserList.value = [
|
||||
{
|
||||
id: row.userId,
|
||||
nickName: row.nickName,
|
||||
}
|
||||
]
|
||||
couponFormUser.value = row
|
||||
pointOptionsAjax()
|
||||
async function selectUserHandle(row) {
|
||||
try {
|
||||
if (showCoupon.value) {
|
||||
couponFormUserList.value = [
|
||||
{
|
||||
id: row.userId,
|
||||
nickName: row.nickName,
|
||||
}
|
||||
]
|
||||
couponFormUser.value = row
|
||||
pointOptionsAjax()
|
||||
|
||||
// 已存在选择的用户,并且切换了不通用户
|
||||
if (couponFormUser.id && row.userId != couponFormUser.value.userId) {
|
||||
resetCoupon()
|
||||
// 已存在选择的用户,并且切换了不通用户
|
||||
if (couponFormUser.id && row.userId != couponFormUser.value.userId) {
|
||||
resetCoupon()
|
||||
}
|
||||
}
|
||||
|
||||
if (payList.value[payActive.value].payType == 'member-account') {
|
||||
vipPayAjax(row)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,7 +804,7 @@ function reset() {
|
||||
buyerRemark: "", // 订单备注
|
||||
checkOrderPay: {
|
||||
orderId: goodsStore.orderListInfo.id,
|
||||
vipPrice: store.shopInfo.isMemberPrice || goodsStore.showVipPrice, // 是否使用会员价
|
||||
vipPrice: store.shopInfo.isMemberPrice ? goodsStore.showVipPrice : 0, // 是否使用会员价
|
||||
allPack: goodsStore.allSelected, // 是否整单打包
|
||||
userId: goodsStore.vipUserInfo.id,
|
||||
seatNum: goodsStore.tableInfo.num, // 用餐人数
|
||||
|
||||
@@ -58,7 +58,7 @@ import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, querySc
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { formatDecimal } from '@/utils'
|
||||
import { microPay, queryOrderStatus, microPayVip, vipPay } from '@/api/order.js'
|
||||
import { microPay, queryOrderStatus, microPayVip, vipPay, queryPayStatus } from '@/api/order.js'
|
||||
|
||||
const store = useUser();
|
||||
const global = useGlobal()
|
||||
@@ -113,6 +113,7 @@ const userPayWait = ref(false);
|
||||
const checkPayStatusLoading = ref(false);
|
||||
|
||||
const fastOrder = ref('')
|
||||
const vipPayOrder = ref('')
|
||||
|
||||
// 提交扫码支付
|
||||
async function submitHandle() {
|
||||
@@ -210,8 +211,11 @@ async function checkPayStauts(tips = true) {
|
||||
try {
|
||||
if (props.selecttype == 1) {
|
||||
// 会员扫码充值
|
||||
const res = await queryScanPay({ flowId: fastOrder.value.id });
|
||||
if (res.status == 0) {
|
||||
const res = await queryPayStatus({
|
||||
shopId: store.shopInfo.id,
|
||||
payOrderNo: fastOrder.value.payOrderNo,
|
||||
});
|
||||
if (res == 'TRADE_SUCCESS') {
|
||||
userPayWait.value = false
|
||||
loading.value = false;
|
||||
scanCode.value = "";
|
||||
@@ -220,8 +224,7 @@ async function checkPayStauts(tips = true) {
|
||||
clearAutoCheckOrder()
|
||||
emits("success");
|
||||
return;
|
||||
}
|
||||
if (res.status == 7) {
|
||||
} else if (res == 'TRADE_AWAIT') {
|
||||
if (tips) {
|
||||
ElMessage.warning("用户支付中...");
|
||||
}
|
||||
@@ -263,7 +266,6 @@ async function checkPayStauts(tips = true) {
|
||||
userPayWait.value = false
|
||||
loading.value = false;
|
||||
scanCode.value = "";
|
||||
ElMessage.success("支付成功");
|
||||
dialogVisible.value = false;
|
||||
clearAutoCheckOrder()
|
||||
emits("success");
|
||||
@@ -276,7 +278,7 @@ async function checkPayStauts(tips = true) {
|
||||
return;
|
||||
} else {
|
||||
clearAutoCheckOrder()
|
||||
ElMessage.error(res.msg);
|
||||
ElMessage.error(res.msg || '');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -292,7 +294,9 @@ function resetScanCode() {
|
||||
userPayWait.value = false;
|
||||
loading.value = false;
|
||||
scanCode.value = "";
|
||||
inputRef.value.focus();
|
||||
setTimeout(() => {
|
||||
inputRef.value.focus();
|
||||
}, 500)
|
||||
}
|
||||
|
||||
// 输入
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="tableData.list" height="440px" border stripe v-loading="tableData.loading">
|
||||
<el-table-column prop="nickName" label="昵称" width="120px" />
|
||||
<el-table-column prop="nickName" label="昵称" width="150px" />
|
||||
<el-table-column prop="phone" label="手机" width="150px" />
|
||||
<el-table-column prop="code" label="编号" width="120px" />
|
||||
<el-table-column prop="code" label="编号" width="150px" />
|
||||
<el-table-column prop="level" label="等级" />
|
||||
<el-table-column prop="accountPoints" label="积分" />
|
||||
<el-table-column prop="amount" label="余额" width="120px">
|
||||
@@ -27,7 +27,7 @@
|
||||
¥{{ formatDecimal(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120px">
|
||||
<el-table-column label="操作" width="120px" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" @click="toHomeMember(scope.row)">选择</el-button>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user