2023-11-14 17:21:03 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
import { useRouter } from "@/hooks/useRouter";
|
2024-02-22 18:37:23 +08:00
|
|
|
|
import { onLoad, onPageScroll, onShow } from "@dcloudio/uni-app";
|
2024-02-08 21:01:37 +08:00
|
|
|
|
import { nextTick, onBeforeUnmount, ref, unref } from "vue";
|
2024-02-22 18:37:23 +08:00
|
|
|
|
import { useMainStore } from '@/store/modules/useMainStore';
|
2023-11-14 17:21:03 +08:00
|
|
|
|
import { storeToRefs } from "pinia";
|
|
|
|
|
import { orderConfirm, orderCreate } from "@/api/order";
|
|
|
|
|
import { useInterface } from "@/hooks/useInterface";
|
|
|
|
|
import { addressTabs, discountsPriceRows, payRows, priceRows } from "@/pages/submitOrder/index.data";
|
|
|
|
|
import Goods from "@/components/goodsComponents/Goods.vue"
|
|
|
|
|
import UvRadioGroup from "@/uni_modules/uv-radio/components/uv-radio-group/uv-radio-group.vue";
|
|
|
|
|
import UvRadio from "@/uni_modules/uv-radio/components/uv-radio/uv-radio.vue";
|
|
|
|
|
import { doPayment, PayType } from "@/utils/paymentUtils";
|
|
|
|
|
import CouponSelect from "@/pages/submitOrder/components/coupon-select.vue";
|
|
|
|
|
import Header from "@/components/Header/index.vue"
|
2023-11-15 19:59:37 +08:00
|
|
|
|
import { useScroll } from "@/hooks/useScroll";
|
2024-02-08 21:01:37 +08:00
|
|
|
|
import { nextIcon, shopIcon } from "@/utils/images";
|
|
|
|
|
import { emitter } from "@/utils/emitter";
|
2024-02-22 18:37:23 +08:00
|
|
|
|
import { h5InWeChat } from "@/utils";
|
2024-02-08 21:01:37 +08:00
|
|
|
|
import Login from "@/pages/login/login.vue";
|
|
|
|
|
// ==================================== hooks =====================================
|
|
|
|
|
const {scrollTop} = useScroll()
|
2024-02-22 18:37:23 +08:00
|
|
|
|
onPageScroll(() => {
|
|
|
|
|
})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
const {getParams, push, goBack} = useRouter()
|
|
|
|
|
const {toast, loading, hideLoading} = useInterface();
|
|
|
|
|
const mainStore = useMainStore();
|
2024-03-05 12:16:58 +08:00
|
|
|
|
const {integralName} = storeToRefs(mainStore);
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const campaignType = ref(0)
|
|
|
|
|
const zeroPrice = ref(false) // 本单支付金额是否为0
|
|
|
|
|
/**
|
|
|
|
|
* 重新计算价格
|
|
|
|
|
* @return {Promise<void>}
|
|
|
|
|
*/
|
|
|
|
|
async function calculateOrder() {
|
2023-11-14 17:21:03 +08:00
|
|
|
|
orderDetail.value = await orderConfirm({
|
2024-03-05 12:16:58 +08:00
|
|
|
|
cartId: unref(routerParams)?.cartId,
|
|
|
|
|
orderType: unref(routerParams)?.orderType,
|
2023-11-14 17:21:03 +08:00
|
|
|
|
addressId: unref(selectAddress)?.id || undefined,
|
2024-03-05 12:16:58 +08:00
|
|
|
|
shippingType: addressTabSelect.value, // 默认快递 1快递 2门店
|
2024-02-08 21:01:37 +08:00
|
|
|
|
storeId: shopSelect.value?.id,
|
|
|
|
|
useIntegral: useIntegral.value.length > 0,
|
2023-11-14 17:21:03 +08:00
|
|
|
|
couponId: currentCouponId.value
|
|
|
|
|
})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
// 余额为0 自动走余额支付
|
|
|
|
|
if (orderDetail.value.priceGroup.totalPrice <= 0) {
|
|
|
|
|
payType.value = PayType["1"]
|
|
|
|
|
zeroPrice.value = true
|
2024-03-05 12:16:58 +08:00
|
|
|
|
toast?.({title: '支付金额为0.00,自动选择余额支付', icon: 'none', duration: 3000})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
} else {
|
|
|
|
|
zeroPrice.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================================== 优惠券相关 ===========================================
|
|
|
|
|
const selectCouponRef = ref(false)
|
|
|
|
|
const currentCouponId = ref(undefined)
|
|
|
|
|
const selectCouponFn = async (coupon) => {
|
|
|
|
|
currentCouponId.value = coupon.couponId
|
|
|
|
|
await calculateOrder()
|
2024-03-05 12:16:58 +08:00
|
|
|
|
selectCouponRef.value?.close()
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
const showCouponSelect = (index) => {
|
|
|
|
|
if (index === 0) {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
selectCouponRef.value?.open()
|
2024-02-08 21:01:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =================================== 配送方式相关 ================================================
|
|
|
|
|
const addressTabSelect = ref(1) // 提货方式
|
2023-11-14 17:21:03 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 选择提货方式
|
|
|
|
|
* @param tab
|
|
|
|
|
*/
|
|
|
|
|
function changeAddressTab(tab) {
|
2024-02-08 21:01:37 +08:00
|
|
|
|
addressTabSelect.value = tab.value
|
|
|
|
|
shopSelect.value = undefined
|
|
|
|
|
doGetInitConfirmOrder()
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 去选择地址
|
|
|
|
|
*/
|
|
|
|
|
function gotoSelectAddress() {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
push?.({url: '/pages/address/address'}, {
|
|
|
|
|
data: {
|
|
|
|
|
type: 'select', cartId: unref(routerParams)?.cartId
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取默认选择的地址
|
|
|
|
|
*/
|
|
|
|
|
async function doGetSelectAddress() {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
if (!selectAddress.value && orderDetail.value?.addressInfo) {
|
|
|
|
|
selectAddress.value = orderDetail.value?.addressInfo
|
|
|
|
|
await doGetInitConfirmOrder()
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const shopSelect = ref(null) // 当前选择的店铺
|
2024-03-05 12:16:58 +08:00
|
|
|
|
const selectAddress = ref(null) // 当前选择的地址
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
// 注册事件监听
|
|
|
|
|
emitter.on('selectShop', (res) => {
|
|
|
|
|
// 处理门店选择逻辑
|
|
|
|
|
shopSelect.value = res
|
|
|
|
|
doGetInitConfirmOrder()
|
|
|
|
|
})
|
2024-03-05 12:16:58 +08:00
|
|
|
|
emitter.on('selectAddress', async (item) => {
|
|
|
|
|
// item
|
|
|
|
|
selectAddress.value = item
|
2024-02-08 21:01:37 +08:00
|
|
|
|
// 处理门店选择逻辑
|
|
|
|
|
await doGetSelectAddress()
|
|
|
|
|
await doGetInitConfirmOrder()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 选择店铺
|
|
|
|
|
*/
|
|
|
|
|
function selectShop() {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
push?.({url: '/pages/submitOrder/shopSelect'}, {data: {shopSelect: shopSelect.value}})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================== 订单信息相关 ======================================================
|
|
|
|
|
const flag = ref(false)
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
const payType = ref(PayType["0"]) // 支付方式
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const useIntegral = ref([1]) // 是否使用积分 length>0使用积分
|
|
|
|
|
|
|
|
|
|
// 订单信息
|
2023-11-14 17:21:03 +08:00
|
|
|
|
const orderDetail = ref({
|
|
|
|
|
cartInfo: [],
|
|
|
|
|
priceGroup: {
|
2024-02-08 21:01:37 +08:00
|
|
|
|
costPrice: 0,
|
|
|
|
|
payIntegral: 0,
|
|
|
|
|
storeFreePostage: 0,
|
|
|
|
|
storePostage: 0,
|
|
|
|
|
totalPrice: 0,
|
|
|
|
|
vipPrice: 0
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取初始订单信息
|
2024-02-08 21:01:37 +08:00
|
|
|
|
* 调用此方法可以重新生成订单信息(包括价格信息)
|
2023-11-14 17:21:03 +08:00
|
|
|
|
*/
|
|
|
|
|
async function doGetInitConfirmOrder() {
|
2024-02-08 21:01:37 +08:00
|
|
|
|
await calculateOrder()
|
2024-03-05 12:16:58 +08:00
|
|
|
|
cartIds.value = unref(routerParams)?.cartId
|
|
|
|
|
currentCouponId.value = orderDetail.value.priceGroup?.couponId
|
2023-11-14 17:21:03 +08:00
|
|
|
|
flag.value = true
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
/**
|
|
|
|
|
* 改变是否使用积分
|
|
|
|
|
*/
|
|
|
|
|
function handleUseIntegralChange() {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
doGetInitConfirmOrder()
|
|
|
|
|
})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const subLoading = ref(false) // 加载中
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 提交订单
|
|
|
|
|
* @return {Promise<void>}
|
|
|
|
|
*/
|
2023-11-14 17:21:03 +08:00
|
|
|
|
async function handleConfirm() {
|
2024-02-08 21:01:37 +08:00
|
|
|
|
if (addressTabSelect.value === 1 && (!unref(selectAddress) || !unref(selectAddress).id)) {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
toast?.({title: '请先选择地址'})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
if (addressTabSelect.value === 2 && !shopSelect.value) {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
toast?.({title: '请先选择门店'})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2023-11-14 17:21:03 +08:00
|
|
|
|
subLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const payInfo = await doCreateServiceOrder()
|
|
|
|
|
// 去拉取支付
|
2024-02-22 18:37:23 +08:00
|
|
|
|
await doPayment({type: payType.value, payInfo, isGroup: routerParams.value.campaignType === 1})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
// #ifndef H5
|
2024-03-05 12:16:58 +08:00
|
|
|
|
push?.({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
// #endif
|
|
|
|
|
// 处理微信内h5
|
|
|
|
|
// #ifdef H5
|
2024-02-22 18:37:23 +08:00
|
|
|
|
if (h5InWeChat()) {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
push?.({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
}
|
2023-11-14 17:21:03 +08:00
|
|
|
|
// #endif
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e)
|
2024-03-05 12:16:58 +08:00
|
|
|
|
toast?.({title: '支付失败'})
|
|
|
|
|
push?.({url: '/pages/payStatus/index'}, {data: {campaignType: campaignType.value}, type: 'redirectTo'})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
} finally {
|
|
|
|
|
subLoading.value = false
|
|
|
|
|
mainStore.cartId = null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 服务端创建订单
|
|
|
|
|
*/
|
|
|
|
|
async function doCreateServiceOrder() {
|
|
|
|
|
try {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
loading?.({title: '订单创建中...'})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const data = {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
key: unref(orderDetail)?.orderKey,
|
|
|
|
|
addressId: unref(selectAddress)?.id,
|
|
|
|
|
storeId: unref(shopSelect)?.id,
|
2023-11-14 17:21:03 +08:00
|
|
|
|
bargainId: 0,
|
|
|
|
|
combinationId: 0,
|
|
|
|
|
couponId: currentCouponId.value,
|
|
|
|
|
from: '',
|
|
|
|
|
mark: '',
|
|
|
|
|
pinkId: 0,
|
|
|
|
|
seckillId: 0,
|
|
|
|
|
shippingType: addressTabSelect.value,
|
|
|
|
|
isChannel: 1,
|
2024-02-08 21:01:37 +08:00
|
|
|
|
distributorId: unref(routerParams)?.distributorId, // 分销商ID
|
|
|
|
|
useIntegral: useIntegral.value.length > 0,
|
|
|
|
|
orderType: unref(routerParams)?.orderType,
|
|
|
|
|
}
|
|
|
|
|
setActivityData(data)
|
|
|
|
|
const res = await orderCreate(data);
|
2023-11-14 17:21:03 +08:00
|
|
|
|
return res.result
|
|
|
|
|
} finally {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
hideLoading?.()
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
/**
|
|
|
|
|
* 设置活动参数
|
|
|
|
|
* @param data
|
|
|
|
|
*/
|
|
|
|
|
function setActivityData(data) {
|
|
|
|
|
// 处理活动数据 路由参数 orderType 1普通下单 2活动下单
|
2024-03-05 12:16:58 +08:00
|
|
|
|
if (routerParams.value?.orderType !== 2) return
|
2024-02-08 21:01:37 +08:00
|
|
|
|
// 活动商品
|
2024-03-05 12:16:58 +08:00
|
|
|
|
data.campaignType = routerParams.value?.campaignType // 1拼团 2秒杀 3砍价
|
|
|
|
|
campaignType.value = routerParams.value?.campaignType
|
|
|
|
|
data.campaignDetailId = routerParams.value?.campaignDetailId // 活动营销ID
|
2024-02-08 21:01:37 +08:00
|
|
|
|
// 拼团 路由参数 campaignType 1拼团活动
|
2024-03-05 12:16:58 +08:00
|
|
|
|
if (routerParams.value?.campaignType !== 1) return;
|
|
|
|
|
data.teamworkType = routerParams.value?.teamworkType // 1发起拼团 2加入
|
|
|
|
|
data.teamworkType === 2 ? data.teamworkId = routerParams.value?.teamworkId : void (0) // 加入拼团的id
|
2024-02-08 21:01:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// =============================== 生命周期 ========================================
|
|
|
|
|
const routerParams = ref({})
|
|
|
|
|
const cartIds = ref('')
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查路由参数
|
|
|
|
|
*/
|
|
|
|
|
function checkRouterParam(params) {
|
|
|
|
|
if (!params.cartId) {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
toast?.({title: '路由参数错误'})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
routerParams.value = params
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
onLoad(async options => {
|
|
|
|
|
try {
|
2024-03-05 12:16:58 +08:00
|
|
|
|
const params = getParams?.(options)
|
2023-11-14 17:21:03 +08:00
|
|
|
|
await checkRouterParam(params)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e)
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-02-08 21:01:37 +08:00
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
emitter.clear('selectShop')
|
|
|
|
|
emitter.clear('selectAddress')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onShow(async () => {
|
|
|
|
|
await doGetInitConfirmOrder()
|
2023-11-17 20:55:32 +08:00
|
|
|
|
await doGetSelectAddress()
|
|
|
|
|
})
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<template>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="order-confirm">
|
|
|
|
|
<!-- header -->
|
2023-11-17 20:55:32 +08:00
|
|
|
|
<Header :scroll-top="scrollTop">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
提交订单
|
|
|
|
|
</Header>
|
|
|
|
|
<!-- 地址 -->
|
|
|
|
|
<view class="address-box">
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view class="address-box__inner">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="tab-box">
|
|
|
|
|
<!-- tab top -->
|
|
|
|
|
<view class="title-row flex flex-ai__center flex-jc__sb">
|
|
|
|
|
<view
|
|
|
|
|
class="item flex flex-ai__center flex-jc__center"
|
|
|
|
|
:class="{active:addressTabSelect === tab.value}"
|
|
|
|
|
v-for="tab in addressTabs"
|
|
|
|
|
:key="tab.value"
|
|
|
|
|
@click.stop="changeAddressTab(tab)"
|
|
|
|
|
>
|
|
|
|
|
{{ tab.label }}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
|
|
|
|
<!-- address info -->
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<template v-if="addressTabSelect === 1">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view
|
2024-03-05 12:16:58 +08:00
|
|
|
|
v-if="selectAddress"
|
2024-02-08 21:01:37 +08:00
|
|
|
|
class="address-row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
@click="gotoSelectAddress"
|
2023-11-14 17:21:03 +08:00
|
|
|
|
>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view
|
|
|
|
|
class="flex flex-ai__center"
|
|
|
|
|
v-if="selectAddress"
|
|
|
|
|
>
|
|
|
|
|
<uv-icon
|
|
|
|
|
name="map"
|
|
|
|
|
size="22"
|
|
|
|
|
/>
|
|
|
|
|
<view class="info">
|
|
|
|
|
<view>
|
|
|
|
|
{{ selectAddress.realName }} {{ selectAddress.phone }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="address-info">
|
|
|
|
|
{{ selectAddress.province }} - {{ selectAddress.city }}- {{ selectAddress.district }} -
|
|
|
|
|
{{ selectAddress.detail }}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<image
|
|
|
|
|
class="arrow-icon"
|
|
|
|
|
:src="nextIcon"
|
|
|
|
|
alt=""
|
2023-11-14 17:21:03 +08:00
|
|
|
|
/>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="address-row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
v-else
|
|
|
|
|
@click="gotoSelectAddress"
|
|
|
|
|
>
|
2024-03-05 12:16:58 +08:00
|
|
|
|
点击选择地址
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<image
|
|
|
|
|
class="arrow-icon"
|
|
|
|
|
:src="nextIcon"
|
|
|
|
|
alt=""
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 门店INFO -->
|
|
|
|
|
<template v-else>
|
|
|
|
|
<view
|
|
|
|
|
class="shop-select"
|
|
|
|
|
@click="selectShop">
|
|
|
|
|
<image :src="shopIcon" />
|
|
|
|
|
<view class="right flex flex-jc__sb flex-ai__center">
|
|
|
|
|
<view
|
|
|
|
|
v-if="shopSelect">
|
|
|
|
|
<view>{{ shopSelect.storeIntro }}</view>
|
|
|
|
|
<view style="font-size: 23rpx;font-weight: normal">{{ shopSelect.address }}</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view
|
|
|
|
|
v-else>
|
|
|
|
|
点击选择门店
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<uv-icon name="arrow-right" />
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
</template>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 商品清单 -->
|
|
|
|
|
<view
|
|
|
|
|
class="main-box goods-box"
|
|
|
|
|
v-show="orderDetail.cartInfo.length>0"
|
|
|
|
|
>
|
|
|
|
|
<view class="title-row flex flex-ai__end">
|
|
|
|
|
商品清单
|
|
|
|
|
<span class="small">
|
|
|
|
|
共 {{ orderDetail.cartInfo.length }} 件
|
|
|
|
|
</span>
|
|
|
|
|
</view>
|
|
|
|
|
<template v-for="sku in orderDetail.cartInfo">
|
|
|
|
|
<view class="goods-row">
|
|
|
|
|
<Goods
|
|
|
|
|
info-padding="0 10rpx 20rpx 10rpx"
|
|
|
|
|
:goods="sku.productInfo"
|
|
|
|
|
row
|
|
|
|
|
imgWidth="200rpx"
|
|
|
|
|
>
|
|
|
|
|
<template #options="{goods}">
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<view
|
|
|
|
|
class="goods-detail"
|
|
|
|
|
style="width: 100%">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="sku-row">
|
|
|
|
|
{{ goods.attrInfo.sku }}
|
|
|
|
|
</view>
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<view
|
|
|
|
|
class="price-row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
style="width:100%;">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="price flex flex-ai__end">
|
|
|
|
|
¥{{ sku.truePrice }}
|
|
|
|
|
<span class="old-price">
|
|
|
|
|
¥{{ goods.otPrice }}
|
|
|
|
|
</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="cart-num">
|
|
|
|
|
x{{ sku.cartNum }}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
</Goods>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 优惠价格信息 -->
|
|
|
|
|
<view class="main-box price-box">
|
|
|
|
|
<template
|
|
|
|
|
v-for="(row,index) in discountsPriceRows"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<view
|
2023-11-14 17:21:03 +08:00
|
|
|
|
class="row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
@click="showCouponSelect(index)"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="label">{{ row.label }}</view>
|
|
|
|
|
<view class="value">
|
|
|
|
|
{{ row.prefix }}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
{{ orderDetail["priceGroup"][row.field]?.toFixed(2) || '0.00' }}
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<image
|
2023-11-17 20:55:32 +08:00
|
|
|
|
v-if="row.field=== 'couponPrice'"
|
2023-11-14 17:21:03 +08:00
|
|
|
|
class="arrow-icon"
|
2023-11-22 18:55:55 +08:00
|
|
|
|
:src="nextIcon"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
alt=""
|
2023-11-14 17:21:03 +08:00
|
|
|
|
/>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</template>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="coupon-select">
|
|
|
|
|
<coupon-select
|
|
|
|
|
v-if="flag"
|
|
|
|
|
ref="selectCouponRef"
|
|
|
|
|
:id="cartIds"
|
|
|
|
|
:currentCouponId="currentCouponId"
|
|
|
|
|
@submitCoupon="selectCouponFn"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 支付方式 -->
|
|
|
|
|
<view class="main-box pay-box">
|
|
|
|
|
<uv-radio-group
|
|
|
|
|
v-model="payType"
|
|
|
|
|
class="pay-box__inner flex flex-ai__center flex-jc__center flex-wrap"
|
|
|
|
|
shape="circle"
|
|
|
|
|
activeColor="#ec6e47"
|
|
|
|
|
>
|
|
|
|
|
<template
|
|
|
|
|
v-for="payItem in payRows"
|
|
|
|
|
:key="payItem.type"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="pay-item">
|
|
|
|
|
<uv-radio
|
|
|
|
|
:name="payItem.type"
|
2024-02-08 21:01:37 +08:00
|
|
|
|
:disabled="
|
|
|
|
|
payItem.disabled || (payItem.type===PayType['0']&&zeroPrice) || (mainStore.user.nowMoney===0 &&!zeroPrice&&payItem.type===PayType['1'])"
|
2023-11-14 17:21:03 +08:00
|
|
|
|
>
|
|
|
|
|
<view class="flex flex-ai__center flex-jc__sb">
|
|
|
|
|
<view
|
|
|
|
|
class="pay_icon"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<image
|
|
|
|
|
:src="payItem.icon"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
alt=""
|
2023-11-14 17:21:03 +08:00
|
|
|
|
/>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="text">
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<view
|
|
|
|
|
class="flex flex-nowrap flex-ai__end"
|
|
|
|
|
style="white-space: nowrap">
|
2023-11-14 17:21:03 +08:00
|
|
|
|
{{ payItem.label }}
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<span
|
|
|
|
|
v-if="payItem.type===PayType['1']"
|
|
|
|
|
style="font-size: 16rpx;white-space: nowrap;">
|
|
|
|
|
({{ mainStore.user.nowMoney }}元)
|
2024-02-08 21:01:37 +08:00
|
|
|
|
</span>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view class="e-text">
|
|
|
|
|
{{ payItem.eLabel }}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
|
|
|
|
</uv-radio>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</template>
|
|
|
|
|
</uv-radio-group>
|
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<!-- 价格信息 -->
|
|
|
|
|
<view class="main-box price-box">
|
|
|
|
|
<template
|
|
|
|
|
v-for="(row,index) in priceRows"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
|
|
|
|
<view class="row flex flex-ai__center flex-jc__sb">
|
|
|
|
|
<view class="label">{{ row.label }}</view>
|
|
|
|
|
<view class="value">
|
|
|
|
|
{{ row.prefix }}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
{{ orderDetail["priceGroup"][row.field]?.toFixed(2) || '0.00' }}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</template>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<!--会员 -->
|
|
|
|
|
<view
|
|
|
|
|
class="row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
v-if="orderDetail.priceGroup.isVip">
|
|
|
|
|
<view class="label">会员优惠</view>
|
|
|
|
|
<view class="value">
|
|
|
|
|
-¥{{ orderDetail.priceGroup.vipDeductionAmount.toFixed(2) }}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
class="row flex flex-ai__center flex-jc__sb"
|
|
|
|
|
v-if="orderDetail.priceGroup.enableIntegral">
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<view class="label">{{ integralName }}抵扣</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view class="value flex flex-ai__center">
|
2024-02-22 18:37:23 +08:00
|
|
|
|
当前{{ integralName }}:
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<text class="primary-color">{{ orderDetail.priceGroup.integral }}</text>
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<uv-checkbox-group
|
2024-02-08 21:01:37 +08:00
|
|
|
|
style="margin-left: 10rpx;margin-top: 3rpx;"
|
|
|
|
|
shape="circle"
|
|
|
|
|
activeColor="#ee6d46"
|
|
|
|
|
v-model="useIntegral"
|
|
|
|
|
@change="handleUseIntegralChange">
|
2024-02-22 18:37:23 +08:00
|
|
|
|
<uv-checkbox
|
2024-02-08 21:01:37 +08:00
|
|
|
|
label=" "
|
|
|
|
|
:name="1" />
|
2024-02-22 18:37:23 +08:00
|
|
|
|
</uv-checkbox-group>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<template v-if="useIntegral.length>0">
|
|
|
|
|
-¥{{ orderDetail.priceGroup.deductionPrice.toFixed(2) }}
|
|
|
|
|
</template>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<!-- 底部操作条 -->
|
|
|
|
|
<view class="bottom-empty-height"></view>
|
|
|
|
|
<view class="bottom-option-box flex flex-jc__sb flex-ai__center">
|
|
|
|
|
<view class="info">
|
|
|
|
|
总计:¥{{ orderDetail.priceGroup.totalPrice?.toFixed(2) }}
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="animation-button sub-button"
|
|
|
|
|
:class="{disabled:subLoading}"
|
|
|
|
|
@click="handleConfirm"
|
|
|
|
|
>
|
|
|
|
|
提交订单
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<style
|
|
|
|
|
scoped
|
|
|
|
|
lang="scss"
|
|
|
|
|
>
|
|
|
|
|
$bottomHeight: 100rpx;
|
|
|
|
|
// global
|
|
|
|
|
.main-box {
|
|
|
|
|
@include usePadding(35, 0);
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background: $white-color;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.arrow-icon {
|
|
|
|
|
width: 20rpx;
|
|
|
|
|
height: 20rpx;
|
2024-02-22 18:37:23 +08:00
|
|
|
|
flex-shrink: 0;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.bottom-empty-height {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: $bottomHeight;
|
|
|
|
|
padding-bottom: 30rpx;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
// box
|
|
|
|
|
.order-confirm {
|
|
|
|
|
position: relative;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.address-box {
|
|
|
|
|
@include usePadding(35, 30);
|
|
|
|
|
width: 100%;
|
|
|
|
|
background: $white-color;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
&__inner {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border: 1px solid #E6E6E6;
|
|
|
|
|
box-sizing: border-box;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.tab-box {
|
|
|
|
|
width: 100%;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
// tab top
|
|
|
|
|
.title-row {
|
|
|
|
|
.item {
|
|
|
|
|
@include usePadding(0, 15);
|
|
|
|
|
flex: 1 0 auto;
|
|
|
|
|
background: #e6e6e6;
|
|
|
|
|
transition: all .4s;
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
background: #333;
|
|
|
|
|
color: $white-color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// address info
|
|
|
|
|
.address-row {
|
|
|
|
|
@include usePadding(25, 70);
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
.info {
|
|
|
|
|
margin-left: 20rpx;
|
|
|
|
|
|
|
|
|
|
.address-info {
|
|
|
|
|
color: #333333;
|
|
|
|
|
margin: 10rpx 0;
|
2024-02-22 18:37:23 +08:00
|
|
|
|
word-break: break-all;
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
.shop-select {
|
|
|
|
|
@include usePadding(42, 42);
|
|
|
|
|
@include useFlex(flex-start, center);
|
|
|
|
|
|
|
|
|
|
.right {
|
|
|
|
|
flex-grow: 1;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
image {
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
width: 35rpx;
|
|
|
|
|
height: 35rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.goods-box {
|
|
|
|
|
.title-row {
|
|
|
|
|
@include usePadding(0, 17);
|
|
|
|
|
color: #333;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
border-bottom: 1rpx solid #E6E6E6;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.small {
|
|
|
|
|
margin-left: 15rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.goods-row {
|
|
|
|
|
@include usePadding(0, 40);
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.goods-detail {
|
|
|
|
|
width: 100%;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.sku-row {
|
|
|
|
|
color: $tips-color;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.price-row {
|
|
|
|
|
color: $tips-color;
|
|
|
|
|
|
|
|
|
|
.price {
|
|
|
|
|
color: $primary-color;
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
|
|
|
|
.old-price {
|
|
|
|
|
color: $tips-color;
|
|
|
|
|
margin-left: 10rpx;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
text-decoration: line-through;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cart-num {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.price-box {
|
|
|
|
|
.row {
|
|
|
|
|
@include usePadding(0, 30);
|
|
|
|
|
color: #333;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
border-bottom: 1rpx solid #E6E6E6;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
&:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.value {
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.pay-box {
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
:deep(.uv-radio-group ) {
|
|
|
|
|
@include usePadding(0, 32);
|
|
|
|
|
gap: 20rpx;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.pay-item {
|
|
|
|
|
flex: 1 0 45%;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.pay_icon {
|
|
|
|
|
width: 63rpx;
|
|
|
|
|
margin: 0 20rpx;
|
|
|
|
|
aspect-ratio: 1/1;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.text {
|
|
|
|
|
font-size: 24rpx;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.e-text {
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.bottom-option-box {
|
|
|
|
|
position: fixed;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: $bottomHeight;
|
2024-02-08 21:01:37 +08:00
|
|
|
|
bottom: env(safe-area-inset-bottom);
|
2023-11-14 17:21:03 +08:00
|
|
|
|
left: 0;
|
|
|
|
|
background: $white-color;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.info {
|
|
|
|
|
@include usePadding(34, 0)
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
.sub-button {
|
|
|
|
|
@include usePadding(50, 0);
|
|
|
|
|
height: 100%;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
transition: all .3s;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
:deep(.coupon-select) .uni-popup__wrapper {
|
|
|
|
|
height: auto;
|
|
|
|
|
max-height: 1000rpx;
|
|
|
|
|
overflow-y: auto;
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</style>
|