代客下单结账增加积分优惠券支付
This commit is contained in:
parent
63ef70ab6a
commit
67a892ac01
|
|
@ -471,4 +471,50 @@ export function $activateByOrderId(data) {
|
|||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//会员积分列表
|
||||
export function $returnMemberPointsList(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/page',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 会员积分账户信息
|
||||
export function $returnMemberPoints(memberId) {
|
||||
return request({
|
||||
url: '/api/points/member-points/'+memberId,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
export function $calcUsablePoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-usable-points',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 003-根据积分计算可抵扣金额
|
||||
export function $calcDeDuctionPoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-deduction-amount',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -30,5 +30,9 @@ export const $status= {
|
|||
cleaning: {
|
||||
label: "待清台",
|
||||
type: "#FAAD14",
|
||||
},
|
||||
unbind:{
|
||||
label: "未绑定",
|
||||
type: "rgb(221,221,221)",
|
||||
}
|
||||
}
|
||||
|
|
@ -207,21 +207,24 @@ export default {
|
|||
filters: {
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.orderType.find(item => item.key == t).label;
|
||||
const item= orderEnum.orderType.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
sendTypeFilter(t) {
|
||||
if (t) {
|
||||
return orderEnum.sendType.find(item => item.key == t).label;
|
||||
const item= orderEnum.sendType.find(item => item.key == t);
|
||||
return item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
statusFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.status.find(item => item.key == t).label;
|
||||
const item= orderEnum.status.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog title="选择用户" width="850px" :visible.sync="show">
|
||||
<el-dialog title="选择用户" width="850px" :visible.sync="show" top="20px">
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="余额" prop="amount"></el-table-column>
|
||||
<el-table-column label="积分" prop="totalScore"></el-table-column>
|
||||
<el-table-column label="积分" prop="accountPoints"></el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template v-slot="scope">
|
||||
|
|
@ -99,6 +99,7 @@
|
|||
|
||||
<script>
|
||||
import { queryAllShopUser, queryAllShopInfo } from "@/api/shop";
|
||||
import { $returnMemberPointsList } from "@/api/table";
|
||||
import dayjs from "dayjs";
|
||||
let cacheData = {};
|
||||
export default {
|
||||
|
|
@ -107,6 +108,7 @@ export default {
|
|||
show: false,
|
||||
query: {
|
||||
name: "",
|
||||
isVip:1
|
||||
},
|
||||
shopInfo: {
|
||||
balanceTotal: 0,
|
||||
|
|
@ -202,7 +204,6 @@ export default {
|
|||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export default {
|
|||
}
|
||||
if (curretnMoney > money) {
|
||||
this.$message.error("实收金额不能大于总金额");
|
||||
this.form.curretnMoney = form.money;
|
||||
this.form.curretnMoney = this.form.money;
|
||||
}
|
||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
||||
|
|
@ -173,7 +173,7 @@ export default {
|
|||
},
|
||||
open(data) {
|
||||
console.log(data);
|
||||
this.form.money = data.amount;
|
||||
this.form.money = data.amount*1;
|
||||
this.form.discount = data.discount?toFixedNoRounding(data.discount.toFixed(3)):100;
|
||||
this.show = true;
|
||||
this.init();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,189 @@
|
|||
<template>
|
||||
<el-dialog width="600px" :title="title" :visible.sync="show">
|
||||
<div class="u-p-15">
|
||||
<div class="">
|
||||
<el-tabs v-model="activeName" @tab-click="tabClick">
|
||||
<el-tab-pane label="优惠券(单选)" name="youhui">
|
||||
<el-table
|
||||
empty-text="无可用优惠券"
|
||||
:data="quans.fullReductionCoupon"
|
||||
@cell-click="fullReductionCouponClick"
|
||||
>
|
||||
<el-table-column type="index" width="80" label="">
|
||||
<template v-slot="scope">
|
||||
<el-checkbox
|
||||
@change="fullReductionCouponClick(scope.row)"
|
||||
:value="scope.row.id == fullReductionCouponSel.id"
|
||||
></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope"> {{scope.row.type==1?'优惠券':'商品券'}} </template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品券(多选)" name="goods">
|
||||
<el-table
|
||||
empty-text="无可用商品券"
|
||||
:data="quans.productCoupon"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="productCouponChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope"> {{scope.row.type==1?'优惠券':'商品券'}} </template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<div v-if="quansSelArr.length > 0">
|
||||
<div class="font-bold u-m-b-10">已选优惠券</div>
|
||||
<el-table
|
||||
empty-text="未选择优惠券"
|
||||
:data="quansSelArr"
|
||||
>
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope"> {{scope.row.type==1?'优惠券':'商品券'}} </template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-row-center u-m-t-50">
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm"
|
||||
>确定</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { $activateByOrderId } from "@/api/table";
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "选择优惠券",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fullReductionCouponSel: {
|
||||
id: "",
|
||||
},
|
||||
productCouponSelArr: [],
|
||||
quansSelArr: [],
|
||||
quans: {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: [],
|
||||
},
|
||||
currentRow: null,
|
||||
multipleSelection: null,
|
||||
fullReductionCouponSelId: "",
|
||||
activeName: "youhui",
|
||||
form: {},
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
productCouponChange(val) {
|
||||
this.productCouponSelArr = val;
|
||||
if (this.productCouponSelArr.length > 0) {
|
||||
this.productCouponSelArr.length = val.length + 1;
|
||||
for (let i in val) {
|
||||
this.quansSelArr[i + 1] = val[i];
|
||||
}
|
||||
} else {
|
||||
this.quansSelArr = val;
|
||||
}
|
||||
},
|
||||
fullReductionCouponClick(row) {
|
||||
if (this.fullReductionCouponSel.id == row.id) {
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr.shift();
|
||||
|
||||
} else {
|
||||
this.fullReductionCouponSel = row;
|
||||
this.quansSelArr.unshift(row);
|
||||
}
|
||||
console.log(this.quansSelArr)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.currentRow = val;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
tabClick() {},
|
||||
init() {},
|
||||
|
||||
changeKey(key, val) {
|
||||
this[key] = val;
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.$emit("confirm", this.quansSelArr);
|
||||
this.close();
|
||||
},
|
||||
async open(data) {
|
||||
console.log(data);
|
||||
if (data.memberId) {
|
||||
let quans = await $activateByOrderId({
|
||||
orderId: data.id,
|
||||
memberId: data.memberId,
|
||||
});
|
||||
quans.fullReductionCoupon = quans.fullReductionCoupon.filter(
|
||||
(v) => v.use
|
||||
);
|
||||
quans.productCoupon = quans.productCoupon.filter((v) => v.use);
|
||||
this.quans = quans;
|
||||
}
|
||||
|
||||
this.show = true;
|
||||
this.init();
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.number = `${this.value}`;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.codeImg {
|
||||
width: 160px;
|
||||
border: 1px solid rgb(220, 223, 230);
|
||||
height: 160px;
|
||||
}
|
||||
::v-deep .el-input .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .el-input .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<template v-else>
|
||||
<div class="flex cur-pointer" @click="refChooseUserOpen">
|
||||
<img
|
||||
v-if="vipUser.headImg"
|
||||
v-if="vipUser.headImg && vipUser.headImg != 'null'"
|
||||
class="headimg"
|
||||
:src="vipUser.headImg"
|
||||
alt=""
|
||||
|
|
@ -806,11 +806,13 @@
|
|||
<div class="cashier_left">
|
||||
<!-- <div class="title">选择优惠</div> -->
|
||||
<div class="detail_box">
|
||||
<div class="usercard">
|
||||
<div class="usercard" @click="refChooseUserOpen">
|
||||
<span
|
||||
class="el-avatar el-avatar--square"
|
||||
style="height: 50px; width: 50px; line-height: 50px"
|
||||
><img v-if="vipUser.id" :src="vipUser.headImg"
|
||||
><img
|
||||
v-if="vipUser.id && vipUser.headImg != 'null'"
|
||||
:src="vipUser.headImg"
|
||||
/></span>
|
||||
<div class="info">
|
||||
<div class="nickname">
|
||||
|
|
@ -820,30 +822,94 @@
|
|||
</div>
|
||||
<div class="other_info">
|
||||
<div class="item">余额:{{ vipUser.amount | to2 }}</div>
|
||||
<div class="item">积分:{{ vipUser.totalScore }}</div>
|
||||
<div class="item">
|
||||
积分:{{ vipUser.accountPoints }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="forms">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="createOrder.form"
|
||||
label-width="60px"
|
||||
>
|
||||
<el-form-item label="优惠券">
|
||||
<el-select
|
||||
style="margin-right: 10px"
|
||||
v-model="createOrder.quan.sel"
|
||||
placeholder="选择优惠券"
|
||||
<div class="u-m-b-20 u-m-t-10" v-if="vipUser.id">
|
||||
<div class="u-flex u-flex-wrap">
|
||||
<span class="font-bold no-wrap u-m-r-20">积分抵扣</span>
|
||||
<el-radio-group
|
||||
v-model="points.selected"
|
||||
:disabled="!points.res.usable"
|
||||
@input="pointsChange"
|
||||
>
|
||||
<el-radio :label="1">全部抵扣</el-radio>
|
||||
<el-radio :label="2">部分抵扣</el-radio>
|
||||
</el-radio-group>
|
||||
<div class="u-m-l-20" v-if="points.res.usable">
|
||||
<el-input-number
|
||||
@change="pointsValueChange"
|
||||
v-if="points.selected == 1"
|
||||
disabled
|
||||
v-model="points.value"
|
||||
:min="points.minDeductionPoints"
|
||||
:max="points.maxUsablePoints"
|
||||
></el-input-number>
|
||||
<el-input-number
|
||||
@change="pointsValueChange"
|
||||
v-if="points.selected == 2"
|
||||
v-model="points.value"
|
||||
:min="points.minDeductionPoints"
|
||||
:max="points.maxUsablePoints"
|
||||
></el-input-number>
|
||||
</div>
|
||||
</div>
|
||||
<div class="color-999 u-m-t-10">
|
||||
<template v-if="points.res.usable">
|
||||
<span class="color-red">*</span>
|
||||
<span
|
||||
>最大抵扣积分{{ points.res.maxUsablePoints }}</span
|
||||
>
|
||||
</el-select>
|
||||
<el-button size="medium " type="text">
|
||||
查看不可用券
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span
|
||||
>最小抵扣积分{{
|
||||
points.res.minDeductionPoints
|
||||
}}</span
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="color-red">*</span>
|
||||
<span>{{ points.res.unusableReason || "" }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="u-flex flex-wrap">
|
||||
<span class="font-bold no-wrap">优惠券</span>
|
||||
<div
|
||||
class="border u-p-l-20 cur-pointer u-m-r-20 u-flex no-wrap u-p-t-10 u-p-b-10 border-r-4 selQuan"
|
||||
@click="showQuan"
|
||||
>
|
||||
<span class="color-999 u-p-r-10">选择优惠券</span>
|
||||
<span
|
||||
class="el-icon-arrow-down color-999 u-m-r-10"
|
||||
></span>
|
||||
</div>
|
||||
<!-- <el-button size="medium " type="text">
|
||||
查看不可用券
|
||||
</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-p-b-20" v-if="quansSelArr.length > 0">
|
||||
<div class="font-bold u-m-b-10">已选优惠券</div>
|
||||
<el-table empty-text="未选择优惠券" :data="quansSelArr">
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称">
|
||||
</el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_group">
|
||||
<el-button size="medium" @click="disCountShow">
|
||||
|
|
@ -894,13 +960,17 @@
|
|||
<div class="left">门店优惠</div>
|
||||
<div class="right">-¥0.00</div>
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<!-- <div class="detail_form_item">
|
||||
<div class="left">满减优惠</div>
|
||||
<div class="right">-¥0.00</div>
|
||||
</div>
|
||||
<div class="right">-¥{{ manjian }}</div>
|
||||
</div> -->
|
||||
<div class="detail_form_item">
|
||||
<div class="left">优惠券</div>
|
||||
<div class="right">-¥0.00</div>
|
||||
<div class="right">-¥{{ manjian }}</div>
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">积分抵扣</div>
|
||||
<div class="right">-¥{{ points.toMoney | to2 }}</div>
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">整单改价</div>
|
||||
|
|
@ -937,7 +1007,9 @@
|
|||
<div class="left">应付金额</div>
|
||||
<div class="right redfont">
|
||||
¥{{
|
||||
(createOrder.data.amount * createOrder.discount) | to2
|
||||
currentPayMoney - points.toMoney <= 0
|
||||
? 0
|
||||
: (currentPayMoney - points.toMoney) | to2
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1233,6 +1305,9 @@
|
|||
<!-- 打折 -->
|
||||
<money-discount ref="refDiscount" @confirm="ChangeDiscount">
|
||||
</money-discount>
|
||||
<!-- 优惠券 -->
|
||||
<quans-pop ref="refQuans" @confirm="quansConfirm"> </quans-pop>
|
||||
|
||||
<!-- 选择人数 -->
|
||||
<choose-diners-number
|
||||
ref="refChooseDinersNumber"
|
||||
|
|
@ -1256,6 +1331,7 @@ import chooseTable from "./components/choose-table-master.vue";
|
|||
import cartItem from "./components/cart-item.vue";
|
||||
import scanPay from "./components/scan-pay.vue";
|
||||
import moneyDiscount from "./components/discount.vue";
|
||||
import quansPop from "./components/quans.vue";
|
||||
import orderNote from "./components/note.vue";
|
||||
import chooseDinersNumber from "./components/choose-diners-number.vue";
|
||||
import returnCart from "./components/return-cart.vue";
|
||||
|
|
@ -1264,6 +1340,7 @@ import dayjs from "dayjs";
|
|||
import { tbShopInfo } from "@/api/user";
|
||||
import { hasPermission } from "@/utils/limits.js";
|
||||
import { tbOrderInfoDetail } from "@/api/order";
|
||||
import { queryAllShopUser } from "@/api/shop";
|
||||
|
||||
import {
|
||||
getGoodsLists,
|
||||
|
|
@ -1287,7 +1364,9 @@ import {
|
|||
tbShopTableGet,
|
||||
$changeUseType,
|
||||
$returnTableDetail,
|
||||
$activateByOrderId
|
||||
$activateByOrderId,
|
||||
$calcUsablePoints,
|
||||
$calcDeDuctionPoints,
|
||||
} from "@/api/table";
|
||||
import { tbShopCategoryGet } from "@/api/shop";
|
||||
import {
|
||||
|
|
@ -1305,6 +1384,7 @@ import { $status } from "@/utils/table.js";
|
|||
let $originTableList = [];
|
||||
export default {
|
||||
components: {
|
||||
quansPop,
|
||||
returnCart,
|
||||
chooseUser,
|
||||
chooseTable,
|
||||
|
|
@ -1318,6 +1398,20 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
//积分抵扣
|
||||
points: {
|
||||
res: {
|
||||
usable: true,
|
||||
},
|
||||
selected: "",
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0,
|
||||
usable: false,
|
||||
points: 0,
|
||||
toMoney: 0,
|
||||
},
|
||||
//选中可用优惠券
|
||||
quansSelArr: [],
|
||||
//台桌搜索文字
|
||||
tableSearchText: "",
|
||||
//是否允许收款
|
||||
|
|
@ -1516,6 +1610,30 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
manjian() {
|
||||
let result = 0;
|
||||
if (this.quansSelArr.length < 0) {
|
||||
result = 0;
|
||||
}
|
||||
const manjianQuan = this.quansSelArr.find((v) => v.type == 1);
|
||||
if (!manjianQuan) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = manjianQuan.discountAmount;
|
||||
}
|
||||
return result.toFixed(2);
|
||||
},
|
||||
currentPayMoney() {
|
||||
const amount = this.createOrder.data.amount || 0;
|
||||
const discount = this.createOrder.discount || 1;
|
||||
// const total=((amount - this.manjian) * this.createOrder.discount - this.points.toMoney)
|
||||
const total = (amount - this.manjian) * this.createOrder.discount;
|
||||
return total <= 0 ? 0 : total;
|
||||
},
|
||||
yinFuJinE(){
|
||||
const total=this.currentPayMoney-( this.points.toMoney||0)
|
||||
return total.toFixed(2);
|
||||
},
|
||||
disableTuicai() {
|
||||
return (
|
||||
this.order.placeNum == 1 ||
|
||||
|
|
@ -1527,7 +1645,7 @@ export default {
|
|||
},
|
||||
title() {
|
||||
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
|
||||
return '代客下单'
|
||||
return "代客下单";
|
||||
},
|
||||
allGiftMoney() {
|
||||
const nowprice = this.order.list
|
||||
|
|
@ -1691,6 +1809,13 @@ export default {
|
|||
this.goods.status = "loadmore";
|
||||
this.getGoods();
|
||||
},
|
||||
currentPayMoney: function (newval) {
|
||||
if (this.createOrder.data.memberId||this.vipUser.id) {
|
||||
this.getCalcUsablePoints().then((res) => {
|
||||
this.pointsValueChange(this.points.value);
|
||||
});
|
||||
}
|
||||
},
|
||||
"useTypes.sel": function (newval, oldval) {
|
||||
console.log(newval);
|
||||
this.setPostPay();
|
||||
|
|
@ -1710,13 +1835,13 @@ export default {
|
|||
table(newval, oldval) {
|
||||
this.setPostPay();
|
||||
this.setUseType();
|
||||
if(oldval.tableId&&newval.tableId){
|
||||
if (oldval.tableId && newval.tableId) {
|
||||
this.perpole = 1;
|
||||
this.isCreateOrder = false;
|
||||
}
|
||||
if(this.key=='isJieZhang'){
|
||||
if (this.key == "isJieZhang") {
|
||||
this.isCreateOrder = false;
|
||||
this.key=''
|
||||
this.key = "";
|
||||
}
|
||||
if (newval && newval.tableId) {
|
||||
this.createOrder.data.amount = 0;
|
||||
|
|
@ -1746,8 +1871,10 @@ export default {
|
|||
tableId: this.table.tableId,
|
||||
masterId: this.masterId,
|
||||
vipUserId: val,
|
||||
orderId:this.createOrder.data.id||'',
|
||||
orderId: this.createOrder.data.id || "",
|
||||
type: val === "" ? 1 : 0,
|
||||
}).then((res) => {
|
||||
this.createOrder.data.memberId = val.id;
|
||||
});
|
||||
},
|
||||
"prveOrder.list.length": function (val) {
|
||||
|
|
@ -1865,6 +1992,57 @@ export default {
|
|||
this.open(this.$route.query);
|
||||
},
|
||||
methods: {
|
||||
async getCalcUsablePoints() {
|
||||
const pointsRes = await $calcUsablePoints({
|
||||
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
orderAmount: this.currentPayMoney.toFixed(2),
|
||||
});
|
||||
this.points.res = pointsRes;
|
||||
this.points.minDeductionPoints = pointsRes.minDeductionPoints;
|
||||
this.points.maxUsablePoints = pointsRes.maxUsablePoints;
|
||||
if(this.points.selected){
|
||||
this.points.value = Math.min(
|
||||
this.vipUser.accountPoints,
|
||||
this.points.res.maxUsablePoints || 0
|
||||
);
|
||||
}
|
||||
return pointsRes;
|
||||
},
|
||||
//根据积分输入值变化计算抵扣金额
|
||||
pointsValueChange(e) {
|
||||
console.log(e);
|
||||
if (e == 0 || !e) {
|
||||
return (this.points.toMoney = 0);
|
||||
}
|
||||
$calcDeDuctionPoints({
|
||||
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
orderAmount: this.currentPayMoney.toFixed(2),
|
||||
points: e,
|
||||
}).then((res) => {
|
||||
this.points.toMoney = res * 1;
|
||||
});
|
||||
},
|
||||
//积分抵扣类型改变
|
||||
pointsChange(e) {
|
||||
console.log(e);
|
||||
if (e == 1) {
|
||||
this.points.value = Math.min(
|
||||
this.vipUser.accountPoints,
|
||||
this.points.res.maxUsablePoints || 0
|
||||
);
|
||||
this.pointsValueChange(this.points.value);
|
||||
}
|
||||
},
|
||||
showQuan() {
|
||||
this.$refs.refQuans.open({
|
||||
id: this.createOrder.data.id,
|
||||
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
});
|
||||
},
|
||||
quansConfirm(e) {
|
||||
console.log(e);
|
||||
this.quansSelArr = e;
|
||||
},
|
||||
searchInput(e) {
|
||||
console.log(e);
|
||||
this.tableList = $originTableList.filter((v) =>
|
||||
|
|
@ -1920,7 +2098,7 @@ export default {
|
|||
if (!canJiesuan) {
|
||||
return;
|
||||
}
|
||||
this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", {
|
||||
this.$confirm("是否确认已现金收款:" + this.yinFuJinE + "?", "快捷支付", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
|
|
@ -2042,8 +2220,8 @@ export default {
|
|||
//munchies 先付 restaurant 后付
|
||||
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
|
||||
}
|
||||
console.log('this.postPay')
|
||||
console.log(this.postPay)
|
||||
console.log("this.postPay");
|
||||
console.log(this.postPay);
|
||||
},
|
||||
//获取店铺信息
|
||||
async getShopInfo() {
|
||||
|
|
@ -2073,20 +2251,20 @@ export default {
|
|||
tableId: this.table.tableId,
|
||||
num: this.perpole,
|
||||
});
|
||||
this.order.seatFee = res
|
||||
this.order.seatFee = res;
|
||||
this.perpole = res.totalNumber || res.number;
|
||||
return res;
|
||||
},
|
||||
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
||||
async onTableChange() {
|
||||
const perpole=this.perpole || ''
|
||||
const perpole = this.perpole || "";
|
||||
const tableRes = await $returnTableDetail({
|
||||
tableId: this.table.tableId,
|
||||
});
|
||||
console.log(tableRes);
|
||||
const orderId=tableRes.orderId ||this.table.orderId
|
||||
const orderId = tableRes.orderId || this.table.orderId;
|
||||
if (orderId) {
|
||||
this.getOrderData({ orderId:orderId });
|
||||
this.getOrderData({ orderId: orderId });
|
||||
}
|
||||
const res = await this.getMasterId();
|
||||
this.masterId = res.masterId;
|
||||
|
|
@ -2112,7 +2290,7 @@ export default {
|
|||
}
|
||||
this.getCacheOrder();
|
||||
console.log(this.isCreateOrder);
|
||||
this.perpole=perpole||this.perpole
|
||||
this.perpole = perpole || this.perpole;
|
||||
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
|
||||
//不免餐位费
|
||||
await this.changePerpole();
|
||||
|
|
@ -2170,7 +2348,10 @@ export default {
|
|||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.tableList = content.filter(
|
||||
(v) => v.status != "closed" && v.status != "cleaning"
|
||||
(v) =>
|
||||
v.status != "closed" &&
|
||||
v.status != "cleaning" &&
|
||||
v.status != "unbind"
|
||||
);
|
||||
$originTableList = this.tableList;
|
||||
} catch (error) {
|
||||
|
|
@ -2251,7 +2432,7 @@ export default {
|
|||
if (!canDiscount) {
|
||||
return;
|
||||
}
|
||||
const { amount } = this.createOrder.data;
|
||||
const amount = this.createOrder.data.amount - this.manjian;
|
||||
this.refToggle("refDiscount", true, {
|
||||
amount,
|
||||
discount: this.createOrder.discount * 100,
|
||||
|
|
@ -2386,20 +2567,47 @@ export default {
|
|||
orderId: this.createOrder.data.id,
|
||||
payType: this.order.payType,
|
||||
});
|
||||
if (this.order.payType == "cash") {
|
||||
return this.$confirm(
|
||||
"是否确认已现金收款:" + this.yinFuJinE + "?",
|
||||
"快捷支付",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
this.pays();
|
||||
});
|
||||
}
|
||||
this.pays();
|
||||
},
|
||||
// 支付订单
|
||||
async pays() {
|
||||
this.loading = true;
|
||||
const userCouponInfos = this.quansSelArr.reduce((prve, cur) => {
|
||||
const index = prve.findIndex((v) => v.userCouponId == cur.couponId);
|
||||
if (index != -1) {
|
||||
prve[index].num += 1;
|
||||
} else {
|
||||
prve.push({
|
||||
userCouponId: cur.couponId,
|
||||
num: 1,
|
||||
});
|
||||
}
|
||||
return prve;
|
||||
}, []);
|
||||
try {
|
||||
const res = await $payOrder({
|
||||
tableId: this.table.tableId,
|
||||
masterId: this.masterId,
|
||||
orderId: this.createOrder.data.id,
|
||||
payType: this.order.payType,
|
||||
vipUserId: this.vipUser.id,
|
||||
vipUserId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
discount: this.createOrder.discount,
|
||||
code: this.createOrder.code,
|
||||
userCouponInfos,
|
||||
pointsNum: this.points.value,
|
||||
});
|
||||
this.loading = false;
|
||||
this.payOrderSuccess();
|
||||
|
|
@ -2471,7 +2679,7 @@ export default {
|
|||
}
|
||||
res = await $createOrder({
|
||||
masterId: this.order.masterId || this.masterId,
|
||||
vipUserId: this.vipUser.id,
|
||||
vipUserId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
tableId: this.table.tableId,
|
||||
note: this.note.content,
|
||||
postPay: this.postPay,
|
||||
|
|
@ -2485,7 +2693,7 @@ export default {
|
|||
}
|
||||
//后付款
|
||||
this.createOrder.status = "success";
|
||||
this.order.list=[];
|
||||
this.order.list = [];
|
||||
// this.getCart();
|
||||
if (this.postPay && !isNowPay) {
|
||||
this.$notify({
|
||||
|
|
@ -2990,7 +3198,7 @@ export default {
|
|||
}
|
||||
} else {
|
||||
//添加
|
||||
console.log(this.table)
|
||||
console.log(this.table);
|
||||
res = await addCart({
|
||||
masterId: this.masterId,
|
||||
vipUserId: this.vipUser.id,
|
||||
|
|
@ -3141,9 +3349,9 @@ export default {
|
|||
this.order.seatFee = seatFee
|
||||
? {
|
||||
...seatFee,
|
||||
totalNumber: seatFee.num||seatFee.number,
|
||||
totalNumber: seatFee.num || seatFee.number,
|
||||
num: seatFee.number,
|
||||
name: seatFee.name|| seatFee.productName,
|
||||
name: seatFee.name || seatFee.productName,
|
||||
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
|
||||
}
|
||||
: this.order.seatFee;
|
||||
|
|
@ -3288,6 +3496,9 @@ export default {
|
|||
} else {
|
||||
//增加
|
||||
console.log(item);
|
||||
if (item.specList.length <= 0) {
|
||||
return this.$message.error("该商品缺少skuID,skuList是空数组");
|
||||
}
|
||||
res = await addCart({
|
||||
masterId: this.masterId,
|
||||
vipUserId: this.vipUser.id,
|
||||
|
|
@ -3371,7 +3582,7 @@ export default {
|
|||
this.getCategory();
|
||||
this.getTable();
|
||||
console.log(params);
|
||||
|
||||
|
||||
if (key == "isJieZhang") {
|
||||
this.table = params.tableId ? { name: item.name } : "";
|
||||
if (params.orderId) {
|
||||
|
|
@ -3383,13 +3594,13 @@ export default {
|
|||
this.isCreateOrder = true;
|
||||
return;
|
||||
}
|
||||
if( key == "isPayOrder" ){
|
||||
this.isCreateOrder =true
|
||||
if (key == "isPayOrder") {
|
||||
this.isCreateOrder = true;
|
||||
}
|
||||
if(params.orderId) {
|
||||
if (params.orderId) {
|
||||
const orderRes = await this.getOrderData(params);
|
||||
}
|
||||
|
||||
|
||||
// this.getCart();
|
||||
// this.getCacheOrder();
|
||||
// if (!params) {
|
||||
|
|
@ -3404,26 +3615,33 @@ export default {
|
|||
? item.useType
|
||||
: item.useType.replace(/-after|-before/g, "");
|
||||
}
|
||||
|
||||
|
||||
this.table = params.tableId ? item : "";
|
||||
},
|
||||
|
||||
async getOrderData(params) {
|
||||
const orderId= params ? params.orderId : this.createOrder.data.id
|
||||
|
||||
const orderId = params ? params.orderId : this.createOrder.data.id;
|
||||
|
||||
const res = await tbOrderInfoDetail(
|
||||
params ? params.orderId : this.createOrder.data.id
|
||||
);
|
||||
if(res.memberId){
|
||||
$activateByOrderId({
|
||||
orderId,memberId:res.memberId
|
||||
})
|
||||
this.createOrder.data = res;
|
||||
if (res.memberId) {
|
||||
await this.getCalcUsablePoints();
|
||||
queryAllShopUser({ id: res.memberId }).then((res) => {
|
||||
if (res.content[0]) {
|
||||
this.vipUser = res.content[0];
|
||||
this.points.maxUsablePoints = Math.min(
|
||||
this.points.maxUsablePoints,
|
||||
this.vipUser.accountPoints || 0
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (res.status != "unpaid") {
|
||||
return res;
|
||||
}
|
||||
this.createOrder.data = res;
|
||||
this.order.packFee.totalAmount = res.seatInfo || { totalAmount: 0 };
|
||||
const goodsMap = {};
|
||||
for (let i in res.detailList) {
|
||||
|
|
@ -3511,6 +3729,11 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.selQuan {
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 4px;
|
||||
margin-left: 12px;
|
||||
}
|
||||
/* 针对所有input type="number" */
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
|
|
|
|||
Loading…
Reference in New Issue