优化添加优惠

This commit is contained in:
gyq 2025-03-25 00:31:50 +08:00
parent a914adc9f8
commit 3e84edbb6c
19 changed files with 402 additions and 238 deletions

View File

@ -1,14 +1,11 @@
# 本地环境 # 本地环境
ENV = development ENV = development
# 测试ws
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 正式ws # 正式ws
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client' VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
#测试ws
VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 阿伟本地ws
# VITE_API_WSS = 'ws://192.168.2.17:9998/client'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api' 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 = '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'

View File

@ -2,7 +2,7 @@
ENV = production ENV = production
# 正式ws # 正式ws
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client' VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api' 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_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/' # VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client/'

View File

@ -1,11 +1,11 @@
# 线上环境 # 线上环境
ENV = test ENV = test
#测试ws # 测试ws
VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss' # VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 正式ws # 正式ws
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client' VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api' 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_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://pre-cashierclient.sxczgkj.cn/cashier-client'
# 正式 # 正式
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client' VITE_API_URL = 'https://cashier.sxczgkj.com/'

12
src/api/system.js Normal file
View File

@ -0,0 +1,12 @@
import request from "@/utils/request.js";
/**
* 获取版本 pc:pc端 type 0 windows1 安卓2 iOS
* @returns
*/
export function findVersion(source = "pc", type = 0) {
return request({
method: "get",
url: `/system/admin/version/${source}/${type}`,
});
}

View File

@ -101,7 +101,7 @@ export default (data) => {
</div> </div>
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;"> <div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
<span>原价</span> <span>原价</span>
<span>${data.amount}</span> <span>${data.originAmount}</span>
</div> </div>
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;"> <div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
<span>折扣</span> <span>折扣</span>

View File

@ -157,7 +157,7 @@ function selectCoupon(row) {
showDialog.value = false showDialog.value = false
} }
// de //
async function findCouponAjax() { async function findCouponAjax() {
try { try {
tableData.loading = true tableData.loading = true
@ -170,18 +170,38 @@ async function findCouponAjax() {
tableData.list = res tableData.list = res
} else { } else {
let arr = [] let arr = []
let ids = props.orderList.map(item => item.productId) let ids = props.orderList.map(item => item.product_id)
res && res.map(item => { res && res.map((item, index) => {
if (ids.includes(item.proId)) {
let pro = props.orderList.find(val => val.productId == item.proId) 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({ arr.push({
...item, ...item,
productName: pro.productName, productName: pro.productName,
lowPrice: pro.lowPrice lowPrice: pro.lowPrice,
discount: discount
}) })
} }
}) })
tableData.list = arr tableData.list = arr
console.log('tableData.list===', tableData.list);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);

View File

@ -5,16 +5,20 @@
<div class="t1"> <div class="t1">
<span class="title">应收:</span> <span class="title">应收:</span>
<span class="num">{{ money }}</span> <span class="num">{{ money }}</span>
</div> <div class="clear" v-if="money != props.amount" @click="reset">
<div class="t2"> <span style="margin-left: 10px;">清除优惠</span>
<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 }}
<el-icon style="margin-left: 6px"> <el-icon style="margin-left: 6px">
<CircleClose /> <CircleClose />
</el-icon> </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> </span>
</div> </div>
</div> </div>
@ -56,7 +60,7 @@
<div class="item" @click="amountInput('0')">0</div> <div class="item" @click="amountInput('0')">0</div>
<div class="item" @click="delHandle"> <div class="item" @click="delHandle">
<el-icon> <el-icon>
<CloseBold /> <Back />
</el-icon> </el-icon>
</div> </div>
</div> </div>
@ -115,16 +119,10 @@
<el-pagination layout="prev, pager, next, total" background style="margin-top: 20px" <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" /> :total="Number(buyerTable.total)" v-model:current-page="buyerTable.page" @current-change="getBuyerList" />
</el-dialog> </el-dialog>
<el-dialog v-model="showCoupon" title="添加优惠" @open="couponDialogOpen" @closed="resetCouponFormHandle" top="5vh" <el-dialog v-model="showCoupon" :title="`添加优惠(¥${originOrderAmount}`" @open="couponDialogOpen"
width="80%"> @closed="resetCouponFormHandle" top="5vh" width="80%">
<div class="coupom_dialog"> <div class="coupom_dialog">
<el-form ref="couponFormRef" :model="couponForm" label-width="100" label-position="left"> <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="选择会员"> <el-form-item label="选择会员">
<div class="flex"> <div class="flex">
<div class="select_wrap"> <div class="select_wrap">
@ -137,9 +135,16 @@
<el-button type="danger" @click="clearCouponUser">清除</el-button> <el-button type="danger" @click="clearCouponUser">清除</el-button>
</div> </div>
</el-form-item> </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="优惠券"> <el-form-item label="优惠券">
<div style="width: 100%;"> <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> @click="showCounponModalHandle">选择优惠券</el-button>
<div> <div>
<div class="title">优惠券</div> <div class="title">优惠券</div>
@ -156,11 +161,11 @@
<div v-html="scope.row.useRestrictions"></div> <div v-html="scope.row.useRestrictions"></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="110" align="center"> <!-- <el-table-column label="操作" width="110" align="center">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="danger" @click="delCoupon(scope.$index, 1)">删除</el-button> <el-button type="danger" @click="delCoupon(scope.$index, 1)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
</div> </div>
<div> <div>
@ -169,7 +174,12 @@
<el-table-column label="名称" prop="name"></el-table-column> <el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="商品信息"> <el-table-column label="商品信息">
<template v-slot="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column label="描述" prop="useRestrictions"> <el-table-column label="描述" prop="useRestrictions">
@ -177,38 +187,42 @@
<div v-html="scope.row.useRestrictions"></div> <div v-html="scope.row.useRestrictions"></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="110" align="center"> <!-- <el-table-column label="操作" width="110" align="center">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="danger" @click="delCoupon(scope.$index, 2)">删除</el-button> <el-button type="danger" @click="delCoupon(scope.$index, 2)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="积分抵扣"> <el-form-item label="积分抵扣">
<el-input v-model="couponForm.pointsNum" <div class="flex">
:disabled="!couponFormUser.id || !pointOptions.usable || couponForm.amount < pointOptions.minPaymentAmount" <el-input v-model="couponForm.pointsNum"
:placeholder="pointOptions.usable ? '请输入需要抵扣的积分' : pointOptions.unusableReason" :disabled="!couponFormUser.id || !pointOptions.usable || couponForm.amount < pointOptions.minPaymentAmount"
v-loading="pointOptions.loading" @input="pointInput"> :placeholder="pointOptions.usable ? '请输入需要抵扣的积分' : pointOptions.unusableReason"
<template #prepend>现有积分{{ couponFormUser.accountPoints || 0 }}</template> v-loading="pointOptions.loading" @input="pointInput">
<template #append>可抵扣金额{{ pointOptions.amount || 0 }}</template> <template #prepend>现有积分{{ couponFormUser.accountPoints || 0 }}</template>
</el-input> <template #append>可抵扣金额{{ pointOptions.amount || 0 }}</template>
</el-input>
<el-button type="danger" @click="clearPoint">清除</el-button>
</div>
<div class="point_tips err" <div class="point_tips err"
v-if="couponFormUser.id && couponForm.amount < pointOptions.minPaymentAmount">注意订单金额不足{{ v-if="couponFormUser.id && couponForm.amount < pointOptions.minPaymentAmount">注意订单金额不足{{
formatDecimal(+pointOptions.minPaymentAmount) }}无法使用积分抵扣 formatDecimal(+pointOptions.minPaymentAmount) }}无法使用积分抵扣
</div> </div>
</el-form-item> </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> </el-form>
</div> </div>
<div class="dialog_footer" style="display: flex;justify-content: flex-end;"> <div class="dialog_footer">
<el-button @click="showCoupon = false">取消</el-button> <div class="result">
<el-button type="primary" @click="discountConfirm">确定</el-button> 优惠完
<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> </div>
</el-dialog> </el-dialog>
<!-- 选择会员 --> <!-- 选择会员 -->
@ -227,16 +241,16 @@ import scanModal from "@/components/payCard/scanModal.vue";
import SelectVipUser from '@/components/selectVipUser.vue' import SelectVipUser from '@/components/selectVipUser.vue'
import CouponModal from '@/components/payCard/couponModal.vue' import CouponModal from '@/components/payCard/couponModal.vue'
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useGlobal } from "@/store/global.js";
import { staffPermission } from "@/api/user.js"; import { staffPermission } from "@/api/user.js";
import { cashPay, buyerPage, creditPay, vipPay } from "@/api/order.js"; import { cashPay, buyerPage, creditPay, vipPay } from "@/api/order.js";
import { calcUsablePoints, calcDeductionAmount } from '@/api/account.js' import { calcUsablePoints, calcDeductionAmount } from '@/api/account.js'
import { useGoods } from "@/store/goods.js"; import { useGoods } from "@/store/goods.js";
const emit = defineEmits(["paySuccess", 'orderExpired', 'reset']);
const SelectVipUserRef = ref(null) const SelectVipUserRef = ref(null)
const CouponModalRef = ref(null) const CouponModalRef = ref(null)
const goodsStore = useGoods(); const goodsStore = useGoods();
const global = useGlobal();
const store = useUser(); const store = useUser();
const props = defineProps({ const props = defineProps({
@ -262,13 +276,16 @@ const props = defineProps({
} }
}); });
const discountAmount = ref(null)
watch(props, () => { watch(props, () => {
money.value = formatDecimal(props.amount) money.value = formatDecimal(props.amount)
originOrderAmount.value = formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0) -
(goodsStore.cartInfo.packFee || 0))
payData.value.checkOrderPay.isPrint = props.isPrint payData.value.checkOrderPay.isPrint = props.isPrint
}) })
const emit = defineEmits(["paySuccess", 'orderExpired']); const originOrderAmount = ref(0)
const money = ref("0"); const money = ref("0");
const discountRateVlaue = ref(0) const discountRateVlaue = ref(0)
const scanModalRef = ref(null); const scanModalRef = ref(null);
@ -353,18 +370,10 @@ function scanCodeSuccess() {
// //
async function vipPayAjax(row) { async function vipPayAjax(row) {
try { try {
if (row.amount < money.value) { // if (row.amount < money.value) {
ElMessage.error('余额不足') // ElMessage.error('')
return // return
} // }
goodsStore.showVipPrice = 1
goodsStore.vipUserInfo = row
goodsStore.calcCartInfo()
reset()
payData.value.payType = 'userPay' payData.value.payType = 'userPay'
payData.value.shopUserId = row.id payData.value.shopUserId = row.id
payData.value.checkOrderPay.userId = row.userId payData.value.checkOrderPay.userId = row.userId
@ -378,6 +387,10 @@ async function vipPayAjax(row) {
emit("paySuccess"); emit("paySuccess");
} catch (error) { } catch (error) {
console.log(error); console.log(error);
if (error.code == 701) {
//
emit('orderExpired')
}
} }
payLoading.value = false; payLoading.value = false;
} }
@ -406,11 +419,6 @@ async function payTypeChange(index, item) {
if (item.payType == 'deposit') { if (item.payType == 'deposit') {
scanModalRef.value.show(); scanModalRef.value.show();
} }
// if (payActive.value != "buyer") {
// if (payList.value[payActive.value].payType == "deposit") {
// }
// }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@ -420,11 +428,6 @@ async function payTypeChange(index, item) {
async function confirmOrder() { async function confirmOrder() {
try { try {
if (payLoading.value) return 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"); // await staffPermission("yun_xu_shou_kuan");
if (payList.value[payActive.value].payType == "arrears") { if (payList.value[payActive.value].payType == "arrears") {
showBuyerHandle(); showBuyerHandle();
@ -465,7 +468,7 @@ async function confirmOrder() {
emit("paySuccess"); emit("paySuccess");
} }
} catch (error) { } catch (error) {
if (error.code == 701 || error.code == 603) { if (error.code == 701) {
// //
emit('orderExpired') emit('orderExpired')
} }
@ -477,26 +480,44 @@ async function confirmOrder() {
// //
function amountInput(num) { function amountInput(num) {
if (money.value + num <= props.amount) { if (discountAmount.value !== null) {
money.value = clearNoNum({ value: (money.value += num) }) 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 { } 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) payData.value.checkOrderPay.roundAmount = roundAmount.value;
console.log('roundAmount.value', roundAmount.value); payData.value.checkOrderPay.orderAmount = money.value;
} }
// //
function delHandle() { function delHandle() {
if (!money.value) return; if (!money.value) return; money.value = money.value.substring(0, money.value.length - 1);
money.value = money.value.substring(0, money.value.length - 1);
if (!money.value) { if (!money.value) {
money.value = "0"; money.value = "0";
} }
roundAmount.value = formatDecimal(props.amount - money.value) if (discountAmount.value !== null) {
console.log('roundAmount.value', roundAmount.value); 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); payList.value = res.filter(item => item.isDisplay);
if (payList.value[0].payType == "scanCode" && !payList.value[0].disabled) { if (payList.value.length) {
scanModalRef.value.show(); if (payList.value[0].payType == "scanCode" && !payList.value[0].disabled) {
payType.value = payList.value[0].payType; scanModalRef.value.show();
payType.value = payList.value[0].payType;
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
} }
//
function cancelDiscount() {
discountRateVlaue.value = 0
money.value = formatDecimal(props.amount)
}
/** 添加优惠 start */ /** 添加优惠 start */
const showCoupon = ref(false) const showCoupon = ref(false)
const couponFormRef = ref(null) const couponFormRef = ref(null)
@ -593,61 +610,49 @@ const discountInput = _.debounce(function (e) {
pointOptions.value.amount = 0 pointOptions.value.amount = 0
}, 500) }, 500)
// const discountInput = (e) => { //
// setTimeout(() => { function clearPoint() {
// couponForm.value.amount = couponForm.value.originAmount if (couponForm.value.pointsNum > 0) {
// couponForm.value.discountRatio = inputFilterFloat(e) couponForm.value.pointsNum = ''
// if (couponForm.value.discountRatio > 9.9) { couponForm.value.amount = +couponForm.value.amount + +pointOptions.value.amount
// couponForm.value.discountRatio = 9.9 pointOptions.value.amount = 0
// } }
// 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)
} }
// 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 { try {
const res = await calcDeductionAmount({ const res = await calcDeductionAmount({
shopUserId: couponFormUser.value.id, shopUserId: couponFormUser.value.id,
@ -660,11 +665,15 @@ const calcPointMoney = _.debounce(async function () {
console.log(error); console.log(error);
} }
pointOptions.value.loading = false pointOptions.value.loading = false
}, 500) }
// dialog // dialog
function couponDialogOpen() { 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 couponForm.value.originAmount = couponForm.value.amount
resetCouponForm.value = { ...couponForm.value } resetCouponForm.value = { ...couponForm.value }
@ -672,7 +681,7 @@ function couponDialogOpen() {
couponResList2.value = [] couponResList2.value = []
// //
if (goodsStore.vipUserInfo.id && goodsStore.showVipPrice) { if (goodsStore.vipUserInfo.id) {
couponFormUserList.value = [ couponFormUserList.value = [
{ {
id: goodsStore.vipUserInfo.userId, id: goodsStore.vipUserInfo.userId,
@ -680,7 +689,10 @@ function couponDialogOpen() {
} }
] ]
couponFormUser.value = goodsStore.vipUserInfo couponFormUser.value = goodsStore.vipUserInfo
pointOptions() pointOptionsAjax()
} else {
couponFormUserList.value = []
couponFormUser.value = ''
} }
} }
@ -692,6 +704,23 @@ function resetCouponFormHandle() {
// //
async function selectUserHandle(row) { async function selectUserHandle(row) {
try { 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) { if (showCoupon.value) {
couponFormUserList.value = [ couponFormUserList.value = [
{ {
@ -706,10 +735,10 @@ async function selectUserHandle(row) {
if (couponFormUser.id && row.userId != couponFormUser.value.userId) { if (couponFormUser.id && row.userId != couponFormUser.value.userId) {
resetCoupon() resetCoupon()
} }
} } else {
if (payList.value[payActive.value].payType == 'member-account') {
if (payList.value[payActive.value].payType == 'member-account') { vipPayAjax(row)
vipPayAjax(row) }
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -720,7 +749,7 @@ async function selectUserHandle(row) {
function resetCoupon() { function resetCoupon() {
couponResList1.value = [] couponResList1.value = []
couponResList2.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) CouponModalRef.value.show(couponFormUser.value.id)
} }
const couponResList2Amount = ref(0)
// //
function CouponModalSuccess(res) { function CouponModalSuccess(res) {
console.log(res); console.log(res);
couponResType.value = res.type 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 (res.type == 1) {
if (couponForm.value.amount < res.couponList[0].fullAmount) { if (couponForm.value.amount < res.couponList[0].fullAmount) {
ElMessage.error(`订单金额不足¥${formatDecimal(res.couponList[0].fullAmount, 2, true)},无法使用优惠券`) ElMessage.error(`订单金额不足¥${formatDecimal(res.couponList[0].fullAmount, 2, true)},无法使用优惠券`)
return 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 { couponResList1.value = res.couponList
couponResList2.value = res.couponList couponForm.value.fullCouponDiscountAmount = res.couponList[0].discountAmount
const discountOrders = applyCoupons([...props.orderList], couponResList2.value) }
console.log('discountOrder===', discountOrders);
// let rate = 1
let amount = 0 if (couponForm.value.discountRatio) {
discountOrders.forEach(item => { rate = couponForm.value.discountRatio / couponFormDiscountRate.value
if (item.isCoupon) { }
amount += item.price
} // 使discount
}) couponForm.value.amount = formatDecimal((originOrderAmount.value * rate) - (couponResList1.value.length ? couponResList1.value[0].discountAmount : 0) - couponResList2Amount.value)
couponForm.value.productCouponDiscountAmount = amount
couponForm.value.amount = formatDecimal(couponForm.value.amount - amount) if (couponForm.value.amount < 0) {
couponForm.value.amount = 0
} }
} }
@ -796,6 +846,7 @@ const applyCoupons = (orders, coupons) => {
eligibleProducts.forEach(product => { eligibleProducts.forEach(product => {
if (!couponUsed && !product.isCoupon) { if (!couponUsed && !product.isCoupon) {
product.isCoupon = true; product.isCoupon = true;
product.discount = coupon.discount
couponUsed = true; // 使 couponUsed = true; // 使
} }
}); });
@ -829,9 +880,6 @@ function discountConfirm() {
let rate = couponForm.value.discountRatio / couponFormDiscountRate.value let rate = couponForm.value.discountRatio / couponFormDiscountRate.value
let discount = formatDecimal(couponForm.value.originAmount * rate) let discount = formatDecimal(couponForm.value.originAmount * rate)
payData.value.checkOrderPay.discountAmount = formatDecimal(couponForm.value.originAmount - discount) payData.value.checkOrderPay.discountAmount = formatDecimal(couponForm.value.originAmount - discount)
// console.log(rate);
// console.log(discount);
// console.log(payData.value.checkOrderPay.discountAmount);
} else { } else {
payData.value.checkOrderPay.discountAmount = 0 payData.value.checkOrderPay.discountAmount = 0
} }
@ -848,19 +896,26 @@ function discountConfirm() {
payData.value.checkOrderPay.orderAmount = couponForm.value.amount 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 payData.value.checkOrderPay.fullCouponDiscountAmount = couponForm.value.fullCouponDiscountAmount
showCoupon.value = false 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 */ /** 添加优惠 end */
// //
function reset() { function reset() {
discountAmount.value = null
roundAmount.value = 0 roundAmount.value = 0
discountRateVlaue.value = 0 discountRateVlaue.value = 0
money.value = `${formatDecimal(props.amount)}`; money.value = `${formatDecimal(props.amount)}`;
originOrderAmount.value = formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0) -
(goodsStore.cartInfo.packFee || 0))
payData.value = { payData.value = {
shopId: store.shopInfo.id, shopId: store.shopInfo.id,
buyerRemark: "", // buyerRemark: "", //
@ -883,11 +938,11 @@ function reset() {
isPrint: props.isPrint isPrint: props.isPrint
}, },
}; };
}
onMounted(() => { if (!payList.value.length) {
queryPayTypeAjax(); queryPayTypeAjax()
}); }
}
defineExpose({ defineExpose({
reset reset
@ -916,23 +971,33 @@ defineExpose({
.t1 { .t1 {
display: flex; display: flex;
align-items: flex-end;
color: var(--el-color-danger); color: var(--el-color-danger);
font-weight: bold; font-weight: bold;
.title { .title {
font-size: var(--el-font-size-base); font-size: var(--el-font-size-base);
position: relative; position: relative;
top: 14px; bottom: 6px;
} }
.num { .num {
font-size: 30px; font-size: 30px;
} }
.clear {
position: relative;
bottom: 6px;
display: flex;
align-items: center;
margin-left: 20px;
}
} }
.t2 { .t2 {
display: flex; display: flex;
color: #999; color: #999;
gap: 10px;
padding-top: 10px; padding-top: 10px;
span { span {
@ -1054,6 +1119,9 @@ defineExpose({
} }
.coupom_dialog { .coupom_dialog {
height: 60vh;
overflow-y: auto;
.title { .title {
font-size: 16px; 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> </style>

View File

@ -1,5 +1,4 @@
<!-- 扫码弹窗 --> <!-- 扫码弹窗 -->
<template> <template>
<div class="dialog"> <div class="dialog">
<el-dialog title="扫码支付" width="600" v-model="dialogVisible" @open="reset" @close="clearAutoCheckOrder"> <el-dialog title="扫码支付" width="600" v-model="dialogVisible" @open="reset" @close="clearAutoCheckOrder">

View File

@ -1,5 +1,5 @@
<template> <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 inline>
<el-form-item> <el-form-item>
<el-input placeholder="请输入手机号搜索会员" v-model="tableData.phone" /> <el-input placeholder="请输入手机号搜索会员" v-model="tableData.phone" />
@ -16,7 +16,7 @@
<el-button @click="resetTable">重置</el-button> <el-button @click="resetTable">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </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="nickName" label="昵称" width="150px" />
<el-table-column prop="phone" label="手机" width="150px" /> <el-table-column prop="phone" label="手机" width="150px" />
<el-table-column prop="code" label="编号" width="150px" /> <el-table-column prop="code" label="编号" width="150px" />

View File

@ -24,8 +24,19 @@
<el-button plain style="width: 100%;" @click="dialogVisible = false">取消</el-button> <el-button plain style="width: 100%;" @click="dialogVisible = false">取消</el-button>
</div> </div>
<div class="btn"> <div class="btn">
<el-button type="primary" style="width: 100%;" :disabled="!goodsInfo.id" <el-button type="primary" style="width: 100%;"
@click="submitSku">确认</el-button> :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> </div>
</div> </div>
@ -66,16 +77,16 @@ function submitSku() {
// //
function selectedSku(index = 0, i = 0) { function selectedSku(index = 0, i = 0) {
goodsInfo.value = {}
goods.value.selectSpec[index].selectSpecResult.map(item => { goods.value.selectSpec[index].selectSpecResult.map(item => {
item.active = false item.active = false
}) })
if (index == 0) { if (index == 0) {
selecSkuArray.value = [] selecSkuArray.value = []
} }
if (selecSkuArray.value.length - 1 > index) { if (selecSkuArray.value.length - 1 > index) {
// console.log(selecSkuArray.value.length - 1); // console.log(selecSkuArray.value.length - 1);
// console.log(index); // console.log(index);
@ -86,15 +97,14 @@ function selectedSku(index = 0, i = 0) {
if (index < goods.value.selectSpec.length - 1) { if (index < goods.value.selectSpec.length - 1) {
selectedSkuNum.value = 0 selectedSkuNum.value = 0
goods.value.selectSpec.map((item, idx) => { // goods.value.selectSpec.map((item, idx) => {
if (index < idx) { // if (index < idx) {
item.selectSpecResult.map(val => { // item.selectSpecResult.map(val => {
val.disabled = true // val.disabled = true
val.active = false // val.active = false
}) // })
} // }
}) // })
goods.value.selectSpec[index + 1].selectSpecResult.map(item => { goods.value.selectSpec[index + 1].selectSpecResult.map(item => {
goods.value.skuList.map(val => { goods.value.skuList.map(val => {
// console.log(val); // console.log(val);
@ -148,6 +158,8 @@ async function queryProductSkuAjax() {
goodsInfo.value = item goodsInfo.value = item
} }
}) })
console.log('goodsInfo.value===', goodsInfo.value);
} }
// //
@ -156,7 +168,6 @@ function show(item, t = 'shop') {
let arr = [] let arr = []
for (let val in item.selectSpecInfo) { for (let val in item.selectSpecInfo) {
if (item.selectSpecInfo[val].length) { if (item.selectSpecInfo[val].length) {
switch (type.value) { switch (type.value) {
case 'shop': case 'shop':
arr.push({ arr.push({

View File

@ -1,5 +1,5 @@
<template> <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"> :close-on-press-escape="false" :show-close="false">
<div class="message"> <div class="message">
{{ updataInfo.message }} {{ updataInfo.message }}
@ -9,7 +9,7 @@
</div> </div>
<template #footer> <template #footer>
<div class="footer" style="padding: 0 20px 20px;"> <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"> <el-button type="primary" :loading="isUpload" @click="uplaodHandle">
<template v-if="!uploadSucess"> <template v-if="!uploadSucess">
<template v-if="!isUpload"> <template v-if="!isUpload">
@ -30,7 +30,7 @@
<script setup> <script setup>
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { findVersion } from '@/api/user.js' import { findVersion } from '@/api/system.js'
import packageData from "../../package.json"; import packageData from "../../package.json";
import { ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
import useStorage from '@/utils/useStorage.js' import useStorage from '@/utils/useStorage.js'
@ -44,8 +44,6 @@ const updataInfo = ref({})
const isUpload = ref(false) const isUpload = ref(false)
const uploadPro = ref(0) const uploadPro = ref(0)
const uploadSucess = ref(false) const uploadSucess = ref(false)
const uploadResponse = ref({})
const tempFilePath = ref('')
// //
function closeHandle() { function closeHandle() {
@ -58,10 +56,12 @@ async function findVersionAjax() {
try { try {
let updateFlag = useStorage.get('updateFlag') let updateFlag = useStorage.get('updateFlag')
const res = await findVersion() const res = await findVersion()
let reg = /\./g; if (res && res.version) {
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) { let reg = /\./g;
showDialog.value = true if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) {
updataInfo.value = res showDialog.value = true
updataInfo.value = res
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -86,9 +86,9 @@ async function uplaodHandle() {
} }
onMounted(() => { onMounted(() => {
// if (store.userInfo) { if (store.shopInfo.id) {
// findVersionAjax() findVersionAjax()
// } }
ipcRenderer.on('updateProgress', (event, res) => { ipcRenderer.on('updateProgress', (event, res) => {
uploadPro.value = res uploadPro.value = res
}) })

View File

@ -16,6 +16,7 @@ export const useGoods = defineStore("goods", {
vipUserInfo: {}, // 会员信息 vipUserInfo: {}, // 会员信息
// tableInfo: { // tableInfo: {
// name: "A1", // name: "A1",
// id: 1,
// num: 4, // num: 4,
// tableCode: "66666666", // tableCode: "66666666",
// }, // 台桌信息 // }, // 台桌信息
@ -50,6 +51,11 @@ export const useGoods = defineStore("goods", {
pendingList: useStorage.get("pendingList") || [], pendingList: useStorage.get("pendingList") || [],
}), }),
actions: { actions: {
// 清除会员信息
clearVipUserInfo() {
this.vipUserInfo = {};
this.showVipPrice = 0;
},
// 恢复挂单 // 恢复挂单
async recoverPending(item) { async recoverPending(item) {
let socket = useSocket(); let socket = useSocket();
@ -451,7 +457,7 @@ export const useGoods = defineStore("goods", {
} }
item.product_id = item.productId; item.product_id = item.productId;
item.lowPrice = val.lowPrice || 0; item.lowPrice = item.price;
item.sku_name = sku && sku.specInfo; item.sku_name = sku && sku.specInfo;
item.group_type = val.groupType; item.group_type = val.groupType;
item.goods_type = val.type; item.goods_type = val.type;

View File

@ -145,7 +145,7 @@ export const useSocket = defineStore("socket", {
} }
} else if (data.data_type == "product_update") { } else if (data.data_type == "product_update") {
// 商品更新 // 商品更新
goodsStore.updateGoodsList(); this.updateGoods();
} }
}); });
@ -161,6 +161,10 @@ export const useSocket = defineStore("socket", {
this.clearHeartBeat(); this.clearHeartBeat();
}); });
}, },
updateGoods: _.throttle(function () {
const goodsStore = useGoods();
goodsStore.updateGoodsList();
}, 1000),
// 启动心跳连接 // 启动心跳连接
startheartbeat() { startheartbeat() {
this.heartbeatTimer = setInterval(() => { this.heartbeatTimer = setInterval(() => {

View File

@ -22,8 +22,11 @@ export const useUser = defineStore("user", {
this.token = res.tokenInfo.tokenValue; this.token = res.tokenInfo.tokenValue;
useStorage.set("token", this.token); useStorage.set("token", this.token);
const logo = await shopExtendDetail({ autoKey: "ticket_logo" }); const logo = shopExtendDetail({ autoKey: "ticket_logo" });
useStorage.set("shopInfo", { ...res.shopInfo, ticketLogo: logo.value }); useStorage.set("shopInfo", {
...res.shopInfo,
ticketLogo: logo ? logo.value : "",
});
this.shopInfo = useStorage.get("shopInfo"); this.shopInfo = useStorage.get("shopInfo");
return await this.shopStaffInfo(); return await this.shopStaffInfo();
}); });
@ -44,7 +47,7 @@ export const useUser = defineStore("user", {
const res = await shopInfo_detail(); const res = await shopInfo_detail();
// 获取标签小票的logo // 获取标签小票的logo
const logo = await shopExtendDetail({ autoKey: "ticket_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"); this.shopInfo = useStorage.get("shopInfo");
} catch (error) { } catch (error) {
console.log(error); console.log(error);

View File

@ -163,6 +163,7 @@ export function commOrderPrintData(orderInfo) {
loginAccount: userStore.userInfo.name, loginAccount: userStore.userInfo.name,
carts: [], carts: [],
amount: formatDecimal(orderInfo.payAmount), amount: formatDecimal(orderInfo.payAmount),
originAmount: formatDecimal(orderInfo.originAmount),
discountAmount: formatDecimal( discountAmount: formatDecimal(
orderInfo.originAmount - orderInfo.orderAmount orderInfo.originAmount - orderInfo.orderAmount
), ),

View File

@ -45,7 +45,7 @@
<div class="pay_wrap"> <div class="pay_wrap">
<payCard ref="payCardRef" :orderList="orderList" :amount="cartInfo.totalAmount" <payCard ref="payCardRef" :orderList="orderList" :amount="cartInfo.totalAmount"
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" @orderExpired="orderExpiredHnadle" :orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" @orderExpired="orderExpiredHnadle"
:isPrint="0" /> :isPrint="0" @reset="show" />
</div> </div>
</div> </div>
<!-- <el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)"> <!-- <el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
@ -229,6 +229,7 @@ function paySuccess() {
useStorage.del('tableCode') useStorage.del('tableCode')
socket.cartInit() socket.cartInit()
goodsStore.successClearCart() goodsStore.successClearCart()
goodsStore.clearVipUserInfo()
} }
const payCardRef = ref(null) const payCardRef = ref(null)

View File

@ -6,7 +6,7 @@
{{ item.product_name }} {{ item.product_name }}
</div> </div>
<div class="n">x{{ formatDecimal(+item.number, 2, true) }}</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_temporary">
<template v-if="item.is_gift"> <template v-if="item.is_gift">
<span class="t_line">{{ formatDecimal(+item.discount_sale_amount) }}</span> <span class="t_line">{{ formatDecimal(+item.discount_sale_amount) }}</span>
@ -95,11 +95,25 @@
</span> </span>
</div> </div>
</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> </div>
</template> </template>
<script setup> <script setup>
import { formatDecimal } from '@/utils/index.js' import { formatDecimal } from '@/utils/index.js'
import { useGoods } from '@/store/goods.js'
const goodsStore = useGoods()
const props = defineProps({ const props = defineProps({
list: { list: {
@ -129,6 +143,11 @@ const props = defineProps({
color: #555; color: #555;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
&.undeline {
color: #999;
text-decoration: line-through;
}
} }
.t_line { .t_line {

View File

@ -221,13 +221,15 @@ const cartLoading = ref(false);
const orderInfo = ref({}); const orderInfo = ref({});
const createOrderLoading = ref(false); const createOrderLoading = ref(false);
//
function selectUser(row) { function selectUser(row) {
console.log('selectUser===', row);
goodsStore.vipUserInfo = { ...row } goodsStore.vipUserInfo = { ...row }
if (store.shopInfo.isMemberPrice && row.isVip) { if (store.shopInfo.isMemberPrice && row.isVip) {
goodsStore.showVipPrice = 1 goodsStore.showVipPrice = 1
goodsStore.calcCartInfo()
} }
goodsStore.calcCartInfo()
} }
// //

View File

@ -147,7 +147,7 @@ const submitHandle = () => {
.userlogin(form) .userlogin(form)
.then(async (res) => { .then(async (res) => {
// //
// useStorage.set('merchantLoginAccount', form.username) useStorage.set('merchantLoginAccount', form.username)
ElMessage.success("登录成功"); ElMessage.success("登录成功");
goodsStore.initGoods() goodsStore.initGoods()
setTimeout(() => { setTimeout(() => {
@ -155,15 +155,16 @@ const submitHandle = () => {
name: "home", name: "home",
}); });
}, 1000); }, 1000);
// const douyin = await douyincheckIn({ const douyin = await douyincheckIn({
// token: store.token, token: store.token,
// loginName: res.loginName, loginName: form.username,
// clientType: 'pc' clientType: 'pc'
// }) })
// useStorage.set('douyin', douyin.userInfo) useStorage.set('douyin', douyin.userInfo)
// global.updateData(true) // global.updateData(true)
}) })
.catch((err) => { .catch((err) => {
console.log(err);
loading.value = false; loading.value = false;
// //
captchaAjax() captchaAjax()
@ -203,7 +204,7 @@ onMounted(() => {
let merchantLoginAccount = useStorage.get('merchantLoginAccount') let merchantLoginAccount = useStorage.get('merchantLoginAccount')
if (merchantLoginAccount) { if (merchantLoginAccount) {
form.merchantName = merchantLoginAccount form.username = merchantLoginAccount
} }
}) })
</script> </script>