代客下单逻辑修改
This commit is contained in:
parent
d0cee95145
commit
67ec915181
|
|
@ -8,7 +8,7 @@ const request = http.request
|
|||
export function getOrderPayUrl(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `/${urlType}/pay/shopPayApi/orderPayUrl`,
|
||||
method: "GET",
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,155 @@
|
|||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
// WebSocket 工具类,封装了 WebSocket 的连接、发送、接收、心跳、重连和关闭等操作
|
||||
class WebsocketUtil {
|
||||
|
||||
// 构造函数,初始化 WebSocket 连接
|
||||
constructor(url, time, params) {
|
||||
this.url = url; // WebSocket 服务器的 URL
|
||||
this.params = params; // WebSocket 服务器的 URL
|
||||
this.time = time; // 心跳发送的间隔时间(秒)
|
||||
this.socketTask = null; // WebSocket 任务对象
|
||||
this.isOpen = false; // WebSocket 连接是否打开
|
||||
this.reconnectTimeout = null; // 重连定时器
|
||||
this.heartbeatInterval = null; // 心跳定时器
|
||||
this.messageCallbacks = []; // 存储外部注册的消息回调函数的数组
|
||||
this.messageCallbacks = []; // 存储外部注册的消息回调函数的数组
|
||||
|
||||
// 初始化 WebSocket 连接
|
||||
this.initializeWebSocket();
|
||||
}
|
||||
|
||||
// 初始化 WebSocket 连接
|
||||
initializeWebSocket() {
|
||||
if (this.isOpen) {
|
||||
return
|
||||
}
|
||||
this.socketTask = uni.connectSocket({
|
||||
url: this.url,
|
||||
success: () => {
|
||||
console.log('WebSocket连接成功');
|
||||
return this.socketTask;
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('WebSocket连接失败', error);
|
||||
uni.$emit('is-socket-open', true)
|
||||
this.reconnect();
|
||||
}
|
||||
});
|
||||
|
||||
this.socketTask.onOpen((res) => {
|
||||
console.log('WebSocket连接正常!==', res);
|
||||
this.isOpen = true;
|
||||
// 连接成功后启动心跳和消息监听
|
||||
this.startHeartbeat();
|
||||
this.listenForMessages();
|
||||
uni.$emit('is-socket-open', true)
|
||||
|
||||
});
|
||||
this.socketTask.onError((res) => {
|
||||
console.log('WebSocket连接失败!==', res);
|
||||
uni.$emit('is-socket-open', false)
|
||||
this.reconnect();
|
||||
});
|
||||
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
|
||||
this.socketTask.onClose((result) => {
|
||||
this.isOpen = false;
|
||||
// if( this.isOpen ){
|
||||
this.reconnect();
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 启动心跳检测
|
||||
startHeartbeat() {
|
||||
if (this.heartbeatInterval) {
|
||||
clearInterval(this.heartbeatInterval);
|
||||
}
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
if (this.isOpen) {
|
||||
this.send(JSON.stringify({"type": "ping_interval","set": "pad"}));
|
||||
}
|
||||
}, this.time);
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
send(data, type) {
|
||||
if (this.socketTask && this.isOpen) {
|
||||
this.socketTask.send({
|
||||
data: data,
|
||||
success: (res) => {
|
||||
// console.log('消息发送成功', res);
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('消息发送失败', error);
|
||||
this.reconnect(); // 这里可能需要根据实际情况判断是否重连
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 监听 WebSocket 消息
|
||||
listenForMessages() {
|
||||
if (this.socketTask) {
|
||||
this.socketTask.onMessage((res) => {
|
||||
const {
|
||||
data
|
||||
} = res;
|
||||
this.messageCallbacks.forEach(callback => callback(data
|
||||
.toString())); // 假设 data 是字符串或可转换为字符串
|
||||
});
|
||||
// this.send("WebSocket连接正常");
|
||||
} else {
|
||||
console.error('WebSocket 连接尚未建立,无法监听消息');
|
||||
}
|
||||
}
|
||||
|
||||
// 重连 WebSocket
|
||||
reconnect() {
|
||||
if (this.reconnectTimeout) {
|
||||
clearTimeout(this.reconnectTimeout);
|
||||
}
|
||||
this.reconnectTimeout = setTimeout(() => {
|
||||
this.initializeWebSocket();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// 关闭 WebSocket 连接
|
||||
closeSocket() {
|
||||
if (this.socketTask) {
|
||||
uni.closeSocket({
|
||||
success: () => {
|
||||
console.log('WebSocket连接已关闭');
|
||||
this.isOpen = false;
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('关闭WebSocket连接失败', error);
|
||||
}
|
||||
});
|
||||
this.socketTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 外部注册消息回调函数
|
||||
onMessage(callback) {
|
||||
this.messageCallbacks.push(callback);
|
||||
}
|
||||
|
||||
// 外部注销消息回调函数
|
||||
offMessage(callback) {
|
||||
this.messageCallbacks = []
|
||||
}
|
||||
|
||||
// 销毁 WebSocket 连接,清理资源
|
||||
destroy() {
|
||||
this.closeSocket();
|
||||
clearInterval(this.heartbeatInterval);
|
||||
clearTimeout(this.reconnectTimeout);
|
||||
this.messageCallbacks = [];
|
||||
}
|
||||
}
|
||||
|
||||
export default WebsocketUtil;
|
||||
|
|
@ -23,6 +23,7 @@ class WebsocketUtil {
|
|||
|
||||
// 初始化 WebSocket 连接
|
||||
initializeWebSocket() {
|
||||
console.log('初始化WebSocket连接');
|
||||
if (this.isOpen) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
import http from '../http.js'
|
||||
const request = http.request
|
||||
import {marketUrl} from '../prveUrl.js'
|
||||
|
||||
/**
|
||||
* 满减活动
|
||||
* @returns
|
||||
*/
|
||||
export function discountActivity(params) {
|
||||
return request({
|
||||
url: marketUrl+`/admin/discountActivity`,
|
||||
method: 'get',
|
||||
params: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1,125 +1,20 @@
|
|||
import { BigNumber } from "bignumber.js";
|
||||
import _ from "lodash";
|
||||
|
||||
export interface Goods {
|
||||
productId: string | number; // 商品ID(唯一标识商品,用于优惠券/活动匹配,必选)
|
||||
skuId: string | number; // 商品规格ID(唯一标识商品规格,如颜色/尺寸)
|
||||
id: string | number; // 购物车ID(唯一标识购物车中的条目,如购物车项主键)
|
||||
product_id: string | number; // 商品ID(唯一标识商品,用于优惠券/活动匹配,必选)
|
||||
salePrice: number; // 商品原价(元)
|
||||
number: number; // 商品数量
|
||||
product_type: string; // 商品类型
|
||||
is_temporary?: number; // 是否临时菜(默认false)
|
||||
is_gift?: number; // 是否赠菜(默认false)
|
||||
returnNum?: number; // 退货数量(历史订单用,默认0)
|
||||
memberPrice: number; // 商品会员价(元,优先级:商品会员价 > 会员折扣)
|
||||
discountSaleAmount?: number; // 商家改价后单价(元,优先级最高)
|
||||
packFee?: number; // 单份打包费(元,默认0)
|
||||
packNumber?: number; // 堂食打包数量(默认0)
|
||||
skuData?: {
|
||||
// SKU扩展数据(可选)
|
||||
id: string | number; // SKU ID(唯一标识商品规格,如颜色/尺寸)
|
||||
memberPrice?: number; // SKU会员价
|
||||
salePrice?: number; // SKU原价
|
||||
};
|
||||
discount_sale_amount: number; // 商家改价后单价(元,优先级最高)
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
isVip: number; // 是否会员 1是会员
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface ShopInfo {
|
||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface ThresholdFood {
|
||||
id: string | number; // 商品ID
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface UseFood {
|
||||
id: string | number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface Coupon {
|
||||
id: string | number;
|
||||
use: boolean;
|
||||
type: number;
|
||||
thresholdFoods: ThresholdFood[];
|
||||
useFoods: UseFood[];
|
||||
noUseRestrictions?: string;
|
||||
discountShare: number; // 是否与折扣优惠同享 1是同享
|
||||
vipPriceShare: number; // 是否与会员优惠同享 1是同享
|
||||
otherCouponShare: number; // 是否与其他优惠券同享 1是同享
|
||||
fullAmount: number; // 使用门槛金额
|
||||
discountRate: number; // 折扣率(满减券:折扣金额/门槛金额,折扣券:折扣率)
|
||||
maxDiscountAmount: number; // 最大折扣金额(满减券:折扣金额,折扣券:折扣金额)
|
||||
discountNum: number; // 抵扣商品数量(商品券:抵扣商品数量,折扣券:0)
|
||||
useRule: string; // 使用规则(price_asc:按商品单价升序,price_desc:按商品单价降序)
|
||||
}
|
||||
|
||||
export interface couponDiscount {
|
||||
discountPrice: number;
|
||||
hasDiscountGoodsArr: Goods[];
|
||||
}
|
||||
export interface selCoupon extends Coupon {
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
export interface couponCalcParams {
|
||||
canDikouGoodsArr: Goods[];
|
||||
coupon: Coupon;
|
||||
user: User;
|
||||
shopInfo: ShopInfo;
|
||||
selCoupon: selCoupon[];
|
||||
goodsOrderPrice: number; //商品订单总价
|
||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
||||
}
|
||||
|
||||
//限时折扣配置
|
||||
export interface TimeLimitDiscountConfig {
|
||||
/**
|
||||
* 折扣优先级 limit-time/vip-price
|
||||
*/
|
||||
discountPriority: string;
|
||||
/**
|
||||
* 折扣% 范围1-99
|
||||
*/
|
||||
discountRate: number;
|
||||
/**
|
||||
* 参与商品
|
||||
*/
|
||||
foods: string;
|
||||
/**
|
||||
* 参与商品 1全部 2部分
|
||||
*/
|
||||
foodType: number;
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
shopId: number;
|
||||
/**
|
||||
* 可使用类型:堂食 dine-in 外带 take-out 外卖 take-away 配送 post
|
||||
*/
|
||||
useType: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface CanDikouGoodsArrArgs {
|
||||
canDikouGoodsArr: Goods[];
|
||||
selCoupon: selCoupon[];
|
||||
user: User;
|
||||
shopInfo: ShopInfo;
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
||||
}
|
||||
import {
|
||||
ShopInfo,
|
||||
couponCalcParams,
|
||||
BaseCartItem,
|
||||
TimeLimitDiscountConfig,
|
||||
CanDikouGoodsArrArgs,
|
||||
Coupon,
|
||||
ShopUserInfo,
|
||||
GoodsType,
|
||||
BackendCoupon,
|
||||
ExchangeCalculationResult,
|
||||
PointDeductionRule,
|
||||
OrderCostSummary,
|
||||
} from "./types";
|
||||
|
||||
/**
|
||||
* 返回商品单价
|
||||
|
|
@ -128,8 +23,8 @@ export interface CanDikouGoodsArrArgs {
|
|||
* @param {Object} shopInfo
|
||||
*/
|
||||
export function returnGoodsPrice(
|
||||
goods: Goods,
|
||||
user: User,
|
||||
goods: BaseCartItem,
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
|
|
@ -145,11 +40,18 @@ export function returnGoodsPrice(
|
|||
shopInfo &&
|
||||
shopInfo.isMemberPrice;
|
||||
// 商家改价
|
||||
if (goods.discount_sale_amount * 1 > 0) {
|
||||
if (goods.discount_sale_amount && goods.discount_sale_amount * 1 > 0) {
|
||||
return goods.salePrice;
|
||||
}
|
||||
// 限时折扣
|
||||
if (limitTimeDiscount && limitTimeDiscount.id) {
|
||||
//优先使用
|
||||
if (goods.isTimeDiscount || goods.is_time_discount) {
|
||||
return new BigNumber(goods.salePrice)
|
||||
.times(limitTimeDiscount.discountRate / 100)
|
||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
}
|
||||
const canUseFoods = limitTimeDiscount.foods.split(",");
|
||||
const canUseLimit =
|
||||
limitTimeDiscount.foodType == 1 ||
|
||||
|
|
@ -182,8 +84,8 @@ export function returnGoodsPrice(
|
|||
* 返回商品分组
|
||||
* @param arr 商品列表
|
||||
*/
|
||||
export function returnGoodsGroupMap(arr: Goods[]) {
|
||||
let map: { [key: string]: Goods[] } = {};
|
||||
export function returnGoodsGroupMap(arr: BaseCartItem[]) {
|
||||
let map: { [key: string]: BaseCartItem[] } = {};
|
||||
arr.forEach((v) => {
|
||||
const key = v.productId + "_" + v.skuId;
|
||||
if (!map[key]) {
|
||||
|
|
@ -194,12 +96,22 @@ export function returnGoodsGroupMap(arr: Goods[]) {
|
|||
return map;
|
||||
}
|
||||
|
||||
interface CouponTypes {
|
||||
1: "满减券";
|
||||
2: "商品券";
|
||||
3: "折扣券";
|
||||
4: "第二件半价券";
|
||||
5: "消费送券";
|
||||
6: "买一送一券";
|
||||
7: "固定价格券";
|
||||
8: "免配送费券";
|
||||
}
|
||||
/**
|
||||
* 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
||||
* @param coupon
|
||||
*/
|
||||
export function returnCoupType(coupon: Coupon) {
|
||||
const couponTypes = {
|
||||
const couponTypes: CouponTypes = {
|
||||
1: "满减券",
|
||||
2: "商品券",
|
||||
3: "折扣券",
|
||||
|
|
@ -209,10 +121,9 @@ export function returnCoupType(coupon: Coupon) {
|
|||
7: "固定价格券",
|
||||
8: "免配送费券",
|
||||
};
|
||||
return couponTypes[coupon.type as keyof typeof couponTypes] || "未知类型";
|
||||
return couponTypes[coupon.type as keyof CouponTypes] || "未知类型";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回商品券抵扣后的商品列表
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
|
|
@ -226,7 +137,7 @@ export function returnCanDikouGoodsArr(args: CanDikouGoodsArrArgs) {
|
|||
// 收集已抵扣商品并关联对应的优惠券类型
|
||||
const goodsCouponGoods = selCoupon
|
||||
.filter((v) => types.includes(v.type))
|
||||
.reduce((prev: Goods[], cur) => {
|
||||
.reduce((prev: BaseCartItem[], cur) => {
|
||||
// 给每个抵扣商品添加所属优惠券类型
|
||||
if (cur && cur.discount) {
|
||||
const goodsWithType = cur.discount.hasDiscountGoodsArr.map((goods) => ({
|
||||
|
|
@ -242,19 +153,23 @@ export function returnCanDikouGoodsArr(args: CanDikouGoodsArrArgs) {
|
|||
const findCart = goodsCouponGoods.find((carts) => carts.id == v.id);
|
||||
if (findCart) {
|
||||
// 根据优惠券类型判断扣减数量
|
||||
if ([4, 6].includes(findCart.couponType)) {
|
||||
if ([4, 6].includes(findCart.couponType ?? 0)) {
|
||||
// 类型4(第二件半价)或6(买一送一),数量减2
|
||||
v.num -= 2;
|
||||
if (v.num) {
|
||||
v.num -= 2;
|
||||
}
|
||||
} else {
|
||||
// 其他类型(如类型2商品券),按原逻辑扣减对应数量
|
||||
v.num -= findCart.num;
|
||||
if (v.num) {
|
||||
v.num -= findCart.num ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return v;
|
||||
})
|
||||
.filter((v) => {
|
||||
const canUseNum = v.num - (v.returnNum || 0);
|
||||
if (canUseNum <= 0 || v.is_temporary == 1 || v.is_gift == 1) {
|
||||
const canUseNum = (v.num ?? 0) - (v.returnNum || 0);
|
||||
if (canUseNum <= 0 || v.is_temporary || v.is_gift) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -264,12 +179,15 @@ export function returnCanDikouGoodsArr(args: CanDikouGoodsArrArgs) {
|
|||
return arr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回商品是否享用了会员价/会员折扣
|
||||
* @param {*} goods
|
||||
*/
|
||||
function returnGoodsIsUseVipPrice(shopInfo: ShopInfo, user: User, goods: Goods) {
|
||||
function returnGoodsIsUseVipPrice(
|
||||
shopInfo: ShopInfo,
|
||||
user: ShopUserInfo,
|
||||
goods: BaseCartItem
|
||||
) {
|
||||
if (goods.is_time_discount) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -277,22 +195,27 @@ function returnGoodsIsUseVipPrice(shopInfo: ShopInfo, user: User, goods: Goods)
|
|||
return false;
|
||||
}
|
||||
if (shopInfo.isMemberPrice == 1 && user.isVip == 1) {
|
||||
console.log('goods', goods);
|
||||
if (goods.memberPrice <= 0) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回可以计算抵扣金额的商品列表
|
||||
*/
|
||||
function returnCanCalcGoodsList(canCalcGoodsArr: Goods[], coupon: Coupon, shopInfo: ShopInfo, user: User) {
|
||||
function returnCanCalcGoodsList(
|
||||
canCalcGoodsArr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
shopInfo: ShopInfo,
|
||||
user: ShopUserInfo
|
||||
) {
|
||||
return canCalcGoodsArr.filter((goods) => {
|
||||
|
||||
console.log("goods");
|
||||
console.log(goods);
|
||||
if (
|
||||
!coupon.discountShare &&
|
||||
(goods.is_time_discount || goods.isTimeDiscount)
|
||||
|
|
@ -305,7 +228,6 @@ function returnCanCalcGoodsList(canCalcGoodsArr: Goods[], coupon: Coupon, shopIn
|
|||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
@ -328,7 +250,6 @@ function returnCanCalcGoodsList(canCalcGoodsArr: Goods[], coupon: Coupon, shopIn
|
|||
* @returns {Object} - { canUse: boolean, reason: string } 可用状态及不可用原因
|
||||
*/
|
||||
export function returnCouponCanUse(args: couponCalcParams) {
|
||||
|
||||
let {
|
||||
canDikouGoodsArr,
|
||||
coupon,
|
||||
|
|
@ -369,25 +290,25 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
return coupon.thresholdFoods.find((food) => food.id == v.productId);
|
||||
});
|
||||
}
|
||||
console.log("canCalcGoodsArr",canCalcGoodsArr);
|
||||
|
||||
canCalcGoodsArr = returnCanCalcGoodsList(
|
||||
canCalcGoodsArr,
|
||||
coupon,
|
||||
shopInfo,
|
||||
user
|
||||
);
|
||||
|
||||
console.log("canCalcGoodsArr");
|
||||
console.log(canCalcGoodsArr);
|
||||
fullAmount = canCalcGoodsArr.reduce((pre, cur) => {
|
||||
return (
|
||||
pre + returnGoodsPrice(cur, user, shopInfo, limitTimeDiscount) * cur.num
|
||||
pre +
|
||||
returnGoodsPrice(cur, user, shopInfo, limitTimeDiscount) * (cur.num || 0)
|
||||
);
|
||||
}, 0);
|
||||
|
||||
// 是否全部商品可用
|
||||
const isDikouAll = coupon.useFoods.length === 0;
|
||||
// 订单可用商品列表
|
||||
let canUseGoodsArr: Goods[] = [];
|
||||
let canUseGoodsArr: BaseCartItem[] = [];
|
||||
if (!isDikouAll) {
|
||||
canUseGoodsArr = canDikouGoodsArr.filter((v) => {
|
||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
||||
|
|
@ -420,7 +341,7 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
};
|
||||
}
|
||||
// 不满足门槛金额
|
||||
if (fullAmount < coupon.fullAmount) {
|
||||
if (fullAmount < (coupon.fullAmount || 0)) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
||||
|
|
@ -429,13 +350,6 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
}
|
||||
// 商品兑换券,第二件半价和买一送一判断是否有可用商品
|
||||
if ([2, 4, 5].includes(coupon.type)) {
|
||||
if(coupon.type==2){
|
||||
console.log("isDikouAll",isDikouAll);
|
||||
console.log("canCalcGoodsArr",canCalcGoodsArr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 没有符合条件的商品
|
||||
if (isDikouAll && canDikouGoodsArr.length === 0) {
|
||||
return {
|
||||
|
|
@ -456,7 +370,7 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
reason: "没有符合计算门槛条件的商品",
|
||||
};
|
||||
}
|
||||
if (fullAmount < coupon.fullAmount) {
|
||||
if (fullAmount < (coupon.fullAmount || 0)) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
||||
|
|
@ -465,7 +379,7 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
}
|
||||
}
|
||||
//商品兑换券是否达到门槛金额
|
||||
if (coupon.type == 2 && goodsOrderPrice < coupon.fullAmount) {
|
||||
if (coupon.type == 2 && goodsOrderPrice < (coupon.fullAmount || 0)) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
||||
|
|
@ -476,9 +390,9 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
if (coupon.type === 6) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
canUse = canDikouGoodsArr.some((v) => (v.num || 0) >= 2);
|
||||
} else if (canUseGoodsArr.length > 0) {
|
||||
canUse = canUseGoodsArr.some((v) => v.num >= 2);
|
||||
canUse = canUseGoodsArr.some((v) => (v.num || 0) >= 2);
|
||||
}
|
||||
|
||||
if (!canUse) {
|
||||
|
|
@ -493,9 +407,9 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
if (coupon.type === 4) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
canUse = canDikouGoodsArr.some((v) => (v.num || 0) >= 2);
|
||||
} else if (canUseGoodsArr.length > 0) {
|
||||
canUse = canUseGoodsArr.some((v) => v.num >= 2);
|
||||
canUse = canUseGoodsArr.some((v) => (v.num || 0) >= 2);
|
||||
}
|
||||
if (!canUse) {
|
||||
return {
|
||||
|
|
@ -520,9 +434,9 @@ export function returnCouponCanUse(args: couponCalcParams) {
|
|||
* @param {Object} shopInfo 店铺信息
|
||||
*/
|
||||
export function calcDiscountGoodsArrPrice(
|
||||
discountGoodsArr: Goods[],
|
||||
discountGoodsArr: BaseCartItem[],
|
||||
discountNum: number,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
|
|
@ -536,7 +450,7 @@ export function calcDiscountGoodsArrPrice(
|
|||
}
|
||||
const goods = discountGoodsArr[i];
|
||||
const shengyuNum = discountNum - hasCountNum;
|
||||
const num = Math.min(goods.num, shengyuNum);
|
||||
const num = Math.min(goods.num || 0, shengyuNum);
|
||||
const realPrice = returnGoodsPrice(
|
||||
goods,
|
||||
user,
|
||||
|
|
@ -570,16 +484,15 @@ export function calcDiscountGoodsArrPrice(
|
|||
* @param limitTimeDiscount 限时折扣
|
||||
*/
|
||||
export function returnCouponDiscount(
|
||||
arr: Goods[],
|
||||
arr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
goodsOrderPrice: number,
|
||||
selCoupon: selCoupon[],
|
||||
selCoupon: Coupon[],
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
|
||||
) {
|
||||
arr = returnCanDikouGoods(arr, user, shopInfo,limitTimeDiscount);
|
||||
arr = returnCanDikouGoods(arr, user, shopInfo, limitTimeDiscount);
|
||||
const canDikouGoodsArr = returnCanDikouGoodsArr({
|
||||
canDikouGoodsArr: arr,
|
||||
selCoupon,
|
||||
|
|
@ -637,15 +550,15 @@ export function returnCouponDiscount(
|
|||
* @param limitTimeDiscount 限时折扣
|
||||
*/
|
||||
export function returnCouponZhekouDiscount(
|
||||
canDikouGoodsArr: Goods[],
|
||||
canDikouGoodsArr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
goodsOrderPrice: number,
|
||||
selCoupon: selCoupon[],
|
||||
selCoupon: Coupon[],
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
const { discountRate, maxDiscountAmount } = coupon;
|
||||
|
||||
let { discountRate, maxDiscountAmount } = coupon;
|
||||
maxDiscountAmount = maxDiscountAmount || 0;
|
||||
// 计算商品优惠券折扣总和,使用BigNumber避免精度问题
|
||||
const goodsCouponDiscount = selCoupon
|
||||
.filter((v) => v.type == 2)
|
||||
|
|
@ -662,7 +575,7 @@ export function returnCouponZhekouDiscount(
|
|||
|
||||
// 计算优惠比例:(100 - 折扣率) / 100
|
||||
const discountAmountRatio = new BigNumber(100)
|
||||
.minus(discountRate)
|
||||
.minus(discountRate || 0)
|
||||
.dividedBy(100);
|
||||
|
||||
// 计算折扣金额:调整后的商品订单金额 × 优惠比例
|
||||
|
|
@ -691,14 +604,14 @@ export function returnCouponZhekouDiscount(
|
|||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
export function returnCouponProductDiscount(
|
||||
canDikouGoodsArr: Goods[],
|
||||
canDikouGoodsArr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
const { useFoods, discountNum, useRule } = coupon;
|
||||
|
||||
let { useFoods, discountNum, useRule } = coupon;
|
||||
discountNum = discountNum || 0;
|
||||
//抵扣商品数组
|
||||
let discountGoodsArr = [];
|
||||
|
||||
|
|
@ -720,7 +633,6 @@ export function returnCouponProductDiscount(
|
|||
discountGoodsArr = discountSelGoodsArr.slice(0, discountNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const result = calcDiscountGoodsArrPrice(
|
||||
discountGoodsArr,
|
||||
|
|
@ -740,9 +652,9 @@ export function returnCouponProductDiscount(
|
|||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnCouponBuyOneGiveOneDiscount(
|
||||
canDikouGoodsArr: Goods[],
|
||||
canDikouGoodsArr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
|
|
@ -750,7 +662,7 @@ function returnCouponBuyOneGiveOneDiscount(
|
|||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合买一送一条件的商品
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2);
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => (v.num || 0) >= 2);
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
|
|
@ -770,7 +682,7 @@ function returnCouponBuyOneGiveOneDiscount(
|
|||
}
|
||||
}
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr: Goods[] = [];
|
||||
let hasDiscountGoodsArr: BaseCartItem[] = [];
|
||||
if (discountGoods) {
|
||||
discountPrice = returnGoodsPrice(
|
||||
discountGoods,
|
||||
|
|
@ -794,9 +706,9 @@ function returnCouponBuyOneGiveOneDiscount(
|
|||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnSecoendDiscount(
|
||||
canDikouGoodsArr: Goods[],
|
||||
canDikouGoodsArr: BaseCartItem[],
|
||||
coupon: Coupon,
|
||||
user: User,
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
|
|
@ -804,7 +716,7 @@ function returnSecoendDiscount(
|
|||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合条件的商品
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2);
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => (v.num || 0) >= 2);
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
|
|
@ -824,7 +736,7 @@ function returnSecoendDiscount(
|
|||
}
|
||||
}
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr: Goods[] = [];
|
||||
let hasDiscountGoodsArr: BaseCartItem[] = [];
|
||||
if (discountGoods) {
|
||||
discountPrice = returnGoodsPrice(
|
||||
discountGoods,
|
||||
|
|
@ -852,25 +764,25 @@ function returnSecoendDiscount(
|
|||
* @param limitTimeDiscount 限时折扣
|
||||
*/
|
||||
export function returnCanDikouGoods(
|
||||
arr: Goods[],
|
||||
user: User,
|
||||
arr: BaseCartItem[],
|
||||
user: ShopUserInfo,
|
||||
shopInfo: ShopInfo,
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
||||
) {
|
||||
const result = arr
|
||||
.filter((v) => {
|
||||
return v.is_temporary != 1 && v.is_gift != 1;
|
||||
})
|
||||
.filter((v) => {
|
||||
return v.num > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return (
|
||||
returnGoodsPrice(b, user, shopInfo, limitTimeDiscount) -
|
||||
returnGoodsPrice(a, user, shopInfo, limitTimeDiscount)
|
||||
);
|
||||
});
|
||||
return result;
|
||||
.filter((v) => {
|
||||
return !v.is_temporary && !v.is_gift;
|
||||
})
|
||||
.filter((v) => {
|
||||
return (v.num || 0) > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return (
|
||||
returnGoodsPrice(b, user, shopInfo, limitTimeDiscount) -
|
||||
returnGoodsPrice(a, user, shopInfo, limitTimeDiscount)
|
||||
);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export const utils = {
|
||||
returnGoodsPrice,
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,11 @@
|
|||
export * from "./types";
|
||||
import OrderPriceCalculator from "./goods";
|
||||
import couponUtils from "./coupon";
|
||||
import limitUtils from "./limit";
|
||||
|
||||
export { OrderPriceCalculator, couponUtils, limitUtils };
|
||||
export default {
|
||||
OrderPriceCalculator,
|
||||
couponUtils,
|
||||
limitUtils,
|
||||
};
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
import BigNumber from "bignumber.js";
|
||||
|
||||
import _ from "lodash";
|
||||
|
||||
import {
|
||||
BaseCartItem,
|
||||
ShopUserInfo,
|
||||
ShopInfo,
|
||||
TimeLimitDiscountConfig,
|
||||
CanReturnMemberPriceArgs,
|
||||
returnPriceArgs,
|
||||
} from "./types";
|
||||
|
||||
/**
|
||||
* 判断商品是否可以使用限时折扣
|
||||
* @param goods 商品对象
|
||||
* @param limitTimeDiscountRes 限时折扣配置
|
||||
* @param shopInfo 店铺信息
|
||||
* @param shopUserInfo 店铺用户信息
|
||||
* @param idKey 商品ID键名,默认"id"
|
||||
* @returns
|
||||
*/
|
||||
export function canUseLimitTimeDiscount(
|
||||
goods: BaseCartItem,
|
||||
limitTimeDiscountRes: TimeLimitDiscountConfig | null | undefined,
|
||||
shopInfo: ShopInfo,
|
||||
shopUserInfo: ShopUserInfo,
|
||||
idKey = "id" as keyof BaseCartItem
|
||||
) {
|
||||
shopInfo = shopInfo || {};
|
||||
shopUserInfo = shopUserInfo || {};
|
||||
if (!limitTimeDiscountRes || !limitTimeDiscountRes.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const canUseFoods = (limitTimeDiscountRes.foods || "").split(",");
|
||||
|
||||
const goodsCanUse =
|
||||
limitTimeDiscountRes.foodType == 1 ||
|
||||
canUseFoods.includes(`${goods[idKey]}`);
|
||||
if (!goodsCanUse) {
|
||||
return false;
|
||||
}
|
||||
if (limitTimeDiscountRes.discountPriority == "limit-time") {
|
||||
return true;
|
||||
}
|
||||
if (limitTimeDiscountRes.discountPriority == "vip-price") {
|
||||
if (shopUserInfo.isVip != 1 || shopUserInfo.isMemberPrice != 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
shopUserInfo.isVip == 1 &&
|
||||
shopUserInfo.isMemberPrice == 1 &&
|
||||
goods.memberPrice * 1 <= 0
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回商品显示价格
|
||||
* @params {*} args 参数对象
|
||||
* @params {*} args.goods 商品对象
|
||||
* @params {*} args.shopInfo 店铺信息
|
||||
* @params {*} args.limitTimeDiscountRes 限时折扣信息
|
||||
* @params {*} args.shopUserInfo 店铺用户信息
|
||||
* @returns
|
||||
*/
|
||||
export function returnPrice(args: returnPriceArgs) {
|
||||
let {
|
||||
goods,
|
||||
shopInfo,
|
||||
limitTimeDiscountRes,
|
||||
shopUserInfo,
|
||||
idKey = "product_id",
|
||||
} = args;
|
||||
limitTimeDiscountRes = limitTimeDiscountRes || {
|
||||
foods: "",
|
||||
foodType: 2,
|
||||
discountPriority: "",
|
||||
discountRate: 0,
|
||||
id: 0,
|
||||
shopId: 0,
|
||||
useType: "",
|
||||
};
|
||||
const canUseFoods = (limitTimeDiscountRes.foods || "").split(",");
|
||||
const includesGoods =
|
||||
limitTimeDiscountRes.foodType == 1 ||
|
||||
canUseFoods.includes("" + goods[idKey]);
|
||||
shopInfo = shopInfo || {};
|
||||
shopUserInfo = shopUserInfo || {};
|
||||
if (
|
||||
shopUserInfo.isMemberPrice == 1 &&
|
||||
shopUserInfo.isVip == 1 &&
|
||||
shopInfo.isMemberPrice == 1
|
||||
) {
|
||||
const memberPrice = goods.memberPrice || goods.salePrice;
|
||||
|
||||
//是会员而且启用会员价
|
||||
if (limitTimeDiscountRes) {
|
||||
//使用限时折扣
|
||||
//限时折扣优先
|
||||
if (limitTimeDiscountRes.discountPriority == "limit-time") {
|
||||
if (includesGoods) {
|
||||
return returnLimitPrice({
|
||||
price: goods.salePrice,
|
||||
limitTimeDiscountRes,
|
||||
});
|
||||
} else {
|
||||
return memberPrice;
|
||||
}
|
||||
}
|
||||
if (
|
||||
limitTimeDiscountRes.discountPriority == "vip-price" &&
|
||||
includesGoods
|
||||
) {
|
||||
if (goods.memberPrice * 1 > 0) {
|
||||
//会员优先
|
||||
return memberPrice;
|
||||
} else {
|
||||
const price = returnLimitPrice({
|
||||
price: goods.salePrice,
|
||||
limitTimeDiscountRes,
|
||||
goods: goods,
|
||||
});
|
||||
|
||||
return price;
|
||||
}
|
||||
} else {
|
||||
return memberPrice;
|
||||
}
|
||||
} else {
|
||||
//是会员没有限时折扣
|
||||
return memberPrice;
|
||||
}
|
||||
} else {
|
||||
// console.log('不是会员或者没有启用会员价',goods,limitTimeDiscountRes);
|
||||
//不是会员或者没有启用会员价
|
||||
if (limitTimeDiscountRes && limitTimeDiscountRes.id && includesGoods) {
|
||||
const price = returnLimitPrice({
|
||||
price: goods.salePrice,
|
||||
limitTimeDiscountRes,
|
||||
goods: goods,
|
||||
});
|
||||
|
||||
return price;
|
||||
} else {
|
||||
return goods.salePrice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface returnLimitPriceArgs {
|
||||
limitTimeDiscountRes: TimeLimitDiscountConfig | null | undefined;
|
||||
price: number;
|
||||
goods?: BaseCartItem;
|
||||
}
|
||||
/**
|
||||
* 返回限时折扣价格
|
||||
* @params {*} args 参数对象
|
||||
* @params {*} args.limitTimeDiscountRes 限时折扣信息
|
||||
* @params {*} args.price 商品价格
|
||||
* @param {*} args.goods 商品对象
|
||||
* @returns
|
||||
*/
|
||||
export function returnLimitPrice(args: returnLimitPriceArgs) {
|
||||
const { limitTimeDiscountRes, price, goods } = args;
|
||||
const discountRate = new BigNumber(
|
||||
limitTimeDiscountRes ? limitTimeDiscountRes.discountRate : 100
|
||||
).dividedBy(100);
|
||||
|
||||
const result = BigNumber(price)
|
||||
.times(discountRate)
|
||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否返回会员价
|
||||
* @param {*} args 参数对象
|
||||
* @param {*} args.shopInfo 店铺信息
|
||||
* @param {*} args.shopUserInfo 店铺用户信息
|
||||
* @returns
|
||||
*/
|
||||
export function canReturnMemberPrice(args: CanReturnMemberPriceArgs) {
|
||||
const { shopInfo, shopUserInfo } = args;
|
||||
if (shopUserInfo.isMemberPrice == 1 && shopUserInfo.isVip == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回会员价格
|
||||
* @param {*} goods
|
||||
* @returns
|
||||
*/
|
||||
export function returnMemberPrice(goods: BaseCartItem) {
|
||||
return goods.memberPrice || goods.salePrice;
|
||||
}
|
||||
|
||||
export const utils = {
|
||||
returnPrice,
|
||||
canUseLimitTimeDiscount,
|
||||
returnLimitPrice,
|
||||
canReturnMemberPrice,
|
||||
returnMemberPrice,
|
||||
};
|
||||
|
||||
export default utils;
|
||||
|
|
@ -0,0 +1,429 @@
|
|||
/** 商品类型枚举 */
|
||||
export enum GoodsType {
|
||||
NORMAL = "normal", // 普通商品
|
||||
WEIGHT = "weight", // 称重商品
|
||||
GIFT = "gift", // 赠菜(继承普通商品逻辑,标记用)
|
||||
EMPTY = "", // 空字符串类型(后端未返回时默认归类为普通商品)
|
||||
PACKAGE = "package", // 打包商品(如套餐/预打包商品,按普通商品逻辑处理,可扩展特殊规则)
|
||||
}
|
||||
|
||||
/** 优惠券计算结果类型(新增细分字段) */
|
||||
export interface CouponResult {
|
||||
deductionAmount: number; // 抵扣金额
|
||||
excludedProductIds: string[]; // 不适用商品ID列表(注意:是商品ID,非购物车ID)
|
||||
usedCoupon: Coupon | undefined; // 实际使用的优惠券
|
||||
productCouponDeduction: number; // 新增:商品优惠券抵扣(兑换券等)
|
||||
fullCouponDeduction: number; // 新增:满减优惠券抵扣
|
||||
}
|
||||
|
||||
/** 兑换券计算结果类型(新增细分字段) */
|
||||
export interface ExchangeCalculationResult {
|
||||
deductionAmount: number;
|
||||
excludedProductIds: string[]; // 不适用商品ID列表(商品ID)
|
||||
productCouponDeduction: number; // 新增:兑换券属于商品券,同步记录
|
||||
}
|
||||
|
||||
export interface CouponTypes {
|
||||
1: "满减券";
|
||||
2: "商品券";
|
||||
3: "折扣券";
|
||||
4: "第二件半价券";
|
||||
5: "消费送券";
|
||||
6: "买一送一券";
|
||||
7: "固定价格券";
|
||||
8: "免配送费券";
|
||||
}
|
||||
|
||||
/** 优惠券类型枚举 */
|
||||
export enum CouponType {
|
||||
FULL_REDUCTION = "full_reduction", // 满减券
|
||||
DISCOUNT = "discount", // 折扣券
|
||||
SECOND_HALF = "second_half", // 第二件半价券
|
||||
BUY_ONE_GET_ONE = "buy_one_get_one", // 买一送一券
|
||||
EXCHANGE = "exchange", // 商品兑换券
|
||||
}
|
||||
|
||||
/** 后端返回的优惠券原始字段类型 */
|
||||
export interface BackendCoupon {
|
||||
id?: number; // 自增主键(int64)
|
||||
shopId?: number; // 店铺ID(int64)
|
||||
syncId?: number; // 同步Id(int64)
|
||||
type?: number; // 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
||||
name?: string; // 券名称
|
||||
useShopType?: string; // 可用门店类型:only-仅本店;all-所有门店,custom-指定门店
|
||||
useShops?: string; // 可用门店(逗号分隔字符串,如"1,2,3")
|
||||
useType?: string; // 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
||||
validType?: string; // 有效期类型:fixed(固定时间),custom(自定义时间)
|
||||
validDays?: number; // 有效期(天)
|
||||
validStartTime?: string; // 有效期开始时间(如"2024-01-01 00:00:00")
|
||||
validEndTime?: string; // 有效期结束时间
|
||||
daysToTakeEffect?: number; // 隔天生效
|
||||
useDays?: string; // 可用周期(如"周一,周二")
|
||||
useTimeType?: string; // 可用时间段类型:all-全时段,custom-指定时段
|
||||
useStartTime?: string; // 可用开始时间(每日)
|
||||
useEndTime?: string; // 可用结束时间(每日)
|
||||
getType?: string; // 发放设置:不可自行领取/no,可领取/yes
|
||||
getMode?: string; // 用户领取方式
|
||||
giveNum?: number; // 总发放数量,-10086为不限量
|
||||
getUserType?: string; // 可领取用户:全部/all,新用户一次/new,仅会员/vip
|
||||
getLimit?: number; // 每人领取限量,-10086为不限量
|
||||
useLimit?: number; // 每人每日使用限量,-10086为不限量
|
||||
discountShare?: number; // 与限时折扣同享:0-否,1-是
|
||||
vipPriceShare?: number; // 与会员价同享:0-否,1-是
|
||||
ruleDetails?: string; // 附加规则说明
|
||||
status?: number; // 状态:0-禁用,1-启用
|
||||
useNum?: number; // 已使用数量
|
||||
leftNum?: number; // 剩余数量
|
||||
foods?: string; // 指定门槛商品(逗号分隔字符串,如"101,102",此处为商品ID)
|
||||
fullAmount?: number; // 使用门槛:满多少金额(元)
|
||||
discountAmount?: number; // 使用门槛:减多少金额(元)
|
||||
discountRate?: number; // 折扣%(如90=9折)
|
||||
maxDiscountAmount?: number; // 可抵扣最大金额(元)
|
||||
useRule?: string; // 使用规则:price_asc-价格低到高,price_desc-高到低
|
||||
discountNum?: number; // 抵扣数量
|
||||
otherCouponShare?: number; // 与其它优惠共享:0-否,1-是
|
||||
createTime?: string; // 创建时间
|
||||
updateTime?: string; // 更新时间
|
||||
}
|
||||
|
||||
/** 营销活动类型枚举 */
|
||||
export enum ActivityType {
|
||||
TIME_LIMIT_DISCOUNT = "time_limit_discount", // 限时折扣
|
||||
}
|
||||
|
||||
/** 基础购物车商品项(核心修正:新增product_id,明确各ID含义) */
|
||||
export interface BaseCartItem {
|
||||
id: string | number; // 购物车ID(唯一标识购物车中的条目,如购物车项主键)
|
||||
product_id: string | number; // 商品ID(唯一标识商品,用于优惠券/活动匹配,必选)
|
||||
productId?: string | number; // 商品ID
|
||||
salePrice: number; // 商品原价(元)
|
||||
number: number; // 商品数量
|
||||
num?: number; // 商品数量
|
||||
isTimeDiscount?: boolean; // 是否限时折扣商品(默认false)
|
||||
is_time_discount?: boolean; // 是否限时折扣商品(默认false)
|
||||
product_type: GoodsType; // 商品类型
|
||||
is_temporary?: boolean; // 是否临时菜(默认false)
|
||||
isTemporary?: boolean; // 是否临时菜(默认false)
|
||||
is_gift?: boolean; // 是否赠菜(默认false)
|
||||
isGift?: boolean; // 是否赠菜(默认false)
|
||||
returnNum?: number; // 退货数量(历史订单用,默认0)
|
||||
memberPrice: number; // 商品会员价(元,优先级:商品会员价 > 会员折扣)
|
||||
discountSaleAmount?: number; // 商家改价后单价(元,优先级最高)
|
||||
discount_sale_amount?: number; // 商家改价后单价(元,优先级最高)
|
||||
packFee?: number; // 单份打包费(元,默认0)
|
||||
packNumber?: number; // 堂食打包数量(默认0)
|
||||
activityInfo?: {
|
||||
// 商品参与的营销活动(如限时折扣)
|
||||
type: ActivityType;
|
||||
discountRate: number; // 折扣率(如0.8=8折)
|
||||
vipPriceShare: boolean; // 是否与会员优惠同享(默认false)
|
||||
};
|
||||
skuData?: {
|
||||
// SKU扩展数据(可选)
|
||||
id: string | number; // SKU ID(唯一标识商品规格,如颜色/尺寸)
|
||||
memberPrice: number; // SKU会员价
|
||||
salePrice?: number; // SKU原价
|
||||
};
|
||||
skuId?: string | number; // SKU ID(唯一标识商品规格,如颜色/尺寸)
|
||||
couponType?: number; // 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
||||
}
|
||||
|
||||
export interface CouponFoods {
|
||||
id: string;
|
||||
name: string;
|
||||
images: string;
|
||||
}
|
||||
|
||||
/** 基础优惠券接口(所有券类型继承,包含统一门槛商品字段) */
|
||||
export interface BaseCoupon {
|
||||
otherCouponShare?: number; // 与其它优惠共享:0-否,1-是
|
||||
id: string | number; // 优惠券ID
|
||||
type: number; // 工具库字符串枚举(由后端couponType转换)
|
||||
name: string; // 对应后端title
|
||||
available: boolean; // 基于BackendCoupon字段计算的可用性
|
||||
useShopType?: string; // only-仅本店;all-所有门店,custom-指定门店
|
||||
useShops: string[]; // 可用门店ID列表
|
||||
discountShare: boolean; // 与限时折扣同享:0-否,1-是(后端字段转换为布尔值)
|
||||
vipPriceShare: boolean; // 与会员价同享:0-否,1-是(后端字段转换为布尔值)
|
||||
useType?: string[]; // 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
||||
isValid: boolean; // 是否在有效期内
|
||||
discountAmount?: number; // 减免金额 (满减券有)
|
||||
fullAmount?: number; // 使用门槛:满多少金额
|
||||
maxDiscountAmount?: number; // 可抵扣最大金额 元
|
||||
use: boolean;
|
||||
discountNum?: number; // 抵扣数量
|
||||
useRule?: string; // 使用规则:price_asc-价格低到高,price_desc-高到低
|
||||
discountRate?: number; // 折扣%(如90=9折)
|
||||
noUseRestrictions?: boolean; // 是不可用原因
|
||||
thresholdFoods: CouponFoods[]; // 门槛商品ID列表(空数组=全部商品,非空=指定商品ID)
|
||||
useFoods: CouponFoods[]; // 可用商品ID列表(空数组=全部商品,非空=指定商品ID)
|
||||
}
|
||||
export interface couponDiscount {
|
||||
discountPrice: number;
|
||||
hasDiscountGoodsArr: BaseCartItem[];
|
||||
}
|
||||
/** 满减券(适配后端字段) */
|
||||
export interface FullReductionCoupon extends BaseCoupon {
|
||||
fullAmount: number; // 对应后端fullAmount(满减门槛)
|
||||
discountAmount: number; // 对应后端discountAmount(减免金额)
|
||||
maxDiscountAmount?: number; // 对应后端maxDiscountAmount(最大减免)
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
/** 折扣券(适配后端字段) */
|
||||
export interface DiscountCoupon extends BaseCoupon {
|
||||
discountRate: number; // 后端discountRate(%)转小数(如90→0.9)
|
||||
maxDiscountAmount: number; // 对应后端maxDiscountAmount(最大减免)
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
/** 第二件半价券(适配后端字段) */
|
||||
export interface SecondHalfPriceCoupon extends BaseCoupon {
|
||||
maxUseCountPerOrder?: number; // 对应后端useLimit(-10086=不限)
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
/** 买一送一券(适配后端字段) */
|
||||
export interface BuyOneGetOneCoupon extends BaseCoupon {
|
||||
maxUseCountPerOrder?: number; // 对应后端useLimit(-10086=不限)
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
/** 商品兑换券(适配后端字段) */
|
||||
export interface ExchangeCoupon extends BaseCoupon {
|
||||
deductCount: number; // 对应后端discountNum(抵扣数量)
|
||||
sortRule: "low_price_first" | "high_price_first"; // 后端useRule转换
|
||||
discount?: couponDiscount;
|
||||
}
|
||||
|
||||
/** 所有优惠券类型联合 */
|
||||
export type Coupon =
|
||||
| FullReductionCoupon
|
||||
| DiscountCoupon
|
||||
| SecondHalfPriceCoupon
|
||||
| BuyOneGetOneCoupon
|
||||
| ExchangeCoupon;
|
||||
|
||||
/** 营销活动配置(如限时折扣,applicableProductIds为商品ID列表) */
|
||||
export interface ActivityConfig {
|
||||
type: ActivityType;
|
||||
applicableProductIds?: string[]; // 适用商品ID列表(与BaseCartItem.product_id匹配)
|
||||
discountRate: number; // 折扣率(如0.8=8折)
|
||||
vipPriceShare: boolean; // 是否与会员优惠同享
|
||||
}
|
||||
|
||||
/** 积分抵扣规则 */
|
||||
export interface PointDeductionRule {
|
||||
pointsPerYuan: number; // X积分=1元(如100=100积分抵1元)
|
||||
maxDeductionAmount?: number; // 最大抵扣金额(元,默认不限)
|
||||
}
|
||||
|
||||
/** 餐位费配置 */
|
||||
export interface SeatFeeConfig {
|
||||
pricePerPerson: number; // 每人餐位费(元)
|
||||
personCount: number; // 用餐人数(默认1)
|
||||
isEnabled: boolean; // 是否启用餐位费(默认false)
|
||||
}
|
||||
/** 商家减免类型枚举 */
|
||||
export enum MerchantReductionType {
|
||||
FIXED_AMOUNT = "fixed_amount", // 固定金额减免(如直接减 10 元)
|
||||
DISCOUNT_RATE = "discount_rate", // 比例折扣减免(如打 9 折,即减免 10%)
|
||||
}
|
||||
|
||||
/** 商家减免配置(新增,替代原单一金额字段) */
|
||||
export interface MerchantReductionConfig {
|
||||
type: MerchantReductionType; // 减免类型(二选一)
|
||||
fixedAmount?: number; // 固定减免金额(元,仅 FIXED_AMOUNT 生效,≥0)
|
||||
discountRate?: number; // 折扣率(%,仅 DISCOUNT_RATE 生效,0-100,如 90 代表 9 折)
|
||||
}
|
||||
/**商家霸王餐配置 */
|
||||
export interface FreeDineConfig {
|
||||
enable: boolean; //是否开启
|
||||
rechargeThreshold: number; //订单满多少元可以使用
|
||||
rechargeTimes: number; //充值多少倍免单
|
||||
withCoupon: boolean; //与优惠券同享
|
||||
withPoints: boolean; //与积分同享
|
||||
useType?: string[]; //使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||
useShopType?: string; //all 全部 part部分
|
||||
shopIdList?: number[]; //可用门店id
|
||||
}
|
||||
|
||||
//限时折扣配置
|
||||
export interface TimeLimitDiscountConfig {
|
||||
/**
|
||||
* 折扣优先级 limit-time/vip-price
|
||||
*/
|
||||
discountPriority: string;
|
||||
/**
|
||||
* 折扣% 范围1-99
|
||||
*/
|
||||
discountRate: number;
|
||||
/**
|
||||
* 参与商品
|
||||
*/
|
||||
foods: string;
|
||||
/**
|
||||
* 参与商品 1全部 2部分
|
||||
*/
|
||||
foodType: number;
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
shopId: number;
|
||||
/**
|
||||
* 可使用类型:堂食 dine-in 外带 take-out 外卖 take-away 配送 post
|
||||
*/
|
||||
useType: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
//用户信息
|
||||
export interface ShopUserInfo {
|
||||
isVip: number | null; //是否会员
|
||||
discount: number | null; //用户折扣
|
||||
isMemberPrice: number | null; //会员折扣与会员价是否同时使用
|
||||
}
|
||||
/** 订单额外费用配置 */
|
||||
export interface OrderExtraConfig {
|
||||
// merchantReduction: number; // 商家减免金额(元,默认0)
|
||||
// 替换原单一金额字段,支持两种减免形式
|
||||
merchantReduction: MerchantReductionConfig;
|
||||
additionalFee: number; // 附加费(元,如余额充值、券包,默认0)
|
||||
pointDeductionRule: PointDeductionRule; // 积分抵扣规则
|
||||
seatFeeConfig: SeatFeeConfig; // 餐位费配置
|
||||
currentStoreId: string; // 当前门店ID(用于验证优惠券适用门店)
|
||||
userPoints: number; // 用户当前积分(用于积分抵扣)
|
||||
isMember: boolean; // 用户是否会员(用于会员优惠)
|
||||
memberDiscountRate?: number; // 会员折扣率(如0.95=95折,无会员价时用)
|
||||
newUserDiscount?: number; // 新用户减免金额(元,默认0)
|
||||
fullReductionActivities: FullReductionActivity[]; // 当前店铺的满减活动列表(后端返回结构)
|
||||
currentDinnerType: "dine-in" | "take-out" | "take-away" | "post"; // 当前就餐类型(匹配useType)
|
||||
isFreeDine?: boolean; //是否霸王餐
|
||||
freeDineConfig?: FreeDineConfig;
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig; //限时折扣
|
||||
shopUserInfo: ShopUserInfo; // 用户信息
|
||||
}
|
||||
|
||||
/** 订单费用汇总(修改:补充商家减免类型和明细) */
|
||||
export interface OrderCostSummary {
|
||||
goodsList: BaseCartItem[];
|
||||
// 商品总件数
|
||||
goodsTotal: number;
|
||||
totalDiscountAmount: number;
|
||||
goodsRealAmount: number; // 商品真实原价总和
|
||||
goodsOriginalAmount: number; // 商品原价总和
|
||||
goodsDiscountAmount: number; // 商品折扣金额
|
||||
couponDeductionAmount: number; // 优惠券总抵扣
|
||||
productCouponDeduction: number; // 商品优惠券抵扣
|
||||
fullCouponDeduction: number; // 满减优惠券抵扣
|
||||
pointDeductionAmount: number; // 积分抵扣金额
|
||||
seatFee: number; // 餐位费
|
||||
packFee: number; // 打包费
|
||||
scoreMaxMoney: number; // 积分最大可抵扣金额
|
||||
// 新增:商家减免明细
|
||||
merchantReduction: {
|
||||
type: MerchantReductionType; // 实际使用的减免类型
|
||||
originalConfig: MerchantReductionConfig; // 原始配置(便于前端展示)
|
||||
actualAmount: number; // 实际减免金额(计算后的值,≥0)
|
||||
};
|
||||
additionalFee: number; // 附加费
|
||||
finalPayAmount: number; // 最终实付金额
|
||||
couponUsed?: Coupon; // 实际使用的优惠券
|
||||
pointUsed: number; // 实际使用的积分
|
||||
newUserDiscount: number; // 新用户减免金额(元,默认0)
|
||||
dinnerType?: "dine-in" | "take-out"; // 就餐类型(堂食/自取/配送/快递)
|
||||
config: OrderExtraConfig; // 订单额外费用配置
|
||||
//满减活动
|
||||
fullReduction: {
|
||||
usedFullReductionActivityFullAmount: number; // 计算出的满减活动的门槛金额
|
||||
usedActivity?: FullReductionActivity; // 实际使用的满减活动
|
||||
usedThreshold?: FullReductionThreshold; // 实际使用的满减阈值(多门槛中选最优)
|
||||
actualAmount: number; // 满减实际减免金额(元)
|
||||
};
|
||||
vipDiscountAmount: number; //会员折扣减免金额
|
||||
// 订单原支付金额
|
||||
orderOriginFinalPayAmount: number; //订单原金额(包含打包费+餐位费)
|
||||
}
|
||||
|
||||
/** 满减活动阈值(单条满减规则:满X减Y)- 对应 MkDiscountThresholdInsertGroupDefaultGroup */
|
||||
export interface FullReductionThreshold {
|
||||
activityId?: number; // 关联满减活动ID
|
||||
fullAmount?: number; // 满多少金额(元,必填)
|
||||
discountAmount?: number; // 减多少金额(元,必填)
|
||||
}
|
||||
|
||||
/** 满减活动主表 - 对应 Request 接口(后端真实字段) */
|
||||
export interface FullReductionActivity {
|
||||
id?: number; // 自增主键(后端字段:id)
|
||||
shopId?: number; // 店铺ID(后端字段:shopId)
|
||||
status?: number; // 活动状态:1=未开始,2=进行中,3=已结束(后端字段:status)
|
||||
sort?: number; // 排序值(越大优先级越高,后端字段:sort)
|
||||
createTime?: string; // 创建时间(后端字段:createTime,格式如"2025-10-14 13:56:07")
|
||||
updateTime?: string; // 最新修改时间(后端字段:updateTime,用于优先级排序)
|
||||
validStartTime?: string; // 有效期开始时间(后端字段:validStartTime,格式如"2025-10-14")
|
||||
validEndTime?: string; // 有效期结束时间(后端字段:validEndTime,格式如"2025-12-14")
|
||||
useType?: string; // 可使用类型(后端字段:useType,如"dine,pickup,deliv,express")
|
||||
useDays?: string; // 可用周期(后端字段:useDays,如"周一,周二,周三,周四,周五,周六,周日")
|
||||
useTimeType?: string; // 可用时间段类型(后端字段:useTimeType,all=全时段,custom=指定时段)
|
||||
useStartTime?: string; // 每日可用开始时间(后端字段:useStartTime,如"09:00:00",仅custom时有效)
|
||||
useEndTime?: string; // 每日可用结束时间(后端字段:useEndTime,如"22:00:00",仅custom时有效)
|
||||
couponShare?: number; // 与优惠券同享:0=否,1=是(后端字段:couponShare)
|
||||
discountShare?: number; // 与限时折扣同享:0=否,1=是(后端字段:discountShare)
|
||||
vipPriceShare?: number; // 与会员价同享:0=否,1=是(后端字段:vipPriceShare)
|
||||
pointsShare?: number; // 与积分抵扣同享:0=否,1=是(后端字段:pointsShare)
|
||||
thresholds?: FullReductionThreshold[]; // 满减阈值列表(多门槛,后端字段:thresholds)
|
||||
isDel?: boolean; // 是否删除:0=否,1=是(后端字段:isDel,默认false)
|
||||
}
|
||||
|
||||
// 辅助枚举:星期映射(用于useDays校验)
|
||||
export const WEEKDAY_MAP = {
|
||||
周一: 1,
|
||||
周二: 2,
|
||||
周三: 3,
|
||||
周四: 4,
|
||||
周五: 5,
|
||||
周六: 6,
|
||||
周日: 0, // JS中getDay()返回0=周日
|
||||
};
|
||||
|
||||
export interface ShopInfo {
|
||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
export interface couponCalcParams {
|
||||
canDikouGoodsArr: BaseCartItem[];
|
||||
coupon: Coupon;
|
||||
user: ShopUserInfo;
|
||||
shopInfo: ShopInfo;
|
||||
selCoupon: Coupon[];
|
||||
goodsOrderPrice: number; //商品订单总价
|
||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
||||
}
|
||||
export interface CanDikouGoodsArrArgs {
|
||||
canDikouGoodsArr: BaseCartItem[];
|
||||
selCoupon: Coupon[];
|
||||
user: ShopUserInfo;
|
||||
shopInfo: ShopInfo;
|
||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
||||
}
|
||||
export interface returnPriceArgs {
|
||||
goods: BaseCartItem;
|
||||
selCoupon: Coupon[];
|
||||
user: ShopUserInfo;
|
||||
shopInfo: ShopInfo;
|
||||
shopUserInfo: ShopUserInfo;
|
||||
limitTimeDiscountRes?: TimeLimitDiscountConfig | null | undefined;
|
||||
idKey?: keyof BaseCartItem;
|
||||
}
|
||||
|
||||
|
||||
export interface CanReturnMemberPriceArgs {
|
||||
shopInfo?: ShopInfo;
|
||||
shopUserInfo: ShopUserInfo;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
"jsencrypt": "^3.3.2",
|
||||
"lodash": "^4.17.21",
|
||||
"uview-plus": "^3.3.32",
|
||||
"ysk-utils": "^1.0.58"
|
||||
"ysk-utils": "^1.0.70"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ function loginFunc() {
|
|||
// 请求后的操作
|
||||
loginPromise
|
||||
.then((res) => {
|
||||
if(res.data){
|
||||
// 登录成功
|
||||
loginFinishFunc(res.data);
|
||||
// 保存商户号
|
||||
|
|
@ -311,6 +312,13 @@ function loginFunc() {
|
|||
merchantName: vdata.formData.merchantName,
|
||||
username: vdata.formData.username
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg|| '登录失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
.catch((e) => {
|
||||
getCode();
|
||||
|
|
@ -345,6 +353,7 @@ watch(
|
|||
);
|
||||
// 封装登录成功后的操作
|
||||
async function loginFinishFunc(loginBizData) {
|
||||
console.log('loginBizData', loginBizData);
|
||||
// 保存 token
|
||||
uni.setStorageSync('shopInfo', loginBizData.shopInfo);
|
||||
uni.setStorageSync('tokenInfo', loginBizData.tokenInfo);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,610 @@
|
|||
<template>
|
||||
<view
|
||||
class="bg-fff border-r-24 u-m-t-32"
|
||||
v-if="orderInfo && orderInfo.detailMap"
|
||||
>
|
||||
<view
|
||||
class="u-m-b-20"
|
||||
v-for="(goods, orderIndex) in orderInfo.detailMap"
|
||||
:key="orderIndex"
|
||||
>
|
||||
<view class="u-p-t-24"> 第{{ orderIndex }}次下单 </view>
|
||||
<view class="u-m-t-24 list">
|
||||
<view class="item u-m-b-32" v-for="(item, index) in goods" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="u-flex u-relative">
|
||||
<view class="limit-discount" v-if="item.isTimeDiscount"
|
||||
>限时折扣</view
|
||||
>
|
||||
<image
|
||||
v-if="item.isTemporary == 0"
|
||||
class="img"
|
||||
:src="item.coverImg || item.productImg"
|
||||
mode=""
|
||||
></image>
|
||||
<view
|
||||
v-else
|
||||
style="
|
||||
background-color: #3f9eff;
|
||||
width: 152rpx;
|
||||
height: 152rpx;
|
||||
line-height: 152rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
"
|
||||
>
|
||||
临时菜
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-l-32 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="isTui(item)">
|
||||
{{
|
||||
item.status == "part_refund" ? "部分已退" : "全部已退"
|
||||
}}
|
||||
</view>
|
||||
<view
|
||||
:class="{
|
||||
'line-th':
|
||||
item.status == 'return' ||
|
||||
item.status == 'refund' ||
|
||||
item.status == 'refunding',
|
||||
}"
|
||||
>
|
||||
{{ item.name || item.productName }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-flex u-m-t-8"
|
||||
style="flex-direction: column; align-items: flex-start"
|
||||
>
|
||||
<view class="u-flex u-m-b-8">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<uni-tag
|
||||
text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;"
|
||||
>
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.userCouponId">
|
||||
<uni-tag
|
||||
:text="productCouponDikou(item)"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;"
|
||||
>
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.packNumber > 0">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small"
|
||||
text="打包"
|
||||
inverted
|
||||
type="success"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view
|
||||
class="u-m-r-20 u-font-24 u-flex"
|
||||
v-if="item.refundNum > 0"
|
||||
>
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{
|
||||
item.refundNum * item.unitPrice
|
||||
}}</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-m-r-20 u-font-24 u-flex"
|
||||
v-if="item.returnNum"
|
||||
>
|
||||
<view class="color-666">退菜数量:</view>
|
||||
<view class="color-999 u-m-l-6">{{
|
||||
item.returnNum
|
||||
}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{
|
||||
item.skuName || ""
|
||||
}}</view>
|
||||
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.remark">
|
||||
备注:{{ item.remark }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
<view class="u-relative">
|
||||
<template v-if="item.isGift">
|
||||
<text class="line-th color-999"
|
||||
>¥{{ toFixed(item.price * item.num, item) }}</text
|
||||
>
|
||||
<view class="u-absolute" style="right: 0; bottom: 100%">
|
||||
<text class="font-bold">¥0</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template
|
||||
v-if="
|
||||
item.discountSaleAmount &&
|
||||
item.discountSaleAmount * 1 > 0
|
||||
"
|
||||
>
|
||||
<text class="line-th color-999"
|
||||
>¥{{ toFixed(item.price * item.num, item) }}</text
|
||||
>
|
||||
<view class="u-absolute" style="right: 0; bottom: 100%">
|
||||
<text class="font-bold"
|
||||
>¥{{
|
||||
toFixed(item.discountSaleAmount * item.num, item)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="item.isTimeDiscount">
|
||||
<text class="line-th color-999"
|
||||
>¥{{ toFixed(item.price * item.num, item) }}</text
|
||||
>
|
||||
<view
|
||||
class="u-absolute xianshi"
|
||||
style="right: 0; bottom: 100%"
|
||||
>
|
||||
<text class="font-bold"
|
||||
>¥{{ returnLimitTotalMoney(item) }}</text
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
<template
|
||||
v-else-if="
|
||||
isVip &&
|
||||
item.price &&
|
||||
item.price * 1 != item.memberPrice * 1
|
||||
"
|
||||
>
|
||||
<text class="line-th color-999"
|
||||
>¥{{ toFixed(item.price * item.num, item) }}</text
|
||||
>
|
||||
<view class="u-absolute" style="right: 0; bottom: 100%">
|
||||
<text class="font-bold"
|
||||
>¥{{
|
||||
toFixed(item.memberPrice * item.num, item)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="font-bold">
|
||||
<text>¥</text>
|
||||
<text class="">{{
|
||||
toFixed(item.price * item.num, item)
|
||||
}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-m-t-22 color-999 u-font-24"
|
||||
>X{{ item.num || item.num }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <template v-if="canTuicai(orderInfo, item)"> -->
|
||||
<template v-if="false">
|
||||
<view
|
||||
class="u-flex u-row-right gap-20 u-m-t-24"
|
||||
v-if="item.returnNum * item.unitPrice < item.num * item.unitPrice"
|
||||
>
|
||||
<my-button
|
||||
:width="128"
|
||||
:height="48"
|
||||
plain
|
||||
shape="circle"
|
||||
@tap="tuicai(item, index)"
|
||||
><text class="no-wrap">退菜</text></my-button
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive,inject } from "vue";
|
||||
import BigNumber from "bignumber.js";
|
||||
import { hasPermission } from "@/commons/utils/hasPermission.js";
|
||||
import {
|
||||
isTui,
|
||||
isTuiCai,
|
||||
isGift,
|
||||
canTuiKuan,
|
||||
canTuicai,
|
||||
mathFloorPrice,
|
||||
} from "@/commons/utils/goodsUtil.js";
|
||||
|
||||
const emits = defineEmits(["tuicai", "tuikuan", "printOrder"]);
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = inject("shopInfo");
|
||||
const pageData = inject("pageData");
|
||||
const pop = reactive({
|
||||
youhui: false,
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: "",
|
||||
isVip: false,
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 计算菜品数量
|
||||
*/
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0;
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.length;
|
||||
return a + bTotal;
|
||||
}, 0);
|
||||
return result.toFixed(0);
|
||||
});
|
||||
|
||||
/**
|
||||
* 桌位费
|
||||
*/
|
||||
const seatFeePrice = computed(() => {
|
||||
const n =
|
||||
props.orderInfo.seatNum > 0
|
||||
? props.orderInfo.seatNum * uni.getStorageSync("shopInfo").tableFee
|
||||
: 0;
|
||||
return n.toFixed(2);
|
||||
});
|
||||
function toFixed(price, item) {
|
||||
if (item) {
|
||||
if (item.productType == "weight" || item.type == "weight") {
|
||||
return (Math.floor(price * 100) / 100).toFixed(2);
|
||||
} else {
|
||||
return parseFloat(price).toFixed(2);
|
||||
}
|
||||
} else {
|
||||
return parseFloat(price).toFixed(2);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否是会员
|
||||
*/
|
||||
const isVip = computed(() => {
|
||||
return (
|
||||
uni.getStorageSync("shopInfo").isMemberPrice &&
|
||||
props.user &&
|
||||
props.user.id &&
|
||||
props.user.isVip
|
||||
);
|
||||
});
|
||||
|
||||
function returnLimitTotalMoney(data) {
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: data,
|
||||
shopInfo: pageData.shopInfo,
|
||||
limitTimeDiscountRes: pageData.limitTimeDiscount,
|
||||
shopUserInfo: pageData.user,
|
||||
idKey: "product_id",
|
||||
});
|
||||
return BigNumber(price).times(data.number).toNumber();
|
||||
}
|
||||
|
||||
const vipDiscountPrice = computed(() => {
|
||||
if (!isVip.value) {
|
||||
return 0;
|
||||
}
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info
|
||||
.filter(
|
||||
(v) =>
|
||||
v.discountSaleAmount <= 0 &&
|
||||
v.isGift != 1 &&
|
||||
v.status !== "return" &&
|
||||
v.price != v.unitPrice &&
|
||||
v.memberPrice != v.price
|
||||
)
|
||||
.reduce((a, b) => {
|
||||
return a + b.num * (b.price - b.memberPrice);
|
||||
}, 0);
|
||||
return prve + curTotal;
|
||||
}, 0);
|
||||
return goodsPrice.toFixed(2);
|
||||
});
|
||||
|
||||
/**
|
||||
* 单品打折优惠
|
||||
*/
|
||||
const discountSaleAmount = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info
|
||||
.filter(
|
||||
(v) =>
|
||||
v.discountSaleAmount > 0 && v.isGift != 1 && v.status !== "return"
|
||||
)
|
||||
.reduce((a, b) => {
|
||||
return a + b.num * (b.price - b.discountSaleAmount);
|
||||
}, 0);
|
||||
return prve + curTotal;
|
||||
}, 0);
|
||||
return goodsPrice.toFixed(2);
|
||||
});
|
||||
|
||||
/**
|
||||
* 打折优惠
|
||||
*/
|
||||
const discountAmount = computed(() => {
|
||||
return props.orderInfo.discountAmount || 0;
|
||||
});
|
||||
|
||||
/**
|
||||
* 总优惠金额
|
||||
*/
|
||||
const discountsPrice = computed(() => {
|
||||
// 满减券优惠
|
||||
let fullCouponDiscountAmount =
|
||||
props.orderInfo.status == "done"
|
||||
? props.orderInfo.fullCouponDiscountAmount
|
||||
: 0;
|
||||
// 商品券优惠
|
||||
let productCouponDiscountAmount =
|
||||
props.orderInfo.status == "done"
|
||||
? props.orderInfo.productCouponDiscountAmount
|
||||
: 0;
|
||||
// 积分抵扣优惠
|
||||
let pointsDiscountAmount =
|
||||
props.orderInfo.status == "done" ? props.orderInfo.pointsDiscountAmount : 0;
|
||||
return (
|
||||
parseFloat(vipDiscountPrice.value) +
|
||||
parseFloat(discountSaleAmount.value) +
|
||||
discountAmount.value +
|
||||
fullCouponDiscountAmount +
|
||||
productCouponDiscountAmount +
|
||||
pointsDiscountAmount
|
||||
).toFixed(2);
|
||||
});
|
||||
|
||||
// 菜品金额
|
||||
const productCoupPrice = computed(() => {
|
||||
if (props.orderInfo.status == "done") {
|
||||
return props.orderInfo.productCouponDiscountAmount;
|
||||
}
|
||||
const goodsPrice = props.data.reduce((a, b) => {
|
||||
const curTotal = b.info
|
||||
.filter((v) => !v.isGift)
|
||||
.reduce((prve, cur) => {
|
||||
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price;
|
||||
let tPrice = isVip.value ? memberPrice : cur.price;
|
||||
tPrice =
|
||||
cur.memberPrice != cur.unitPrice && cur.price != cur.unitPrice
|
||||
? cur.unitPrice
|
||||
: tPrice;
|
||||
let Total = Math.floor(tPrice * cur.num * 100) / 100;
|
||||
|
||||
return (
|
||||
prve + Total - cur.returnNum * tPrice - cur.refundNum * cur.unitPrice
|
||||
);
|
||||
}, 0);
|
||||
return a + curTotal;
|
||||
}, 0);
|
||||
// console.log("菜品金额==",goodsPrice)
|
||||
return goodsPrice.toFixed(2);
|
||||
});
|
||||
|
||||
const allPpackFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info
|
||||
.filter((v) => v.packNumber > 0)
|
||||
.reduce((a, b) => {
|
||||
return a + parseFloat(b.packAmount * b.packNumber).toFixed(2) * 1;
|
||||
}, 0);
|
||||
return prve + curTotal;
|
||||
}, 0);
|
||||
return goodsPrice.toFixed(2);
|
||||
});
|
||||
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info
|
||||
.filter((v) => v.status !== "return" && v.returnNum + v.refundNum < v.num)
|
||||
.reduce((a, b) => {
|
||||
return (
|
||||
a +
|
||||
parseFloat(
|
||||
(
|
||||
b.packAmount *
|
||||
(b.num - (b.returnNum + b.refundNum) > b.packNumber
|
||||
? b.packNumber
|
||||
: b.num - (b.returnNum + b.refundNum))
|
||||
).toFixed(2)
|
||||
)
|
||||
);
|
||||
}, 0);
|
||||
return prve + curTotal;
|
||||
}, 0);
|
||||
return goodsPrice.toFixed(2);
|
||||
});
|
||||
|
||||
const allPrice = computed(() => {
|
||||
let seatAmount = props.orderInfo.seatAmount || 0;
|
||||
const total = productCoupPrice.value * 1 + seatAmount * 1 + packFee.value * 1;
|
||||
return (total <= 0 ? 0 : total).toFixed(2);
|
||||
});
|
||||
|
||||
/**
|
||||
* 已优惠金额
|
||||
*/
|
||||
const youhuiAllPrice = computed(() => {
|
||||
const n = vipDiscountPrice.value * 1;
|
||||
return (n < 0 ? 0 : n).toFixed(2);
|
||||
});
|
||||
|
||||
function youhuiDetailShow() {
|
||||
pop.youhui = true;
|
||||
}
|
||||
|
||||
function productCouponDikou(item) {
|
||||
return "商品券抵扣¥" + returnProductCoupPrice(item);
|
||||
}
|
||||
|
||||
function youhuiDetailHide() {
|
||||
pop.youhui = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转桌/并桌
|
||||
*/
|
||||
function rotatingTables() {
|
||||
let arr = [];
|
||||
props.data.forEach((ele) => {
|
||||
ele.info.forEach((res) => {
|
||||
// 头像 coverImg
|
||||
res.coverImg = res.productImg;
|
||||
// 名字 name
|
||||
res.name = res.productName;
|
||||
// 金额 price
|
||||
res.price = res.price;
|
||||
// 数量 number
|
||||
res.number = res.num;
|
||||
res.masterId = props.orderInfo.masterId;
|
||||
res.useType = props.orderInfo.useType;
|
||||
res.tableId = props.orderInfo.tableId;
|
||||
arr.push(res);
|
||||
});
|
||||
});
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pagesCreateOrder/confirm-order/rotatingTables?item=" +
|
||||
JSON.stringify(arr) +
|
||||
"&tableId=" +
|
||||
props.orderInfo.tableId,
|
||||
});
|
||||
}
|
||||
|
||||
function returnProductCoupPrice(item) {
|
||||
if (!item.isMember) {
|
||||
return item.price * item.num;
|
||||
}
|
||||
const price = item.memberPrice ? item.memberPrice : item.price;
|
||||
return price * item.num;
|
||||
}
|
||||
|
||||
|
||||
function returnCanTuiMoney(item) {
|
||||
// if (props.orderInfo.status == 'unpaid') {
|
||||
// return returnTotalMoney(item)
|
||||
// } else {
|
||||
if (
|
||||
props.orderInfo.pointsDiscountAmount > 0 ||
|
||||
props.orderInfo.fullCouponDiscountAmount > 0
|
||||
) {
|
||||
return item.canReturnAmount;
|
||||
} else if (item.price != item.unitPrice) {
|
||||
return item.price * item.num;
|
||||
} else {
|
||||
return (Math.floor(item.num * item.unitPrice * 100) / 100).toFixed(2);
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
function tuicai(item, index) {
|
||||
emits("tuicai", item, index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img {
|
||||
width: 152rpx;
|
||||
height: 152rpx;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.border-r-24 {
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
// border-color: rgb(240, 240, 240);
|
||||
border-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.line-th {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 4rpx 8rpx 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
&.no-pay {
|
||||
background-color: rgb(170, 170, 170);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.refund {
|
||||
background-color: #fce7e7;
|
||||
padding: 8rpx 20rpx 6rpx 22rpx;
|
||||
color: #eb4f4f;
|
||||
}
|
||||
}
|
||||
|
||||
.tui {
|
||||
background-color: rgb(239, 239, 239);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 6rpx;
|
||||
color: #666;
|
||||
padding: 0 4rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.limit-discount {
|
||||
background-color: #cc5617;
|
||||
padding: 2rpx 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
border-radius: 20rpx 0rpx 20rpx 0rpx;
|
||||
z-index: 9;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
<view class="block u-m-b-0">
|
||||
<view class="u-flex">
|
||||
<view>共</view>
|
||||
<view class="fen font-bold">{{ goods.list.length }}</view>
|
||||
<view class="fen font-bold">{{ allGoodsList.length }}</view>
|
||||
<view>份菜品</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -164,12 +164,12 @@
|
|||
>
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<image
|
||||
class="img"
|
||||
v-if="item.coverImg"
|
||||
:src="item.coverImg"
|
||||
mode=""
|
||||
></image>
|
||||
<view v-if="item.coverImg" class="u-relative">
|
||||
<view class="limit-discount" v-if="item.is_time_discount"
|
||||
>限时折扣</view
|
||||
>
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
</view>
|
||||
<view
|
||||
style="
|
||||
background-color: #3f9eff;
|
||||
|
|
@ -274,7 +274,10 @@
|
|||
<text class="line-th color-999"
|
||||
>¥{{ toFixed(item.lowPrice * item.number, item) }}</text
|
||||
>
|
||||
<view class="u-absolute" style="right: 0; bottom: 100%">
|
||||
<view
|
||||
class="u-absolute xianshi"
|
||||
style="right: 0; bottom: 100%"
|
||||
>
|
||||
<text class="font-bold"
|
||||
>¥{{ returnLimitTotalMoney(item) }}</text
|
||||
>
|
||||
|
|
@ -283,8 +286,8 @@
|
|||
<template
|
||||
v-else-if="
|
||||
isVip &&
|
||||
item.lowMemberPrice &&
|
||||
item.lowMemberPrice * 1 != item.lowPrice * 1
|
||||
item.salePrice &&
|
||||
item.salePrice * 1 != item.memberPrice * 1
|
||||
"
|
||||
>
|
||||
<text class="line-th color-999"
|
||||
|
|
@ -383,6 +386,9 @@
|
|||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 历史订单 -->
|
||||
<orderList :orderInfo="pageData.orderInfo"></orderList>
|
||||
|
||||
<view class="border-bottom">
|
||||
<template v-if="orderCostSummary.seatFee > 0">
|
||||
<view class="u-flex u-row-between u-m-t-18 u-p-b-34">
|
||||
|
|
@ -392,6 +398,7 @@
|
|||
<view>¥{{ orderCostSummary.seatFee }}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="orderCostSummary.packFee > 0">
|
||||
<view class="u-flex u-row-between u-m-t-18 u-p-b-34">
|
||||
<view>
|
||||
|
|
@ -404,9 +411,14 @@
|
|||
|
||||
<view class="u-flex u-row-between u-m-t-38">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex price" v-if="youhui * 1 > 0">
|
||||
<view
|
||||
class="u-flex price"
|
||||
v-if="orderCostSummary.totalDiscountAmount"
|
||||
>
|
||||
<view class="">优惠金额</view>
|
||||
<view class="font-bold u-font-32">¥{{ youhui }}</view>
|
||||
<view class="font-bold u-font-32"
|
||||
>¥{{ orderCostSummary.totalDiscountAmount }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -424,12 +436,12 @@
|
|||
<view class="btn">
|
||||
<my-button shape="circle" @click="createAnOrder">
|
||||
<view class="font-bold u-font-32">
|
||||
{{
|
||||
pageData.shopInfo.registerType == "before" ||
|
||||
pageData.eatTypes.active == "take-out"
|
||||
? "结算"
|
||||
: "下单"
|
||||
}}
|
||||
<text v-if="pageData.shopInfo.registerType == 'before'">
|
||||
下单
|
||||
</text>
|
||||
<text v-if="pageData.shopInfo.registerType == 'after'">
|
||||
{{ goods.list.length > 0 ? "下单" : "结算" }}
|
||||
</text>
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
|
|
@ -461,6 +473,9 @@
|
|||
<script setup>
|
||||
import { onLoad, onReady, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import yskUtils from "ysk-utils";
|
||||
// import yskUtils from "@/lib/index";
|
||||
const limitUtils = yskUtils.limitUtils;
|
||||
|
||||
import {
|
||||
ref,
|
||||
inject,
|
||||
|
|
@ -469,12 +484,15 @@ import {
|
|||
reactive,
|
||||
computed,
|
||||
watch,
|
||||
provide,
|
||||
} from "vue";
|
||||
provide("yskUtils", yskUtils);
|
||||
|
||||
import modelDiscount from "./components/discount";
|
||||
import giveFood from "./components/give-food";
|
||||
import packNumber from "./components/pack-number";
|
||||
import oneRemark from "./components/remark";
|
||||
import orderList from "./components/list";
|
||||
// import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
|
||||
import { getSafeBottomHeight } from "@/commons/utils/safe-bottom.js";
|
||||
|
|
@ -486,6 +504,8 @@ import { getShopTableDetail } from "@/http/api/table.js";
|
|||
import { getShopInfo } from "@/http/api/shop.js";
|
||||
import { getProductList } from "@/http/api/product.js";
|
||||
import { createOrder, getHistoryOrder } from "@/http/api/order.js";
|
||||
import { shopUserDetail } from "@/http/yskApi/shop-user.js";
|
||||
import { discountActivity } from "@/http/yskApi/market/discountActivity.js";
|
||||
import BigNumber from "bignumber.js";
|
||||
|
||||
const models = new Map();
|
||||
|
|
@ -498,16 +518,17 @@ const option = reactive({
|
|||
tableId: "",
|
||||
});
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
provide("shopInfo", shopInfo);
|
||||
|
||||
function returnLimitTotalMoney(data) {
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
// const price = yskUtils.limitUtils.returnPrice({
|
||||
const price = limitUtils.returnPrice({
|
||||
goods: data,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: pageData.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
shopUserInfo: pageData.user,
|
||||
idKey: "product_id",
|
||||
});
|
||||
console.log("pageData.limitTimeDiscount", pageData.limitTimeDiscount);
|
||||
return BigNumber(price).times(data.number).toNumber();
|
||||
}
|
||||
/**
|
||||
|
|
@ -556,22 +577,34 @@ const pageData = reactive({
|
|||
orderInfo: {},
|
||||
limitTimeDiscount: null, //限时折扣
|
||||
});
|
||||
|
||||
provide("pageData", pageData);
|
||||
|
||||
async function getDiscountActivity() {
|
||||
let res = await discountActivity({
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
});
|
||||
if (res.code == 200) {
|
||||
fullReductionActivities.value = res.data?[res.data]:[];
|
||||
}
|
||||
}
|
||||
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
|
||||
onLoad((opt) => {
|
||||
onLoad(async (opt) => {
|
||||
Object.assign(option, opt);
|
||||
console.log("opt====", opt);
|
||||
if (opt.tableId || opt.tableCode) {
|
||||
pageData.table.id = opt.tableId;
|
||||
pageData.table.tableCode = opt.tableCode;
|
||||
}
|
||||
//获取满减活动
|
||||
await getDiscountActivity();
|
||||
pageData.shopInfo = uni.getStorageSync("shopInfo");
|
||||
console.log(uni.getStorageSync("shopInfo"), "提示1");
|
||||
getTbShopInfo();
|
||||
});
|
||||
let bottomHeight = ref(100);
|
||||
onReady(() => {
|
||||
getSafeBottomHeight("safe-bottom").then((res) => {
|
||||
bottomHeight.value = res;
|
||||
bottomHeight.value = res + 40;
|
||||
});
|
||||
});
|
||||
watch(
|
||||
|
|
@ -619,37 +652,16 @@ const $seatFee = reactive({
|
|||
totalAmount: 0,
|
||||
});
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
const $packFee = computed(() => {
|
||||
return goods.list
|
||||
.reduce((prve, cur) => {
|
||||
return prve + (cur.packFee || 0) * parseFloat(cur.pack_number).toFixed(2);
|
||||
}, 0)
|
||||
.toFixed(2);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否是会员
|
||||
*/
|
||||
const isVip = computed(() => {
|
||||
return (
|
||||
pageData.shopInfo.isMemberPrice &&
|
||||
return pageData.shopInfo.isMemberPrice &&
|
||||
pageData.user &&
|
||||
pageData.user.id &&
|
||||
pageData.user.isVip
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计算优惠金额
|
||||
*/
|
||||
const youhui = computed(() => {
|
||||
return 0;
|
||||
? true
|
||||
: false;
|
||||
});
|
||||
|
||||
function toFixed(price, item) {
|
||||
|
|
@ -704,7 +716,6 @@ function onMessage() {
|
|||
cartItem = getNowCart(item, $goods, pageData.user);
|
||||
if (cartItem.isGrounding || cartItem.is_temporary == 1) {
|
||||
cartControls(cartItem, "add");
|
||||
|
||||
} else {
|
||||
delCart(cartItem.id);
|
||||
}
|
||||
|
|
@ -796,21 +807,18 @@ function cartControls(cartItem, type) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (type == "del") {
|
||||
goods.list.splice(cartIndex, 1);
|
||||
return;
|
||||
}
|
||||
if (type == "add") {
|
||||
goods.list.push({...cartItem,packNumber:cartItem.pack_number});
|
||||
goods.list.push({ ...cartItem, packNumber: cartItem.pack_number });
|
||||
}
|
||||
if (type == "edit") {
|
||||
goods.list[cartIndex].number = cartItem.number;
|
||||
goods.list[cartIndex].pack_number = cartItem.pack_number;
|
||||
goods.list[cartIndex].packNumber = cartItem.pack_number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -868,11 +876,66 @@ async function getTableInfo(opt) {
|
|||
*/
|
||||
function watchChooseuser() {
|
||||
uni.$off("choose-user");
|
||||
uni.$on("choose-user", (data) => {
|
||||
pageData.user = data;
|
||||
uni.$on("choose-user", async (data) => {
|
||||
if (pageData.user.id == data.id) {
|
||||
return;
|
||||
}
|
||||
if (data.id) {
|
||||
const res = await shopUserDetail({
|
||||
userId: data.userId,
|
||||
});
|
||||
pageData.user = res.data;
|
||||
} else {
|
||||
pageData.user = data;
|
||||
}
|
||||
// 更新购物车和历史订单数据
|
||||
uodateCartAndHistory();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新购物车和历史订单数据
|
||||
*/
|
||||
function uodateCartAndHistory() {
|
||||
let newData = {
|
||||
history: [],
|
||||
cart: [],
|
||||
};
|
||||
console.log("uodateCartAndHistory", pageData.user);
|
||||
for (let cart of goods.list) {
|
||||
const canUseLimitTimeDiscount = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
cart,
|
||||
pageData.limitTimeDiscount,
|
||||
pageData.shopInfo,
|
||||
pageData.user,
|
||||
"product_id"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
console.log("uodateCartAndHistory", pageData.user);
|
||||
if (canUseLimitTimeDiscount != cart.is_time_discount) {
|
||||
newData.cart.push({
|
||||
id: cart.id,
|
||||
is_time_discount: canUseLimitTimeDiscount,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (newData.history.length <= 0 && newData.cart.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "pad",
|
||||
account: uni.getStorageSync("shopInfo").id,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "bulk_edit",
|
||||
table_code: pageData.table.tableCode,
|
||||
data: newData,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 就餐类型切换监听
|
||||
*/
|
||||
|
|
@ -1136,7 +1199,8 @@ async function createAnOrder() {
|
|||
dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
remark: pageData.form.note, //备注
|
||||
seatNum: 0, //用餐人数
|
||||
packFee:pageData.eatTypes.active=='dine-in'?seatFeeConfig.personCount : 0, //打包费
|
||||
packFee:
|
||||
pageData.eatTypes.active == "dine-in" ? seatFeeConfig.personCount : 0, //打包费
|
||||
originAmount: orderCostSummary.value.goodsRealAmount, //订单原金额(不包含打包费+餐位费)
|
||||
placeNum: placeNum, //当前订单下单次数
|
||||
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||
|
|
@ -1146,30 +1210,33 @@ async function createAnOrder() {
|
|||
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
|
||||
par.seatNum = userNumbers.defaultCateIndex * 1 + 1;
|
||||
}
|
||||
if (pageData.orderInfo) {
|
||||
if (pageData.orderInfo && pageData.shopInfo.registerType != "before") {
|
||||
par.orderId = pageData.orderInfo.id;
|
||||
}
|
||||
// console.log(par,22222222);
|
||||
const res = await createOrder(par);
|
||||
console.log(res, "创建订单");
|
||||
if (res.code != 200) {
|
||||
uni.showToast({
|
||||
title: res.msg || "创建订单失败!",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
let res = {data:{id:''}};
|
||||
if (goods.list.length) {
|
||||
res = await createOrder(par);
|
||||
console.log(res, "创建订单");
|
||||
if (res.code != 200) {
|
||||
uni.showToast({
|
||||
title: res.msg || "创建订单失败!",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.$emit("update:createOrderIndex");
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "pad",
|
||||
account: uni.getStorageSync("shopInfo").id,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "cleanup",
|
||||
table_code: pageData.table.tableCode,
|
||||
})
|
||||
);
|
||||
uni.removeStorageSync("table_code");
|
||||
}
|
||||
uni.$emit("update:createOrderIndex");
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "pad",
|
||||
account: uni.getStorageSync("shopInfo").id,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "cleanup",
|
||||
table_code: pageData.table.tableCode,
|
||||
})
|
||||
);
|
||||
uni.removeStorageSync("table_code");
|
||||
|
||||
if (
|
||||
pageData.shopInfo.registerType == "before" ||
|
||||
pageData.eatTypes.active == "take-out"
|
||||
|
|
@ -1185,12 +1252,23 @@ async function createAnOrder() {
|
|||
"redirect"
|
||||
);
|
||||
} else {
|
||||
if(!res.data.id&&pageData.orderInfo.id){
|
||||
return go.to(
|
||||
"PAGES_ORDER_PAY",
|
||||
{
|
||||
orderId: pageData.orderInfo.id,
|
||||
isNowPay: true,
|
||||
dinnerType: pageData.eatTypes.active,
|
||||
},
|
||||
"redirect"
|
||||
);
|
||||
}
|
||||
//后付
|
||||
if (option.isCreateOrderToDetail != "0") {
|
||||
go.to(
|
||||
"PAGES_ORDER_DETAIL",
|
||||
{
|
||||
id: res.data.id,
|
||||
id: res.data.id||pageData.orderInfo.id,
|
||||
dinnerType: pageData.eatTypes.active,
|
||||
},
|
||||
"redirect"
|
||||
|
|
@ -1243,9 +1321,6 @@ const fullReductionActivities = ref([]);
|
|||
// 商家霸王餐配置
|
||||
const freeDineConfig = ref(null);
|
||||
|
||||
//限时折扣
|
||||
const limitTimeDiscount = ref(null);
|
||||
|
||||
const orderExtraConfig = computed(() => {
|
||||
return {
|
||||
// 引用扩展后的商家减免配置
|
||||
|
|
@ -1262,15 +1337,35 @@ const orderExtraConfig = computed(() => {
|
|||
currentDinnerType: pageData.eatTypes.active,
|
||||
isFreeDine: false, //霸王餐
|
||||
freeDineConfig: freeDineConfig.value,
|
||||
limitTimeDiscount: limitTimeDiscount.value,
|
||||
limitTimeDiscount: pageData.limitTimeDiscount,
|
||||
shopUserInfo: pageData.user,
|
||||
};
|
||||
});
|
||||
|
||||
const allGoodsList = computed(() => {
|
||||
if (!pageData.orderInfo || !pageData.orderInfo.detailMap) {
|
||||
return goods.list;
|
||||
}
|
||||
console.log(Object.values(pageData.orderInfo.detailMap));
|
||||
const historyGoodsList = Object.values(pageData.orderInfo.detailMap).reduce(
|
||||
(prve, cur) => {
|
||||
cur.map((v) => {
|
||||
v.number = v.num;
|
||||
v.salePrice = v.price;
|
||||
});
|
||||
prve.push(...cur);
|
||||
return prve;
|
||||
},
|
||||
[]
|
||||
);
|
||||
return [...goods.list, ...historyGoodsList];
|
||||
});
|
||||
|
||||
// 订单费用汇总
|
||||
const orderCostSummary = computed(() => {
|
||||
console.log(goods.list, "购物车数据");
|
||||
const costSummary = yskUtils.OrderPriceCalculator.calculateOrderCostSummary(
|
||||
goods.list,
|
||||
allGoodsList.value,
|
||||
pageData.eatTypes.active,
|
||||
selCoupon.value,
|
||||
activityList.value,
|
||||
|
|
@ -1327,8 +1422,8 @@ watch(
|
|||
|
||||
.item {
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
}
|
||||
|
|
@ -1386,4 +1481,19 @@ watch(
|
|||
.hover-class {
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
.limit-discount {
|
||||
background-color: #cc5617;
|
||||
padding: 2rpx 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
border-radius: 20rpx 0rpx 20rpx 0rpx;
|
||||
z-index: 9;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -54,7 +54,10 @@
|
|||
{{ index + 1 }}
|
||||
</view>
|
||||
<view class="">
|
||||
<view>{{ item.name }}</view>
|
||||
<view>
|
||||
<text>{{ item.name }}</text>
|
||||
<text class="limit" v-if="item.is_time_discount">限</text>
|
||||
</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666">{{
|
||||
item.specInfo || ""
|
||||
}}</view>
|
||||
|
|
@ -179,7 +182,7 @@
|
|||
v-if="v.is_time_discount || v.isTimeDiscount"
|
||||
>
|
||||
<view class="font-bold red u-m-r-32"
|
||||
>¥{{ formatPrice(v.price * (v.num - v.returnNum)) }}</view
|
||||
>¥{{ returnLimitPrice({...v,number:v.num,salePrice:v.price}) }}</view
|
||||
>
|
||||
<view class="u-m-l-30 u-m-r-30 color-333">
|
||||
X{{ v.num.toFixed(2) }}
|
||||
|
|
@ -276,6 +279,8 @@ import { getElRect } from "@/commons/utils/safe-bottom.js";
|
|||
import * as Api from "@/http/yskApi/Instead.js";
|
||||
import { computed, ref, onMounted, reactive, watch, inject } from "vue";
|
||||
import BigNumber from "bignumber.js";
|
||||
import { limitTimeDiscount } from "../../../http/yskApi/limitTimeDiscount";
|
||||
import { number } from "uview-plus/libs/function/test";
|
||||
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
|
|
@ -343,18 +348,19 @@ function returnLimitPrice(data) {
|
|||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
idKey: "product_id",
|
||||
});
|
||||
return price
|
||||
}
|
||||
|
||||
function returnLimitTotalPrice(data) {
|
||||
console.log('returnLimitTotalPrice',data)
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: data,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
idKey: "product_id",
|
||||
});
|
||||
return BigNumber(price).times(data.number).toNumber();
|
||||
}
|
||||
|
|
@ -377,16 +383,12 @@ const allPrice = computed(() => {
|
|||
let price = (cur.is_time_discount? returnLimitPrice(cur) : cur.lowPrice) * cur.number
|
||||
return BigNumber(prve).plus(price);
|
||||
}, 0);
|
||||
console.log('cartPrice',cartPrice)
|
||||
let historyOrderPrice = allHistoryOrder.value.reduce((prve, cur) => {
|
||||
const isTimeDiscount=cur.is_time_discount||cur.isTimeDiscount
|
||||
let price = (isTimeDiscount? returnLimitPrice(cur) : cur.price)* (cur.num - cur.returnNum)
|
||||
console.log('price',price)
|
||||
let price = (cur.isTimeDiscount? returnLimitPrice({...cur,salePrice:cur.price}) : cur.price)* (cur.num - cur.returnNum)
|
||||
return BigNumber(prve).plus(price);
|
||||
}, 0);
|
||||
console.log('historyOrderPrice',historyOrderPrice)
|
||||
|
||||
return BigNumber(cartPrice).plus(historyOrderPrice);
|
||||
return BigNumber(cartPrice).plus(historyOrderPrice).decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
});
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
|
|
@ -495,7 +497,7 @@ function getshopsInfo() {
|
|||
}
|
||||
|
||||
function toConfimOrder() {
|
||||
if (props.data.length <= 0) {
|
||||
if (props.data.length <= 0&& props.historyOrder.length<=0) {
|
||||
return infoBox.showToast("还没有选择商品");
|
||||
}
|
||||
|
||||
|
|
@ -687,6 +689,7 @@ $car-top: -16rpx;
|
|||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.total {
|
||||
|
|
@ -780,4 +783,17 @@ $car-top: -16rpx;
|
|||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.limit{
|
||||
background-color: #cc5617;
|
||||
margin-left: 10rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
border-radius: 14rpx;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
class="u-relative u-flex item box-shadow"
|
||||
@tap="emitEvent('showDetail')"
|
||||
>
|
||||
<view class="limit-discount" v-if="data.is_time_discount">限时折扣</view>
|
||||
<view class="limit-discount" v-if="is_time_discount">限时折扣</view>
|
||||
<!-- 已下架 -->
|
||||
<view
|
||||
v-if="!data.isSale"
|
||||
|
|
@ -175,9 +175,9 @@
|
|||
<view class="bg-fff u-p-20 w-full">
|
||||
<view class="u-flex u-row-between u-font-16">
|
||||
<view>{{ data.name }}</view>
|
||||
<view class="u-flex" v-if="data.is_time_discount">
|
||||
<view class="u-flex" v-if="is_time_discount">
|
||||
<view class="font-bold u-m-t-16">
|
||||
¥{{ data.timeLimitPrice }}
|
||||
¥{{ limitPrice }}
|
||||
</view>
|
||||
<view class="u-m-t-16 old-price"> ¥{{ data.lowPrice }} </view>
|
||||
</view>
|
||||
|
|
@ -194,6 +194,7 @@ import { computed, toRef, toRefs, inject, watch } from "vue";
|
|||
import dayjs from "dayjs";
|
||||
import isBetween from "dayjs/plugin/isBetween";
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = inject("shopInfo");
|
||||
dayjs.extend(isBetween);
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
const props = defineProps({
|
||||
|
|
@ -277,6 +278,34 @@ const computedImgStyle = computed(() => {
|
|||
// height: props.img.height
|
||||
// }
|
||||
// }
|
||||
//判断是否是时间折扣商品
|
||||
const is_time_discount = computed(() => {
|
||||
if (!props.limitTimeDiscount || !props.limitTimeDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
const isCanuse = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
props.data,
|
||||
props.limitTimeDiscount,
|
||||
shopInfo,
|
||||
null,
|
||||
"id"
|
||||
);
|
||||
return isCanuse;
|
||||
});
|
||||
|
||||
const limitPrice = computed(() => {
|
||||
if (!is_time_discount.value) {
|
||||
return 0;
|
||||
}
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: props.data,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
});
|
||||
return price;
|
||||
});
|
||||
|
||||
//判断是否是菜品
|
||||
function isGoods() {
|
||||
|
|
|
|||
|
|
@ -29,8 +29,12 @@
|
|||
<view class="u-flex u-p-b-30 u-row-between">
|
||||
<view class="price">
|
||||
<template v-if="goods && goods.isGrounding">
|
||||
<text v-if="goodsData.is_time_discount">¥{{ returnLimitPrice() }}</text>
|
||||
<text :class="{'old-price':goodsData.is_time_discount}">¥{{ to2(goods.salePrice * number) }}</text>
|
||||
<text v-if="is_time_discount"
|
||||
>¥{{ returnLimitPrice() }}</text
|
||||
>
|
||||
<text :class="{ oldPrice: is_time_discount }"
|
||||
>¥{{ goods.salePrice }}</text
|
||||
>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
|
@ -67,7 +71,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch,inject } from "vue";
|
||||
import { computed, reactive, ref, watch, inject } from "vue";
|
||||
import util from "../util.js";
|
||||
import infobox from "@/commons/utils/infoBox.js";
|
||||
import myModel from "@/components/my-components/my-model.vue";
|
||||
|
|
@ -75,14 +79,15 @@ import myButton from "@/components/my-components/my-button.vue";
|
|||
import BigNumber from "bignumber.js";
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
const shopUserInfo = uni.getStorageSync("shopUserInfo");
|
||||
|
||||
const props = defineProps({
|
||||
limitTimeDiscount:{
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
limitTimeDiscount: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
|
|
@ -114,16 +119,33 @@ const props = defineProps({
|
|||
function to2(number) {
|
||||
return Number(number).toFixed(2);
|
||||
}
|
||||
function returnLimitPrice(){
|
||||
const price= yskUtils.limitUtils.returnPrice({
|
||||
|
||||
const is_time_discount = computed(() => {
|
||||
if (!props.limitTimeDiscount || !props.limitTimeDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
const isCanuse = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
goods.value,
|
||||
props.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo,
|
||||
"productId"
|
||||
);
|
||||
console.log('isCanuse');
|
||||
console.log( goods.value);
|
||||
return isCanuse;
|
||||
|
||||
});
|
||||
function returnLimitPrice() {
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: goods.value,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
shopUserInfo: shopUserInfo,
|
||||
idKey: "productId",
|
||||
});
|
||||
|
||||
return BigNumber(price).times(number.value).toNumber()
|
||||
return BigNumber(price).times(number.value).toNumber();
|
||||
}
|
||||
const selSku = computed(() => {
|
||||
return props.skus
|
||||
|
|
@ -228,7 +250,7 @@ function confirm() {
|
|||
if (isDisabled.value) {
|
||||
return;
|
||||
}
|
||||
emits("confirm", goods.value, number.value);
|
||||
emits("confirm", goods.value, number.value,is_time_discount.value);
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
|
@ -275,8 +297,8 @@ defineExpose({
|
|||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.old-price{
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
.oldPrice {
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,185 +1,205 @@
|
|||
<template>
|
||||
<my-model ref="model" borderRadius="12" :title="datas.title">
|
||||
<template #desc>
|
||||
<scroll-view scroll-y="true" style="height: 50vh;" class="u-p-30 guigeModel">
|
||||
<view class="u-m-b-40" v-for="(item,index) in datas.skus" :key="index">
|
||||
<view class="u-text-left">
|
||||
<view class="color-333">{{item.title}} <text
|
||||
style="color:#999">({{item.count}}选{{item.number}})</text> </view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-flex-wrap">
|
||||
<view class="item" @tap="chooseSkd(skd,item)" :class="{active:skd.select==true}"
|
||||
v-for="(skd,skdIndex) in item.goods" :key="skdIndex">
|
||||
{{skd.proName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-30 border-top ">
|
||||
<view class="u-flex u-p-b-30 u-row-between">
|
||||
<view class="price">
|
||||
<text>¥</text>
|
||||
<text>{{datas.price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm">添加</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
<uni-popup ref="popup" type="message">
|
||||
<uni-popup-message type="info" message="请选择套餐" :duration="2000"></uni-popup-message>
|
||||
</uni-popup>
|
||||
<my-model ref="model" borderRadius="12" :title="datas.title">
|
||||
<template #desc>
|
||||
<scroll-view
|
||||
scroll-y="true"
|
||||
style="height: 50vh"
|
||||
class="u-p-30 guigeModel"
|
||||
>
|
||||
<view class="u-m-b-40" v-for="(item, index) in datas.skus" :key="index">
|
||||
<view class="u-text-left">
|
||||
<view class="color-333"
|
||||
>{{ item.title }}
|
||||
<text style="color: #999"
|
||||
>({{ item.count }}选{{ item.number }})</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-flex-wrap">
|
||||
<view
|
||||
class="item"
|
||||
@tap="chooseSkd(skd, item)"
|
||||
:class="{ active: skd.select == true }"
|
||||
v-for="(skd, skdIndex) in item.goods"
|
||||
:key="skdIndex"
|
||||
>
|
||||
{{ skd.proName }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-30 border-top">
|
||||
<view class="u-flex u-p-b-30 u-row-between">
|
||||
<view class="price">
|
||||
<text>¥</text>
|
||||
<text>{{ datas.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm">添加</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
<uni-popup ref="popup" type="message">
|
||||
<uni-popup-message
|
||||
type="info"
|
||||
message="请选择套餐"
|
||||
:duration="2000"
|
||||
></uni-popup-message>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import infobox from '@/commons/utils/infoBox.js'
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
const props = defineProps({
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
})
|
||||
const model = ref(null)
|
||||
const popup = ref()
|
||||
let datas = reactive({
|
||||
item: "",
|
||||
title: "",
|
||||
price: "",
|
||||
skus: [],
|
||||
// 几选几,的和
|
||||
selectNumber: 0,
|
||||
})
|
||||
|
||||
watch(() => props.goodsData, (newval) => {
|
||||
let gArr = JSON.parse(newval.groupSnap)
|
||||
gArr.forEach(ele => {
|
||||
ele.selectData = []
|
||||
})
|
||||
console.log(newval,11);
|
||||
datas.item = newval
|
||||
datas.title = newval.name
|
||||
datas.price = newval.lowPrice
|
||||
datas.skus = gArr
|
||||
})
|
||||
|
||||
const selectNumber = computed(() => {
|
||||
return datas.skus.reduce((prve, cur) => {
|
||||
console.log(prve)
|
||||
return 0 + cur.number
|
||||
}, 0)
|
||||
})
|
||||
|
||||
const emits = defineEmits(['confirm', 'updateSku'])
|
||||
|
||||
function confirm() {
|
||||
// 将数据保存进对应的值
|
||||
let arr = []
|
||||
let arrlength = 0
|
||||
datas.selectNumber = 0
|
||||
datas.skus.map(ele => {
|
||||
let group = {
|
||||
...ele,
|
||||
goods: [],
|
||||
}
|
||||
if(ele.goods&&ele.goods.length>0){
|
||||
ele.goods.map(item=>{
|
||||
if(item.select){
|
||||
group.goods.push(item)
|
||||
arrlength++
|
||||
}
|
||||
})
|
||||
}
|
||||
arr.push(group)
|
||||
datas.selectNumber += ele.number
|
||||
})
|
||||
console.log(arrlength)
|
||||
console.log(datas.selectNumber)
|
||||
if (arrlength == datas.selectNumber) {
|
||||
emits('confirm', arr, datas.item)
|
||||
close()
|
||||
} else {
|
||||
popup.value.open()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐选择处理
|
||||
* @param {Object} skd
|
||||
* @param {Object} item
|
||||
*/
|
||||
function chooseSkd(skd, item) {
|
||||
if (item.selectData.includes(skd.proId)) {
|
||||
skd.select = false
|
||||
let indexs = item.selectData.indexOf(skd.proId)
|
||||
item.selectData.splice(indexs, 1)
|
||||
} else {
|
||||
if (item.selectData.length < item.number) {
|
||||
skd.select = true
|
||||
item.selectData.push(skd.proId)
|
||||
}
|
||||
}
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import infobox from "@/commons/utils/infoBox.js";
|
||||
import myModel from "@/components/my-components/my-model.vue";
|
||||
import myButton from "@/components/my-components/my-button.vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
const props = defineProps({
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
const model = ref(null);
|
||||
const popup = ref();
|
||||
let datas = reactive({
|
||||
item: "",
|
||||
title: "",
|
||||
price: "",
|
||||
skus: [],
|
||||
// 几选几,的和
|
||||
selectNumber: 0,
|
||||
});
|
||||
|
||||
}
|
||||
watch(
|
||||
() => props.goodsData,
|
||||
(newval) => {
|
||||
let gArr = JSON.parse(newval.groupSnap);
|
||||
gArr.forEach((ele) => {
|
||||
ele.selectData = [];
|
||||
});
|
||||
console.log(newval, 11);
|
||||
datas.item = newval;
|
||||
datas.title = newval.name;
|
||||
datas.price = newval.lowPrice;
|
||||
datas.skus = gArr;
|
||||
}
|
||||
);
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
}
|
||||
const selectNumber = computed(() => {
|
||||
return datas.skus.reduce((prve, cur) => {
|
||||
console.log(prve);
|
||||
return 0 + cur.number;
|
||||
}, 0);
|
||||
});
|
||||
|
||||
function close() {
|
||||
datas.selectNumber = 0
|
||||
model.value.close()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
const emits = defineEmits(["confirm", "updateSku"]);
|
||||
|
||||
function confirm() {
|
||||
// 将数据保存进对应的值
|
||||
let arr = [];
|
||||
let arrlength = 0;
|
||||
datas.selectNumber = 0;
|
||||
datas.skus.map((ele) => {
|
||||
let group = {
|
||||
...ele,
|
||||
goods: [],
|
||||
};
|
||||
if (ele.goods && ele.goods.length > 0) {
|
||||
ele.goods.map((item) => {
|
||||
if (item.select) {
|
||||
group.goods.push(item);
|
||||
arrlength++;
|
||||
}
|
||||
});
|
||||
}
|
||||
arr.push(group);
|
||||
datas.selectNumber += ele.number;
|
||||
});
|
||||
console.log(arrlength);
|
||||
console.log(datas.selectNumber);
|
||||
if (arrlength == datas.selectNumber) {
|
||||
emits("confirm", arr, datas.item);
|
||||
close();
|
||||
} else {
|
||||
popup.value.open();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐选择处理
|
||||
* @param {Object} skd
|
||||
* @param {Object} item
|
||||
*/
|
||||
function chooseSkd(skd, item) {
|
||||
if (item.selectData.includes(skd.proId)) {
|
||||
skd.select = false;
|
||||
let indexs = item.selectData.indexOf(skd.proId);
|
||||
item.selectData.splice(indexs, 1);
|
||||
} else {
|
||||
if (item.selectData.length < item.number) {
|
||||
skd.select = true;
|
||||
item.selectData.push(skd.proId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function open() {
|
||||
model.value.open();
|
||||
}
|
||||
|
||||
function close() {
|
||||
datas.selectNumber = 0;
|
||||
model.value.close();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.border-top {}
|
||||
.border-top {
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.guigeModel {
|
||||
.item {
|
||||
color: #666;
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 28rpx;
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
transition: all .2s ease-in-out;
|
||||
.guigeModel {
|
||||
.item {
|
||||
color: #666;
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 28rpx;
|
||||
border: 1px solid #e5e5e5;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: #ccc;
|
||||
border-color: #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.disabled {
|
||||
color: #ccc;
|
||||
border-color: #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
}
|
||||
.price {
|
||||
color: #eb4f4f;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,279 +1,354 @@
|
|||
<template>
|
||||
<view class="">
|
||||
<up-overlay :show="overlayshow" @click="overlayshow = false">
|
||||
<view class="boxoverlay" v-if="form&&form.goods">
|
||||
<view class="rect" @tap.stop>
|
||||
<view class="title">
|
||||
<view> 标题 </view>
|
||||
<view class="" @click="overlayshow = false">
|
||||
<up-icon name="close" color="#93969b" size="20"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inputtop">
|
||||
<view class="dj">
|
||||
<view class="text">单价</view>
|
||||
<view class="jg">¥{{form.goods.lowPrice}}/{{form.goods.unitName}}</view>
|
||||
</view>
|
||||
<view class="inputdj">
|
||||
<view>重量</view>
|
||||
<view class="inputdjbox">
|
||||
<view class="inputdisplay">{{ currentInput }}</view>
|
||||
<text>{{ form.goods.unitName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="keyboard">
|
||||
<button v-for="(num, index) in numberButtons" :key="index" @click="handleClick(num)">
|
||||
{{ num }}
|
||||
</button>
|
||||
<button @click="deleteLast">←</button>
|
||||
</view>
|
||||
<view class="classmoney">
|
||||
¥ {{ (Math.floor((form.goods.lowPrice * currentInput)*100)/100).toFixed(2) }}
|
||||
</view>
|
||||
<view class="classconfirm" @click="clickconfirm"> 确认 </view>
|
||||
</view>
|
||||
</view>
|
||||
</up-overlay>
|
||||
</view>
|
||||
<view class="">
|
||||
<up-overlay :show="overlayshow" @click="overlayshow = false">
|
||||
<view class="boxoverlay" v-if="form && form.goods">
|
||||
<view class="rect" @tap.stop>
|
||||
<view class="title">
|
||||
<view> {{ form.goods.name }} </view>
|
||||
<view class="" @click="overlayshow = false">
|
||||
<up-icon name="close" color="#93969b" size="20"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inputtop">
|
||||
<view class="dj">
|
||||
<view class="text">单价</view>
|
||||
<view class="jg"
|
||||
>¥{{
|
||||
is_time_discount ? returnLimitPrice() : form.goods.lowPrice
|
||||
}}/{{ form.goods.unitName }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="inputdj">
|
||||
<view>重量</view>
|
||||
<view class="inputdjbox">
|
||||
<view class="inputdisplay">{{ currentInput }}</view>
|
||||
<text>{{ form.goods.unitName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="keyboard">
|
||||
<button
|
||||
v-for="(num, index) in numberButtons"
|
||||
:key="index"
|
||||
@click="handleClick(num)"
|
||||
>
|
||||
{{ num }}
|
||||
</button>
|
||||
<button @click="deleteLast">←</button>
|
||||
</view>
|
||||
<view class="classmoney">
|
||||
¥
|
||||
{{ totalMoney }}
|
||||
</view>
|
||||
<view class="classconfirm" @click="clickconfirm"> 确认 </view>
|
||||
</view>
|
||||
</view>
|
||||
</up-overlay>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch, defineExpose, defineEmits } from 'vue';
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const currentInput = ref('');
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||
import { BigNumber } from "bignumber.js";
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
ref,
|
||||
watch,
|
||||
defineExpose,
|
||||
defineEmits,
|
||||
inject,
|
||||
} from "vue";
|
||||
const yskUtils = inject("yskUtils");
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
const shopUserInfo = uni.getStorageSync("shopUserInfo");
|
||||
const emit = defineEmits(["refresh"]);
|
||||
const currentInput = ref("");
|
||||
|
||||
const numberButtons = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'];
|
||||
const numberButtons = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "."];
|
||||
|
||||
const handleClick = (value) => {
|
||||
// 首位不能输入0
|
||||
if (currentInput.value === '') {
|
||||
if (value === '0') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (value === '.' && currentInput.value.indexOf('.') !== -1) {
|
||||
return; // 如果已经存在小数点,不再添加
|
||||
}
|
||||
if (value === '.' && currentInput.value === '') {
|
||||
currentInput.value = '0.';
|
||||
} else {
|
||||
currentInput.value += value;
|
||||
}
|
||||
// 限制小数点后两位
|
||||
const parts = currentInput.value.split('.');
|
||||
if (parts.length > 1 && parts[1].length > 2) {
|
||||
currentInput.value = currentInput.value.slice(0, -1);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteLast = () => {
|
||||
currentInput.value = currentInput.value.slice(0, -1);
|
||||
};
|
||||
const handleClick = (value) => {
|
||||
// 首位不能输入0
|
||||
if (currentInput.value === "") {
|
||||
if (value === "0") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (value === "." && currentInput.value.indexOf(".") !== -1) {
|
||||
return; // 如果已经存在小数点,不再添加
|
||||
}
|
||||
if (value === "." && currentInput.value === "") {
|
||||
currentInput.value = "0.";
|
||||
} else {
|
||||
currentInput.value += value;
|
||||
}
|
||||
// 限制小数点后两位
|
||||
const parts = currentInput.value.split(".");
|
||||
if (parts.length > 1 && parts[1].length > 2) {
|
||||
currentInput.value = currentInput.value.slice(0, -1);
|
||||
}
|
||||
};
|
||||
|
||||
const clickconfirm = () => {
|
||||
// 首位不能输入0
|
||||
if (currentInput.value === '') {
|
||||
uni.showToast({
|
||||
title: '请输入',
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
console.log(currentInput.value,'称重数量')
|
||||
emit('weighgoodsUpdate', form.foodsindex, form.index, true, undefined, currentInput.value)
|
||||
overlayshow.value = false
|
||||
}
|
||||
//显示
|
||||
const overlayshow = ref(false);
|
||||
const form = reactive({})
|
||||
const open = (foodsindex, index, goods) => {
|
||||
console.log("222",goods)
|
||||
currentInput.value = ''
|
||||
Object.assign(form, {
|
||||
foodsindex,
|
||||
index,
|
||||
goods
|
||||
})
|
||||
overlayshow.value = true
|
||||
}
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
const deleteLast = () => {
|
||||
currentInput.value = currentInput.value.slice(0, -1);
|
||||
};
|
||||
|
||||
const clickconfirm = () => {
|
||||
// 首位不能输入0
|
||||
if (currentInput.value === "") {
|
||||
uni.showToast({
|
||||
title: "请输入",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
console.log(currentInput.value, "称重数量");
|
||||
emit(
|
||||
"weighgoodsUpdate",
|
||||
form.foodsindex,
|
||||
form.index,
|
||||
true,
|
||||
undefined,
|
||||
currentInput.value,
|
||||
is_time_discount.value
|
||||
);
|
||||
overlayshow.value = false;
|
||||
};
|
||||
//显示
|
||||
const overlayshow = ref(false);
|
||||
const form = reactive({});
|
||||
const open = (foodsindex, index, goods) => {
|
||||
console.log(goods);
|
||||
currentInput.value = "";
|
||||
Object.assign(form, {
|
||||
foodsindex,
|
||||
index,
|
||||
goods,
|
||||
});
|
||||
overlayshow.value = true;
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
limitTimeDiscount: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const is_time_discount = computed(() => {
|
||||
if (!props.limitTimeDiscount || !props.limitTimeDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
const isCanuse = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
form.goods,
|
||||
props.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo,
|
||||
"id"
|
||||
);
|
||||
console.log("isCanuse");
|
||||
return isCanuse;
|
||||
});
|
||||
function returnLimitPrice() {
|
||||
const price = yskUtils.limitUtils.returnPrice({
|
||||
goods: form.goods,
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: props.limitTimeDiscount,
|
||||
shopUserInfo: shopUserInfo,
|
||||
idKey: "id",
|
||||
});
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
const totalMoney = computed(() => {
|
||||
if(!currentInput.value) return 0
|
||||
if (is_time_discount.value) {
|
||||
return BigNumber(returnLimitPrice())
|
||||
.times(currentInput.value)
|
||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
}
|
||||
return BigNumber(form.goods.lowPrice)
|
||||
.times(currentInput.value)
|
||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
||||
.toNumber();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
page {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.boxoverlay {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
.boxoverlay {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
|
||||
.rect {
|
||||
padding: 32rpx 28rpx;
|
||||
width: 30%;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
.rect {
|
||||
padding: 32rpx 28rpx;
|
||||
width: 30%;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
font-size: 40rpx;
|
||||
border-bottom: 1rpx solid #ccc;
|
||||
}
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
font-size: 40rpx;
|
||||
border-bottom: 1rpx solid #ccc;
|
||||
}
|
||||
|
||||
.inputtop {
|
||||
margin-top: 20rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
.inputtop {
|
||||
margin-top: 20rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.dj {
|
||||
width: 32%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
.dj {
|
||||
width: 32%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
|
||||
.text {
|
||||
font-weight: 300;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.text {
|
||||
font-weight: 300;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.jg {
|
||||
margin-top: 16rpx;
|
||||
background-color: #e8f4ff;
|
||||
color: #1890ff;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #1890ff;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
.jg {
|
||||
margin-top: 16rpx;
|
||||
background-color: #e8f4ff;
|
||||
color: #1890ff;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #1890ff;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.inputdj {
|
||||
width: 66%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
font-weight: 300;
|
||||
font-size: 24rpx;
|
||||
.inputdj {
|
||||
width: 66%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
font-weight: 300;
|
||||
font-size: 24rpx;
|
||||
|
||||
.inputdjbox {
|
||||
margin-top: 16rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: 1rpx solid #ccc;
|
||||
border-radius: 10rpx;
|
||||
padding-left: 20rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fff;
|
||||
.inputdjbox {
|
||||
margin-top: 16rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: 1rpx solid #ccc;
|
||||
border-radius: 10rpx;
|
||||
padding-left: 20rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fff;
|
||||
|
||||
.inputdisplay {
|
||||
width: auto;
|
||||
.inputdisplay {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
}
|
||||
text {
|
||||
border: 1rpx solid #ccc;
|
||||
border-radius: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 20rpx;
|
||||
background: #f5f7fa;
|
||||
color: #a7aaaf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text {
|
||||
border: 1rpx solid #ccc;
|
||||
border-radius: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 20rpx;
|
||||
background: #f5f7fa;
|
||||
color: #a7aaaf;
|
||||
}
|
||||
}
|
||||
.keyboard {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
}
|
||||
}
|
||||
button {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 28%;
|
||||
margin: 10rpx;
|
||||
}
|
||||
|
||||
.keyboard {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
.keyboard-button {
|
||||
width: 28%;
|
||||
margin: 10rpx;
|
||||
border: none;
|
||||
border-radius: 5rpx;
|
||||
box-shadow: 0 0 5rpx rgba(0, 0, 0, 0.3), 0 0 10rpx rgba(0, 0, 0, 0.2);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
button {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 28%;
|
||||
margin: 10rpx;
|
||||
}
|
||||
// .keyboard-button:hover {
|
||||
// box-shadow: 0 0 10rpx rgba(255, 0, 0, 0.5), 0 0 20px rgba(255, 0, 0, 0.3);
|
||||
// transform: translateY(-2rpx);
|
||||
// }
|
||||
|
||||
.keyboard-button {
|
||||
width: 28%;
|
||||
margin: 10rpx;
|
||||
border: none;
|
||||
border-radius: 5rpx;
|
||||
box-shadow: 0 0 5rpx rgba(0, 0, 0, 0.3), 0 0 10rpx rgba(0, 0, 0, 0.2);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.dot-button {
|
||||
// background-color: #FFC107;
|
||||
}
|
||||
|
||||
// .keyboard-button:hover {
|
||||
// box-shadow: 0 0 10rpx rgba(255, 0, 0, 0.5), 0 0 20px rgba(255, 0, 0, 0.3);
|
||||
// transform: translateY(-2rpx);
|
||||
// }
|
||||
.clear-button {
|
||||
// background-color: #FF5733;
|
||||
}
|
||||
|
||||
.dot-button {
|
||||
// background-color: #FFC107;
|
||||
}
|
||||
.clear-button:hover {
|
||||
box-shadow: 0 0 10px rgba(255, 87, 51, 0.5),
|
||||
0 0 20px rgba(255, 87, 51, 0.3);
|
||||
}
|
||||
|
||||
.clear-button {
|
||||
// background-color: #FF5733;
|
||||
}
|
||||
.delete-button {
|
||||
// background-color: #33FF57;
|
||||
}
|
||||
|
||||
.clear-button:hover {
|
||||
box-shadow: 0 0 10px rgba(255, 87, 51, 0.5), 0 0 20px rgba(255, 87, 51, 0.3);
|
||||
}
|
||||
.delete-button:hover {
|
||||
// box-shadow: 0 0 10px rgba(51, 255, 87, 0.5), 0 0 20px rgba(51, 255, 87, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.delete-button {
|
||||
// background-color: #33FF57;
|
||||
}
|
||||
.classmoney {
|
||||
margin-top: 16rpx;
|
||||
width: 100%;
|
||||
font-size: 40rpx;
|
||||
text-align: left;
|
||||
color: #ff5152;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.delete-button:hover {
|
||||
// box-shadow: 0 0 10px rgba(51, 255, 87, 0.5), 0 0 20px rgba(51, 255, 87, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.classmoney {
|
||||
margin-top: 16rpx;
|
||||
width: 100%;
|
||||
font-size: 40rpx;
|
||||
text-align: left;
|
||||
color: #ff5152;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.classconfirm {
|
||||
width: 100%;
|
||||
margin: 30rpx auto 0 auto;
|
||||
border-radius: 16rpx;
|
||||
text-align: center;
|
||||
background: #1890ff;
|
||||
color: #fff;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.classconfirm {
|
||||
width: 100%;
|
||||
margin: 30rpx auto 0 auto;
|
||||
border-radius: 16rpx;
|
||||
text-align: center;
|
||||
background: #1890ff;
|
||||
color: #fff;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -273,7 +273,11 @@
|
|||
<!-- 登录弹窗 -->
|
||||
<my-login v-model="modal.login" @loginSuccess="loginSuccess"></my-login>
|
||||
<!-- 称重 -->
|
||||
<weigh-item ref="refweighitem" @weighgoodsUpdate="goodsUpdate"></weigh-item>
|
||||
<weigh-item
|
||||
ref="refweighitem"
|
||||
@weighgoodsUpdate="goodsUpdate"
|
||||
:limitTimeDiscount="data.limitTimeDiscount"
|
||||
></weigh-item>
|
||||
<up-modal
|
||||
title="提示"
|
||||
content="该台桌购物车里有商品,是否清除该台桌里的商品?"
|
||||
|
|
@ -484,7 +488,7 @@ function onMessage() {
|
|||
);
|
||||
}
|
||||
|
||||
if (msg.status == 0&&msg.type!='time_discount') {
|
||||
if (msg.status == 0 && msg.type != "time_discount") {
|
||||
infoBox.showToast(msg.msg || "添加失败");
|
||||
data.isGoodsAdd = true;
|
||||
// 如果是商品库存不足起售数量
|
||||
|
|
@ -506,6 +510,7 @@ function onMessage() {
|
|||
if (!data.table.tableCode) {
|
||||
data.table.tableCode = msg.table_code;
|
||||
uni.setStorageSync("msg_id", msg.msg_id);
|
||||
data.limitTimeDiscount = limitTimeDiscountRes.value;
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "shopping",
|
||||
|
|
@ -596,6 +601,9 @@ function delCart(id) {
|
|||
* 获取订单详情
|
||||
*/
|
||||
async function getHistoryOrderDetail() {
|
||||
if(shopInfo.registerType=='before'){
|
||||
return
|
||||
}
|
||||
data.historyOrder = [];
|
||||
let res = await getHistoryOrder({
|
||||
tableCode: data.table.tableCode,
|
||||
|
|
@ -684,11 +692,11 @@ function cartControls(cartItem, type) {
|
|||
}
|
||||
if (type == "add") {
|
||||
cars.push(cartItem);
|
||||
if ($goods){
|
||||
$goods.chooseNumber = cartItem.number;
|
||||
console.log('$goods',$goods)
|
||||
console.log('cartItem',cartItem)
|
||||
}
|
||||
if ($goods) {
|
||||
$goods.chooseNumber = cartItem.number;
|
||||
console.log("$goods", $goods);
|
||||
console.log("cartItem", cartItem);
|
||||
}
|
||||
}
|
||||
if (type == "edit") {
|
||||
editItem.value = $goods;
|
||||
|
|
@ -1014,11 +1022,18 @@ function setTabsCurrentPosition(position = "center") {
|
|||
tabsEle.scrollWidth / 2 +
|
||||
tabsEle.tabsItems[index].width / 2;
|
||||
}
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
|
||||
provide("shopInfo", shopInfo);
|
||||
/**
|
||||
* 获取商品列表
|
||||
* @param max
|
||||
* @param isGetPrve
|
||||
*/
|
||||
async function getGoodsData(max = 6, isGetPrve = false) {
|
||||
const fuhao = !isGetPrve ? 1 : -1;
|
||||
for (let i = 0; i < max; i++) {
|
||||
if (layoutData.current + i >= layoutData.list.length - 1) {
|
||||
if (layoutData.current + i > layoutData.list.length - 1) {
|
||||
break;
|
||||
} else {
|
||||
const pageData = layoutData.list[layoutData.current + i * fuhao];
|
||||
|
|
@ -1033,25 +1048,7 @@ async function getGoodsData(max = 6, isGetPrve = false) {
|
|||
? layoutArr[res2.data.productList.length]
|
||||
: "6-grid",
|
||||
productList: res2.data.productList.map((v) => {
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
v.is_time_discount = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
{ ...v, salePrice: v.lowPrice },
|
||||
data.limitTimeDiscount,
|
||||
shopInfo,
|
||||
null,
|
||||
"id"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
if (v.is_time_discount) {
|
||||
v.timeLimitPrice = yskUtils.limitUtils.returnPrice({
|
||||
goods: { ...v, salePrice: v.lowPrice },
|
||||
shopInfo: shopInfo,
|
||||
limitTimeDiscountRes: data.limitTimeDiscount,
|
||||
shopUserInfo: null,
|
||||
idKey: "id",
|
||||
});
|
||||
}
|
||||
v.salePrice = v.lowPrice;
|
||||
const findGoodsInCar = cars.find((cars) => {
|
||||
return cars.productId == v.id;
|
||||
});
|
||||
|
|
@ -1086,14 +1083,18 @@ function animationStart(e) {
|
|||
}
|
||||
async function animationfinish(e) {
|
||||
if (isScrollChangeCategorySel) {
|
||||
layoutData.current = e.detail.current;
|
||||
const categoryId = layoutData.list[layoutData.current].productCategoryId
|
||||
? layoutData.list[layoutData.current].productCategoryId
|
||||
: layoutData.list[layoutData.current].productList[0].categoryId;
|
||||
const index = layoutData.category.list.findIndex((v) => v.id == categoryId);
|
||||
isScrollChangeCategorySel = true;
|
||||
layoutData.category.sel = index;
|
||||
await getLayoutGoodsInit();
|
||||
try {
|
||||
layoutData.current = e.detail.current;
|
||||
const categoryId = layoutData.list[layoutData.current].productCategoryId
|
||||
? layoutData.list[layoutData.current].productCategoryId
|
||||
: layoutData.list[layoutData.current].productList[0].categoryId;
|
||||
const index = layoutData.category.list.findIndex(
|
||||
(v) => v.id == categoryId
|
||||
);
|
||||
isScrollChangeCategorySel = true;
|
||||
layoutData.category.sel = index;
|
||||
await getLayoutGoodsInit();
|
||||
} catch (error) {}
|
||||
}
|
||||
isScrollChangeCategorySel = false;
|
||||
isTapChangeCategorySel = false;
|
||||
|
|
@ -1104,6 +1105,21 @@ async function animationfinish(e) {
|
|||
* @param {Object} item
|
||||
*/
|
||||
async function taocanConfirm(d, item) {
|
||||
const is_time_discount = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
{
|
||||
...item,
|
||||
salePrice: item.lowPrice,
|
||||
memberPrice: item.memberPrice
|
||||
? item.memberPrice
|
||||
: item.skuList[0].memberPrice,
|
||||
},
|
||||
data.limitTimeDiscount,
|
||||
shopInfo,
|
||||
null,
|
||||
"id"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
editCart(
|
||||
{
|
||||
number: item.skuList[0].suitNum,
|
||||
|
|
@ -1112,6 +1128,7 @@ async function taocanConfirm(d, item) {
|
|||
sku_id: item.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(d),
|
||||
is_temporary: 0, //是否是临时菜
|
||||
is_time_discount,
|
||||
},
|
||||
"add"
|
||||
);
|
||||
|
|
@ -1529,6 +1546,7 @@ function setTagDisabled() {
|
|||
|
||||
console.log(selArr);
|
||||
let selArrAllGroup = util.generateCombinations(selArr, selArr.length - 1);
|
||||
console.log("selArrAllGroup");
|
||||
console.log(selArrAllGroup);
|
||||
const matchArr = [];
|
||||
for (let key in skuMap) {
|
||||
|
|
@ -1551,6 +1569,7 @@ function setTagDisabled() {
|
|||
return;
|
||||
}
|
||||
const includeSkuMap = matchArr.reduce((prve, cur) => {
|
||||
console.log("cur.specSnap", cur);
|
||||
const speArr = cur.specSnap.split(",");
|
||||
for (let i of speArr) {
|
||||
if (!prve.hasOwnProperty("i")) {
|
||||
|
|
@ -1593,7 +1612,7 @@ function chooseGuige(foodsindex, index) {
|
|||
}
|
||||
}
|
||||
|
||||
async function guigeConfirm(sku, suitNum) {
|
||||
async function guigeConfirm(sku, number, is_time_discount) {
|
||||
if (!data.isGoodsAdd) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1602,6 +1621,7 @@ async function guigeConfirm(sku, suitNum) {
|
|||
let product_id = goods.id;
|
||||
let product_type = goods.type;
|
||||
let res = findGoodsInCar(goods, sku_id);
|
||||
|
||||
if (res) {
|
||||
//更新
|
||||
let { index } = res;
|
||||
|
|
@ -1617,7 +1637,7 @@ async function guigeConfirm(sku, suitNum) {
|
|||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
is_temporary: carGoods.is_temporary, //是否是临时菜
|
||||
is_time_discount: goods.is_time_discount,
|
||||
is_time_discount,
|
||||
},
|
||||
"edit"
|
||||
);
|
||||
|
|
@ -1626,12 +1646,12 @@ async function guigeConfirm(sku, suitNum) {
|
|||
//添加
|
||||
editCart(
|
||||
{
|
||||
number: suitNum,
|
||||
number: number,
|
||||
product_id: product_id,
|
||||
product_type: product_type,
|
||||
sku_id: sku_id,
|
||||
is_temporary: 0, //是否是临时菜
|
||||
is_time_discount: goods.is_time_discount,
|
||||
is_time_discount,
|
||||
},
|
||||
"add"
|
||||
);
|
||||
|
|
@ -1748,13 +1768,27 @@ async function goodsUpdate(
|
|||
index,
|
||||
isAdd,
|
||||
searchGoodsIndex,
|
||||
showCurrentInput
|
||||
showCurrentInput,
|
||||
is_time_discount
|
||||
) {
|
||||
console.log(foodsindex, index, isAdd, searchGoodsIndex, "11111");
|
||||
if (!data.isGoodsAdd) {
|
||||
return;
|
||||
}
|
||||
const $goods = layoutData.list[foodsindex].productList[index];
|
||||
console.log($goods);
|
||||
if (is_time_discount === undefined) {
|
||||
is_time_discount = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
{ ...$goods, salePrice: $goods.lowPrice },
|
||||
data.limitTimeDiscount,
|
||||
shopInfo,
|
||||
null,
|
||||
"id"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
if ($goods.type != "sku") {
|
||||
const step = isAdd ? 1 : -1;
|
||||
//增加
|
||||
|
|
@ -1763,7 +1797,7 @@ async function goodsUpdate(
|
|||
let { sku_id, product_id, id, number, discount_sale_amount } = isShop;
|
||||
// 数量加减
|
||||
let num = number + step;
|
||||
if (num == 0 ||num<$goods.skuList[0].suitNum) {
|
||||
if (num == 0 || num < $goods.skuList[0].suitNum) {
|
||||
let params = {
|
||||
...data.socketData,
|
||||
id: id,
|
||||
|
|
@ -1782,6 +1816,7 @@ async function goodsUpdate(
|
|||
let cartItem = cars[goodsInCarIndex];
|
||||
num = cartItem.number * 1 + Number(showCurrentInput);
|
||||
}
|
||||
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
...data.socketData,
|
||||
|
|
@ -1796,9 +1831,10 @@ async function goodsUpdate(
|
|||
operate_type: "edit",
|
||||
pack_number: 0, //数量
|
||||
is_temporary: 0, //是否是临时菜
|
||||
is_time_discount: $goods.is_time_discount,
|
||||
is_time_discount,
|
||||
})
|
||||
);
|
||||
|
||||
// $goods.chooseNumber = 1
|
||||
$goods.chooseNumber = num;
|
||||
}
|
||||
|
|
@ -1811,6 +1847,7 @@ async function goodsUpdate(
|
|||
if (showCurrentInput) {
|
||||
weightNum = Number(showCurrentInput);
|
||||
}
|
||||
|
||||
let params = {
|
||||
...data.socketData,
|
||||
table_code: data.table.tableCode,
|
||||
|
|
@ -1820,11 +1857,12 @@ async function goodsUpdate(
|
|||
sku_name: "", // 临时菜规格
|
||||
number: weightNum,
|
||||
// discount_sale_amount: $goods.lowPrice,
|
||||
discount_sale_amount:0,
|
||||
discount_sale_amount: 0,
|
||||
pack_number: 0, //数量
|
||||
is_temporary: 0, //是否是临时菜
|
||||
is_time_discount: $goods.is_time_discount,
|
||||
is_time_discount,
|
||||
};
|
||||
console.log(params, "发送消息");
|
||||
websocketUtil.send(JSON.stringify(params));
|
||||
// $goods.chooseNumber = 1
|
||||
}
|
||||
|
|
@ -1912,7 +1950,7 @@ onShow(() => {
|
|||
title: "购物车加载中",
|
||||
mask: true,
|
||||
});
|
||||
layoutData.current = 0;
|
||||
// layoutData.current = 0;
|
||||
watchChooseTable();
|
||||
watchUpdate();
|
||||
watchSocketOpen();
|
||||
|
|
@ -1931,11 +1969,13 @@ let sysInfo = ref({
|
|||
windowWidth: 0,
|
||||
windowHeight: 0,
|
||||
});
|
||||
console.log(yskUtils);
|
||||
const limitTimeDiscountRes = ref(null);
|
||||
async function getLimit() {
|
||||
const res = await limitTimeDiscountApi.limitTimeDiscount();
|
||||
data.limitTimeDiscount = res.data;
|
||||
limitTimeDiscountRes.value = res.data;
|
||||
if (data.table.tableCode) {
|
||||
data.limitTimeDiscount = limitTimeDiscountRes.value;
|
||||
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "shopping",
|
||||
|
|
@ -1943,7 +1983,7 @@ async function getLimit() {
|
|||
table_code: data.table.tableCode,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "time_discount_save",
|
||||
data: data.limitTimeDiscount,
|
||||
data: limitTimeDiscountRes.value,
|
||||
})
|
||||
);
|
||||
console.log("limitTimeDiscount", data.limitTimeDiscount);
|
||||
|
|
@ -1962,6 +2002,8 @@ onLoad(async (opt) => {
|
|||
isCreateOrderToDetail.value = true;
|
||||
}
|
||||
|
||||
websocketUtil.initializeWebSocket();
|
||||
|
||||
xiadanClick();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1982,6 +2024,7 @@ onLoad(async (opt) => {
|
|||
min-height: 40px;
|
||||
padding-top: calc(var(--status-bar-height));
|
||||
padding-bottom: 6px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.top {
|
||||
|
|
|
|||
|
|
@ -12,16 +12,12 @@ export function getNowCart(carItem,goodsList,user) {
|
|||
goodsList.map(goodsItem => {
|
||||
if(carItem.product_id == goodsItem.id){
|
||||
goodsItem.skuList.map(item=>{
|
||||
if(carItem.product_id == item.productId){
|
||||
if(carItem.product_id == item.productId&&item.id==carItem.sku_id){
|
||||
carItem.lowPrice = item.salePrice
|
||||
carItem.lowMemberPrice = item.memberPrice
|
||||
carItem.memberPrice = item.memberPrice
|
||||
carItem.specInfo = item.specInfo
|
||||
|
||||
if( uni.getStorageSync('shopInfo').isMemberPrice && user && user.id && user.isVip ){
|
||||
carItem.salePrice = item.memberPrice
|
||||
} else {
|
||||
carItem.salePrice = item.salePrice
|
||||
}
|
||||
carItem.salePrice = item.salePrice
|
||||
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||
<view @click="discountShow">修改</view>
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||
<view class="u-m-t-10 u-flex u-row-center color-main u-m-t-24">
|
||||
<view @click="chooseUser()">选择用户</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -58,13 +58,16 @@
|
|||
</view>
|
||||
<view
|
||||
class="border-bottom-dashed u-p-b-30 u-p-t-30"
|
||||
v-if="discountSaleAmount * 1 > 0"
|
||||
v-if="orderCostSummary.fullReduction.actualAmount&&orderCostSummary.fullReduction.usedThreshold"
|
||||
>
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between">
|
||||
<view>单品打折优惠</view>
|
||||
<view class="color-red"> -¥{{ discountSaleAmount }} </view>
|
||||
<view>满减活动</view>
|
||||
<view class="color-red">
|
||||
-¥{{ orderCostSummary.fullReduction.actualAmount }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="border-bottom-dashed u-p-b-30 u-p-t-30">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between" @click="toQuan">
|
||||
|
|
@ -312,6 +315,7 @@
|
|||
import {
|
||||
reactive,
|
||||
onMounted,
|
||||
nextTick,
|
||||
watch,
|
||||
ref,
|
||||
onBeforeUnmount,
|
||||
|
|
@ -338,6 +342,8 @@ import { getDiscountByUserId } from "@/http/yskApi/market/consumeDiscount.js";
|
|||
import { getHistoryOrder } from "@/http/api/order.js";
|
||||
import { getPayTypeList } from "@/http/api/payType.js";
|
||||
import { shopUserDetail } from "@/http/api/shopUser.js";
|
||||
import { discountActivity } from "@/http/yskApi/market/discountActivity.js";
|
||||
|
||||
import {
|
||||
scanPay,
|
||||
microPay,
|
||||
|
|
@ -353,6 +359,7 @@ import {
|
|||
payedDeductPoints,
|
||||
consumeAwardPoints,
|
||||
} from "@/http/api/points.js";
|
||||
|
||||
import yskUtils from "ysk-utils";
|
||||
|
||||
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
|
||||
|
|
@ -380,8 +387,7 @@ const pageData = reactive({
|
|||
const order = reactive({
|
||||
orderAmount: 0,
|
||||
});
|
||||
//商品数量从0到n每一个对应的价格
|
||||
let $goodsPayPriceMap = {};
|
||||
|
||||
const pays = reactive({
|
||||
list: ["扫码收款", "二维码收款"],
|
||||
selIndex: 0,
|
||||
|
|
@ -420,10 +426,20 @@ onShow(() => {
|
|||
watchChooseQuan();
|
||||
});
|
||||
const options = reactive({});
|
||||
async function getDiscountActivity() {
|
||||
let res = await discountActivity({
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
});
|
||||
if (res.code == 200) {
|
||||
fullReductionActivities.value = res.data?[res.data]:[];
|
||||
}
|
||||
}
|
||||
onLoad(async (opt) => {
|
||||
Object.assign(order, opt);
|
||||
Object.assign(options, opt);
|
||||
getPayType();
|
||||
await getPayType();
|
||||
await getDiscountActivity()
|
||||
console.log("pays.payTypes.list");
|
||||
init();
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
|
|
@ -445,6 +461,9 @@ function toDiancai() {
|
|||
* 初始化
|
||||
*/
|
||||
async function init() {
|
||||
nextTick(() => {
|
||||
onMessage();
|
||||
});
|
||||
// 获取订单详情
|
||||
const { data: orderRes } = await getHistoryOrder({ orderId: order.orderId });
|
||||
if (orderRes.status == "cancelled") {
|
||||
|
|
@ -466,11 +485,10 @@ async function init() {
|
|||
Object.assign(order, orderRes);
|
||||
pageData.goodsList = objToArrary(orderRes.detailMap);
|
||||
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(pageData.goodsList);
|
||||
|
||||
// console.log("order===",order)
|
||||
// console.log("pageData.user===",pageData.user)
|
||||
// 获取用户信息
|
||||
|
||||
if (order.userId || pageData.user.userId) {
|
||||
shopUserDetail({
|
||||
userId: order.userId || pageData.user.userId,
|
||||
|
|
@ -549,42 +567,7 @@ const originPrice = computed(() => {
|
|||
}
|
||||
});
|
||||
|
||||
const newOriginPrice = computed(() => {
|
||||
if (pageData.goodsList) {
|
||||
let goodsPrice = pageData.goodsList
|
||||
.filter((v) => v.price != 0 && v.status !== "return")
|
||||
.reduce((a, b) => {
|
||||
let memberPrice = b.memberPrice ? b.memberPrice : b.price;
|
||||
let tPrice = isVip.value ? memberPrice : b.price;
|
||||
tPrice = b.discountSaleAmount ? b.discountSaleAmount : tPrice;
|
||||
return (
|
||||
a +
|
||||
parseFloat(
|
||||
mathFloorPrice(b.num * tPrice, b) * 1 -
|
||||
mathFloorPrice(b.returnNum * tPrice, b) * 1 -
|
||||
mathFloorPrice(b.refundNum * tPrice, b) * 1
|
||||
)
|
||||
);
|
||||
}, 0);
|
||||
// console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 菜品折扣金额
|
||||
*/
|
||||
const discountSaleAmount = computed(() => {
|
||||
if (pageData.goodsList) {
|
||||
let price = pageData.goodsList
|
||||
.filter((v) => v.discountSaleAmount > 0 && v.status !== "return")
|
||||
.reduce((a, b) => {
|
||||
return a + (b.num * b.price - b.num * b.discountSaleAmount);
|
||||
}, 0);
|
||||
// console.log("单品折扣金额====",price)
|
||||
return price.toFixed(2);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -756,6 +739,9 @@ watch(
|
|||
v.disabled = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -797,14 +783,14 @@ function getPayParam() {
|
|||
newCustomerDiscountAmount: orderCostSummary.value.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId:
|
||||
orderCostSummary.value.newUserDiscount > 0
|
||||
? cartStore.consumeDiscount.id
|
||||
? newUserDiscountRes.value.id
|
||||
: "",
|
||||
|
||||
discountActAmount: orderCostSummary.value.fullReduction.actualAmount, //满减抵扣金额
|
||||
discountActId: orderCostSummary.value.fullReduction.usedActivity
|
||||
discountActId: (orderCostSummary.value.fullReduction.usedActivity&&orderCostSummary.value.fullReduction.usedThreshold)
|
||||
? orderCostSummary.value.fullReduction.usedActivity.id
|
||||
: null,
|
||||
vipPrice: orderCostSummary.value.vipDiscountAmount != 0 ? 1 : 0, // 是否使用会员价
|
||||
vipPrice:isVip.value? 1 : 0, // 是否使用会员价
|
||||
limitRate:
|
||||
order.limitRate && order.limitRate.id
|
||||
? {
|
||||
|
|
@ -840,7 +826,6 @@ function getPayUrl() {
|
|||
if (order.userId || pageData.user.userId) {
|
||||
params.userId = order.userId || pageData.user.userId;
|
||||
}
|
||||
delete params.limitRate;
|
||||
getOrderPayUrl(params).then((res) => {
|
||||
console.log(res, "tishi");
|
||||
payCodeUrl.value = res.data;
|
||||
|
|
@ -854,11 +839,20 @@ function getPayUrl() {
|
|||
async function getPayType() {
|
||||
const payTypeList = await getPayTypeList();
|
||||
pays.payTypes.list = [];
|
||||
const arr = ["cash", "member-account"];
|
||||
payTypeList.data.map((v) => {
|
||||
if (v.payType != "bank") {
|
||||
let disabled = false;
|
||||
if (orderCostSummary.value.finalPayAmount <= 0) {
|
||||
if (arr.includes(v.payType)) {
|
||||
disabled = false;
|
||||
} else {
|
||||
disabled = true;
|
||||
}
|
||||
}
|
||||
pays.payTypes.list.push({
|
||||
...v,
|
||||
disabled: false,
|
||||
disabled
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -927,6 +921,9 @@ function changeAccountPoints() {
|
|||
function toQuan() {
|
||||
console.log("toQuan", order);
|
||||
console.log("pageData.user", pageData.user);
|
||||
if(orderCostSummary.value.usedActivity){
|
||||
return infoBox.showToast("满减活动不可与优惠券同享")
|
||||
}
|
||||
if (!order.userId && !pageData.user.id) {
|
||||
return infoBox.showToast("请先选择会员", 0.5).then(() => {
|
||||
chooseUser();
|
||||
|
|
@ -993,19 +990,80 @@ function chooseUser() {
|
|||
function watchChooseuser() {
|
||||
uni.$off("choose-user");
|
||||
uni.$on("choose-user", (data) => {
|
||||
if (pageData.user.id != data.id) {
|
||||
selCoupon.value = [];
|
||||
accountPoints.sel = false;
|
||||
}
|
||||
pageData.user = data;
|
||||
if (data.id) {
|
||||
getNewUserDiscount();
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => pageData.user.id,
|
||||
(newval) => {
|
||||
selCoupon.value = [];
|
||||
accountPoints.sel = false;
|
||||
// 更新购物车和历史订单数据
|
||||
uodateCartAndHistory();
|
||||
if (newval) {
|
||||
getNewUserDiscount();
|
||||
// getShopUserDetail();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 更新购物车和历史订单数据
|
||||
*/
|
||||
function uodateCartAndHistory() {
|
||||
let newData = {
|
||||
history: [],
|
||||
cart: [],
|
||||
};
|
||||
console.log("uodateCartAndHistory", pageData.user);
|
||||
for (let cart of pageData.goodsList) {
|
||||
const canUseLimitTimeDiscount = yskUtils.limitUtils.canUseLimitTimeDiscount(
|
||||
cart,
|
||||
order.limitRate,
|
||||
pageData.shopInfo,
|
||||
pageData.user,
|
||||
"productId"
|
||||
)
|
||||
? 1
|
||||
: 0;
|
||||
console.log("uodateCartAndHistory", pageData.user);
|
||||
if (canUseLimitTimeDiscount != cart.is_time_discount) {
|
||||
newData.cart.push({
|
||||
id: cart.id,
|
||||
is_time_discount: canUseLimitTimeDiscount,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (newData.history.length <= 0 && newData.cart.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "pad",
|
||||
account: uni.getStorageSync("shopInfo").id,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "bulk_edit",
|
||||
table_code: order.takeCode,
|
||||
data: newData,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function getShopUserDetail() {
|
||||
shopUserDetail({
|
||||
// shopId: uni.getStorageSync("shopInfo").id,
|
||||
id: pageData.user.id,
|
||||
}).then((res) => {
|
||||
if (res.data) {
|
||||
pageData.user = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const newUserDiscountRes=ref(null)
|
||||
//获取用户新客立减
|
||||
function getNewUserDiscount() {
|
||||
getDiscountByUserId({
|
||||
|
|
@ -1013,6 +1071,7 @@ function getNewUserDiscount() {
|
|||
}).then((res) => {
|
||||
if (res.data) {
|
||||
newUserDiscount.value = res.data.amount || 0;
|
||||
newUserDiscountRes.value = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1298,6 +1357,64 @@ function cashConfirmShow() {
|
|||
modal.key = "cash";
|
||||
modal.show = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取历史订单并更新商品列表
|
||||
*/
|
||||
async function getHistoryAndUpdateGoodsList() {
|
||||
// 获取订单详情
|
||||
const { data: orderRes } = await getHistoryOrder({ orderId: order.orderId });
|
||||
if (orderRes.status == "cancelled") {
|
||||
uni.showToast({
|
||||
title: "订单已取消",
|
||||
icon: "none",
|
||||
});
|
||||
toDiancai();
|
||||
return;
|
||||
}
|
||||
if (orderRes.status == "done") {
|
||||
uni.showToast({
|
||||
title: "订单已完成",
|
||||
icon: "none",
|
||||
});
|
||||
toDiancai();
|
||||
return;
|
||||
}
|
||||
Object.assign(order, orderRes);
|
||||
pageData.goodsList = objToArrary(orderRes.detailMap);
|
||||
pageData.seatNum = order.seatNum;
|
||||
}
|
||||
/**
|
||||
* socket消息监听
|
||||
*/
|
||||
function onMessage() {
|
||||
websocketUtil.offMessage();
|
||||
websocketUtil.onMessage((res) => {
|
||||
let msg = JSON.parse(res);
|
||||
|
||||
switch (msg.operate_type) {
|
||||
case "pad_init":
|
||||
getHistoryAndUpdateGoodsList();
|
||||
break;
|
||||
case "pad_add":
|
||||
case "add":
|
||||
break;
|
||||
case "pad_edit":
|
||||
case "edit":
|
||||
break;
|
||||
case "pad_del":
|
||||
case "del":
|
||||
break;
|
||||
case "pad_cleanup":
|
||||
case "cleanup":
|
||||
break;
|
||||
case "product_update":
|
||||
break;
|
||||
case "pad_batch":
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@
|
|||
</view>
|
||||
<view class="u-flex u-font-24"> 满{{ item.fullAmount }}可用 </view>
|
||||
<view class="u-flex">
|
||||
<view class="use-btn" @click.stop="toEmitChooseQuan(item)"
|
||||
<!-- <view class="use-btn" @click.stop="toEmitChooseQuan(item)"
|
||||
>去使用</view
|
||||
>
|
||||
> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -112,9 +112,9 @@
|
|||
</view>
|
||||
<view class="u-flex u-font-24"> 满{{ item.fullAmount }}可用 </view>
|
||||
<view class="u-flex">
|
||||
<view class="use-btn" @click.stop="toEmitChooseQuan(item)"
|
||||
<!-- <view class="use-btn" @click.stop="toEmitChooseQuan(item)"
|
||||
>去使用</view
|
||||
>
|
||||
> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -173,7 +173,6 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, reactive, watch, computed, onMounted, toRaw } from "vue";
|
||||
import couponUtils from "./coupon";
|
||||
import color from "@/commons/color.js";
|
||||
import dayjs from "dayjs";
|
||||
import { getSafeBottomHeight } from "@/commons/utils/safe-bottom.js";
|
||||
|
|
@ -193,8 +192,12 @@ import { queryAllShopUser, shopUserDetail } from "@/http/yskApi/shop-user.js";
|
|||
// const yskUtils = {
|
||||
// couponUtils,
|
||||
// };
|
||||
import yskUtils from "ysk-utils";
|
||||
|
||||
// import yskUtils from "ysk-utils";
|
||||
import {couponUtils} from "@/lib/index";
|
||||
const yskUtils={
|
||||
couponUtils
|
||||
}
|
||||
|
||||
const modal = reactive({
|
||||
title: "提示",
|
||||
|
|
@ -458,6 +461,7 @@ async function getQuan() {
|
|||
const orderRes = await orderApi.tbOrderInfoDetail(option.orderId);
|
||||
if (orderRes.code == 200) {
|
||||
order.value = orderRes.data;
|
||||
Object.assign(limitTimeDiscount,orderRes.data.limitRate)
|
||||
}
|
||||
|
||||
console.log(order.value);
|
||||
|
|
@ -528,6 +532,7 @@ watch(
|
|||
user,
|
||||
shopInfo
|
||||
);
|
||||
console.log('canDikouGoodsArr');
|
||||
console.log(canDikouGoodsArr);
|
||||
|
||||
let goodsCoupon = newval.filter((v) => v.type == 2);
|
||||
|
|
@ -757,6 +762,7 @@ $quan-color: #318afe;
|
|||
flex-direction: column;
|
||||
background-color: $quan-color;
|
||||
height: 100%;
|
||||
min-width: 180rpx;
|
||||
}
|
||||
|
||||
&.goods {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ importers:
|
|||
specifier: ^3.3.32
|
||||
version: 3.6.10
|
||||
ysk-utils:
|
||||
specifier: ^1.0.58
|
||||
version: 1.0.58
|
||||
specifier: ^1.0.70
|
||||
version: 1.0.70
|
||||
devDependencies:
|
||||
copy-webpack-plugin:
|
||||
specifier: ^12.0.2
|
||||
|
|
@ -269,8 +269,8 @@ packages:
|
|||
base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
baseline-browser-mapping@2.8.26:
|
||||
resolution: {integrity: sha512-73lC1ugzwoaWCLJ1LvOgrR5xsMLTqSKIEoMHVtL9E/HNk0PXtTM76ZIm84856/SF7Nv8mPZxKoBsgpm0tR1u1Q==}
|
||||
baseline-browser-mapping@2.8.28:
|
||||
resolution: {integrity: sha512-gYjt7OIqdM0PcttNYP2aVrr2G0bMALkBaoehD4BuRGjAOtipg0b6wHg1yNL+s5zSnLZZrGHOw4IrND8CD+3oIQ==}
|
||||
hasBin: true
|
||||
|
||||
big.js@5.2.2:
|
||||
|
|
@ -328,8 +328,8 @@ packages:
|
|||
engines: {node: '>=0.10'}
|
||||
hasBin: true
|
||||
|
||||
electron-to-chromium@1.5.250:
|
||||
resolution: {integrity: sha512-/5UMj9IiGDMOFBnN4i7/Ry5onJrAGSbOGo3s9FEKmwobGq6xw832ccET0CE3CkkMBZ8GJSlUIesZofpyurqDXw==}
|
||||
electron-to-chromium@1.5.252:
|
||||
resolution: {integrity: sha512-53uTpjtRgS7gjIxZ4qCgFdNO2q+wJt/Z8+xAvxbCqXPJrY6h7ighUkadQmNMXH96crtpa6gPFNP7BF4UBGDuaA==}
|
||||
|
||||
emojis-list@3.0.0:
|
||||
resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==}
|
||||
|
|
@ -688,8 +688,8 @@ packages:
|
|||
webpack-cli:
|
||||
optional: true
|
||||
|
||||
ysk-utils@1.0.58:
|
||||
resolution: {integrity: sha512-hpu7QlcIn0lo0WAWjgjPAhEpCD0NQjVT0Xx0enJ6vytJt5ISKvTNO52xKWDPWs2VsW3PVIamMKJbbxX8VZ1QTA==}
|
||||
ysk-utils@1.0.70:
|
||||
resolution: {integrity: sha512-fCro0XPI3m94vUWufCxaBR4hEdc6ucqGSmH45jSvIUuhrME8Aa0YwtsUrGtr4WjP2n3mdzz+ip861ghmtP+ScQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
|
|
@ -920,7 +920,7 @@ snapshots:
|
|||
|
||||
base64-js@1.5.1: {}
|
||||
|
||||
baseline-browser-mapping@2.8.26: {}
|
||||
baseline-browser-mapping@2.8.28: {}
|
||||
|
||||
big.js@5.2.2: {}
|
||||
|
||||
|
|
@ -932,9 +932,9 @@ snapshots:
|
|||
|
||||
browserslist@4.28.0:
|
||||
dependencies:
|
||||
baseline-browser-mapping: 2.8.26
|
||||
baseline-browser-mapping: 2.8.28
|
||||
caniuse-lite: 1.0.30001754
|
||||
electron-to-chromium: 1.5.250
|
||||
electron-to-chromium: 1.5.252
|
||||
node-releases: 2.0.27
|
||||
update-browserslist-db: 1.1.4(browserslist@4.28.0)
|
||||
|
||||
|
|
@ -978,7 +978,7 @@ snapshots:
|
|||
detect-libc@1.0.3:
|
||||
optional: true
|
||||
|
||||
electron-to-chromium@1.5.250: {}
|
||||
electron-to-chromium@1.5.252: {}
|
||||
|
||||
emojis-list@3.0.0: {}
|
||||
|
||||
|
|
@ -1300,7 +1300,7 @@ snapshots:
|
|||
- esbuild
|
||||
- uglify-js
|
||||
|
||||
ysk-utils@1.0.58:
|
||||
ysk-utils@1.0.70:
|
||||
dependencies:
|
||||
bignumber.js: 9.3.1
|
||||
loadsh: 0.0.4
|
||||
|
|
|
|||
Loading…
Reference in New Issue