下单详情
This commit is contained in:
parent
56799f41f6
commit
70edc6756d
|
|
@ -27,11 +27,20 @@ export const APIputuserorder = (data) => {
|
|||
})
|
||||
}
|
||||
|
||||
//订单列表
|
||||
export const orderhistoryOrder = (data) => {
|
||||
//历史订单(多次下单使用)
|
||||
export const APIhistoryOrder = (data) => {
|
||||
return request({
|
||||
url: url + '/user/order/historyOrder',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//订单详情
|
||||
export const APIgetOrderById = (data) => {
|
||||
return request({
|
||||
url: url + '/user/order/getOrderById',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -86,10 +86,10 @@ const useWebSocket = (options = {}) => {
|
|||
sendMessage(initMessage)
|
||||
});
|
||||
socketTask.value.onMessage((res) => {
|
||||
// console.log(res, 'receivedMessages.value')
|
||||
let list = JSON.parse(res.data)
|
||||
console.log(list, 'receivedMessages.value')
|
||||
receivedMessages.value.push(list);
|
||||
if (list.type == 'p') {
|
||||
if (res.msg == 'ok') {
|
||||
console.log('心跳响应正常');
|
||||
// 心跳正常,重置重连尝试次数
|
||||
reconnectAttempts.value = 0;
|
||||
|
|
@ -135,7 +135,7 @@ const useWebSocket = (options = {}) => {
|
|||
if (isConnected.value) {
|
||||
socketTask.value.send({
|
||||
data: JSON.stringify({
|
||||
type: 'pong'
|
||||
type: 'ping_interval'
|
||||
}),
|
||||
success: () => {
|
||||
console.log('心跳消息发送成功');
|
||||
|
|
@ -148,7 +148,7 @@ const useWebSocket = (options = {}) => {
|
|||
}, heartbeatInterval * 1.2);
|
||||
|
||||
socketTask.value.onMessage((res) => {
|
||||
if (res.data === 'ping') {
|
||||
if (res.msg == 'ok') {
|
||||
clearTimeout(pongTimer);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,207 @@
|
|||
<template>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
|
||||
placement="column">
|
||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
||||
<view class="method_list" @click="groupChange(item.type)">
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill" />
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">会员卡余额 ¥{{amountVIP?amountVIP.amount:0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<up-radio activeColor="#E8AD7B" icon-size="18" size="18" :name="item.type">
|
||||
</up-radio>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
defineProps,
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect
|
||||
} from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const emits = defineEmits(['customevent', 'groupChange']);
|
||||
|
||||
const amountVIP = uni.cache.get('shopUserInfo')
|
||||
|
||||
const paymentMethodList = ref([{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: ''
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
// #endif
|
||||
])
|
||||
|
||||
|
||||
const paymentMethodName = ref([{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: ''
|
||||
},
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
])
|
||||
|
||||
const radiovalue = ref(1) // 支付方式
|
||||
|
||||
const ispws = ref(false) // 输入支付密码
|
||||
|
||||
const storeInfo = ref({})
|
||||
|
||||
// * 监听支付方式切换
|
||||
const groupChange = (type) => {
|
||||
console.log(type)
|
||||
if (props.freeCheck && type == 1) {
|
||||
return;
|
||||
}
|
||||
// if (props.payAmount <= 0 && type != 1) {
|
||||
// return;
|
||||
// }
|
||||
radiovalue.value = type;
|
||||
let name = paymentMethodName.value[type - 1].name;
|
||||
emits("groupChange", type)
|
||||
}
|
||||
|
||||
// 去充值
|
||||
const goRecharge = () => {
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.paymentMethod {
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
|
||||
.paymentMethod_content {
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding: 30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.paymentMethod_title {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.method_list {
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.method_list_top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.method_list_top_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 54.67rpx !important;
|
||||
height: 48rpx !important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.method_list_top_cen {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.method_list_bom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.balance {
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.topUpNow {
|
||||
color: #FF803D;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.method_list:nth-child(odd) {
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -53,6 +53,12 @@
|
|||
"navigationBarTitleText": "订单列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/user",
|
||||
"style": {
|
||||
|
|
|
|||
|
|
@ -163,9 +163,6 @@
|
|||
APIhomehomePageUp,
|
||||
APIhome
|
||||
} from "@/common/api/index/index.js"
|
||||
import {
|
||||
APIshopUserInfo
|
||||
} from "@/common/api/member.js"
|
||||
import {
|
||||
useNavbarStore
|
||||
} from '@/stores/navbarStore';
|
||||
|
|
@ -173,6 +170,7 @@
|
|||
productStore
|
||||
} from '@/stores/user.js';
|
||||
const store = useNavbarStore();
|
||||
const storeuser = productStore();
|
||||
store.updateNavbarConfig({
|
||||
showBack: true, //左边返回键
|
||||
rightText: '', //右边文字
|
||||
|
|
@ -344,11 +342,7 @@
|
|||
await proxy.$onLaunched;
|
||||
if (uni.cache.get('shopId') && uni.cache.get('token')) {
|
||||
showindex.value = 'shopIndex'
|
||||
let res = await APIshopUserInfo()
|
||||
if (res) {
|
||||
//商家信息
|
||||
uni.cache.set('ShopUser', res)
|
||||
}
|
||||
await storeuser.actionsAPIuser()
|
||||
} else {
|
||||
hometop()
|
||||
init_fn()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,965 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="card_box">
|
||||
<view class="card_head_box">
|
||||
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
|
||||
</view>
|
||||
<view class="card">
|
||||
<!-- 订单头部 -->
|
||||
<view class="card_item" v-for="(value, key) in listinfo.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="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">¥{{item.priceAmount}}</view>
|
||||
<view class="num">x{{item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
|
||||
<view class="totalAmount">
|
||||
<view class="label">小计¥</view>
|
||||
<view class="price"> {{item.totalAmount}} </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 class="cell-item" v-if="listinfo.seatCount > 0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.seatCount}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.seatAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<block v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
<view v-for="(item,indexe) in favorable" :key="indexe">
|
||||
<view v-if="!rechargeFreeChecked" 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="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></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="16"
|
||||
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="calcUsablePointsData.usable">
|
||||
使用 {{ calcUsablePointsData.pointsNum}}
|
||||
积分抵扣¥{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
|
||||
</text>
|
||||
<text class="favorable_right_text"
|
||||
style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
|
||||
{{calcUsablePointsData.unusableReason||''}}
|
||||
</text>
|
||||
|
||||
<up-checkbox-group iconPlacement="right" @change="pointsChange">
|
||||
<up-checkbox v-model="isPointsChecked"
|
||||
:disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked"
|
||||
activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
||||
</up-checkbox>
|
||||
</up-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<block v-for="(item,index) in listinfo.couponInfoList.fullReductionCoupon" :key="index">
|
||||
<view class="cell-item" v-if="item.type == 1">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">-¥</view>
|
||||
<view>{{item.discountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="cell-item column" v-if="listinfo.couponInfoList.productCoupon.length > 0">
|
||||
<view class="label">商品券</view>
|
||||
<view class="val column">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList.productCoupon"
|
||||
:key="index">
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="num">X{{item.finalUseNum}}</view>
|
||||
<view class="amount">-¥{{item.finalDiscountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item"
|
||||
v-if="listinfo && listinfo.pointsDiscountAmount && listinfo.pointsDiscountAmount > 0">
|
||||
<view class="label">积分抵扣</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.pointsDiscountAmount.toFixed(2)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="total-wrap">
|
||||
<view>总计¥</view>
|
||||
<view class="price"> {{listinfo.payAmount}} </view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="orderInfo">
|
||||
<view class="row" @click="copyHandle(listinfo.orderNo)">
|
||||
<text class="t">订单编号:</text>
|
||||
<text class="info">{{listinfo.orderNo}}(点击复制)</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">下单时间:</text>
|
||||
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">下单门店:</text>
|
||||
<text class="info">{{listinfo.name}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">订单类型:</text>
|
||||
<text class="info" v-if="listinfo.sendType == 'post'">快递</text>
|
||||
<text class="info" v-if="listinfo.sendType == 'takeaway'">外卖</text>
|
||||
<text class="info" v-if="listinfo.sendType == 'takeself'">自提</text>
|
||||
<text class="info" v-if="listinfo.sendType == 'table'">堂食</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">备注:</text>
|
||||
<text class="info">{{ listinfo.remark || ""}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">就餐人数:</text>
|
||||
<text class="info">{{ listinfo.seatCount || ""}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
defineProps,
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect
|
||||
} from 'vue'
|
||||
|
||||
// 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 props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean
|
||||
},
|
||||
|
||||
listinfo: {
|
||||
type: Object
|
||||
},
|
||||
amountVIP: {
|
||||
type: Object
|
||||
},
|
||||
})
|
||||
|
||||
const data = reactive({
|
||||
calcUsablePointsData: null,
|
||||
isShow: false,
|
||||
payAmount: 0,
|
||||
isPointsChecked: false,
|
||||
userCouponInfos: [],
|
||||
selectCouponData: [],
|
||||
})
|
||||
|
||||
|
||||
const childOnShow = () => {
|
||||
console.log('isShow==', this.isShow)
|
||||
if (!this.isShow) {
|
||||
this.getCalcUsablePoints()
|
||||
return;
|
||||
}
|
||||
// uni.$on('couponItem',this.changeCoupon)
|
||||
this.userCouponInfos = [];
|
||||
this.favorable[0].value = ""
|
||||
this.favorable[1].value = []
|
||||
this.listinfo.payAmount = this.payAmount
|
||||
this.selectCouponData = uni.cache.get('selectCouponData') || []
|
||||
this.changeCoupon();
|
||||
}
|
||||
|
||||
// * 监听优惠券/商品券选择
|
||||
const changeCoupon = (data) => {
|
||||
// 优惠券数据
|
||||
let couponList = this.selectCouponData.filter(v => v.type == 1);
|
||||
// 商品券列表
|
||||
let productList = this.selectCouponData.filter(v => v.type == 2);
|
||||
// 优惠券处理
|
||||
if (couponList.length > 0) {
|
||||
let couponData = couponList[0]
|
||||
//不包含优惠券的金额
|
||||
let currentPayAmount = (this.userCouponInfos.filter(v => v.type == 1).length > 0 ? Number(this.listinfo
|
||||
.payAmount) + couponData.discountAmount : this.listinfo.payAmount)
|
||||
// 判断优惠金额不能大于支付金额
|
||||
if (couponData.discountAmount <= currentPayAmount) {
|
||||
|
||||
// if ( this.isPointsChecked && this.calcUsablePointsData) {
|
||||
// this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
// } else {
|
||||
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
// }
|
||||
this.listinfo.payAmount = (currentPayAmount - couponData.discountAmount).toFixed(2)
|
||||
this.favorable[0].value = ('-¥' + couponData.discountAmount)
|
||||
|
||||
this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
discountAmount: couponData.discountAmount,
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
|
||||
this.$emit("setPayAmount", {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
icon: "none",
|
||||
})
|
||||
}
|
||||
}
|
||||
// 商品券处理
|
||||
if (productList.length > 0) {
|
||||
//商品券使用数量
|
||||
|
||||
let payAmount = this.listinfo.payAmount
|
||||
productList.map((item, index) => {
|
||||
// 筛选选中商品券商品列表
|
||||
let productDetails = this.listinfo.details.filter(v => v.productId == item.proId);
|
||||
//金额从小到大排序
|
||||
let minCouponList = productDetails.sort((a, b) => (a.memberPrice > 0 ? a.memberPrice : a
|
||||
.salePrice) - (b.memberPrice > 0 ? b.memberPrice : b.salePrice))
|
||||
// 商品数量
|
||||
let productAllNum = 0;
|
||||
let productNum = 0
|
||||
let productPayAmount = 0
|
||||
minCouponList.map((v, indexs) => {
|
||||
productNum = 0;
|
||||
productPayAmount = 0;
|
||||
let productDetailsNum = 0;
|
||||
productDetails.map((v, indexs) => {
|
||||
productDetailsNum += v.num;
|
||||
})
|
||||
for (let i = 0; i < v.num; i++) {
|
||||
if (productAllNum < productDetailsNum && productNum < item.num && ((v
|
||||
.memberPrice > 0 ? v.memberPrice : v.price) <= (payAmount -
|
||||
productPayAmount))) {
|
||||
productNum++
|
||||
productAllNum++
|
||||
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.price
|
||||
}
|
||||
|
||||
}
|
||||
payAmount = payAmount - productPayAmount
|
||||
|
||||
})
|
||||
if (productNum > 0) {
|
||||
this.userCouponInfos.push({
|
||||
userCouponId: item.id,
|
||||
type: item.type,
|
||||
productId: item.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum,
|
||||
})
|
||||
this.favorable[1].value.push({
|
||||
userCouponId: item.id,
|
||||
name: item.name,
|
||||
type: item.type,
|
||||
productId: item.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
this.setPayAmount()
|
||||
}
|
||||
|
||||
const setPayAmount = (cartLists) => {
|
||||
let tableFee;
|
||||
// this.storeInfo.registerType == 'munchies'
|
||||
if (this.userCouponInfos.length > 0) {
|
||||
console.log(this.userCouponInfos)
|
||||
this.userCouponInfos.forEach(item => {
|
||||
if (item.type == 2) {
|
||||
if (item.discountAmount && item.discountAmount > 0) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(
|
||||
2)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.isPointsChecked = false;
|
||||
this.getCalcUsablePoints()
|
||||
this.$emit("setPayAmount", {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
}
|
||||
|
||||
// * 积分状态监听
|
||||
const pointsChange = () => {
|
||||
if (this.freeCheck || !this.calcUsablePointsData.usable) {
|
||||
return;
|
||||
}
|
||||
this.isPointsChecked = !this.isPointsChecked
|
||||
if (this.isPointsChecked) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - (this.calcUsablePointsData.pointsNum / this
|
||||
.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
} else {
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount) + (this.calcUsablePointsData.pointsNum /
|
||||
this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
this.$emit("setPayAmount", {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeDisabled: this.freeDisabled,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
}
|
||||
const goUrl = (item) => {
|
||||
if (this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
|
||||
let couopnInfo;
|
||||
switch (item.type) {
|
||||
case 'coupon':
|
||||
let payAmount = this.listinfo.payAmount;
|
||||
let couponList = this.userCouponInfos.filter(v => v.type == 1);
|
||||
if (couponList.length > 0) {
|
||||
payAmount = payAmount + couponList.discountAmount;
|
||||
}
|
||||
couopnInfo = {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeDisabled: this.freeDisabled,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "orderInfo_coupon",
|
||||
shopId: this.listinfo.shopId,
|
||||
orderId: this.listinfo.id,
|
||||
couopnInfo: JSON.stringify(couopnInfo),
|
||||
payAmount: payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(couponList)
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
couopnInfo = {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeDisabled: this.freeDisabled,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "orderInfo_product",
|
||||
shopId: this.listinfo.shopId,
|
||||
orderId: this.listinfo.id,
|
||||
couopnInfo: JSON.stringify(couopnInfo),
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * 获取积分相关信息
|
||||
const getCalcUsablePoints = async () => {
|
||||
let params = {
|
||||
memberId: this.listinfo.memberId,
|
||||
}
|
||||
if (this.listinfo.pointsDiscountAmount) {
|
||||
params.orderAmount = this.listinfo.payAmount + this.listinfo.pointsDiscountAmount
|
||||
} else {
|
||||
params.orderAmount = this.listinfo.payAmount
|
||||
}
|
||||
let res = await this.api.calcUsablePoints(params)
|
||||
this.calcUsablePointsData = res.data;
|
||||
if (this.calcUsablePointsData.usable && params.orderAmount >= this.calcUsablePointsData
|
||||
.minPaymentAmount) {
|
||||
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this
|
||||
.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this
|
||||
.calcUsablePointsData.accountPoints
|
||||
}
|
||||
}
|
||||
|
||||
// * 复制订单号
|
||||
const copyHandle = (e) => {
|
||||
uni.setClipboardData({
|
||||
data: e,
|
||||
success() {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card_box {
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
border-radius: 18rpx;
|
||||
padding-bottom: 32rpx;
|
||||
|
||||
.card_head_box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: absolute;
|
||||
top: -22.5rpx;
|
||||
padding: 0 44rpx;
|
||||
|
||||
.card_head_item {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 50%;
|
||||
// box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.orderInfo {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin-top: 32rpx;
|
||||
padding: 32rpx 34rpx;
|
||||
|
||||
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.t {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.row:last-child {
|
||||
margin-bottom: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
.fixedview {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
||||
.flex-between {
|
||||
width: 100%;
|
||||
padding: 36rpx 54rpx 102rpx 54rpx;
|
||||
background: #FFFFFF;
|
||||
|
||||
.fixedview_one {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.fixedview_oneone {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.fixedview_onetow {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fixedview_tow {
|
||||
width: 140rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
background: #E3AD7F;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,557 @@
|
|||
<template>
|
||||
<view class="card_box">
|
||||
<view class="card_head_box">
|
||||
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
|
||||
</view>
|
||||
<view class="card">
|
||||
<!-- 订单头部 -->
|
||||
<view class="head">
|
||||
<view class="head_left">
|
||||
<text class="shopName">{{listinfo.name}}</text>
|
||||
<text class="tableName" v-if="listinfo.tableName">「桌号:{{listinfo.tableName}}」</text>
|
||||
</view>
|
||||
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
<text> 待支付 </text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'unsend'">
|
||||
<text>待发货</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'closed'">
|
||||
<text>订单完成</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'send'">
|
||||
<text> 已发</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'refunding'">
|
||||
<text>申请退单</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'refund'">
|
||||
<text>退单</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'cancelled'">
|
||||
<text>已取消</text>
|
||||
</text>
|
||||
<text class="status" v-if="listinfo.status == 'merge'">
|
||||
<text>合台</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 取餐号 -->
|
||||
<view class="number-wrap"
|
||||
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
|
||||
<text class="t">取餐号</text>
|
||||
<text class="number">{{listinfo.outNumber}}</text>
|
||||
</view>
|
||||
<block>
|
||||
|
||||
</block>
|
||||
<!-- 订单详情 -->
|
||||
<view class="shop-box">
|
||||
<view class="shop-head">
|
||||
<view class="shop-head-left" v-if="listinfo.dineMod">
|
||||
<view class="tag-wrap">
|
||||
<text class="tag" v-if="listinfo.dineMod == 'dine-in'">堂食</text>
|
||||
<text class="tag" v-if="listinfo.dineMod == 'take-out'">外带</text>
|
||||
<text class="tag" v-if="listinfo.dineMod == 'take-away'">外卖</text>
|
||||
</view>
|
||||
<text class="title">订单详情</text>
|
||||
</view>
|
||||
|
||||
<view style="display: flex;align-items: center;"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
|
||||
<uni-countdown :show-day="false" color="#E3AD7F" border-color="#E3AD7F" splitorColor="#E3AD7F"
|
||||
:font-size="16" :hour="0" :minute="listinfo.expiredMinutes"
|
||||
:second="listinfo.expiredSeconds" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="(value, key) in Object.entries(listinfo.detailMap)" :key="key">
|
||||
<view>第{{key}}下单</view>
|
||||
<view class="" v-for="item in value" :key="item.id">
|
||||
<view class="cover">
|
||||
<u-image width="152" height="152" radius="16" :src='item.productImg'
|
||||
v-if="item.productId!=-999"></u-image>
|
||||
<u-image width="152" height="152" radius="16"
|
||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||
mode="heightFix" v-else></u-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">¥{{item.priceAmount}}</view>
|
||||
<view class="num">x{{item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item" v-if="listinfo.seatAmount > 0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.seatNum}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.seatAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="listinfo&&listinfo.couponInfoList && listinfo.couponInfoList.fullReductionCoupon">
|
||||
<view class="cell-item" v-for="(item,index) in listinfo.couponInfoList.fullReductionCoupon"
|
||||
:key="index">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">-¥</view>
|
||||
<view>{{item.discountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="cell-item column"
|
||||
v-if="listinfo&&listinfo.couponInfoList && listinfo.couponInfoList.productCoupon">
|
||||
<view class="label">商品券</view>
|
||||
<view class="val column">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList.productCoupon"
|
||||
:key="index">
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="num">X{{item.finalUseNum}}</view>
|
||||
<view class="amount">-¥{{item.finalDiscountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item"
|
||||
v-if="listinfo && listinfo.pointsDiscountAmount && listinfo.pointsDiscountAmount > 0">
|
||||
<view class="label">积分抵扣</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.pointsDiscountAmount.toFixed(2)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-wrap">
|
||||
<view>合计:</view>
|
||||
<view class="price"> ¥{{listinfo.payAmount}} </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="order_footer">
|
||||
<view class="order_footer_icon">
|
||||
<view class="order_footer_left_icon"></view>
|
||||
<view class="order_footer_right_icon"></view>
|
||||
</view>
|
||||
<view class="order-info">
|
||||
<view class="row" @click="copyHandle(listinfo.orderNo)">
|
||||
<text class="t">订单编号:</text>
|
||||
<text class="info">{{listinfo.orderNo}}(点击复制)</text>
|
||||
</view>
|
||||
<view class="row" v-if="listinfo.dineMod">
|
||||
<text class="t">用餐模式:</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'dine-in'">堂食</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'take-out'">外带</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'take-away'">外卖</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">下单时间:</text>
|
||||
<text class="info">{{$u.timeFormat(listinfo.updateTime, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
||||
</view>
|
||||
<!--<view class="row">
|
||||
<text class="t">下单门店:</text>
|
||||
<text class="info">{{listinfo.name}}</text>
|
||||
</view>
|
||||
-->
|
||||
<view class="row" v-if="listinfo.remark">
|
||||
<text class="t">备注:</text>
|
||||
<text class="info">{{ listinfo.remark||""}}</text>
|
||||
</view>
|
||||
<view class="row" v-if="listinfo.seatNum">
|
||||
<text class="t">就餐人数:</text>
|
||||
<text class="info">{{ listinfo.seatNum || ""}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
defineProps
|
||||
} from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
listinfo: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
|
||||
// * 复制订单号
|
||||
const copyHandle = (e) => {
|
||||
uni.setClipboardData({
|
||||
data: e,
|
||||
success() {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card_box {
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
border-radius: 18rpx;
|
||||
|
||||
.card_head_box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: absolute;
|
||||
top: -22.5rpx;
|
||||
padding: 0 44rpx;
|
||||
|
||||
.card_head_item {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 50%;
|
||||
// box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.card {
|
||||
// background-color: #fff;
|
||||
border-radius: 20upx;
|
||||
margin-bottom: 28upx;
|
||||
position: relative;
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 50rpx 34rpx 32rpx 34rpx;
|
||||
border-bottom: 2rpx dashed #E3E3E3;
|
||||
|
||||
.head_left {
|
||||
.shopName {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.tableName {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
text {
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.number-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.t {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.number {
|
||||
font-weight: bold;
|
||||
font-size: 56rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.price {
|
||||
.i {
|
||||
font-size: 20upx;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 38upx;
|
||||
}
|
||||
}
|
||||
|
||||
.shop-box {
|
||||
padding: 36rpx 34rpx 30rpx 34rpx;
|
||||
border-bottom: 2rpx dashed #E3E3E3;
|
||||
|
||||
.shop-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.shop-head-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.tag-wrap {
|
||||
width: 80rpx;
|
||||
height: 48rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
border: 2rpx solid #E3AD7F;
|
||||
margin-right: 18rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.tag {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #E3AD7F;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.shop-info {
|
||||
margin-top: 32rpx;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cell-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 0 32rpx 0;
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cell-item.column {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.total-wrap {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
|
||||
.price {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.order_footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 34rpx;
|
||||
position: relative;
|
||||
|
||||
.order_footer_icon {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: -22.5rpx;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.order_footer_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);
|
||||
|
||||
}
|
||||
|
||||
.order_footer_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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.order-info {
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-top: 32upx;
|
||||
|
||||
.t {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
<template>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
|
||||
placement="column">
|
||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
||||
<view class="method_list" @click="groupChange(item.type)">
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill"/>
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">会员卡余额 ¥{{amountVIP?amountVIP.amount:0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-radio activeColor="#E8AD7B" :disabled="(freeCheck&&index==0) || (index!=0&&payAmount<=0) || (rechargeFreeChecked&&index==0)" icon-size="36" size="36" :name="item.type">
|
||||
</u-radio>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
|
||||
data() {
|
||||
return {
|
||||
paymentMethodList:[
|
||||
{ name: "余额支付", type: 1, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
|
||||
// #ifdef MP-WEIXIN
|
||||
{ name: "微信支付", type: 2, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
|
||||
// #endif
|
||||
],
|
||||
paymentMethodName:[
|
||||
{ name: "余额支付", type: 1, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
|
||||
{ name: "微信支付", type: 2, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
|
||||
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
|
||||
],
|
||||
radiovalue: 1, // 支付方式
|
||||
ispws: false, // 输入支付密码
|
||||
storeInfo: {},
|
||||
}
|
||||
},
|
||||
props:{
|
||||
rechargeFreeChecked:{
|
||||
type: Boolean
|
||||
},
|
||||
payAmount:{
|
||||
type: Number
|
||||
},
|
||||
amountVIP:{
|
||||
type: Object
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
// freeCheck(newVal,oldVal) {
|
||||
// if ( newVal ) {
|
||||
// // #ifdef MP-WEIXIN
|
||||
// this.radiovalue = 2
|
||||
// // #endif
|
||||
// // #ifdef MP-ALIPAY
|
||||
// this.radiovalue = 3
|
||||
// // #endif
|
||||
// let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
// console.log({type:this.radiovalue ,name: name })
|
||||
// this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
// }
|
||||
// }
|
||||
payAmount:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
if ( newVal <= 0 ) {
|
||||
this.radiovalue = 1
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
rechargeFreeChecked:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
if ( newVal ) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.radiovalue = 2
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
this.radiovalue = 3
|
||||
// #endif
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
freeCheck:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
if ( newVal ) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.radiovalue = 2
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
this.radiovalue = 3
|
||||
// #endif
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// console.log(this.amountVIP)
|
||||
// this.getAount();
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听支付方式切换
|
||||
* @param {Object}
|
||||
*/
|
||||
groupChange(type) {
|
||||
if ( this.freeCheck && type == 1 ) {
|
||||
return;
|
||||
}
|
||||
if ( this.payAmount<=0 && type != 1 ) {
|
||||
return;
|
||||
}
|
||||
this.radiovalue = type;
|
||||
let name = this.paymentMethodName[type-1].name;
|
||||
this.$emit("groupChange",{type:type ,name: name })
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 去充值
|
||||
*/
|
||||
goRecharge() {
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.paymentMethod{
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
.paymentMethod_content{
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding:30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.paymentMethod_title{
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.method_list{
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
.method_list_top{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.method_list_top_left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon{
|
||||
width: 54.67rpx!important;
|
||||
height: 48rpx!important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
.name{
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.method_list_top_cen{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.method_list_bom{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.balance{
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.topUpNow{
|
||||
color: #FF803D;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.method_list:nth-child(odd){
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<template>
|
||||
<!-- 充值免单 -->
|
||||
<view class="rechargeFree">
|
||||
<view class="rechargeFree_bg" @click="changeFree">
|
||||
<view class="left">
|
||||
<view class="icon">优惠</view>
|
||||
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}倍(订单满¥{{freeDingConfig.rechargeThreshold}}元可用),本单立享免单!</view>
|
||||
</view>
|
||||
<u-checkbox-group iconPlacement="right" >
|
||||
<u-checkbox :disabled="freeDisabled" v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
||||
</u-checkbox>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
freeDisabled: false,
|
||||
}
|
||||
},
|
||||
props:{
|
||||
shopUserInfo:{
|
||||
type: Object
|
||||
},
|
||||
freeDingConfig:{
|
||||
type: Object
|
||||
},
|
||||
payAmount: {
|
||||
type: Number
|
||||
},
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
payAmount (newVal) {
|
||||
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
} else {
|
||||
this.freeDisabled = false
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
} else {
|
||||
this.freeDisabled = false
|
||||
}
|
||||
console.log(this.freeDisabled )
|
||||
},
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* 监听是否免单
|
||||
*/
|
||||
changeFree ( e ) {
|
||||
if ( this.freeDisabled ) {
|
||||
return;
|
||||
}
|
||||
this.$emit("changeFree",this.rechargeFreeChecked)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 充值免单
|
||||
.rechargeFree{
|
||||
// padding: 0 20rpx;
|
||||
margin-top: 32rpx;
|
||||
.rechargeFree_bg{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #fff;
|
||||
.left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon{
|
||||
width: 68rpx;
|
||||
height: 36rpx;
|
||||
text-align: center;
|
||||
line-height: 36rpx;
|
||||
background: linear-gradient( 180deg, #FEDE81 0%, #FEB263 100%);
|
||||
border-radius: 12rpx 0rpx 12rpx 0rpx;
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.text{
|
||||
width: 90%;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<template>
|
||||
<!-- 充值活动 -->
|
||||
<view class="topUp" v-if="list.length > 0">
|
||||
<view class="topUpActivity">
|
||||
<view class="topUpActivity_title">充值更划算</view>
|
||||
<view class="content">
|
||||
<view class="content_item" @click="goTopUp(item)" v-for="(item,index) in list" :key="index">
|
||||
<view class="fit">首充优惠</view>
|
||||
<view class="amount">{{ item.amount }}元</view>
|
||||
<view class="zs"><text class="zamount">赠{{ item.giftAmount }}元</text><text class="points">50积分</text></view>
|
||||
<view class="coupon">赠送2张优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
}
|
||||
},
|
||||
props:{
|
||||
shopUserInfo:{
|
||||
type: Object
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.shopUserInfo)
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 去充值
|
||||
*/
|
||||
goTopUp( item ) {
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopId'),
|
||||
type: "topUpActivity",
|
||||
amount: item.amount,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取充值数据
|
||||
*/
|
||||
async getData () {
|
||||
let res = await this.api.paygetActive({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
page: 1,
|
||||
pageSize: 99
|
||||
})
|
||||
this.list = res.data.list;
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.topUp{
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
padding: 0 20rpx;
|
||||
.topUpActivity{
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
.topUpActivity_title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.content{
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
padding-top: 32rpx;
|
||||
.content_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background: linear-gradient( 180deg, #FFF7E6 0%, #FFFFFF 100%);
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
border: 2rpx solid #FEE082;
|
||||
margin-right: 24rpx;
|
||||
padding: 22rpx 42rpx;
|
||||
flex-shrink: 0;
|
||||
.fit{
|
||||
width: 102rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient( 180deg, #FEE082 0%, #FFA158 100%);
|
||||
border-radius: 12rpx 0rpx 12rpx 0rpx;
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -14rpx;
|
||||
}
|
||||
.amount{
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.zs{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
margin-top: 12rpx;
|
||||
text{
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #666666;
|
||||
}
|
||||
text:nth-child(1){
|
||||
padding-right: 12rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
.coupon{
|
||||
padding: 6rpx 12rpx;
|
||||
background: rgba(250,236,205,0.88);
|
||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #F7955C;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -223,6 +223,14 @@
|
|||
orderForm.form.status = 'loadmore'
|
||||
navtabindex.value == '1' ? getorderList() : userorderList()
|
||||
}
|
||||
|
||||
const orderinfo = (e) => {
|
||||
uni.pro.navigateTo('order/detail', {
|
||||
orderId: e.id,
|
||||
shopId:e.shopId
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
init_fn()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -79,12 +79,9 @@
|
|||
});
|
||||
return false;
|
||||
}
|
||||
uni.pro.redirectTo('product/index', dinersNum.value)
|
||||
|
||||
uni.cache.set('dinersNum', dinersNum.value)
|
||||
uni.pro.redirectTo('product/index')
|
||||
}
|
||||
|
||||
uni.cache.get('tableCode')
|
||||
uni.cache.get('shopId')
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,232 +0,0 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/order/orderAMeal.png" mode="aspectFill"></image>
|
||||
<view class="content_box">
|
||||
<view class="content">
|
||||
<view class="title">
|
||||
<view class="title_text">请选择就餐人数</view>
|
||||
<view class="title_tabNum">桌号A2</view>
|
||||
</view>
|
||||
<view class="num" :class="{'active':numIndex==-1}">
|
||||
<view class="item" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">
|
||||
<view class="num_item" :class="{'active':numIndex==index }">{{index+1}}</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<u--input class="num_item" v-model="otherNum" :class="{'active':numIndex==-1 }" @input="isOtherNum" @focus="tabCut(-1)" @blur="blur()" border="none" type="nubmer" maxlength="3"></u--input>
|
||||
</view>
|
||||
<!-- <view class="num_item" v-else :class="{'active':numIndex==-1 }">其</view> -->
|
||||
</view>
|
||||
<view class="startBtn" @click="start">
|
||||
开始点餐
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableCode: null,
|
||||
shopId: null,
|
||||
numIndex: 0,
|
||||
otherNum: '其他',
|
||||
dinersNum: 1,
|
||||
type: ""
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.tableCode = options.tableCode;
|
||||
this.shopId = options.shopId;
|
||||
if ( options.type ) { this.type = options.type}
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
|
||||
isOtherNum (e) {
|
||||
this.$nextTick(() => {
|
||||
this.otherNum = this.otherNum.replace(/\D/g, '')
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 切换桌型
|
||||
*/
|
||||
tabCut(index) {
|
||||
this.numIndex = index;
|
||||
if ( index != -1) {
|
||||
this.dinersNum = index+1;
|
||||
} else {
|
||||
this.otherNum = this.otherNum == "其他" ? "" : this.otherNum;
|
||||
}
|
||||
},
|
||||
|
||||
blur ( index ) {
|
||||
this.otherNum = this.otherNum == "" ? "其他" : this.otherNum;
|
||||
},
|
||||
|
||||
/**
|
||||
* 开始点餐
|
||||
*/
|
||||
async start () {
|
||||
if ( this.numIndex == -1 && (this.otherNum == "其他"||this.otherNum <= 0)) {
|
||||
uni.showToast({
|
||||
title: '请选择就餐人数',
|
||||
icon: 'none',
|
||||
})
|
||||
return;
|
||||
}
|
||||
if ( this.numIndex == -1 && this.otherNum != "其他") {
|
||||
this.dinersNum = this.otherNum
|
||||
}
|
||||
|
||||
let res = await this.api.productChoseCount({
|
||||
tableId: this.tableCode,
|
||||
num: this.dinersNum,
|
||||
shopId: this.shopId,
|
||||
}) //判断是否支付成功
|
||||
if ( res.code == 0) {
|
||||
if( this.type == 'confirm') {
|
||||
uni.pro,navigateBack()
|
||||
} else {
|
||||
uni.pro.redirectTo('order_food/order_food', {
|
||||
// uni.pro.navigateTo('order_food/order_food', {
|
||||
tableCode: this.tableCode,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
// background: #f6f6f6;
|
||||
}
|
||||
.top_bg{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
}
|
||||
.content_box{
|
||||
width: 100%;
|
||||
padding: 0 28rpx;
|
||||
position: absolute;
|
||||
bottom: 148rpx;
|
||||
}
|
||||
.content{
|
||||
width: 100%;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 48rpx 0 32rpx 32rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 44rpx 44rpx 44rpx 44rpx;
|
||||
.title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 48rpx;
|
||||
padding-right: 32rpx;
|
||||
.title_text{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.title_tabNum{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
.num{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.item{
|
||||
width: 20%;
|
||||
padding-right: 32rpx;
|
||||
}
|
||||
.num_item{
|
||||
width: 100%;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
margin-right: 28rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #FEF4EB;
|
||||
border-radius: 12rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.num_item:nth-child(5n){
|
||||
margin-right: 0;
|
||||
}
|
||||
::v-deep .u-input{
|
||||
width: 100%;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #FEF4EB;
|
||||
border-radius: 12rpx;
|
||||
|
||||
}
|
||||
::v-deep input{
|
||||
font-weight: 400;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx!important;
|
||||
color: #333333!important;
|
||||
text-align: center!important;
|
||||
background-color: #FEF4EB!important;
|
||||
}
|
||||
.active{
|
||||
color: #fff;
|
||||
background-color: #E8AD7B;
|
||||
}
|
||||
|
||||
}
|
||||
::v-deep .num.active .u-input{
|
||||
width: 100%;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #E8AD7B!important;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
::v-deep .num.active input{
|
||||
color: #fff!important;
|
||||
border-radius: 12rpx;
|
||||
background-color: #E8AD7B!important;
|
||||
}
|
||||
|
||||
}
|
||||
.startBtn{
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
text-align: center;
|
||||
background-color: #E8AD7B;
|
||||
border-radius: 48rpx;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
|
@ -32,7 +32,6 @@
|
|||
const cartListsdatashow = ref(false)
|
||||
const showCart = ref(false)
|
||||
const orderdetail = () => {
|
||||
|
||||
if (this.cartLists.data.length == 0) {
|
||||
uni.showToast({
|
||||
title: '请先添加商品',
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<confirmorder :cartLists_count="cartLists_count" :cartList="matchedProducts" :totalPrices='totalPrices'
|
||||
:confirmordershow="confirmordershow" @close="confirmordershow = !confirmordershow"></confirmorder>
|
||||
<!-- 店铺详情 -->
|
||||
<shopindex ref="showShopInfoRef"></shopindex>
|
||||
<!-- 购物车 -->
|
||||
|
|
@ -241,7 +242,7 @@
|
|||
</shoppingCartes>
|
||||
|
||||
<!-- 显示购物车栏 -->
|
||||
<view class="cart-wrap" v-if="cartLists_count>0">
|
||||
<view class="cart-wrap" v-if="cartLists_count>0 && !confirmordershow">
|
||||
<view class="cart-content">
|
||||
<view class="left">
|
||||
<view class="iconBox">
|
||||
|
|
@ -253,7 +254,7 @@
|
|||
</view>
|
||||
|
||||
<text class="i">¥</text>
|
||||
<text class="num">{{TotalPrices}}</text>
|
||||
<text class="num">{{totalPrices}}</text>
|
||||
</view>
|
||||
<view class="btn" @tap="$u.debounce(orderdetail, 500)">
|
||||
<text class="t">去结算</text>
|
||||
|
|
@ -341,15 +342,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
|
||||
<!-- <view>
|
||||
<button @click="manualClose">手动关闭连接</button>
|
||||
<p>连接状态: {{ isConnected ? '已连接' : '未连接' }}</p>
|
||||
<view>收到的消息:</view>
|
||||
<view>
|
||||
<view v-for="(message, index) in receivedMessages" :key="index">{{ message }}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -360,7 +352,8 @@
|
|||
onMounted,
|
||||
watchEffect,
|
||||
getCurrentInstance,
|
||||
computed
|
||||
computed,
|
||||
watch
|
||||
} from "vue";
|
||||
|
||||
import {
|
||||
|
|
@ -374,6 +367,7 @@
|
|||
import Nav from '@/components/CustomNavbar.vue';
|
||||
import shopindex from './components/shopindex.vue'
|
||||
import shoppingCartes from './components/shoppingCartes.vue'
|
||||
import confirmorder from './components/confirmorder.vue'
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
|
|
@ -394,8 +388,14 @@
|
|||
import {
|
||||
useNavbarStore
|
||||
} from '@/stores/navbarStore';
|
||||
const store = useNavbarStore();
|
||||
|
||||
// 结账管理
|
||||
import {
|
||||
Memberpay
|
||||
} from '@/stores/pay.js';
|
||||
|
||||
const storeMemberpay = Memberpay();
|
||||
const store = useNavbarStore();
|
||||
|
||||
import {
|
||||
productStore
|
||||
|
|
@ -403,6 +403,12 @@
|
|||
|
||||
const userStore = productStore();
|
||||
|
||||
// 金额管理
|
||||
import {
|
||||
useCartStore
|
||||
} from '@/stores/order.js';
|
||||
const cartStore = useCartStore()
|
||||
|
||||
// 动态更新导航栏配置
|
||||
store.updateNavbarConfig({
|
||||
showBack: true, //左边返回键
|
||||
|
|
@ -413,7 +419,6 @@
|
|||
hasPlaceholder: false //是否要占位符
|
||||
});
|
||||
|
||||
const userInfo = uni.cache.get('userInfo')
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
const shopTable = uni.cache.get('shopTable')
|
||||
const distance = uni.cache.get('distance') //距离
|
||||
|
|
@ -434,9 +439,6 @@
|
|||
// 计算高度
|
||||
const navScroll = ref(null)
|
||||
|
||||
// 用餐人数
|
||||
const dinersNum = ref(0)
|
||||
|
||||
// 获取商品数据
|
||||
const shopProductList = reactive({
|
||||
hots: [],
|
||||
|
|
@ -809,6 +811,9 @@
|
|||
//购物车显示
|
||||
const showCart = ref(false)
|
||||
|
||||
// 提交订单显示
|
||||
const confirmordershow = ref(false)
|
||||
|
||||
// 购物车数组
|
||||
const cartList = ref([])
|
||||
|
||||
|
|
@ -863,14 +868,21 @@
|
|||
const Message = receivedMessages.value[receivedMessages.value.length - 1];
|
||||
if (Message) {
|
||||
// 心跳返回 过滤
|
||||
if (Message.type == "p") {
|
||||
if (Message.type == "ping_interval" || Message.msg_id == "ping_interval") {
|
||||
return false
|
||||
}
|
||||
|
||||
// 清空购物车
|
||||
if (Message.operate_type == 'shopping_cleanup') {
|
||||
cartList.value = []
|
||||
showCart.value = false
|
||||
// 初始化
|
||||
if (Message.operate_type == "shopping_init") {
|
||||
cartList.value = Message.data
|
||||
}
|
||||
|
||||
|
||||
// 购物车数据更新从新请求
|
||||
if (Message.type == 'product') {
|
||||
isDataLoaded.value = false;
|
||||
await productqueryProduct()
|
||||
// 数据可以更新
|
||||
}
|
||||
|
||||
// 初始化购物车数据
|
||||
|
|
@ -959,29 +971,27 @@
|
|||
}, 0);
|
||||
});
|
||||
|
||||
// 计算购物车商品费用
|
||||
const totalPrices = ref(0);
|
||||
|
||||
// 使用 computed 计算购物车总价格
|
||||
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.salePrice);
|
||||
}
|
||||
}, 0);
|
||||
// 是否免除桌位费 0否1是
|
||||
if (uni.cache.get('shopInfo').isTableFee == 0) {
|
||||
console.log( cart + dinersNum.value * parseFloat(uni.cache.get('shopInfo').tableFee))
|
||||
return cart + parseFloat(dinersNum.value) * parseFloat(uni.cache.get('shopInfo').tableFee)
|
||||
} else {
|
||||
return cart;
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
// 结账
|
||||
const orderdetail = async () => {
|
||||
confirmordershow.value = true
|
||||
}
|
||||
|
||||
// 定义 ifcartNumber 计算属性方法 展示数量
|
||||
const ifcartNumber = computed(() => {
|
||||
return (item) => {
|
||||
|
|
@ -1007,7 +1017,6 @@
|
|||
};
|
||||
})
|
||||
|
||||
|
||||
// 计算处理后的购物车列表 // 用于筛选后的购物车数组
|
||||
const cartListFilter = computed(() => {
|
||||
// 使用 reduce 方法对 cartList 进行处理
|
||||
|
|
@ -1034,20 +1043,6 @@
|
|||
}));
|
||||
})
|
||||
|
||||
// 结账
|
||||
|
||||
const orderdetail = () => {
|
||||
|
||||
if (this.cartLists.data.length == 0) {
|
||||
uni.showToast({
|
||||
title: '请先添加商品',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 列表请求
|
||||
const productqueryProduct = async () => {
|
||||
shopProductList.hots = await productminiApphotsquery()
|
||||
|
|
@ -1079,8 +1074,13 @@
|
|||
const currentPage = pages[pages.length - 1];
|
||||
// 获取页面参数
|
||||
const options = currentPage.options;
|
||||
dinersNum.value = options.dinersNum
|
||||
await productqueryProduct()
|
||||
|
||||
orderId.value = options.orderId
|
||||
let res = await APIshopUserInfo({
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
cartStore.shopInfo = uni.cache.get('shopInfo')
|
||||
setTimeout(() => {
|
||||
getElementTop()
|
||||
}, 500)
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@
|
|||
if (options.shopId) {
|
||||
fromInfo.shopId = options.shopId
|
||||
}
|
||||
// if (options.payAmount) {
|
||||
// this.payAmount = options.payAmount
|
||||
// }
|
||||
if (options.payAmount) {
|
||||
fromInfo.payAmount = options.payAmount
|
||||
}
|
||||
// if (options.orderId) {
|
||||
// fromInfo.orderId = options.orderId
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
],
|
||||
})
|
||||
|
||||
const userInfo = uni.cache.get('userInfo')
|
||||
const userInfo = uni.cache.get('shopUserInfo')
|
||||
// this.userInfo = uni.cache.get('userInfo')
|
||||
// this.userHeadImg = this.userInfo.headImg;
|
||||
// this.nickName = this.userInfo.nickName;
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ import {
|
|||
} from 'vue';
|
||||
|
||||
export const useCartStore = defineStore('cart', () => {
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
const shopInfo = null
|
||||
const dinersNum = uni.cache.get('dinersNum')
|
||||
|
||||
// 计算单个商品的打包费用(向下取整并保留两位小数)
|
||||
const itemSinglePackFee = (item) => {
|
||||
const fee = item.packFee * item.cartNumber;
|
||||
|
|
@ -44,9 +43,13 @@ export const useCartStore = defineStore('cart', () => {
|
|||
const getTotalSeatcharge = () => computed(() => {
|
||||
// 是否免除桌位费 0 否 1 是
|
||||
let tableFeeTotals = 0
|
||||
if (shopInfo.isTableFee == 0 && dinersNum) {
|
||||
const tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(shopInfo
|
||||
.tableFee) * 100) / 100;
|
||||
try {
|
||||
if (shopInfo.isTableFee == 0 && dinersNum) {
|
||||
const tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(shopInfo
|
||||
.tableFee) * 100) / 100;
|
||||
}
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
return Math.floor(tableFeeTotals * 100) / 100 ? Math.floor(tableFeeTotals * 100) / 100 : 0;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue