build(custom): 修正提交规范

This commit is contained in:
2023-11-09 19:49:24 +08:00
parent 76d57cea37
commit 29c1d4280f
105 changed files with 29374 additions and 18618 deletions

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '购物车'
})
navigationBarTitleText: "购物车",
});

View File

@@ -1,22 +1,36 @@
<template>
<view>
<view v-if="list.length > 0">
<nut-swipe v-for="(item,index) in list" :key="index">
<nut-swipe v-for="(item, index) in list" :key="index">
<view class="item">
<nut-checkbox v-model="item.checkbox" @click="select">{{ item.ID }}</nut-checkbox>
<image src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg"
style="width: 100px;height: 100px"/>
<nut-checkbox v-model="item.checkbox" @click="select">{{
item.ID
}}</nut-checkbox>
<image
src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg"
style="width: 100px; height: 100px"
/>
<view class="text">
<view>{{ item.name }}</view>
<view class="bom">
<nut-price :price="item.number" size="normal" :need-symbol="false"/>
<nut-input-number readonly @add="select()" @reduce="select()"
v-model="item.count"/>
<nut-price
:price="item.number"
size="normal"
:need-symbol="false"
/>
<nut-input-number
readonly
@add="select()"
@reduce="select()"
v-model="item.count"
/>
</view>
</view>
</view>
<template #right>
<nut-button shape="square" style="height:100%" type="danger">删除</nut-button>
<nut-button shape="square" style="height: 100%" type="danger"
>删除</nut-button
>
</template>
</nut-swipe>
</view>
@@ -28,10 +42,16 @@
</view>
<view class="bottom-box">
<view class="left">
<nut-checkbox v-model="selectAllVal" @change="selectAll">全选</nut-checkbox>
<nut-checkbox v-model="selectAllVal" @change="selectAll"
>全选</nut-checkbox
>
<view class="text-box">
总计积分
<nut-price v-model:price="localCount" size="normal" :need-symbol="false"/>
<nut-price
v-model:price="localCount"
size="normal"
:need-symbol="false"
/>
</view>
</view>
<nut-button type="primary" @click="sub">去结算</nut-button>
@@ -40,78 +60,77 @@
</template>
<script lang="ts" setup>
import {ref} from 'vue'
import Taro from '@tarojs/taro'
import {getCartList} from '@/api/goods'
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { getCartList } from "@/api/goods";
const selectAllVal = ref(false)
const selectAllVal = ref(false);
const list = ref([])
const list = ref([]);
const localCount = ref(0)
const localCount = ref(0);
Taro.useDidShow(() => {
getList()
})
getList();
});
const select = () => {
localCount.value = 0
localCount.value = 0;
list.value.forEach((item: any) => {
if (item.checkbox) {
setTimeout(() => {
item.countNum = Number(item.number) * Number(item.count)
localCount.value += item.countNum
console.log(localCount.value)
}, 1)
selectAllVal.value = true
item.countNum = Number(item.number) * Number(item.count);
localCount.value += item.countNum;
console.log(localCount.value);
}, 1);
selectAllVal.value = true;
} else {
selectAllVal.value = false
selectAllVal.value = false;
}
})
}
});
};
const selectAll = () => {
localCount.value = 0
localCount.value = 0;
list.value.forEach((item: any) => {
item.checkbox = selectAllVal.value
})
select()
console.log(list.value)
}
item.checkbox = selectAllVal.value;
});
select();
console.log(list.value);
};
const sub = () => {
const arr = list.value.filter((item: any) => item.checkbox)
const arr = list.value.filter((item: any) => item.checkbox);
if (arr.length === 0) {
Taro.showToast({
title: '请选择商品',
icon: 'none'
})
return
title: "请选择商品",
icon: "none",
});
return;
}
Taro.navigateTo({
url: '/pages/goods/order_create/index'
})
}
url: "/pages/goods/order_create/index",
});
};
const getList = async () => {
const res = await getCartList()
const res = await getCartList();
list.value = res.data.data.Goods.map((item: any) => {
return {
...item,
count: 1,
countNum: item.number,
checkbox: false
}
})
}
checkbox: false,
};
});
};
const toPage = () => {
Taro.switchTab({
url: '/pages/index/index'
})
}
url: "/pages/index/index",
});
};
</script>
<style lang="scss">
@@ -176,7 +195,5 @@ const toPage = () => {
margin-left: 10px;
}
}
}
</style>