init
This commit is contained in:
@@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<s-pages title="收银台" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32">
|
||||
<view class="center p-t-96 weight500 size100"><span class="size48">¥</span>
|
||||
{{ fen2yuan(state.orderInfo.payPrice) }}
|
||||
</view>
|
||||
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
||||
<view>
|
||||
<radio-group @change="onTapPay">
|
||||
<label class="" v-for="item in state.payMethods" :key="item.title">
|
||||
<view class="flex-center ju-between m-b-40" :class="{ 'disabled-pay-item': item.disabled }">
|
||||
<view class="flex-center">
|
||||
<image class="h_64 w_64" v-if="item.disabled"
|
||||
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
|
||||
mode="aspectFit" />
|
||||
<image class="h_64 w_64" v-else :src="sheep.$url.static(item.icon)" mode="aspectFit" />
|
||||
<text class="pay-title m-l-12">{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="check-box ss-flex ss-col-center ss-p-l-10">
|
||||
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
|
||||
余额: {{ fen2yuan(totalRecharge) }}元
|
||||
</view>
|
||||
<view class="">
|
||||
<radio :value="item.value" color="var(--ui-BG-Main)"
|
||||
backgroundColor="rgba(255, 255, 255, 0)" :disabled="item.disabled"
|
||||
:checked="state.payment === item.value" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 工具 -->
|
||||
<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
|
||||
<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
|
||||
检测支付环境中
|
||||
</button>
|
||||
<button v-else-if="state.payStatus === -1" class="ss-reset-button past-due-btn" disabled>
|
||||
支付已过期
|
||||
</button>
|
||||
<button v-else class="ai-button2" @tap="onPay" :disabled="state.payStatus !== 1"
|
||||
:class="{ 'disabled-btn': state.payStatus !== 1 }">
|
||||
立即支付
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
computed,
|
||||
} from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import sheep from '@/sheep';
|
||||
import PayChannelApi from '@/sheep/api/pay/channel';
|
||||
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import { getPayMethods, goPayResult } from '@/sheep/platform/pay';
|
||||
import { SYSCONST } from '@/sheep/helper/const';
|
||||
import { getWallet } from '@/sheep/api/home/pay';
|
||||
let id = ref('');
|
||||
let payOrderId = ref('');
|
||||
let orderInfo = ref({});
|
||||
const userWallet = ref();
|
||||
|
||||
let totalRecharge = ref();
|
||||
// 检测支付环境
|
||||
const state = reactive({
|
||||
orderType: 'aiGoods', // 订单类型; goods - 商品订单, recharge - 充值订单 aiRecharge
|
||||
orderInfo: {}, // 支付单信息
|
||||
payStatus: 0, // 0=检测支付环境, -2=未查询到支付单信息, -1=支付已过期, 1=待支付,2=订单已支付
|
||||
payMethods: [], // 可选的支付方式
|
||||
payment: '', // 选中的支付方式
|
||||
});
|
||||
const getOrderDetail = async () => {
|
||||
let { code, data } = await api.getOrderDetail({ id: id.value });
|
||||
console.log('订单详情', code, data);
|
||||
if (code !== 0 || !data) {
|
||||
state.payStatus = -2;
|
||||
return;
|
||||
}
|
||||
state.orderInfo = data || {};
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
};
|
||||
|
||||
// 获得支付方式
|
||||
async function setPayMethods() {
|
||||
const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId || 1);
|
||||
// console.log('支付方式', code, data);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.payMethods = getPayMethods(data);
|
||||
console.log('支付方式', state.payMethods);
|
||||
// 金额超出阈值,仅允许余额支付
|
||||
if (state.orderInfo?.totalPrice >= SYSCONST.MAX_PRICE) {
|
||||
state.payMethods = state.payMethods.map((item) => ({
|
||||
...item,
|
||||
disabled: item.value !== 'wallet' ? true : item.disabled,
|
||||
}));
|
||||
state.payment = 'wallet';
|
||||
}
|
||||
state.payMethods.find((item) => {
|
||||
if (item.value && !item.disabled) {
|
||||
state.payment = item.value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 支付文案提示
|
||||
const payDescText = computed(() => {
|
||||
if (state.payStatus === 2) {
|
||||
return '该订单已支付';
|
||||
}
|
||||
if (state.payStatus === 1 && state.orderInfo?.payExpireTime) {
|
||||
const time = useDurationTime(state.orderInfo.payExpireTime);
|
||||
if (time?.ms <= 0) {
|
||||
state.payStatus = -1;
|
||||
return '';
|
||||
}
|
||||
return `剩余支付时间 ${time?.h}:${time?.m}:${time?.s} `;
|
||||
}
|
||||
if (state.payStatus === -2) {
|
||||
return '未查询到支付单信息';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
// 状态转换:payOrder.status => payStatus
|
||||
function checkPayStatus() {
|
||||
if (state.orderInfo.status === 10 || state.orderInfo.status === 20) {
|
||||
// 支付成功
|
||||
state.payStatus = 2;
|
||||
// 跳转回支付成功页
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '订单已支付',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
goPayResult(state.orderInfo.id, state.orderType);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.status === 30) {
|
||||
// 支付关闭
|
||||
state.payStatus = -1;
|
||||
return;
|
||||
}
|
||||
state.payStatus = 1; // 待支付
|
||||
}
|
||||
|
||||
// 切换支付方式
|
||||
function onTapPay(e) {
|
||||
state.payment = e.detail.value;
|
||||
}
|
||||
let type = ref(); //2充值
|
||||
onLoad(async (options) => {
|
||||
id.value = options.id || '';
|
||||
payOrderId.value = options.payOrderId || '';
|
||||
type.value = options.type || '';
|
||||
|
||||
if (type.value == 2) {
|
||||
state.orderType = 'aiRecharge';
|
||||
state.orderInfo.totalPrice = options.price * 100;
|
||||
// state.orderInfo.price = options.price || '';
|
||||
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
} else {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
onShow(() => {
|
||||
getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
totalRecharge.value = res.data.totalRecharge;
|
||||
}
|
||||
});
|
||||
});
|
||||
const onPay = () => {
|
||||
// console.log(userWallet.value.totalRecharge);
|
||||
if (state.payment === '') {
|
||||
sheep.$helper.toast('请选择支付方式');
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.totalPrice >= SYSCONST.MAX_PRICE && state.payment !== 'wallet') {
|
||||
sheep.$helper.toast('请选择余额支付');
|
||||
return;
|
||||
}
|
||||
if (state.payment === 'wallet') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要支付吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
if (totalRecharge.value < state.orderInfo.totalPrice) {
|
||||
uni.showToast({
|
||||
title: '余额不足请充值',
|
||||
icon: 'none',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/recharge',
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pay-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.ss-modal-box {
|
||||
// max-height: 1000rpx;
|
||||
|
||||
.modal-header {
|
||||
position: relative;
|
||||
padding: 60rpx 20rpx 40rpx;
|
||||
|
||||
.money-text {
|
||||
color: $red;
|
||||
font-size: 46rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-size: 26rpx;
|
||||
color: $gray-b;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 20rpx;
|
||||
font-size: 46rpx;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
.pay-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-tip {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
height: 86rpx;
|
||||
}
|
||||
|
||||
.disabled-pay-item {
|
||||
.pay-title {
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.userInfo-money {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background: #e5e5e5;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.past-due-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,470 @@
|
||||
<template>
|
||||
<s-layout title="商品详情">
|
||||
<view>
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty v-else-if="state.goodsInfo === null" text="商品不存在或已下架" icon="/static/soldout-empty.png" showAction
|
||||
actionText="再逛逛" actionUrl="/pages/AI/index" />
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品轮播图 -->
|
||||
<su-swiper class="" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)" otStyle="tag"
|
||||
imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
|
||||
<!-- 限时折扣/会员价的优惠信息 -->
|
||||
<view v-if="!show" class="session">
|
||||
<view class="bg w100 h100 h_152">
|
||||
<image class="w100 h100" :src="$url + 'ai/2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="sessionCon w100 h100 h_152 flex-center ju-between p-x-40">
|
||||
<view>
|
||||
<view class="flex-row al-flex-end m-b-8" style="color: #fff">
|
||||
<view class="size44 weight500">
|
||||
<span class="size32">¥</span>{{ $fen2yuan(state.goodsInfo.discountedPrice?state.goodsInfo.discountedPrice:state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view class="size24 m-l-14 m-r-6 through" v-if="state.goodsInfo.marketPrice">
|
||||
¥{{ $fen2yuan(state.goodsInfo.discountedPrice?state.goodsInfo.price:state.goodsInfo.marketPrice) }}</view>
|
||||
<view class="size24">已售</view>
|
||||
</view>
|
||||
<view class="flex-row relative">
|
||||
<view class="w_348 h_37">
|
||||
<image class="w100 h100" :src="$url + 'ai/3.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="absolute t0 l0 size20 c27 line37 p-l-10">
|
||||
限时省{{ $fen2yuan(state.goodsInfo.marketPrice - state.goodsInfo.price) }}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="c15 size28 m-b-22">距离活动{{ timeText }}</view>
|
||||
<view>
|
||||
<uni-countdown color="#FFFFFF" background-color="#FF393A" border-color="#FF393A" :show-day="false"
|
||||
:hour="hour" :minute="minute" :second="second" @timeup="timeup"></uni-countdown>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-32 ss-p-x-32" :class="{ 'm-t-52': !show }">
|
||||
<view class="title-text ss-line-2 ss-m-b-6 flex-center ju-flex-start">
|
||||
<view class="label m-r-10 shrink" v-if="state.goodsInfo.tagSaleName">{{
|
||||
state.goodsInfo.tagSaleName
|
||||
}}</view>
|
||||
<view>{{ state.goodsInfo.name }}</view>
|
||||
</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku v-model="state.selectedSku.goods_sku_text" :sku="state.selectedSku" @tap="addCar" theme="2"
|
||||
v-if="timeText !== '开始'" />
|
||||
<detail-cell v-if="state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime" label="发货" :value="`${state.goodsInfo.deliverPlace || ''} ${state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime ? '|' : ''
|
||||
} ${state.goodsInfo.deliverTime || ''}`" />
|
||||
<detail-cell theme="2" label="运费" value="免运费(请以提交订单为准)" />
|
||||
</view>
|
||||
|
||||
<!-- 详情 -->
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
</view>
|
||||
</block>
|
||||
<view class="theme-ai">
|
||||
<card_payment ref="paymentRef" source="orderInfo" :actionStatus="timeText" @addCar="addCar" />
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
// import { onPageScroll} from '@dcloudio/uni-app';
|
||||
|
||||
import card_payment from '@/components/card_payment/card_payment';
|
||||
import detailNavbar from '../goods/components/detail/detail-navbar.vue';
|
||||
import detailCellSku from '../goods/components/detail/detail-cell-sku.vue';
|
||||
|
||||
import detailCell from '../goods/components/detail/detail-cell.vue';
|
||||
import detailTabbar from '../goods/components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from '../goods/components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from '../goods/components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from '../goods/components/detail/detail-content-card.vue';
|
||||
import detailActivityTip from '../goods/components/detail/detail-activity-tip.vue';
|
||||
import {
|
||||
formatSales,
|
||||
formatGoodsSwiper,
|
||||
fen2yuan,
|
||||
fen2yuanSimple,
|
||||
formatDiscountPercent,
|
||||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
let { proxy } = getCurrentInstance();
|
||||
const state = reactive({
|
||||
skeletonLoading: false,
|
||||
goodsInfo: {},
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
});
|
||||
const getInfo = async () => {
|
||||
let res = await api.getSpuDetail(id.value, shoppingPlazaId.value);
|
||||
if (res.code === 0) {
|
||||
state.goodsInfo = res.data;
|
||||
timeChange();
|
||||
}
|
||||
};
|
||||
let id = ref();
|
||||
let shoppingPlazaId = ref();
|
||||
onLoad(async (options) => {
|
||||
// 滚到顶部
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
});
|
||||
id.value = options.id;
|
||||
shoppingPlazaId.value = options.shopId;
|
||||
getInfo();
|
||||
}); // 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
state.settlementSku = e;
|
||||
}
|
||||
const onAddCart = () => { };
|
||||
const onBuy = () => { };
|
||||
let paymentRef = ref(null);
|
||||
const addCar = () => {
|
||||
paymentRef.value.addCar({ ...state.goodsInfo, shoppingPlazaId: shoppingPlazaId.value });
|
||||
};
|
||||
/**
|
||||
* 倒计时
|
||||
*/
|
||||
|
||||
let show = ref(false);
|
||||
let timeText = ref('开始');
|
||||
let hour = ref(0);
|
||||
let minute = ref(0);
|
||||
let second = ref(0);
|
||||
const timeup = () => {
|
||||
show.value = true;
|
||||
timeChange();
|
||||
};
|
||||
const timeChange = () => {
|
||||
show.value = false;
|
||||
let data = state.goodsInfo;
|
||||
let endTime = data.endTime;
|
||||
let startTime = data.startTime;
|
||||
// 当前时间戳
|
||||
let currentTime = Date.now();
|
||||
let time = null;
|
||||
if (currentTime < startTime) {
|
||||
timeText.value = '开始';
|
||||
time = startTime - currentTime;
|
||||
} else if (currentTime > startTime && currentTime < endTime) {
|
||||
timeText.value = '结束';
|
||||
time = endTime - currentTime;
|
||||
} else {
|
||||
show.value = true;
|
||||
timeText.value = '已结束';
|
||||
}
|
||||
if (time) {
|
||||
hour.value = Math.floor(time / 1000 / 60 / 60);
|
||||
minute.value = Math.floor(time / 1000 / 60) % 60;
|
||||
second.value = Math.floor(time / 1000) % 60;
|
||||
}
|
||||
};
|
||||
// inner
|
||||
let navBar = ref('inner');
|
||||
let scrollTop = ref(0);
|
||||
onPageScroll((e) => {
|
||||
//console.log(e)
|
||||
scrollTop.value = e.scrollTop;
|
||||
if (e.scrollTop > 20) {
|
||||
navBar.value = 'normal';
|
||||
} else {
|
||||
navBar.value = 'inner';
|
||||
}
|
||||
});
|
||||
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.tag-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.add-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
background: #fa8735;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 0 12rpx 12rpx 0;
|
||||
background: #fe3b48;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 428rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #999999;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
height: 60vh;
|
||||
|
||||
.model-content {
|
||||
height: 56vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
// 限时折扣
|
||||
.discount {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disImg {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.discountCont {
|
||||
width: 680rpx;
|
||||
height: 90rpx;
|
||||
margin: 10rpx auto 0 auto;
|
||||
// background-color: gold;
|
||||
}
|
||||
|
||||
.disContT {
|
||||
width: 680rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.disContT1 {
|
||||
// width: 400rpx;
|
||||
// height: 50rpx;
|
||||
// background-color: green;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContT2 {
|
||||
width: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
// background-color: gold;
|
||||
font-size: 30rpx;
|
||||
text-align: end;
|
||||
color: #ff393a;
|
||||
font-weight: bolder;
|
||||
font-style: oblique 20deg;
|
||||
letter-spacing: 0.1rem;
|
||||
}
|
||||
|
||||
.disContT1P {
|
||||
color: white;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.disContT1End {
|
||||
// width: 180rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background-color: #fee2be;
|
||||
color: #f71b1b;
|
||||
font-size: 23rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-left: 26rpx;
|
||||
}
|
||||
|
||||
.disContB {
|
||||
width: 680rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContB1 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
color: #ffcccc;
|
||||
font-size: 24rpx;
|
||||
// 删除线
|
||||
text-decoration: line-through;
|
||||
padding-left: 6rpx;
|
||||
}
|
||||
|
||||
.disContB2 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.session {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -100rpx;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.sessionCon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -100rpx;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__number) {
|
||||
font-size: 24rpx !important;
|
||||
width: 40rpx !important;
|
||||
height: 40rpx !important;
|
||||
line-height: 40rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__splitor) {
|
||||
color: #ff393a !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<s-pages title="收银台" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32">
|
||||
<view class="center p-t-96 weight500 size100"
|
||||
><span class="size48">¥</span>
|
||||
<!-- {{ fen2yuan(state.orderInfo.totalPrice) }} -->
|
||||
{{ fen2yuan(state.orderInfo.totalPrice) }}
|
||||
</view>
|
||||
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
||||
<view>
|
||||
<radio-group @change="onTapPay">
|
||||
<label class="" v-for="item in state.payMethods" :key="item.title">
|
||||
<view
|
||||
class="flex-center ju-between m-b-40"
|
||||
:class="{ 'disabled-pay-item': item.disabled }"
|
||||
>
|
||||
<view class="flex-center">
|
||||
<image
|
||||
class="h_64 w_64"
|
||||
v-if="item.disabled"
|
||||
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<image
|
||||
class="h_64 w_64"
|
||||
v-else
|
||||
:src="sheep.$url.static(item.icon)"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="pay-title m-l-12">{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="check-box ss-flex ss-col-center ss-p-l-10">
|
||||
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
|
||||
余额: {{ fen2yuan(totalRecharge) }}元
|
||||
</view>
|
||||
<view class="">
|
||||
<radio
|
||||
:value="item.value"
|
||||
color="#366DEE"
|
||||
backgroundColor="rgba(255, 255, 255, 0)"
|
||||
:disabled="item.disabled"
|
||||
:checked="state.payment === item.value"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="">
|
||||
<radio :value="item.value" color="#366DEE" backgroundColor="rgba(255, 255, 255, 0)"
|
||||
:disabled="item.disabled" :checked="state.payment === item.value" />
|
||||
</view> -->
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 工具 -->
|
||||
<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
|
||||
<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
|
||||
检测支付环境中
|
||||
</button>
|
||||
<button v-else-if="state.payStatus === -1" class="ss-reset-button past-due-btn" disabled>
|
||||
支付已过期
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="ai-button2"
|
||||
@tap="onPay"
|
||||
:disabled="state.payStatus !== 1"
|
||||
:class="{ 'disabled-btn': state.payStatus !== 1 }"
|
||||
>
|
||||
立即支付
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
computed,
|
||||
} from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import sheep from '@/sheep';
|
||||
import PayChannelApi from '@/sheep/api/pay/channel';
|
||||
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import { getPayMethods, goPayResult } from '@/sheep/platform/pay';
|
||||
import { SYSCONST } from '@/sheep/helper/const';
|
||||
import { getWallet } from '@/sheep/api/home/pay';
|
||||
let id = ref('');
|
||||
let payOrderId = ref('');
|
||||
let orderInfo = ref({});
|
||||
const userWallet = ref();
|
||||
|
||||
let totalRecharge = ref();
|
||||
// 检测支付环境
|
||||
const state = reactive({
|
||||
orderType: 'aiGoods', // 订单类型; goods - 商品订单, recharge - 充值订单 aiRecharge
|
||||
orderInfo: {}, // 支付单信息
|
||||
payStatus: 0, // 0=检测支付环境, -2=未查询到支付单信息, -1=支付已过期, 1=待支付,2=订单已支付
|
||||
payMethods: [], // 可选的支付方式
|
||||
payment: '', // 选中的支付方式
|
||||
});
|
||||
const getOrderDetail = async () => {
|
||||
let { code, data } = await api.getGiftOrderDetail({ id: id.value });
|
||||
if (code !== 0 || !data) {
|
||||
state.payStatus = -2;
|
||||
return;
|
||||
}
|
||||
state.orderInfo = data || {};
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
};
|
||||
|
||||
// 获得支付方式
|
||||
async function setPayMethods() {
|
||||
const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId || 1);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.payMethods = getPayMethods(data);
|
||||
// 金额超出阈值,仅允许余额支付
|
||||
if (state.orderInfo?.totalPrice >= SYSCONST.MAX_PRICE) {
|
||||
state.payMethods = state.payMethods.map((item) => ({
|
||||
...item,
|
||||
disabled: item.value !== 'wallet' ? true : item.disabled,
|
||||
}));
|
||||
state.payment = 'wallet';
|
||||
}
|
||||
state.payMethods.find((item) => {
|
||||
if (item.value && !item.disabled) {
|
||||
state.payment = item.value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 支付文案提示
|
||||
const payDescText = computed(() => {
|
||||
if (state.payStatus === 2) {
|
||||
return '该订单已支付';
|
||||
}
|
||||
if (state.payStatus === 1 && state.orderInfo?.payExpireTime) {
|
||||
const time = useDurationTime(state.orderInfo.payExpireTime);
|
||||
if (time?.ms <= 0) {
|
||||
state.payStatus = -1;
|
||||
return '';
|
||||
}
|
||||
return `剩余支付时间 ${time?.h}:${time?.m}:${time?.s} `;
|
||||
}
|
||||
if (state.payStatus === -2) {
|
||||
return '未查询到支付单信息';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
// 状态转换:payOrder.status => payStatus
|
||||
function checkPayStatus() {
|
||||
if (state.orderInfo.status === 10 || state.orderInfo.status === 20) {
|
||||
// 支付成功
|
||||
state.payStatus = 2;
|
||||
// 跳转回支付成功页
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '订单已支付',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
goPayResult(state.orderInfo.id, state.orderType);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.status === 30) {
|
||||
// 支付关闭
|
||||
state.payStatus = -1;
|
||||
return;
|
||||
}
|
||||
state.payStatus = 1; // 待支付
|
||||
}
|
||||
|
||||
// 切换支付方式
|
||||
function onTapPay(e) {
|
||||
state.payment = e.detail.value;
|
||||
}
|
||||
let type = ref(); //2充值
|
||||
onLoad(async (options) => {
|
||||
// console.log(options);
|
||||
|
||||
id.value = options.id || '';
|
||||
payOrderId.value = options.payOrderId || '';
|
||||
type.value = options.type || '';
|
||||
|
||||
if (type.value == 2) {
|
||||
state.orderType = 'aiRecharge';
|
||||
state.orderInfo.totalPrice = options.price * 100;
|
||||
// state.orderInfo.price = options.price;
|
||||
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
} else {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
onShow(() => {
|
||||
getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
totalRecharge.value = res.data.totalRecharge;
|
||||
}
|
||||
});
|
||||
});
|
||||
const onPay = () => {
|
||||
// console.log(userWallet.value.totalRecharge);
|
||||
if (state.payment === '') {
|
||||
sheep.$helper.toast('请选择支付方式');
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.totalPrice >= SYSCONST.MAX_PRICE && state.payment !== 'wallet') {
|
||||
sheep.$helper.toast('请选择余额支付');
|
||||
return;
|
||||
}
|
||||
if (state.payment === 'wallet') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要支付吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
if (totalRecharge.value < state.orderInfo.totalPrice) {
|
||||
uni.showToast({
|
||||
title: '余额不足请充值',
|
||||
icon: 'none',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/recharge',
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pay-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.ss-modal-box {
|
||||
// max-height: 1000rpx;
|
||||
|
||||
.modal-header {
|
||||
position: relative;
|
||||
padding: 60rpx 20rpx 40rpx;
|
||||
|
||||
.money-text {
|
||||
color: $red;
|
||||
font-size: 46rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-size: 26rpx;
|
||||
color: $gray-b;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 20rpx;
|
||||
font-size: 46rpx;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
.pay-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-tip {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
height: 86rpx;
|
||||
}
|
||||
|
||||
.disabled-pay-item {
|
||||
.pay-title {
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.userInfo-money {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background: #e5e5e5;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.past-due-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<s-pages title="确认订单">
|
||||
<view class="p-b-132">
|
||||
<AddressSelection v-model="addressState" theme="2" @getSettlementInfo="getSettlementInfo" />
|
||||
<view class="p-x-32 m-t-24">
|
||||
<view class="bg24 p-x-20 p-t-20 radius16">
|
||||
<view v-if="settlementInfo.items && settlementInfo.items.length">
|
||||
<view class="m-b-24 no-click-wrap" v-for="(v, i) in settlementInfo.items" :key="i">
|
||||
<aiOrder :data="v" :source="3" />
|
||||
<view class="no-click-block" @click.stop.prevent></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">商品金额</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.totalPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">运费</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.deliveryPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-end borderTop">
|
||||
<span class="size26 line96">合计: </span>
|
||||
<span class="c13 size28 m-l-12 line96 weight900"
|
||||
>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</span
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-32 btn">
|
||||
<view class="ai-button2" @click="sub">确认订单</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import AddressSelection from '@/pages/order/addressSelection.vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import api from '@/sheep/api/member/address';
|
||||
import * as SpuApi from '@/sheep/api/ai/index';
|
||||
|
||||
const addressState = ref({
|
||||
addressInfo: {},
|
||||
deliveryType: 1,
|
||||
isPickUp: false,
|
||||
pickUpInfo: {},
|
||||
receiverName: '',
|
||||
receiverMobile: '',
|
||||
});
|
||||
let remark_value = ref();
|
||||
let spuId = ref();
|
||||
let spuPrice = ref();
|
||||
|
||||
const settlementInfo = ref<any>({});
|
||||
let addressId = ref('');
|
||||
const getSettlementInfo = (id = '') => {
|
||||
addressId.value = id;
|
||||
SpuApi.getGiftSettlementInfo({
|
||||
id: id,
|
||||
spuId: spuId.value,
|
||||
}).then((res: any) => {
|
||||
settlementInfo.value = res.data || {};
|
||||
// 设置收货地址
|
||||
if (res.data.address) {
|
||||
addressState.value.addressInfo = res.data.address;
|
||||
}
|
||||
// if (settlementInfo.value?.items?.length) {
|
||||
// settlementInfo.value.items.forEach((e) => {
|
||||
// e.skuArr = e.items;
|
||||
// e.skuArr.forEach((item) => {
|
||||
// item.propertyText = '';
|
||||
// if(item.properties){
|
||||
// item.properties.forEach((e1) => {
|
||||
// item.propertyText += e1.valueName + ' ';
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
});
|
||||
};
|
||||
const sub = async () => {
|
||||
if (!addressId.value) return proxy.utils.toast('请选择地址');
|
||||
let res: any = await SpuApi.createOrderOpen({
|
||||
id: addressId.value,
|
||||
spuId: spuId.value,
|
||||
userRemark: remark_value.value,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
proxy.utils.toast('下单成功');
|
||||
setTimeout(() => {
|
||||
proxy.utils.go('/pages/AI/giftCashierDesk', {
|
||||
id: res.data.id,
|
||||
payOrderId: res.data.payOrderId,
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
const getAddress = () => {
|
||||
api.getAddressList().then((res) => {
|
||||
if (res.code === 0 && res.data?.length) {
|
||||
// addressState.value.addressInfo = res.data[0];
|
||||
// getSettlementInfo(res.data[0].id);
|
||||
let index = res.data.findIndex((e) => e.defaultStatus);
|
||||
if (index !== -1) {
|
||||
addressState.value.addressInfo = res.data[index];
|
||||
getSettlementInfo(res.data[index].id);
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
});
|
||||
};
|
||||
// onLoad((options: any) => {
|
||||
// if (options.id) {
|
||||
// spuId.value = options.id;
|
||||
// }
|
||||
// if (options.price) {
|
||||
// spuPrice.value = options.price;
|
||||
// }
|
||||
// getSettlementInfo();
|
||||
// });
|
||||
onLoad((e) => {
|
||||
// getCartList();
|
||||
spuId.value = e.id;
|
||||
// console.log(e.id);
|
||||
});
|
||||
onShow(() => {
|
||||
getAddress();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.no-click-wrap {
|
||||
position: relative;
|
||||
}
|
||||
.no-click-block {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 12rpx);
|
||||
z-index: 100;
|
||||
background: transparent;
|
||||
}
|
||||
.borderTop {
|
||||
border-top: 1rpx solid #dfdfdf;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,534 @@
|
||||
<!-- 订单详情 -->
|
||||
<template>
|
||||
<s-pages title="订单详情">
|
||||
<view class="flex-center al-flex-end ju-between p-x-32 m-b-54">
|
||||
<view>
|
||||
<view class="size40 weight500 m-b-16">{{ statusObj[state.orderInfo.status]?.text }}</view>
|
||||
<view class="size24">{{ statusObj[state.orderInfo.status]?.text1 }}</view>
|
||||
</view>
|
||||
<view class="w_120 h_120" v-if="statusObj[state.orderInfo.status]?.icon">
|
||||
<image
|
||||
class="w100 h100"
|
||||
:src="statusObj[state.orderInfo.status]?.icon"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收货地址 -->
|
||||
<view class="order-address-box flex-row bg24 c0" v-if="state.orderInfo.receiverAreaId > 0">
|
||||
<view class="cityImg">
|
||||
<image :src="`${$url}goods/city1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="size32">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<text class="address-username">
|
||||
{{ state.orderInfo.receiverName }}
|
||||
</text>
|
||||
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
|
||||
</view>
|
||||
<view class="address-detail size32">
|
||||
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="detail-goods"
|
||||
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
|
||||
>
|
||||
<card_order
|
||||
theme="2"
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
></card_order>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
<view class="order-price-box bg24">
|
||||
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
|
||||
<text class="title c25">{{ v.title }}</text>
|
||||
<view class="ss-flex">
|
||||
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
|
||||
><span>{{ v.type == 2 ? '-' : '' }}</span
|
||||
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view
|
||||
class="notice-box bg24"
|
||||
:class="{
|
||||
'm-b-90':
|
||||
statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
>
|
||||
<view class="notice-box__content">
|
||||
<view class="notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c25">订单编号</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.no }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy">
|
||||
<image :src="`${$url}goods/copy1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<truckLine :data="state.orderInfo" :code="3" v-if="state.orderInfo.deliveryTime"></truckLine>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">下单时间</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
|
||||
<text class="title c25">支付时间:</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">支付方式</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
'm-r-28': statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1"
|
||||
@click="btn(1)"
|
||||
>
|
||||
{{ statusObj[state.orderInfo.status]?.btn1 }}</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn2"
|
||||
@click="btn(2)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn2 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderStatus,
|
||||
formatOrderStatusDescription,
|
||||
handleOrderButtons,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as OrderApi from '@/sheep/api/ai/index';
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
let { proxy } = getCurrentInstance();
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
text: '待付款',
|
||||
text1: '付款时间还剩余',
|
||||
btn1: '去支付',
|
||||
btn2: '取消订单',
|
||||
},
|
||||
10: {
|
||||
text: '待发货',
|
||||
text1: '您的商品即将发货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
},
|
||||
20: {
|
||||
text: '待收货',
|
||||
text1: '您的商品已发货,待您确认收货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
btn1: '确认收货',
|
||||
},
|
||||
30: {
|
||||
text: '已完成',
|
||||
text1: '您的订单已完成,感谢您的购买!',
|
||||
},
|
||||
40: {
|
||||
text: '已取消',
|
||||
text1: '您的订单已取消!',
|
||||
},
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
const systemStore = ref({}); // 门店信息
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
let orderId = ref();
|
||||
|
||||
async function getOrderDetail() {
|
||||
let id = orderId.value;
|
||||
// 对详情数据进行适配
|
||||
let res;
|
||||
res = await OrderApi.getGiftOrderInfo({
|
||||
id,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
state.orderInfo = res.data;
|
||||
handleOrderButtons(state.orderInfo);
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
||||
await getOrderDetail();
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
orderId.value = options.id;
|
||||
}
|
||||
await getOrderDetail();
|
||||
});
|
||||
|
||||
const priceArr = ref([
|
||||
{
|
||||
title: '商品金额',
|
||||
value: 'totalPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '运费',
|
||||
value: 'deliveryPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
value: 'payPrice',
|
||||
type: 1,
|
||||
},
|
||||
]);
|
||||
const btn = async (type) => {
|
||||
if (state.orderInfo.status === 0 && type === 1) {
|
||||
// 去支付
|
||||
goPay();
|
||||
}
|
||||
if (state.orderInfo.status === 0 && type === 2) {
|
||||
// 取消订单
|
||||
cancelOrder();
|
||||
}
|
||||
if (state.orderInfo.status === 20 && type === 1) {
|
||||
// 确认收货confirmReceive
|
||||
OrderApi.giftConfirmReceive({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: state.orderInfo.id,
|
||||
payOrderId: state.orderInfo.payOrderId,
|
||||
});
|
||||
};
|
||||
const cancelOrder = () => {
|
||||
OrderApi.cancelOrder({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.score-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.apply-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.state-box {
|
||||
color: rgba(#fff, 0.9);
|
||||
width: 100%;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.state-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-address-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 20rpx 32rpx 24rpx 32rpx;
|
||||
padding: 24rpx 30rpx 24rpx 20rpx;
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
color: #1b1b21;
|
||||
|
||||
.address-username {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.address-detail {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-goods {
|
||||
border-radius: 10rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.order-list {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.order-card {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.order-sku {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
width: 450rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.order-num {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-btn {
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
height: 36rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
border: 2rpx solid var(--ui-BG-Main);
|
||||
border-radius: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单信息。
|
||||
.notice-box {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-box__head {
|
||||
font-size: 30rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 80rpx;
|
||||
border-bottom: 1rpx solid #dfdfdf;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.notice-box__content {
|
||||
padding: 20rpx;
|
||||
|
||||
.self-pickup-box {
|
||||
width: 100%;
|
||||
|
||||
.self-pickup--img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-item,
|
||||
.notice-item--center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
width: 100rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
padding: 0;
|
||||
background: rgba(238, 238, 238, 1);
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
|
||||
// 订单价格信息
|
||||
.order-price-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-item {
|
||||
line-height: 70rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.all-rpice-item {
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #3b3b3b;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.all-price {
|
||||
color: #ee0a24 !important;
|
||||
}
|
||||
|
||||
// 底部
|
||||
.footer-box {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
padding-right: 20rpx;
|
||||
|
||||
.cancel-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.cityImg {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-top: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.order-goods {
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.copy {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 14rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.orderBan {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,365 @@
|
||||
<template>
|
||||
<s-pages title="AI店铺" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32 h100 flex-column">
|
||||
<view class="search flex-center m-t-48 m-b-56">
|
||||
<view class="searchLeft flex1 flex-center p-l-40 p-r-40">
|
||||
<uni-icons class="m-r-20" type="search" color="#8F8F8F" size="" />
|
||||
<uni-easyinput
|
||||
class="flex1"
|
||||
v-model="searchText"
|
||||
type="text"
|
||||
placeholder="请搜索想要的商品"
|
||||
:inputBorder="false"
|
||||
@blur="search"
|
||||
@clear="clearSearch"
|
||||
placeholderStyle="color: #D3D3D3;font-size: 28rpx;"
|
||||
:styles="{ color: '', fontSize: '28rpx' }"
|
||||
/>
|
||||
</view>
|
||||
<view class="m-l-24" @click="search">搜索</view>
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<card_pages
|
||||
ref="pageCommodity"
|
||||
:navList="nav"
|
||||
:currentTab="index"
|
||||
@upCallback="getData"
|
||||
:height="height + 'px'"
|
||||
:oneShow="true"
|
||||
>
|
||||
<template #nav>
|
||||
<view class="flex-center ju-flex-start">
|
||||
<view
|
||||
v-for="(tab, i) in nav"
|
||||
:key="tab.id"
|
||||
class="m-r-32 navItem flex-center flex-column size28 line32 c28"
|
||||
:class="{ active: index == i, c29: index == i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="">
|
||||
{{ tab.name }}
|
||||
</view>
|
||||
<view class="navIcon p-b-10">
|
||||
<image class="w100" :src="$ygUrl + 'ai_index_current.png'" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-b-20" v-if="timeRound.length && index === 0">
|
||||
<scroll-view scroll-x class="time-scroll">
|
||||
<view class="flex">
|
||||
<view
|
||||
v-for="(item, i) in timeRound"
|
||||
:key="i"
|
||||
class="timeNav m-r-30"
|
||||
:class="{ activeTime: selectedTimeId === item.id }"
|
||||
@click="changeTimeRound(item, i)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<template #content>
|
||||
<view class="p-t-16">
|
||||
<view class="m-b-24" v-for="(v, i) in dataList" :key="i">
|
||||
<aiOrder
|
||||
:data="v"
|
||||
@addCar="addCar"
|
||||
:source="index"
|
||||
@update="update"
|
||||
@shipment="shipment"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</card_pages>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" v-if="payShow">
|
||||
<card_payment
|
||||
ref="paymentRef"
|
||||
@updataList="clearSearch"
|
||||
@updatePrice="updatePrice"
|
||||
:addShow="addShow"
|
||||
:minSalesCountShow="navName == '折扣区' ? true : false"
|
||||
/>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, watch, getCurrentInstance } from 'vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import CartApi from '@/sheep/api/trade/cart.js';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
import card_payment from '@/components/card_payment/card_payment';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const searchText = ref('');
|
||||
const search = (text = '') => {
|
||||
pageCommodity.value.downCallback();
|
||||
};
|
||||
const clearSearch = () => {
|
||||
searchText.value = '';
|
||||
pageCommodity.value.downCallback();
|
||||
};
|
||||
const getCartList = async () => {
|
||||
let res = await api.getShopCartList({});
|
||||
if (res.code === 0) {
|
||||
if (res.data.length || addShow.value) {
|
||||
payShow.value = true;
|
||||
} else {
|
||||
payShow.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* 选品广场时间轮次 */
|
||||
const timeRound = ref([]);
|
||||
const selectedTimeId = ref(null);
|
||||
let navName = ref('');
|
||||
function changeTimeRound(e, i) {
|
||||
navName.value = e.name;
|
||||
selectedTimeId.value = e?.id ?? null;
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function getSpuTimeList() {
|
||||
api.getSpuTimeList({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
timeRound.value = res.data || [];
|
||||
selectedTimeId.value = timeRound.value?.[0]?.id ?? null;
|
||||
navName.value = timeRound.value?.[0]?.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
/* */
|
||||
onShow(() => {
|
||||
getSpuTimeList();
|
||||
getCartList();
|
||||
|
||||
// if(paymentRef.value){
|
||||
// paymentRef.value.getCartList()
|
||||
// }
|
||||
});
|
||||
const update = () => {
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
};
|
||||
// 购物车数据
|
||||
let carArr = ref([]);
|
||||
let height = ref(0);
|
||||
let system = uni.getSystemInfoSync();
|
||||
let h =
|
||||
system.windowHeight -
|
||||
system.statusBarHeight -
|
||||
uni.upx2px(88) -
|
||||
uni.upx2px(76) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(67) -
|
||||
uni.upx2px(70) +
|
||||
uni.upx2px(8);
|
||||
let index = ref(0);
|
||||
let price = ref(0);
|
||||
let payShow = ref(false);
|
||||
let addShow = ref(false);
|
||||
watch(
|
||||
() => [payShow.value],
|
||||
() => {
|
||||
if (payShow.value) {
|
||||
height.value = h - uni.upx2px(128);
|
||||
} else {
|
||||
height.value = h;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
// watch(
|
||||
// () => [carArr.value, index.value,price.value],
|
||||
// () => {
|
||||
// if (carArr.value.length && !index.value && price.value > 0) {
|
||||
// payShow.value = true
|
||||
// height.value = h - uni.upx2px(128);
|
||||
// } else {
|
||||
// payShow.value = false
|
||||
// height.value = h;
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// immediate: true,
|
||||
// deep: true,
|
||||
// },
|
||||
// );
|
||||
let nav = ref([
|
||||
{
|
||||
name: '选品广场',
|
||||
id: 1,
|
||||
},
|
||||
{
|
||||
name: '我的店铺',
|
||||
id: 2,
|
||||
},
|
||||
]);
|
||||
let pageCommodity = ref(null);
|
||||
let dataList = ref([]);
|
||||
const getData = async (mescroll) => {
|
||||
if (mescroll.dataObj.index != index.value) {
|
||||
return;
|
||||
}
|
||||
let res = null;
|
||||
if (index.value) {
|
||||
res = await api.getOrderPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyWord: searchText.value,
|
||||
});
|
||||
} else {
|
||||
res = await api.getSpuPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyWord: searchText.value,
|
||||
timeId: selectedTimeId.value,
|
||||
...mescroll.params,
|
||||
});
|
||||
}
|
||||
|
||||
// CartApi.getCartList()
|
||||
if (res.code !== 0) {
|
||||
pageCommodity.value.getState(false);
|
||||
return;
|
||||
}
|
||||
let curPageData = []; // 当前页数据
|
||||
if (index.value) {
|
||||
let list = res.data.list;
|
||||
let arr = [];
|
||||
if (list.length) {
|
||||
list.forEach((e) => {
|
||||
e.items1 = JSON.parse(JSON.stringify(e.items));
|
||||
if (e?.items?.length) {
|
||||
e.items.forEach((item) => {
|
||||
item.skuArr = item.items;
|
||||
item.status = e.status;
|
||||
item.id = item.spuId;
|
||||
item.spuId = e.payOrderId;
|
||||
item.shoppingPlazaId = e.roundTimeId;
|
||||
item.items1 = e.items1
|
||||
arr.push(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 多规格
|
||||
if (arr.length) {
|
||||
arr.forEach((e) => {
|
||||
if (e.skuArr && e.skuArr.length) {
|
||||
e.skuArr.forEach((item) => {
|
||||
item.propertyText = '';
|
||||
if (item?.properties) {
|
||||
item.properties.forEach((e1) => {
|
||||
item.propertyText += e1.valueName + ' ';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
curPageData = arr;
|
||||
} else {
|
||||
curPageData = res.data?.list || [];
|
||||
}
|
||||
if (mescroll?.num == 1) {
|
||||
dataList.value = [];
|
||||
}
|
||||
dataList.value = dataList.value.concat(curPageData);
|
||||
console.log(dataList.value);
|
||||
pageCommodity.value.getState(true, curPageData.length);
|
||||
};
|
||||
let paymentRef = ref(null);
|
||||
const addCar = (data) => {
|
||||
payShow.value = true;
|
||||
addShow.value = true;
|
||||
setTimeout(() => {
|
||||
if (paymentRef.value) {
|
||||
paymentRef.value.addCar(data);
|
||||
}
|
||||
}, 500);
|
||||
};
|
||||
const navChange = (i) => {
|
||||
index.value = i;
|
||||
dataList.value = [];
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
if (index.value) {
|
||||
payShow.value = false;
|
||||
} else {
|
||||
payShow.value = true;
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/AI/member',
|
||||
});
|
||||
};
|
||||
const updatePrice = (val) => {
|
||||
addShow.value = val;
|
||||
getCartList();
|
||||
};
|
||||
//延迟/立即发货
|
||||
function shipment(e) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.time-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.timeNav {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.searchLeft {
|
||||
background: #fff;
|
||||
height: 72rpx;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.navItem {
|
||||
.navIcon {
|
||||
opacity: 0;
|
||||
width: 39rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
font-size: 32rpx !important;
|
||||
|
||||
.navIcon {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.c28 {
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.c29 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.activeTime {
|
||||
color: #fb4d32;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,632 @@
|
||||
<template>
|
||||
<s-layout navbar="inner" :goLeft="false" @onClickLeft="onClickLeft" theme="2" color="#ffffff" :index="1000">
|
||||
<view class="theme-ai pages bg1" :style="{ top: -height + 'px' }">
|
||||
<view class="w100 bg">
|
||||
<image class="w100" :src="$ygUrl + 'ai_member_bg.png'" mode="widthFix" />
|
||||
</view>
|
||||
<view class="con p-t-282 p-x-32">
|
||||
<view class="w100 flex-center m-b-48">
|
||||
<view class="titleImg">
|
||||
<image class="w100" :src="$ygUrl + 'member_1.png'" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="arr flex-row wrap w100 m-b-24">
|
||||
<view class="item m-b-32" v-for="(v, i) in arr" :key="i">
|
||||
<view class="itemBg">
|
||||
<image class="w100" :src="$ygUrl + 'member_2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="itemCon flex-center p-y-24 p-l-8 p-r-22">
|
||||
<view class="itemIcon shrink">
|
||||
<image :src="v.icon" mode="widthFix" />
|
||||
</view>
|
||||
<view>
|
||||
<view class="t1 size28 m-b-8 line38">{{ v.title }}</view>
|
||||
<view class="t2 size22">{{ v.title1 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 等级 -->
|
||||
<view class="card3" v-if="!status && openStatus === 0">
|
||||
<view class="card3_bg">
|
||||
<image class="w100" :src="$ygUrl + 'ai_member_bg2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="text1 size24 p-x-14"> 限时福利 </view>
|
||||
<view class="card3_img1">
|
||||
<image class="w100" :src="$url + 'ai/member/9.png'" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
<view class="card3_con flex-center ju-flex-start p-t-54 p-b-44 p-l-22">
|
||||
<view class="card3_img m-r-30">
|
||||
<image class="w100" :src="$ygUrl + 'member_icon_5.png'" mode="widthFix" />
|
||||
</view>
|
||||
<view class="m-r-16">
|
||||
<view class="m-b-8 c_money size56 weight900"><span class="size32">¥</span>{{
|
||||
getPriceRes.activityPrice }}</view>
|
||||
<view class="c12 through size24">原价¥{{ getPriceRes.originalPrice }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="size32 c10 f500">数字居民</view>
|
||||
<view class="size24 c11">尊贵身份 居民特享</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="status && levelObj && levelObj.bgIcon" class="h_244 m-b-32 relative">
|
||||
<view class="h100 w100">
|
||||
<image class="h100 w100" :src="$url + levelObj.bgIcon" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="absolute w100 h100 flex-column ju-between t0 l0">
|
||||
<view class="flex-row">
|
||||
<view class="size22 p-x-16 h_40 line40 center m-t-4 m-l-4" :style="{
|
||||
background: levelObj.color2,
|
||||
color: levelObj.color1,
|
||||
borderRadius: '16rpx 0 16rpx 0',
|
||||
}">
|
||||
当前等级<span v-if="level">V{{ level }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w_190 h_174 absolute t-32 r40">
|
||||
<image class="w100 h100" :src="$url + levelObj.icon1" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="flex al-flex-end h_72">
|
||||
<image class="w_208 h100 m-l-34" :src="$url + levelObj.textIcon" mode="scaleToFill" />
|
||||
<!-- <view class="m-b-10">
|
||||
<uni-icons type="star-filled" size="18" :color="levelObj.color1" v-for="(item,i) in 0" :key="i" />
|
||||
</view> -->
|
||||
<uni-rate :value="levelObj.levelStartNum" :max="levelObj.levelStarMax" size="18"
|
||||
:color="levelObj.color2" :active-color="levelObj.color1" readonly class="m-b-10"
|
||||
v-if="level !== 3 && status === 1" />
|
||||
</view>
|
||||
<view class="progress relative m-l-34">
|
||||
<view class="w100 absolute t0 l0 h_8" :style="{ background: levelObj.bg2 }"></view>
|
||||
<view class="absolute t0 l0 h_8" :style="{
|
||||
background: levelObj.bg1,
|
||||
width: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
</view>
|
||||
<view class="absolute t-4 w_16 h_16 qiu radius16" :style="{
|
||||
background: levelObj.bg1,
|
||||
left: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
</view>
|
||||
<view class="absolute t-34 w_80 center size20" :style="{
|
||||
color: levelObj.bg1,
|
||||
marginLeft: '-40rpx',
|
||||
left: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
<!-- {{ parseInt(userInfo?.progress?.currentProgress) || 0 }}% -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-l-34 m-b-18 weight500 size22" :style="{ color: levelObj.color3 }">
|
||||
{{ levelObj.text }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- m-b-258 -->
|
||||
<view class="card4" v-if="mesArr.length">
|
||||
<maoScroll :data="mesArr" :lineHeight="72" :animation="1000" :animationScroll="1000" :showNum="3">
|
||||
<template #default="{ line }">
|
||||
<view class="bg14 radius8 p-x-16 flex-center ju-flex-start h100"
|
||||
style="display: line-block">
|
||||
<view class="m-r-18 userImg flex-center">
|
||||
<image class="w_56 h_56" :src="line.avatar" mode="scaleToFill" v-if="line.avatar"
|
||||
style="border-radius: 50%" />
|
||||
<image v-else class="w_56 h_56" :src="`${$url}home/head.png`" mode="scaleToFill"
|
||||
style="border-radius: 50%" />
|
||||
<view class="userType" v-if="userType[parseInt(line.userType)]?.icon">
|
||||
<image class="w_20 h_20" :src="$url + userType[parseInt(line.userType)]?.icon"
|
||||
mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="size28 line54" v-html="line.messageContent"></view>
|
||||
</view>
|
||||
</template>
|
||||
</maoScroll>
|
||||
</view>
|
||||
|
||||
<!-- 商品 v-if="!status"-->
|
||||
<view class="goods-wrap m-b-258">
|
||||
<view class="goods-item" v-for="(item, i) in goods_list">
|
||||
<view class="pic">
|
||||
<view class="buy-status" v-if="status"> 已购买 </view>
|
||||
<image :src="item.picUrl" />
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<view class="title lineTwo">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="spec">
|
||||
<!-- xx | xx -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="price"> <text>¥</text>{{ $fen2yuan(item.price) }} </view>
|
||||
<view class="btn" @click="buyGoods(item)" v-if="!status && num"> 立即购买 </view>
|
||||
<view class="btn" @click="goOrderDetail(item)" v-if="status"> 订单详情 </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card6 bg1">
|
||||
<view class="ai-button" @click="sub" v-if="!status && num && openStatus === 0">
|
||||
立即开通
|
||||
</view>
|
||||
<view class="ai-button" @click="sub" v-if="status"> 进入店铺 </view>
|
||||
<view class="card5">
|
||||
<view class="radio-box">
|
||||
<radio-group @change="radioChange">
|
||||
<label class="flex-center ju-flex-start">
|
||||
<radio color="#FB4D32" class="radio" value="1" :checked="radioValue" />
|
||||
<view class="flex-center size24">
|
||||
我已阅读并同意
|
||||
<text class="c8" @click="go()">《臻选优购服务协议》</text>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import maoScroll from '@/components/mao-scroll/mao-scroll';
|
||||
import { userType } from '@/sheep/helper/user';
|
||||
import * as api from '@/sheep/api/ai';
|
||||
import sheep from '@/sheep';
|
||||
let openStatus = ref(0); //判断是需要开通商品 0-不发货,1-发货
|
||||
let { proxy } = getCurrentInstance();
|
||||
let arr = ref([
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_1.png',
|
||||
title: '品牌中国 数字家园',
|
||||
title1: '中国塑品牌 数字建家园',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_2.png',
|
||||
title: '权益代码 数字账本',
|
||||
title1: '代码明权属 账本存变动',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_3.png',
|
||||
title: '数据驱动 平台赋能',
|
||||
title1: '数据驱决策 平台赋动能',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_4.png',
|
||||
title: '高维素质 数字世界',
|
||||
title1: '素质提维度 适配数字境',
|
||||
},
|
||||
]);
|
||||
let mesArr = ref([]);
|
||||
let orderId = ref();
|
||||
let getPriceRes = reactive({
|
||||
originalPrice: 0,
|
||||
activityPrice: 0,
|
||||
});
|
||||
const radioValue = ref();
|
||||
let goods_list = ref([]);
|
||||
const radioChange = (e) => {
|
||||
radioValue.value = e.detail.value;
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/agreement?type=4',
|
||||
});
|
||||
};
|
||||
const goAIindex = () => {
|
||||
proxy.utils.go('/pages/AI/index');
|
||||
};
|
||||
function buyGoods(e) {
|
||||
if (!radioValue.value) {
|
||||
proxy.utils.toast('请先阅读并同意协议');
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/AI/giftOrder?id=${e.id}`,
|
||||
});
|
||||
}
|
||||
function goOrderDetail(e) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/AI/giftOrderInfo?id=${orderId.value}`,
|
||||
});
|
||||
}
|
||||
const sub = async () => {
|
||||
if (radioValue.value) {
|
||||
// proxy.utils.toast('开通成功');
|
||||
// setTimeout(() => {
|
||||
// proxy.utils.go('/pages/AI/index');
|
||||
// }, 1000);
|
||||
if (status.value) {
|
||||
proxy.utils.go('/pages/AI/index');
|
||||
return;
|
||||
}
|
||||
let res = await api.createOpen({});
|
||||
setTimeout(() => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: res.data.id,
|
||||
payOrderId: res.data.payOrderId,
|
||||
type: 2,
|
||||
price: getPriceRes.activityPrice,
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
proxy.utils.toast('请先阅读并同意协议');
|
||||
}
|
||||
};
|
||||
let userInfo = ref({});
|
||||
let level = ref(0);
|
||||
let levelObj = ref({});
|
||||
const getInfo = async () => {
|
||||
let res: any = await api.getLevelInfo({});
|
||||
if (res.code === 0) {
|
||||
userInfo.value = res.data;
|
||||
level.value = res.data.currentLevel?.level;
|
||||
levelObj.value = userType[level.value];
|
||||
//星星(推荐人)最大数量限制
|
||||
if (level.value === 0) {
|
||||
levelObj.value.levelStarMax = 5;
|
||||
} else {
|
||||
levelObj.value.levelStarMax = 3;
|
||||
}
|
||||
//星星(推荐人)数量
|
||||
if (res.data.currentLevel.level === 3) {
|
||||
levelObj.value.levelStartNum = 3;
|
||||
} else {
|
||||
levelObj.value.levelStartNum = 5 - Number(res.data.progress.upgradeRequirements.slice(2, 3));
|
||||
}
|
||||
// console.log(levelObj.value);
|
||||
}
|
||||
};
|
||||
let num = ref(0);
|
||||
let status = ref(0); // 0 未开通 1 已开通
|
||||
//获取是否开通商品发货
|
||||
async function getOpenStatus() {
|
||||
const res = await api.getAiOpenStatus();
|
||||
openStatus.value = res.data;
|
||||
return res;
|
||||
}
|
||||
const loadPageData = async () => {
|
||||
uni.showLoading({ title: '加载中' });
|
||||
try {
|
||||
const [openStatusRes, statusRes, messageRes, remainingRes, priceRes] = await Promise.all([
|
||||
api.getAiOpenStatus(),
|
||||
api.checkShopStatus({}),
|
||||
api.getMessageList({ pageNo: 1, pageSize: 10 }),
|
||||
api.getRemainingCount({}),
|
||||
api.getPrice(),
|
||||
]);
|
||||
openStatus.value = openStatusRes.data;
|
||||
status.value = statusRes.data;
|
||||
await getProduct(status.value);
|
||||
if (status.value) {
|
||||
radioValue.value = true;
|
||||
await getInfo();
|
||||
}
|
||||
mesArr.value = messageRes.code === 0 ? messageRes.data : [];
|
||||
num.value = remainingRes.data;
|
||||
if (remainingRes.code === 0 && remainingRes.data <= 0 && !status.value) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: 'AI店铺开通数量已用完,请联系客服',
|
||||
cancelText: '返回',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
} else if (res.cancel) {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
getPriceRes.activityPrice = Number(priceRes.data.activityPrice).toFixed(2);
|
||||
getPriceRes.originalPrice = Number(priceRes.data.originalPrice).toFixed(2);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
onShow(async () => {
|
||||
await loadPageData();
|
||||
});
|
||||
const onClickLeft = () => {
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
};
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
|
||||
//获取开通ai店铺赠送商品
|
||||
function getProduct(status) {
|
||||
if (status === 1) {
|
||||
api.getGiftOrder().then((res) => {
|
||||
orderId.value = res.data.id;
|
||||
// console.log(res);
|
||||
if (res.data) {
|
||||
res.data.items.forEach((e) => {
|
||||
e.name = e.spuName;
|
||||
});
|
||||
goods_list.value = res.data.items;
|
||||
}
|
||||
});
|
||||
} else if (status === 0) {
|
||||
if (openStatus.value === 1) {
|
||||
api.getAiProduct({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
}).then((res) => {
|
||||
goods_list.value = res.data.list;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card4 {
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.pages {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
padding-bottom: 84rpx;
|
||||
|
||||
.bg {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.con {
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
|
||||
.goods-wrap {
|
||||
.goods-item {
|
||||
margin-bottom: 24rpx;
|
||||
display: flex;
|
||||
|
||||
.pic {
|
||||
width: 206rpx;
|
||||
min-width: 206rpx;
|
||||
height: 206rpx;
|
||||
background: #d8d8d8;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
|
||||
.buy-status {
|
||||
background: #366eee;
|
||||
// display: inline-flex;
|
||||
border-radius: 0 0 12rpx 0;
|
||||
font-size: 16rpx;
|
||||
line-height: 28rpx;
|
||||
padding: 0 8rpx;
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
// color: #FFFFFF;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.spec {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height: 30rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
line-height: 42rpx;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
line-height: 54rpx;
|
||||
border-radius: 94rpx;
|
||||
background: linear-gradient(270deg, var(--color3) 0%, var(--color2) 99%);
|
||||
padding: 0 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.titleImg {
|
||||
width: calc(566 / 686 * 100%);
|
||||
}
|
||||
|
||||
.arr {
|
||||
.item {
|
||||
width: calc(100% / 2 - 15rpx);
|
||||
margin-right: 30rpx;
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
position: relative;
|
||||
|
||||
.itemBg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.itemIcon {
|
||||
width: 60rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.itemCon {
|
||||
position: relative;
|
||||
|
||||
.t1 {
|
||||
color: #f13428;
|
||||
}
|
||||
|
||||
.t2 {
|
||||
color: #f7772e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card3 {
|
||||
position: relative;
|
||||
margin-bottom: 44rpx;
|
||||
|
||||
.f500 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.c11 {
|
||||
color: #f7772e !important;
|
||||
}
|
||||
|
||||
.card3_img {
|
||||
width: 108rpx;
|
||||
}
|
||||
|
||||
.card3_bg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.card3_con {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.text1 {
|
||||
position: absolute;
|
||||
left: 28rpx;
|
||||
top: -20rpx;
|
||||
line-height: 40rpx;
|
||||
background: linear-gradient(128deg, #f1873b 0%, #ec5d2d 99%);
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.card3_img1 {
|
||||
width: 129rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.card4 {
|
||||
.bg14 {
|
||||
background: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.card5 {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.c8 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.radio-box {}
|
||||
|
||||
.radio {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-radio-input) {
|
||||
background-color: rgba($color: #000000, $alpha: 0);
|
||||
}
|
||||
|
||||
.userImg {
|
||||
position: relative;
|
||||
|
||||
.userType {
|
||||
position: absolute;
|
||||
bottom: 0rpx;
|
||||
right: -10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card5 {}
|
||||
|
||||
.card6 {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0rpx;
|
||||
left: 0;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
padding-top: 24rpx;
|
||||
padding-bottom: 50rpx;
|
||||
|
||||
.ai-button {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.progress {
|
||||
width: 63%;
|
||||
}
|
||||
|
||||
.qiu {}
|
||||
|
||||
.level-title {
|
||||
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
|
||||
font-weight: 400;
|
||||
font-size: 51rpx;
|
||||
line-height: 66rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,524 @@
|
||||
<!-- 订单详情 -->
|
||||
<template>
|
||||
<s-pages title="订单详情">
|
||||
<view class="flex-center al-flex-end ju-between p-x-32 m-b-54">
|
||||
<view>
|
||||
<view class="size40 weight500 m-b-16">{{ statusObj[state.orderInfo.status]?.text }}</view>
|
||||
<view class="size24">{{ statusObj[state.orderInfo.status]?.text1 }}</view>
|
||||
</view>
|
||||
<view class="w_120 h_120" v-if="statusObj[state.orderInfo.status]?.icon">
|
||||
<image
|
||||
class="w100 h100"
|
||||
:src="statusObj[state.orderInfo.status]?.icon"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收货地址 -->
|
||||
<view class="order-address-box flex-row bg24 c0" v-if="state.orderInfo.receiverAreaId > 0">
|
||||
<view class="cityImg">
|
||||
<image :src="`${$url}goods/city1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="size32">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<text class="address-username">
|
||||
{{ state.orderInfo.receiverName }}
|
||||
</text>
|
||||
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
|
||||
</view>
|
||||
<view class="address-detail size32">
|
||||
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="detail-goods"
|
||||
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
|
||||
>
|
||||
<card_order
|
||||
theme="2"
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
></card_order>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
<view class="order-price-box bg24">
|
||||
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
|
||||
<text class="title c25">{{ v.title }}</text>
|
||||
<view class="ss-flex">
|
||||
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
|
||||
><span>{{ v.type == 2 ? '-' : '' }}</span
|
||||
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view
|
||||
class="notice-box bg24"
|
||||
:class="{
|
||||
'm-b-90':
|
||||
statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
>
|
||||
<view class="notice-box__content">
|
||||
<view class="notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c25">订单编号</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.no }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy">
|
||||
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- <truckLine :data="state.orderInfo" :code="2" v-if="state.orderInfo.deliveryTime"></truckLine> -->
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">下单时间</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
|
||||
<text class="title c25">支付时间:</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">支付方式</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
'm-r-28': statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1"
|
||||
@click="btn(1)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn1 }}</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn2"
|
||||
@click="btn(2)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn2 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderStatus,
|
||||
formatOrderStatusDescription,
|
||||
handleOrderButtons,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as OrderApi from '@/sheep/api/ai/index';
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
let { proxy } = getCurrentInstance();
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
text: '待付款',
|
||||
text1: '付款时间还剩余',
|
||||
btn1: '去支付',
|
||||
btn2: '取消订单',
|
||||
},
|
||||
10: {
|
||||
text: '待发货',
|
||||
text1: '您的商品即将发货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
},
|
||||
20: {
|
||||
text: '待收货',
|
||||
text1: '您的商品已发货,待您确认收货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
btn1: '确认收货',
|
||||
},
|
||||
30: {
|
||||
text: '已完成',
|
||||
text1: '您的订单已完成,感谢您的购买!',
|
||||
},
|
||||
40: {
|
||||
text: '已取消',
|
||||
text1: '您的订单已取消!',
|
||||
},
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
const systemStore = ref({}); // 门店信息
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
let orderId = ref();
|
||||
|
||||
async function getOrderDetail() {
|
||||
let id = orderId.value;
|
||||
// 对详情数据进行适配
|
||||
let res;
|
||||
res = await OrderApi.getOrderDetail({ id });
|
||||
if (res.code === 0) {
|
||||
state.orderInfo = res.data;
|
||||
handleOrderButtons(state.orderInfo);
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
||||
await getOrderDetail();
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
orderId.value = options.id;
|
||||
}
|
||||
// await getOrderDetail();
|
||||
});
|
||||
|
||||
const priceArr = ref([
|
||||
{
|
||||
title: '商品金额',
|
||||
value: 'totalPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '运费',
|
||||
value: 'deliveryPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
value: 'payPrice',
|
||||
type: 1,
|
||||
},
|
||||
]);
|
||||
const btn = async (type) => {
|
||||
if (state.orderInfo.status === 0 && type === 1) {
|
||||
// 去支付
|
||||
goPay();
|
||||
}
|
||||
if (state.orderInfo.status === 0 && type === 2) {
|
||||
// 取消订单
|
||||
cancelOrder();
|
||||
}
|
||||
if (state.orderInfo.status === 20 && type === 1) {
|
||||
// 确认收货confirmReceive
|
||||
OrderApi.confirmReceive({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: state.orderInfo.id,
|
||||
payOrderId: state.orderInfo.payOrderId,
|
||||
});
|
||||
};
|
||||
const cancelOrder = () => {
|
||||
OrderApi.cancelOrder({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.score-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.apply-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.state-box {
|
||||
color: rgba(#fff, 0.9);
|
||||
width: 100%;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.state-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-address-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 20rpx 32rpx 24rpx 32rpx;
|
||||
padding: 24rpx 30rpx 24rpx 20rpx;
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
color: #1b1b21;
|
||||
|
||||
.address-username {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.address-detail {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-goods {
|
||||
border-radius: 10rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.order-list {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.order-card {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.order-sku {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
width: 450rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.order-num {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-btn {
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
height: 36rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
border: 2rpx solid var(--ui-BG-Main);
|
||||
border-radius: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单信息。
|
||||
.notice-box {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-box__head {
|
||||
font-size: 30rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 80rpx;
|
||||
border-bottom: 1rpx solid #dfdfdf;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.notice-box__content {
|
||||
padding: 20rpx;
|
||||
|
||||
.self-pickup-box {
|
||||
width: 100%;
|
||||
|
||||
.self-pickup--img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-item,
|
||||
.notice-item--center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
width: 100rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
padding: 0;
|
||||
background: rgba(238, 238, 238, 1);
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
|
||||
// 订单价格信息
|
||||
.order-price-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-item {
|
||||
line-height: 70rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.all-rpice-item {
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #3b3b3b;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
.all-price {
|
||||
color: #ee0a24 !important;
|
||||
}
|
||||
|
||||
// 底部
|
||||
.footer-box {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
padding-right: 20rpx;
|
||||
|
||||
.cancel-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.cityImg {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-top: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.order-goods {
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
.copy {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 14rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.orderBan {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<s-pages title="确认订单">
|
||||
<view class="p-b-132">
|
||||
<AddressSelection v-model="addressState" theme="2" @getSettlementInfo="getSettlementInfo" />
|
||||
<view class="p-x-32 m-t-24">
|
||||
<view class="bg24 p-x-20 p-t-20 radius16">
|
||||
<view v-if="settlementInfo.items && settlementInfo.items.length">
|
||||
<view class="m-b-24" v-for="(v, i) in settlementInfo.items" :key="i">
|
||||
<aiOrder :data="v" :source="3" idName="spuId"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">商品金额</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">运费</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.deliveryPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-end borderTop">
|
||||
<span class="size26 line96">合计: </span>
|
||||
<span class="c13 size28 m-l-12 line96 weight900"
|
||||
>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</span
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-32 btn">
|
||||
<view class="ai-button2" @click="sub">确认订单</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import AddressSelection from '@/pages/order/addressSelection.vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
import api from '@/sheep/api/member/address';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import * as SpuApi from '@/sheep/api/ai/index';
|
||||
|
||||
const addressState = ref({
|
||||
addressInfo: {}, // 选择的收货地址
|
||||
deliveryType: 1, // 收货方式:1-快递配送,2-门店自提
|
||||
isPickUp: false, // 门店自提是否开启
|
||||
pickUpInfo: {}, // 选择的自提门店信息
|
||||
receiverName: '', // 收件人名称
|
||||
receiverMobile: '', // 收件人手机
|
||||
});
|
||||
|
||||
const cartList = ref([]);
|
||||
const getCartList = () => {
|
||||
SpuApi.getShopCartList({}).then((res) => {
|
||||
let list = res.data || [];
|
||||
if (list.length) {
|
||||
list.forEach((e) => {
|
||||
e.skuArr = JSON.parse(e.specification);
|
||||
});
|
||||
}
|
||||
cartList.value = list;
|
||||
});
|
||||
};
|
||||
// 获取订单结算信息
|
||||
const settlementInfo = ref({});
|
||||
let addressId = ref('');
|
||||
const getSettlementInfo = (id = '') => {
|
||||
addressId.value = id;
|
||||
SpuApi.getSettlementInfo({
|
||||
id: id,
|
||||
}).then((res) => {
|
||||
settlementInfo.value = res.data || {};
|
||||
|
||||
if (proxy.$fen2yuan(settlementInfo?.price?.payPrice || 0) >= 5000) {
|
||||
proxy.utils.toast('订单金额不能超过5000元');
|
||||
}
|
||||
if (settlementInfo.value?.items?.length) {
|
||||
settlementInfo.value.items.forEach((e) => {
|
||||
e.skuArr = e.items;
|
||||
e.skuArr.forEach((item) => {
|
||||
item.propertyText = '';
|
||||
item.properties.forEach((e1) => {
|
||||
item.propertyText += e1.valueName + ' ';
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const sub = async () => {
|
||||
if (proxy.$fen2yuan(settlementInfo?.price?.payPrice || 0) >= 5000) {
|
||||
proxy.utils.toast('订单金额不能超过5000元, 请重新选择商品');
|
||||
return;
|
||||
}
|
||||
if (!addressId.value) return proxy.utils.toast('请选择地址');
|
||||
let res: any = await SpuApi.createOrder({ id: addressId.value });
|
||||
if (res.code === 0) {
|
||||
proxy.utils.toast('下单成功');
|
||||
setTimeout(() => {
|
||||
// proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
// id: res.data.id,
|
||||
// payOrderId: res.data.payOrderId,
|
||||
// });
|
||||
uni.redirectTo({
|
||||
url: '/pages/AI/cashierDesk?id=' + res.data.id + '&payOrderId=' + res.data.payOrderId,
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
}
|
||||
};
|
||||
const getAddress = () => {
|
||||
api.getAddressList().then((res) => {
|
||||
if (res.code === 0 && res.data?.length) {
|
||||
// addressState.value.addressInfo = res.data[0];
|
||||
// getSettlementInfo(res.data[0].id);
|
||||
let index = res.data.findIndex((e) => e.defaultStatus);
|
||||
if (index !== -1) {
|
||||
addressState.value.addressInfo = res.data[index];
|
||||
getSettlementInfo(res.data[index].id);
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
});
|
||||
};
|
||||
onLoad(() => {
|
||||
// getCartList();
|
||||
getAddress();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
}
|
||||
|
||||
.bottom {
|
||||
}
|
||||
|
||||
.borderTop {
|
||||
border-top: 1px solid #d4d4d4;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0rpx;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: 20rpx;
|
||||
// background: #03011d;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user