1

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