Commit 477407cf authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents c84bb4bb b6fae1de
<script setup>
import { getTokenUser } from './api/index';
import testJson from './static/json/test.json';
import { getToken } from './utils/auth';
onLaunch(() => {
if (!getToken()) signIn();
console.log('App Launch');
});
......@@ -10,6 +14,14 @@ onShow(() => {
onHide(() => {
console.log('App Hide');
});
// 登录
const signIn = () => {
getTokenUser(testJson).then((res) => {
const token = res.data.access_token;
xma.setStorageSync('Authorization', token);
console.log('登录...');
});
};
</script>
<style>
.multi-line {
......
......@@ -16,3 +16,28 @@ export function groupBuyList() {
method: 'GET',
});
}
// 根据父级分类id查询子分类列表
export function getByParentId(id) {
return request({
url: `/sgyrdd/category/getByParentId?parentId=${id}`,
method: 'GET',
});
}
// 获取团购专区主页轮播图
export function groupImgList() {
return request({
url: `/sgyrdd/carousel/groupBuyList`,
method: 'GET',
});
}
// 附近人气美食分页
export function popularityPage(data) {
return request({
url: `/sgyrdd/shop/popularityPage`,
method: 'POST',
data,
});
}
import { request } from '../utils/request';
// 订单列表接口
export function getOrderList(data) {
return request({
url: '/sgyrdd/sgyOrder/groupBuy/page',
method: 'GET',
data,
});
}
......@@ -60,6 +60,12 @@
"style": {
"navigationBarTitleText": "我的券"
}
},
{
"path": "pages/ticket/detail",
"style": {
"navigationBarTitleText": "优惠券详情"
}
}
,
{
......
......@@ -87,12 +87,29 @@ import Search from '../../components/index/Search.vue';
import Classification from '../../components/index/Classification.vue';
import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue';
import { getByParentId } from '../../api/index';
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null);
const rotate = ref(false);
const rotate2 = ref(false);
const rotate3 = ref(false);
onLoad((option) => {
const { parentId } = option;
query(parentId);
});
// 根据父级分类id查询子分类列表
const query = (parentId) => {
getByParentId(parentId).then((res) => {
console.log('打印res', res);
});
};
// onLoad(option) {
// //option为object类型,会序列化上个页面传递的参数
// console.log(option.id); //打印出上个页面传递的参数。
// console.log(option.name); //打印出上个页面传递的参数。
// },
const choice = (index) => {
active.value = index;
};
......
......@@ -9,24 +9,24 @@
<view class="classification">
<view class="classification-top">
<view
@tap="jingang(index)"
@tap="jingang(item.categoryId)"
class="choice"
v-for="(item, index) in classificationT"
:key="index"
>
<image class="imgs" :src="'../../static/index/' + item.img + '.png'" mode="widthFix" />
<text class="introduce">{{ item.text }}</text>
<image class="imgs" :src="item.icon" mode="widthFix" />
<text class="introduce">{{ item.categoryName }}</text>
</view>
</view>
<view class="classification-bottom">
<view
@tap="jingang(index)"
@tap="jingang(item.categoryId)"
class="choice"
v-for="(item, index) in classificationB"
:key="index"
>
<image class="imgs" :src="'../../static/index/' + item.img + '.png'" mode="widthFix" />
<text class="introduce">{{ item.text }}</text>
<image class="imgs" :src="item.icon" mode="widthFix" />
<text class="introduce">{{ item.categoryName }}</text>
</view>
</view>
</view>
......@@ -128,15 +128,17 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
import ShopCard from '../../components/index/ShopCard.vue';
import Marketing from '../../components/index/Marketing.vue';
import Position from '../../components/index/Position.vue';
import { getTokenUser, groupBuyList } from '../../api/index';
import testJson from '../../static/json/test.json';
import { getToken } from '../../utils/auth';
import { groupBuyList, groupImgList, popularityPage } from '../../api/index';
// import testJson from '../../static/json/test.json';
// import { getToken } from '../../utils/auth';
const title = ref('小程序平台');
const { countInfo, addCount } = useCountStore();
onMounted(async () => {
if (!getToken()) await signIn();
// 轮播图数据
let lunboData;
onMounted(() => {
getClassification();
rotatingBroadcast();
nearbyFood();
// test(testJson).then((res) => {
// console.log('打印', res);
// });
......@@ -153,19 +155,49 @@ const signIn = () => {
// 获取分类
const getClassification = () => {
groupBuyList().then((res) => {
console.log('res', res);
res.data.forEach((item) => {
item.icon = import.meta.env.VITE_APP_IMG_URL + item.icon;
item.pic = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
classificationT.value = res.data.slice(0, 4);
classificationB.value = res.data.slice(4);
});
};
// 附近人气美食分页
const nearbyFood = () => {
console.log('位置名称:');
xma.getLocation({
isHighAccuracy: true,
success: function (res) {
console.log('位置名称:', res);
},
fail: function (err) {
console.log('获取位置失败:', err);
},
});
};
// 轮播图
const rotatingBroadcast = () => {
groupImgList().then((res) => {
console.log('lunbo', res);
res.data.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.imgUrl;
});
lunboData = res.data;
swiperList.value = res.data.map((item) => {
return item.imgUrl;
});
});
};
const light = ref(0);
const rotate = ref(false);
const classificationT = reactive([
const classificationT = ref([
{ img: 'hotPot', text: '火锅' },
{ img: 'barbecue', text: '烧烤烤肉' },
{ img: 'stirFriedDishes', text: '地方菜系' },
{ img: 'hamburg', text: '小吃快餐' },
]);
const classificationB = reactive([
const classificationB = ref([
{ img: 'seafood', text: '鱼鲜海鲜' },
{ img: 'foreignLand', text: '异域风味' },
{ img: 'selfHelp', text: '自助餐' },
......@@ -189,19 +221,22 @@ const choice = (index) => {
light.value = index;
};
// 金刚区分类选择
const jingang = (index) => {
switch (index) {
case 0:
const jingang = (id) => {
// switch (index) {
// case 0:
// xma.navigateTo({
// url: '/pages/index/foodClassification',
// });
// break;
// case 1:
// xma.navigateTo({});
// break;
// case 2:
// xma.navigateTo({});
// }
xma.navigateTo({
url: '/pages/index/foodClassification',
url: '/pages/index/foodClassification?parentId=' + id,
});
break;
case 1:
xma.navigateTo({});
break;
case 2:
xma.navigateTo({});
}
};
const locationFiltering = () => {
rotate.value = !rotate.value;
......
......@@ -36,7 +36,7 @@ const handleBack = () => {
background-color: #ffffff;
position: fixed;
z-index: 999;
width: 100%;
width: 375 * 2rpx;
.headbox {
position: relative;
......
......@@ -28,10 +28,39 @@
<view class="btn-error">再来一单</view>
</view>
</view>
<wd-loadmore :state="state" @reload="loadmore" />
</view>
</template>
<script></script>
<script setup>
import { getOrderList } from '@/api/order';
const state = ref('loading');
const page = reactive({
pageNum: 0,
pageSize: 10,
});
const num = ref(0);
const max = ref(60);
onReachBottom(() => {
if (num.value === 45) {
state.value = 'error';
} else if (num.value < max.value) {
getList();
} else if (num.value === max.value) {
state.value = 'finished';
}
});
const getList = async () => {
const res = await getOrderList();
state.value = 'loading';
console.log(res);
};
getList();
</script>
<style lang="scss" scoped>
.content {
......@@ -59,7 +88,8 @@
.left {
display: flex;
align-items: center;
gap: 20rpx;
gap: 6rpx;
font-weight: bold;
image {
height: 38rpx;
......
......@@ -206,6 +206,8 @@ page {
}
.container {
width: 375 * 2rpx;
margin: 0 auto;
.content {
padding-top: 44px;
display: flex;
......
......@@ -26,6 +26,8 @@ page {
background: #f3f3f3;
}
.container {
width: 375 * 2rpx;
margin: 0 auto;
.tabs {
padding-top: 44px;
......
......@@ -37,6 +37,8 @@ page {
}
.container {
width: 375 * 2rpx;
margin: 0 auto;
.content {
padding-top: 44px;
display: flex;
......
<template>
<!-- 优惠券列表 -->
<view class="ticket-list">
<view class="ticket-item">
<view class="ticket-box">
<view class="normal ticket-left">
<view class="ticket-box">
<view class="ticket-price">
<text class="price"></text>
<text class="num">20</text>
</view>
<view class="ticket-desc">
<text class="desc">满50元可用</text>
<text class="desc">数量:10</text>
</view>
</view>
</view>
<view class="ticket-right">
<view class="head">
<text class="title">超市优惠券</text>
<view class="headbox">
<text class="time">使用时间:2023.02.4-2023.02.10</text>
<view class="btn">使用</view>
</view>
</view>
<view class="foot">
<view class="line"></view>
<view class="footbox" @click="changeShowDetail()">
<text class="desc">详细信息</text>
<wd-icon
:name="showDetail ? 'chevron-down' : 'chevron-right'"
size="15px"
color="#9d9d9d"
></wd-icon>
</view>
</view>
</view>
</view>
<view class="detail" v-if="showDetail">
<view class="line"></view>
<view class="detail-box">
<view class="rowbox">
<text>使用时间</text>
<text class="desc">2023.02.04-2023.04.20</text>
</view>
<view class="rowbox">
<text>使用条件</text>
<text class="desc">满50元可用</text>
</view>
<view class="rowbox">
<text>使用说明</text>
<text class="desc">
活动期间,使用说明内容使用说明内容 使用说明内容使用说明内容使用说明内 容使用说明内容。
</text>
</view>
</view>
</view>
</view>
<view class="ticket-item">
<view class="ticket-box">
<view class="past ticket-left">
<view class="ticket-box">
<view class="ticket-price">
<text class="price"></text>
<text class="num">20</text>
</view>
<view class="ticket-desc">
<text class="desc">满50元可用</text>
<text class="desc">数量:10</text>
</view>
</view>
</view>
<view class="ticket-right">
<image src="@/static/ticket/past-icon.png" class="img"></image>
<view class="head">
<text class="title">超市优惠券</text>
<view class="headbox">
<text class="time">使用时间:2023.02.4-2023.02.10</text>
<!-- <view class="btn">使用</view> -->
</view>
</view>
<view class="foot">
<view class="line"></view>
<view class="footbox">
<text class="desc">详细信息</text>
<wd-icon name="chevron-right" size="15px" color="#9d9d9d"></wd-icon>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
const showDetail = ref(false);
const changeShowDetail = () => {
console.log('showDetail', showDetail.value);
showDetail.value = !showDetail.value;
};
</script>
<style lang="scss" scoped>
.ticket-list {
display: flex;
flex-direction: column;
gap: 36rpx;
.ticket-item {
width: 100%;
background-color: #fff;
border-radius: 16rpx;
display: flex;
flex-direction: column;
.ticket-box {
display: flex;
.normal {
background: url('../../static/ticket/ticket-normal.png') no-repeat;
background-size: 100% 100%;
}
.past {
background: url('../../static/ticket/ticket-past.png') no-repeat;
background-size: 100% 100%;
}
.ticket-left {
width: 200rpx;
height: 200rpx;
.ticket-box {
width: 94%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 30rpx;
.ticket-price {
display: flex;
align-items: last baseline;
text {
font-size: 24rpx;
line-height: 24rpx;
font-family: PingFang SC;
color: #fff;
}
.num {
font-size: 52rpx;
}
}
.ticket-desc {
display: flex;
flex-direction: column;
align-items: center;
gap: 24rpx;
.desc {
font-size: 24rpx;
line-height: 24rpx;
font-family: PingFang SC;
color: #fff;
}
}
}
}
.ticket-right {
display: flex;
flex-direction: column;
width: 504rpx;
position: relative;
.img {
width: 126rpx;
height: 94rpx;
position: absolute;
right: 28rpx;
top: 26rpx;
}
.head {
display: flex;
flex-direction: column;
padding: 30rpx 22rpx 26rpx 32rpx;
gap: 4rpx;
.title {
font-family: PingFang SC Heavy-Regular;
font-size: 32rpx;
color: #333333;
line-height: 32rpx;
}
.headbox {
display: flex;
justify-content: space-between;
align-items: end;
height: 50rpx;
.time {
font-family: PingFang SC Heavy-Regular;
font-size: 20rpx;
color: #999999;
line-height: 20rpx;
}
.btn {
width: 100rpx;
height: 50rpx;
border-radius: 26rpx;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(90deg, #ff7051 0%, #ff382e 100%);
color: #fff;
font-size: 24rpx;
line-height: 24rpx;
}
}
}
.foot {
display: flex;
flex-direction: column;
padding: 0 22rpx 14rpx 32rpx;
gap: 14rpx;
.line {
border-top: 2rpx solid #f2f2f2;
}
.footbox {
display: flex;
align-items: center;
justify-content: space-between;
.desc {
font-family: PingFang SC Heavy-Regular;
font-size: 20rpx;
color: #999999;
line-height: 20rpx;
}
}
}
}
}
.detail {
display: flex;
flex-direction: column;
padding: 24rpx 0rpx 56rpx 0rpx;
gap: 30rpx;
.line {
border-top: 2rpx solid #e7e7e7;
}
.detail-box {
display: flex;
flex-direction: column;
gap: 40rpx;
padding: 0 40rpx 0 22rpx;
.rowbox {
display: flex;
flex-direction: row;
gap: 48rpx;
text {
font-family: PingFang SC Regular;
font-size: 28rpx;
color: #666666;
line-height: 28rpx;
}
.desc {
width: 476rpx;
}
}
}
}
}
}
</style>
<template>
<view class="container">
<Header title="合力超市"></Header>
<view class="content">
<view class="shop">
<image src="@/static/ticket/logo.png" class="logo"></image>
<view class="info">
<view class="top">
<view class="left">
<text class="title">合力超市花果园R1区店</text>
<view class="ratebox">
<wd-rate v-model="value" size="13px" space="1px" active-color="#f12929" />
<text class="rate">4.9</text>
</view>
<view class="ratebox">
<text>营业时间:</text>
<text class="time">6:00-22:00</text>
</view>
</view>
<view class="btn">
<image src="@/static/ticket/shopmail.png"></image>
<text>进店</text>
</view>
</view>
<view class="bottom">
<image class="address" src="@/static/ticket/address.png"></image>
<view class="infobox">
<text class="addr">贵阳市南明区花果园R1区1209</text>
<text>距您400米 步行5分钟</text>
</view>
<view class="iconbox">
<image class="img" src="@/static/ticket/map.png"></image>
<text>导航到店</text>
</view>
<view class="iconbox">
<image class="img" src="@/static/ticket/phone.png"></image>
<text>电话</text>
</view>
</view>
</view>
</view>
<!-- 优惠券列表 -->
<TicketList></TicketList>
</view>
</view>
</template>
<script setup>
import Header from '@/pages/order/components/Header/index.vue';
import TicketList from '@/pages/ticket/components/TicketList/index.vue';
const value = ref(4);
</script>
<style scoped lang="scss">
page {
background: #f3f3f3;
}
.container {
width: 375 * 2rpx;
margin: 0 auto;
.content {
display: flex;
flex-direction: column;
padding: 100rpx 26rpx 26rpx;
gap: 26rpx;
.shop {
display: flex;
gap: 20rpx;
background-color: #fff;
border-radius: 16rpx;
padding: 24rpx 22rpx 30rpx;
.logo {
height: 116rpx;
width: 116rpx;
border-radius: 16rpx;
}
.info {
display: flex;
flex-direction: column;
gap: 34rpx;
.top {
display: flex;
justify-content: space-between;
width: 514rpx;
.left {
display: flex;
flex-direction: column;
gap: 10rpx;
.title {
font-family: PingFang SC Bold;
font-size: 32rpx;
color: #333333;
line-height: 32rpx;
}
.ratebox {
display: flex;
align-items: center;
gap: 8rpx;
text {
font-family: PingFang SC Regular;
font-size: 24rpx;
color: #666;
}
.rate {
font-size: 22rpx;
color: #f12a2a;
}
.time {
color: #333;
}
}
}
.btn {
width: 127rpx;
height: 53rpx;
border-radius: 27rpx;
border: 2rpx solid #f12a2a;
display: flex;
align-items: center;
justify-content: center;
font-family: PingFang SC Regular;
font-size: 24rpx;
color: #f12a2a;
gap: 6rpx;
image {
width: 30rpx;
height: 30rpx;
}
}
}
.bottom {
display: flex;
justify-content: space-around;
.address {
width: 30rpx;
height: 30rpx;
}
.infobox {
display: flex;
flex-direction: column;
gap: 6rpx;
text {
font-family: PingFang SC Regular;
font-size: 22rpx;
color: #999999;
}
.addr {
width: 324rpx;
font-size: 24rpx;
color: #333;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
.iconbox {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8rpx;
font-family: PingFang SC Regular;
font-size: 20rpx;
color: #666666;
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
}
}
}
</style>
<template>
<view class="container">
<Header title="我的码"></Header>
<view class="tab">
<view
......@@ -29,25 +30,14 @@
</view>
<!-- 优惠券列表 -->
<view class="ticket-list">
<view class="ticket-item">
<view class="normal ticket-left">
<view class="ticket-price">
<text class="price"></text>
<text class="num">20</text>
</view>
<view class="ticket-desc">
<text class="desc">满50元可用</text>
<text class="desc">数量:10</text>
</view>
</view>
</view>
<TicketList></TicketList>
</view>
</view>
</template>
<script setup>
import Header from '../order/components/Header/index.vue';
import Header from '@/pages/order/components/Header/index.vue';
import TicketList from '@/pages/ticket/components/TicketList/index.vue';
const tabList = ['有效优惠券', '无效优惠券'];
const currentTab = ref(0);
......@@ -68,9 +58,12 @@ const changeStatus = (index) => {
page {
background: #f3f3f3;
}
.container {
width: 375 * 2rpx;
margin: 0 auto;
// 标签栏
.tab {
// 标签栏
.tab {
display: flex;
align-items: center;
justify-content: space-around;
......@@ -106,9 +99,9 @@ page {
transform: translate(-50%);
}
}
}
}
.content {
.content {
display: flex;
flex-direction: column;
padding: 202rpx 26rpx 26rpx;
......@@ -173,70 +166,6 @@ page {
color: #f12a2a;
}
}
.ticket-list {
display: flex;
flex-direction: column;
gap: 36rpx;
.ticket-item {
width: 100%;
background-color: #fff;
border-radius: 16rpx;
display: flex;
.normal {
background: url('../../static/ticket/ticket-normal.png') no-repeat;
background-size: 100% 100%;
}
.past {
background: url('../../static/ticket/ticket-past.png') no-repeat;
background-size: 100% 100%;
}
.ticket-left {
width: 196rpx;
height: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 30rpx;
.ticket-price {
display: flex;
align-items: last baseline;
.price {
font-size: 24rpx;
line-height: 24rpx;
font-family: PingFang SC;
color: #fff;
}
.num {
font-size: 52rpx;
line-height: 24rpx;
font-family: PingFang SC;
color: #fff;
}
}
.ticket-desc {
display: flex;
flex-direction: column;
gap: 24rpx;
.desc {
font-size: 24rpx;
line-height: 24rpx;
font-family: PingFang SC;
color: #fff;
}
}
}
}
}
}
</style>
......@@ -3,12 +3,12 @@ let domain = {};
if (env === 'dev') {
domain = {
apiPrefix: '/api',
// imgPrefix: 'https://gdlxy-images.wjzpgz.com/',
imgPrefix: 'http://file.rhhzkj.com:8080',
};
} else {
domain = {
apiPrefix: 'https://api.rddyz.com',
// imgPrefix: 'https://gdlxy-images.wjzpgz.com/',
imgPrefix: 'https://file.rddyz.com',
};
}
......
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