hookehuyr

待申领物资-购物车操作逻辑完善

This diff is collapsed. Click to expand it.
<!--
* @Date: 2024-07-23 12:53:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-24 14:44:31
* @LastEditTime: 2024-07-24 15:15:38
* @FilePath: /temple_material_request/src/views/material_request.vue
* @Description: 申领物资页面
-->
<template>
<div class="material-request-page">
<van-tabs v-model:active="active" @change="onChange" sticky :color="styleColor.baseColor">
<van-tab v-for="index in 8" :title="'标签 ' + index">
<div class="list-wrapper">
......@@ -81,7 +80,7 @@
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { showToast } from 'vant';
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
......@@ -192,6 +191,11 @@ const addShoppingCart = () => { // 加入购物车
.forEach(item => {
shop_cart_list.value = shop_cart_list.value.concat(item);
});
// 购物车为空提示
if (!shop_cart_list.value.length) {
showToast('请选择物资');
return;
}
// 校验购物车值
let error_list = shop_cart_list.value.filter((item) => { if (item.num === null || item.num === '') { return item;} })
if (error_list.length) {
......@@ -213,7 +217,7 @@ const goShoppingCart = () => { // 跳转购物车
}
const show_choose_material = ref(false);
const onCloseChoose = () => {
const onCloseChoose = () => { // 关闭选择物资弹窗回调
show_choose_material.value = false;
}
......