订单详情完善

This commit is contained in:
wwz 2025-03-11 16:42:37 +08:00
parent 5342133cbd
commit cab9f836af
16 changed files with 506 additions and 126 deletions

View File

@ -21,7 +21,6 @@ export const APIuserlogin = (data) => {
}) })
} }
//用户信息获取 //用户信息获取
export const APIuser = (data) => { export const APIuser = (data) => {
return request({ return request({
@ -31,3 +30,21 @@ export const APIuser = (data) => {
toast: false toast: false
}) })
} }
//获取手机号
export const APIuserphone = (data) => {
return request({
url: url + '/user/phone',
method: 'post',
data: data
})
}
//文件上传
export const APIuserupload = (data) => {
return request({
url: url + '/user/common/upload',
method: 'post',
data: data
})
}

View File

@ -21,3 +21,12 @@ export const APIpayltPayOrder = (data) => {
data: data data: data
}) })
} }
// 会员退款
export const APIrefundVip = (data) => {
return request({
url: urlOrder + '/pay/vipPay',
method: 'post',
data: data
})
}

View File

@ -12,3 +12,30 @@ export const APIgeocodelocation = (data) => {
data: data data: data
}) })
} }
//001-会员积分账户信息
export const APImemberPointsmyPoints = (data) => {
return request({
url: urlAccount + '/user/points/memberPoints/myPoints',
method: 'get',
data: data
})
}
//002-获取订单可用积分及抵扣金额(支付页面使用)
export const APImemberPointscalcUsablePoints = (data) => {
return request({
url: urlAccount + '/user/points/memberPoints/calcUsablePoints',
method: 'get',
data: data
})
}
//003-根据积分计算可抵扣金额
export const APImemberPointscalcDeductionAmount = (data) => {
return request({
url: urlAccount + '/user/points/memberPoints/calcDeductionAmount',
method: 'get',
data: data
})
}

View File

@ -78,7 +78,7 @@ const useWebSocket = (options = {}) => {
isConnected.value = true; isConnected.value = true;
reconnectAttempts.value = 0; reconnectAttempts.value = 0;
// 监听初始化成功在开启心跳 // 监听初始化成功在开启心跳
startHeartbeat(); // startHeartbeat();
}, },
fail: () => { fail: () => {
console.error('WebSocket 连接失败,尝试重连'); console.error('WebSocket 连接失败,尝试重连');

View File

@ -34,7 +34,8 @@
watch, watch,
onMounted, onMounted,
computed, computed,
toRefs toRefs,
watchEffect
} from 'vue'; } from 'vue';
const store = useNavbarStore(); const store = useNavbarStore();
@ -63,7 +64,7 @@
const navbarStyle = computed(() => { const navbarStyle = computed(() => {
return { return {
// height: `${height}px`, // height: `${height}px`,store.showSearch=fa
backgroundColor: store.scrollTop >= 44 ? '#fff' : 'transparent' backgroundColor: store.scrollTop >= 44 ? '#fff' : 'transparent'
}; };
}); });
@ -72,6 +73,12 @@
oneStyle: {}, oneStyle: {},
towStyle: {} towStyle: {}
}); });
watchEffect(()=>{
if(store.showSearch>44){
}
})
onMounted(() => { onMounted(() => {
// #ifdef MP-WEIXIN || MP-ALIPAY // #ifdef MP-WEIXIN || MP-ALIPAY
const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); const menuButtonInfo = uni.getMenuButtonBoundingClientRect();

View File

@ -22,6 +22,7 @@
import { import {
ref, ref,
defineProps, defineProps,
defineExpose,
defineEmits defineEmits
} from 'vue'; } from 'vue';
@ -34,7 +35,7 @@
}); });
// //
const emits = defineEmits(['inputComplete', 'close']); const emits = defineEmits(['inputComplete', 'close', 'closeModal']);
// //
const password = ref(''); const password = ref('');
@ -56,6 +57,10 @@
emits('close'); emits('close');
password.value = ''; password.value = '';
}; };
//
defineExpose({
closeModal
});
</script> </script>
<style scoped> <style scoped>

View File

