优化店铺切换商品展示
This commit is contained in:
parent
4245b5a098
commit
95ab7730f5
|
|
@ -5,10 +5,10 @@ ENV = development
|
|||
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
|
||||
# 正式ws
|
||||
# VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
|
||||
# 本地ws
|
||||
VITE_API_WSS = 'ws://192.168.1.43:2348'
|
||||
# VITE_API_WSS = 'ws://192.168.1.43:2348'
|
||||
|
||||
# 正式 php
|
||||
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
||||
|
|
@ -35,11 +35,11 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
|||
# VITE_API_URL = 'http://192.168.1.35/'
|
||||
|
||||
# 阿伟
|
||||
VITE_API_URL = 'http://192.168.1.21:8000/'
|
||||
# VITE_API_URL = 'http://192.168.1.21:8000/'
|
||||
|
||||
# 测试
|
||||
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
|
||||
# 正式
|
||||
# VITE_API_URL = 'https://cashier.sxczgkj.com'
|
||||
VITE_API_URL = 'https://cashier.sxczgkj.com'
|
||||
|
||||
|
|
|
|||
|
|
@ -382,3 +382,14 @@ export function calcDeductionAmount(params) {
|
|||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺用户详情
|
||||
*/
|
||||
export function shopUserDetail(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/account/admin/shopUser/detail",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
<!-- 选择会员 -->
|
||||
<SelectVipUser ref="SelectVipUserRef" @success="selectUserHandle" />
|
||||
<SelectVipUser ref="SelectVipUserRef" :amount="0.01" @success="selectUserHandle" />
|
||||
<!-- 选择优惠券 -->
|
||||
<CouponModal ref="CouponModalRef" :orderList="props.orderList" @success="CouponModalSuccess" />
|
||||
</template>
|
||||
|
|
@ -708,8 +708,10 @@ async function selectUserHandle(row) {
|
|||
goodsStore.vipUserInfo = { ...row }
|
||||
// 选择会员后重新计算会员价
|
||||
if (store.shopInfo.isMemberPrice && row.isVip) {
|
||||
console.log('选择会员后重新计算会员价===', row);
|
||||
goodsStore.showVipPrice = 1
|
||||
}
|
||||
|
||||
goodsStore.calcCartInfo()
|
||||
|
||||
emit('reset')
|
||||
|
|
@ -717,11 +719,10 @@ async function selectUserHandle(row) {
|
|||
couponForm.value.discountRatio = ''
|
||||
discountInput('')
|
||||
|
||||
setTimeout(() => {
|
||||
couponDialogOpen()
|
||||
}, 100)
|
||||
|
||||
if (showCoupon.value) {
|
||||
setTimeout(() => {
|
||||
couponDialogOpen()
|
||||
}, 100)
|
||||
couponFormUserList.value = [
|
||||
{
|
||||
id: row.userId,
|
||||
|
|
@ -737,7 +738,9 @@ async function selectUserHandle(row) {
|
|||
}
|
||||
} else {
|
||||
if (payList.value[payActive.value].payType == 'member-account') {
|
||||
vipPayAjax(row)
|
||||
setTimeout(() => {
|
||||
vipPayAjax(row)
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<el-input placeholder="请输入手机号搜索会员" v-model="tableData.phone" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="tableData.isVips" placeholder="是否为会员" style="width: 150px;" @change="resetTable">
|
||||
<el-select v-model="tableData.isVips" placeholder="是否为会员" style="width: 150px;" @change="changeIsVips">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="0"></el-option>
|
||||
|
|
@ -43,6 +43,13 @@ import { ref, reactive } from 'vue'
|
|||
import { shopUserList } from "@/api/account.js";
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
|
||||
const props = defineProps({
|
||||
amount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
|
||||
const emits = defineEmits(['success'])
|
||||
const showDialog = ref(false)
|
||||
const tableData = reactive({
|
||||
|
|
@ -68,6 +75,12 @@ async function toHomeMember(row) {
|
|||
// 重置表格
|
||||
function resetTable() {
|
||||
tableData.phone = ''
|
||||
tableData.isVips = ''
|
||||
tableData.page = 1
|
||||
getMemberList()
|
||||
}
|
||||
|
||||
function changeIsVips() {
|
||||
tableData.page = 1
|
||||
getMemberList()
|
||||
}
|
||||
|
|
@ -80,14 +93,17 @@ async function getMemberList() {
|
|||
key: tableData.phone,
|
||||
isVips: tableData.isVips,
|
||||
page: tableData.page,
|
||||
size: tableData.size
|
||||
size: tableData.size,
|
||||
amount: props.amount
|
||||
})
|
||||
tableData.list = res.records
|
||||
tableData.total = res.totalRow
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
tableData.loading = false
|
||||
setTimeout(() => {
|
||||
tableData.loading = false
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 显示选择会员弹窗
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { useUser } from "@/store/user.js";
|
|||
import { useSocket } from "@/store/socket.js";
|
||||
import useStorage from "@/utils/useStorage.js";
|
||||
import { formatDecimal } from "@/utils/index.js";
|
||||
import { shopUserDetail } from "@/api/account.js";
|
||||
|
||||
// 商品store + 购物车store
|
||||
export const useGoods = defineStore("goods", {
|
||||
|
|
@ -15,10 +16,10 @@ export const useGoods = defineStore("goods", {
|
|||
allSelected: 0, // 是否整单打包
|
||||
vipUserInfo: {}, // 会员信息
|
||||
// tableInfo: {
|
||||
// name: "A1",
|
||||
// id: 1,
|
||||
// num: 4,
|
||||
// tableCode: "66666666",
|
||||
// name: "测试A1",
|
||||
// id: 185,
|
||||
// num: 1,
|
||||
// tableCode: "3000101010",
|
||||
// }, // 台桌信息
|
||||
tableInfo: {
|
||||
id: "",
|
||||
|
|
@ -52,6 +53,15 @@ export const useGoods = defineStore("goods", {
|
|||
pendingList: useStorage.get("pendingList") || [],
|
||||
}),
|
||||
actions: {
|
||||
// 清除所有商品信息
|
||||
clearAllGoods() {
|
||||
this.categoryIndex = 0;
|
||||
this.categoryList = [];
|
||||
this.originCategoryList = [];
|
||||
this.goodsListLoading = false;
|
||||
this.goodsList = [];
|
||||
this.originGoodsList = [];
|
||||
},
|
||||
// 清除会员信息
|
||||
clearVipUserInfo() {
|
||||
this.vipUserInfo = {};
|
||||
|
|
@ -171,6 +181,19 @@ export const useGoods = defineStore("goods", {
|
|||
});
|
||||
|
||||
if (res) {
|
||||
if (res.userId) {
|
||||
const userInfo = await shopUserDetail({
|
||||
userId: res.userId,
|
||||
});
|
||||
if (userInfo.id) {
|
||||
this.vipUserInfo = userInfo;
|
||||
|
||||
if (userInfo.isVip) {
|
||||
this.showVipPrice = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.orderListInfo = res;
|
||||
|
||||
let arr = [];
|
||||
|
|
@ -353,7 +376,7 @@ export const useGoods = defineStore("goods", {
|
|||
// ) {
|
||||
// await this.historyOrderAjax(this.tableInfo.tableCode);
|
||||
// }
|
||||
// this.calcCartInfo();
|
||||
this.calcCartInfo();
|
||||
console.log("getCartList.cartList===", this.cartList);
|
||||
} catch (error) {
|
||||
console.log("getCartList===", error);
|
||||
|
|
@ -598,17 +621,15 @@ export const useGoods = defineStore("goods", {
|
|||
}
|
||||
|
||||
// 清空商品列表的角标
|
||||
// this.goodsList.map((item) => {
|
||||
// item.map((val) => {
|
||||
// val.number = 0;
|
||||
// });
|
||||
// });
|
||||
if (!this.cartList.length && !this.orderList.length) {
|
||||
this.updateGoodsNumber();
|
||||
}
|
||||
},
|
||||
// 下单成功清除购物车,重新加载订单
|
||||
async updateOrderList() {
|
||||
await this.historyOrderAjax(this.cartList[0].table_code);
|
||||
this.cartList = [];
|
||||
// this.calcCartInfo();
|
||||
this.calcCartInfo();
|
||||
},
|
||||
// 计算购物车信息
|
||||
calcCartInfo() {
|
||||
|
|
@ -643,13 +664,15 @@ export const useGoods = defineStore("goods", {
|
|||
console.log("arr===11111", arr);
|
||||
|
||||
arr.map((val, index) => {
|
||||
console.log("val===", val);
|
||||
|
||||
let lowPrice = 0;
|
||||
let number = val.number - (val.returnNum || 0);
|
||||
|
||||
if (this.vipUserInfo.id && store.shopInfo.isMemberPrice) {
|
||||
lowPrice = val.memberPrice;
|
||||
if (!+val.memberPrice) {
|
||||
lowPrice = val.lowPrice;
|
||||
} else {
|
||||
lowPrice = +val.memberPrice;
|
||||
}
|
||||
} else {
|
||||
lowPrice = val.lowPrice;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,11 @@ export const useSocket = defineStore("socket", {
|
|||
break;
|
||||
case "cleanup":
|
||||
// 清空购物车
|
||||
if (
|
||||
data.data.table_code == goodsStore.orderListInfo.tableCode &&
|
||||
!data.type
|
||||
)
|
||||
return;
|
||||
goodsStore.successClearCart();
|
||||
break;
|
||||
case "batch":
|
||||
|
|
@ -169,7 +174,7 @@ export const useSocket = defineStore("socket", {
|
|||
startheartbeat() {
|
||||
this.heartbeatTimer = setInterval(() => {
|
||||
if (this.log) console.log("发送心跳");
|
||||
this.ws.send(JSON.stringify({ type: "ping_interval" }));
|
||||
this.ws.send(JSON.stringify({ type: "ping_interval", set: "cashier" }));
|
||||
}, 10000);
|
||||
},
|
||||
// 清除心跳
|
||||
|
|
@ -190,7 +195,10 @@ export const useSocket = defineStore("socket", {
|
|||
} else {
|
||||
const orderInfo = await getOrderByIdAjax(this.orderList[0]);
|
||||
if (orderInfo.status == "done" && orderInfo.platformType != "PC") {
|
||||
// 打印小票
|
||||
printStore.pushReceiptData(commOrderPrintData(orderInfo));
|
||||
// 打印标签小票
|
||||
printStore.labelPrint(commOrderPrintData(orderInfo));
|
||||
}
|
||||
this.orderList.splice(0, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
<el-table :data="tableData.list" height="540px" v-loading="tableData.loading"
|
||||
v-if="tableData.type == 2">
|
||||
<el-table-column label="抖音订单号" prop="d_order_id" width="240"></el-table-column>
|
||||
<el-table-column label="总金额" prop="pay_amount" width="100">
|
||||
<el-table-column label="总金额" prop="pay_amount">
|
||||
<template v-slot="scope">
|
||||
<span style="color: var(--primary-color);">¥{{ scope.row.pay_amount }}</span>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
¥{{ formatDecimal(+props.item.discount_sale_amount, 2, true) }}
|
||||
</span>
|
||||
<span class="dis" v-else>
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice : +props.item.lowPrice, 2,
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice || +props.item.lowPrice :
|
||||
+props.item.lowPrice, 2,
|
||||
true) }}
|
||||
</span>
|
||||
<span v-if="props.item.discount_sale_amount">
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
<div class="price" v-else>
|
||||
<template v-if="+props.item.discount_sale_amount">
|
||||
<span class="dis">
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice : +props.item.lowPrice,
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice || +props.item.lowPrice : +props.item.lowPrice,
|
||||
2, true) }}
|
||||
</span>
|
||||
<span>
|
||||
|
|
@ -40,7 +41,7 @@
|
|||
</span>
|
||||
</template>
|
||||
<span>
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice : +props.item.lowPrice,
|
||||
¥{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice || +props.item.lowPrice : +props.item.lowPrice,
|
||||
2,
|
||||
true) }}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
<template v-else>
|
||||
<el-text tag="del" class="del" size="small">¥{{ item.skuList[0].salePrice
|
||||
}}</el-text>
|
||||
<el-text>¥{{ item.skuList[0].memberPrice }}</el-text>
|
||||
<el-text>¥{{ +item.skuList[0].memberPrice || item.skuList[0].salePrice }}</el-text>
|
||||
</template>
|
||||
</div>
|
||||
<div class="show_more_btn" v-if="showEditor">
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ function show(t) {
|
|||
setTimeout(() => {
|
||||
payCardRef.value.reset()
|
||||
}, 100)
|
||||
// if (t = 1) cartList.value = [...goodsStore.cartList];
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
|
|
|||
|
|
@ -270,6 +270,8 @@ async function createOrderHandle(t = 0) {
|
|||
goodsStore.orderListInfo = res
|
||||
|
||||
if (t == 1) {
|
||||
// 向其他端发送清空购物车消息
|
||||
goodsStore.operateCart({ table_code: goodsStore.orderListInfo.tableCode }, "cleanup");
|
||||
settleAccountRef.value.show(t)
|
||||
} else {
|
||||
goodsStore.clearCart()
|
||||
|
|
|
|||
|
|
@ -149,8 +149,10 @@ import { useRouter } from "vue-router";
|
|||
import { useUser } from "@/store/user.js";
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useGoods } from "@/store/goods.js";
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
|
||||
const goodsStore = useGoods();
|
||||
const printStore = usePrint();
|
||||
const store = useUser();
|
||||
const router = useRouter();
|
||||
|
|
@ -200,6 +202,7 @@ async function logoutHandle() {
|
|||
try {
|
||||
loading.value = true;
|
||||
await store.logout()
|
||||
goodsStore.clearAllGoods()
|
||||
ElMessage.success("交班成功");
|
||||
setTimeout(() => {
|
||||
router.replace({
|
||||
|
|
|
|||
Loading…
Reference in New Issue