订单详情完善

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) => {
return request({
@ -31,3 +30,21 @@ export const APIuser = (data) => {
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

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

View File

@ -11,4 +11,31 @@ export const APIgeocodelocation = (data) => {
method: 'get',
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;
reconnectAttempts.value = 0;
// 监听初始化成功在开启心跳
startHeartbeat();
// startHeartbeat();
},
fail: () => {
console.error('WebSocket 连接失败,尝试重连');

View File

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

View File

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

View File

@ -42,9 +42,9 @@
import {
productStore
} 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) => {
console.log(11)
const store = productStore();
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 class="tabBox">
<view class="tabBox" v-if="listinfo.status == 'unpaid'">
<view class="tab">
<view v-for="(item,index) in tebtypeList" :key="index"
:class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'"
@ -132,8 +132,8 @@
<view class="favorable_right" :class="{column:item.value}" v-if="item.type=='product'">
<view :class="{column:item.value}">
<view class="favorable_right_text" v-if="item.value.uniqueIds">
<text>{{item.value.uniqueIds}}</text>
<text>-{{item.value.Productroll}}</text>
<text>{{item.value.uniqueIds}}</text>
<text>-{{item.value.Productroll}}</text>
</view>
</view>
<up-icon name="arrow-right" color="#575B66" size="16"
@ -146,25 +146,18 @@
<up-icon name="arrow-right" color="#575B66" size="16"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></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="18" size="18">
</up-checkbox>
</up-checkbox-group>
<!-- 积分 -->
<view class="favorable_right" v-if="item.type=='points'"
@click.stop="calcUsablePointsData.showModal = true">
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
v-if="calcUsablePointsData.integral">
使用 {{ calcUsablePointsData.integral}}
积分抵扣{{props.listinfo.pointsDiscountAmount}}
</text>
<up-icon v-else name="arrow-right" color="#575B66" size="16"></up-icon>
</view>
</view>
</view>
</block>
@ -236,6 +229,10 @@
<text class="info">{{ listinfo.seatNum || ""}}</text>
</view>
</view>
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
:maxValue="calcUsablePointsData.maxIntegral" :instructions="calcUsablePointsData.instructionText"
@confirm="handleConfirm" @close="calcUsablePointsData.showModal = false"
@IntegralInputclose="IntegralInputclose" />
</view>
</template>
@ -252,6 +249,14 @@
defineExpose
} from 'vue'
import IntegralInput from './IntegralInput.vue';
import {
APImemberPointsmyPoints,
APImemberPointscalcUsablePoints,
APImemberPointscalcDeductionAmount
} from '@/common/api/shop/index.js'
//
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 tabClick = (item, index) => {
@ -342,20 +338,12 @@
}
const childOnShow = () => {}
// * /
const changeCoupon = (data) => {}
const setPayAmount = (cartLists) => {}
// *
const pointsChange = () => {}
//
const goUrl = (item) => {
switch (item.type) {
case 'coupon':
//
IntegralInputclose()
uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_coupon",
shopId: uni.cache.get('orderVIP').shopId,
@ -365,6 +353,11 @@
})
break;
case 'product':
//
IntegralInputclose()
//
props.listinfo.coupondiscountAmount = 0
favorablelist[1].value = ''
uni.pro.navigateTo('/pages/order/coupon', {
type: "confirm_order_product",
shopId: uni.cache.get('orderVIP').shopId,
@ -373,11 +366,52 @@
shoppingCart: JSON.stringify(props.listinfo.combinedArray)
})
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) => {
@ -394,7 +428,8 @@
//
defineExpose({
dataprocessing
dataprocessing,
getCalcUsablePoints
});
</script>

View File

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

View File

@ -1,17 +1,19 @@
<template>
<view class="container">
<view class="headStatus"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
<view class="headStatus">
<view class="status">
<up-icon name="checkmark-circle-fill" color="#03C061" size="23"></up-icon>
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
待支付
</view>
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view>
<up-icon v-if="listinfo.status =='done'||listinfo.status =='unpaid'" name="checkmark-circle-fill"
color="#03C061" size="23"></up-icon>
<view class="statusName" v-if="listinfo.status == 'unpaid'">待支付</view>
<view class="statusName" v-if="listinfo.status=='done'">已完成</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 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 class="wxQrcode" v-if="shopQrcode">
@ -33,7 +35,8 @@
<!-- 先下单后支付 -->
<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>
<!-- 先支付后下单 -->
@ -60,7 +63,8 @@
</block> -->
<!-- 支付方式 -->
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange">
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
v-if="listinfo.status == 'unpaid'">
</paymentMethodes>
<!-- <paymentMethodes ref="paymentMethodes" :rechargeFreeChecked="rechargeFreeChecked"
v-if="orderVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck"
@ -81,7 +85,7 @@
</view>
</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>
</template>
@ -103,6 +107,11 @@
APIshopUserInfo
} from '@/common/api/member.js'
import {
APImemberPointsmyPoints,
APImemberPointscalcUsablePoints
} from '@/common/api/shop/index.js'
import {
useCartStore
} from '@/stores/order.js';
@ -144,8 +153,9 @@
const listinfo = reactive({
combinedArray: {},
Productroll: 0,
coupondiscountAmount: "",
couponInfoList: ''
coupondiscountAmount: 0,
couponInfoList: '',
pointsDiscountAmount: 0
})
//
@ -213,13 +223,15 @@
0 ? listinfo.Seatcharge : 0);
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 ==
0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo
.coupondiscountAmount || 0);
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
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) => {
console.log(data)
//
if (data.typeOrder == 1) {
//
listinfo.coupondiscountAmount = data.item.discountAmount
uniqueIds.value.push(data.item.id)
orderInfoAfterRef.value.dataprocessing(data)
if (data.item) {
//
listinfo.coupondiscountAmount = data.item.discountAmount
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 {
// id
uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))]
@ -295,7 +317,7 @@
orderId: orderId.value,
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
0, //使01
allPack: is_type.value == 0 ? 0 : 1, //
userAllPack: is_type.value == 0 ? 0 : 1, //
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //
originAmount: listinfo.originAmount, //+
discountRatio: 1, //( ) 1
@ -305,7 +327,7 @@
couponList: uniqueIds.value, //使
orderAmount: listinfo.totalCost, //
roundAmount: 0, //
pointsDiscountAmount: 0, //(tb_points_basic_setting)
pointsDiscountAmount: listinfo.pointsDiscountAmount, //(tb_points_basic_setting)
pointsNum: 0, //( enable_deduction使)
remark: '', //
}
@ -317,22 +339,68 @@
})
if (res) {
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) => {
console.log('输入的密码是:', pwd);
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(() => {
uni.$off('returnData', handleReturnData);
});
onMounted(async () => {
//
const pages = getCurrentPages();

View File

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

View File

@ -1,6 +1,6 @@
<template>
<view>
<Nav v-if="store.scrollTop>=44" />
<Nav />
<!-- 顶部面板 -->
<view class="top--panel">
<image class="panelimgbackground"
@ -98,7 +98,7 @@
<view class="Controls" v-else>
<view class="btn" v-if="item.cartNumber != '0'">
<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>
<text class="num"> {{ ifcartNumber(item) }} </text>
@ -106,7 +106,7 @@
v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text>
<view class="btn">
<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>
@ -419,7 +419,7 @@
store.updateNavbarConfig({
showBack: true, //
rightText: '', //
showSearch: true, //true
showSearch: false, //true
title: '',
isTransparent: false,
hasPlaceholder: false //
@ -561,6 +561,11 @@
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
uni.$u.debounce(navScroll.value = res.scrollTop, 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
} from '@/common/api/member.js'
import {
APIuserphone
} from '@/common/api/api.js'
const props = defineProps({
shopUserInfo: {
@ -167,8 +170,7 @@
//#ifdef MP-WEIXIN
let avatarUrl = e.detail.avatarUrl
uni.uploadFile({
url: uni.conf.baseUrl + '/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
url: uni.conf.baseUrl + '/account/user/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
@ -202,7 +204,7 @@
let avatarUrl = res.tempFilePaths[0]; //
my.uploadFile({
url: uni.conf.baseUrl + '/common/upload',
url: uni.conf.baseUrl + '/account/user/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
@ -236,8 +238,8 @@
//
const confirmTime = (e) => {
this.calendarShow = false;
this.birthDay = this.getDate(e.value);
calendarShow.value = false;
formInfo.birthDay = getDate(e.value);
}
//
@ -247,14 +249,13 @@
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
// let res = await APIshopUser({
// code: data.code,
// encryptedData: d.detail.encryptedData,
// iv: d.detail.iv,
// source: "wechar"
// })
formInfo.telephone = res.data
let res = await APIuserphone({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
source: "wechar"
})
formInfo.telephone = res
}
})
}
@ -267,11 +268,11 @@
console.log(res)
my.getPhoneNumber({
success: async (data) => {
let res = await this.api.userwxlogins({
let res = await APIuserphone({
encryptedData: JSON.parse(data.response).response,
source: "alipay"
})
this.telephone = res.data
formInfo.telephone = res
// console.log(this.phonetitle)
}
});
@ -331,12 +332,12 @@
});
return;
}
let res = await this.api.openMember({
id: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopId'),
let res = await APIshopUser({
// id: uni.cache.get('userInfo').id,
// shopId: uni.cache.get('shopId'),
nickName: formInfo.nickName,
headImg: userHeadImg.value,
telephone: formInfo.telephone,
phone: formInfo.telephone,
birthDay: formInfo.birthDay
})
if (res.code == 0) {

View File

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

View File

@ -8,7 +8,8 @@ import {
import {
APIpayltPayOrder,
APIpayltPayVip
APIpayltPayVip,
APIrefundVip
} from '@/common/api/pay.js'
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) {
return new Promise(async (resolve, reject) => {