Commit 30bc52bc authored by 张娇(东信)'s avatar 张娇(东信)

购物车修改数量接口添加

parent c1a2085d
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index, item)" @tap="selectItem(index, item)"
> >
{{ item }} {{ item.startDate }}
</li> </li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4"> <wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li> <li>选择日期</li>
...@@ -39,21 +39,13 @@ onMounted(async () => { ...@@ -39,21 +39,13 @@ onMounted(async () => {
getStartDateList(); getStartDateList();
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
console.log('item', item);
selectedItem.value = index; selectedItem.value = index;
emit('dataParams', item); emit('dataParams', item);
}; };
// 查询出发日期 // 查询出发日期
const getStartDateList = () => { const getStartDateList = () => {
getStartDate(params).then((res) => { getStartDate(params).then((res) => {
console.log('res.data', res.data);
const transformedData = Object.keys(res.data).reduce((acc, key) => {
acc[key] = { [key]: res.data[key] };
return acc;
}, {});
dataList.value = res.data; dataList.value = res.data;
console.log(Object.keys(dataList.value, 232));
}); });
}; };
function handleConfirm4({ value }) { function handleConfirm4({ value }) {
......
...@@ -64,3 +64,11 @@ export function sgyOrderOrderInfo(data) { ...@@ -64,3 +64,11 @@ export function sgyOrderOrderInfo(data) {
data, data,
}); });
} }
// 筑农首页-3、订单详情
export function quantity(data) {
return request({
url: `/sgyrdd/sgyBasket/quantity`,
method: 'POST',
data,
});
}
...@@ -213,6 +213,9 @@ const locationFiltering = (index) => { ...@@ -213,6 +213,9 @@ const locationFiltering = (index) => {
sortType.value = null; sortType.value = null;
attractionId.value = null; attractionId.value = null;
dateType.value = null; dateType.value = null;
startCity.value = null;
serviceCommitment.value = null;
labelId.value = null;
} }
}; };
// 查询热门路线 // 查询热门路线
...@@ -231,7 +234,8 @@ const sortParams = (sortMode) => { ...@@ -231,7 +234,8 @@ const sortParams = (sortMode) => {
}; };
// 出发日期 // 出发日期
const dataParams = (item) => { const dataParams = (item) => {
dateType.value = item; console.log(item, item.key, 22322323);
dateType.value = item.key;
getProd(); getProd();
}; };
// 景点 // 景点
...@@ -258,7 +262,7 @@ const getProd = () => { ...@@ -258,7 +262,7 @@ const getProd = () => {
size: 10, size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }), ...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }), ...(attractionId.value !== null && { attractionId: attractionId.value.id }),
...(dateType.value !== null && { dateType: dateType.value }), ...(dateType.value !== null && { dateType: dateType.value.key }),
...(startCity.value !== null && { startCity: startCity.value }), ...(startCity.value !== null && { startCity: startCity.value }),
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }), ...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }), ...(labelId.value !== null && { labelId: labelId.value }),
...@@ -274,7 +278,7 @@ function toRouteDetails(item) { ...@@ -274,7 +278,7 @@ function toRouteDetails(item) {
console.log(item, 22222); console.log(item, 22222);
// TODO: 跳转到线路详情 // TODO: 跳转到线路详情
xma.navigateTo({ xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.prodId}`, url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?shopId=${item.shopId},prodId=${item.prodId}`,
}); });
} }
function toSpecialOfferZoneList() { function toSpecialOfferZoneList() {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<span></span> <span></span>
{{ item.skuPrice }} {{ item.skuPrice }}
</div> </div>
<wd-input-number v-model="item.count" /> <wd-input-number v-model="item.count" @change="changeQuantity(item)" />
</div> </div>
</div> </div>
</div> </div>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { getshoppingCartList } from '../../../api/packageDetail'; import { getshoppingCartList } from '../../../api/packageDetail';
import { categoryPresaleList } from '../../../api/assistingAgriculture/building'; import { categoryPresaleList } from '../../../api/assistingAgriculture/building';
import { quantity } from '../../../api/assistingAgriculture/shop';
// 计算是否全选 // 计算是否全选
const checkedAll = computed(() => { const checkedAll = computed(() => {
return cartList.value.every((item) => item.isChecked); return cartList.value.every((item) => item.isChecked);
...@@ -114,6 +115,13 @@ const presaleSortList = (index) => { ...@@ -114,6 +115,13 @@ const presaleSortList = (index) => {
}); });
}); });
}; };
// 购物车数量修改
const changeQuantity = async (item) => {
const res = await quantity({
basketId: item.basket.basketId,
basketCount: item.count,
});
};
const selectedItems = computed(() => { const selectedItems = computed(() => {
return cartList.value.reduce((acc, shop) => { return cartList.value.reduce((acc, shop) => {
const selectedProducts = shop.prodInfos.filter((item) => item.isChecked); const selectedProducts = shop.prodInfos.filter((item) => item.isChecked);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment