This commit is contained in:
@@ -3,11 +3,16 @@
|
||||
<view v-if="list.length > 0">
|
||||
<nut-cell-group v-for="(itm, idx) in list" :key="idx">
|
||||
<nut-cell>
|
||||
<nut-checkbox v-model="itm.state.checkbox" :indeterminate="itm.state.indeterminate"
|
||||
@change="(val: boolean) => changeBoxAll(val, idx)">{{ itm.StoreName }}
|
||||
<nut-checkbox
|
||||
v-model="itm.state.checkbox"
|
||||
:indeterminate="itm.state.indeterminate"
|
||||
@change="(val: boolean) => changeBoxAll(val, idx)"
|
||||
>{{ itm.StoreName }}
|
||||
</nut-checkbox>
|
||||
</nut-cell>
|
||||
<nut-checkbox-group v-model="itm.state.checkboxgroup" :ref="el => getGroup(el, idx)"
|
||||
<nut-checkbox-group
|
||||
v-model="itm.state.checkboxgroup"
|
||||
:ref="el => getGroup(el, idx)"
|
||||
@change="label => changeBox(label, itm)">
|
||||
<nut-cell v-for="(item, idx1) in itm.Goods" :key="idx1">
|
||||
<nut-checkbox :label="item.gid" style="width: 10%"></nut-checkbox>
|
||||
@@ -15,15 +20,22 @@
|
||||
<view class="box-left">
|
||||
<img class="cover" :src="item.cover" alt="" />
|
||||
<view class="center">
|
||||
<view>{{ item.name }}</view>
|
||||
<view class="line-clamp-2 text-[25px]">{{ item.name }}</view>
|
||||
<view class="price">
|
||||
<view>{{ item.price }}元
|
||||
<text v-if="item.discount_integral > 0">+{{ item.discount_integral }}积分</text>
|
||||
<view
|
||||
>{{ item.price }}元
|
||||
<text v-if="item.discount_integral > 0"
|
||||
>+{{ item.discount_integral }}积分</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-input-number v-model="item.number" readonly :min="-1" @add.stop="() => onAdd(item)"
|
||||
<nut-input-number
|
||||
v-model="item.number"
|
||||
readonly
|
||||
:min="-1"
|
||||
@add.stop="() => onAdd(item)"
|
||||
@reduce.stop="() => onReduce(item)" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
@@ -32,7 +44,7 @@
|
||||
</view>
|
||||
<nut-empty v-else description="购物车暂无数据"></nut-empty>
|
||||
<view>
|
||||
<view style="height: 100rpx"></view>
|
||||
<view style="height: 100px"></view>
|
||||
</view>
|
||||
<view class="bottom-box" v-if="list.length > 0">
|
||||
<view class="left">
|
||||
@@ -42,26 +54,36 @@
|
||||
<view>
|
||||
<view class="text-box">
|
||||
总金额:
|
||||
<nut-price v-model:price="localCount.price" size="normal" :need-symbol="false" />
|
||||
<nut-price
|
||||
v-model:price="localCount.price"
|
||||
size="normal"
|
||||
:need-symbol="false" />
|
||||
</view>
|
||||
<view class="text-box">
|
||||
总积分:
|
||||
<nut-price v-model:price="localCount.exchange" size="normal" :need-symbol="false" />
|
||||
<nut-price
|
||||
v-model:price="localCount.exchange"
|
||||
size="normal"
|
||||
:need-symbol="false" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-button type="primary" @click="sub">去结算</nut-button>
|
||||
</view>
|
||||
<!-- 支付 -->
|
||||
<Pay :is-show-pay="isShowPay" :interval="true" v-model:jfInfo="orderData" @closePay="closePay" />
|
||||
<Pay
|
||||
:is-show-pay="isShowPay"
|
||||
:interval="true"
|
||||
v-model:jfInfo="orderData"
|
||||
@closePay="closePay" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, ref } from 'vue';
|
||||
import {nextTick, ref} from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { addCart, getAllCart } from '@/api/cart';
|
||||
import { createActiveOrder } from '@/api/goods';
|
||||
import {addCart, getAllCart} from '@/api/cart';
|
||||
import {createActiveOrder} from '@/api/goods';
|
||||
import Pay from '@/components/Pay.vue';
|
||||
|
||||
interface CardList {
|
||||
@@ -184,7 +206,7 @@ const sub = async () => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { data: res } = await createActiveOrder({
|
||||
const {data: res} = await createActiveOrder({
|
||||
Bid: arr.map((item: any) => item.StoreBid),
|
||||
});
|
||||
if (res.oid) {
|
||||
@@ -293,16 +315,18 @@ const add_cart = async (item: CardList, num: number = 1) => {
|
||||
align-items: center;
|
||||
|
||||
.cover {
|
||||
width: 130rpx;
|
||||
height: 130rpx;
|
||||
margin-right: 15rpx;
|
||||
border-radius: 20rpx;
|
||||
width: 130px;
|
||||
height: 130px;
|
||||
min-width: 130px;
|
||||
min-height: 130px;
|
||||
margin-right: 15px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
justify-content: space-between;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
@@ -320,21 +344,21 @@ const add_cart = async (item: CardList, num: number = 1) => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
height: 100px;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20rpx;
|
||||
box-shadow: 100rpx 104rpx 288rpx rgba(0, 0, 0, 0.01);
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
padding: 0 20px;
|
||||
box-shadow: 100px 104px 288px rgba(0, 0, 0, 0.01);
|
||||
border-top: 1px solid #f5f5f5;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text-box {
|
||||
margin-left: 10rpx;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<view class="card">
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="flex items-center">
|
||||
<nut-price size="large" :price="goodInfo.number"></nut-price>
|
||||
<nut-price size="large" :price="goodInfo.discount_price"></nut-price>
|
||||
<nut-price
|
||||
v-if="goodInfo.exchange"
|
||||
size="large"
|
||||
@@ -87,6 +87,7 @@ interface GoodInfo {
|
||||
profile?: string;
|
||||
price?: number;
|
||||
cartNum?: number;
|
||||
discount_price?: number;
|
||||
}
|
||||
|
||||
const goodInfo = ref<GoodInfo>({});
|
||||
@@ -311,6 +312,7 @@ page {
|
||||
height: 30px;
|
||||
background-color: #8f8f8f;
|
||||
}
|
||||
|
||||
.line1 {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
.nut-price {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nut-price--symbol-large {
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 1;
|
||||
height: 30px;
|
||||
border-left: 1px solid #a3a3a3;
|
||||
margin: 0 50px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.nut-radio {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.nut-radio__label {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.nut-button {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.nut-short-password {
|
||||
// .nut-icon-tips {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
@for $i from 1 through 5 {
|
||||
.nut-short-password__item:nth-child(#{$i}) {
|
||||
border-right: 1px solid var(--nut-shortpassword-border-color, #ddd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 20px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
image {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 15px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
text-overflow: ellipsis;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 10px;
|
||||
font-size: 28px;
|
||||
text-align: right;
|
||||
color: #9c9c9c;
|
||||
}
|
||||
}
|
||||
}
|
||||
.nut-price {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nut-price--symbol-large {
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 1;
|
||||
height: 30px;
|
||||
border-left: 1px solid #a3a3a3;
|
||||
margin: 0 50px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.nut-radio {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.nut-radio__label {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.nut-button {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.nut-short-password {
|
||||
// .nut-icon-tips {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
@for $i from 1 through 5 {
|
||||
.nut-short-password__item:nth-child(#{$i}) {
|
||||
border-right: 1px solid var(--nut-shortpassword-border-color, #ddd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 10px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
image {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 15px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
text-overflow: ellipsis;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 10px;
|
||||
font-size: 28px;
|
||||
text-align: right;
|
||||
color: #9c9c9c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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