diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 1e7ad13..7f85a4b 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -49,7 +49,7 @@ export const getAddressDetail = (id: string) => get({ url: URL.addressDetai export const addressCreate = (data: any) => post({ url: URL.addressCreate, data }); export const addressUpdate = (data: any) => post({ url: URL.addressUpdate, data }); -export const addressDelete = (id: string) => post({ url: URL.addressDelete + `?id=${id}` }); +export const addressDelete = (id: string) => post({ url: URL.addressDelete + `?addrid=${id}` }); export const getDynamicCode = () => post({ url: URL.dynamicCode }); diff --git a/src/pages/mall/index.vue b/src/pages/mall/index.vue index aa6300b..50e0d89 100644 --- a/src/pages/mall/index.vue +++ b/src/pages/mall/index.vue @@ -22,7 +22,8 @@ @click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'> {{ item.goodsName || '未知' }} - ¥{{ item.price }} + ¥{{ (item.price * ((userInfo.levelEntity?.discount || 100)/100)).toFixed(2) }} + ¥{{ item.price }} @@ -50,7 +51,7 @@ import useShoppingCartStore from '@/store/modules/shoppingcart'; import { useUserStore } from '@/store'; const userStore = useUserStore(); -const { companyConfigInfo } = storeToRefs(userStore); +const {userInfo, companyConfigInfo } = storeToRefs(userStore); const shoppingCartStore = useShoppingCartStore(); const { totalCount } = storeToRefs(shoppingCartStore); diff --git a/src/pages/mall/subs/goods/detail.vue b/src/pages/mall/subs/goods/detail.vue index 9e61eae..0dd90f8 100644 --- a/src/pages/mall/subs/goods/detail.vue +++ b/src/pages/mall/subs/goods/detail.vue @@ -14,7 +14,13 @@ - {{ goodsBean?.price || 0 }} + + ¥{{ ((goodsBean?.price || 0) * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }} + + ¥{{ goodsBean?.price || 0 }} + + 销量{{ goodsBean?.send_num || 0 }} @@ -49,8 +55,12 @@ :key='index'> - {{ item.goodsName||'未知' }} - {{ item.price }} + {{ item.goodsName || '未知' }} + {{ (item.price * ((userInfo.levelEntity.discount || 100) / 100)).toFixed(2) }} + {{ item.price }} + + @@ -100,10 +110,14 @@ import { goPath, showToast } from '@/utils'; import { getGoodsDetail, getGoodsList } from '@/api/goods'; import { GoodsBean } from '@/api/goods/types'; import useShoppingCartStore from '@/store/modules/shoppingcart'; +import { useUserStore } from '@/store'; const shoppingCartStore = useShoppingCartStore(); const { totalCount } = storeToRefs(shoppingCartStore); +const userStore = useUserStore(); +const { userInfo } = storeToRefs(userStore); + const goodsBean = ref(); const recommendList = ref(); @@ -216,6 +230,9 @@ const placeOrder = () => { padding: 20rpx 30rpx; view:nth-of-type(1) { + display: flex; + flex-direction: row; + text:nth-of-type(1) { display: flex; font-size: 40rpx; @@ -225,10 +242,10 @@ const placeOrder = () => { } .goods-price:before { - content: "¥"; - font-size: 30rpx; - margin-bottom: 5rpx; - margin-right: 5rpx; + //content: "¥"; + //font-size: 30rpx; + //margin-bottom: 5rpx; + //margin-right: 5rpx; } text:nth-of-type(2) { diff --git a/src/pages/mall/subs/search/index.vue b/src/pages/mall/subs/search/index.vue index fc36802..aa9549a 100644 --- a/src/pages/mall/subs/search/index.vue +++ b/src/pages/mall/subs/search/index.vue @@ -12,8 +12,12 @@ - {{ item.goodsName||'未知' }} - ¥{{ item.price }} + {{ item.goodsName || '未知' }} + ¥{{ (item.price * ((userInfo.levelEntity?.discount || 100)/100)).toFixed(2) }} + ¥{{ item.price }} + + @@ -29,10 +33,14 @@ import { goPath } from '@/utils'; import { getGoodsList } from '@/api/goods'; import useShoppingCartStore from '@/store/modules/shoppingcart'; import { GoodsBean } from '@/api/goods/types'; +import { useUserStore } from '@/store'; const skuDialogRef = ref(); const shoppingCartStore = useShoppingCartStore(); +const userStore = useUserStore(); +const { userInfo } = storeToRefs(userStore); + const goodsList = ref([]); onLoad((e) => { diff --git a/src/pages/mall/subs/shoppingcart/index.vue b/src/pages/mall/subs/shoppingcart/index.vue index 756ff85..aa1806c 100644 --- a/src/pages/mall/subs/shoppingcart/index.vue +++ b/src/pages/mall/subs/shoppingcart/index.vue @@ -12,7 +12,7 @@ + @click.stop='handleCheck(item)' /> {{ item.name }} @@ -24,7 +24,12 @@ - ¥{{ item.price }} + + ¥{{ (item?.price * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }} + ¥{{ item?.price }} + + @@ -41,7 +46,7 @@ - + 全选 @@ -50,7 +55,7 @@ 删除 合计: - ¥{{ totalPayPrice }} + ¥{{ totalPayPrice.toFixed(2) }} 结算 @@ -67,6 +72,7 @@ import { goPath, showToast } from '@/utils'; import { GoodsBean, StockBean } from '@/api/goods/types'; import SkuDialog from '@/components/sku-dialog.vue'; import { ref } from 'vue'; +import { useUserStore } from '@/store'; const isEditMode = ref(false); const checkedAll = ref(false); @@ -74,22 +80,37 @@ const checkedAll = ref(false); const shoppingCartStore = useShoppingCartStore(); const { shoppingCartList, totalCount } = storeToRefs(shoppingCartStore); +const userStore = useUserStore(); +const { userInfo } = storeToRefs(userStore); + const skuDialogRef = ref(); const temporaryGoodsBean = ref(); const temporaryStockBean = ref(); -watch(checkedAll, (newValue) => { - shoppingCartList.value.forEach(res => { - res.checked = newValue; - }); +const totalPayPrice = computed(() => { + return shoppingCartList.value.filter(res => res.checked).reduce((a, b) => a + b.consumePrice * b.checkedStock.count, 0) || 0; }); -const totalPayPrice = computed(() => { - return shoppingCartList.value.filter(res => res.checked).reduce((a, b) => a + b.consumePrice * b.checkedStock.count, 0); -}); +const handleCheck = (item: any) => { + item.checked = !item.checked; + if(!item.checked) { + checkedAll.value = false; + } else { + checkedAll.value = shoppingCartList.value.every(res => res.checked); + } +}; + +const handleAllCheck = () => { + checkedAll.value = !checkedAll.value; + shoppingCartList.value.forEach(res => { + res.checked = checkedAll.value; + }); +}; const deleteShoppingCart = () => { shoppingCartStore.deleteIfChecked(); + checkedAll.value = false; + isEditMode.value = false; }; const showSkuDialog = (index: number) => { diff --git a/src/pages/mine/subs/address/index.vue b/src/pages/mine/subs/address/index.vue index ff84b70..66c5317 100644 --- a/src/pages/mine/subs/address/index.vue +++ b/src/pages/mine/subs/address/index.vue @@ -4,7 +4,7 @@ + @on-delete='args => {handleDelete(args)}' /> @@ -42,6 +42,23 @@ const fetchAddressList = async () => { addressList.value = await getAddressList(); }; +const handleDelete = async (item: any) => { + uni.showModal( + { + title: '提示', + content: '确定删除该地址吗?', + success: async (res) => { + if(res.confirm) { + const result = await addressDelete(item?.addrid); + if(result) { + await fetchAddressList(); + } + } + } + } + ); +}; + const onChecked = (e: any) => { const pages = getCurrentPages(); if(pages.length >= 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) { diff --git a/src/pages/mine/subs/order/detail.vue b/src/pages/mine/subs/order/detail.vue index bef778a..d02dc54 100644 --- a/src/pages/mine/subs/order/detail.vue +++ b/src/pages/mine/subs/order/detail.vue @@ -18,11 +18,14 @@