1

parent 5e87a55c
......@@ -23,6 +23,16 @@ export function addOrder(data) {
data,
});
}
// 获取购物车列表
export function getshoppingCartList(data) {
return request({
url: `/sgyrdd/sgyBasket/list`,
method: 'GET',
data,
});
}
// 套餐详情
export function getCollect(data) {
return request({
......
......@@ -69,7 +69,7 @@
<view class="sort-text">客服</view>
</view> -->
<view class="borderClass" @tap="toCart">
<wd-badge modelValue="4">
<wd-badge :modelValue="subscript">
<img
src="/static/assistingAgriculture/detail/car.png"
style="width: 40rpx; height: 40rpx"
......@@ -104,6 +104,7 @@ import {
getProdDetail,
getEvalNumber,
addOrder,
getshoppingCartList,
getCollect,
getCouponShopList,
receiveCoupon,
......@@ -131,10 +132,12 @@ const storeList = ref([
let prodId;
const dataDetails = ref({});
const commentData = ref({});
const subscript = ref(0);
onLoad((options) => {
prodId = '43834';
getProdDetailFn();
getEvalNumberFn();
getshoppingCartListFn();
});
function handleClick(e) {
console.log(e);
......@@ -170,14 +173,27 @@ const getEvalNumberFn = () => {
// 加入购物车
const addOrderFn = () => {
const orderParams = {
shopId: dataDetails.value.prod.prodId,
prodId: dataDetails.value.prodParameters.prodId,
shopId: dataDetails.value.prod.shopId,
prodId: dataDetails.value.skus[0].prodId,
skuId: dataDetails.value.skus[0].skuId,
shopType: 3,
shopType: '3',
basketCount: 1,
};
addOrder(orderParams).then((res) => {
console.log('加入购物车', res);
xma.showToast({
title: res.msg,
duration: 1500,
icon: 'none',
});
});
};
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
res.data.forEach((item) => {
// item.img = imgUrl + item.img;
});
subscript.value = res.data.length;
});
};
// 进入页面回到顶部
......
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