This commit is contained in:
@@ -12,9 +12,8 @@
|
||||
</nut-cell>
|
||||
<nut-checkbox-group
|
||||
v-model="itm.state.checkboxgroup"
|
||||
:ref="(el) => getGroup(el, idx)"
|
||||
@change="(label) => changeBox(label, itm)"
|
||||
>
|
||||
: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>
|
||||
<view class="box">
|
||||
@@ -33,8 +32,7 @@
|
||||
readonly
|
||||
:min="-1"
|
||||
@add.stop="() => onAdd(item)"
|
||||
@reduce.stop="() => onReduce(item)"
|
||||
/>
|
||||
@reduce.stop="() => onReduce(item)" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
</nut-checkbox-group>
|
||||
@@ -44,7 +42,7 @@
|
||||
<view>
|
||||
<view style="height: 100rpx"></view>
|
||||
</view>
|
||||
<view class="bottom-box">
|
||||
<view class="bottom-box" v-if="list.length > 0">
|
||||
<view class="left">
|
||||
<!-- <nut-checkbox v-model="selectAllVal" @change="selectAll"
|
||||
>全选
|
||||
@@ -55,16 +53,14 @@
|
||||
<nut-price
|
||||
v-model:price="localCount.price"
|
||||
size="normal"
|
||||
:need-symbol="false"
|
||||
/>
|
||||
:need-symbol="false" />
|
||||
</view>
|
||||
<view class="text-box">
|
||||
总积分:
|
||||
<nut-price
|
||||
v-model:price="localCount.exchange"
|
||||
size="normal"
|
||||
:need-symbol="false"
|
||||
/>
|
||||
:need-symbol="false" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -75,17 +71,16 @@
|
||||
:is-show-pay="isShowPay"
|
||||
:interval="true"
|
||||
v-model:jfInfo="orderData"
|
||||
@closePay="closePay"
|
||||
/>
|
||||
@closePay="closePay" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { addCart, getAllCart } from "@/api/cart";
|
||||
import { createActiveOrder } from "@/api/goods";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
import {nextTick, ref} from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {addCart, getAllCart} from '@/api/cart';
|
||||
import {createActiveOrder} from '@/api/goods';
|
||||
import Pay from '@/components/Pay.vue';
|
||||
|
||||
interface CardList {
|
||||
name: string;
|
||||
@@ -134,7 +129,7 @@ const changeBox = (label: string[], item: any) => {
|
||||
exchange: 0,
|
||||
};
|
||||
|
||||
item["Count"] = {
|
||||
item['Count'] = {
|
||||
priceCount: 0,
|
||||
exchangeCount: 0,
|
||||
};
|
||||
@@ -143,8 +138,8 @@ const changeBox = (label: string[], item: any) => {
|
||||
label.forEach((id: string) => {
|
||||
item.Goods.forEach((itm: any) => {
|
||||
if (itm.gid === id) {
|
||||
item["Count"].priceCount += itm.price;
|
||||
item["Count"].exchangeCount += itm.exchange;
|
||||
item['Count'].priceCount += itm.price;
|
||||
item['Count'].exchangeCount += itm.exchange;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -193,18 +188,18 @@ const orderData = ref<any>([]);
|
||||
|
||||
const sub = async () => {
|
||||
const arr: any = list.value.filter(
|
||||
(item: any) => item.state.checkboxgroup.length > 0
|
||||
(item: any) => item.state.checkboxgroup.length > 0,
|
||||
);
|
||||
if (arr.length === 0) {
|
||||
Taro.showToast({
|
||||
title: "请选择商品",
|
||||
icon: "none",
|
||||
title: '请选择商品',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { data: res } = await createActiveOrder({
|
||||
const {data: res} = await createActiveOrder({
|
||||
Bid: arr.map((item: any) => item.StoreBid),
|
||||
});
|
||||
if (res.oid) {
|
||||
@@ -214,7 +209,7 @@ const sub = async () => {
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -224,7 +219,7 @@ const closePay = async (val: boolean) => {
|
||||
orderData.value = [];
|
||||
await getList();
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/order_list/index?type=0",
|
||||
url: '/pages/users/order_list/index?type=0',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -239,7 +234,7 @@ const getList = async () => {
|
||||
list.value = list.value.map((item: any) => ({
|
||||
...item,
|
||||
Goods: item.Goods.sort(
|
||||
(a: CardList, b: CardList) => Number(a.gid) - Number(b.gid)
|
||||
(a: CardList, b: CardList) => Number(a.gid) - Number(b.gid),
|
||||
),
|
||||
state: {
|
||||
indeterminate: false,
|
||||
@@ -277,13 +272,13 @@ const add_cart = async (item: CardList, num: number = 1) => {
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
icon: 'none',
|
||||
});
|
||||
await getList();
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -291,7 +286,7 @@ const add_cart = async (item: CardList, num: number = 1) => {
|
||||
|
||||
<style lang="scss">
|
||||
.index {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user