完成订单详情
This commit is contained in:
50
App.vue
50
App.vue
@@ -26,58 +26,12 @@
|
||||
try {
|
||||
const storelogin = Storelogin();
|
||||
await storelogin.actionslogin()
|
||||
proxy.$isResolve()
|
||||
} catch (error) {
|
||||
proxy.$isResolve()
|
||||
console.log(error)
|
||||
}
|
||||
// #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 {
|
||||
|
||||
@@ -47,4 +47,22 @@ export const APIuserupload = (data) => {
|
||||
method: 'post',
|
||||
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
|
||||
})
|
||||
}
|
||||
@@ -56,14 +56,13 @@ const useWebSocket = (options = {}) => {
|
||||
|
||||
// 连接 WebSocket
|
||||
const connect = () => {
|
||||
|
||||
if (!isNetworkConnected.value) {
|
||||
uni.showToast({
|
||||
title: '网络未连接...',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
uni.pro.switchTab('index/index')
|
||||
}, 1000)
|
||||
console.log('网络未连接,暂不尝试连接 WebSocket');
|
||||
return;
|
||||
@@ -112,7 +111,6 @@ const useWebSocket = (options = {}) => {
|
||||
clearTimeout(reconnectTimer.value); // 清除重连定时器
|
||||
if (res.code == '1006') {
|
||||
console.log('服务器正常关闭,停止重连');
|
||||
uni.navigateBack()
|
||||
autoReconnect.value = false;
|
||||
return false;
|
||||
}
|
||||
@@ -143,7 +141,7 @@ const useWebSocket = (options = {}) => {
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
uni.pro.switchTab('index/index')
|
||||
}, 1000)
|
||||
return;
|
||||
}
|
||||
@@ -184,7 +182,6 @@ const useWebSocket = (options = {}) => {
|
||||
// 手动关闭连接
|
||||
const closeSocket = () => {
|
||||
isManuallyClosed.value = true;
|
||||
uni.navigateBack()
|
||||
closeExistingConnection();
|
||||
};
|
||||
|
||||
@@ -230,7 +227,6 @@ const useWebSocket = (options = {}) => {
|
||||
title: '重连次数达到上限,停止重连',
|
||||
icon: 'none'
|
||||
});
|
||||
uni.navigateBack()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -49,13 +49,14 @@
|
||||
}
|
||||
if (password.value.length === 6) {
|
||||
emits('inputComplete', password.value);
|
||||
password.value = ''
|
||||
}
|
||||
};
|
||||
|
||||
// 关闭模态框
|
||||
const closeModal = () => {
|
||||
emits('close');
|
||||
password.value = '';
|
||||
password = '';
|
||||
};
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
<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">会员卡余额 ¥{{orderVIP?orderVIP.amount:0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
<text class="balance" v-if="orderVIP.isVip == 1">
|
||||
会员卡余额¥{{orderVIP?orderVIP.amount:0}}</text>
|
||||
<text class="topUpNow"
|
||||
@click="goRecharge">{{orderVIP.isVip == 0?'注册会员':'去充值'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -60,14 +62,15 @@
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
const emits = defineEmits(['customevent', 'groupChange']);
|
||||
|
||||
|
||||
const paymentMethodList = ref([{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: ''
|
||||
payType: 'accountPay'
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
{
|
||||
@@ -92,7 +95,7 @@
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: ''
|
||||
payType: 'accountPay'
|
||||
},
|
||||
{
|
||||
name: "微信支付",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!-- 金刚区 -->
|
||||
<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 class="flex-between" style="flex-wrap: inherit;">
|
||||
@@ -25,10 +25,10 @@
|
||||
</view>
|
||||
<view class="componentsclass" v-if="showproductlist">
|
||||
<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" />
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<!-- 首页抢购区域 -->
|
||||
<view class="fivecontent">
|
||||
@@ -164,6 +164,9 @@
|
||||
APIhomehomePageUp,
|
||||
APIhome
|
||||
} from "@/common/api/index/index.js"
|
||||
import {
|
||||
APIgeocodelocation
|
||||
} from "@/common/api/api.js"
|
||||
import {
|
||||
useNavbarStore
|
||||
} from '@/stores/navbarStore';
|
||||
@@ -203,16 +206,16 @@
|
||||
const refbannervo = ref(null);
|
||||
//数据
|
||||
const hometoplist = reactive({
|
||||
|
||||
|
||||
})
|
||||
// 首页上面数据
|
||||
const hometop = async () => {
|
||||
try {
|
||||
let res = await APIhomehomePageUp()
|
||||
Object.assign(hometoplist, res)
|
||||
hometoplist.freeBannerList.forEach((item, index) => {
|
||||
advertisementStyle.value.push(getStyle(index))
|
||||
})
|
||||
hometoplist.freeBannerList.forEach((item, index) => {
|
||||
advertisementStyle.value.push(getStyle(index))
|
||||
})
|
||||
// 数据加载完后获取dom 高度
|
||||
setTimeout(() => {
|
||||
const query = uni.createSelectorQuery().select('#fourcontent');
|
||||
@@ -231,7 +234,7 @@
|
||||
page: 1, //页数
|
||||
size: 10, //页容量
|
||||
status: 'loadmore',
|
||||
name:'1'
|
||||
name: '1'
|
||||
})
|
||||
// 使用 reactive 创建响应式对象
|
||||
const timeData = ref({});
|
||||
@@ -334,10 +337,9 @@
|
||||
isSticky.value = res.scrollTop > elementTop.value ? true : false
|
||||
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
|
||||
});
|
||||
onShow(() => {})
|
||||
onMounted(async () => {
|
||||
onShow(async () => {
|
||||
await proxy.$onLaunched;
|
||||
if (uni.cache.get('shopId') && uni.cache.get('token')) {
|
||||
if (uni.cache.get('shopId')) {
|
||||
showindex.value = 'shopIndex'
|
||||
await storeuser.actionsAPIuser()
|
||||
} else {
|
||||
@@ -346,6 +348,56 @@
|
||||
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(() => {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<view class="modal-content">
|
||||
<view class="input-wrapper">
|
||||
<input type="number" v-model="inputValue" :min="minValue" :max="maxValue" @input="handleInput"
|
||||
placeholder="请输入积分" />
|
||||
:placeholder="instructions" />
|
||||
</view>
|
||||
<view class="instructions">{{ instructions }}</view>
|
||||
<!-- <view class="instructions">{{ instructions }}</view> -->
|
||||
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
|
||||
<button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</button>
|
||||
</view>
|
||||
|
||||
@@ -162,23 +162,13 @@
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<block v-for="(item,index) in listinfo.couponInfoList" :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.length > 0">
|
||||
<view class="label">商品券</view>
|
||||
<view class="cell-item column" v-if="listinfo.discountInfo.length > 0">
|
||||
<view class="label">优惠折扣</view>
|
||||
<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="num">X{{item.finalUseNum}}</view>
|
||||
<view class="amount">-¥{{item.finalDiscountAmount}}</view>
|
||||
<!-- <view class="num">{{item.amount}}</view> -->
|
||||
<view class="amount" style="margin-left: 10rpx;">{{item.amount}}元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -258,7 +248,7 @@
|
||||
} from '@/common/api/shop/index.js'
|
||||
|
||||
// 定义自定义事件
|
||||
const emits = defineEmits(['customevent', 'istype']);
|
||||
const emits = defineEmits(['customevent', 'istype', 'learcoupons']);
|
||||
|
||||
// teb 切换送餐和打包
|
||||
const tebtypeList = reactive([{
|
||||
@@ -344,6 +334,8 @@
|
||||
case 'coupon':
|
||||
// 清空积分
|
||||
IntegralInputclose()
|
||||
favorablelist[1].value = ''
|
||||
emits('learcoupons', 'coupon')
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
@@ -356,8 +348,9 @@
|
||||
// 清空积分
|
||||
IntegralInputclose()
|
||||
// 清空优惠卷
|
||||
props.listinfo.coupondiscountAmount = 0
|
||||
favorablelist[1].value = ''
|
||||
favorablelist[0].value = ''
|
||||
emits('learcoupons', 'product')
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_product",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
@@ -369,7 +362,8 @@
|
||||
case 'points':
|
||||
if (calcUsablePointsData.usable == 0) {
|
||||
uni.showToast({
|
||||
title: '此次订单不可用积分!'
|
||||
title: calcUsablePointsData.unusableReason,
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
@@ -672,7 +666,7 @@
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 0;
|
||||
// padding: 32rpx 0;
|
||||
|
||||
.head_left {
|
||||
display: flex;
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<!-- 先下单后支付 -->
|
||||
<!-- x详情 -->
|
||||
<orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck"
|
||||
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"
|
||||
@clickPointsamount='clickPointsamount'>
|
||||
@clickPointsamount='clickPointsamount' @learcoupons="learcoupons">
|
||||
</orderInfoAfter>
|
||||
|
||||
<!-- 先支付后下单 -->
|
||||
@@ -85,8 +85,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 100%;height: 200rpx;"> </view>
|
||||
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent"
|
||||
:password='payPasswordPassword' @close="ispws = false" />
|
||||
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -159,7 +158,10 @@
|
||||
Productroll: 0,
|
||||
coupondiscountAmount: 0,
|
||||
couponInfoList: '',
|
||||
pointsDiscountAmount: 0
|
||||
pointsDiscountAmount: 0,
|
||||
packFee: 0,
|
||||
totalPrices: 0,
|
||||
Seatcharge: 0
|
||||
})
|
||||
|
||||
// 会员信息
|
||||
@@ -195,24 +197,40 @@
|
||||
// }
|
||||
}
|
||||
|
||||
// 历史订单
|
||||
if (listinfo.detailMap) {
|
||||
let combinedArray = [];
|
||||
for (const key in listinfo.detailMap) {
|
||||
if (listinfo.detailMap.hasOwnProperty(key)) {
|
||||
let subArray = listinfo.detailMap[key];
|
||||
combinedArray = [...combinedArray, ...subArray]
|
||||
try {
|
||||
// 历史订单
|
||||
if (listinfo.detailMap) {
|
||||
let combinedArray = [];
|
||||
for (const key in listinfo.detailMap) {
|
||||
if (listinfo.detailMap.hasOwnProperty(key)) {
|
||||
let subArray = listinfo.detailMap[key];
|
||||
combinedArray = [...combinedArray, ...subArray]
|
||||
}
|
||||
}
|
||||
}
|
||||
listinfo.combinedArray = combinedArray
|
||||
setTimeout(async () => {
|
||||
listinfo.combinedArray = 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.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 () => {
|
||||
if (listinfo.combinedArray.length > 0) {
|
||||
//总价格
|
||||
console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
|
||||
listinfo.Productroll, listinfo.coupondiscountAmount)
|
||||
// console.log(listinfo.combinedArray, listinfo.packFee, listinfo.totalPrices, listinfo.Seatcharge,
|
||||
// listinfo.Productroll, listinfo.coupondiscountAmount)
|
||||
// 打包费packFee 计算购物车商品费用totalPrices 餐位费Seatcharge
|
||||
let sum = (is_type.value != 0 ? listinfo.packFee : 0) + listinfo.totalPrices + (is_type.value ==
|
||||
0 ? listinfo.Seatcharge : 0);
|
||||
@@ -234,7 +252,8 @@
|
||||
listinfo.totalCost = Math.round(sums * 100) / 100;
|
||||
// 积分
|
||||
if (listinfo.totalCost && listinfo.status == 'unpaid') {
|
||||
await memberPointscalcUsablePoints()
|
||||
uni.$u.debounce(await memberPointscalcUsablePoints(), 500)
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -286,15 +305,6 @@
|
||||
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
|
||||
@@ -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 () => {
|
||||
@@ -333,7 +353,6 @@
|
||||
|
||||
})
|
||||
} else {
|
||||
payPasswordPassword.value = ''
|
||||
ispws.value = true
|
||||
}
|
||||
return false
|
||||
@@ -362,9 +381,7 @@
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
if (res) {
|
||||
await orderorderInfo()
|
||||
}
|
||||
await orderorderInfo()
|
||||
}
|
||||
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
@@ -414,11 +431,10 @@
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
await orderorderInfo()
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
payPasswordPassword.value = ''
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -447,7 +463,7 @@
|
||||
orderVIP.value = res
|
||||
ordershopUserInfo.value = res.shopInfo
|
||||
}
|
||||
await orderorderInfo()
|
||||
orderorderInfo()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -549,7 +565,7 @@
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 50rpx 34rpx 32rpx 34rpx;
|
||||
padding: 50rpx 0 32rpx 0;
|
||||
border-bottom: 2rpx dashed #E3E3E3;
|
||||
|
||||
.head_left {
|
||||
@@ -653,7 +669,7 @@
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 32rpx;
|
||||
padding: 32rpx 0 !important;
|
||||
display: flex;
|
||||
|
||||
.cover {}
|
||||
|
||||
@@ -203,10 +203,12 @@
|
||||
|
||||
// 计算购物车商品费用
|
||||
const totalPrices = computed(() => {
|
||||
|
||||
let combinedArray = [];
|
||||
for (const key in props.orderinfo.detailMap) {
|
||||
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是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.price) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
|
||||
}
|
||||
}, 0);
|
||||
console.log(cartone)
|
||||
// 购物车总数价格
|
||||
let cart = props.cartList.reduce((total, item) => {
|
||||
// 是否启用会员价 0否1是
|
||||
@@ -246,7 +247,6 @@
|
||||
tableFeeTotals = Math.ceil(parseFloat(dinersNum) * parseFloat(tableFee) *
|
||||
100) / 100;
|
||||
}
|
||||
console.log(tableFeeTotals)
|
||||
return Math.floor(tableFeeTotals * 100) / 100 ? Math.floor(tableFeeTotals * 100) / 100 : 0;
|
||||
});
|
||||
|
||||
@@ -266,7 +266,6 @@
|
||||
// 监听送餐/打包切换
|
||||
const tabClick = (item, index) => {
|
||||
is_type.value = index
|
||||
console.log(props.cartList)
|
||||
// this.getchoseEatModel('tabClick', index, item);
|
||||
}
|
||||
|
||||
@@ -295,10 +294,9 @@
|
||||
remark: remark.value, //备注
|
||||
placeNum: props.orderinfo.placeNum + 1, //当前订单下单次数
|
||||
waitCall: '', //是否等叫 0 否 1 等叫
|
||||
orderId: props.orderinfo.id
|
||||
|
||||
orderId: props.orderinfo.id,
|
||||
userId: uni.cache.get('userInfo').id || '' //
|
||||
})
|
||||
console.log(res)
|
||||
// 清空购物车
|
||||
emits('customevent', {
|
||||
type: 'shopping',
|
||||
|
||||
@@ -723,7 +723,7 @@
|
||||
|
||||
//获取多规格数据
|
||||
const clickspecifications = async (item, index, indexs, type) => {
|
||||
console.log(item, index, indexs, type)
|
||||
// console.log(item, index, indexs, type)
|
||||
// 数量清零
|
||||
shopCartNumber.value = 0
|
||||
// 初始化
|
||||
@@ -883,7 +883,7 @@
|
||||
// 购物车数据更新从新请求
|
||||
if (Message.type == 'product') {
|
||||
isDataLoaded.value = false;
|
||||
await productqueryProduct()
|
||||
uni.$u.debounce(productqueryProduct(), 500)
|
||||
// 数据可以更新
|
||||
}
|
||||
|
||||
@@ -1110,6 +1110,7 @@
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await proxy.$onLaunched;
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
// 获取当前页面实例
|
||||
@@ -1119,6 +1120,7 @@
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
console.log(options.q)
|
||||
const store = productStore();
|
||||
await store.scanCodeactions(options.q)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</view>
|
||||
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
|
||||
</view>
|
||||
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo" :detailtype='detailtype' >
|
||||
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo" :detailtype='detailtype'>
|
||||
</registermember>
|
||||
</view>
|
||||
|
||||
@@ -320,6 +320,7 @@
|
||||
});
|
||||
return false;
|
||||
}
|
||||
console.log(infoForn, 111)
|
||||
console.log({
|
||||
shopId: infoForn.shopId,
|
||||
activateId: infoForn.id,
|
||||
@@ -347,11 +348,12 @@
|
||||
uni.cache.set('orderVIP', res)
|
||||
uni.cache.set('ordershopUserInfo', res.shopInfo)
|
||||
infoForn.show = res.isVip == 1 ? false : true
|
||||
|
||||
infoForn.userInfo = res
|
||||
}
|
||||
|
||||
|
||||
const detailtype = ref('')
|
||||
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
@@ -359,28 +361,27 @@
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 获取页面参数
|
||||
const options = currentPage.options;
|
||||
// // #ifdef MP-WEIXIN
|
||||
// if (options.q) {
|
||||
// infoForn.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
// uni.cache.set('shopId', infoForn.shopId)
|
||||
// this.tokenShow = false;
|
||||
// }
|
||||
// // #endif
|
||||
// // #ifdef MP-ALIPAY
|
||||
// if (getApp().globalData.shopId) {
|
||||
// infoForn.shopId = getApp().globalData.shopId
|
||||
// }
|
||||
// uni.cache.set('shopId', infoForn.shopId)
|
||||
// // #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
infoForn.shopId = await getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (getApp().globalData.shopId) {
|
||||
infoForn.shopId = getApp().globalData.shopId
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (options.shopId) {
|
||||
uni.cache.set('shopId', options.shopId, 30)
|
||||
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') {
|
||||
detailtype.value = 'detail'
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ export const useCartStore = defineStore('cart', () => {
|
||||
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
||||
.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.price) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
|
||||
}
|
||||
}, 0);
|
||||
// 向上取整并保留两位小数
|
||||
@@ -94,7 +94,7 @@ export const useCartStore = defineStore('cart', () => {
|
||||
// 计算购物车总打包费用(向下取整并保留两位小数)
|
||||
const getTotalPackFee = (cartList) => computed(() => {
|
||||
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);
|
||||
return Math.floor(total * 100) / 100;
|
||||
});
|
||||
|
||||
@@ -26,6 +26,7 @@ export const Memberpay = defineStore('memberpay', {
|
||||
shopId: data.shopId,
|
||||
shopUserId: data.shopUserId,
|
||||
amount: data.amount,
|
||||
activateId: data.activateId,
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
@@ -110,7 +111,12 @@ export const Memberpay = defineStore('memberpay', {
|
||||
try {
|
||||
let res = await APIpayltPayOrder({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
checkOrderPay: data.checkOrderPay,
|
||||
checkOrderPay: {
|
||||
...data.checkOrderPay,
|
||||
...{
|
||||
userId: uni.cache.get('userInfo').id
|
||||
}
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
@@ -121,6 +127,7 @@ export const Memberpay = defineStore('memberpay', {
|
||||
// #endif
|
||||
returnUrl: data.returnUrl,
|
||||
buyerRemark: data.buyerRemark,
|
||||
userId: uni.cache.get('userInfo').id || ''
|
||||
})
|
||||
if (res) {
|
||||
uni.showLoading({
|
||||
@@ -189,19 +196,20 @@ export const Memberpay = defineStore('memberpay', {
|
||||
try {
|
||||
let res = await APIrefundVip({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
checkOrderPay: data.checkOrderPay,
|
||||
checkOrderPay: {
|
||||
...data.checkOrderPay,
|
||||
...{
|
||||
userId: uni.cache.get('userInfo').id
|
||||
}
|
||||
},
|
||||
pwd: data.pwd,
|
||||
payType: 'accountPay',
|
||||
payType: data.payType,
|
||||
returnUrl: data.returnUrl,
|
||||
buyerRemark: data.buyerRemark,
|
||||
shopUserId: data.shopUserId,
|
||||
userId: uni.cache.get('userInfo').id || '' //
|
||||
})
|
||||
if (res) {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
resolve(true)
|
||||
} catch (e) {
|
||||
uni.showToast({
|
||||
title: "支付失败"
|
||||
|
||||
Reference in New Issue
Block a user