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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user