mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-11-06 17:09:01 +08:00
Merge branch 'feat/appointment-goods'
This commit is contained in:
209
pages/cart/gift-card/index.vue
Normal file
209
pages/cart/gift-card/index.vue
Normal file
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<view class="b-content" :style="themeStyle">
|
||||
<scroll-view class="list-scroll-content" scroll-y>
|
||||
<u-empty
|
||||
mode="coupon"
|
||||
text="暂无可用礼品卡"
|
||||
v-if="!cardList.length"
|
||||
></u-empty>
|
||||
|
||||
<view class="coupon-card" v-for="item in cardList" :key="item.id">
|
||||
<view class="coupon-card-left">
|
||||
<view class="price-row">
|
||||
<text class="coupon-price-symbol">¥</text>
|
||||
<text class="coupon-price-value">{{ unitPrice(item.balance) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon-divider"></view>
|
||||
<view class="coupon-card-right">
|
||||
<text class="coupon-card-name">{{ item.giftCardName || '礼品卡' }}</text>
|
||||
<view class="coupon-card-foot">
|
||||
<view
|
||||
class="coupon-status-btn"
|
||||
:class="{ cancel: item.selected }"
|
||||
@click="clickWay(item)"
|
||||
>
|
||||
{{ item.selected ? '取消使用' : '立即使用' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="notice" v-if="cardList.length">{{ GIFT_CARD_PAY_NOTICE }}</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { useStore } from '@/store'
|
||||
import { selectGiftCard } from '@/api/trade.js'
|
||||
import { unitPrice } from '@/utils/filters.js'
|
||||
import { decorateGiftCard, GIFT_CARD_PAY_NOTICE } from '@/utils/giftCard.js'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
const way = ref('')
|
||||
const cardList = ref<any[]>([])
|
||||
|
||||
onLoad((options) => {
|
||||
way.value = options?.way || ''
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
const selectedIds = (store.state as any).selectedGiftCardIds || []
|
||||
const cards = (store.state as any).canUseGiftCards || []
|
||||
cardList.value = cards.map((item: any) => decorateGiftCard(item, selectedIds))
|
||||
})
|
||||
|
||||
function clickWay(item: any) {
|
||||
if (!item?.id) return
|
||||
selectGiftCard({
|
||||
way: way.value,
|
||||
credentialId: String(item.id),
|
||||
used: !item.selected,
|
||||
}).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message || '礼品卡选择失败',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.b-content {
|
||||
background: #f7f8fa;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.list-scroll-content {
|
||||
flex: 1;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
padding: 24rpx 24rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.coupon-card {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
position: relative;
|
||||
border: 1rpx solid #f0f1f5;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.coupon-card-left {
|
||||
width: 200rpx;
|
||||
min-height: 148rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
color: #ff3b30;
|
||||
background: linear-gradient(135deg, #fff5f5 0%, #ffecec 100%);
|
||||
}
|
||||
|
||||
.price-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.coupon-price-symbol {
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
margin-right: 2rpx;
|
||||
}
|
||||
|
||||
.coupon-price-value {
|
||||
font-size: 44rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.coupon-price-label {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #ff8a80;
|
||||
}
|
||||
|
||||
.coupon-divider {
|
||||
position: absolute;
|
||||
left: 200rpx;
|
||||
top: 24rpx;
|
||||
bottom: 24rpx;
|
||||
width: 0;
|
||||
border-left: 2rpx dashed #f0d6d6;
|
||||
}
|
||||
|
||||
.coupon-card-right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 24rpx 24rpx 20rpx 28rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.coupon-card-name {
|
||||
font-size: 28rpx;
|
||||
color: #111;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.coupon-card-desc,
|
||||
.coupon-card-time {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #8a8f99;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.coupon-card-time {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.coupon-card-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.coupon-status-btn {
|
||||
flex-shrink: 0;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, var(--theme-light, #ff6b35), var(--theme-primary, #ff4b2b));
|
||||
|
||||
&.cancel {
|
||||
background: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
432
pages/cart/gift-card/myGiftCards.vue
Normal file
432
pages/cart/gift-card/myGiftCards.vue
Normal file
@@ -0,0 +1,432 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="bind-section">
|
||||
<view class="section-title">兑换礼品卡</view>
|
||||
<view class="bind-row">
|
||||
<text class="bind-label">卡号</text>
|
||||
<u-input
|
||||
v-model="bindForm.cardNo"
|
||||
border="none"
|
||||
maxlength="64"
|
||||
placeholder="请输入卡号"
|
||||
clearable
|
||||
/>
|
||||
</view>
|
||||
<view class="bind-row">
|
||||
<text class="bind-label">兑换码</text>
|
||||
<u-input
|
||||
v-model="bindForm.cardSecret"
|
||||
border="none"
|
||||
maxlength="128"
|
||||
password
|
||||
placeholder="请输入兑换码(卡密)"
|
||||
clearable
|
||||
/>
|
||||
</view>
|
||||
<view class="bind-btn" :class="{ disabled: bindSubmitting }" @click="submitBind">
|
||||
{{ bindSubmitting ? '兑换中...' : '兑换' }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tabs-wrap">
|
||||
<u-tabs
|
||||
:list="tabList"
|
||||
keyName="text"
|
||||
:scrollable="false"
|
||||
:inactiveStyle="{ color: '#333' }"
|
||||
v-model:current="tabCurrentIndex"
|
||||
:lineColor="lightColor"
|
||||
:activeStyle="{ color: lightColor }"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list-scroll" scroll-y @scrolltolower="loadMore">
|
||||
<u-empty v-if="!loading && !list.length" mode="coupon" text="暂无礼品卡" />
|
||||
<view
|
||||
class="gcc-card"
|
||||
:class="{ 'is-disabled': statusTab === 'UNAVAILABLE' }"
|
||||
v-for="item in list"
|
||||
:key="item.id || item.cardNo"
|
||||
>
|
||||
<view class="gcc-header">
|
||||
<view class="gcc-header-pattern" />
|
||||
<view class="gcc-header-inner">
|
||||
<view class="gcc-header-left">
|
||||
<view class="gcc-title">{{ item.giftCardName || '礼品卡' }}</view>
|
||||
<view class="gcc-face">面值{{ item.faceText }}元</view>
|
||||
<view class="gcc-cardno">{{ item.cardNo }}</view>
|
||||
</view>
|
||||
<view class="gcc-header-right">
|
||||
<view class="gcc-type">现金卡</view>
|
||||
<view class="gcc-expire">{{ item.expireText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gcc-body">
|
||||
<view class="gcc-row">
|
||||
当前余额:
|
||||
<text class="gcc-strong" v-if="item.balance != null">¥{{ unitPrice(item.balance) }}</text>
|
||||
<text class="gcc-strong" v-else>—</text>
|
||||
</view>
|
||||
<view
|
||||
class="gcc-action"
|
||||
:class="{ 'is-disabled': actionDisabled || isActivating(item) }"
|
||||
@click="onCardPrimaryAction(item)"
|
||||
>
|
||||
<text v-if="isActivating(item)">提交中...</text>
|
||||
<text v-else>{{ actionLabel }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="load-more" v-if="list.length">{{ loadStatusText }}</view>
|
||||
<view class="notice">{{ useNotice }}</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
activateGiftCardCashMemberCard,
|
||||
bindGiftCardCashMemberCard,
|
||||
getGiftCardCashMemberCardPage,
|
||||
} from '@/api/promotions.js'
|
||||
import { unitPrice } from '@/utils/filters.js'
|
||||
import {
|
||||
decorateGiftCard,
|
||||
GIFT_CARD_STATUS,
|
||||
GIFT_CARD_USE_NOTICE,
|
||||
giftCardActionLabel,
|
||||
resolveMemberCardId,
|
||||
} from '@/utils/giftCard.js'
|
||||
import { useStore } from '@/store'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
|
||||
const store = useStore()
|
||||
const lightColor = computed(() => store.getters.lightColor)
|
||||
const useNotice = GIFT_CARD_USE_NOTICE
|
||||
|
||||
const tabList = [
|
||||
{ text: '可用', status: GIFT_CARD_STATUS.AVAILABLE },
|
||||
{ text: '不可用', status: GIFT_CARD_STATUS.UNAVAILABLE },
|
||||
{ text: '待激活', status: GIFT_CARD_STATUS.PENDING_ACTIVATION },
|
||||
]
|
||||
const tabCurrentIndex = ref(0)
|
||||
const statusTab = computed(() => tabList[tabCurrentIndex.value].status)
|
||||
const actionLabel = computed(() => giftCardActionLabel(statusTab.value))
|
||||
const actionDisabled = computed(() => statusTab.value === GIFT_CARD_STATUS.UNAVAILABLE)
|
||||
|
||||
const bindForm = ref({ cardNo: '', cardSecret: '' })
|
||||
const bindSubmitting = ref(false)
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const pageNumber = ref(1)
|
||||
const loadStatus = ref('more')
|
||||
const activatingId = ref('')
|
||||
|
||||
const loadStatusText = computed(() => (loadStatus.value === 'noMore' ? '没有更多了' : ''))
|
||||
|
||||
onShow(() => {
|
||||
resetAndLoad()
|
||||
})
|
||||
|
||||
watch(tabCurrentIndex, () => {
|
||||
resetAndLoad()
|
||||
})
|
||||
|
||||
function resetAndLoad() {
|
||||
pageNumber.value = 1
|
||||
list.value = []
|
||||
loadStatus.value = 'more'
|
||||
getList()
|
||||
}
|
||||
|
||||
function getList() {
|
||||
if (loadStatus.value === 'noMore' && pageNumber.value > 1) return
|
||||
loading.value = true
|
||||
getGiftCardCashMemberCardPage({
|
||||
pageNumber: pageNumber.value,
|
||||
pageSize: 10,
|
||||
sort: 'createTime',
|
||||
order: 'desc',
|
||||
memberCardStatus: statusTab.value,
|
||||
}).then((res) => {
|
||||
loading.value = false
|
||||
if (!res.data.success) return
|
||||
const records = ((res.data.result && res.data.result.records) || []).map((item: any) =>
|
||||
decorateGiftCard(item)
|
||||
)
|
||||
if (pageNumber.value === 1) {
|
||||
list.value = records
|
||||
} else {
|
||||
list.value = list.value.concat(records)
|
||||
}
|
||||
loadStatus.value = records.length < 10 ? 'noMore' : 'more'
|
||||
}).catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
if (loadStatus.value === 'noMore' || loading.value) return
|
||||
pageNumber.value += 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function submitBind() {
|
||||
const cardNo = String(bindForm.value.cardNo || '').trim()
|
||||
const cardSecret = String(bindForm.value.cardSecret || '').trim()
|
||||
if (!cardNo) {
|
||||
uni.showToast({ title: '请输入卡号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!cardSecret) {
|
||||
uni.showToast({ title: '请输入兑换码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (bindSubmitting.value) return
|
||||
bindSubmitting.value = true
|
||||
bindGiftCardCashMemberCard({ cardNo, cardSecret })
|
||||
.then((res) => {
|
||||
bindSubmitting.value = false
|
||||
if (!res.data.success) return
|
||||
uni.showToast({ title: res.data.message || '兑换成功', icon: 'none' })
|
||||
bindForm.value = { cardNo: '', cardSecret: '' }
|
||||
const pendingIndex = tabList.findIndex((item) => item.status === GIFT_CARD_STATUS.PENDING_ACTIVATION)
|
||||
if (pendingIndex >= 0 && tabCurrentIndex.value !== pendingIndex) {
|
||||
tabCurrentIndex.value = pendingIndex
|
||||
return
|
||||
}
|
||||
resetAndLoad()
|
||||
})
|
||||
.catch(() => {
|
||||
bindSubmitting.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function isActivating(item: any) {
|
||||
const id = resolveMemberCardId(item)
|
||||
return !!activatingId.value && activatingId.value === id
|
||||
}
|
||||
|
||||
function onCardPrimaryAction(item: any) {
|
||||
if (actionDisabled.value) return
|
||||
if (statusTab.value === GIFT_CARD_STATUS.PENDING_ACTIVATION) {
|
||||
const memberCardId = resolveMemberCardId(item)
|
||||
if (!memberCardId) {
|
||||
uni.showToast({ title: '卡片信息异常,无法激活', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (activatingId.value) return
|
||||
activatingId.value = memberCardId
|
||||
activateGiftCardCashMemberCard(memberCardId)
|
||||
.then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({ title: res.data.message || '激活成功', icon: 'none' })
|
||||
const availableIndex = tabList.findIndex((item) => item.status === GIFT_CARD_STATUS.AVAILABLE)
|
||||
if (availableIndex >= 0 && tabCurrentIndex.value !== availableIndex) {
|
||||
tabCurrentIndex.value = availableIndex
|
||||
return
|
||||
}
|
||||
resetAndLoad()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
activatingId.value = ''
|
||||
})
|
||||
return
|
||||
}
|
||||
if (statusTab.value === GIFT_CARD_STATUS.AVAILABLE) {
|
||||
uni.switchTab({ url: '/pages/tabbar/home/index' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
height: 100vh;
|
||||
background: #f7f8fa;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.bind-section {
|
||||
margin: 24rpx;
|
||||
padding: 28rpx 24rpx 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.bind-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 88rpx;
|
||||
border-bottom: 1rpx solid #f0f1f5;
|
||||
}
|
||||
|
||||
.bind-label {
|
||||
width: 110rpx;
|
||||
flex-shrink: 0;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.bind-btn {
|
||||
margin-top: 24rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
border-radius: 40rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
background: linear-gradient(135deg, #ff6b35, #ff4b2b);
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.tabs-wrap {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.list-scroll {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.gcc-card {
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
&.is-disabled {
|
||||
opacity: 0.72;
|
||||
}
|
||||
}
|
||||
|
||||
.gcc-header {
|
||||
position: relative;
|
||||
min-height: 180rpx;
|
||||
background: linear-gradient(125deg, #ff9a4a 0%, #ff7729 42%, #ff8f3d 100%);
|
||||
}
|
||||
|
||||
.gcc-header-pattern {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0.22;
|
||||
pointer-events: none;
|
||||
background-image: repeating-linear-gradient(
|
||||
-36deg,
|
||||
transparent,
|
||||
transparent 10rpx,
|
||||
rgba(255, 255, 255, 0.45) 10rpx,
|
||||
rgba(255, 255, 255, 0.45) 12rpx
|
||||
);
|
||||
}
|
||||
|
||||
.gcc-header-inner {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 28rpx 24rpx 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.gcc-header-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-right: 16rpx;
|
||||
}
|
||||
|
||||
.gcc-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.gcc-face {
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.gcc-cardno {
|
||||
margin-top: 28rpx;
|
||||
font-size: 22rpx;
|
||||
opacity: 0.75;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.gcc-header-right {
|
||||
text-align: right;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.gcc-type {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.gcc-expire {
|
||||
margin-top: 16rpx;
|
||||
font-size: 22rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.gcc-body {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.gcc-row {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.gcc-strong {
|
||||
color: #ff6b22;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.gcc-action {
|
||||
margin-top: 24rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
text-align: center;
|
||||
border-radius: 999rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #e95b6c;
|
||||
background: #faf4f5;
|
||||
|
||||
&.is-disabled {
|
||||
color: #c5c8ce;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
}
|
||||
|
||||
.load-more,
|
||||
.notice {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
padding: 8rpx 8rpx 40rpx;
|
||||
}
|
||||
|
||||
.notice {
|
||||
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
@@ -124,7 +124,7 @@ function hideLoadingIfNeeded() {
|
||||
}
|
||||
|
||||
function callback(paymentMethod: string) {
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url:
|
||||
'/pages/cart/payment/success?paymentMethod=' +
|
||||
paymentMethod +
|
||||
|
||||
@@ -60,9 +60,11 @@ function checkOrder() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/mine/deposit/operation',
|
||||
})
|
||||
} else {
|
||||
navigateTo('/pages/order/myOrder?status=0')
|
||||
return
|
||||
}
|
||||
uni.reLaunch({
|
||||
url: '/pages/order/myOrder?status=0',
|
||||
})
|
||||
}
|
||||
|
||||
function navigateTo(url: string, type?: string) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</block>
|
||||
</scroll-view>
|
||||
<div class="keyword-box" v-show="!isShowKeywordList">
|
||||
<view class="keyword-block add1">
|
||||
<view class="keyword-block add1" v-if="hotKeywordList.length">
|
||||
<view class="keyword-list-header">
|
||||
<view class="u-tips">热门搜索</view>
|
||||
</view>
|
||||
@@ -624,31 +624,43 @@ function loadOldKeyword(index: number) {
|
||||
})
|
||||
}
|
||||
|
||||
function getHistoryKeywords(limit = 10) {
|
||||
try {
|
||||
const raw = uni.getStorageSync('OldKeys')
|
||||
const list = raw ? JSON.parse(raw) : []
|
||||
return Array.isArray(list) ? list.filter(Boolean).slice(0, limit) : []
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
async function loadHotKeyword() {
|
||||
hotKeywordList.value = []
|
||||
if (
|
||||
!storage.getHotWords().time ||
|
||||
storage.getHotWords().time <= new Date().getTime() / 1000
|
||||
) {
|
||||
const res = await getHotKeywords(10)
|
||||
const keywords = res.data.result
|
||||
const cached = storage.getHotWords() || {}
|
||||
const now = Date.now() / 1000
|
||||
let keywords: string[] = []
|
||||
|
||||
keywords.forEach((item: string) => {
|
||||
hotKeywordList.value.push(item)
|
||||
})
|
||||
|
||||
const hotData = {
|
||||
time: new Date().getTime() / 1000 + 30 * 5,
|
||||
keywords: keywords,
|
||||
}
|
||||
storage.setHotWords(hotData)
|
||||
if (cached.time && cached.time > now && Array.isArray(cached.keywords) && cached.keywords.length) {
|
||||
keywords = cached.keywords
|
||||
} else {
|
||||
const keywords = storage.getHotWords().keywords
|
||||
|
||||
keywords.forEach((item: string) => {
|
||||
hotKeywordList.value.push(item)
|
||||
try {
|
||||
const res = await getHotKeywords(10)
|
||||
if (res?.data?.success && Array.isArray(res.data.result)) {
|
||||
keywords = res.data.result.filter(Boolean)
|
||||
}
|
||||
} catch {
|
||||
keywords = []
|
||||
}
|
||||
storage.setHotWords({
|
||||
time: now + 30 * 5,
|
||||
keywords,
|
||||
})
|
||||
}
|
||||
|
||||
if (!keywords.length) {
|
||||
keywords = getHistoryKeywords(10)
|
||||
}
|
||||
|
||||
hotKeywordList.value = keywords
|
||||
loadDefaultKeyword()
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</view>
|
||||
<view>
|
||||
<template v-for="(item,index) in sku.orderItems" :key="index">
|
||||
<view class="goods-item-view" v-if="item.sn == sn"
|
||||
<view class="goods-item-view" v-if="item && item.sn == sn"
|
||||
@click="gotoGoodsDetail(sku.goodsId || sku.goods_id)">
|
||||
<view class="goods-img">
|
||||
<u-image
|
||||
@@ -31,8 +31,8 @@
|
||||
<view class="goods-info">
|
||||
<view class="goods-title">{{ getGoodsName(item) }}</view>
|
||||
<view class="goods-price">
|
||||
<text>¥{{ unitPrice(applyInfo.applyRefundPrice) }}</text>
|
||||
<text class="num">购买数量: {{ item.num }}</text>
|
||||
<text>¥{{ unitPrice(displayRefundPrice) }}</text>
|
||||
<text class="num">购买数量: {{ item.num || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -41,10 +41,10 @@
|
||||
<view class="after-num">
|
||||
<text class="after-num-label">申请数量</text>
|
||||
<u-number-box
|
||||
:value="parseInt(form.num)"
|
||||
:value="applyNum"
|
||||
disabled-input
|
||||
:min="1"
|
||||
:max="parseInt(sku.num)"
|
||||
:max="maxApplyNum"
|
||||
bg-color="#fff"
|
||||
@change="valChange"
|
||||
></u-number-box>
|
||||
@@ -169,6 +169,8 @@ import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useStore } from '@/store'
|
||||
import { unitPrice, parseGoodsImageUrl } from '@/utils/filters.js'
|
||||
import { getAfterSaleReason, applyReturn, getAfterSaleInfo } from '@/api/after-sale'
|
||||
import { isAppointmentOrder } from '@/utils/goodsType.js'
|
||||
import { computePartialRefundPrice } from '@/utils/appointmentGoods.js'
|
||||
import { handleUploadAfterRead } from '@/utils/uploadHelper.js'
|
||||
import storage from '@/utils/storage.js'
|
||||
|
||||
@@ -185,6 +187,7 @@ const reasonSelectShow = ref(false)
|
||||
const reasonList = ref<any[]>([])
|
||||
const applyInfo = ref<any>({})
|
||||
const uToast = ref<any>(null)
|
||||
const isAppointmentAfterSale = ref(false)
|
||||
|
||||
const form = reactive({
|
||||
orderItemSn: '',
|
||||
@@ -203,6 +206,21 @@ const form = reactive({
|
||||
bankAccountNumber: '',
|
||||
})
|
||||
|
||||
const displayRefundPrice = computed(() => {
|
||||
if (!isAppointmentAfterSale.value) return applyInfo.value?.applyRefundPrice
|
||||
return computePartialRefundPrice(applyInfo.value, form.num)
|
||||
})
|
||||
|
||||
const maxApplyNum = computed(() => {
|
||||
const value = Number(sku.value?.num)
|
||||
return value > 0 ? value : 1
|
||||
})
|
||||
|
||||
const applyNum = computed(() => {
|
||||
const value = Number(form.num)
|
||||
return value > 0 ? value : 1
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
let navTitle = '申请售后'
|
||||
form.serviceType = 'RETURN_GOODS'
|
||||
@@ -220,11 +238,14 @@ onLoad((options) => {
|
||||
}
|
||||
uni.setNavigationBarTitle({ title: navTitle })
|
||||
sn.value = options?.sn || ''
|
||||
sku.value = storage.getAfterSaleData()
|
||||
const cached = storage.getAfterSaleData()
|
||||
sku.value = cached && typeof cached === 'object' ? cached : { orderItems: [] }
|
||||
if (!Array.isArray(sku.value.orderItems)) sku.value.orderItems = []
|
||||
isAppointmentAfterSale.value = isAppointmentOrder(sku.value?.orderType)
|
||||
form.orderItemSn = options?.sn || ''
|
||||
form.skuId = sku.value.skuId
|
||||
form.num = sku.value.num
|
||||
form.goodsId = sku.value.goodsId
|
||||
form.skuId = sku.value.skuId || ''
|
||||
form.num = Number(sku.value.num) > 0 ? Number(sku.value.num) : 1
|
||||
form.goodsId = sku.value.goodsId || ''
|
||||
fetchReasonActions(form.serviceType)
|
||||
init(options?.sn || '')
|
||||
})
|
||||
@@ -271,8 +292,12 @@ function init(orderItemSn: string) {
|
||||
icon: 'none',
|
||||
})
|
||||
} else {
|
||||
applyInfo.value = response.data.result
|
||||
form.accountType = response.data.result.accountType
|
||||
const result = response.data.result
|
||||
applyInfo.value = {
|
||||
...result,
|
||||
totalNum: result.orderItemNum || sku.value?.num,
|
||||
}
|
||||
form.accountType = result.accountType
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -294,6 +319,12 @@ function reasonSelectConfirm(val: any) {
|
||||
|
||||
function valChange(e: { value: number }) {
|
||||
form.num = e.value
|
||||
if (isAppointmentAfterSale.value) {
|
||||
applyInfo.value = {
|
||||
...applyInfo.value,
|
||||
applyRefundPrice: computePartialRefundPrice(applyInfo.value, form.num),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onUploadAfterRead(event: any) {
|
||||
@@ -320,7 +351,9 @@ function onSubmit() {
|
||||
uni.showLoading({ title: '加载中' })
|
||||
form.accountType = applyInfo.value.accountType
|
||||
form.refundWay = applyInfo.value.refundWay
|
||||
form.applyRefundPrice = applyInfo.value.applyRefundPrice
|
||||
form.applyRefundPrice = isAppointmentAfterSale.value
|
||||
? computePartialRefundPrice(applyInfo.value, form.num)
|
||||
: applyInfo.value.applyRefundPrice
|
||||
|
||||
applyReturn(sn.value, form).then((resp) => {
|
||||
hideLoadingIfNeeded()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</view>
|
||||
<view>
|
||||
<template v-for="(item,index) in sku.orderItems" :key="index">
|
||||
<view class="goods-item-view" v-if="item.sn == sn" @click="navigateToGoodsDetail(sku.skuId)">
|
||||
<view class="goods-item-view" v-if="item && item.sn == sn" @click="navigateToGoodsDetail(sku.skuId)">
|
||||
<view class="goods-img">
|
||||
<u-image
|
||||
border-radius="6"
|
||||
@@ -23,8 +23,8 @@
|
||||
<view class="goods-info">
|
||||
<view class="goods-title">{{ getGoodsName(item) }}</view>
|
||||
<view class="goods-price">
|
||||
<text v-if="sku.orderItems.length <= 1">¥{{ unitPrice(sku.flowPrice) }}</text>
|
||||
<text class="num">购买数量: {{ item.num }}</text>
|
||||
<text v-if="!sku.orderItems || sku.orderItems.length <= 1">¥{{ unitPrice(sku.flowPrice) }}</text>
|
||||
<text class="num">购买数量: {{ item.num || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -72,7 +72,9 @@ const applyInfo = ref<any>({})
|
||||
|
||||
onLoad((options) => {
|
||||
sn.value = options?.sn || ''
|
||||
sku.value = storage.getAfterSaleData()
|
||||
const cached = storage.getAfterSaleData()
|
||||
sku.value = cached && typeof cached === 'object' ? cached : { orderItems: [] }
|
||||
if (!Array.isArray(sku.value.orderItems)) sku.value.orderItems = []
|
||||
if (isECouponOrder(sku.value?.orderType)) {
|
||||
uni.showToast({
|
||||
title: '电子卡券订单不支持售后',
|
||||
|
||||
1131
pages/order/appointment/appointmentCheckout.vue
Normal file
1131
pages/order/appointment/appointmentCheckout.vue
Normal file
File diff suppressed because it is too large
Load Diff
44
pages/order/components/verificationCodes.vue
Normal file
44
pages/order/components/verificationCodes.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<view v-if="items.length" class="verify-codes">
|
||||
<view v-for="(item, index) in items" :key="item.key" class="verify-code">
|
||||
<text class="verify-code__label">{{ index === 0 ? '核销码' : '' }}</text>
|
||||
<text class="verify-code__text" :class="{ 'is-struck': item.struck }">{{ item.code }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
items: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.verify-code {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 12rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.verify-code__label {
|
||||
color: #999;
|
||||
width: 140rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.verify-code__text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-weight: bold;
|
||||
letter-spacing: 2rpx;
|
||||
color: #333;
|
||||
}
|
||||
.verify-code__text.is-struck {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="wrapper" :style="themeStyle">
|
||||
<!-- 选择地址 -->
|
||||
<div
|
||||
class="address-box"
|
||||
@@ -68,6 +68,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<view class="appointment-card" v-if="isAppointmentCheckout && appointmentCheckoutView">
|
||||
<view class="appointment-card__title">预约信息</view>
|
||||
<view class="appointment-hero">
|
||||
<view class="appointment-hero__time">{{ appointmentCheckoutView.time }}</view>
|
||||
<view class="appointment-hero__meta">
|
||||
<text>{{ appointmentCheckoutView.dateText }} {{ appointmentCheckoutView.week }}</text>
|
||||
<text v-if="appointmentCheckoutView.mode" class="appointment-tag">{{ appointmentCheckoutView.mode }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="appointment-form" v-if="appointmentCheckoutView.formRows.length">
|
||||
<template v-for="(row, index) in appointmentCheckoutView.formRows" :key="index">
|
||||
<view v-if="row.type === 'group'" class="appointment-group">{{ row.label }}</view>
|
||||
<view v-else class="appointment-row">
|
||||
<text class="appointment-row__label">{{ row.label }}</text>
|
||||
<text class="appointment-row__value">{{ row.value }}</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 开团信息 -->
|
||||
<view class="group-box" v-if="isAssemble">
|
||||
<view class="group-title">
|
||||
@@ -336,34 +356,24 @@
|
||||
</u-col>
|
||||
</u-row>
|
||||
</div>
|
||||
<div v-if="giftCardList.length || giftCardDeductAmount > 0">
|
||||
<u-row>
|
||||
<u-col :span="6">礼品卡</u-col>
|
||||
<u-col :span="6" class="tr tipsColor" textAlign="right">
|
||||
<span v-if="giftCardDeductAmount > 0" class="main-color"
|
||||
>-¥{{ unitPrice(giftCardDeductAmount) }}</span
|
||||
>
|
||||
<span v-else @click="giftCardExpanded = !giftCardExpanded"
|
||||
>{{ giftCardList.length }} 张可用</span
|
||||
>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<view v-if="giftCardExpanded && giftCardList.length" class="gift-card-list">
|
||||
<view
|
||||
class="gift-card-item"
|
||||
:class="{ 'gift-card-item--selected': isGiftCardSelected(item) }"
|
||||
v-for="item in giftCardList"
|
||||
:key="item.id"
|
||||
@click="toggleGiftCard(item)"
|
||||
>
|
||||
<view class="gift-card-item__name">{{ item.giftCardName || '礼品卡' }}</view>
|
||||
<view class="gift-card-item__meta">
|
||||
<text>余额 ¥{{ unitPrice(item.balance) }}</text>
|
||||
<text class="gift-card-item__no">{{ item.cardNo }}</text>
|
||||
</view>
|
||||
<u-row>
|
||||
<u-col :span="8" @click="openGiftCards()">使用礼品卡</u-col>
|
||||
<u-col
|
||||
:span="4"
|
||||
textAlign="right"
|
||||
class="coupon-col"
|
||||
@click="openGiftCards()"
|
||||
>
|
||||
<view class="coupon-col__content" v-if="giftCardDeductAmount > 0">
|
||||
<text class="main-color">-¥{{ unitPrice(giftCardDeductAmount) }}</text>
|
||||
<u-icon name="arrow-right" size="14" color="#909399"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
<view class="coupon-col__content" v-else>
|
||||
<text>{{ giftCardList.length }} 张可用</text>
|
||||
<u-icon name="arrow-right" size="14" color="#909399"></u-icon>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</div>
|
||||
|
||||
<!-- 配送地区没有提示 -->
|
||||
@@ -416,11 +426,11 @@
|
||||
import { ref, computed, watch, getCurrentInstance } from 'vue'
|
||||
import { onLoad, onShow, onBackPress } from '@dcloudio/uni-app'
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import * as API_Address from '@/api/address'
|
||||
import * as API_Order from '@/api/order'
|
||||
import * as API_Trade from '@/api/trade'
|
||||
import configs from '@/config/config'
|
||||
import LiLiWXPay from '@/js_sdk/lili-pay/wx-pay.js'
|
||||
import invoices from '@/pages/order/invoice/setInvoice'
|
||||
import {
|
||||
unitPrice,
|
||||
@@ -428,9 +438,12 @@ import {
|
||||
secrecyMobile,
|
||||
isLogin,
|
||||
} from '@/utils/filters.js'
|
||||
import { hasECouponInCheckout } from '@/utils/goodsType.js'
|
||||
import { hasECouponInCheckout, hasAppointmentInCheckout } from '@/utils/goodsType.js'
|
||||
import { SERVICE_MODE_LABEL, formatDate } from '@/utils/appointmentGoods.js'
|
||||
import { bindCheckout } from '@/api/appointment.js'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
const { proxy } = getCurrentInstance()!
|
||||
const lightColor = computed(() => store.getters.lightColor)
|
||||
const mainColor = computed(() => store.getters.mainColor)
|
||||
@@ -474,10 +487,71 @@ const originOrderData = ref<any>('')
|
||||
|
||||
// E_COUPON 结算:免地址/免配送(hidePhysicalCheckout);优惠券/活动/礼品卡可用(M-02)
|
||||
const isECouponCheckout = computed(() => hasECouponInCheckout(orderMessage.value))
|
||||
const isAppointmentCheckout = computed(() => hasAppointmentInCheckout(orderMessage.value))
|
||||
const isVirtualCheckout = computed(() => orderMessage.value?.cartTypeEnum === 'VIRTUAL')
|
||||
const hidePhysicalCheckout = computed(
|
||||
() => isVirtualCheckout.value || isECouponCheckout.value
|
||||
() => isVirtualCheckout.value || isECouponCheckout.value || isAppointmentCheckout.value
|
||||
)
|
||||
const appointmentCheckoutContext = ref<any>(null)
|
||||
|
||||
const APPOINTMENT_WEEK_LABELS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
|
||||
function presentAppointmentFormRows(rows: any[]) {
|
||||
const result: any[] = []
|
||||
let lastGroup = ''
|
||||
rows.forEach((row) => {
|
||||
if (row?.type === 'group') {
|
||||
result.push(row)
|
||||
lastGroup = row.label || ''
|
||||
return
|
||||
}
|
||||
const matched = String(row?.label || '').match(/^(.*?)(?:\s*[((](\d+)[))])$/)
|
||||
if (!matched) {
|
||||
result.push(row)
|
||||
return
|
||||
}
|
||||
const group = `第${matched[2]}位`
|
||||
if (group !== lastGroup) {
|
||||
result.push({ type: 'group', label: group })
|
||||
lastGroup = group
|
||||
}
|
||||
result.push({ label: matched[1], value: row.value })
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
const appointmentCheckoutView = computed(() => {
|
||||
const ctx =
|
||||
appointmentCheckoutContext.value ||
|
||||
orderMessage.value?.appointmentCheckout ||
|
||||
orderMessage.value?.appointmentContext
|
||||
if (!ctx) return null
|
||||
const date = formatDate(ctx.slotDate)
|
||||
let dateText = ''
|
||||
let week = ''
|
||||
if (date) {
|
||||
const [year, month, day] = date.split('-').map(Number)
|
||||
const current = new Date(year, month - 1, day)
|
||||
dateText = `${month}月${day}日`
|
||||
week = APPOINTMENT_WEEK_LABELS[current.getDay()] || ''
|
||||
}
|
||||
const time =
|
||||
ctx.slotStartTime && ctx.slotEndTime ? `${ctx.slotStartTime} - ${ctx.slotEndTime}` : dateText
|
||||
const mode = SERVICE_MODE_LABEL[ctx.serviceMode] || ctx.serviceMode || ''
|
||||
const formRows = []
|
||||
if (ctx.serviceAddressSnapshot) {
|
||||
formRows.push({ label: '服务地址', value: ctx.serviceAddressSnapshot })
|
||||
}
|
||||
const savedRows = Array.isArray(ctx.formRows) ? ctx.formRows : []
|
||||
if (savedRows.length) {
|
||||
formRows.push(...presentAppointmentFormRows(savedRows))
|
||||
} else {
|
||||
if (ctx.contactName) formRows.push({ label: '联系人', value: ctx.contactName })
|
||||
if (ctx.contactPhone) formRows.push({ label: '联系方式', value: ctx.contactPhone })
|
||||
}
|
||||
if (!time && !formRows.length) return null
|
||||
return { dateText, week, time, mode, formRows }
|
||||
})
|
||||
|
||||
const giftCardList = computed(() => orderMessage.value?.canUseGiftCards || [])
|
||||
const giftCardDeductAmount = computed(() => {
|
||||
@@ -488,8 +562,6 @@ const giftCardDeductAmount = computed(() => {
|
||||
}
|
||||
return Number(dto.giftCardPrice) || 0
|
||||
})
|
||||
const selectedGiftCardIds = computed(() => orderMessage.value?.selectedGiftCardIds || [])
|
||||
const giftCardExpanded = ref(false)
|
||||
|
||||
watch(
|
||||
remarkVal,
|
||||
@@ -527,9 +599,10 @@ onShow(async () => {
|
||||
mask: true,
|
||||
})
|
||||
try {
|
||||
appointmentCheckoutContext.value = uni.getStorageSync('appointment_checkout_context') || null
|
||||
await getOrderList()
|
||||
// E_COUPON 不需要配送方式
|
||||
if (!isECouponCheckout.value) {
|
||||
// E_COUPON / 预约商品不需要配送方式
|
||||
if (!isECouponCheckout.value && !isAppointmentCheckout.value) {
|
||||
await getDistribution()
|
||||
}
|
||||
if (routerVal.value.way == 'PINTUAN') {
|
||||
@@ -605,27 +678,10 @@ function invoice() {
|
||||
invoiceFlag.value = true
|
||||
}
|
||||
|
||||
function isGiftCardSelected(item: any) {
|
||||
if (!item?.id) return false
|
||||
return (selectedGiftCardIds.value || []).map(String).includes(String(item.id))
|
||||
}
|
||||
|
||||
function toggleGiftCard(item: any) {
|
||||
if (!item?.id) return
|
||||
API_Trade.selectGiftCard({
|
||||
way: routerVal.value.way,
|
||||
credentialId: String(item.id),
|
||||
used: !isGiftCardSelected(item),
|
||||
}).then((res) => {
|
||||
if (res.data.success) {
|
||||
getOrderList()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message || '礼品卡选择失败',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
})
|
||||
function openGiftCards() {
|
||||
;(store.state as any).canUseGiftCards = giftCardList.value
|
||||
;(store.state as any).selectedGiftCardIds = orderMessage.value?.selectedGiftCardIds || []
|
||||
navigateTo(`/pages/cart/gift-card/index?way=${routerVal.value.way}`)
|
||||
}
|
||||
|
||||
function GET_Discount() {
|
||||
@@ -717,44 +773,57 @@ function createTradeFun() {
|
||||
delete submit.parentOrderSn
|
||||
}
|
||||
|
||||
API_Trade.createTrade(submit).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: '创建订单成功!',
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
})
|
||||
if (orderMessage.value.priceDetailDTO.billPrice == 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/myOrder?status=0',
|
||||
const runCreate = () =>
|
||||
API_Trade.createTrade(submit).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.removeStorageSync('appointment_checkout_context')
|
||||
uni.showToast({
|
||||
title: '创建订单成功!',
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
})
|
||||
if (orderMessage.value.priceDetailDTO.billPrice == 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/myOrder?status=0',
|
||||
})
|
||||
} else {
|
||||
navigateTo(
|
||||
`/pages/cart/payment/payOrder?trade_sn=${res.data.result.sn}`
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// #ifdef MP-WEIXIN
|
||||
pay(res.data.result.sn)
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
navigateTo(
|
||||
`/pages/cart/payment/payOrder?trade_sn=${res.data.result.sn}`
|
||||
)
|
||||
// #endif
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
})
|
||||
|
||||
if (isAppointmentCheckout.value) {
|
||||
const ctx =
|
||||
appointmentCheckoutContext.value ||
|
||||
uni.getStorageSync('appointment_checkout_context')
|
||||
if (!ctx) {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
duration: 2000,
|
||||
title: '预约信息不完整,请返回重选时段',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
})
|
||||
}, 3000)
|
||||
}
|
||||
bindCheckout(ctx)
|
||||
.then(runCreate)
|
||||
.catch((e: any) => {
|
||||
uni.showToast({
|
||||
title: e?.data?.message || e?.message || '预约信息提交失败',
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
async function pay(sn: string) {
|
||||
new LiLiWXPay({
|
||||
sn,
|
||||
price: orderMessage.value.priceDetailDTO.billPrice,
|
||||
}).pay()
|
||||
runCreate()
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
function getUserAddress() {
|
||||
@@ -860,9 +929,11 @@ function getOrderList() {
|
||||
orderMessage.value = res.data.result
|
||||
;(store.state as any).canUseCoupons = res.data.result.canUseCoupons
|
||||
;(store.state as any).cantUseCoupons = res.data.result.cantUseCoupons
|
||||
;(store.state as any).canUseGiftCards = res.data.result.canUseGiftCards || []
|
||||
;(store.state as any).selectedGiftCardIds = res.data.result.selectedGiftCardIds || []
|
||||
|
||||
// E_COUPON 免地址,不自动回填 memberAddress
|
||||
if (!hasECouponInCheckout(res.data.result)) {
|
||||
// E_COUPON / 预约商品免地址,不自动回填 memberAddress
|
||||
if (!hasECouponInCheckout(res.data.result) && !hasAppointmentInCheckout(res.data.result)) {
|
||||
if (!res.data.result.memberAddress) {
|
||||
getUserAddress()
|
||||
} else {
|
||||
@@ -894,6 +965,89 @@ page {
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.appointment-card {
|
||||
margin-bottom: 20rpx;
|
||||
padding: 28rpx 32rpx 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
.appointment-card__title {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.appointment-hero {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.appointment-hero__time {
|
||||
font-size: 44rpx;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
line-height: 1.2;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
.appointment-hero__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
margin-top: 14rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.appointment-tag {
|
||||
padding: 2rpx 14rpx;
|
||||
border-radius: 8rpx;
|
||||
background: var(--theme-primary-10, rgba(255, 60, 42, 0.1));
|
||||
color: var(--theme-primary, #ff3c2a);
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.appointment-form {
|
||||
margin-top: 20rpx;
|
||||
border-top: 1rpx solid #f2f2f2;
|
||||
}
|
||||
.appointment-group {
|
||||
padding-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: var(--theme-primary, #ff3c2a);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.appointment-row + .appointment-group {
|
||||
margin-top: 8rpx;
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
}
|
||||
.appointment-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
padding: 22rpx 0;
|
||||
}
|
||||
.appointment-row + .appointment-row {
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
}
|
||||
.appointment-group + .appointment-row {
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
.appointment-row__label {
|
||||
flex: none;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
line-height: 1.5;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.appointment-row__value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.flex-8 {
|
||||
flex: 8;
|
||||
}
|
||||
@@ -1061,6 +1215,7 @@ page {
|
||||
|
||||
.box6 {
|
||||
position: fixed;
|
||||
z-index: 20;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
@@ -1072,6 +1227,7 @@ page {
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.tabbar-right {
|
||||
@@ -1162,7 +1318,8 @@ page {
|
||||
.wrapper {
|
||||
height: auto;
|
||||
background: #f7f7f7;
|
||||
padding-bottom: 200rpx;
|
||||
padding-bottom: calc(240rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(240rpx + env(safe-area-inset-bottom));
|
||||
overflow: auto !important;
|
||||
}
|
||||
|
||||
@@ -1250,39 +1407,4 @@ page {
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.gift-card-list {
|
||||
margin-top: 16rpx;
|
||||
padding: 0 8rpx 8rpx;
|
||||
}
|
||||
|
||||
.gift-card-item {
|
||||
border: 1rpx solid #eceef2;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
margin-bottom: 16rpx;
|
||||
background: #fff;
|
||||
|
||||
&--selected {
|
||||
border-color: $main-color;
|
||||
background: rgba($main-color, 0.04);
|
||||
}
|
||||
}
|
||||
|
||||
.gift-card-item__name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.gift-card-item__meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.gift-card-item__no {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,48 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="navbar">
|
||||
<view v-for="(item, index) in navList" :key="index" class="nav-item"
|
||||
:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
|
||||
</view>
|
||||
<scroll-view class="navbar" scroll-x :show-scrollbar="false">
|
||||
<view class="navbar-inner">
|
||||
<view v-for="(item, index) in navList" :key="index" class="nav-item"
|
||||
:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
|
||||
<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
|
||||
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData(tabIndex)">
|
||||
<!-- 空白页 -->
|
||||
<u-empty text="暂无订单" mode="list"
|
||||
<u-empty :text="tabItem.kind === 'afterSale' ? '暂无售后记录' : '暂无订单'" mode="list"
|
||||
v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></u-empty>
|
||||
<!-- 订单列表 -->
|
||||
<view class="seller-view" :key="orderIndex" v-for="(order, orderIndex) in tabItem.orderList">
|
||||
<template v-if="order.isAfterSale">
|
||||
<view class="seller-info u-flex u-row-between">
|
||||
<view class="seller-name wes">
|
||||
<view class="name">{{ order.storeName }}</view>
|
||||
</view>
|
||||
<view class="order-sn">{{ orderCardStatus(order) }}</view>
|
||||
</view>
|
||||
<view class="after-sale-sn">售后单号:{{ order.serviceSn }}</view>
|
||||
<view class="goods-item-view" @click="openOrder(order)">
|
||||
<view class="goods-img">
|
||||
<u-image border-radius="6" width="131rpx" height="131rpx" mode="aspectFill"
|
||||
:src="getOrderItemImage(order.orderItems[0], order, 0)"></u-image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-title u-line-2">{{ order.groupName }}</view>
|
||||
<view class="goods-price">申请退款 ¥{{ unitPrice(order.applyRefundPrice) }}</view>
|
||||
</view>
|
||||
<view class="goods-num">
|
||||
<view>x{{ order.groupNum }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-view u-flex u-row-between">
|
||||
<view class="description">{{ afterSaleTypeText(order.serviceType) }}</view>
|
||||
<view class="goods-btn flex flex-a-c">
|
||||
<view class="pay-btn" @click="openOrder(order)">售后详情</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 店铺名称 -->
|
||||
<view class="seller-info u-flex u-row-between">
|
||||
<view class="seller-name wes" @click="navigateToStore(order)">
|
||||
@@ -26,12 +57,11 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="order-sn">{{orderStatusList(order.orderStatus)
|
||||
}}</view>
|
||||
<view class="order-sn">{{ orderCardStatus(order) }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<view class="goods-item-view" @click="navigateToOrderDetail(order.sn)">
|
||||
<view class="goods-item-view" @click="openOrder(order)">
|
||||
<view class="goods-img" v-for="(goods, goodsIndex) in order.orderItems"
|
||||
:key="goodsIndex">
|
||||
<u-image border-radius="6" width="131rpx" height="131rpx" mode="aspectFill"
|
||||
@@ -62,7 +92,7 @@
|
||||
v-if="order.allowOperationVO.pay" @click="waitPay(order)">立即付款</view>
|
||||
<!-- 取消订单 -->
|
||||
<view ripple class="cancel-btn" shape="circle" size="mini"
|
||||
v-if="order.allowOperationVO.cancel" @click="onCancel(order.sn)">
|
||||
v-if="showOrderCancel(order)" @click="onCancel(order.sn)">
|
||||
取消订单
|
||||
</view>
|
||||
<!-- 等待收货 -->
|
||||
@@ -70,16 +100,12 @@
|
||||
v-if="order.allowOperationVO.rog && !isECouponOrder(order.orderType)" @click="onRog(order.sn)">
|
||||
确认收货
|
||||
</view>
|
||||
<view ripple shape="circle" class="cancel-btn" size="mini"
|
||||
v-if="!isECouponOrder(order.orderType) && order.groupAfterSaleStatus && ( order.groupAfterSaleStatus.includes('NOT_APPLIED') || order.groupAfterSaleStatus.includes('PART_AFTER_SALE'))"
|
||||
@click="applyService(order)">
|
||||
退款/售后
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<uni-load-more :status="tabItem.loadStatus"></uni-load-more>
|
||||
<uni-load-more v-if="tabItem.orderList.length > 0" :status="tabItem.loadStatus"></uni-load-more>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -114,7 +140,7 @@ import { onLoad, onShow, onPullDownRefresh, onBackPress } from '@dcloudio/uni-ap
|
||||
import { useStore } from '@/store'
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
|
||||
import { getOrderList, cancelOrder, confirmReceipt } from '@/api/order.js'
|
||||
import { getClearReason } from '@/api/after-sale.js'
|
||||
import { getClearReason, getAfterSaleList } from '@/api/after-sale.js'
|
||||
import LiLiWXPay from '@/js_sdk/lili-pay/wx-pay.js'
|
||||
import {
|
||||
unitPrice,
|
||||
@@ -123,7 +149,8 @@ import {
|
||||
orderStatusList,
|
||||
} from '@/utils/filters.js'
|
||||
// E_COUPON 订单不展示确认收货、退款/售后(FR-B-04)
|
||||
import { isECouponOrder } from '@/utils/goodsType.js'
|
||||
import { isECouponOrder, isAppointmentOrder } from '@/utils/goodsType.js'
|
||||
import { appointmentOrderStatusText, getAppointmentAllowOperation } from '@/utils/appointmentGoods.js'
|
||||
|
||||
const store = useStore()
|
||||
const { proxy } = getCurrentInstance()!
|
||||
@@ -133,6 +160,9 @@ const mainColor = computed(() => store.getters.mainColor)
|
||||
interface NavTabItem {
|
||||
state: number
|
||||
text: string
|
||||
tag: string
|
||||
commentStatus?: string
|
||||
kind?: 'order' | 'afterSale'
|
||||
loadStatus: string
|
||||
orderList: any[]
|
||||
pageNumber: number
|
||||
@@ -141,30 +171,27 @@ interface NavTabItem {
|
||||
|
||||
const tabCurrentIndex = ref(0)
|
||||
const navList = reactive<NavTabItem[]>([
|
||||
{ state: 0, text: '全部', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 1, text: '待付款', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 2, text: '待发货', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 3, text: '待收货', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 4, text: '已完成', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 5, text: '已取消', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 0, text: '全部', tag: 'ALL', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 1, text: '待支付', tag: 'WAIT_PAY', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 2, text: '待发货', tag: 'WAIT_SHIP', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 3, text: '待收货/使用', tag: 'WAIT_USE', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 4, text: '评价', tag: 'ALL', commentStatus: 'UNFINISHED', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
{ state: 5, text: '售后', tag: 'ALL', kind: 'afterSale', loadStatus: 'more', orderList: [], pageNumber: 1 },
|
||||
])
|
||||
|
||||
const status = ref<number>(0)
|
||||
const params = reactive({
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
tag: 'ALL',
|
||||
})
|
||||
|
||||
const orderStatus = [
|
||||
{ orderStatus: 'ALL' },
|
||||
{ orderStatus: 'WAIT_PAY' },
|
||||
{ orderStatus: 'WAIT_SHIP' },
|
||||
{ orderStatus: 'WAIT_ROG' },
|
||||
{ orderStatus: 'COMPLETE' },
|
||||
{ orderStatus: 'CANCELLED' },
|
||||
{ orderStatus: 'STAY_PICKED_UP' },
|
||||
]
|
||||
const afterSaleStatusText: Record<string, string> = {
|
||||
APPLY: '申请中',
|
||||
PASS: '已通过',
|
||||
REFUSE: '已拒绝',
|
||||
BUYER_RETURN: '待卖家收货',
|
||||
SELLER_CONFIRM: '卖家确认收货',
|
||||
SELLER_TERMINATION: '卖家终止售后',
|
||||
BUYER_CANCEL: '买家取消售后',
|
||||
WAIT_REFUND: '等待平台退款',
|
||||
COMPLETE: '完成',
|
||||
}
|
||||
|
||||
const cancelShow = ref(false)
|
||||
const orderSn = ref('')
|
||||
@@ -207,21 +234,15 @@ onLoad((options) => {
|
||||
})
|
||||
|
||||
watch(tabCurrentIndex, (val) => {
|
||||
params.tag = orderStatus[val].orderStatus
|
||||
navList.forEach((res) => {
|
||||
res.pageNumber = 1
|
||||
res.loadStatus = 'more'
|
||||
res.orderList = []
|
||||
res.loaded = false
|
||||
})
|
||||
loadData(val)
|
||||
})
|
||||
|
||||
function applyService(order: any) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/afterSales/afterSales?orderSn=${order.sn}`,
|
||||
})
|
||||
}
|
||||
|
||||
function navigateToStore(val: any) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/shopPage?id=' + val.storeId,
|
||||
@@ -285,6 +306,7 @@ function initData(index: number) {
|
||||
navList[index].pageNumber = 1
|
||||
navList[index].loadStatus = 'more'
|
||||
navList[index].orderList = []
|
||||
navList[index].loaded = false
|
||||
loadData(index)
|
||||
}
|
||||
|
||||
@@ -301,26 +323,99 @@ function pay(val: any) {
|
||||
}
|
||||
|
||||
function loadData(index: number) {
|
||||
params.pageNumber = navList[index].pageNumber
|
||||
getOrderList(params).then((res) => {
|
||||
const tab = navList[index]
|
||||
if (!tab || tab.loadStatus === 'noMore') {
|
||||
return
|
||||
}
|
||||
const pageNumber = tab.pageNumber
|
||||
const request = tab.kind === 'afterSale'
|
||||
? getAfterSaleList({
|
||||
pageNumber,
|
||||
pageSize: 10,
|
||||
sort: 'createTime',
|
||||
order: 'desc',
|
||||
})
|
||||
: getOrderList({
|
||||
pageNumber,
|
||||
pageSize: 10,
|
||||
tag: tab.tag,
|
||||
...(tab.commentStatus ? { commentStatus: tab.commentStatus } : {}),
|
||||
})
|
||||
request.then((res) => {
|
||||
uni.stopPullDownRefresh()
|
||||
tab.loaded = true
|
||||
if (!res.data.success) {
|
||||
navList[index].loadStatus = 'noMore'
|
||||
tab.loadStatus = 'noMore'
|
||||
return false
|
||||
}
|
||||
const records = res.data.result.records
|
||||
if (records.length == 0) {
|
||||
navList[index].loadStatus = 'noMore'
|
||||
} else if (records.length < 10) {
|
||||
navList[index].loadStatus = 'noMore'
|
||||
let records = res.data.result.records || []
|
||||
if (tab.kind === 'afterSale') {
|
||||
records = records.map(mapAfterSaleOrder)
|
||||
}
|
||||
if (records.length < 10) {
|
||||
tab.loadStatus = 'noMore'
|
||||
}
|
||||
if (records.length > 0) {
|
||||
navList[index].orderList = navList[index].orderList.concat(records)
|
||||
navList[index].pageNumber += 1
|
||||
tab.orderList = tab.orderList.concat(records)
|
||||
tab.pageNumber += 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const afterSaleTypeTextMap: Record<string, string> = {
|
||||
RETURN_MONEY: '仅退款',
|
||||
RETURN_GOODS: '退货退款',
|
||||
EXCHANGE_GOODS: '换货',
|
||||
SUPPLY_AGAIN_GOODS: '补发商品',
|
||||
CANCEL: '取消订单',
|
||||
}
|
||||
|
||||
function afterSaleTypeText(type: string) {
|
||||
return afterSaleTypeTextMap[type] || '售后'
|
||||
}
|
||||
|
||||
function mapAfterSaleOrder(item: any) {
|
||||
return {
|
||||
...item,
|
||||
isAfterSale: true,
|
||||
serviceSn: item.sn,
|
||||
sn: item.orderSn,
|
||||
orderStatus: item.serviceStatus,
|
||||
groupName: item.goodsName,
|
||||
groupNum: item.num,
|
||||
groupImages: item.goodsImage,
|
||||
applyRefundPrice: item.applyRefundPrice,
|
||||
orderItems: [
|
||||
{
|
||||
image: item.goodsImage,
|
||||
name: item.goodsName,
|
||||
num: item.num,
|
||||
},
|
||||
],
|
||||
allowOperationVO: {},
|
||||
}
|
||||
}
|
||||
|
||||
function orderCardStatus(order: any) {
|
||||
if (order?.isAfterSale) {
|
||||
return afterSaleStatusText[order.serviceStatus] || '售后'
|
||||
}
|
||||
if (isAppointmentOrder(order?.orderType)) {
|
||||
return appointmentOrderStatusText(order.orderStatus)
|
||||
}
|
||||
return orderStatusList(order.orderStatus)
|
||||
}
|
||||
|
||||
function openOrder(order: any) {
|
||||
if (order?.isAfterSale) {
|
||||
uni.navigateTo({
|
||||
url: './afterSales/applyDetail?sn=' + order.serviceSn,
|
||||
})
|
||||
return
|
||||
}
|
||||
navigateToOrderDetail(order.sn)
|
||||
}
|
||||
|
||||
function changeTab(e: any) {
|
||||
tabCurrentIndex.value = e.target.current
|
||||
}
|
||||
@@ -371,6 +466,13 @@ function orderStateExp(state: number) {
|
||||
return { stateTip, stateTipColor }
|
||||
}
|
||||
|
||||
function showOrderCancel(order: any) {
|
||||
if (isAppointmentOrder(order?.orderType)) {
|
||||
return !!getAppointmentAllowOperation(order)?.cancel
|
||||
}
|
||||
return !!order?.allowOperationVO?.cancel
|
||||
}
|
||||
|
||||
function navigateToOrderDetail(sn: string) {
|
||||
uni.navigateTo({
|
||||
url: './orderDetail?sn=' + sn,
|
||||
@@ -456,23 +558,31 @@ function reBuy(order: any) {
|
||||
}
|
||||
|
||||
.navbar {
|
||||
display: flex;
|
||||
height: 40px;
|
||||
padding: 0 5px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
white-space: nowrap;
|
||||
|
||||
.navbar-inner {
|
||||
display: inline-flex;
|
||||
align-items: stretch;
|
||||
height: 40px;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
padding: 0 24rpx;
|
||||
font-size: 26rpx;
|
||||
color: $font-color-light;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
|
||||
&.current {
|
||||
color: $main-color;
|
||||
@@ -525,6 +635,12 @@ function reBuy(order: any) {
|
||||
}
|
||||
}
|
||||
|
||||
.after-sale-sn {
|
||||
padding: 0 32rpx 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.goods-item-view {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -1,17 +1,39 @@
|
||||
<template>
|
||||
<view>
|
||||
<view :style="themeStyle">
|
||||
<!-- 订单状态 -->
|
||||
<div class="info-view order-view">
|
||||
<div class="order-status" v-if="orderStatusMap[order.orderStatus]">
|
||||
<view class="order-status-title">{{ orderStatusMap[order.orderStatus].title }}</view>
|
||||
<view class="order-status-desc">{{ orderStatusMap[order.orderStatus].value }}</view>
|
||||
<div class="order-status" v-if="displayOrderStatus">
|
||||
<view class="order-status-title">{{ displayOrderStatus.title }}</view>
|
||||
<view class="order-status-desc" v-if="displayOrderStatus.value">{{ displayOrderStatus.value }}</view>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- 物流/配送信息 / 卡密入口 -->
|
||||
<view class="info-view logistics-view" v-if="showDeliveryInfoBlock">
|
||||
<view class="logistics-List">
|
||||
<view v-if="isECouponOrder" class="card-key-entry">
|
||||
<view v-if="isAppointmentOrderFlag" class="appointment-entry">
|
||||
<view class="appointment-entry__row">
|
||||
<text class="label">预约时间</text>
|
||||
<text class="value">{{ appointmentSlotText }}</text>
|
||||
</view>
|
||||
<view class="appointment-entry__row" v-if="appointmentDetail.serviceMode">
|
||||
<text class="label">服务方式</text>
|
||||
<text class="value">{{ serviceModeLabel }}</text>
|
||||
</view>
|
||||
<view class="appointment-entry__row" v-if="appointmentDetail.serviceAddressSnapshot">
|
||||
<text class="label">服务地址</text>
|
||||
<text class="value">{{ appointmentDetail.serviceAddressSnapshot }}</text>
|
||||
</view>
|
||||
<template v-for="(row, index) in appointmentFormRows" :key="index">
|
||||
<view v-if="row.type === 'group'" class="appointment-group">{{ row.label }}</view>
|
||||
<view v-else class="appointment-entry__row">
|
||||
<text class="label">{{ row.label }}</text>
|
||||
<text class="value">{{ row.value }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<verification-codes :items="verificationCodeItems" />
|
||||
</view>
|
||||
<view v-else-if="isECouponOrder" class="card-key-entry">
|
||||
<view v-if="ecouponCardKeyDelivered" class="card-key-entry__btn" @click="goCardKeyDetail">
|
||||
查看卡密
|
||||
</view>
|
||||
@@ -22,9 +44,7 @@
|
||||
{{ ecouponPendingMessage || '卡密尚未发放,请稍后刷新' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="verificationCode" v-else-if="order.verificationCode">
|
||||
券码: {{ order.orderStatus == 'CANCELLED' ? '已失效' : order.verificationCode }}
|
||||
</view>
|
||||
<verification-codes v-else-if="verificationCodeItems.length" :items="verificationCodeItems" />
|
||||
<view
|
||||
v-else-if="allowOperation.showLogistics"
|
||||
@click="handleClickDeliver()"
|
||||
@@ -76,8 +96,7 @@
|
||||
<view class="seller-info u-flex u-row-between">
|
||||
<view class="seller-name" @click="goToShopPage(order)">
|
||||
<view class="name">{{ order.storeName }}</view>
|
||||
<view class="status" v-if="orderStatusMap[order.orderStatus]"> {{ orderStatusMap[order.orderStatus].title
|
||||
}}</view>
|
||||
<view class="status" v-if="displayOrderStatus"> {{ displayOrderStatus.title }}</view>
|
||||
</view>
|
||||
<view class="order-sn"></view>
|
||||
</view>
|
||||
@@ -87,18 +106,23 @@
|
||||
<view class="goods-img" @click="gotoGoodsDetail(sku)">
|
||||
<u-image border-radius="6" width="131rpx" height="131rpx" :src="sku.image"></u-image>
|
||||
</view>
|
||||
<view class="goods-info" @click="gotoGoodsDetail(sku)">
|
||||
<view class="goods-title u-line-2">{{ sku.goodsName }}</view>
|
||||
<view class="goods-price">
|
||||
¥{{unitPrice(sku.goodsPrice) }}
|
||||
<!-- <span v-if="sku.point">+{{ sku.point }}积分</span> -->
|
||||
<span style="font-size: 24rpx;margin-left: 14rpx;color: #ff9900;" v-if="!isECouponOrder && sku.isRefund && sku.isRefund !== 'NO_REFUND'">
|
||||
{{refundPriceList(sku.isRefund)}} ({{unitPrice(sku.refundPrice, "¥") }})
|
||||
</span>
|
||||
<view class="goods-body">
|
||||
<view class="goods-info" @click="gotoGoodsDetail(sku)">
|
||||
<view class="goods-title u-line-2">{{ sku.goodsName }}</view>
|
||||
<view class="goods-price">
|
||||
¥{{unitPrice(sku.goodsPrice) }}
|
||||
<!-- <span v-if="sku.point">+{{ sku.point }}积分</span> -->
|
||||
<span style="font-size: 24rpx;margin-left: 14rpx;color: #ff9900;" v-if="!isECouponOrder && !isAppointmentOrderFlag && sku.isRefund && sku.isRefund !== 'NO_REFUND'">
|
||||
{{refundPriceList(sku.isRefund)}} ({{unitPrice(sku.refundPrice, "¥") }})
|
||||
</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-side" :class="{ 'has-action': canShowSkuAfterSale(sku) }">
|
||||
<view class="goods-num">
|
||||
<view>x{{ sku.num }}</view>
|
||||
</view>
|
||||
<view class="after-sale-btn" v-if="canShowSkuAfterSale(sku)" @click.stop="onSkuAfterSale(sku)">退款/售后</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-num">
|
||||
<view>x{{ sku.num }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -112,7 +136,7 @@
|
||||
<view class="title">商品总价:</view>
|
||||
<view class="value">¥{{unitPrice(order.goodsPrice) }}</view>
|
||||
</view>
|
||||
<view class="order-info-view" v-if="order.freightPrice && !isECouponOrder">
|
||||
<view class="order-info-view" v-if="order.freightPrice && !isECouponOrder && !isAppointmentOrderFlag">
|
||||
<view class="title">运费:</view>
|
||||
<view class="value">¥{{unitPrice(order.freightPrice) }}</view>
|
||||
</view>
|
||||
@@ -142,7 +166,7 @@
|
||||
</view>
|
||||
<view class="customer-list">
|
||||
<view class="customer-service"
|
||||
v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true"
|
||||
v-if="showCancelBtn"
|
||||
@click="onCancel(order.sn)">取消订单</view>
|
||||
<view class="customer-service" v-if="allowOperation.showLogistics" @click="handleClickDeliver()">查看物流</view>
|
||||
<view class="customer-service" v-if="order.orderStatus != 'UNPAID' && order.orderPromotionType == 'PINTUAN'"
|
||||
@@ -158,8 +182,8 @@
|
||||
<view class="title">订单编号:</view>
|
||||
<view class="value order-sn-value">
|
||||
<text class="order-sn-text">{{ order.sn }}</text>
|
||||
<view class="copy" @click.stop="onCopy(order.sn)">
|
||||
<u-tag text="复制" type="info" plain size="mini" />
|
||||
<view class="copy" @tap.stop="onCopy(order.sn)">
|
||||
<view class="copy-icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -264,10 +288,12 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import { getExpress, getPackage } from '@/api/trade.js'
|
||||
import { cancelOrder, confirmReceipt, getOrderDetail } from '@/api/order.js'
|
||||
import shares from '@/components/m-share/index'
|
||||
import { getClearReason } from '@/api/after-sale.js'
|
||||
import storage from '@/utils/storage'
|
||||
import {
|
||||
unitPrice,
|
||||
secrecyMobile,
|
||||
@@ -282,14 +308,26 @@ import {
|
||||
} from '@/utils/orderDelivery.js'
|
||||
import {
|
||||
isECouponOrder as checkECouponOrder,
|
||||
isAppointmentOrder as checkAppointmentOrder,
|
||||
isNonPhysicalOrder as checkNonPhysicalOrder,
|
||||
orderHasCardKeyContent,
|
||||
collectCardKeyFulfillLines,
|
||||
resolveCardKeyFulfillMessage,
|
||||
CARD_KEY_FULFILL_STATUS,
|
||||
} from '@/utils/goodsType.js'
|
||||
import { getAppointmentOrderDetail } from '@/api/appointment.js'
|
||||
import VerificationCodes from './components/verificationCodes.vue'
|
||||
import {
|
||||
SERVICE_MODE_LABEL,
|
||||
appointmentOrderStatusText,
|
||||
getAppointmentAllowOperation,
|
||||
formatDate,
|
||||
parseFormAnswerGroups,
|
||||
formatFormAnswerValue,
|
||||
} from '@/utils/appointmentGoods.js'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
const lightColor = computed(() => store.getters.lightColor)
|
||||
const mainColor = computed(() => store.getters.mainColor)
|
||||
|
||||
@@ -318,8 +356,70 @@ const reason = ref('')
|
||||
const orderPackage = ref<any[]>([])
|
||||
const legacyTraces = ref<any>(null)
|
||||
|
||||
const displayOrderStatus = computed(() => {
|
||||
if (isAppointmentOrderFlag.value) {
|
||||
const status = order.value?.orderStatus
|
||||
const title = appointmentOrderStatusText(status)
|
||||
if (status === 'UNPAID') return { title, value: '请尽快完成支付' }
|
||||
if (status === 'CANCELLED') return { title, value: '订单已取消' }
|
||||
if (status === 'COMPLETED' || status === 'COMPLETE') return { title, value: '服务已完成' }
|
||||
const onSite = appointmentDetail.value?.serviceMode === 'ON_SITE'
|
||||
return {
|
||||
title,
|
||||
value: onSite ? '请等待上门服务' : '请按时到店使用',
|
||||
}
|
||||
}
|
||||
return orderStatusMap[order.value?.orderStatus]
|
||||
})
|
||||
const isECouponOrder = computed(() => checkECouponOrder(order.value?.orderType))
|
||||
const isAppointmentOrderFlag = computed(() => checkAppointmentOrder(order.value?.orderType))
|
||||
const isNonPhysicalOrder = computed(() => checkNonPhysicalOrder(order.value?.orderType))
|
||||
const appointmentDetail = ref<Record<string, any>>({})
|
||||
const appointmentAllow = computed(() =>
|
||||
getAppointmentAllowOperation(order.value) || { cancel: false, afterSale: false }
|
||||
)
|
||||
const showCancelBtn = computed(() => {
|
||||
if (isAppointmentOrderFlag.value) return appointmentAllow.value.cancel
|
||||
return orderDetail.value.allowOperationVO?.cancel === true
|
||||
})
|
||||
const appointmentCodes = computed(() => appointmentDetail.value?.codes || [])
|
||||
const serviceModeLabel = computed(
|
||||
() => SERVICE_MODE_LABEL[appointmentDetail.value?.serviceMode] || appointmentDetail.value?.serviceMode || ''
|
||||
)
|
||||
const appointmentSlotText = computed(() => {
|
||||
const d = appointmentDetail.value
|
||||
if (!d?.slotDate) return '—'
|
||||
const date = formatDate(d.slotDate)
|
||||
const slot = d.slotStartTime && d.slotEndTime ? `${d.slotStartTime}-${d.slotEndTime}` : ''
|
||||
return [date, slot].filter(Boolean).join(' ')
|
||||
})
|
||||
const appointmentFormGroups = computed(() =>
|
||||
parseFormAnswerGroups(appointmentDetail.value?.formAnswerJson)
|
||||
)
|
||||
const appointmentFormRows = computed(() => {
|
||||
const groups = appointmentFormGroups.value
|
||||
const rows = []
|
||||
if (groups.length) {
|
||||
groups.forEach((group, index) => {
|
||||
if (groups.length > 1) {
|
||||
rows.push({ type: 'group', label: `第${index + 1}位` })
|
||||
}
|
||||
group.forEach((field) => {
|
||||
const value = formatFormAnswerValue(field.value)
|
||||
if (!value) return
|
||||
rows.push({ label: field.fieldLabel || '补充信息', value })
|
||||
})
|
||||
})
|
||||
return rows
|
||||
}
|
||||
if (appointmentDetail.value?.contactName) {
|
||||
rows.push({ label: '联系人', value: appointmentDetail.value.contactName })
|
||||
}
|
||||
if (appointmentDetail.value?.contactPhone) {
|
||||
rows.push({ label: '联系方式', value: appointmentDetail.value.contactPhone })
|
||||
}
|
||||
return rows
|
||||
})
|
||||
const ecouponCardKeyDelivered = computed(() =>
|
||||
orderHasCardKeyContent(orderGoodsList.value)
|
||||
)
|
||||
@@ -335,14 +435,45 @@ const allowOperation = computed(() =>
|
||||
)
|
||||
|
||||
const showDeliveryInfoBlock = computed(() => {
|
||||
if (isAppointmentOrderFlag.value) return true
|
||||
if (isECouponOrder.value) return true
|
||||
if (order.value.verificationCode) return true
|
||||
if (order.value.orderType === 'VIRTUAL') return false
|
||||
if (order.value.deliveryMethod === 'SELF_PICK_UP') return false
|
||||
if (order.value.verificationCode) return true
|
||||
if (order.value.deliveryMethod === 'LOGISTICS') return true
|
||||
return false
|
||||
})
|
||||
|
||||
const verificationCodeItems = computed(() => {
|
||||
if (isAppointmentOrderFlag.value) {
|
||||
const cancelled = order.value.orderStatus === 'CANCELLED'
|
||||
let qrAssigned = false
|
||||
return appointmentCodes.value.map((code, index) => {
|
||||
const pending = !cancelled && code.status === 'UNUSED'
|
||||
const showQr = pending && !qrAssigned
|
||||
if (showQr) qrAssigned = true
|
||||
return {
|
||||
key: code.id || code.code || String(index),
|
||||
canvasId: `verify-code-${index}`,
|
||||
code: code.code,
|
||||
struck: !pending,
|
||||
showQr,
|
||||
}
|
||||
})
|
||||
}
|
||||
const code = order.value.verificationCode
|
||||
if (!code || isECouponOrder.value) return []
|
||||
const status = order.value.orderStatus
|
||||
const pending = status !== 'CANCELLED' && status !== 'COMPLETED'
|
||||
return [{
|
||||
key: code,
|
||||
canvasId: 'verify-code-0',
|
||||
code,
|
||||
struck: !pending,
|
||||
showQr: pending,
|
||||
}]
|
||||
})
|
||||
|
||||
const deliveryEntryText = computed(() =>
|
||||
getDeliveryEntryText(
|
||||
orderPackage.value,
|
||||
@@ -444,6 +575,19 @@ function ByUserMessage(orderItem: any) {
|
||||
})
|
||||
}
|
||||
|
||||
async function loadAppointmentDetail(orderSnParam: string) {
|
||||
if (!checkAppointmentOrder(order.value?.orderType)) {
|
||||
appointmentDetail.value = {}
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await getAppointmentOrderDetail(orderSnParam)
|
||||
appointmentDetail.value = res.data?.result || {}
|
||||
} catch {
|
||||
appointmentDetail.value = {}
|
||||
}
|
||||
}
|
||||
|
||||
function loadData(orderSnParam: string) {
|
||||
uni.showLoading({ title: '加载中' })
|
||||
getOrderDetail(orderSnParam).then(async (res) => {
|
||||
@@ -454,6 +598,7 @@ function loadData(orderSnParam: string) {
|
||||
if (!order.value.allowOperationVO && result.allowOperationVO) {
|
||||
order.value.allowOperationVO = result.allowOperationVO
|
||||
}
|
||||
await loadAppointmentDetail(orderSnParam)
|
||||
await loadDelivery(order.value)
|
||||
hideLoadingIfNeeded()
|
||||
})
|
||||
@@ -479,6 +624,35 @@ function onCopy(orderSnText: string) {
|
||||
setClipboard(String(orderSnText))
|
||||
}
|
||||
|
||||
function canApplySkuAfterSale(sku: any) {
|
||||
const status = String(sku?.afterSaleStatus || '')
|
||||
if (status.includes('NOT_APPLIED') || status.includes('PART_AFTER_SALE')) return true
|
||||
if (isAppointmentOrderFlag.value && (!status || status === 'NEW')) return true
|
||||
return false
|
||||
}
|
||||
|
||||
function canShowSkuAfterSale(sku: any) {
|
||||
if (isECouponOrder.value) return false
|
||||
if (!order.value?.sn || Number(order.value.flowPrice) === 0) return false
|
||||
if (isAppointmentOrderFlag.value && !appointmentAllow.value.afterSale) return false
|
||||
return canApplySkuAfterSale(sku)
|
||||
}
|
||||
|
||||
function onSkuAfterSale(sku: any) {
|
||||
if (!canShowSkuAfterSale(sku)) return
|
||||
storage.setAfterSaleData({
|
||||
...order.value,
|
||||
...sku,
|
||||
orderItems: orderGoodsList.value || [],
|
||||
storeName: order.value.storeName,
|
||||
flowPrice: order.value.flowPrice,
|
||||
orderType: order.value.orderType,
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: `./afterSales/afterSalesSelect?sn=${sku.sn}`,
|
||||
})
|
||||
}
|
||||
|
||||
function onAfterSales(orderSnText: string, sku: any) {
|
||||
uni.navigateTo({
|
||||
url: `./afterSales/afterSalesSelect?sn=${orderSnText}&sku=${encodeURIComponent(
|
||||
@@ -571,13 +745,56 @@ function reBuy(orderItem: any) {
|
||||
<style lang="scss">
|
||||
@import "./goods.scss";
|
||||
|
||||
.goods-item-view {
|
||||
.seller-view .goods-item-view {
|
||||
align-items: flex-start;
|
||||
|
||||
.goods-body {
|
||||
flex: 4;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.goods-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.goods-title {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
align-self: stretch;
|
||||
min-height: 131rpx;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.goods-side.has-action {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.goods-num {
|
||||
flex: none;
|
||||
width: auto;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.after-sale-btn {
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 0 16rpx;
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
background: #f5f5f5;
|
||||
border-radius: 22rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.empty {
|
||||
@@ -752,6 +969,38 @@ page,
|
||||
.copy {
|
||||
margin-left: 16rpx;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.copy-icon {
|
||||
position: relative;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
}
|
||||
|
||||
.copy-icon::before,
|
||||
.copy-icon::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
border: 2rpx solid #666;
|
||||
border-radius: 4rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.copy-icon::before {
|
||||
left: 0;
|
||||
top: 8rpx;
|
||||
}
|
||||
|
||||
.copy-icon::after {
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,6 +1023,31 @@ page,
|
||||
}
|
||||
}
|
||||
|
||||
.appointment-entry__row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.appointment-entry__row .label {
|
||||
color: #999;
|
||||
width: 140rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.appointment-entry__row .value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
.appointment-group {
|
||||
margin: 8rpx 0 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: var(--theme-primary, #ff3c2a);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.verificationCode {
|
||||
font-weight: bold;
|
||||
letter-spacing: 2rpx;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="main-page">
|
||||
<div class="main-page" :style="themeStyle">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="status_bar"></view>
|
||||
<!-- #endif -->
|
||||
@@ -13,8 +13,6 @@
|
||||
routerVal.goodsId
|
||||
" :thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods"
|
||||
@close="enableShare = false" />
|
||||
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX"
|
||||
:y="navbarListY" placement="top-start" />
|
||||
<view class="index">
|
||||
<!-- topBar -->
|
||||
<u-navbar
|
||||
@@ -25,17 +23,8 @@
|
||||
:bg-color="navbar.background"
|
||||
:auto-back="false"
|
||||
:class="headerFlag ? 'header' : 'header bg-none scroll-hide'"
|
||||
@leftClick="back"
|
||||
>
|
||||
<template #left>
|
||||
<view class="backs" @tap.stop>
|
||||
<view class="nav-action" @tap.stop="back()">
|
||||
<u-icon name="arrow-left" class="icon-back"></u-icon>
|
||||
</view>
|
||||
<view class="nav-action" @tap.stop="popupsSwitch = !popupsSwitch">
|
||||
<u-icon name="list" class="icon-list"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #center>
|
||||
<view class="headerList" :class="headerFlag ? 'tab-bar' : 'tab-bar scroll-hide'">
|
||||
<view class="headerRow headerRow--tabs">
|
||||
@@ -62,17 +51,8 @@
|
||||
class="header-only-back"
|
||||
:bg-color="navbarOnlyBack.background"
|
||||
:auto-back="false"
|
||||
@leftClick="back"
|
||||
>
|
||||
<template #left>
|
||||
<view class="bg-back" @tap.stop>
|
||||
<view class="nav-action" @tap.stop="back()">
|
||||
<u-icon size="20" name="arrow-left" class="icon-back"></u-icon>
|
||||
</view>
|
||||
<view class="nav-action" @tap.stop="popupsSwitch = !popupsSwitch">
|
||||
<u-icon size="20" name="list" class="icon-list"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</u-navbar>
|
||||
</view>
|
||||
|
||||
@@ -262,7 +242,13 @@
|
||||
<view class="detail-btn" v-if="!isGroup && !takeDownFromSale">
|
||||
<view class="to-store-car to-store-btn" v-if="showAddToCart" @click="shutMask(4)">
|
||||
加入购物车</view>
|
||||
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
|
||||
<view
|
||||
class="to-buy to-store-btn"
|
||||
:class="{ 'to-buy-theme': isAppointmentGoodsType }"
|
||||
@click="handleBuyClick"
|
||||
>
|
||||
{{ isAppointmentGoodsType ? '立即预约' : '立即购买' }}
|
||||
</view>
|
||||
<view class="to-store-car to-store-btn" v-if="startTimer">暂未开始</view>
|
||||
</view>
|
||||
<!-- 拼团结算 -->
|
||||
@@ -325,13 +311,13 @@ import * as API_trade from '@/api/trade.js'
|
||||
import * as API_Members from '@/api/members.js'
|
||||
import * as API_store from '@/api/store.js'
|
||||
import { getIMDetail } from '@/api/common'
|
||||
import { modelNavigateTo } from '@/pages/tabbar/home/template/tpl.js'
|
||||
/************请求存储***************/
|
||||
import storage from '@/utils/storage.js'
|
||||
/************工具函数***************/
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import { unitPrice, goodsFormatPrice, isLogin, parseGoodsImageUrl, clearStrComma, talkIm } from '@/utils/filters.js'
|
||||
import { isNonPhysicalGoods } from '@/utils/goodsType.js'
|
||||
import { isNonPhysicalGoods, isAppointmentGoods } from '@/utils/goodsType.js'
|
||||
|
||||
/************组件***************/
|
||||
import PromotionLayout from './product/promotion/-promotion'
|
||||
@@ -347,36 +333,17 @@ import GoodsSwiper from './product/goods/-goods-swiper'
|
||||
import popupGoods from '@/components/m-buy/goods'
|
||||
import popupAddress from './product/popup/address'
|
||||
import shares from '@/components/m-share/index'
|
||||
import popups from '@/components/popups/popups'
|
||||
import takeDownFormSaleGoods from '@/components/m-take-down-sale-goods/index'
|
||||
import setup from './product/popup/popup'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
const instance = getCurrentInstance()
|
||||
const popupGoodsRef = ref()
|
||||
const takeDownSaleRef = ref()
|
||||
|
||||
// 响应式数据
|
||||
const promotionShow = ref(false)
|
||||
let navbarListX: any
|
||||
let navbarListY: any
|
||||
// #ifdef H5
|
||||
navbarListX = ref(110)
|
||||
navbarListY = ref(80)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
// #ifndef H5
|
||||
navbarListX = ref(120)
|
||||
navbarListY = ref(170)
|
||||
// #endif
|
||||
// #endif
|
||||
const navbarListData = [
|
||||
{ title: "首页", icon: "home-fill", ___type: "other" },
|
||||
{ title: "购物车", icon: "bag-fill", ___type: "other" },
|
||||
{ title: "搜索", icon: "search", ___type: "category" },
|
||||
{ title: "个人中心", icon: "account-fill", ___type: "other" },
|
||||
]
|
||||
const popupsSwitch = ref(false)
|
||||
const enableShare = ref(false)
|
||||
const selectedGoods = ref<any>("")
|
||||
const isGroup = ref(false)
|
||||
@@ -437,6 +404,7 @@ const isNonPhysicalGoodsType = computed(() => isNonPhysicalGoods(goodsDetail.val
|
||||
const showAddToCart = computed(() => {
|
||||
return !isNonPhysicalGoodsType.value
|
||||
})
|
||||
const isAppointmentGoodsType = computed(() => isAppointmentGoods(goodsDetail.value?.goodsType))
|
||||
|
||||
// watch
|
||||
watch(isGroup, (val) => {
|
||||
@@ -494,10 +462,6 @@ function share() {
|
||||
return `/pages/product/goods?id=${routerVal.value.id}&goodsId=${routerVal.value.goodsId}`
|
||||
}
|
||||
|
||||
function handleNavbarList(val: any) {
|
||||
modelNavigateTo({ url: val })
|
||||
}
|
||||
|
||||
function emptyPromotion(): boolean {
|
||||
if (PromotionList.value == "" || PromotionList.value == null || PromotionList.value == []) {
|
||||
return true
|
||||
@@ -637,13 +601,11 @@ function cartCount() {
|
||||
}
|
||||
|
||||
function back() {
|
||||
if (getCurrentPages().length == 1) {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/home/index",
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
}
|
||||
uni.navigateBack({
|
||||
fail() {
|
||||
uni.switchTab({ url: '/pages/tabbar/home/index' })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function getStoreBaseInfoFun(id: any) {
|
||||
@@ -724,6 +686,26 @@ function getCoupon(item: any) {
|
||||
receiveCouponsFun(item.id)
|
||||
}
|
||||
|
||||
function goAppointmentCheckout(num = 1) {
|
||||
const sku = goodsDetail.value?.id
|
||||
const gid = goodsDetail.value?.goodsId || routerVal.value.goodsId
|
||||
if (!sku || !gid) {
|
||||
uni.showToast({ title: '商品信息异常', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/appointment/appointmentCheckout?skuId=${sku}&goodsId=${gid}&num=${num}`,
|
||||
})
|
||||
}
|
||||
|
||||
function handleBuyClick() {
|
||||
if (isAppointmentGoodsType.value) {
|
||||
goAppointmentCheckout()
|
||||
return
|
||||
}
|
||||
shutMask(4, 'buy')
|
||||
}
|
||||
|
||||
function shutMask(flag: any, buyFlag?: any, type?: any) {
|
||||
promotionShow.value = false
|
||||
buyMask.value = false
|
||||
|
||||
@@ -46,6 +46,10 @@ page {
|
||||
> .to-buy {
|
||||
background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d);
|
||||
}
|
||||
> .to-buy-theme {
|
||||
background-image: none;
|
||||
background: var(--theme-primary, #ff3c2a);
|
||||
}
|
||||
> .to-store-car {
|
||||
background-image: linear-gradient(135deg, #f2140c, #f2270c 70%, #f24d0c);
|
||||
}
|
||||
@@ -201,7 +205,7 @@ page {
|
||||
|
||||
.header-only-back {
|
||||
background: transparent;
|
||||
z-index: 9;
|
||||
z-index: 12 !important;
|
||||
}
|
||||
.header,
|
||||
.header-only-back {
|
||||
@@ -332,26 +336,10 @@ page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nav-action + .nav-action {
|
||||
border-left: 2rpx solid rgb(194, 194, 194);
|
||||
}
|
||||
.backs,
|
||||
.bg-back {
|
||||
width: 150rpx;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
padding: 8rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bg-back {
|
||||
background: rgba($color: #fff, $alpha: 0.8);
|
||||
}
|
||||
.backs {
|
||||
text-align: center;
|
||||
font-size: 42rpx;
|
||||
}
|
||||
|
||||
.headerImg {
|
||||
|
||||
@@ -234,7 +234,7 @@ import {
|
||||
getStoreIsCollect,
|
||||
} from '@/api/members.js'
|
||||
import config from '@/config/config'
|
||||
import { getGoodsList } from '@/api/goods.js'
|
||||
import { getGoodsList, getMpScene } from '@/api/goods.js'
|
||||
import { getAllCoupons } from '@/api/promotions.js'
|
||||
import { getFloorStoreData } from '@/api/home'
|
||||
import {
|
||||
@@ -349,6 +349,33 @@ function fallbackToBasePage() {
|
||||
getCategoryData()
|
||||
}
|
||||
|
||||
function applyStoreId(id) {
|
||||
storeId.value = id || ''
|
||||
goodsParams.storeId = storeId.value
|
||||
couponParams.storeId = storeId.value
|
||||
}
|
||||
|
||||
function parseStoreIdFromParams(params) {
|
||||
const text = String(params || '').trim()
|
||||
if (!text) return ''
|
||||
if (text.indexOf('id=') === 0) return text.slice(3)
|
||||
const match = /(?:^|&)id=([^&]+)/.exec(text)
|
||||
return match ? decodeURIComponent(match[1]) : ''
|
||||
}
|
||||
|
||||
async function resolveStoreIdFromScene(scene) {
|
||||
const raw = decodeURIComponent(String(scene || '')).trim()
|
||||
if (!raw) return ''
|
||||
const direct = parseStoreIdFromParams(raw)
|
||||
if (direct) return direct
|
||||
try {
|
||||
const res = await getMpScene(raw)
|
||||
return parseStoreIdFromParams(res?.data?.result)
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function getStoreLicencePhoto() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/licencePhoto?id=${storeId.value}`,
|
||||
@@ -505,11 +532,15 @@ function getCoupon(item: any) {
|
||||
}
|
||||
|
||||
onLoad((options: any) => {
|
||||
storeId.value = options.id
|
||||
console.log(storeId.value, 'this.storeId')
|
||||
|
||||
goodsParams.storeId = options.id
|
||||
couponParams.storeId = options.id
|
||||
applyStoreId(options?.id)
|
||||
if (!storeId.value && options?.scene) {
|
||||
resolveStoreIdFromScene(options.scene).then((id) => {
|
||||
if (!storeId.value && id) {
|
||||
applyStoreId(id)
|
||||
init()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onPageScroll((e) => {
|
||||
@@ -531,7 +562,7 @@ onMounted(() => {
|
||||
withShareTicket: true,
|
||||
})
|
||||
// #endif
|
||||
init()
|
||||
if (storeId.value) init()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -32,37 +32,46 @@
|
||||
<view class="point-value">{{ footNum || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 我的订单,代付款 -->
|
||||
<!-- 我的订单 -->
|
||||
<view class="order">
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=1')">
|
||||
<view class="bag bag2">
|
||||
<u-icon name="bag-fill" size="22" color="#fff"></u-icon>
|
||||
<view class="order-head">
|
||||
<text class="order-head-title">我的订单</text>
|
||||
<view class="order-head-all" @click="navigateTo('/pages/order/myOrder?status=0')">
|
||||
<text>全部</text>
|
||||
<u-icon name="arrow-right" size="12" color="#999"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">待付款</view>
|
||||
</view>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=3')">
|
||||
<view class="bag bag3">
|
||||
<u-icon name="car-fill" size="22" color="#fff"></u-icon>
|
||||
<view class="order-row">
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=1')">
|
||||
<view class="bag bag2">
|
||||
<u-icon name="bag-fill" size="22" color="#fff"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">待支付</view>
|
||||
</view>
|
||||
<view class="order-item-label">待收货</view>
|
||||
</view>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')">
|
||||
<view class="bag bag4">
|
||||
<u-icon name="star-fill" size="22" color="#fff"></u-icon>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=2')">
|
||||
<view class="bag bag1">
|
||||
<u-icon name="gift-fill" size="22" color="#fff"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">待发货</view>
|
||||
</view>
|
||||
<view class="order-item-label">待评价</view>
|
||||
</view>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/afterSales/afterSales')">
|
||||
<view class="bag bag5">
|
||||
<u-icon name="server-fill" size="22" color="#fff"></u-icon>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=3')">
|
||||
<view class="bag bag3">
|
||||
<u-icon name="car-fill" size="22" color="#fff"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">待收货</view>
|
||||
</view>
|
||||
<view class="order-item-label">售后</view>
|
||||
</view>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=0')">
|
||||
<view class="bag bag1">
|
||||
<u-icon name="order" size="22" color="#fff"></u-icon>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=4')">
|
||||
<view class="bag bag4">
|
||||
<u-icon name="star-fill" size="22" color="#fff"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">待评价</view>
|
||||
</view>
|
||||
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=5')">
|
||||
<view class="bag bag5">
|
||||
<u-icon name="server-fill" size="22" color="#fff"></u-icon>
|
||||
</view>
|
||||
<view class="order-item-label">售后</view>
|
||||
</view>
|
||||
<view class="order-item-label">我的订单</view>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
@@ -257,12 +266,34 @@ body {
|
||||
}
|
||||
|
||||
.order {
|
||||
height: 140rpx;
|
||||
font-size: $font-sm;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 3%;
|
||||
color: #999;
|
||||
padding: 8rpx 16rpx 24rpx;
|
||||
color: #333;
|
||||
|
||||
.order-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8rpx 12rpx 20rpx;
|
||||
}
|
||||
|
||||
.order-head-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.order-head-all {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
flex: 1;
|
||||
@@ -274,9 +305,10 @@ body {
|
||||
}
|
||||
|
||||
.order-item-label {
|
||||
margin-top: 10rpx;
|
||||
margin-top: 12rpx;
|
||||
line-height: 1.4;
|
||||
font-size: $font-sm;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@
|
||||
<image class="interact-item-icon" src="/static/mine/mycoupon.png" mode=""></image>
|
||||
<view>优惠券</view>
|
||||
</view>
|
||||
<view class="interact-item" @click="navigateTo('/pages/cart/gift-card/myGiftCards')">
|
||||
<image class="interact-item-icon" src="/static/mine/pointgift.png" mode=""></image>
|
||||
<view>礼品卡</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user