【fix】优化代码
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<script setup>
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import {onLoad, onPageScroll, onShow} from "@dcloudio/uni-app";
|
||||
import { onLoad, onPageScroll, onShow } from "@dcloudio/uni-app";
|
||||
import { nextTick, onBeforeUnmount, ref, unref } from "vue";
|
||||
import { useMainStore } from '@/store/store';
|
||||
import { useMainStore } from '@/store/modules/useMainStore';
|
||||
import { storeToRefs } from "pinia";
|
||||
import { orderConfirm, orderCreate } from "@/api/order";
|
||||
import { useInterface } from "@/hooks/useInterface";
|
||||
@ -16,15 +16,16 @@ import Header from "@/components/Header/index.vue"
|
||||
import { useScroll } from "@/hooks/useScroll";
|
||||
import { nextIcon, shopIcon } from "@/utils/images";
|
||||
import { emitter } from "@/utils/emitter";
|
||||
import {h5InWeChat} from "@/utils";
|
||||
import { h5InWeChat } from "@/utils";
|
||||
import Login from "@/pages/login/login.vue";
|
||||
// ==================================== hooks =====================================
|
||||
const {scrollTop} = useScroll()
|
||||
onPageScroll(()=>{})
|
||||
onPageScroll(() => {
|
||||
})
|
||||
const {getParams, push, goBack} = useRouter()
|
||||
const {toast, loading, hideLoading} = useInterface();
|
||||
const mainStore = useMainStore();
|
||||
const {selectAddress, defaultAddress, address} = storeToRefs(mainStore);
|
||||
const {selectAddress, defaultAddress, address, integralName} = storeToRefs(mainStore);
|
||||
const campaignType = ref(0)
|
||||
const zeroPrice = ref(false) // 本单支付金额是否为0
|
||||
/**
|
||||
@ -187,20 +188,20 @@ async function handleConfirm() {
|
||||
try {
|
||||
const payInfo = await doCreateServiceOrder()
|
||||
// 去拉取支付
|
||||
await doPayment({type: payType.value, payInfo,isGroup:routerParams.value.campaignType===1})
|
||||
await doPayment({type: payType.value, payInfo, isGroup: routerParams.value.campaignType === 1})
|
||||
// #ifndef H5
|
||||
push({url: '/pages/payStatus/index'}, { data: {campaignType: campaignType.value},type: 'redirectTo'})
|
||||
push({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
||||
// #endif
|
||||
// 处理微信内h5
|
||||
// #ifdef H5
|
||||
if(h5InWeChat()){
|
||||
push({url: '/pages/payStatus/index'}, { data: {campaignType: campaignType.value},type: 'redirectTo'})
|
||||
if (h5InWeChat()) {
|
||||
push({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
||||
}
|
||||
// #endif
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
toast({title: '支付失败'})
|
||||
push({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value} , type: 'redirectTo'})
|
||||
push({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
||||
} finally {
|
||||
subLoading.value = false
|
||||
mainStore.cartId = null
|
||||
@ -247,7 +248,7 @@ function setActivityData(data) {
|
||||
if (routerParams.value.orderType !== 2) return
|
||||
// 活动商品
|
||||
data.campaignType = routerParams.value.campaignType // 1拼团 2秒杀 3砍价
|
||||
campaignType.value = routerParams.value.campaignType
|
||||
campaignType.value = routerParams.value.campaignType
|
||||
data.campaignDetailId = routerParams.value.campaignDetailId // 活动营销ID
|
||||
// 拼团 路由参数 campaignType 1拼团活动
|
||||
if (routerParams.value.campaignType !== 1) return;
|
||||
@ -374,7 +375,7 @@ onShow(async () => {
|
||||
v-else>
|
||||
点击选择门店
|
||||
</view>
|
||||
<u-icon name="arrow-right" />
|
||||
<uv-icon name="arrow-right" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -402,11 +403,15 @@ onShow(async () => {
|
||||
imgWidth="200rpx"
|
||||
>
|
||||
<template #options="{goods}">
|
||||
<view class="goods-detail" style="width: 100%">
|
||||
<view
|
||||
class="goods-detail"
|
||||
style="width: 100%">
|
||||
<view class="sku-row">
|
||||
{{ goods.attrInfo.sku }}
|
||||
</view>
|
||||
<view class="price-row flex flex-ai__center flex-jc__sb" style="width:100%;">
|
||||
<view
|
||||
class="price-row flex flex-ai__center flex-jc__sb"
|
||||
style="width:100%;">
|
||||
<view class="price flex flex-ai__end">
|
||||
¥{{ sku.truePrice }}
|
||||
<span class="old-price">
|
||||
@ -487,10 +492,14 @@ onShow(async () => {
|
||||
/>
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="flex flex-nowrap flex-ai__end" style="white-space: nowrap">
|
||||
<view
|
||||
class="flex flex-nowrap flex-ai__end"
|
||||
style="white-space: nowrap">
|
||||
{{ payItem.label }}
|
||||
<span v-if="payItem.type===PayType['1']" style="font-size: 16rpx;white-space: nowrap;">
|
||||
({{mainStore.user.nowMoney}}元)
|
||||
<span
|
||||
v-if="payItem.type===PayType['1']"
|
||||
style="font-size: 16rpx;white-space: nowrap;">
|
||||
({{ mainStore.user.nowMoney }}元)
|
||||
</span>
|
||||
</view>
|
||||
<view class="e-text">
|
||||
@ -531,20 +540,20 @@ onShow(async () => {
|
||||
<view
|
||||
class="row flex flex-ai__center flex-jc__sb"
|
||||
v-if="orderDetail.priceGroup.enableIntegral">
|
||||
<view class="label">积分抵扣</view>
|
||||
<view class="label">{{ integralName }}抵扣</view>
|
||||
<view class="value flex flex-ai__center">
|
||||
当前积分:
|
||||
当前{{ integralName }}:
|
||||
<text class="primary-color">{{ orderDetail.priceGroup.integral }}</text>
|
||||
<u-checkbox-group
|
||||
<uv-checkbox-group
|
||||
style="margin-left: 10rpx;margin-top: 3rpx;"
|
||||
shape="circle"
|
||||
activeColor="#ee6d46"
|
||||
v-model="useIntegral"
|
||||
@change="handleUseIntegralChange">
|
||||
<u-checkbox
|
||||
<uv-checkbox
|
||||
label=" "
|
||||
:name="1" />
|
||||
</u-checkbox-group>
|
||||
</uv-checkbox-group>
|
||||
<template v-if="useIntegral.length>0">
|
||||
-¥{{ orderDetail.priceGroup.deductionPrice.toFixed(2) }}
|
||||
</template>
|
||||
@ -586,6 +595,7 @@ $bottomHeight: 100rpx;
|
||||
.arrow-icon {
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bottom-empty-height {
|
||||
@ -637,6 +647,7 @@ $bottomHeight: 100rpx;
|
||||
.address-info {
|
||||
color: #333333;
|
||||
margin: 10rpx 0;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user