@ -42,9 +42,9 @@
import { import {
productStore productStore
} from '@/stores/user.js'; } from '@/stores/user.js';
const shopExtend = uni.cache.get('shopTable').shopExtendMap const shopExtend = uni.cache.get('shopUserInfo')? uni.cache.get('shopUserInfo').shopExtendList[0] : ''
const scanCodehandle = async (i) => { const scanCodehandle = async (i) => {
console.log(11)
const store = productStore(); const store = productStore();
await store.scanCodeactions() await store.scanCodeactions()
} }

View File

@ -0,0 +1,152 @@
<template>
<view class="integral-modal" v-if="visible">
<view class="modal-mask" @click="closeModal"></view>
<view class="modal-content">
<view class="input-wrapper">
<input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput"
placeholder="请输入积分" />
</view>
<view class="instructions">{{ instructions }}</view>
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
</view>
</view>
</template>
<script setup>
import {
ref,
defineProps,
defineEmits
} from 'vue';
//
const props = defineProps({
visible: {
type: Boolean,
default: false
},
minValue: {
type: Number,
default: 1
},
maxValue: {
type: Number,
default: 100
},
instructions: {
type: String,
default: '请输入有效积分值'
}
});
//
const emits = defineEmits(['confirm', 'close','IntegralInputclose']);
//
const inputValue = ref('');
//
const handleInput = (e) => {
//
let value = e.detail ? e.detail.value : (e.target ? e.target.value : '');
// if (value > props.maxValue || value < props.minValue) {
// inputValue.value = value > props.maxValue ? props.maxValue : props.minValue
// return false;
// }
//
value = value.replace(/\D/g, '');
if (value) {
value = parseInt(value, 10);
//
// if (value < props.minValue) {
// value = props.minValue;
// } else if (value > props.maxValue) {
// value = props.maxValue;
// }
inputValue.value = value.toString();
} else {
inputValue.value = '';
}
};
//
const confirmIntegral = () => {
console.log(inputValue.value, 444)
if (inputValue.value < props.minValue || inputValue.value > props.maxValue) {
uni.showToast({
title: '输入的积分值不在有效范围内',
icon: 'none'
});
return false;
}
if (inputValue.value) {
const value = parseInt(inputValue.value, 10);
if (value >= props.minValue && value <= props.maxValue) {
emits('confirm', value);
emits('close');
} else {
uni.showToast({
title: '输入的积分值不在有效范围内',
icon: 'none'
});
}
} else {
uni.showToast({
title: '请输入有效的积分值',
icon: 'none'
});
}
};
const IntegralInputclose = () => {
emits('IntegralInputclose');
}
//
const closeModal = () => {
emits('close');
};
</script>
<style scoped>
.integral-modal {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
}
.modal-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: #fff;
padding: 20px;
box-sizing: border-box;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
text-align: center;
}
.input-wrapper {
margin-bottom: 15px;
}
.instructions {
margin-bottom: 20px;
color: #666;
}
</style>

View File

@ -6,7 +6,7 @@
</view> </view>
<!-- 先付款 --> <!-- 先付款 -->
<view class="tabBox"> <view class="tabBox" v-if="listinfo.status == 'unpaid'">
<view class="tab"> <view class="tab">
<view v-for="(item,index) in tebtypeList" :key="index" <view v-for="(item,index) in tebtypeList" :key="index"
:class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'" :class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'"
@ -132,8 +132,8 @@
<view class="favorable_right" :class="{column:item.value}" v-if="item.type=='product'"> <view class="favorable_right" :class="{column:item.value}" v-if="item.type=='product'">
<view :class="{column:item.value}"> <view :class="{column:item.value}">
<view class="favorable_right_text" v-if="item.value.uniqueIds"> <view class="favorable_right_text" v-if="item.value.uniqueIds">
<text>{{item.value.uniqueIds}}</text> <text>{{item.value.uniqueIds}}</text>
<text>-{{item.value.Productroll}}</text> <text>-{{item.value.Productroll}}</text>
</view> </view>
</view> </view>
<up-icon name="arrow-right" color="#575B66" size="16" <up-icon name="arrow-right" color="#575B66" size="16"
@ -146,25 +146,18 @@
<up-icon name="arrow-right" color="#575B66" size="16" <up-icon name="arrow-right" color="#575B66" size="16"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></up-icon> v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></up-icon>
</view> </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" <view class="favorable_right" v-if="item.type=='points'"
:disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked" @click.stop="calcUsablePointsData.showModal = true">
activeColor="#E8AD7B" shape="circle" icon-size="18" size="18"> <text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
</up-checkbox> v-if="calcUsablePointsData.integral">
</up-checkbox-group> 使用 {{ calcUsablePointsData.integral}}
积分抵扣{{props.listinfo.pointsDiscountAmount}}
</text>
<up-icon v-else name="arrow-right" color="#575B66" size="16"></up-icon>
</view> </view>
</view> </view>
</view> </view>
</block> </block>
@ -236,6 +229,10 @@
<text class="info">{{ listinfo.seatNum || ""}}</text> <text class="info">{{ listinfo.seatNum || ""}}</text>
</view> </view>
</view> </view>
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
:maxValue="calcUsablePointsData.maxIntegral" :instructions="calcUsablePointsData.instructionText"
@confirm="handleConfirm" @close="calcUsablePointsData.showModal = false"
@IntegralInputclose="IntegralInputclose" />
</view> </view>
</template> </template>
@ -252,6 +249,14 @@
defineExpose defineExpose
} from 'vue' } from 'vue'
import IntegralInput from './IntegralInput.vue';
import {
APImemberPointsmyPoints,
APImemberPointscalcUsablePoints,
APImemberPointscalcDeductionAmount
} from '@/common/api/shop/index.js'
// //
const emits = defineEmits(['customevent', 'istype']); const emits = defineEmits(['customevent', 'istype']);
@ -315,15 +320,6 @@
} }
}) })
const calcUsablePointsData = reactive({
usable: '',
pointsNum: '',
equivalentPoints: '',
unusableReason: '',
})
const isPointsChecked = ref(false)
const is_type = ref(0) const is_type = ref(0)
// / // /
const tabClick = (item, index) => { const tabClick = (item, index) => {
@ -342,20 +338,12 @@
} }
const childOnShow = () => {}
// * /
const changeCoupon = (data) => {}
const setPayAmount = (cartLists) => {}
// *
const pointsChange = () => {}
// //
const goUrl = (item) => { const goUrl = (item) => {
switch (item.type) { switch (item.type) {
case 'coupon': case 'coupon':
//
IntegralInputclose()
uni.pro.navigateTo('/pages/order/coupon', { uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_coupon", type: "confirm_order_coupon",
shopId: uni.cache.get('orderVIP').shopId, shopId: uni.cache.get('orderVIP').shopId,
@ -365,6 +353,11 @@
}) })
break; break;
case 'product': case 'product':
//
IntegralInputclose()
//
props.listinfo.coupondiscountAmount = 0
favorablelist[1].value = ''
uni.pro.navigateTo('/pages/order/coupon', { uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_product", type: "confirm_order_product",
shopId: uni.cache.get('orderVIP').shopId, shopId: uni.cache.get('orderVIP').shopId,
@ -373,11 +366,52 @@
shoppingCart: JSON.stringify(props.listinfo.combinedArray) shoppingCart: JSON.stringify(props.listinfo.combinedArray)
}) })
break; break;
case 'points':
if (calcUsablePointsData.usable == 0) {
uni.showToast({
title: '此次订单不可用积分!'
})
return false;
}
calcUsablePointsData.showModal = true
break;
} }
} }
//
const calcUsablePointsData = reactive({
minIntegral: 1, //
maxIntegral: '', //
instructionText: '',
unusableReason: '',
showModal: false,
integral: ''
})
const handleConfirm = async (integral) => {
calcUsablePointsData.integral = integral
props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
points: integral,
userId: props.orderVIP.id,
orderAmount: props.listinfo.totalCost
})
emits('clickPointsamount', props.listinfo.pointsDiscountAmount);
};
// * // *
const getCalcUsablePoints = async () => {} const getCalcUsablePoints = async (data) => {
Object.assign(calcUsablePointsData, data);
calcUsablePointsData.minIntegral = data.minDeductionPoints
calcUsablePointsData.maxIntegral = data.maxUsablePoints
calcUsablePointsData.instructionText = `请输入 ${ data.minDeductionPoints} - ${data.maxUsablePoints} 之间的积分`
}
//
const IntegralInputclose = async () => {
calcUsablePointsData.integral = null
props.listinfo.pointsDiscountAmount = 0
calcUsablePointsData.showModal = false
}
// * // *
const copyHandle = (e) => { const copyHandle = (e) => {
@ -394,7 +428,8 @@
// //
defineExpose({ defineExpose({
dataprocessing dataprocessing,
getCalcUsablePoints
}); });
</script> </script>

View File

@ -64,11 +64,14 @@
</view> </view>
</view> </view>
<view style="height:120rpx;" v-if="Orderinfo.typeOrder == 2"></view> <view style="height:120rpx;"></view>
<view class="btnBox" v-if="Orderinfo.typeOrder == 2"> <view class="btnBox" v-if="Orderinfo.typeOrder == 2">
<view class="btn" @click="cancelCoupon">确定</view> <view class="btn" @click="cancelCoupon">确定</view>
</view> </view>
<view class="btnBox" v-else>
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
</view>
</view> </view>
</template> </template>
@ -256,12 +259,24 @@
console.log(res) console.log(res)
} }
//
const cancelCoupon = () => { const cancelCoupon = () => {
uni.$emit('returnData', Selectedlist.value); uni.$emit('returnData', Selectedlist.value);
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
} }
//
const IntegralInputclose = () => {
uni.$emit('returnData', {
typeOrder: Orderinfo.typeOrder,
});
uni.navigateBack({
delta: 1
});
}
onMounted(async () => { onMounted(async () => {
// //
const pages = getCurrentPages(); const pages = getCurrentPages();

View File

@ -1,17 +1,19 @@
<template> <template>
<view class="container"> <view class="container">
<view class="headStatus" <view class="headStatus">
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
<view class="status"> <view class="status">
<up-icon name="checkmark-circle-fill" color="#03C061" size="23"></up-icon> <up-icon v-if="listinfo.status =='done'||listinfo.status =='unpaid'" name="checkmark-circle-fill"
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"> color="#03C061" size="23"></up-icon>
待支付 <view class="statusName" v-if="listinfo.status == 'unpaid'">待支付</view>
</view> <view class="statusName" v-if="listinfo.status=='done'">已完成</view>
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view> <view class="statusName" v-if="listinfo.status=='refund'">退单</view>
<view class="statusName" v-if="listinfo.status=='part-refund'">部分退单</view>
<view class="statusName" v-if="listinfo.status=='cancelled'">取消订单</view>
</view>
<view class="time" v-if="listinfo.createTime">下单时间{{ listinfo.createTime }}</view>
<view class="time" v-if="listinfo.paidTime && (listinfo.status!='cancelled' ||listinfo.status!='unpaid')">
付款时间{{listinfo.paidTime}}
</view> </view>
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
下单时间{{ listinfo.createTime }}</view>
<view class="time" v-if="listinfo.status=='closed'">付款时间{{listinfo.paidTime}}</view>
</view> </view>
<view class="wxQrcode" v-if="shopQrcode"> <view class="wxQrcode" v-if="shopQrcode">
@ -33,7 +35,8 @@
<!-- 先下单后支付 --> <!-- 先下单后支付 -->
<orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck" <orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck"
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"> :listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"
@clickPointsamount='clickPointsamount'>
</orderInfoAfter> </orderInfoAfter>
<!-- 先支付后下单 --> <!-- 先支付后下单 -->
@ -60,7 +63,8 @@
</block> --> </block> -->
<!-- 支付方式 --> <!-- 支付方式 -->
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"> <paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
v-if="listinfo.status == 'unpaid'">
</paymentMethodes> </paymentMethodes>
<!-- <paymentMethodes ref="paymentMethodes" :rechargeFreeChecked="rechargeFreeChecked" <!-- <paymentMethodes ref="paymentMethodes" :rechargeFreeChecked="rechargeFreeChecked"
v-if="orderVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck" v-if="orderVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck"
@ -81,7 +85,7 @@
</view> </view>
</view> </view>
<view style="width: 100%;height: 200rpx;"> </view> <view style="width: 100%;height: 200rpx;"> </view>
<payPassword :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" /> <payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
</view> </view>
</template> </template>
@ -103,6 +107,11 @@
APIshopUserInfo APIshopUserInfo
} from '@/common/api/member.js' } from '@/common/api/member.js'
import {
APImemberPointsmyPoints,
APImemberPointscalcUsablePoints
} from '@/common/api/shop/index.js'
import { import {
useCartStore useCartStore
} from '@/stores/order.js'; } from '@/stores/order.js';
@ -144,8 +153,9 @@
const listinfo = reactive({ const listinfo = reactive({
combinedArray: {}, combinedArray: {},
Productroll: 0, Productroll: 0,
coupondiscountAmount: "", coupondiscountAmount: 0,
couponInfoList: '' couponInfoList: '',
pointsDiscountAmount: 0
}) })
// //
@ -213,13 +223,15 @@
0 ? listinfo.Seatcharge : 0); 0 ? listinfo.Seatcharge : 0);
listinfo.originAmount = Math.round(sum * 100) / 100; listinfo.originAmount = Math.round(sum * 100) / 100;
// packFee totalPrices Seatcharge Productroll coupondiscountAmount // packFee totalPrices Seatcharge Productroll coupondiscountAmount listinfo.pointsDiscountAmount
let sums = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value == let sums = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value ==
0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo 0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo
.coupondiscountAmount || 0); .coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
listinfo.totalCost = Math.round(sums * 100) / 100; listinfo.totalCost = Math.round(sums * 100) / 100;
console.log(listinfo.totalCost) //
// totalCost.value = Math.round(sums * 100) / 100; if (listinfo.totalCost) {
await memberPointscalcUsablePoints()
}
} }
}); });
@ -263,13 +275,23 @@
// //
const handleReturnData = async (data) => { const handleReturnData = async (data) => {
console.log(data)
// //
if (data.typeOrder == 1) { if (data.typeOrder == 1) {
// if (data.item) {
listinfo.coupondiscountAmount = data.item.discountAmount //
uniqueIds.value.push(data.item.id) listinfo.coupondiscountAmount = data.item.discountAmount
orderInfoAfterRef.value.dataprocessing(data) uniqueIds.value.push(data.item.id)
orderInfoAfterRef.value.dataprocessing(data)
} else {
if (listinfo.coupondiscountAmount > 0) {
listinfo.coupondiscountAmount = 0
uniqueIds.value.pop()
orderInfoAfterRef.value.dataprocessing({
typeOrder: 1,
item: ''
})
}
}
} else { } else {
// id // id
uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))] uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))]
@ -295,7 +317,7 @@
orderId: orderId.value, orderId: orderId.value,
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 : vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
0, //使01 0, //使01
allPack: is_type.value == 0 ? 0 : 1, // userAllPack: is_type.value == 0 ? 0 : 1, //
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, // seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //
originAmount: listinfo.originAmount, //+ originAmount: listinfo.originAmount, //+
discountRatio: 1, //( ) 1 discountRatio: 1, //( ) 1
@ -305,7 +327,7 @@
couponList: uniqueIds.value, //使 couponList: uniqueIds.value, //使
orderAmount: listinfo.totalCost, // orderAmount: listinfo.totalCost, //
roundAmount: 0, // roundAmount: 0, //
pointsDiscountAmount: 0, //(tb_points_basic_setting) pointsDiscountAmount: listinfo.pointsDiscountAmount, //(tb_points_basic_setting)
pointsNum: 0, //( enable_deduction使) pointsNum: 0, //( enable_deduction使)
remark: '', // remark: '', //
} }
@ -317,22 +339,68 @@
}) })
if (res) { if (res) {
await orderorderInfo() await orderorderInfo()
// uni.redirectTo({
// url: '/order/detail?orderId=' + res.id
// });
} }
} }
//002-使
const memberPointscalcUsablePoints = async () => {
let res = await APImemberPointscalcUsablePoints({
userId: orderVIP.value.id,
orderAmount: listinfo.totalCost,
})
orderInfoAfterRef.value.getCalcUsablePoints(res)
}
//
const clickPointsamount = (Pointsamount) => {
listinfo.pointsDiscountAmount = Pointsamount
}
const payPasswordref = ref(null)
// //
const accountPayevent = async (pwd) => { const accountPayevent = async (pwd) => {
console.log('输入的密码是:', pwd); console.log('输入的密码是:', pwd);
ispws.value = false; ispws.value = false;
let checkOrderPay = {
userId: uni.cache.get('userInfo').id,
orderId: orderId.value,
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
0, //使01
userAllPack: is_type.value == 0 ? 0 : 1, //
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //
originAmount: listinfo.originAmount, //+
discountRatio: 1, //( ) 1
discountAmount: 0, // 0
productCouponDiscountAmount: listinfo.Productroll, //
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //
couponList: uniqueIds.value, //使
orderAmount: listinfo.totalCost, //
roundAmount: 0, //
pointsDiscountAmount: listinfo.pointsDiscountAmount, //(tb_points_basic_setting)
pointsNum: 0, //( enable_deduction使)
remark: '', //
}
try {
let res = await storeMemberpay.balancePayOrder({
checkOrderPay,
payType: paymentmethod.payType,
pwd: pwd,
shopUserId: orderVIP.value.id,
buyerRemark: '',
returnUrl: ''
})
await orderorderInfo()
} catch (error) {
//TODO handle the exception
}
payPasswordref.value.closeModal()
} }
onUnmounted(() => { onUnmounted(() => {
uni.$off('returnData', handleReturnData); uni.$off('returnData', handleReturnData);
}); });
onMounted(async () => { onMounted(async () => {
// //
const pages = getCurrentPages(); const pages = getCurrentPages();

View File

@ -42,7 +42,7 @@
<view class="price"> <view class="price">
<view class="priceAmount"> <view class="priceAmount">
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}} {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.price}}
</view> </view>
<view class="num">x{{item.num}}</view> <view class="num">x{{item.num}}</view>
</view> </view>
@ -57,7 +57,6 @@
<!-- 订单内容区域 --> <!-- 订单内容区域 -->
<view class="content_box"> <view class="content_box">
<text class="placeNum">购物车</text>
<view class="content"> <view class="content">
<view class="title"> {{ shopInfo.name }} </view> <view class="title"> {{ shopInfo.name }} </view>
<view class="list_item" v-for="(item,index) in cartList" :key="item.id"> <view class="list_item" v-for="(item,index) in cartList" :key="item.id">
@ -218,7 +217,7 @@
return total + parseFloat(item.memberPrice) * parseFloat(item.num); return total + parseFloat(item.memberPrice) * parseFloat(item.num);
} else { } else {
// salePrice // salePrice
return total + parseFloat(item.salePrice) * parseFloat(item.num); return total + parseFloat(item.price) * parseFloat(item.num);
} }
}, 0); }, 0);
console.log(cartone) console.log(cartone)
@ -436,7 +435,7 @@
.head { .head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 32rpx 0; // padding: 32rpx 0;
.head_left { .head_left {
display: flex; display: flex;
@ -780,7 +779,7 @@
.head_bg { .head_bg {
height: 456rpx; height: 456rpx;
background: linear-gradient(180deg, #E8AD7B 0%, #F5F5F5 100%); // background: linear-gradient(180deg, #E8AD7B 0%, #F5F5F5 100%);
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;

View File

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<Nav v-if="store.scrollTop>=44" /> <Nav />
<!-- 顶部面板 --> <!-- 顶部面板 -->
<view class="top--panel"> <view class="top--panel">
<image class="panelimgbackground" <image class="panelimgbackground"
@ -98,7 +98,7 @@
<view class="Controls" v-else> <view class="Controls" v-else>
<view class="btn" v-if="item.cartNumber != '0'"> <view class="btn" v-if="item.cartNumber != '0'">
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"></up-icon> <up-icon name="minus-circle-fill" color="#E9AB7A" size="25"></up-icon>
<view class="btnClick" @click.stop="shoppingcart(item,index,'-','单')"> <view class="btnClick" @click.stop="singleclick(item,'-')">
</view> </view>
</view> </view>
<text class="num"> {{ ifcartNumber(item) }} </text> <text class="num"> {{ ifcartNumber(item) }} </text>
@ -106,7 +106,7 @@
v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text> v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text>
<view class="btn"> <view class="btn">
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon> <up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
<view class="btnClick" @click.stop="shoppingcart(item,index,'+','单')"> <view class="btnClick" @click.stop="singleclick(item,'+')">
</view> </view>
</view> </view>
</view> </view>
@ -419,7 +419,7 @@
store.updateNavbarConfig({ store.updateNavbarConfig({
showBack: true, // showBack: true, //
rightText: '', // rightText: '', //
showSearch: true, //true showSearch: false, //true
title: '', title: '',
isTransparent: false, isTransparent: false,
hasPlaceholder: false // hasPlaceholder: false //
@ -561,6 +561,11 @@
uni.$u.debounce(store.scrollTop = res.scrollTop, 500) uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
uni.$u.debounce(navScroll.value = res.scrollTop, 500) uni.$u.debounce(navScroll.value = res.scrollTop, 500)
uni.$u.debounce(mainScroll(res), 500) uni.$u.debounce(mainScroll(res), 500)
if(res.scrollTop >= 44){
store.showSearch = true
}else{
store.showSearch = false
}
}); });
// //

View File

@ -92,6 +92,9 @@
APIshopUser APIshopUser
} from '@/common/api/member.js' } from '@/common/api/member.js'
import {
APIuserphone
} from '@/common/api/api.js'
const props = defineProps({ const props = defineProps({
shopUserInfo: { shopUserInfo: {
@ -167,8 +170,7 @@
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
let avatarUrl = e.detail.avatarUrl let avatarUrl = e.detail.avatarUrl
uni.uploadFile({ uni.uploadFile({
url: uni.conf.baseUrl + '/common/upload', url: uni.conf.baseUrl + '/account/user/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl, filePath: avatarUrl,
header: { header: {
environment: 'app', environment: 'app',
@ -202,7 +204,7 @@
let avatarUrl = res.tempFilePaths[0]; // let avatarUrl = res.tempFilePaths[0]; //
my.uploadFile({ my.uploadFile({
url: uni.conf.baseUrl + '/common/upload', url: uni.conf.baseUrl + '/account/user/common/upload',
filePath: avatarUrl, filePath: avatarUrl,
header: { header: {
environment: 'app', environment: 'app',
@ -236,8 +238,8 @@
// //
const confirmTime = (e) => { const confirmTime = (e) => {
this.calendarShow = false; calendarShow.value = false;
this.birthDay = this.getDate(e.value); formInfo.birthDay = getDate(e.value);
} }
// //
@ -247,14 +249,13 @@
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async (data) => { success: async (data) => {
console.log(data) let res = await APIuserphone({
// let res = await APIshopUser({ code: data.code,
// code: data.code, encryptedData: d.detail.encryptedData,
// encryptedData: d.detail.encryptedData, iv: d.detail.iv,
// iv: d.detail.iv, source: "wechar"
// source: "wechar" })
// }) formInfo.telephone = res
formInfo.telephone = res.data
} }
}) })
} }
@ -267,11 +268,11 @@
console.log(res) console.log(res)
my.getPhoneNumber({ my.getPhoneNumber({
success: async (data) => { success: async (data) => {
let res = await this.api.userwxlogins({ let res = await APIuserphone({
encryptedData: JSON.parse(data.response).response, encryptedData: JSON.parse(data.response).response,
source: "alipay" source: "alipay"
}) })
this.telephone = res.data formInfo.telephone = res
// console.log(this.phonetitle) // console.log(this.phonetitle)
} }
}); });
@ -331,12 +332,12 @@
}); });
return; return;
} }
let res = await this.api.openMember({ let res = await APIshopUser({
id: uni.cache.get('userInfo').id, // id: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopId'), // shopId: uni.cache.get('shopId'),
nickName: formInfo.nickName, nickName: formInfo.nickName,
headImg: userHeadImg.value, headImg: userHeadImg.value,
telephone: formInfo.telephone, phone: formInfo.telephone,
birthDay: formInfo.birthDay birthDay: formInfo.birthDay
}) })
if (res.code == 0) { if (res.code == 0) {

View File

@ -16,11 +16,19 @@ export const useCartStore = defineStore('cart', () => {
// const isTableFee = uni.cache.get('ordershopUserInfo').isTableFee //此店是否免桌位费 // const isTableFee = uni.cache.get('ordershopUserInfo').isTableFee //此店是否免桌位费
// const tableFee = uni.cache.get('ordershopUserInfo').tableFee //一个餐位费多钱 // const tableFee = uni.cache.get('ordershopUserInfo').tableFee //一个餐位费多钱
// 计算单个商品的打包费用(向下取整并保留两位小数) // 计算向上取整
const itemSinglePackFee = (item) => { const roundUpToTwoDecimals = (num, i) => {
const fee = item.packFee * item.cartNumber; // 先将数字乘以 100 并转换为字符串保留足够的小数位
// 先将结果乘以 100向下取整再除以 100 以保留两位小数 let temp = (num * 100).toFixed(10);
return Math.floor(fee * 100) / 100 // 向上取整
let rounded = null
if (i == 'upward') {
rounded = Math.ceil(parseFloat(temp));
} else {
rounded = Math.floor(parseFloat(temp));
}
// 再除以 100 得到保留两位小数的结果
return rounded / 100;
}; };
// 计算购物车商品总价格 // 计算购物车商品总价格
@ -43,7 +51,8 @@ export const useCartStore = defineStore('cart', () => {
} }
}, 0); }, 0);
// 向上取整并保留两位小数 // 向上取整并保留两位小数
return cart = Math.ceil(cart * 100) / 100; let result = roundUpToTwoDecimals(cart, 'upward')
return result;
}); });
// 计算商品卷所选择的总价格 // 计算商品卷所选择的总价格
@ -64,34 +73,33 @@ export const useCartStore = defineStore('cart', () => {
} }
}, 0); }, 0);
// 向上取整并保留两位小数 // 向上取整并保留两位小数
return cart = Math.ceil(cart * 100) / 100; let result = roundUpToTwoDecimals(cart, 'upward')
return result;
}); });
// 桌位置 // 桌位置
const getTotalSeatcharge = (seatNum) => computed(() => { const getTotalSeatcharge = (seatNum) => computed(() => {
// 是否免除桌位费 0 否 1 是 // 是否免除桌位费 0 否 1 是
let tableFeeTotals = 0 let cart = 0
if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && (seatNum || uni.cache.get('dinersNum'))) { if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && seatNum) {
tableFeeTotals = Math.ceil(parseFloat((seatNum || uni.cache.get('dinersNum'))) * parseFloat( cart = Math.ceil(parseFloat(seatNum) * parseFloat(
uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100; uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
} }
console.log(uni.cache.get('ordershopUserInfo').isTableFee,seatNum,22222) // 向下取整并保留两位小数
return Math.floor(tableFeeTotals * 100) / 100; let result = roundUpToTwoDecimals(cart, 'downward')
return result;
}); });
// 计算购物车总打包费用(向下取整并保留两位小数) // 计算购物车总打包费用(向下取整并保留两位小数)
const getTotalPackFee = (cartList) => computed(() => { const getTotalPackFee = (cartList) => computed(() => {
let total = 0; const total = cartList.reduce((sum, item) => {
for (const item of cartList) { return sum + item.packAmount * (item.packNumber || (item.num - item.returnNum));
total += itemSinglePackFee(item); }, 0);
} return Math.floor(total * 100) / 100;
return Math.floor(total * 100) / 100 ? Math.floor(total * 100) / 100 : 0;
// 同样对总费用进行向下取整并保留两位小数处理
}); });
return { return {
itemSinglePackFee,
getTotalPackFee, getTotalPackFee,
getTotalSeatcharge, getTotalSeatcharge,
getTotalTotalPrices, getTotalTotalPrices,

View File

@ -8,7 +8,8 @@ import {
import { import {
APIpayltPayOrder, APIpayltPayOrder,
APIpayltPayVip APIpayltPayVip,
APIrefundVip
} from '@/common/api/pay.js' } from '@/common/api/pay.js'
import { import {
@ -182,6 +183,37 @@ export const Memberpay = defineStore('memberpay', {
}) })
}, },
//会员支付
balancePayOrder(data) {
return new Promise(async (resolve, reject) => {
try {
let res = await APIrefundVip({
shopId: uni.cache.get('shopId'),
checkOrderPay: data.checkOrderPay,
pwd: data.pwd,
payType: 'accountPay',
returnUrl: data.returnUrl,
buyerRemark: data.buyerRemark,
shopUserId: data.shopUserId,
})
if (res) {
uni.showLoading({
title: '加载中...',
mask: true
})
}
} catch (e) {
uni.showToast({
title: "支付失败"
})
setTimeout(() => {
uni.hideLoading()
}, 1000)
reject(false)
}
})
},
// 生成订单 // 生成订单
actionscreateOrder(data) { actionscreateOrder(data) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {