完成订单详情

This commit is contained in:
wwz
2025-03-13 09:15:51 +08:00
parent 7dde4ed754
commit e6ca187e5a
14 changed files with 219 additions and 176 deletions

50
App.vue
View File

@@ -26,58 +26,12 @@
try { try {
const storelogin = Storelogin(); const storelogin = Storelogin();
await storelogin.actionslogin() await storelogin.actionslogin()
proxy.$isResolve()
} catch (error) { } catch (error) {
proxy.$isResolve()
console.log(error) console.log(error)
} }
// #endif // #endif
try {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await APIgeocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres) {
let datastorage = {
country: successres.addressComponent.country, // "中国"
province: successres.addressComponent
.province, //province: "陕西省"
address: successres.addressComponent.city, //district: "西安市"
district: successres.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
// 登录
proxy.$isResolve()
}
},
});
} catch (error) {
try {
let successres = await APIgeocodelocation({
lng: '',
lat: '',
})
if (successres) {
let datastorage = {
country: successres.addressComponent.country, // "中国"
province: successres.addressComponent
.province, //province: "陕西省"
address: successres.addressComponent.city, //district: "西安市"
district: successres.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
proxy.$isResolve()
}
} catch (error) {
proxy.$isResolve()
}
}
}); });
// export default { // export default {

View File

@@ -47,4 +47,22 @@ export const APIuserupload = (data) => {
method: 'post', method: 'post',
data: data data: data
}) })
}
//用户密码修改
export const APIuserpwd = (data) => {
return request({
url: url + '/user/pwd',
method: 'put',
data: data
})
}
//验证码获取
export const APIusercode = (data) => {
return request({
url: url + '/user/code',
method: 'get',
data: data
})
} }

View File

@@ -56,14 +56,13 @@ const useWebSocket = (options = {}) => {
// 连接 WebSocket // 连接 WebSocket
const connect = () => { const connect = () => {
if (!isNetworkConnected.value) { if (!isNetworkConnected.value) {
uni.showToast({ uni.showToast({
title: '网络未连接...', title: '网络未连接...',
icon: 'none' icon: 'none'
}) })
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.pro.switchTab('index/index')
}, 1000) }, 1000)
console.log('网络未连接,暂不尝试连接 WebSocket'); console.log('网络未连接,暂不尝试连接 WebSocket');
return; return;
@@ -112,7 +111,6 @@ const useWebSocket = (options = {}) => {
clearTimeout(reconnectTimer.value); // 清除重连定时器 clearTimeout(reconnectTimer.value); // 清除重连定时器
if (res.code == '1006') { if (res.code == '1006') {
console.log('服务器正常关闭,停止重连'); console.log('服务器正常关闭,停止重连');
uni.navigateBack()
autoReconnect.value = false; autoReconnect.value = false;
return false; return false;
} }
@@ -143,7 +141,7 @@ const useWebSocket = (options = {}) => {
icon: 'none' icon: 'none'
}) })
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.pro.switchTab('index/index')
}, 1000) }, 1000)
return; return;
} }
@@ -184,7 +182,6 @@ const useWebSocket = (options = {}) => {
// 手动关闭连接 // 手动关闭连接
const closeSocket = () => { const closeSocket = () => {
isManuallyClosed.value = true; isManuallyClosed.value = true;
uni.navigateBack()
closeExistingConnection(); closeExistingConnection();
}; };
@@ -230,7 +227,6 @@ const useWebSocket = (options = {}) => {
title: '重连次数达到上限,停止重连', title: '重连次数达到上限,停止重连',
icon: 'none' icon: 'none'
}); });
uni.navigateBack()
} }
}; };

View File

@@ -49,13 +49,14 @@
} }
if (password.value.length === 6) { if (password.value.length === 6) {
emits('inputComplete', password.value); emits('inputComplete', password.value);
password.value = ''
} }
}; };
// 关闭模态框 // 关闭模态框
const closeModal = () => { const closeModal = () => {
emits('close'); emits('close');
password.value = ''; password = '';
}; };
// 将方法暴露给父组件 // 将方法暴露给父组件
defineExpose({ defineExpose({

View File

@@ -13,8 +13,10 @@
<view class="method_list_top_cen"> <view class="method_list_top_cen">
<view class="name"> {{ item.name }} </view> <view class="name"> {{ item.name }} </view>
<view class="method_list_bom" v-if="item.type == 1"> <view class="method_list_bom" v-if="item.type == 1">
<text class="balance">会员卡余额 {{orderVIP?orderVIP.amount:0}}</text> <text class="balance" v-if="orderVIP.isVip == 1">
<text class="topUpNow" @click="goRecharge">去充值</text> 会员卡余额{{orderVIP?orderVIP.amount:0}}</text>
<text class="topUpNow"
@click="goRecharge">{{orderVIP.isVip == 0?'注册会员':'去充值'}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -60,14 +62,15 @@
} }
}); });
const emits = defineEmits(['customevent', 'groupChange']); const emits = defineEmits(['customevent', 'groupChange']);
const paymentMethodList = ref([{ const paymentMethodList = ref([{
name: "余额支付", name: "余额支付",
type: 1, type: 1,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
payType: '' payType: 'accountPay'
}, },
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
{ {
@@ -92,7 +95,7 @@
name: "余额支付", name: "余额支付",
type: 1, type: 1,
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
payType: '' payType: 'accountPay'
}, },
{ {
name: "微信支付", name: "微信支付",

View File

@@ -10,7 +10,7 @@
<!-- 金刚区 --> <!-- 金刚区 -->
<diamond :district='hometoplist.district'></diamond> <diamond :district='hometoplist.district'></diamond>
<!-- 今日上线 --> <!-- 今日上线 -->
<todaylist :todayList='hometoplist.todayProInfo' :salesList="hometoplist.hotRanking" ></todaylist> <todaylist :todayList='hometoplist.todayProInfo' :salesList="hometoplist.hotRanking"></todaylist>
<!-- 类目 --> <!-- 类目 -->
<view :style="{'top':store.height+'px'}" class="fourcontent" id="fourcontent"> <view :style="{'top':store.height+'px'}" class="fourcontent" id="fourcontent">
<view class="flex-between" style="flex-wrap: inherit;"> <view class="flex-between" style="flex-wrap: inherit;">
@@ -25,10 +25,10 @@
</view> </view>
<view class="componentsclass" v-if="showproductlist"> <view class="componentsclass" v-if="showproductlist">
<AreaSelect v-if="viewHistoryindex == 0" @updateValue="openproductlist" /> <AreaSelect v-if="viewHistoryindex == 0" @updateValue="openproductlist" />
<grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3" <grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3"
@grouping="openproductlist" /> @grouping="openproductlist" />
</view> </view>
</view> </view>
<!-- 首页抢购区域 --> <!-- 首页抢购区域 -->
<view class="fivecontent"> <view class="fivecontent">
@@ -164,6 +164,9 @@
APIhomehomePageUp, APIhomehomePageUp,
APIhome APIhome
} from "@/common/api/index/index.js" } from "@/common/api/index/index.js"
import {
APIgeocodelocation
} from "@/common/api/api.js"
import { import {
useNavbarStore useNavbarStore
} from '@/stores/navbarStore'; } from '@/stores/navbarStore';
@@ -203,16 +206,16 @@
const refbannervo = ref(null); const refbannervo = ref(null);
//数据 //数据
const hometoplist = reactive({ const hometoplist = reactive({
}) })
// 首页上面数据 // 首页上面数据
const hometop = async () => { const hometop = async () => {
try { try {
let res = await APIhomehomePageUp() let res = await APIhomehomePageUp()
Object.assign(hometoplist, res) Object.assign(hometoplist, res)
hometoplist.freeBannerList.forEach((item, index) => { hometoplist.freeBannerList.forEach((item, index) => {
advertisementStyle.value.push(getStyle(index)) advertisementStyle.value.push(getStyle(index))
}) })
// 数据加载完后获取dom 高度 // 数据加载完后获取dom 高度
setTimeout(() => { setTimeout(() => {
const query = uni.createSelectorQuery().select('#fourcontent'); const query = uni.createSelectorQuery().select('#fourcontent');
@@ -231,7 +234,7 @@
page: 1, //页数 page: 1, //页数
size: 10, //页容量 size: 10, //页容量
status: 'loadmore', status: 'loadmore',
name:'1' name: '1'
}) })
// 使用 reactive 创建响应式对象 // 使用 reactive 创建响应式对象
const timeData = ref({}); const timeData = ref({});
@@ -334,10 +337,9 @@
isSticky.value = res.scrollTop > elementTop.value ? true : false isSticky.value = res.scrollTop > elementTop.value ? true : false
uni.$u.debounce(store.scrollTop = res.scrollTop, 500) uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
}); });
onShow(() => {}) onShow(async () => {
onMounted(async () => {
await proxy.$onLaunched; await proxy.$onLaunched;
if (uni.cache.get('shopId') && uni.cache.get('token')) { if (uni.cache.get('shopId')) {
showindex.value = 'shopIndex' showindex.value = 'shopIndex'
await storeuser.actionsAPIuser() await storeuser.actionsAPIuser()
} else { } else {
@@ -346,6 +348,56 @@
showindex.value = 'index' showindex.value = 'index'
// 获取初始定位高度 // 获取初始定位高度
} }
})
onMounted(async () => {
try {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await APIgeocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres) {
let datastorage = {
country: successres.addressComponent.country, // "中国"
province: successres.addressComponent
.province, //province: "陕西省"
address: successres.addressComponent.city, //district: "西安市"
district: successres.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
// 登录
proxy.$isResolve()
}
},
});
} catch (error) {
try {
let successres = await APIgeocodelocation({
lng: '',
lat: '',
})
if (successres) {
let datastorage = {
country: successres.addressComponent.country, // "中国"
province: successres.addressComponent
.province, //province: "陕西省"
address: successres.addressComponent.city, //district: "西安市"
district: successres.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
proxy.$isResolve()
}
} catch (error) {
proxy.$isResolve()
}
}
}); });
onReachBottom(() => { onReachBottom(() => {

View File

@@ -4,9 +4,9 @@
<view class="modal-content"> <view class="modal-content">
<view class="input-wrapper"> <view class="input-wrapper">
<input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput" <input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput"
placeholder="请输入积分" /> :placeholder="instructions" />
</view> </view>
<view class="instructions">{{ instructions }}</view> <!-- <view class="instructions">{{ instructions }}</view> -->
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button> <up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button> <button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
</view> </view>

View File

@@ -162,23 +162,13 @@
</view> </view>
</block> </block>
<block v-else> <block v-else>
<block v-for="(item,index) in listinfo.couponInfoList" :key="index"> <view class="cell-item column" v-if="listinfo.discountInfo.length > 0">
<view class="cell-item" v-if="item.type == 1"> <view class="label">优惠折扣</view>
<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.length > 0">
<view class="label">商品券</view>
<view class="val column"> <view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList" :key="index"> <view class="productCoupon" v-for="(item,index) in listinfo.discountInfo" :key="index">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
<view class="num">X{{item.finalUseNum}}</view> <!-- <view class="num">{{item.amount}}</view> -->
<view class="amount">-{{item.finalDiscountAmount}}</view> <view class="amount" style="margin-left: 10rpx;">{{item.amount}}</view>
</view> </view>
</view> </view>
</view> </view>
@@ -258,7 +248,7 @@
} from '@/common/api/shop/index.js' } from '@/common/api/shop/index.js'
// 定义自定义事件 // 定义自定义事件
const emits = defineEmits(['customevent', 'istype']); const emits = defineEmits(['customevent', 'istype', 'learcoupons']);
// teb 切换送餐和打包 // teb 切换送餐和打包
const tebtypeList = reactive([{ const tebtypeList = reactive([{
@@ -344,6 +334,8 @@
case 'coupon': case 'coupon':
// 清空积分 // 清空积分
IntegralInputclose() IntegralInputclose()
favorablelist[1].value = ''
emits('learcoupons', 'coupon')
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,
@@ -356,8 +348,9 @@
// 清空积分 // 清空积分
IntegralInputclose() IntegralInputclose()
// 清空优惠卷 // 清空优惠卷
props.listinfo.coupondiscountAmount = 0
favorablelist[1].value = '' favorablelist[1].value = ''
favorablelist[0].value = ''
emits('learcoupons', 'product')
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,
@@ -369,7 +362,8 @@
case 'points': case 'points':
if (calcUsablePointsData.usable == 0) { if (calcUsablePointsData.usable == 0) {
uni.showToast({ uni.showToast({
title: '此次订单不可用积分!' title: calcUsablePointsData.unusableReason,
icon: 'none'
}) })
return false; return false;
} }
@@ -672,7 +666,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;

View File

@@ -33,10 +33,10 @@
<!-- #endif --> <!-- #endif -->
</view> </view>
<!-- 先下单后支付 --> <!-- x详情 -->
<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'> @clickPointsamount='clickPointsamount' @learcoupons="learcoupons">
</orderInfoAfter> </orderInfoAfter>
<!-- 先支付后下单 --> <!-- 先支付后下单 -->
@@ -85,8 +85,7 @@
</view> </view>
</view> </view>
<view style="width: 100%;height: 200rpx;"> </view> <view style="width: 100%;height: 200rpx;"> </view>
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" <payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
:password='payPasswordPassword' @close="ispws = false" />
</view> </view>
</template> </template>
@@ -159,7 +158,10 @@
Productroll: 0, Productroll: 0,
coupondiscountAmount: 0, coupondiscountAmount: 0,
couponInfoList: '', couponInfoList: '',
pointsDiscountAmount: 0 pointsDiscountAmount: 0,
packFee: 0,
totalPrices: 0,
Seatcharge: 0
}) })
// 会员信息 // 会员信息
@@ -195,24 +197,40 @@
// } // }
} }
// 历史订单 try {
if (listinfo.detailMap) { // 历史订单
let combinedArray = []; if (listinfo.detailMap) {
for (const key in listinfo.detailMap) { let combinedArray = [];
if (listinfo.detailMap.hasOwnProperty(key)) { for (const key in listinfo.detailMap) {
let subArray = listinfo.detailMap[key]; if (listinfo.detailMap.hasOwnProperty(key)) {
combinedArray = [...combinedArray, ...subArray] let subArray = listinfo.detailMap[key];
combinedArray = [...combinedArray, ...subArray]
}
} }
} listinfo.combinedArray = combinedArray
listinfo.combinedArray = combinedArray
setTimeout(async () => {
listinfo.packFee = await cartStore.getTotalPackFee(listinfo.combinedArray) listinfo.packFee = await cartStore.getTotalPackFee(listinfo.combinedArray)
// 计算购物车商品费用 // 计算购物车商品费用
listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo.combinedArray) listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo
.combinedArray)
// 餐位费listinfo.seatNum // 餐位费listinfo.seatNum
listinfo.Seatcharge = await cartStore.getTotalSeatcharge(listinfo.seatNum) listinfo.Seatcharge = await cartStore.getTotalSeatcharge(listinfo.seatNum)
}) }
if (listinfo.discountInfo) {
const discountObj = JSON.parse(listinfo.discountInfo);
const tempArray = [];
for (const [key, value] of Object.entries(discountObj)) {
tempArray.push({
name: key,
amount: value
});
}
listinfo.discountInfo = tempArray;
console.log(tempArray)
}
} catch (e) {
} }
} }
} }
@@ -220,8 +238,8 @@
watchEffect(async () => { watchEffect(async () => {
if (listinfo.combinedArray.length > 0) { if (listinfo.combinedArray.length > 0) {
//总价格 //总价格
console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge, // console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
listinfo.Productroll, listinfo.coupondiscountAmount) // listinfo.Productroll, listinfo.coupondiscountAmount)
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge // 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge
let sum = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value == let sum = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value ==
0 ? listinfo.Seatcharge : 0); 0 ? listinfo.Seatcharge : 0);
@@ -234,7 +252,8 @@
listinfo.totalCost = Math.round(sums * 100) / 100; listinfo.totalCost = Math.round(sums * 100) / 100;
// 积分 // 积分
if (listinfo.totalCost && listinfo.status == 'unpaid') { if (listinfo.totalCost && listinfo.status == 'unpaid') {
await memberPointscalcUsablePoints() uni.$u.debounce(await memberPointscalcUsablePoints(), 500)
} }
} }
}); });
@@ -286,15 +305,6 @@
listinfo.coupondiscountAmount = data.item.discountAmount listinfo.coupondiscountAmount = data.item.discountAmount
uniqueIds.value.push(data.item.id) uniqueIds.value.push(data.item.id)
orderInfoAfterRef.value.dataprocessing(data) 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
@@ -310,7 +320,17 @@
}; };
const payPasswordPassword = ref('') const learcoupons = (data) => {
console.log('qing')
if (data == 'product') {
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
listinfo.Productroll = 0 // 商品卷总价价格
} else {
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
}
}
// * 去支付 // * 去支付
const goToPay = async () => { const goToPay = async () => {
@@ -333,7 +353,6 @@
}) })
} else { } else {
payPasswordPassword.value = ''
ispws.value = true ispws.value = true
} }
return false return false
@@ -362,9 +381,7 @@
buyerRemark: '', buyerRemark: '',
returnUrl: '' returnUrl: ''
}) })
if (res) { await orderorderInfo()
await orderorderInfo()
}
} }
//002-获取订单可用积分及抵扣金额(支付页面使用) //002-获取订单可用积分及抵扣金额(支付页面使用)
@@ -414,11 +431,10 @@
buyerRemark: '', buyerRemark: '',
returnUrl: '' returnUrl: ''
}) })
await orderorderInfo()
} catch (error) { } catch (error) {
//TODO handle the exception //TODO handle the exception
} }
payPasswordPassword.value = '' orderorderInfo()
} }
onUnmounted(() => { onUnmounted(() => {
@@ -447,7 +463,7 @@
orderVIP.value = res orderVIP.value = res
ordershopUserInfo.value = res.shopInfo ordershopUserInfo.value = res.shopInfo
} }
await orderorderInfo() orderorderInfo()
}) })
</script> </script>
@@ -549,7 +565,7 @@
.head { .head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx; padding: 50rpx 0 32rpx 0;
border-bottom: 2rpx dashed #E3E3E3; border-bottom: 2rpx dashed #E3E3E3;
.head_left { .head_left {
@@ -653,7 +669,7 @@
} }
.item { .item {
margin-bottom: 32rpx; padding: 32rpx 0 !important;
display: flex; display: flex;
.cover {} .cover {}

View File

@@ -203,10 +203,12 @@
// 计算购物车商品费用 // 计算购物车商品费用
const totalPrices = computed(() => { const totalPrices = computed(() => {
let combinedArray = []; let combinedArray = [];
for (const key in props.orderinfo.detailMap) { for (const key in props.orderinfo.detailMap) {
if (props.orderinfo.detailMap.hasOwnProperty(key)) { if (props.orderinfo.detailMap.hasOwnProperty(key)) {
combinedArray = props.orderinfo.detailMap[key]; let subArray = props.orderinfo .detailMap[key];
combinedArray = [...combinedArray, ...subArray]
} }
} }
// 购物车总数价格 // 购物车总数价格
@@ -214,13 +216,12 @@
// 是否启用会员价 0否1是 // 是否启用会员价 0否1是
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) { if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
// memberPrice会员价 // memberPrice会员价
return total + parseFloat(item.memberPrice) * parseFloat(item.num); return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
} else { } else {
// salePrice销售价 // salePrice销售价
return total + parseFloat(item.price) * parseFloat(item.num); return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
} }
}, 0); }, 0);
console.log(cartone)
// 购物车总数价格 // 购物车总数价格
let cart = props.cartList.reduce((total, item) => { let cart = props.cartList.reduce((total, item) => {
// 是否启用会员价 0否1是 // 是否启用会员价 0否1是
@@ -246,7 +247,6 @@
tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(tableFee) * tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(tableFee) *
100) / 100; 100) / 100;
} }
console.log(tableFeeTotals)
return Math.floor(tableFeeTotals * 100) / 100 ? Math.floor(tableFeeTotals * 100) / 100 : 0; return Math.floor(tableFeeTotals * 100) / 100 ? Math.floor(tableFeeTotals * 100) / 100 : 0;
}); });
@@ -266,7 +266,6 @@
// 监听送餐/打包切换 // 监听送餐/打包切换
const tabClick = (item, index) => { const tabClick = (item, index) => {
is_type.value = index is_type.value = index
console.log(props.cartList)
// this.getchoseEatModel('tabClick', index, item); // this.getchoseEatModel('tabClick', index, item);
} }
@@ -295,10 +294,9 @@
remark: remark.value, //备注 remark: remark.value, //备注
placeNum: props.orderinfo.placeNum + 1, //当前订单下单次数 placeNum: props.orderinfo.placeNum + 1, //当前订单下单次数
waitCall: '', //是否等叫 0 否 1 等叫 waitCall: '', //是否等叫 0 否 1 等叫
orderId: props.orderinfo.id orderId: props.orderinfo.id,
userId: uni.cache.get('userInfo').id || '' //
}) })
console.log(res)
// 清空购物车 // 清空购物车
emits('customevent', { emits('customevent', {
type: 'shopping', type: 'shopping',

View File

@@ -723,7 +723,7 @@
//获取多规格数据 //获取多规格数据
const clickspecifications = async (item, index, indexs, type) => { const clickspecifications = async (item, index, indexs, type) => {
console.log(item, index, indexs, type) // console.log(item, index, indexs, type)
// 数量清零 // 数量清零
shopCartNumber.value = 0 shopCartNumber.value = 0
// 初始化 // 初始化
@@ -883,7 +883,7 @@
// 购物车数据更新从新请求 // 购物车数据更新从新请求
if (Message.type == 'product') { if (Message.type == 'product') {
isDataLoaded.value = false; isDataLoaded.value = false;
await productqueryProduct() uni.$u.debounce(productqueryProduct(), 500)
// 数据可以更新 // 数据可以更新
} }
@@ -1110,6 +1110,7 @@
}) })
onMounted(async () => { onMounted(async () => {
await proxy.$onLaunched;
// 获取当前页面栈 // 获取当前页面栈
const pages = getCurrentPages(); const pages = getCurrentPages();
// 获取当前页面实例 // 获取当前页面实例
@@ -1119,6 +1120,7 @@
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if (options.q) { if (options.q) {
console.log(options.q)
const store = productStore(); const store = productStore();
await store.scanCodeactions(options.q) await store.scanCodeactions(options.q)
} }

View File

@@ -94,7 +94,7 @@
</view> </view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view> <view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view> </view>
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo" :detailtype='detailtype' > <registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo" :detailtype='detailtype'>
</registermember> </registermember>
</view> </view>
@@ -320,6 +320,7 @@
}); });
return false; return false;
} }
console.log(infoForn, 111)
console.log({ console.log({
shopId: infoForn.shopId, shopId: infoForn.shopId,
activateId: infoForn.id, activateId: infoForn.id,
@@ -347,11 +348,12 @@
uni.cache.set('orderVIP', res) uni.cache.set('orderVIP', res)
uni.cache.set('ordershopUserInfo', res.shopInfo) uni.cache.set('ordershopUserInfo', res.shopInfo)
infoForn.show = res.isVip == 1 ? false : true infoForn.show = res.isVip == 1 ? false : true
infoForn.userInfo = res
} }
const detailtype = ref('') const detailtype = ref('')
onMounted(async () => { onMounted(async () => {
// 获取当前页面栈 // 获取当前页面栈
const pages = getCurrentPages(); const pages = getCurrentPages();
@@ -359,28 +361,27 @@
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];
// 获取页面参数 // 获取页面参数
const options = currentPage.options; const options = currentPage.options;
// // #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// if (options.q) { if (options.q) {
// infoForn.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') infoForn.shopId = await getQueryString(decodeURIComponent(options.q), 'shopId')
// uni.cache.set('shopId', infoForn.shopId) }
// this.tokenShow = false; // #endif
// } // #ifdef MP-ALIPAY
// // #endif if (getApp().globalData.shopId) {
// // #ifdef MP-ALIPAY infoForn.shopId = getApp().globalData.shopId
// if (getApp().globalData.shopId) { }
// infoForn.shopId = getApp().globalData.shopId // #endif
// }
// uni.cache.set('shopId', infoForn.shopId)
// // #endif
if (options.shopId) { if (options.shopId) {
uni.cache.set('shopId', options.shopId, 30) uni.cache.set('shopId', options.shopId, 30)
infoForn.shopId = options.shopId ? options.shopId : uni.cache.get('shopId') infoForn.shopId = options.shopId ? options.shopId : uni.cache.get('shopId')
let resone = await APIusershopInfodetail({
shopId: options.shopId
})
infoForn.shopUserInfo = resone.shopInfo
asyncshopUserInfo()
} }
let resone = await APIusershopInfodetail({
shopId: infoForn.shopId
})
infoForn.shopUserInfo = resone.shopInfo
asyncshopUserInfo()
if (options.type == 'detail') { if (options.type == 'detail') {
detailtype.value = 'detail' detailtype.value = 'detail'
} }

View File

@@ -44,10 +44,10 @@ export const useCartStore = defineStore('cart', () => {
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo') if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
.isMemberPrice == 1) { .isMemberPrice == 1) {
// memberPrice会员价 // memberPrice会员价
return total + parseFloat(item.memberPrice) * parseFloat(item.num); return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
} else { } else {
// salePrice销售价 // salePrice销售价
return total + parseFloat(item.price) * parseFloat(item.num); return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
} }
}, 0); }, 0);
// 向上取整并保留两位小数 // 向上取整并保留两位小数
@@ -94,7 +94,7 @@ export const useCartStore = defineStore('cart', () => {
// 计算购物车总打包费用(向下取整并保留两位小数) // 计算购物车总打包费用(向下取整并保留两位小数)
const getTotalPackFee = (cartList) => computed(() => { const getTotalPackFee = (cartList) => computed(() => {
const total = cartList.reduce((sum, item) => { const total = cartList.reduce((sum, item) => {
return sum + item.packAmount * (item.packNumber || (item.num - item.returnNum)); return sum + (item.packAmount * (item.packNumber || (item.num - item.returnNum)));
}, 0); }, 0);
return Math.floor(total * 100) / 100; return Math.floor(total * 100) / 100;
}); });

View File

@@ -26,6 +26,7 @@ export const Memberpay = defineStore('memberpay', {
shopId: data.shopId, shopId: data.shopId,
shopUserId: data.shopUserId, shopUserId: data.shopUserId,
amount: data.amount, amount: data.amount,
activateId: data.activateId,
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
payType: 'wechatPay', payType: 'wechatPay',
openId: uni.cache.get('userInfo').wechatOpenId, openId: uni.cache.get('userInfo').wechatOpenId,
@@ -110,7 +111,12 @@ export const Memberpay = defineStore('memberpay', {
try { try {
let res = await APIpayltPayOrder({ let res = await APIpayltPayOrder({
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
checkOrderPay: data.checkOrderPay, checkOrderPay: {
...data.checkOrderPay,
...{
userId: uni.cache.get('userInfo').id
}
},
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
payType: 'wechatPay', payType: 'wechatPay',
openId: uni.cache.get('userInfo').wechatOpenId, openId: uni.cache.get('userInfo').wechatOpenId,
@@ -121,6 +127,7 @@ export const Memberpay = defineStore('memberpay', {
// #endif // #endif
returnUrl: data.returnUrl, returnUrl: data.returnUrl,
buyerRemark: data.buyerRemark, buyerRemark: data.buyerRemark,
userId: uni.cache.get('userInfo').id || ''
}) })
if (res) { if (res) {
uni.showLoading({ uni.showLoading({
@@ -189,19 +196,20 @@ export const Memberpay = defineStore('memberpay', {
try { try {
let res = await APIrefundVip({ let res = await APIrefundVip({
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
checkOrderPay: data.checkOrderPay, checkOrderPay: {
...data.checkOrderPay,
...{
userId: uni.cache.get('userInfo').id
}
},
pwd: data.pwd, pwd: data.pwd,
payType: 'accountPay', payType: data.payType,
returnUrl: data.returnUrl, returnUrl: data.returnUrl,
buyerRemark: data.buyerRemark, buyerRemark: data.buyerRemark,
shopUserId: data.shopUserId, shopUserId: data.shopUserId,
userId: uni.cache.get('userInfo').id || '' //
}) })
if (res) { resolve(true)
uni.showLoading({
title: '加载中...',
mask: true
})
}
} catch (e) { } catch (e) {
uni.showToast({ uni.showToast({
title: "支付失败" title: "支付失败"