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

购物车修改数量接口添加

parent c1a2085d
......@@ -8,7 +8,7 @@
:class="{ active: selectedItem === index }"
@tap="selectItem(index, item)"
>
{{ item }}
{{ item.startDate }}
</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li>
......@@ -39,21 +39,13 @@ onMounted(async () => {
getStartDateList();
});
const selectItem = (index, item) => {
console.log('item', item);
selectedItem.value = index;
emit('dataParams', item);
};
// 查询出发日期
const getStartDateList = () => {
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;
console.log(Object.keys(dataList.value, 232));
});
};
function handleConfirm4({ value }) {
......
......@@ -64,3 +64,11 @@ export function sgyOrderOrderInfo(data) {
data,
});
}
// 筑农首页-3、订单详情
export function quantity(data) {
return request({
url: `/sgyrdd/sgyBasket/quantity`,
method: 'POST',
data,
});
}
......@@ -213,6 +213,9 @@ const locationFiltering = (index) => {
sortType.value = null;
attractionId.value = null;
dateType.value = null;
startCity.value = null;
serviceCommitment.value = null;
labelId.value = null;
}
};
// 查询热门路线
......@@ -231,7 +234,8 @@ const sortParams = (sortMode) => {
};
// 出发日期
const dataParams = (item) => {
dateType.value = item;
console.log(item, item.key, 22322323);
dateType.value = item.key;
getProd();
};
// 景点
......@@ -258,7 +262,7 @@ const getProd = () => {
size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(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 }),
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }),
......@@ -274,7 +278,7 @@ function toRouteDetails(item) {
console.log(item, 22222);
// TODO: 跳转到线路详情
xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.prodId}`,
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?shopId=${item.shopId},prodId=${item.prodId}`,
});
}
function toSpecialOfferZoneList() {
......
......@@ -31,7 +31,7 @@
<span></span>
{{ item.skuPrice }}
</div>
<wd-input-number v-model="item.count" />
<wd-input-number v-model="item.count" @change="changeQuantity(item)" />
</div>
</div>
</div>
......@@ -60,6 +60,7 @@
import { ref, computed, onMounted } from 'vue';
import { getshoppingCartList } from '../../../api/packageDetail';
import { categoryPresaleList } from '../../../api/assistingAgriculture/building';
import { quantity } from '../../../api/assistingAgriculture/shop';
// 计算是否全选
const checkedAll = computed(() => {
return cartList.value.every((item) => item.isChecked);
......@@ -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(() => {
return cartList.value.reduce((acc, shop) => {
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