fix: 挂账管理更新,耗材盘点更新,代客下单更新
This commit is contained in:
@@ -81,15 +81,16 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
const giftMoney = computed(() => {
|
||||
let oldGiftMoney = 0
|
||||
for (let i in oldOrder.value.detailMap) {
|
||||
oldGiftMoney += oldOrder.value.detailMap[i].reduce((prve: number, cur: any) => {
|
||||
oldGiftMoney += oldOrder.value.detailMap[i].filter((v: any) => v.isGift).reduce((prve: number, cur: any) => {
|
||||
const memberPrice = cur.memberPrice || cur.salePrice
|
||||
return prve + cur.number * (useVipPrice.value ? memberPrice : cur.salePrice)
|
||||
}, 0)
|
||||
}
|
||||
return giftList.value.reduce((acc: number, cur: any) => {
|
||||
const nowTotal = giftList.value.reduce((acc: number, cur: any) => {
|
||||
const memberPrice = cur.memberPrice || cur.salePrice
|
||||
return acc + cur.number * (useVipPrice.value ? memberPrice : cur.salePrice)
|
||||
}, 0)
|
||||
return (nowTotal + oldGiftMoney)
|
||||
})
|
||||
//打包数量
|
||||
const packNum = computed(() => {
|
||||
@@ -174,6 +175,10 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
for (let i in oldOrder.value.detailMap) {
|
||||
console.log(oldOrder.value)
|
||||
total += oldOrder.value.detailMap[i].reduce((prve: number, cur: any) => {
|
||||
console.log(cur)
|
||||
if (cur.isGift) {
|
||||
return prve + 0
|
||||
}
|
||||
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
||||
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
||||
const price = (discount_sale_amount || cur.salePrice || 0)
|
||||
@@ -411,7 +416,15 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
number: v.num,
|
||||
id: v.id,
|
||||
pack_number: v.packNumber,
|
||||
discount_sale_amount: v.discountSaleAmount * 1 || 0
|
||||
discount_sale_amount: v.discountSaleAmount * 1 || 0,
|
||||
is_print: v.isPrint,
|
||||
is_wait_call: v.isWaitCall,
|
||||
is_gift: v.isGift,
|
||||
is_temporary: v.isTemporary,
|
||||
discount_sale_note: v.discountSaleNote,
|
||||
product_name: v.productName,
|
||||
sku_name: v.skuName,
|
||||
sku_id: v.skuId
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -592,6 +605,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
WebSocketManager.sendMessage(msg);
|
||||
}
|
||||
return {
|
||||
giftMoney,
|
||||
goodsTotal,
|
||||
isLinkFinshed,
|
||||
setOldOrder,
|
||||
|
||||
@@ -132,3 +132,12 @@ async function handleOperatClick(data: IOperatData) {}
|
||||
// 切换示例
|
||||
const isA = ref(true);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-table td.el-table__cell div) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,7 @@
|
||||
<el-form-item>
|
||||
<el-input
|
||||
placeholder="邀请人名称/被邀请人/昵称/手机号"
|
||||
v-model="query.search"
|
||||
v-model="query.key"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -101,6 +101,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import shopShareApi from "@/api/account/shopShare";
|
||||
|
||||
const statusList = [
|
||||
{
|
||||
value: 0,
|
||||
@@ -127,7 +129,7 @@ export default {
|
||||
avatarUrlList2: [],
|
||||
shareId: "",
|
||||
query: {
|
||||
search: "",
|
||||
key: "",
|
||||
status: "",
|
||||
},
|
||||
resetQuery: "",
|
||||
@@ -174,7 +176,7 @@ export default {
|
||||
// 获取邀请设置
|
||||
async byShopId() {
|
||||
try {
|
||||
const res = await byShopId();
|
||||
const res = await shopShareApi.get();
|
||||
this.shareId = res.id;
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
@@ -185,19 +187,19 @@ export default {
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true;
|
||||
const res = await byShare({
|
||||
const res = await shopShareApi.getRecord({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
search: this.query.search,
|
||||
key: this.query.key,
|
||||
status: this.query.status,
|
||||
shareId: this.shareId,
|
||||
});
|
||||
this.tableData.loading = false;
|
||||
this.tableData.list = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
this.tableData.list = res.records;
|
||||
this.tableData.total = res.totalRow;
|
||||
// 头像预览图集合
|
||||
this.avatarUrlList1 = res.content.map((item) => item.invitedHeadImg);
|
||||
this.avatarUrlList2 = res.content.map((item) => item.beInvitedHeadImg);
|
||||
this.avatarUrlList1 = res.records.map((item) => item.invitedHeadImg);
|
||||
this.avatarUrlList2 = res.records.map((item) => item.beInvitedHeadImg);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
<div>
|
||||
<el-dialog
|
||||
:show-close="false"
|
||||
:visible.sync="dialogVisible"
|
||||
v-model="dialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
width="30%"
|
||||
center
|
||||
>
|
||||
<div slot="title" class="dialog-title">挂账还款</div>
|
||||
<template #title>
|
||||
<div class="dialog-title">挂账还款</div>
|
||||
</template>
|
||||
<div class="content">
|
||||
<div v-if="form.repaymentMethod == 'total' && !form.creditBuyerId" class="credit_info">
|
||||
<div>挂账人:{{ form.debtor }}</div>
|
||||
@@ -22,12 +24,7 @@
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-radio-group v-model="form.repaymentMethod">
|
||||
<el-radio
|
||||
v-for="item in repaymentMethodList"
|
||||
v-if="form.repaymentMethod == item.value"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>
|
||||
<el-radio v-for="item in repaymentMethodList" :key="item.value" :label="item.value">
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
@@ -38,7 +35,7 @@
|
||||
placeholder=""
|
||||
oninput="value= value.replace(/[^\d|\.]/g, '')"
|
||||
>
|
||||
<template slot="prepend">¥</template>
|
||||
<template #prepend>¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付方式" prop="paymentMethod" style="width: 100%">
|
||||
@@ -49,18 +46,25 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import creditApi from "@/api/order/credit";
|
||||
import creditOrderApi from "@/api/order/credit-order";
|
||||
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import _ from "lodash";
|
||||
const $repaymentMethodList = [
|
||||
{ label: "按总金额还款", value: "total" },
|
||||
{ label: "按订单还款", value: "order" },
|
||||
];
|
||||
export default {
|
||||
// eslint-disable-next-line vue/require-prop-types
|
||||
props: ["couponId"],
|
||||
@@ -68,10 +72,7 @@ export default {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
repaymentMethodList: [
|
||||
{ label: "按总金额还款", value: "total" },
|
||||
{ label: "按订单还款", value: "order" },
|
||||
],
|
||||
repaymentMethodList: $repaymentMethodList,
|
||||
form: {
|
||||
id: "",
|
||||
creditBuyerId: "",
|
||||
@@ -116,11 +117,11 @@ export default {
|
||||
// if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') }
|
||||
let res;
|
||||
if (this.form.repaymentMethod === "total") {
|
||||
res = await creditRePayment(this.form);
|
||||
res = await creditApi.repayment(this.form);
|
||||
} else {
|
||||
res = await creditPayment(this.form);
|
||||
res = await creditOrderApi.pay(this.form);
|
||||
}
|
||||
this.$notify({
|
||||
ElMessage({
|
||||
title: "成功",
|
||||
message: res.repaymentMsg,
|
||||
type: "success",
|
||||
@@ -149,6 +150,9 @@ export default {
|
||||
this.form.id = row.id;
|
||||
}
|
||||
this.form.repaymentMethod = row.repaymentMethod;
|
||||
this.repaymentMethodList = $repaymentMethodList.filter(
|
||||
(item) => item.value === row.repaymentMethod
|
||||
);
|
||||
this.form.debtor = row.debtor;
|
||||
this.form.owedAmount = row.owedAmount;
|
||||
this.form.accountBalance = row.accountBalance;
|
||||
|
||||
@@ -16,7 +16,9 @@ const contentConfig: IContentConfig = {
|
||||
indexAction: function (params) {
|
||||
return creditApi.getList(params);
|
||||
},
|
||||
deleteAction: creditApi.delete,
|
||||
deleteAction: function (params) {
|
||||
return creditApi.delete(params)
|
||||
},
|
||||
// modifyAction: function (data) {
|
||||
// // return creditApi.edit(data);
|
||||
// },
|
||||
|
||||
@@ -42,12 +42,7 @@
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
<page-modal
|
||||
ref="addModalRef"
|
||||
@form-data-change="handleFormDataChange"
|
||||
:modal-config="addModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
>
|
||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||
<template #formFooter>
|
||||
<el-form-item label="" label-width="140">
|
||||
<p>一经创建无法更改还款方式</p>
|
||||
@@ -61,11 +56,17 @@
|
||||
:modal-config="editModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
<!-- 还款 -->
|
||||
<huanKuan ref="refHuanKuan" @success="refresh"></huanKuan>
|
||||
<!-- 还款记录 -->
|
||||
<huanKuanRecord ref="refHuanKuanRecord"></huanKuanRecord>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import creditApi from "@/api/order/credit";
|
||||
import huanKuan from "./components/detail/credit_repayment.vue";
|
||||
import huanKuanRecord from "./components/detail/credit_RePaymentRecord.vue";
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./config/add";
|
||||
@@ -74,19 +75,6 @@ import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
|
||||
let version = ref<string | number>("");
|
||||
function handleFormDataChange(type: string, value: string | number) {
|
||||
version.value = value;
|
||||
if (type === "version" && value !== "") {
|
||||
addModalConfig.formItems[5].hidden = false;
|
||||
return;
|
||||
}
|
||||
if (type === "version" && value == "") {
|
||||
addModalConfig.formItems[5].hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
const refVersionFile = ref<any>();
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
@@ -116,12 +104,16 @@ async function handleEditClick(row: IObject) {
|
||||
console.log({ ...row });
|
||||
editModalRef.value?.setFormData({ ...row, url: [row.url] });
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
contentRef.value?.fetchPageData();
|
||||
}
|
||||
const router = useRouter();
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string, row: any) {}
|
||||
function handleToolbarClick(name: string) {}
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
|
||||
if (data.name == "detail") {
|
||||
router.push({
|
||||
path: "/credit-detail",
|
||||
@@ -132,6 +124,23 @@ async function handleOperatClick(data: IOperatData) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log(data);
|
||||
if (data.name == "huankuan") {
|
||||
refHuanKuanShow(data.row, {});
|
||||
return;
|
||||
}
|
||||
if (data.name == "huankuan_detail") {
|
||||
refHuanKuanRecordShow(data.row, {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 还款
|
||||
const refHuanKuan = ref();
|
||||
function refHuanKuanShow(row: any, order: any) {
|
||||
refHuanKuan.value.show(row, order);
|
||||
}
|
||||
const refHuanKuanRecord = ref();
|
||||
function refHuanKuanRecordShow(row: any, order: any) {
|
||||
refHuanKuanRecord.value.show(row, order);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -60,12 +60,12 @@
|
||||
<el-table-column label="售价" prop="price">
|
||||
<template v-slot="scope">¥{{ scope.row.price }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="账存数量" prop="actualNumber"></el-table-column>
|
||||
<el-table-column label="盈亏数量" prop="winLossNumber"></el-table-column>
|
||||
<el-table-column label="盈亏金额" prop="lpAmount">
|
||||
<template v-slot="scope">¥{{ scope.row.lpAmount }}</template>
|
||||
<el-table-column label="账存数量" prop="beforeNumber"></el-table-column>
|
||||
<el-table-column label="盈亏数量" prop="inOutNumber"></el-table-column>
|
||||
<el-table-column label="盈亏金额" prop="winLossAmount">
|
||||
<template v-slot="scope">¥{{ scope.row.winLossAmount }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际库存" prop="acStockNumber"></el-table-column>
|
||||
<el-table-column label="实际库存" prop="actualNumber"></el-table-column>
|
||||
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="盘点备注" prop="remark"></el-table-column>
|
||||
</el-table>
|
||||
@@ -83,6 +83,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ElNotification } from "element-plus";
|
||||
import { formatDecimal } from "@/utils/tools.js";
|
||||
import { hasPermission } from "@/utils/limits.js";
|
||||
import stockApi from "@/api/product/stock";
|
||||
@@ -148,7 +149,6 @@ export default {
|
||||
if (valid) {
|
||||
try {
|
||||
this.form.winLossNumber = this.profitNumber;
|
||||
this.form.stockNumber = this.form.actualNumber;
|
||||
this.loading = true;
|
||||
let res = await stockApi.check({
|
||||
conId: this.form.id,
|
||||
@@ -162,7 +162,7 @@ export default {
|
||||
this.$emit("success", res);
|
||||
this.dialogVisible = false;
|
||||
this.loading = false;
|
||||
this.$notify({
|
||||
ElNotification({
|
||||
title: "注意",
|
||||
message: `添加成功`,
|
||||
type: "success",
|
||||
@@ -215,8 +215,8 @@ export default {
|
||||
conId: this.searhForm.productId,
|
||||
sort: "id,desc",
|
||||
});
|
||||
this.tableData.list = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
this.tableData.list = res.records;
|
||||
this.tableData.total = res.totalRow;
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false;
|
||||
}, 500);
|
||||
|
||||
@@ -354,6 +354,7 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
.tui {
|
||||
position: relative;
|
||||
.number {
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
|
||||
@@ -75,6 +75,10 @@
|
||||
<span class="font-bold">会员优惠</span>
|
||||
<span class="u-m-l-30">{{ carts.vipDiscount }}</span>
|
||||
</div>
|
||||
<div class="u-flex color-000 u-font-14 u-row-between">
|
||||
<span class="font-bold">赠送</span>
|
||||
<span class="u-m-l-30">{{ carts.giftMoney }}</span>
|
||||
</div>
|
||||
<div class="u-flex color-000 u-font-14 u-row-between">
|
||||
<span class="font-bold">单品改价优惠</span>
|
||||
<span class="u-m-l-30">{{ carts.singleDiscount }}</span>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<el-button
|
||||
v-for="(item, index) in controls"
|
||||
:key="index"
|
||||
size="large"
|
||||
:disabled="btnDisabled(item)"
|
||||
@click="controlsClick(item)"
|
||||
>
|
||||
@@ -27,8 +28,8 @@ import { useCartsStore } from "@/store/modules/carts";
|
||||
const carts = useCartsStore();
|
||||
|
||||
const controls = ref([
|
||||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
// { label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "gift" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "pack" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "del" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
@@ -36,10 +37,10 @@ const controls = ref([
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
{ label: "整单备注", key: "all-note", disabled: false, per: "all-note" },
|
||||
{ label: "退菜", key: "return", disabled: false, per: "return" },
|
||||
{ label: "免厨打", key: "is_print", disabled: false, per: "cart" },
|
||||
{ label: "免厨打", key: "is_print", disabled: false, per: "print" },
|
||||
{ label: "单品改价", key: "changePriceClick", disabled: false, per: "cart" },
|
||||
{ label: "等叫", key: "is_wait_call", disabled: false, per: "cart" },
|
||||
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||
// { label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||
]);
|
||||
|
||||
const emits = defineEmits(["noteClick", "changePriceClick", "packClick", "return"]);
|
||||
@@ -85,13 +86,13 @@ const perList = computed(() => {
|
||||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.isCanSelectGroup) {
|
||||
return ["all-wating", "all-note", "del", "pack"];
|
||||
return ["all-wating", "all-note", "del", "pack", "gift", "print", "one-note"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
if (carts.isOldOrder) {
|
||||
return ["return"];
|
||||
}
|
||||
return ["cart", "del", "pack", "save", "one-note", "all-note", "all-wating"];
|
||||
return ["cart", "del", "pack", "gift", "save", "one-note", "print", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
const canEdit = computed(() => {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<el-tag
|
||||
v-for="(tag, index) in tags"
|
||||
@click="addNote(tag)"
|
||||
size="medium"
|
||||
:key="index"
|
||||
closable
|
||||
@close="delTag(index)"
|
||||
@@ -15,8 +14,8 @@
|
||||
</el-tag>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息" width="120">
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="u-flex" v-if="scope.row.type == 2">
|
||||
<div class="u-flex">
|
||||
@@ -118,7 +118,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="">
|
||||
<el-table-column prop="useRestrictions" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="danger" size="small" @click="delQuan(scope.row)">删除</el-button>
|
||||
</template>
|
||||
@@ -464,7 +464,7 @@ function returnPayParams() {
|
||||
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
||||
discountRatio: 0,
|
||||
seatNum: props.perpole * 1,
|
||||
originAmount: carts.payMoney * 1 - productCouponDiscountAmount.value + seatAmount.value * 1,
|
||||
originAmount: carts.payMoney * 1 + seatAmount.value * 1,
|
||||
discountAmount: discountAmount.value,
|
||||
productCouponDiscountAmount: productCouponDiscountAmount.value * 1,
|
||||
orderAmount: currentpayMoney.value * 1,
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
<el-dialog title="单品改价" width="410px" v-model="show" @close="reset" :modal="modal">
|
||||
<div class="u-m-t-30 u-flex">
|
||||
<div class="no-wrap u-m-r-20">价格更改为</div>
|
||||
<el-input
|
||||
<el-input-number
|
||||
:min="min"
|
||||
:max="max"
|
||||
placeholder="请输入更改后的价格"
|
||||
v-model="price"
|
||||
@blur="checkPrice"
|
||||
type="number"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
></el-input-number>
|
||||
<span class="u-m-l-10 u-font-14">元</span>
|
||||
</div>
|
||||
<div class="u-m-t-16">
|
||||
<span class="color-red">*</span>
|
||||
@@ -33,6 +33,10 @@ export default {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
useVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
vipUser: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -44,6 +48,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
max: 0,
|
||||
min: 0,
|
||||
originPrice: "",
|
||||
price: "",
|
||||
@@ -72,8 +77,11 @@ export default {
|
||||
},
|
||||
open(item) {
|
||||
console.log(item);
|
||||
const memberPrice = item.memberPrice || item.salePrice;
|
||||
this.max = this.useVipPrice ? memberPrice : item.salePrice;
|
||||
this.show = true;
|
||||
const price = item.discount_sale_amount * 1 || item.salePrice * 1;
|
||||
const price =
|
||||
item.discount_sale_amount * 1 || (this.useVipPrice ? memberPrice : item.salePrice);
|
||||
this.price = price;
|
||||
this.originPrice = price;
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<el-tabs v-model="activeName" @tab-click="tabClick">
|
||||
<el-tab-pane label="优惠券(单选)" name="youhui">
|
||||
<el-table
|
||||
ref="table"
|
||||
ref="refTable"
|
||||
empty-text="无可用优惠券"
|
||||
:data="quans.fullReductionCoupon"
|
||||
@cell-click="fullReductionCouponClick"
|
||||
@@ -46,8 +46,7 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品券(多选)" name="goods">
|
||||
<el-table
|
||||
ref="table1"
|
||||
@cell-click="productCouponClick"
|
||||
ref="refTable1"
|
||||
empty-text="无可用商品券"
|
||||
:data="quans.productCoupon"
|
||||
style="width: 100%"
|
||||
@@ -55,8 +54,8 @@
|
||||
<el-table-column width="80">
|
||||
<template v-slot="scope">
|
||||
<el-checkbox
|
||||
@change="productCouponClick(scope.row)"
|
||||
:model-value="scope.row.checked"
|
||||
@change="productCouponClick($event, scope.row)"
|
||||
v-model="scope.row.checked"
|
||||
></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -120,7 +119,6 @@
|
||||
:src="scope.row.productImg"
|
||||
fit="cover"
|
||||
style="width: 40px; height: 40px"
|
||||
:preview-src-list="[scope.row.productImg]"
|
||||
></el-image>
|
||||
</div>
|
||||
<div class="u-p-l-10">
|
||||
@@ -229,6 +227,9 @@ const {
|
||||
isSetProductCoup,
|
||||
} = toRefs(state);
|
||||
|
||||
const refTable = ref();
|
||||
const refTable1 = ref();
|
||||
|
||||
let orderPrice = ref(0);
|
||||
let $originFullReductionCoupon = [];
|
||||
//可以抵扣的商品列表
|
||||
@@ -291,7 +292,8 @@ const AllCouponPrice = computed(() => {
|
||||
const payPrice = computed(() => {
|
||||
return (orderPrice.value - AllCouponPrice.value).toFixed(2);
|
||||
});
|
||||
function productCouponClick(item) {
|
||||
function productCouponClick(checked, item) {
|
||||
console.log(checked);
|
||||
if (!item.use) {
|
||||
return;
|
||||
}
|
||||
@@ -307,8 +309,12 @@ function productCouponClick(item) {
|
||||
console.log("maxSelNum", maxSelNum);
|
||||
console.log("coupMaxUseNum", coupMaxUseNum);
|
||||
console.log("canUseNum", canUseNum);
|
||||
if (!item.checked && canUseNum <= 0) {
|
||||
return ElMessage.error("购物车该商品券可使用最大数量为" + maxSelNum);
|
||||
if (checked && canUseNum <= 0) {
|
||||
ElMessage.error("购物车该商品券可使用最大数量为" + maxSelNum);
|
||||
setTimeout(() => {
|
||||
item.checked = !checked;
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fullReductionCouponSel.value.id && !item.checked) {
|
||||
@@ -361,7 +367,7 @@ function productCouponClick(item) {
|
||||
});
|
||||
}
|
||||
}
|
||||
item.checked = !item.checked;
|
||||
item.checked = checked;
|
||||
if (!item.checked) {
|
||||
const index = quansSelArr.value.findIndex((v) => v.id == item.id);
|
||||
quansSelArr.value.splice(index, 1);
|
||||
@@ -417,6 +423,7 @@ const emits = defineEmits(["confirm"]);
|
||||
function reset() {
|
||||
quansSelArr.value = [];
|
||||
fullReductionCouponSel.value = { id: "" };
|
||||
quans.value.productCoupon = [];
|
||||
}
|
||||
function confirm() {
|
||||
emits("confirm", [...quansSelArr.value], $goodsPayPriceMap, goodsArr);
|
||||
|
||||
@@ -195,7 +195,11 @@
|
||||
<!-- 临时菜 -->
|
||||
<addLingShiCai ref="refAddLingShiCai" @confirm="addLingShiCaiConfirm"></addLingShiCai>
|
||||
<!-- 改价 -->
|
||||
<changePrice ref="refChangePrice" @confirm="changePriceConfirm"></changePrice>
|
||||
<changePrice
|
||||
ref="refChangePrice"
|
||||
:useVipPrice="carts.useVipPrice"
|
||||
@confirm="changePriceConfirm"
|
||||
></changePrice>
|
||||
<!-- 称重商品 -->
|
||||
<changeWeight ref="refChangeWeight" @confirm="changeWeightConfirm"></changeWeight>
|
||||
<!-- 可选套餐 -->
|
||||
@@ -704,6 +708,7 @@ onMounted(async () => {
|
||||
oldOrder.value = res;
|
||||
orderInfo.value = res;
|
||||
showOrder.value = true;
|
||||
perpole.value = res.seatNum || 0;
|
||||
}
|
||||
}
|
||||
if (tableCode) {
|
||||
@@ -764,6 +769,7 @@ $pl: 30px;
|
||||
.diancan {
|
||||
padding-top: 10px;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
max-height: calc(100vh - 256px);
|
||||
.left {
|
||||
flex: 1;
|
||||
|
||||
@@ -31,7 +31,8 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
||||
return false;
|
||||
}
|
||||
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
|
||||
return prve + cur.num * 1;
|
||||
const num = cur.num - cur.refundNum;
|
||||
return prve + (num <= 0 ? 0 : num);
|
||||
}, 0);
|
||||
const selCoupNumber = selCoupArr
|
||||
.filter((v) => v.proId == coup.proId)
|
||||
@@ -126,7 +127,8 @@ export function returnGoodsPayPriceMap(goodsArr) {
|
||||
if (!prve.hasOwnProperty(cur.productId)) {
|
||||
prve[cur.productId] = [];
|
||||
}
|
||||
const arr = new Array(cur.num).fill(cur).map((v) => {
|
||||
const n = cur.num - cur.returnNum;
|
||||
const arr = new Array(n <= 0 ? 0 : n).fill(cur).map((v) => {
|
||||
return {
|
||||
memberPrice: v.memberPrice ? v.memberPrice : v.price,
|
||||
price: v.price,
|
||||
|
||||
@@ -32,6 +32,7 @@ const contentConfig: IContentConfig<any> = {
|
||||
prop: "user",
|
||||
templet: "custom",
|
||||
slotName: "user",
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
label: "性别",
|
||||
|
||||
Reference in New Issue
Block a user