优惠券

parent 5fe273f8
import { request } from '../utils/request';
// 用户券统计接口
export function userCouponStatisticsApi(data) {
return request({
url: '/sgyrdd/coupon/getUserCouponSum',
method: 'GET',
data,
});
}
// 用户券列表接口
export function myCouponListApi(data) {
return request({
url: '/sgyrdd/coupon/getUserCouponPage',
method: 'GET',
data,
});
}
// 商铺优惠券列表接口 data:shopId
export function shopCouponList(data) {
return request({
url: '/sgyrdd/coupon/couponShopList/' + data,
method: 'GET',
});
}
......@@ -37,7 +37,7 @@
<script setup>
const selectType = ref('wx');
const show = ref(true);
const show = ref(false);
function radioChange(evt) {
const { value } = evt.detail;
......
......@@ -28,7 +28,7 @@
<image class="address" src="@/static/ticket/address.png"></image>
<view class="infobox">
<text class="addr">贵阳市南明区花果园R1区1209</text>
<text>距您400米 步行5分钟</text>
<text>距您400米</text>
</view>
<view class="iconbox">
<image class="img" src="@/static/ticket/map.png"></image>
......@@ -49,10 +49,31 @@
</template>
<script setup>
import { shopCouponList } from '@/api/ticket';
import { getShopDetail } from '@/api/order';
import Header from '@/pages/order/components/Header/index.vue';
import TicketList from '@/pages/ticket/components/TicketList/index.vue';
const value = ref(4);
const shopId = ref('1626126617850544129');
const getList = async () => {
const res = await shopCouponList(shopId.value);
console.log(res);
};
getList();
/**
* 获取商铺信息
*/
const shopDetail = ref();
const getShopMailDetail = async () => {
const res = await getShopDetail({ shopId: shopId.value });
if (res.code === 0) {
shopDetail.value = res.data.shop;
}
};
getShopMailDetail();
</script>
<style scoped lang="scss">
......
......@@ -14,7 +14,7 @@
<view class="content">
<view class="card">
<text class="text">已领取优惠金额(元)</text>
<text class="price">0.00</text>
<text class="price">{{ discountAmount }}</text>
</view>
<!-- 优惠券状态 -->
......@@ -36,22 +36,66 @@
</template>
<script setup>
import { myCouponListApi, userCouponStatisticsApi } from '@/api/ticket';
import Header from '@/pages/order/components/Header/index.vue';
import TicketList from '@/pages/ticket/components/TicketList/index.vue';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
// 主状态
const tabList = ['有效优惠券', '无效优惠券'];
const currentTab = ref(0);
const changeTab = (index) => {
currentTab.value = index;
if (currenStatus.value !== index) {
currentTab.value = index;
getStatistics();
}
};
const statusList = ['全部', '附近可用', '已使用', '未使用'];
// 子状态
const statusList = ['全部', '已使用', '未使用'];
const currenStatus = ref(0);
const changeStatus = (index) => {
currenStatus.value = index;
if (currenStatus.value !== index) {
currenStatus.value = index;
getStatistics();
}
};
/**
* 获取用户统计列表
*/
const discountAmount = ref(0.00);
const getStatistics = async () => {
const params = {
statuMain: currentTab.value,
statuSon: currenStatus.value,
};
const res = await userCouponStatisticsApi(params);
if (res.code === 0) {
discountAmount.value = res.data;
}
};
getStatistics();
/**
* 获取用户统计列表
*/
const catalog = reactive({
current: 0,
size: 10,
statuMain: 0,
statuSon: 0,
});
const getCouponList = async () => {
catalog.statuMain = currentTab.value;
catalog.statuSon = currenStatus.value;
const res = await myCouponListApi(catalog);
console.log(res);
};
getCouponList();
</script>
<style scoped lang="scss">
......
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