优化添加优惠
This commit is contained in:
parent
a914adc9f8
commit
3e84edbb6c
|
|
@ -1,14 +1,11 @@
|
|||
# 本地环境
|
||||
ENV = development
|
||||
|
||||
# 测试ws
|
||||
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
|
||||
# 正式ws
|
||||
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
|
||||
|
||||
#测试ws
|
||||
VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
|
||||
# 阿伟本地ws
|
||||
# VITE_API_WSS = 'ws://192.168.2.17:9998/client'
|
||||
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
|
||||
# 正式 php
|
||||
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
||||
|
|
@ -38,5 +35,8 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
|||
# VITE_API_URL = 'http://192.168.1.35/'
|
||||
|
||||
# 测试
|
||||
VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
|
||||
# 正式
|
||||
VITE_API_URL = 'https://cashier.sxczgkj.com'
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
ENV = production
|
||||
|
||||
# 正式ws
|
||||
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
|
||||
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
|
||||
# 正式 php
|
||||
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
||||
|
|
@ -11,7 +11,7 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
|||
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
||||
|
||||
# 线上环境接口地址
|
||||
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'
|
||||
VITE_API_URL = 'https://cashier.sxczgkj.com/'
|
||||
|
||||
# 预发布接口
|
||||
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client/'
|
||||
10
.env.test
10
.env.test
|
|
@ -1,11 +1,11 @@
|
|||
# 线上环境
|
||||
ENV = test
|
||||
|
||||
#测试ws
|
||||
VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
# 测试ws
|
||||
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
|
||||
# 正式ws
|
||||
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
|
||||
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
|
||||
# 正式 php
|
||||
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
||||
|
|
@ -17,10 +17,10 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
|||
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
||||
|
||||
# 测试
|
||||
VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
|
||||
# 预发布
|
||||
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client'
|
||||
|
||||
# 正式
|
||||
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
|
||||
VITE_API_URL = 'https://cashier.sxczgkj.com/'
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取版本 pc:pc端 type 0 windows,1 安卓,2 iOS
|
||||
* @returns
|
||||
*/
|
||||
export function findVersion(source = "pc", type = 0) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/system/admin/version/${source}/${type}`,
|
||||
});
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ export default (data) => {
|
|||
</div>
|
||||
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
|
||||
<span>原价</span>
|
||||
<span>${data.amount}</span>
|
||||
<span>${data.originAmount}</span>
|
||||
</div>
|
||||
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
|
||||
<span>折扣</span>
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ function selectCoupon(row) {
|
|||
showDialog.value = false
|
||||
}
|
||||
|
||||
// 获取用户可用de优惠券
|
||||
// 获取用户可用的优惠券
|
||||
async function findCouponAjax() {
|
||||
try {
|
||||
tableData.loading = true
|
||||
|
|
@ -170,18 +170,38 @@ async function findCouponAjax() {
|
|||
tableData.list = res
|
||||
} else {
|
||||
let arr = []
|
||||
let ids = props.orderList.map(item => item.productId)
|
||||
res && res.map(item => {
|
||||
if (ids.includes(item.proId)) {
|
||||
let pro = props.orderList.find(val => val.productId == item.proId)
|
||||
let ids = props.orderList.map(item => item.product_id)
|
||||
res && res.map((item, index) => {
|
||||
|
||||
let found = ids.find(val => val == item.proId)
|
||||
let result = found !== undefined
|
||||
|
||||
if (result) {
|
||||
let pro = props.orderList.find(val => val.product_id == item.proId)
|
||||
|
||||
console.log('pro===', pro);
|
||||
|
||||
let discount = pro.lowPrice
|
||||
|
||||
if (goodsStore.showVipPrice) {
|
||||
discount = pro.memberPrice
|
||||
}
|
||||
|
||||
if (+pro.discount_sale_amount) {
|
||||
discount = pro.discount_sale_amount
|
||||
}
|
||||
|
||||
arr.push({
|
||||
...item,
|
||||
productName: pro.productName,
|
||||
lowPrice: pro.lowPrice
|
||||
lowPrice: pro.lowPrice,
|
||||
discount: discount
|
||||
})
|
||||
}
|
||||
})
|
||||
tableData.list = arr
|
||||
|
||||
console.log('tableData.list===', tableData.list);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
|||
|
|
@ -5,16 +5,20 @@
|
|||
<div class="t1">
|
||||
<span class="title">应收:¥</span>
|
||||
<span class="num">{{ money }}</span>
|
||||
</div>
|
||||
<div class="t2">
|
||||
<span>原价:¥{{ formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0)) }}</span>
|
||||
<span style="margin-left: 20px">餐位费:¥{{ formatDecimal(+goodsStore.tableInfo.tableFee || 0) }}</span>
|
||||
<span style="margin-left: 20px">优惠:¥{{ formatDecimal(props.amount - money) }}</span>
|
||||
<span style="margin-left: 20px" v-if="discountRateVlaue" @click="cancelDiscount">
|
||||
折扣:{{ discountRateVlaue }}折
|
||||
<div class="clear" v-if="money != props.amount" @click="reset">
|
||||
<span style="margin-left: 10px;">清除优惠</span>
|
||||
<el-icon style="margin-left: 6px">
|
||||
<CircleClose />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="t2">
|
||||
<span>原价:¥{{ originOrderAmount }}</span>
|
||||
<span>餐位费:¥{{ formatDecimal(+goodsStore.tableInfo.tableFee || 0) }}</span>
|
||||
<span>打包费:¥{{ formatDecimal(+goodsStore.cartInfo.packFee || 0) }}</span>
|
||||
<span>优惠:¥{{ formatDecimal(props.amount - money) }}</span>
|
||||
<span v-if="discountRateVlaue">
|
||||
<span>折扣:{{ discountRateVlaue }}折</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,7 +60,7 @@
|
|||
<div class="item" @click="amountInput('0')">0</div>
|
||||
<div class="item" @click="delHandle">
|
||||
<el-icon>
|
||||
<CloseBold />
|
||||
<Back />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -115,16 +119,10 @@
|
|||
<el-pagination layout="prev, pager, next, total" background style="margin-top: 20px"
|
||||
:total="Number(buyerTable.total)" v-model:current-page="buyerTable.page" @current-change="getBuyerList" />
|
||||
</el-dialog>
|
||||
<el-dialog v-model="showCoupon" title="添加优惠" @open="couponDialogOpen" @closed="resetCouponFormHandle" top="5vh"
|
||||
width="80%">
|
||||
<el-dialog v-model="showCoupon" :title="`添加优惠(¥${originOrderAmount})`" @open="couponDialogOpen"
|
||||
@closed="resetCouponFormHandle" top="5vh" width="80%">
|
||||
<div class="coupom_dialog">
|
||||
<el-form ref="couponFormRef" :model="couponForm" label-width="100" label-position="left">
|
||||
<el-form-item label="整单折扣">
|
||||
<el-input v-model="couponForm.discountRatio" placeholder="请输入折扣" style="width: 180px;"
|
||||
@input="discountInput">
|
||||
<template #append>折</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择会员">
|
||||
<div class="flex">
|
||||
<div class="select_wrap">
|
||||
|
|
@ -137,9 +135,16 @@
|
|||
<el-button type="danger" @click="clearCouponUser">清除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="整单折扣">
|
||||
<el-input v-model="couponForm.discountRatio" placeholder="请输入折扣" style="width: 180px;"
|
||||
@input="discountInput">
|
||||
<template #append>折</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券">
|
||||
<div style="width: 100%;">
|
||||
<el-button type="primary" :disabled="!couponFormUser.id"
|
||||
<el-button type="primary"
|
||||
:disabled="!couponFormUser.id && (!couponResList1.length && !couponResList2.length)"
|
||||
@click="showCounponModalHandle">选择优惠券</el-button>
|
||||
<div>
|
||||
<div class="title">优惠券</div>
|
||||
|
|
@ -156,11 +161,11 @@
|
|||
<div v-html="scope.row.useRestrictions"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" align="center">
|
||||
<!-- <el-table-column label="操作" width="110" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button type="danger" @click="delCoupon(scope.$index, 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -169,7 +174,12 @@
|
|||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.productName }} ¥{{ scope.row.lowPrice }}
|
||||
{{ scope.row.productName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="抵扣" prop="useRestrictions">
|
||||
<template v-slot="scope">
|
||||
<div v-html="scope.row.discount"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="描述" prop="useRestrictions">
|
||||
|
|
@ -177,38 +187,42 @@
|
|||
<div v-html="scope.row.useRestrictions"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" align="center">
|
||||
<!-- <el-table-column label="操作" width="110" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button type="danger" @click="delCoupon(scope.$index, 2)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="积分抵扣">
|
||||
<el-input v-model="couponForm.pointsNum"
|
||||
:disabled="!couponFormUser.id || !pointOptions.usable || couponForm.amount < pointOptions.minPaymentAmount"
|
||||
:placeholder="pointOptions.usable ? '请输入需要抵扣的积分' : pointOptions.unusableReason"
|
||||
v-loading="pointOptions.loading" @input="pointInput">
|
||||
<template #prepend>现有积分:{{ couponFormUser.accountPoints || 0 }}</template>
|
||||
<template #append>可抵扣金额:¥{{ pointOptions.amount || 0 }}</template>
|
||||
</el-input>
|
||||
<div class="flex">
|
||||
<el-input v-model="couponForm.pointsNum"
|
||||
:disabled="!couponFormUser.id || !pointOptions.usable || couponForm.amount < pointOptions.minPaymentAmount"
|
||||
:placeholder="pointOptions.usable ? '请输入需要抵扣的积分' : pointOptions.unusableReason"
|
||||
v-loading="pointOptions.loading" @input="pointInput">
|
||||
<template #prepend>现有积分:{{ couponFormUser.accountPoints || 0 }}</template>
|
||||
<template #append>可抵扣金额:¥{{ pointOptions.amount || 0 }}</template>
|
||||
</el-input>
|
||||
<el-button type="danger" @click="clearPoint">清除</el-button>
|
||||
</div>
|
||||
<div class="point_tips err"
|
||||
v-if="couponFormUser.id && couponForm.amount < pointOptions.minPaymentAmount">注意:订单金额不足¥{{
|
||||
formatDecimal(+pointOptions.minPaymentAmount) }},无法使用积分抵扣
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠完">
|
||||
<div class="res">
|
||||
<span class="i">¥</span> <span class="n">{{ formatDecimal(+couponForm.amount) }}</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="dialog_footer" style="display: flex;justify-content: flex-end;">
|
||||
<el-button @click="showCoupon = false">取消</el-button>
|
||||
<el-button type="primary" @click="discountConfirm">确定</el-button>
|
||||
<div class="dialog_footer">
|
||||
<div class="result">
|
||||
优惠完:
|
||||
<span class="i">¥</span> <span class="n">{{ formatDecimal(+couponForm.amount) }}</span>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button @click="showCoupon = false">取消</el-button>
|
||||
<el-button type="primary" @click="discountConfirm">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 选择会员 -->
|
||||
|
|
@ -227,16 +241,16 @@ import scanModal from "@/components/payCard/scanModal.vue";
|
|||
import SelectVipUser from '@/components/selectVipUser.vue'
|
||||
import CouponModal from '@/components/payCard/couponModal.vue'
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useGlobal } from "@/store/global.js";
|
||||
import { staffPermission } from "@/api/user.js";
|
||||
import { cashPay, buyerPage, creditPay, vipPay } from "@/api/order.js";
|
||||
import { calcUsablePoints, calcDeductionAmount } from '@/api/account.js'
|
||||
import { useGoods } from "@/store/goods.js";
|
||||
|
||||
const emit = defineEmits(["paySuccess", 'orderExpired', 'reset']);
|
||||
|
||||
const SelectVipUserRef = ref(null)
|
||||
const CouponModalRef = ref(null)
|
||||
const goodsStore = useGoods();
|
||||
const global = useGlobal();
|
||||
const store = useUser();
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -262,13 +276,16 @@ const props = defineProps({
|
|||
}
|
||||
});
|
||||
|
||||
const discountAmount = ref(null)
|
||||
|
||||
watch(props, () => {
|
||||
money.value = formatDecimal(props.amount)
|
||||
originOrderAmount.value = formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0) -
|
||||
(goodsStore.cartInfo.packFee || 0))
|
||||
payData.value.checkOrderPay.isPrint = props.isPrint
|
||||
})
|
||||
|
||||
const emit = defineEmits(["paySuccess", 'orderExpired']);
|
||||
|
||||
const originOrderAmount = ref(0)
|
||||
const money = ref("0");
|
||||
const discountRateVlaue = ref(0)
|
||||
const scanModalRef = ref(null);
|
||||
|
|
@ -353,18 +370,10 @@ function scanCodeSuccess() {
|
|||
// 会员支付
|
||||
async function vipPayAjax(row) {
|
||||
try {
|
||||
if (row.amount < money.value) {
|
||||
ElMessage.error('余额不足')
|
||||
return
|
||||
}
|
||||
|
||||
goodsStore.showVipPrice = 1
|
||||
goodsStore.vipUserInfo = row
|
||||
|
||||
goodsStore.calcCartInfo()
|
||||
|
||||
reset()
|
||||
|
||||
// if (row.amount < money.value) {
|
||||
// ElMessage.error('余额不足')
|
||||
// return
|
||||
// }
|
||||
payData.value.payType = 'userPay'
|
||||
payData.value.shopUserId = row.id
|
||||
payData.value.checkOrderPay.userId = row.userId
|
||||
|
|
@ -378,6 +387,10 @@ async function vipPayAjax(row) {
|
|||
emit("paySuccess");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
if (error.code == 701) {
|
||||
// 订单已过期需刷新购物车和订单
|
||||
emit('orderExpired')
|
||||
}
|
||||
}
|
||||
payLoading.value = false;
|
||||
}
|
||||
|
|
@ -406,11 +419,6 @@ async function payTypeChange(index, item) {
|
|||
if (item.payType == 'deposit') {
|
||||
scanModalRef.value.show();
|
||||
}
|
||||
// if (payActive.value != "buyer") {
|
||||
// if (payList.value[payActive.value].payType == "deposit") {
|
||||
|
||||
// }
|
||||
// }
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
@ -420,11 +428,6 @@ async function payTypeChange(index, item) {
|
|||
async function confirmOrder() {
|
||||
try {
|
||||
if (payLoading.value) return
|
||||
payData.value.checkOrderPay.orderAmount = formatDecimal(+money.value);
|
||||
payData.value.checkOrderPay.roundAmount = roundAmount.value;
|
||||
payData.value.checkOrderPay.vipPrice = goodsStore.vipUserInfo.userId ? 1 : 0;
|
||||
payData.value.checkOrderPay.couponList = [...couponResList1.value.map(item => item.id), ...couponResList2.value.map(item => item.id)];
|
||||
|
||||
// await staffPermission("yun_xu_shou_kuan");
|
||||
if (payList.value[payActive.value].payType == "arrears") {
|
||||
showBuyerHandle();
|
||||
|
|
@ -465,7 +468,7 @@ async function confirmOrder() {
|
|||
emit("paySuccess");
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code == 701 || error.code == 603) {
|
||||
if (error.code == 701) {
|
||||
// 订单已过期需刷新购物车和订单
|
||||
emit('orderExpired')
|
||||
}
|
||||
|
|
@ -477,26 +480,44 @@ async function confirmOrder() {
|
|||
|
||||
// 输入
|
||||
function amountInput(num) {
|
||||
if (money.value + num <= props.amount) {
|
||||
money.value = clearNoNum({ value: (money.value += num) })
|
||||
if (discountAmount.value !== null) {
|
||||
if (money.value + num <= discountAmount.value) {
|
||||
money.value = clearNoNum({ value: (money.value += num) })
|
||||
} else {
|
||||
money.value = formatDecimal(+discountAmount.value);
|
||||
}
|
||||
|
||||
roundAmount.value = formatDecimal(discountAmount.value - money.value)
|
||||
} else {
|
||||
money.value = formatDecimal(+props.amount);
|
||||
if (money.value + num <= props.amount) {
|
||||
money.value = clearNoNum({ value: (money.value += num) })
|
||||
} else {
|
||||
money.value = formatDecimal(+props.amount);
|
||||
}
|
||||
|
||||
roundAmount.value = formatDecimal(props.amount - money.value)
|
||||
}
|
||||
|
||||
roundAmount.value = formatDecimal(props.amount - money.value)
|
||||
console.log('roundAmount.value', roundAmount.value);
|
||||
payData.value.checkOrderPay.roundAmount = roundAmount.value;
|
||||
payData.value.checkOrderPay.orderAmount = money.value;
|
||||
}
|
||||
|
||||
// 删除
|
||||
function delHandle() {
|
||||
if (!money.value) return;
|
||||
money.value = money.value.substring(0, money.value.length - 1);
|
||||
if (!money.value) return; money.value = money.value.substring(0, money.value.length - 1);
|
||||
if (!money.value) {
|
||||
money.value = "0";
|
||||
}
|
||||
|
||||
roundAmount.value = formatDecimal(props.amount - money.value)
|
||||
console.log('roundAmount.value', roundAmount.value);
|
||||
if (discountAmount.value !== null) {
|
||||
roundAmount.value = formatDecimal(discountAmount.value - money.value)
|
||||
} else {
|
||||
roundAmount.value = formatDecimal(props.amount - money.value)
|
||||
}
|
||||
|
||||
|
||||
payData.value.checkOrderPay.roundAmount = roundAmount.value;
|
||||
payData.value.checkOrderPay.orderAmount = money.value;
|
||||
}
|
||||
|
||||
// 获取支付方式
|
||||
|
|
@ -513,21 +534,17 @@ async function queryPayTypeAjax() {
|
|||
});
|
||||
|
||||
payList.value = res.filter(item => item.isDisplay);
|
||||
if (payList.value[0].payType == "scanCode" && !payList.value[0].disabled) {
|
||||
scanModalRef.value.show();
|
||||
payType.value = payList.value[0].payType;
|
||||
if (payList.value.length) {
|
||||
if (payList.value[0].payType == "scanCode" && !payList.value[0].disabled) {
|
||||
scanModalRef.value.show();
|
||||
payType.value = payList.value[0].payType;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 取消折扣
|
||||
function cancelDiscount() {
|
||||
discountRateVlaue.value = 0
|
||||
money.value = formatDecimal(props.amount)
|
||||
}
|
||||
|
||||
/** 添加优惠 start */
|
||||
const showCoupon = ref(false)
|
||||
const couponFormRef = ref(null)
|
||||
|
|
@ -593,61 +610,49 @@ const discountInput = _.debounce(function (e) {
|
|||
pointOptions.value.amount = 0
|
||||
}, 500)
|
||||
|
||||
// const discountInput = (e) => {
|
||||
// setTimeout(() => {
|
||||
// couponForm.value.amount = couponForm.value.originAmount
|
||||
// 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)
|
||||
// }
|
||||
|
||||
// // 将优惠券/积分所有设置初始化
|
||||
// couponResList1.value = []
|
||||
// couponResList2.value = []
|
||||
|
||||
// couponForm.value.pointsNum = ''
|
||||
// pointOptions.value.amount = 0
|
||||
// }, 50)
|
||||
// }
|
||||
|
||||
// 积分输入格式化
|
||||
function pointInput(e) {
|
||||
setTimeout(() => {
|
||||
couponForm.value.pointsNum = inputFilterInt(e)
|
||||
// 若如果大于最大值
|
||||
if (couponForm.value.pointsNum > pointOptions.value.max) {
|
||||
couponForm.value.pointsNum = pointOptions.value.max
|
||||
}
|
||||
// 如果小于最大值
|
||||
if (couponForm.value.pointsNum < pointOptions.value.min) {
|
||||
couponForm.value.pointsNum = pointOptions.value.min
|
||||
}
|
||||
|
||||
if (!e) {
|
||||
couponForm.value.pointsNum = 0
|
||||
couponForm.value.amount = +couponForm.value.amount + +pointOptions.value.amount
|
||||
pointOptions.value.amount = 0
|
||||
}
|
||||
|
||||
// 满足条件式开始计算抵扣金额,由后端返回
|
||||
if (couponForm.value.pointsNum >= pointOptions.value.min && couponForm.value.pointsNum <= pointOptions.value.max) {
|
||||
pointOptions.value.loading = true
|
||||
calcPointMoney()
|
||||
}
|
||||
}, 50)
|
||||
// 清除积分
|
||||
function clearPoint() {
|
||||
if (couponForm.value.pointsNum > 0) {
|
||||
couponForm.value.pointsNum = ''
|
||||
couponForm.value.amount = +couponForm.value.amount + +pointOptions.value.amount
|
||||
pointOptions.value.amount = 0
|
||||
}
|
||||
}
|
||||
|
||||
// 003-根据积分计算可抵扣金额
|
||||
const calcPointMoney = _.debounce(async function () {
|
||||
// 积分输入格式化
|
||||
const pointInput = _.debounce(function (e) {
|
||||
couponForm.value.pointsNum = inputFilterInt(e)
|
||||
console.log('inputFilterInt===', couponForm.value.pointsNum);
|
||||
|
||||
// 若如果大于最大值
|
||||
if (couponForm.value.pointsNum > pointOptions.value.max) {
|
||||
couponForm.value.pointsNum = pointOptions.value.max
|
||||
}
|
||||
// 如果小于最大值
|
||||
if (couponForm.value.pointsNum < pointOptions.value.min) {
|
||||
couponForm.value.pointsNum = pointOptions.value.min
|
||||
}
|
||||
|
||||
if (!e) {
|
||||
couponForm.value.pointsNum = 0
|
||||
couponForm.value.amount = +couponForm.value.amount + +pointOptions.value.amount
|
||||
pointOptions.value.amount = 0
|
||||
}
|
||||
|
||||
console.log('pointOptions.value===', pointOptions.value);
|
||||
console.log('couponForm.value.pointsNum===', couponForm.value.pointsNum);
|
||||
|
||||
|
||||
// 满足条件式开始计算抵扣金额,由后端返回
|
||||
if (couponForm.value.pointsNum >= pointOptions.value.min && couponForm.value.pointsNum <= pointOptions.value.max) {
|
||||
pointOptions.value.loading = true
|
||||
calcPointMoney()
|
||||
}
|
||||
}, 500)
|
||||
|
||||
|
||||
// 根据积分计算可抵扣金额
|
||||
const calcPointMoney = async () => {
|
||||
try {
|
||||
const res = await calcDeductionAmount({
|
||||
shopUserId: couponFormUser.value.id,
|
||||
|
|
@ -660,11 +665,15 @@ const calcPointMoney = _.debounce(async function () {
|
|||
console.log(error);
|
||||
}
|
||||
pointOptions.value.loading = false
|
||||
}, 500)
|
||||
}
|
||||
|
||||
// 当dialog打开时
|
||||
function couponDialogOpen() {
|
||||
couponForm.value.amount = formatDecimal(money.value - (goodsStore.tableInfo.tableFee || 0))
|
||||
couponResList2Amount.value = 0
|
||||
couponForm.value.discountRatio = ''
|
||||
|
||||
// 需减去抹零金额
|
||||
couponForm.value.amount = formatDecimal(originOrderAmount.value - roundAmount.value)
|
||||
couponForm.value.originAmount = couponForm.value.amount
|
||||
resetCouponForm.value = { ...couponForm.value }
|
||||
|
||||
|
|
@ -672,7 +681,7 @@ function couponDialogOpen() {
|
|||
couponResList2.value = []
|
||||
|
||||
// 当购物车已存在用户时
|
||||
if (goodsStore.vipUserInfo.id && goodsStore.showVipPrice) {
|
||||
if (goodsStore.vipUserInfo.id) {
|
||||
couponFormUserList.value = [
|
||||
{
|
||||
id: goodsStore.vipUserInfo.userId,
|
||||
|
|
@ -680,7 +689,10 @@ function couponDialogOpen() {
|
|||
}
|
||||
]
|
||||
couponFormUser.value = goodsStore.vipUserInfo
|
||||
pointOptions()
|
||||
pointOptionsAjax()
|
||||
} else {
|
||||
couponFormUserList.value = []
|
||||
couponFormUser.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -692,6 +704,23 @@ function resetCouponFormHandle() {
|
|||
// 选择会员完成后
|
||||
async function selectUserHandle(row) {
|
||||
try {
|
||||
console.log('selectUserHandle===', row);
|
||||
goodsStore.vipUserInfo = { ...row }
|
||||
// 选择会员后重新计算会员价
|
||||
if (store.shopInfo.isMemberPrice && row.isVip) {
|
||||
goodsStore.showVipPrice = 1
|
||||
}
|
||||
goodsStore.calcCartInfo()
|
||||
|
||||
emit('reset')
|
||||
|
||||
couponForm.value.discountRatio = ''
|
||||
discountInput('')
|
||||
|
||||
setTimeout(() => {
|
||||
couponDialogOpen()
|
||||
}, 100)
|
||||
|
||||
if (showCoupon.value) {
|
||||
couponFormUserList.value = [
|
||||
{
|
||||
|
|
@ -706,10 +735,10 @@ async function selectUserHandle(row) {
|
|||
if (couponFormUser.id && row.userId != couponFormUser.value.userId) {
|
||||
resetCoupon()
|
||||
}
|
||||
}
|
||||
|
||||
if (payList.value[payActive.value].payType == 'member-account') {
|
||||
vipPayAjax(row)
|
||||
} else {
|
||||
if (payList.value[payActive.value].payType == 'member-account') {
|
||||
vipPayAjax(row)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -720,7 +749,7 @@ async function selectUserHandle(row) {
|
|||
function resetCoupon() {
|
||||
couponResList1.value = []
|
||||
couponResList2.value = []
|
||||
couponForm.value.amount = formatDecimal(couponForm.value.amount * (couponForm.value.discountRatio / couponFormDiscountRate.value))
|
||||
couponForm.value.amount = originOrderAmount.value
|
||||
}
|
||||
|
||||
// 选择完用户后开始获取积分使用配置
|
||||
|
|
@ -751,33 +780,54 @@ function showCounponModalHandle() {
|
|||
CouponModalRef.value.show(couponFormUser.value.id)
|
||||
}
|
||||
|
||||
|
||||
const couponResList2Amount = ref(0)
|
||||
// 选择完优惠券的回调事件
|
||||
function CouponModalSuccess(res) {
|
||||
console.log(res);
|
||||
couponResType.value = res.type
|
||||
clearPoint()
|
||||
|
||||
if (res.type == 2) {
|
||||
couponResList2Amount.value = 0
|
||||
couponResList1.value = []
|
||||
couponForm.value.fullCouponDiscountAmount = 0
|
||||
couponResList2.value = res.couponList
|
||||
|
||||
// 商品券
|
||||
const discountOrders = applyCoupons([...props.orderList], couponResList2.value)
|
||||
|
||||
// 计算所有的优惠金额
|
||||
discountOrders.forEach(item => {
|
||||
if (item.isCoupon) {
|
||||
if (item.discount) {
|
||||
couponResList2Amount.value += item.discount
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
couponForm.value.productCouponDiscountAmount = couponResList2Amount.value
|
||||
}
|
||||
|
||||
if (res.type == 1) {
|
||||
if (couponForm.value.amount < res.couponList[0].fullAmount) {
|
||||
ElMessage.error(`订单金额不足¥${formatDecimal(res.couponList[0].fullAmount, 2, true)},无法使用优惠券`)
|
||||
return
|
||||
} else {
|
||||
couponResList1.value = res.couponList
|
||||
couponForm.value.amount = formatDecimal(couponForm.value.amount - res.couponList[0].discountAmount)
|
||||
couponForm.value.fullCouponDiscountAmount = res.couponList[0].discountAmount
|
||||
}
|
||||
} else {
|
||||
couponResList2.value = res.couponList
|
||||
const discountOrders = applyCoupons([...props.orderList], couponResList2.value)
|
||||
console.log('discountOrder===', discountOrders);
|
||||
couponResList1.value = res.couponList
|
||||
couponForm.value.fullCouponDiscountAmount = res.couponList[0].discountAmount
|
||||
}
|
||||
|
||||
// 计算所有的优惠金额
|
||||
let amount = 0
|
||||
discountOrders.forEach(item => {
|
||||
if (item.isCoupon) {
|
||||
amount += item.price
|
||||
}
|
||||
})
|
||||
couponForm.value.productCouponDiscountAmount = amount
|
||||
couponForm.value.amount = formatDecimal(couponForm.value.amount - amount)
|
||||
let rate = 1
|
||||
if (couponForm.value.discountRatio) {
|
||||
rate = couponForm.value.discountRatio / couponFormDiscountRate.value
|
||||
}
|
||||
|
||||
// 满减券,切勿使用discount计算
|
||||
couponForm.value.amount = formatDecimal((originOrderAmount.value * rate) - (couponResList1.value.length ? couponResList1.value[0].discountAmount : 0) - couponResList2Amount.value)
|
||||
|
||||
if (couponForm.value.amount < 0) {
|
||||
couponForm.value.amount = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -796,6 +846,7 @@ const applyCoupons = (orders, coupons) => {
|
|||
eligibleProducts.forEach(product => {
|
||||
if (!couponUsed && !product.isCoupon) {
|
||||
product.isCoupon = true;
|
||||
product.discount = coupon.discount
|
||||
couponUsed = true; // 标记优惠券已使用
|
||||
}
|
||||
});
|
||||
|
|
@ -829,9 +880,6 @@ function discountConfirm() {
|
|||
let rate = couponForm.value.discountRatio / couponFormDiscountRate.value
|
||||
let discount = formatDecimal(couponForm.value.originAmount * rate)
|
||||
payData.value.checkOrderPay.discountAmount = formatDecimal(couponForm.value.originAmount - discount)
|
||||
// console.log(rate);
|
||||
// console.log(discount);
|
||||
// console.log(payData.value.checkOrderPay.discountAmount);
|
||||
} else {
|
||||
payData.value.checkOrderPay.discountAmount = 0
|
||||
}
|
||||
|
|
@ -848,19 +896,26 @@ function discountConfirm() {
|
|||
payData.value.checkOrderPay.orderAmount = couponForm.value.amount
|
||||
|
||||
// 优惠完之后加上餐位费
|
||||
money.value = formatDecimal(+couponForm.value.amount + +(goodsStore.tableInfo.tableFee || 0))
|
||||
money.value = formatDecimal(+couponForm.value.amount + +(goodsStore.tableInfo.tableFee || 0) + +(goodsStore.cartInfo.packFee || 0))
|
||||
discountAmount.value = money.value
|
||||
|
||||
payData.value.checkOrderPay.fullCouponDiscountAmount = couponForm.value.fullCouponDiscountAmount
|
||||
|
||||
showCoupon.value = false
|
||||
|
||||
payData.value.checkOrderPay.couponList = [...couponResList1.value.map(item => item.id), ...couponResList2.value.map(item => item.id)];
|
||||
payData.value.checkOrderPay.orderAmount = money.value
|
||||
}
|
||||
/** 添加优惠 end */
|
||||
|
||||
// 初始化
|
||||
function reset() {
|
||||
discountAmount.value = null
|
||||
roundAmount.value = 0
|
||||
discountRateVlaue.value = 0
|
||||
money.value = `${formatDecimal(props.amount)}`;
|
||||
originOrderAmount.value = formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0) -
|
||||
(goodsStore.cartInfo.packFee || 0))
|
||||
payData.value = {
|
||||
shopId: store.shopInfo.id,
|
||||
buyerRemark: "", // 订单备注
|
||||
|
|
@ -883,11 +938,11 @@ function reset() {
|
|||
isPrint: props.isPrint
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
queryPayTypeAjax();
|
||||
});
|
||||
if (!payList.value.length) {
|
||||
queryPayTypeAjax()
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
reset
|
||||
|
|
@ -916,23 +971,33 @@ defineExpose({
|
|||
|
||||
.t1 {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
color: var(--el-color-danger);
|
||||
font-weight: bold;
|
||||
|
||||
.title {
|
||||
font-size: var(--el-font-size-base);
|
||||
position: relative;
|
||||
top: 14px;
|
||||
bottom: 6px;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
position: relative;
|
||||
bottom: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.t2 {
|
||||
display: flex;
|
||||
color: #999;
|
||||
gap: 10px;
|
||||
padding-top: 10px;
|
||||
|
||||
span {
|
||||
|
|
@ -1054,6 +1119,9 @@ defineExpose({
|
|||
}
|
||||
|
||||
.coupom_dialog {
|
||||
height: 60vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
|
@ -1087,4 +1155,21 @@ defineExpose({
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dialog_footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
padding-top: 20px;
|
||||
|
||||
.result {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<!-- 扫码弹窗 -->
|
||||
|
||||
<template>
|
||||
<div class="dialog">
|
||||
<el-dialog title="扫码支付" width="600" v-model="dialogVisible" @open="reset" @close="clearAutoCheckOrder">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog :title="`选择会员`" top="2vh" v-model="showDialog" width="80%">
|
||||
<el-dialog :title="`选择会员`" top="3vh" v-model="showDialog" width="80%">
|
||||
<el-form inline>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入手机号搜索会员" v-model="tableData.phone" />
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<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 :data="tableData.list" height="400px" border stripe v-loading="tableData.loading">
|
||||
<el-table-column prop="nickName" label="昵称" width="150px" />
|
||||
<el-table-column prop="phone" label="手机" width="150px" />
|
||||
<el-table-column prop="code" label="编号" width="150px" />
|
||||
|
|
|
|||
|
|
@ -24,8 +24,19 @@
|
|||
<el-button plain style="width: 100%;" @click="dialogVisible = false">取消</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!goodsInfo.id"
|
||||
@click="submitSku">确认</el-button>
|
||||
<el-button type="primary" style="width: 100%;"
|
||||
:disabled="!goodsInfo.id || !+goodsInfo.isGrounding || !!+goodsInfo.isPauseSale"
|
||||
@click="submitSku">
|
||||
<template v-if="goodsInfo.id && !+goodsInfo.isGrounding">
|
||||
未上架
|
||||
</template>
|
||||
<template v-if="goodsInfo.id && +goodsInfo.isPauseSale">
|
||||
已售罄
|
||||
</template>
|
||||
<template v-if="(+goodsInfo.isGrounding && !+goodsInfo.isPauseSale) || !goodsInfo.id">
|
||||
确认
|
||||
</template>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -66,16 +77,16 @@ function submitSku() {
|
|||
|
||||
// 选择规格
|
||||
function selectedSku(index = 0, i = 0) {
|
||||
goodsInfo.value = {}
|
||||
|
||||
goods.value.selectSpec[index].selectSpecResult.map(item => {
|
||||
item.active = false
|
||||
})
|
||||
|
||||
|
||||
if (index == 0) {
|
||||
selecSkuArray.value = []
|
||||
}
|
||||
|
||||
|
||||
if (selecSkuArray.value.length - 1 > index) {
|
||||
// console.log(selecSkuArray.value.length - 1);
|
||||
// console.log(index);
|
||||
|
|
@ -86,15 +97,14 @@ function selectedSku(index = 0, i = 0) {
|
|||
|
||||
if (index < goods.value.selectSpec.length - 1) {
|
||||
selectedSkuNum.value = 0
|
||||
goods.value.selectSpec.map((item, idx) => {
|
||||
if (index < idx) {
|
||||
item.selectSpecResult.map(val => {
|
||||
val.disabled = true
|
||||
val.active = false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// goods.value.selectSpec.map((item, idx) => {
|
||||
// if (index < idx) {
|
||||
// item.selectSpecResult.map(val => {
|
||||
// val.disabled = true
|
||||
// val.active = false
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
goods.value.selectSpec[index + 1].selectSpecResult.map(item => {
|
||||
goods.value.skuList.map(val => {
|
||||
// console.log(val);
|
||||
|
|
@ -148,6 +158,8 @@ async function queryProductSkuAjax() {
|
|||
goodsInfo.value = item
|
||||
}
|
||||
})
|
||||
|
||||
console.log('goodsInfo.value===', goodsInfo.value);
|
||||
}
|
||||
|
||||
// 显示规格
|
||||
|
|
@ -156,7 +168,6 @@ function show(item, t = 'shop') {
|
|||
let arr = []
|
||||
for (let val in item.selectSpecInfo) {
|
||||
if (item.selectSpecInfo[val].length) {
|
||||
|
||||
switch (type.value) {
|
||||
case 'shop':
|
||||
arr.push({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog v-model="showDialog" title="发现新版本" width="500" :close-on-click-modal="false"
|
||||
<el-dialog v-model="showDialog" title="发现新版本" top="30vh" width="500" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" :show-close="false">
|
||||
<div class="message">
|
||||
{{ updataInfo.message }}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
<template #footer>
|
||||
<div class="footer" style="padding: 0 20px 20px;">
|
||||
<el-button v-if="!updataInfo.isUp && !isUpload" @click="closeHandle">下次更新</el-button>
|
||||
<el-button v-if="!updataInfo.isForce && !isUpload" @click="closeHandle">下次更新</el-button>
|
||||
<el-button type="primary" :loading="isUpload" @click="uplaodHandle">
|
||||
<template v-if="!uploadSucess">
|
||||
<template v-if="!isUpload">
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { findVersion } from '@/api/user.js'
|
||||
import { findVersion } from '@/api/system.js'
|
||||
import packageData from "../../package.json";
|
||||
import { ipcRenderer } from 'electron'
|
||||
import useStorage from '@/utils/useStorage.js'
|
||||
|
|
@ -44,8 +44,6 @@ const updataInfo = ref({})
|
|||
const isUpload = ref(false)
|
||||
const uploadPro = ref(0)
|
||||
const uploadSucess = ref(false)
|
||||
const uploadResponse = ref({})
|
||||
const tempFilePath = ref('')
|
||||
|
||||
// 关闭更新弹窗,下次登录在提示
|
||||
function closeHandle() {
|
||||
|
|
@ -58,10 +56,12 @@ async function findVersionAjax() {
|
|||
try {
|
||||
let updateFlag = useStorage.get('updateFlag')
|
||||
const res = await findVersion()
|
||||
let reg = /\./g;
|
||||
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) {
|
||||
showDialog.value = true
|
||||
updataInfo.value = res
|
||||
if (res && res.version) {
|
||||
let reg = /\./g;
|
||||
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) {
|
||||
showDialog.value = true
|
||||
updataInfo.value = res
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -86,9 +86,9 @@ async function uplaodHandle() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
// if (store.userInfo) {
|
||||
// findVersionAjax()
|
||||
// }
|
||||
if (store.shopInfo.id) {
|
||||
findVersionAjax()
|
||||
}
|
||||
ipcRenderer.on('updateProgress', (event, res) => {
|
||||
uploadPro.value = res
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export const useGoods = defineStore("goods", {
|
|||
vipUserInfo: {}, // 会员信息
|
||||
// tableInfo: {
|
||||
// name: "A1",
|
||||
// id: 1,
|
||||
// num: 4,
|
||||
// tableCode: "66666666",
|
||||
// }, // 台桌信息
|
||||
|
|
@ -50,6 +51,11 @@ export const useGoods = defineStore("goods", {
|
|||
pendingList: useStorage.get("pendingList") || [],
|
||||
}),
|
||||
actions: {
|
||||
// 清除会员信息
|
||||
clearVipUserInfo() {
|
||||
this.vipUserInfo = {};
|
||||
this.showVipPrice = 0;
|
||||
},
|
||||
// 恢复挂单
|
||||
async recoverPending(item) {
|
||||
let socket = useSocket();
|
||||
|
|
@ -451,7 +457,7 @@ export const useGoods = defineStore("goods", {
|
|||
}
|
||||
|
||||
item.product_id = item.productId;
|
||||
item.lowPrice = val.lowPrice || 0;
|
||||
item.lowPrice = item.price;
|
||||
item.sku_name = sku && sku.specInfo;
|
||||
item.group_type = val.groupType;
|
||||
item.goods_type = val.type;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export const useSocket = defineStore("socket", {
|
|||
}
|
||||
} else if (data.data_type == "product_update") {
|
||||
// 商品更新
|
||||
goodsStore.updateGoodsList();
|
||||
this.updateGoods();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -161,6 +161,10 @@ export const useSocket = defineStore("socket", {
|
|||
this.clearHeartBeat();
|
||||
});
|
||||
},
|
||||
updateGoods: _.throttle(function () {
|
||||
const goodsStore = useGoods();
|
||||
goodsStore.updateGoodsList();
|
||||
}, 1000),
|
||||
// 启动心跳连接
|
||||
startheartbeat() {
|
||||
this.heartbeatTimer = setInterval(() => {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ export const useUser = defineStore("user", {
|
|||
this.token = res.tokenInfo.tokenValue;
|
||||
useStorage.set("token", this.token);
|
||||
|
||||
const logo = await shopExtendDetail({ autoKey: "ticket_logo" });
|
||||
useStorage.set("shopInfo", { ...res.shopInfo, ticketLogo: logo.value });
|
||||
const logo = shopExtendDetail({ autoKey: "ticket_logo" });
|
||||
useStorage.set("shopInfo", {
|
||||
...res.shopInfo,
|
||||
ticketLogo: logo ? logo.value : "",
|
||||
});
|
||||
this.shopInfo = useStorage.get("shopInfo");
|
||||
return await this.shopStaffInfo();
|
||||
});
|
||||
|
|
@ -44,7 +47,7 @@ export const useUser = defineStore("user", {
|
|||
const res = await shopInfo_detail();
|
||||
// 获取标签小票的logo
|
||||
const logo = await shopExtendDetail({ autoKey: "ticket_logo" });
|
||||
useStorage.set("shopInfo", { ...res, ticketLogo: logo.value });
|
||||
useStorage.set("shopInfo", { ...res, ticketLogo: logo ? logo.value : "" });
|
||||
this.shopInfo = useStorage.get("shopInfo");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ export function commOrderPrintData(orderInfo) {
|
|||
loginAccount: userStore.userInfo.name,
|
||||
carts: [],
|
||||
amount: formatDecimal(orderInfo.payAmount),
|
||||
originAmount: formatDecimal(orderInfo.originAmount),
|
||||
discountAmount: formatDecimal(
|
||||
orderInfo.originAmount - orderInfo.orderAmount
|
||||
),
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<div class="pay_wrap">
|
||||
<payCard ref="payCardRef" :orderList="orderList" :amount="cartInfo.totalAmount"
|
||||
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" @orderExpired="orderExpiredHnadle"
|
||||
:isPrint="0" />
|
||||
:isPrint="0" @reset="show" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
|
||||
|
|
@ -229,6 +229,7 @@ function paySuccess() {
|
|||
useStorage.del('tableCode')
|
||||
socket.cartInit()
|
||||
goodsStore.successClearCart()
|
||||
goodsStore.clearVipUserInfo()
|
||||
}
|
||||
|
||||
const payCardRef = ref(null)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
{{ item.product_name }}
|
||||
</div>
|
||||
<div class="n">x{{ formatDecimal(+item.number, 2, true) }}</div>
|
||||
<div class="p">
|
||||
<div class="p" :class="{ undeline: goodsStore.showVipPrice && item.memberPrice }">
|
||||
<template v-if="item.is_temporary">
|
||||
<template v-if="item.is_gift">
|
||||
<span class="t_line">¥{{ formatDecimal(+item.discount_sale_amount) }}</span>
|
||||
|
|
@ -95,11 +95,25 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gift_wrap" v-if="goodsStore.showVipPrice && item.memberPrice">
|
||||
<div class="name">
|
||||
<span>[会员价]</span>
|
||||
</div>
|
||||
<div class="n"></div>
|
||||
<div class="p">
|
||||
<span>
|
||||
¥{{ formatDecimal(+item.memberPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
|
||||
const goodsStore = useGoods()
|
||||
|
||||
const props = defineProps({
|
||||
list: {
|
||||
|
|
@ -129,6 +143,11 @@ const props = defineProps({
|
|||
color: #555;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
&.undeline {
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
|
||||
.t_line {
|
||||
|
|
|
|||
|
|
@ -221,13 +221,15 @@ const cartLoading = ref(false);
|
|||
const orderInfo = ref({});
|
||||
const createOrderLoading = ref(false);
|
||||
|
||||
|
||||
// 选择会员
|
||||
function selectUser(row) {
|
||||
console.log('selectUser===', row);
|
||||
|
||||
goodsStore.vipUserInfo = { ...row }
|
||||
if (store.shopInfo.isMemberPrice && row.isVip) {
|
||||
goodsStore.showVipPrice = 1
|
||||
goodsStore.calcCartInfo()
|
||||
}
|
||||
goodsStore.calcCartInfo()
|
||||
}
|
||||
|
||||
// 挂单量
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ const submitHandle = () => {
|
|||
.userlogin(form)
|
||||
.then(async (res) => {
|
||||
// 登录成功后保存商户号
|
||||
// useStorage.set('merchantLoginAccount', form.username)
|
||||
useStorage.set('merchantLoginAccount', form.username)
|
||||
ElMessage.success("登录成功");
|
||||
goodsStore.initGoods()
|
||||
setTimeout(() => {
|
||||
|
|
@ -155,15 +155,16 @@ const submitHandle = () => {
|
|||
name: "home",
|
||||
});
|
||||
}, 1000);
|
||||
// const douyin = await douyincheckIn({
|
||||
// token: store.token,
|
||||
// loginName: res.loginName,
|
||||
// clientType: 'pc'
|
||||
// })
|
||||
// useStorage.set('douyin', douyin.userInfo)
|
||||
const douyin = await douyincheckIn({
|
||||
token: store.token,
|
||||
loginName: form.username,
|
||||
clientType: 'pc'
|
||||
})
|
||||
useStorage.set('douyin', douyin.userInfo)
|
||||
// global.updateData(true)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
loading.value = false;
|
||||
// 重新获取验证码
|
||||
captchaAjax()
|
||||
|
|
@ -203,7 +204,7 @@ onMounted(() => {
|
|||
|
||||
let merchantLoginAccount = useStorage.get('merchantLoginAccount')
|
||||
if (merchantLoginAccount) {
|
||||
form.merchantName = merchantLoginAccount
|
||||
form.username = merchantLoginAccount
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue