This commit is contained in:
@@ -9,40 +9,66 @@
|
||||
<!-- <nut-price position="after" symbol="积分" :price="b" size="large" />-->
|
||||
<!-- </view>-->
|
||||
<!-- 商品信息 -->
|
||||
<view class="order-card">
|
||||
<view class="center mb-[20px]" v-for="(item, index) in orderData.OrderGoods" :key="index">
|
||||
<view class="top">
|
||||
<image :src="item.Goods.cover" />
|
||||
<view class="flex flex-col justify-between flex-1">
|
||||
<view class="title">{{ item.Goods?.name }}</view>
|
||||
<view class="text-[#F83D3D] mt-5">
|
||||
<view>¥{{ item.pay_price }}元
|
||||
<text v-if="item.pay_integral > 0">+{{ item.pay_integral }}积分</text>
|
||||
<view class="w-full" v-for="(itm, idx) in orderData" :key="idx">
|
||||
<view class="order-card">
|
||||
<view class="mb-[10px] text-[28px] text-[#9C9C9C]">{{
|
||||
itm.Store.name
|
||||
}}</view>
|
||||
<view
|
||||
class="center mb-[20px]"
|
||||
v-for="(item, index) in itm.OrderGoods"
|
||||
:key="index">
|
||||
<view class="top">
|
||||
<image :src="item.Goods.cover" />
|
||||
<view class="flex flex-col justify-between flex-1 h-[150px]">
|
||||
<view class="title line-clamp-2 text-[25px]">{{
|
||||
item.Goods?.name
|
||||
}}</view>
|
||||
<view class="text-[#F83D3D] mt-5">
|
||||
<view
|
||||
>¥{{ item.pay_price }}元
|
||||
<text v-if="item.pay_integral > 0"
|
||||
>+{{ item.pay_integral }}积分</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>x{{ item.number }}</view>
|
||||
<view class="right">
|
||||
<view>x{{ item.number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="line"></view> -->
|
||||
<view class="flex justify-between items-center mt-2 mb-2 text-[25px]" style="text-align: right">
|
||||
<text class="text-[#9C9C9C] text-[28px]">共{{ orderData.count }}件商品
|
||||
</text>
|
||||
<text class="text-[26px]">应付款: ¥{{ orderData.discount_price }}元
|
||||
<text v-if="orderData.exchange > 0">
|
||||
积分抵扣: {{ orderData.exchange }}</text>
|
||||
</text>
|
||||
<!-- <view class="line"></view> -->
|
||||
<view
|
||||
class="flex justify-between items-center mt-2 mb-2 text-[25px] text-right">
|
||||
<text class="text-[#9C9C9C] text-[28px]"
|
||||
>共{{ itm.count }}件商品
|
||||
</text>
|
||||
<text class="text-[26px]"
|
||||
>应付款: ¥{{ itm.discount_price }}元
|
||||
<text v-if="itm.exchange > 0"> 积分抵扣: {{ itm.exchange }}</text>
|
||||
</text>
|
||||
<!-- <view class="line"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- {{ payVal }} -->
|
||||
<nut-radio-group class="w-[95%]" v-model="payVal">
|
||||
<nut-cell-group class="w-full">
|
||||
<nut-cell class="text-[#333333]" title="支付方式"></nut-cell>
|
||||
<nut-cell v-for="(item, index) in payList" :key="index" class="flex items-center" :title="item.name"
|
||||
:desc="item.number > 0 ? `可用积分:${item.number}` : item.name.includes('微信') ? '微信全额支付' : ''"
|
||||
<nut-cell
|
||||
v-for="(item, index) in payList"
|
||||
:key="index"
|
||||
class="flex items-center"
|
||||
:title="item.name"
|
||||
:desc="
|
||||
item.number > 0
|
||||
? `可用积分:${item.number}`
|
||||
: item.name.includes('微信')
|
||||
? '微信全额支付'
|
||||
: ''
|
||||
"
|
||||
@click="cellClick(item.ID)">
|
||||
<template #icon>
|
||||
<IconFont size="30" :name="item.icon" />
|
||||
@@ -53,8 +79,14 @@
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
</nut-radio-group>
|
||||
<view class="w-[90%] mt-[100px]">
|
||||
<nut-button shape="square" :loading="isLoading" type="primary" block @click="pay">确认支付
|
||||
<view class="w-[90%] mt-[30px]">
|
||||
<nut-button
|
||||
shape="square"
|
||||
:loading="isLoading"
|
||||
type="primary"
|
||||
block
|
||||
@click="pay"
|
||||
>确认支付
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -62,11 +94,11 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import Taro from '@tarojs/taro';
|
||||
import { IconFont } from '@nutui/icons-vue-taro';
|
||||
import { onUnmounted, ref } from 'vue';
|
||||
import { getActiveOrderDetail, getPayList } from '@/api/goods';
|
||||
import { getUserPoint } from '@/api/admin';
|
||||
import { payOrder } from '@/api/order';
|
||||
import {IconFont} from '@nutui/icons-vue-taro';
|
||||
import {onUnmounted, ref} from 'vue';
|
||||
import {getActiveOrderDetail, getPayList} from '@/api/goods';
|
||||
import {getUserPoint} from '@/api/admin';
|
||||
import {payOrder} from '@/api/order';
|
||||
import * as dayjs from 'dayjs';
|
||||
|
||||
const payVal = ref();
|
||||
@@ -75,21 +107,21 @@ const t_id = ref();
|
||||
|
||||
const tStr = ref('00:00');
|
||||
|
||||
const orderData = ref<any>({});
|
||||
const orderData = ref<any>([]);
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
||||
const opt = ref<any>({});
|
||||
|
||||
Taro.useLoad(e => {
|
||||
const { oid, bid, OrderType } = e;
|
||||
const {oid, bid, OrderType} = e;
|
||||
opt.value = e;
|
||||
get_pay_list();
|
||||
getData(oid, bid, OrderType);
|
||||
});
|
||||
|
||||
const a = ref(0);
|
||||
const b = ref(0);
|
||||
// const a = ref(0);
|
||||
// const b = ref(0);
|
||||
|
||||
const payList = ref<any>([]);
|
||||
|
||||
@@ -101,10 +133,10 @@ const get_pay_list = async () => {
|
||||
|
||||
const getData = async (oid: string, bid: string, OrderType: number) => {
|
||||
const user_info = Taro.getStorageSync('userInfo');
|
||||
const data = await getUserPoint({
|
||||
phone: user_info.data.phone,
|
||||
bid,
|
||||
});
|
||||
// const data = await getUserPoint({
|
||||
// phone: user_info.data.phone,
|
||||
// bid,
|
||||
// });
|
||||
|
||||
const res = await getActiveOrderDetail({
|
||||
oid,
|
||||
@@ -114,32 +146,36 @@ const getData = async (oid: string, bid: string, OrderType: number) => {
|
||||
// let a = 0;
|
||||
// let b = 0;
|
||||
|
||||
orderData.value = {
|
||||
...res.data.data[0],
|
||||
...data.data,
|
||||
};
|
||||
// orderData.value = {
|
||||
// ...res.data.data[0],
|
||||
// ...data.data,
|
||||
// };
|
||||
|
||||
a.value = 0;
|
||||
b.value = 0;
|
||||
orderData.value = res.data.data || [];
|
||||
|
||||
res.data.data.forEach(item => {
|
||||
a.value += item.price;
|
||||
b.value += item.discount_integral;
|
||||
});
|
||||
// console.log(orderData.value)
|
||||
|
||||
if (!orderData.value.oid)
|
||||
// a.value = 0;
|
||||
// b.value = 0;
|
||||
|
||||
// res.data.data.forEach(item => {
|
||||
// a.value += item.price;
|
||||
// b.value += item.discount_integral;
|
||||
// });
|
||||
|
||||
if (!orderData.value.length)
|
||||
return Taro.showToast({
|
||||
title: '未获取到订单信息~',
|
||||
icon: 'none',
|
||||
});
|
||||
countdownTime();
|
||||
// countdownTime();
|
||||
};
|
||||
|
||||
const pay = async () => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
if (!payVal.value)
|
||||
return Taro.showToast({ title: '请选择支付方式', icon: 'none' });
|
||||
return Taro.showToast({title: '请选择支付方式', icon: 'none'});
|
||||
|
||||
await confirmPay();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user