优惠卷和商品卷
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
if (numIndex.value == -1 && otherNum.value != "其他") {
|
||||
dinersNum.value = otherNum.value
|
||||
}
|
||||
if (shopTable.useNum < dinersNum.value) {
|
||||
if (shopTable.useNum < dinersNum.value && shopTable.useNum > 0) {
|
||||
uni.showToast({
|
||||
title: `最多${shopTable.useNum}人`,
|
||||
icon: 'none'
|
||||
|
||||
@@ -6,66 +6,58 @@
|
||||
<view class="container">
|
||||
<view class="head">
|
||||
<view class="head_bg"></view>
|
||||
<view class="tips" v-if="shopInfo.registerType == 'before'">
|
||||
<!-- <view class="tips" v-if="shopInfo.registerType == 'before'"> -->
|
||||
<view class="tips">
|
||||
<image class="informIcon"
|
||||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png"
|
||||
mode="aspectFill" />
|
||||
<text class="informText">温馨提示:请适量点餐,避免浪费</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 先下单子切换 -->
|
||||
<view class="tabBox" v-if="shopInfo.registerType == 'before'">
|
||||
<view class="tab">
|
||||
<view v-for="(item,index) in tebtypeList" :key="index"
|
||||
:class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'"
|
||||
@click="tabClick(item,index)">
|
||||
<view></view>
|
||||
<image class="icon" :src="is_type==index?item.url_active:item.url" mode="aspectFill" />
|
||||
<text class="title" :class="{active:is_type==index}">{{item.title}}</text>
|
||||
<view class="card" v-if="orderinfo.detailMap">
|
||||
<!-- 订单头部 -->
|
||||
<view class="card_item" v-for="(value, key) in orderinfo.detailMap" :key="key">
|
||||
<view class="head">
|
||||
<view class="head_left">
|
||||
<text class="placeNum">第{{key}}次下单</text>
|
||||
<!-- <text class="placeTime">{{item.placeTime}}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="table" v-if=" is_type==0 ">
|
||||
<view class="table_left">
|
||||
<image class="icon"
|
||||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png"
|
||||
mode="aspectFill" />
|
||||
<text class="title">桌台</text>
|
||||
<!-- 订单详情 -->
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="item in value" :key="item.id">
|
||||
<view class="cover">
|
||||
<up-image width="76" height="76" radius="16" :src="item.productImg"
|
||||
v-if="item.productId!=-999"></up-image>
|
||||
<up-image width="76" height="76" radius="16"
|
||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||
mode="heightFix" v-else></up-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="productName">{{item.productName}}</text>
|
||||
<text class="productSkuName"
|
||||
v-if="item.productSkuName">{{item.productSkuName}}</text>
|
||||
</view>
|
||||
|
||||
<view class="price">
|
||||
<view class="priceAmount">
|
||||
¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}
|
||||
</view>
|
||||
<view class="num">x{{item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="value" v-if="tableCode"> {{ shopTable.name || '' }} </view>
|
||||
</view>
|
||||
<view class="pack" v-else>
|
||||
<view class="top">
|
||||
<text class="title">{{ shopInfo.shopName }}</text>
|
||||
<text class="address">{{ shopInfo.address }}</text>
|
||||
</view>
|
||||
<!-- <view class="list">
|
||||
<view class="item">
|
||||
<view class="lable">取餐时间</view><view class="text">立即取餐</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">预留电话</view><view class="getPhone text"><u-input class="inputVal" v-model="order.phone" input-align="right" placeholder="请输入预留电话以便联系您" ></u-input><text class="getBtn">获取手机号</text></view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 先下单在在支付 -->
|
||||
<view class="addDish" @click="addDish" v-if="shopInfo.registerType == 'after'">加菜下单</view>
|
||||
<view class="tabBox_t " v-if="shopInfo.registerType == 'after'">
|
||||
<view class="shopName">{{ shopInfo.name }}</view>
|
||||
<view class="tableName"
|
||||
style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<view style="display: flex;">
|
||||
<view>桌号:</view>
|
||||
<view class="name" v-if="shopTable.name">{{ shopTable.name || '' }} </view>
|
||||
<view class="num" v-if="shopTable&&shopTable.seatNum">{{ shopTable.seatNum }}人
|
||||
</view>
|
||||
</view>
|
||||
<view class="semicircle_icon" v-if="index > 0">
|
||||
<view class="semicircle_left_icon"></view>
|
||||
<view class="semicircle_right_icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单内容区域 -->
|
||||
<view class="content_box">
|
||||
<text class="placeNum">购物车</text>
|
||||
<view class="content">
|
||||
<view class="title"> {{ shopInfo.name }} </view>
|
||||
<view class="list_item" v-for="(item,index) in cartList" :key="item.id">
|
||||
@@ -85,19 +77,8 @@
|
||||
class="price">¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 打包费 -->
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{packFee}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 餐位费 -->
|
||||
<view class="cell-item"
|
||||
v-if="shopTable.useNum>0 && shopInfo.registerType == 'before' && is_type == 0">
|
||||
<view class="cell-item" v-if="shopTable.useNum>0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{shopTable.seatNum}}</view>
|
||||
@@ -105,60 +86,10 @@
|
||||
<view>{{Seatcharge}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-for="(item,index) in favorable" :key="index"
|
||||
v-if="shopInfo.registerType == 'before'&&!thisdata.rechargeFreeChecked">
|
||||
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}"
|
||||
@click="goUrl(item)">
|
||||
<view class="favorable_left">
|
||||
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
|
||||
<text class="name"> {{ item.name }} </text>
|
||||
</view>
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text">{{item.value}}</text>
|
||||
<up-icon name="arrow-right" color="#575B66" size="14"></up-icon>
|
||||
</view>
|
||||
<view class="favorable_right" :class="{column:item.value.length>0}"
|
||||
v-if="item.type=='product'">
|
||||
<view :class="{column:item.value.length>0}">
|
||||
<view class="favorable_right_text" v-for="(items,indexs) in item.value"
|
||||
:key="indexs">
|
||||
<text>{{items.name}}</text>
|
||||
<text>X{{items.num}}</text>
|
||||
<text>-¥{{items.discountAmount || 0}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right" color="#575B66" size="14"
|
||||
style="margin-top: 5rpx;"></up-icon>
|
||||
</view>
|
||||
<!-- 积分 -->
|
||||
<!-- <view class="favorable_right" v-if="item.type=='points'" @click.stop="pointsChange">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
|
||||
v-if="thisdata.calcUsablePointsData.usable">
|
||||
使用 {{thisdata.calcUsablePointsData.pointsNum}}
|
||||
积分抵扣¥{{thisdata.calcUsablePointsData.pointsNum/thisdata.calcUsablePointsData.equivalentPoints}}
|
||||
</text>
|
||||
<text class="favorable_right_text"
|
||||
style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
|
||||
{{thisdata.calcUsablePointsData.unusableReason||''}}
|
||||
</text>
|
||||
|
||||
<up-checkbox-group iconPlacement="right" @change="pointsChange">
|
||||
<up-checkbox v-model="isPointsChecked"
|
||||
:disabled="thisdata.freeCheck||!thisdata.calcUsablePointsData.usable"
|
||||
:checked="thisdata.isPointsChecked" activeColor="#E8AD7B" shape="circle"
|
||||
icon-size="36" size="36">
|
||||
</up-checkbox>
|
||||
</up-checkbox-group>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="totalPrice">
|
||||
<!-- <view class="totalPrice">
|
||||
<text style="margin-bottom: 5rpx;">小计¥</text>
|
||||
<text class="totalPriceNum"> {{totalCost}} </text>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <u-divider color="#fa3534" half-width="200" border-color="#6d6d6d">姑苏城外寒山寺</u-divider> -->
|
||||
</view>
|
||||
</view>
|
||||
@@ -167,34 +98,35 @@
|
||||
<view class="remark">
|
||||
<view class="remark_bg">
|
||||
<view class="remark_title">订单备注</view>
|
||||
<u-textarea class="remark_value" placeholder="请填写口味、偏好等要求" :type="'textarea'"
|
||||
v-model="thisdata.remark" :border="thisdata.textareaBorder" :clearable="true" />
|
||||
<u-textarea class="remark_value" placeholder="请填写口味、偏好等要求" :type="'textarea'" v-model="remark"
|
||||
:clearable="true" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<view style="padding: 0 20rpx;" v-if="shopInfo.registerType == 'before'">
|
||||
<!-- <view style="padding: 0 20rpx;" v-if="shopInfo.registerType == 'before'">
|
||||
<paymentMethod ref="paymentMethodref" @groupChange="groupChange">
|
||||
</paymentMethod>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- boutton -->
|
||||
<view style="width: 100%;height: 200rpx;"> </view>
|
||||
<view class="bottom">
|
||||
<view class="bottom_left">
|
||||
<text style="margin-bottom: 5rpx;">实付金额</text>
|
||||
<text class="totalAmount">¥{{ totalCost }} </text>
|
||||
<text class="totalAmount">¥{{ totalPrices }} </text>
|
||||
</view>
|
||||
<block v-if="shopInfo.registerType == 'before'">
|
||||
<!-- <block v-if="shopInfo.registerType == 'before'">
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-if="shopInfo">
|
||||
{{ paymentmethod.paymentBtnText }}11
|
||||
{{ paymentmethod.paymentBtnText }}
|
||||
</view>
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else>
|
||||
{{ paymentmethod.paymentBtnText }}22
|
||||
{{ paymentmethod.paymentBtnText }}
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="shopInfo.registerType == 'after'">
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单33 </view>
|
||||
<block v-if="shopInfo.registerType == 'after'"> -->
|
||||
<block>
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单 </view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
@@ -233,8 +165,15 @@
|
||||
confirmordershow: {
|
||||
type: Boolean
|
||||
},
|
||||
orderinfo: {
|
||||
type: Object,
|
||||
default: {
|
||||
detailMap: {}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const remark = ref('')
|
||||
|
||||
// 定义自定义事件
|
||||
const emits = defineEmits(['customevent', 'close']);
|
||||
@@ -255,71 +194,74 @@
|
||||
|
||||
const tableCode = uni.cache.get('tableCode')
|
||||
|
||||
// 监听送餐/打包切换
|
||||
const is_type = ref(0)
|
||||
|
||||
// teb 切换送餐和打包
|
||||
const tebtypeList = reactive([{
|
||||
title: "送餐到桌",
|
||||
show: false,
|
||||
type: "table",
|
||||
val: "dine-in",
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png",
|
||||
url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"
|
||||
},
|
||||
{
|
||||
title: "打包外带",
|
||||
show: false,
|
||||
type: "takeself",
|
||||
val: "take-out",
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png",
|
||||
url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"
|
||||
},
|
||||
])
|
||||
|
||||
const favorable = reactive([{
|
||||
name: "优惠券",
|
||||
type: "coupon",
|
||||
value: "",
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
},
|
||||
{
|
||||
name: "商品券",
|
||||
type: "product",
|
||||
value: [],
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
},
|
||||
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
|
||||
{
|
||||
name: "积分抵扣",
|
||||
type: "points",
|
||||
value: "",
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png"
|
||||
}
|
||||
])
|
||||
|
||||
// 开始计算费用
|
||||
|
||||
// 打包费
|
||||
const packFee = computed(() => cartStore.getTotalPackFee(props.cartList).value);
|
||||
// const packFee = computed(() => cartStore.getTotalPackFee(props.cartList).value);
|
||||
|
||||
// 计算购物车商品费用
|
||||
const totalPrices = computed(() => cartStore.getTotalTotalPrices(props.cartList).value);
|
||||
// const totalPrices = computed(() => cartStore.getTotalTotalPrices(props.cartList));
|
||||
|
||||
// 计算购物车商品费用
|
||||
const totalPrices = computed(() => {
|
||||
let combinedArray = [];
|
||||
for (const key in props.orderinfo.detailMap) {
|
||||
if (props.orderinfo.detailMap.hasOwnProperty(key)) {
|
||||
combinedArray = props.orderinfo.detailMap[key];
|
||||
}
|
||||
}
|
||||
// 购物车总数价格
|
||||
let cartone = combinedArray.reduce((total, item) => {
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.num);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.salePrice) * parseFloat(item.num);
|
||||
}
|
||||
}, 0);
|
||||
console.log(cartone)
|
||||
// 购物车总数价格
|
||||
let cart = props.cartList.reduce((total, item) => {
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.cartNumber);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.salePrice) * parseFloat(item.cartNumber);
|
||||
}
|
||||
}, 0);
|
||||
cart = cartone + cart
|
||||
// 向上取整并保留两位小数
|
||||
return cart = Math.ceil(cart * 100) / 100;
|
||||
});
|
||||
|
||||
// 餐位费
|
||||
const Seatcharge = computed(() => cartStore.getTotalSeatcharge(props.cartList).value);
|
||||
const getTotalSeatcharge = computed(() => {
|
||||
// 是否免除桌位费 0 否 1 是
|
||||
let tableFeeTotals = 0
|
||||
|
||||
if (isTableFee == 0 && dinersNum) {
|
||||
tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(tableFee) *
|
||||
100) / 100;
|
||||
}
|
||||
console.log(tableFeeTotals)
|
||||
return Math.floor(tableFeeTotals * 100) / 100 ? Math.floor(tableFeeTotals * 100) / 100 : 0;
|
||||
});
|
||||
|
||||
//总价格
|
||||
const totalCost = ref(0);
|
||||
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.cartList.length > 0) {
|
||||
// 打包费 计算购物车商品费用 餐位费
|
||||
const sum = (is_type.value != 0 ? packFee.value : 0) + totalPrices.value + (is_type.value == 0 ?
|
||||
Seatcharge.value : 0);
|
||||
totalCost.value = Math.round(sum * 100) / 100;
|
||||
}
|
||||
// if (props.cartList.length > 0) {
|
||||
// // 打包费 计算购物车商品费用 餐位费
|
||||
// const sum = (is_type.value != 0 ? packFee.value : 0) + totalPrices.value + (is_type.value == 0 ?
|
||||
// Seatcharge.value : 0);
|
||||
// totalCost.value = Math.round(sum * 100) / 100;
|
||||
// }
|
||||
});
|
||||
|
||||
// 监听送餐/打包切换
|
||||
@@ -341,82 +283,76 @@
|
||||
paymentmethod.payType = e.payType;
|
||||
}
|
||||
|
||||
// 跳转
|
||||
const goUrl = (item) => {
|
||||
switch (item.type) {
|
||||
case 'coupon':
|
||||
let payAmount = Seatcharge.value;
|
||||
// let couponList = this.userCouponInfos.filter(v => v.type == 1);
|
||||
// if (couponList.length > 0) {
|
||||
// payAmount = payAmount + couponList.discountAmount;
|
||||
// }
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
shopId: uni.cache.get('shopId'),
|
||||
payAmount: payAmount
|
||||
// shoppingCart: JSON.stringify(this.listinfo.details)
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_product",
|
||||
shopId: this.shopId,
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 提交订单
|
||||
const orderdetail = async () => {
|
||||
let res = await storeMemberpay.actionscreateOrder({
|
||||
dineMode: 'dine-in', //堂食 dine-in 外带 take-out 外卖 take-away
|
||||
seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //用餐人数
|
||||
packFee: packFee.value, //打包费
|
||||
// packFee: packFee.value, //打包费
|
||||
packFee: 0, //打包费
|
||||
originAmount: totalPrices.value, //订单原金额(包含打包费) 不含折扣价格 不含餐位费
|
||||
remark: '', //备注
|
||||
placeNum: '', //当前订单下单次数
|
||||
waitCall: '' //是否等叫 0 否 1 等叫
|
||||
remark: remark.value, //备注
|
||||
placeNum: props.orderinfo.placeNum + 1, //当前订单下单次数
|
||||
waitCall: '', //是否等叫 0 否 1 等叫
|
||||
orderId: props.orderinfo.id
|
||||
|
||||
})
|
||||
console.log(res)
|
||||
uni.showLoading({
|
||||
title: '正在生成订单',
|
||||
mask: true
|
||||
// 清空购物车
|
||||
emits('customevent', {
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: 'cleanup',
|
||||
})
|
||||
if (res) {
|
||||
let checkOrderPay = {
|
||||
orderId: res.id,
|
||||
vipPrice: shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? 1 : 0, //是否使用会员价0否1是
|
||||
allPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //用餐人数
|
||||
orderAmount: totalCost.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: '', //商品优惠券抵扣金额
|
||||
fullCouponDiscountAmount: '', //满减优惠券抵扣金额
|
||||
couponList: '', //用户使用的卡券
|
||||
orderAmount: totalCost.value, // 最中订单金额
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: 0, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: 0, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
let successdata = await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
if (successdata) {
|
||||
console.log(res.id, '支付成功res.id')
|
||||
uni.redirectTo({
|
||||
url: '/order/detail?orderId=' + res.id
|
||||
});
|
||||
}
|
||||
}
|
||||
uni.pro.redirectTo('order/detail', {
|
||||
orderId: res.id,
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/index/index?orderId=' + res.id + '&shopId=' + uni.cache.get('shopId')
|
||||
// })
|
||||
// uni.pro.navigateTo('order/detail', {
|
||||
// orderId: res.id,
|
||||
// shopId: uni.cache.get('shopId')
|
||||
// })
|
||||
// uni.showLoading({
|
||||
// title: '正在生成订单',
|
||||
// mask: true
|
||||
// })
|
||||
// if (res) {
|
||||
// let checkOrderPay = {
|
||||
// orderId: res.id,
|
||||
// vipPrice: shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? 1 : 0, //是否使用会员价0否1是
|
||||
// allPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
// seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //用餐人数
|
||||
// orderAmount: totalCost.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
// discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
// discountAmount: 0, //手动优惠金额 写死0
|
||||
// productCouponDiscountAmount: '', //商品优惠券抵扣金额
|
||||
// fullCouponDiscountAmount: '', //满减优惠券抵扣金额
|
||||
// couponList: '', //用户使用的卡券
|
||||
// orderAmount: totalCost.value, // 最中订单金额
|
||||
// roundAmount: 0, //抹零金额 减免多少钱
|
||||
// pointsDiscountAmount: 0, //积分抵扣金额(tb_points_basic_setting表)
|
||||
// pointsNum: 0, //(扣除各类折扣 enable_deduction后使用)
|
||||
// remark: '', //用户备注
|
||||
// }
|
||||
// let successdata = await storeMemberpay.actionsltPayOrder({
|
||||
// checkOrderPay,
|
||||
// payType: paymentmethod.payType,
|
||||
// buyerRemark: '',
|
||||
// returnUrl: ''
|
||||
// })
|
||||
// if (successdata) {
|
||||
// console.log(res.id, '支付成功res.id')
|
||||
// uni.redirectTo({
|
||||
// url: '/order/detail?orderId=' + res.id
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -485,6 +421,357 @@
|
||||
max-height: 80vh;
|
||||
overflow: auto;
|
||||
|
||||
.card {
|
||||
// background-color: #fff;
|
||||
border-radius: 20upx;
|
||||
margin-bottom: 28upx;
|
||||
position: relative;
|
||||
|
||||
.card_item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
padding: 0 34rpx;
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 0;
|
||||
|
||||
.head_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.placeNum {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin-right: 32rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.placeTime {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.shop-info {
|
||||
border-bottom: 2rpx dashed #e5e5e5;
|
||||
|
||||
.item:nth-child(1) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 32rpx;
|
||||
display: flex;
|
||||
|
||||
.cover {}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 16upx;
|
||||
|
||||
.productName {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.productSkuName {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.n {
|
||||
font-size: 24upx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
padding-left: 68rpx;
|
||||
|
||||
.priceAmount {
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
align-self: flex-end;
|
||||
width: 92rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
background: #999999;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
font-weight: 400;
|
||||
font-size: 22rpx;
|
||||
color: #FFFFFF;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.totalAmount {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
padding: 32rpx 0;
|
||||
border-bottom: 2rpx dashed #e5e5e5;
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.semicircle_icon {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: -22.5rpx;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.semicircle_left_icon {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
margin-left: -22.5rpx;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 50%;
|
||||
// box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
|
||||
|
||||
}
|
||||
|
||||
.semicircle_right_icon {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
margin-right: -22.5rpx;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 50%;
|
||||
// box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cell-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 34rpx 0 34rpx;
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
padding-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.val {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
padding-bottom: 32rpx;
|
||||
border-bottom: 2rpx dashed #e5e5e5;
|
||||
|
||||
view:nth-child(1) {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 42rpx;
|
||||
}
|
||||
|
||||
view:nth-child(2) {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.val.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.productCoupon {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: 0 0 10rpx 0;
|
||||
|
||||
.name {
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0 30rpx;
|
||||
line-height: 20rpx;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorable {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 26rpx;
|
||||
padding-top: 26rpx;
|
||||
border-bottom: 2rpx solid #E5E5E5;
|
||||
|
||||
.favorable_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.favorable_right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.favorable_right_text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-weight: 400rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.favorable_right {
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
|
||||
.favorable_right_text {
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
text:nth-child(1) {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
text:nth-child(2) {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
|
||||
text:nth-child(3) {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorable_right.column {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.favorable.column {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.cell-item.column {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.total-wrap {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
padding: 0 34rpx;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-top: 64rpx;
|
||||
|
||||
.price {
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.order_footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 34rpx;
|
||||
position: relative;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.head {
|
||||
width: 100%;
|
||||
padding: $uni-spacing-row-base;
|
||||
|
||||
@@ -232,8 +232,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<confirmorder :cartLists_count="cartLists_count" :cartList="matchedProducts" :totalPrices='totalPrices'
|
||||
:confirmordershow="confirmordershow" @close="confirmordershow = !confirmordershow"></confirmorder>
|
||||
<confirmorder ref="confirmorderref" :cartLists_count="cartLists_count" :cartList="matchedProducts"
|
||||
:totalPrices='totalPrices' :confirmordershow="confirmordershow"
|
||||
@close="confirmordershow = !confirmordershow" @customevent='websocketsendMessage' :orderinfo="orderinfo">
|
||||
</confirmorder>
|
||||
<!-- 店铺详情 -->
|
||||
<shopindex ref="showShopInfoRef"></shopindex>
|
||||
<!-- 购物车 -->
|
||||
@@ -381,6 +383,10 @@
|
||||
APIminiAppskuinfo
|
||||
} from "@/common/api/product/product.js";
|
||||
|
||||
import {
|
||||
APIhistoryOrder
|
||||
} from "@/common/api/order/index.js";
|
||||
|
||||
// websocket
|
||||
import useWebSocket from '@/common/js/websocket.js';
|
||||
|
||||
@@ -871,13 +877,11 @@
|
||||
if (Message.type == "ping_interval" || Message.msg_id == "ping_interval") {
|
||||
return false
|
||||
}
|
||||
|
||||
// 初始化
|
||||
if (Message.operate_type == "shopping_init") {
|
||||
cartList.value = Message.data
|
||||
}
|
||||
|
||||
|
||||
// 购物车数据更新从新请求
|
||||
if (Message.type == 'product') {
|
||||
isDataLoaded.value = false;
|
||||
@@ -908,6 +912,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 清空购物车
|
||||
if (Message.operate_type == 'shopping_cleanup') {
|
||||
cartList.value = []
|
||||
showCart.value = false
|
||||
}
|
||||
|
||||
//除去p 每次返回都回执消息
|
||||
await websocketsendMessage({
|
||||
type: 'receipt',
|
||||
@@ -972,23 +982,54 @@
|
||||
});
|
||||
|
||||
// 计算购物车商品费用
|
||||
const totalPrices = ref(0);
|
||||
// const totalPrices = ref(0);
|
||||
|
||||
watchEffect(() => {
|
||||
if (matchedProducts.value.length > 0) {
|
||||
totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
|
||||
}
|
||||
});
|
||||
// watchEffect(() => {
|
||||
// if (matchedProducts.value.length > 0) {
|
||||
// totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
|
||||
// }
|
||||
// });
|
||||
|
||||
// matchedProducts 变化时,更新总打包费用
|
||||
watch(() => matchedProducts.value, () => {
|
||||
if (matchedProducts.value.length > 0) {
|
||||
totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
|
||||
}
|
||||
// watch(() => matchedProducts.value, () => {
|
||||
// if (matchedProducts.value.length > 0) {
|
||||
// totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// 计算购物车商品总价格
|
||||
const totalPrices = computed(() => {
|
||||
// 购物车总数价格
|
||||
let cart = matchedProducts.value.reduce((total, item) => {
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.cartNumber);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.salePrice) * parseFloat(item.cartNumber);
|
||||
}
|
||||
}, 0);
|
||||
// 向上取整并保留两位小数
|
||||
return cart = Math.ceil(cart * 100) / 100;
|
||||
});
|
||||
|
||||
// 储存是否存在多次下单
|
||||
const orderinfo = ref({})
|
||||
const confirmorderref = ref(null)
|
||||
// 结账
|
||||
const orderdetail = async () => {
|
||||
try {
|
||||
let res = await APIhistoryOrder({
|
||||
tableCode: uni.cache.get('tableCode'),
|
||||
})
|
||||
orderinfo.value = {
|
||||
id: res.id,
|
||||
detailMap: res.detailMap,
|
||||
placeNum: res.placeNum
|
||||
}
|
||||
} catch (error) {}
|
||||
confirmordershow.value = true
|
||||
}
|
||||
|
||||
@@ -1074,13 +1115,20 @@
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 获取页面参数
|
||||
const options = currentPage.options;
|
||||
await productqueryProduct()
|
||||
|
||||
orderId.value = options.orderId
|
||||
let res = await APIshopUserInfo({
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
cartStore.shopInfo = uni.cache.get('shopInfo')
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
const store = productStore();
|
||||
await store.scanCodeactions(options.q)
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (getApp().globalData.tableCode) {
|
||||
await store.scanCodeactions(getApp().globalData.tableCode)
|
||||
}
|
||||
// #endif
|
||||
|
||||
await productqueryProduct()
|
||||
setTimeout(() => {
|
||||
getElementTop()
|
||||
}, 500)
|
||||
|
||||
Reference in New Issue
Block a user