增加新版优惠券列表
This commit is contained in:
@@ -3,6 +3,7 @@ import request from '@/common/api/request.js'
|
|||||||
const urlAccount = '/account'
|
const urlAccount = '/account'
|
||||||
const urlProduct = '/product'
|
const urlProduct = '/product'
|
||||||
const urlOrder = '/order'
|
const urlOrder = '/order'
|
||||||
|
const urlMarket = '/market'
|
||||||
|
|
||||||
//桌码换取详细店铺信息
|
//桌码换取详细店铺信息
|
||||||
export const APIproductqueryShop = (data) => {
|
export const APIproductqueryShop = (data) => {
|
||||||
@@ -63,7 +64,7 @@ export const APIusershopInfodetail = (data) => {
|
|||||||
//通过用户Id 查找优惠券
|
//通过用户Id 查找优惠券
|
||||||
export const APIcouponfindByUserId = (data) => {
|
export const APIcouponfindByUserId = (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: urlAccount + '/user/coupon/findByUserId',
|
url: urlMarket + '/user/coupon/findByUserId',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ const proxyApi = "/api"
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN || APP || MP-ALIPAY
|
// #ifdef MP-WEIXIN || APP || MP-ALIPAY
|
||||||
const proxyApi = 'http://192.168.1.31' // 调试地址
|
const proxyApi = 'http://192.168.0.71' // 调试地址
|
||||||
const proxyApiwws = 'ws://192.168.1.31:2348' // 调试地址
|
const proxyApiwws = 'ws://192.168.0.71:2348' // 调试地址
|
||||||
// 测试
|
// 测试
|
||||||
// const proxyApi = "https://fv901fw8033.vicp.fun"
|
// const proxyApi = "https://fv901fw8033.vicp.fun"
|
||||||
// const proxyApiwws = 'wss://sockets.sxczgkj.com/wss'
|
// const proxyApiwws = 'wss://sockets.sxczgkj.com/wss'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
const baseUrl = debug ? proxyApi : "http://192.168.1.31"
|
const baseUrl = debug ? proxyApi : "http://192.168.0.71"
|
||||||
const baseUrlwws = 'ws://192.168.1.31:2348'
|
const baseUrlwws = 'ws://192.168.0.71:2348'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
||||||
|
|||||||
28
pages.json
28
pages.json
@@ -163,24 +163,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/test/test",
|
"path": "pages/test/test",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": ""
|
||||||
"navigationBarTitleText" : ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/order/histpry-order/histpry-order",
|
"path": "pages/order/histpry-order/histpry-order",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": ""
|
||||||
"navigationBarTitleText" : ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/order/confirm-order",
|
"path": "pages/order/confirm-order",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "确认订单",
|
||||||
"navigationBarTitleText" : "确认订单",
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/member/czzx",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "充值中心",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<view class="icon left">
|
<view class="icon left">
|
||||||
<u-icon name="search" size="26"></u-icon>
|
<u-icon name="search" size="26"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<input v-model="querForm.searchValue" class="ipt left" type="text" placeholder="搜索" />
|
<input v-model="querForm.searchValue" class="ipt left" type="text" placeholder="搜索" @confirm="searchHandle" />
|
||||||
</view>
|
</view>
|
||||||
<view class="input-wrap" @click="show = true">
|
<view class="input-wrap" @click="show = true">
|
||||||
<view class="icon right">
|
<view class="icon right">
|
||||||
@@ -16,13 +16,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="status-wrap">
|
<view class="status-wrap">
|
||||||
<view
|
<view class="item" :class="{ active: querForm.statusActiveIndex == index }" v-for="(item, index) in statusList" :key="item.value" @click="tabChange(index)">
|
||||||
class="item"
|
|
||||||
:class="{ active: querForm.statusActiveIndex == index }"
|
|
||||||
v-for="(item, index) in statusList"
|
|
||||||
:key="item.value"
|
|
||||||
@click="querForm.statusActiveIndex = index"
|
|
||||||
>
|
|
||||||
<text class="t">{{ item.label }}</text>
|
<text class="t">{{ item.label }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="icon-wrap" :style="{ width: `${100 / statusList.length}%`, left: `${(100 / statusList.length) * querForm.statusActiveIndex}%` }">
|
<view class="icon-wrap" :style="{ width: `${100 / statusList.length}%`, left: `${(100 / statusList.length) * querForm.statusActiveIndex}%` }">
|
||||||
@@ -39,10 +33,10 @@
|
|||||||
<view class="icon"></view>
|
<view class="icon"></view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="view name">
|
<view class="view name">
|
||||||
<text class="t">{{ item.title }}</text>
|
<text class="t">{{ item.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="view time">
|
<view class="view time">
|
||||||
<text class="t">有效期至:{{ item.startTime }}-{{ item.endTime }}</text>
|
<text class="t">{{ dayjs(item.effectStartTime).format('YYYY.MM.DD') }} - {{ dayjs(item.effectEndTime).format('YYYY.MM.DD') }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
@@ -51,9 +45,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="btm">
|
<view class="btm">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<text class="t">{{ item.remark }}</text>
|
<text class="t">1、可适用门店:{{ item.useShops }} 2、可适用商品:{{ item.foods }}3、可使用类型:{{ convertValuesToLabels(item.useType) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right" @click="showDetailHandle(item)">
|
||||||
<text class="t">查看详情</text>
|
<text class="t">查看详情</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -82,10 +76,35 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-popup :show="showDetail" round="20" closeable @close="showDetail = false">
|
||||||
|
<view class="shoplist-popup">
|
||||||
|
<view class="title">
|
||||||
|
<text class="t">详情说明</text>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="popup-list" direction="vertical">
|
||||||
|
<view class="ul">
|
||||||
|
<view class="li">1、可适用门店:{{ selectListItem.useShops }}</view>
|
||||||
|
<view class="li">2、可适用商品:{{ selectListItem.foods }}</view>
|
||||||
|
<view class="li" v-if="selectListItem.useType">3、可使用类型:{{ convertValuesToLabels(selectListItem.useType) }}</view>
|
||||||
|
<view class="li">
|
||||||
|
4、可用时间段:
|
||||||
|
<text class="t" v-if="selectListItem.useTimeType == 'all'">全段时间可用</text>
|
||||||
|
<text class="t" v-else>
|
||||||
|
{{ selectListItem.useStartTime - selectListItem.useEndTime }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="li">5、限量规则:{{ selectListItem.getLimit == -10086 ? '无限' : `${selectListItem.getLimit}张` }}</view>
|
||||||
|
<view class="li">6、同享规则:{{ selectListItem.vipPriceShare ? '与限时折扣同享、与会员价同享' : '不与限时折扣同享、与会员价同享' }}</view>
|
||||||
|
<view class="li">7、其它说明:{{ selectListItem.ruleDetails || '无' }}</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import dayjs from 'dayjs';
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onReady, onShow, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { APIcouponfindByUserId, APIfindCoupon } from '@/common/api/member.js';
|
import { APIcouponfindByUserId, APIfindCoupon } from '@/common/api/member.js';
|
||||||
@@ -101,19 +120,19 @@ const querForm = ref({
|
|||||||
// 状态
|
// 状态
|
||||||
const statusList = ref([
|
const statusList = ref([
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 0,
|
||||||
label: '未使用',
|
label: '未使用',
|
||||||
bg: '#333333',
|
bg: '#333333',
|
||||||
color: '#ffffff'
|
color: '#ffffff'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 2,
|
value: 1,
|
||||||
label: '已使用',
|
label: '已使用',
|
||||||
bg: '#F8F8F8',
|
bg: '#F8F8F8',
|
||||||
color: '#999999'
|
color: '#999999'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 3,
|
value: 2,
|
||||||
label: '已失效',
|
label: '已失效',
|
||||||
bg: '#F8F8F8',
|
bg: '#F8F8F8',
|
||||||
color: '#999999'
|
color: '#999999'
|
||||||
@@ -124,18 +143,123 @@ const list = reactive({
|
|||||||
page: 1,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
status: 'nomore',
|
status: 'nomore',
|
||||||
data: [
|
data: []
|
||||||
{
|
});
|
||||||
id: 1,
|
|
||||||
type: 2,
|
onReachBottom(() => {
|
||||||
fullAmount: 200,
|
console.log('到底了');
|
||||||
discountAmount: 15,
|
list.page++;
|
||||||
title: '超值满减券',
|
getCouponList();
|
||||||
startTime: '2002.1.22',
|
});
|
||||||
endTime: '2022.1.22',
|
|
||||||
remark: '1、可适用门店:全部门店2、可适用商品:部分商品3、可使用类型:堂食4、可用时间段:全时段可用5、限量规则:每人限领3张,每日可最多使用3张6、同享规则:与限时折扣同享、与会员价同享7、其它说明:这里是后台配置内容'
|
const showDetail = ref(false);
|
||||||
|
const selectListItem = ref('');
|
||||||
|
function showDetailHandle(item) {
|
||||||
|
showDetail.value = true;
|
||||||
|
selectListItem.value = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
function searchHandle() {
|
||||||
|
list.page = 1;
|
||||||
|
getCouponList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换类型
|
||||||
|
function tabChange(index) {
|
||||||
|
querForm.value.statusActiveIndex = index;
|
||||||
|
list.page = 1;
|
||||||
|
getCouponList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取优惠券列表
|
||||||
|
async function getCouponList() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await APIcouponfindByUserId({
|
||||||
|
userId: uni.cache.get('userInfo').id,
|
||||||
|
name: querForm.value.searchValue,
|
||||||
|
status: statusList.value[querForm.value.statusActiveIndex].value,
|
||||||
|
shopId: querForm.value.shopId ? querForm.value.shopId : uni.cache.get('shopId'),
|
||||||
|
page: list.page,
|
||||||
|
size: list.size
|
||||||
|
});
|
||||||
|
if (list.page == 1) {
|
||||||
|
list.data = res.records;
|
||||||
|
} else {
|
||||||
|
list.data.push(...res.records);
|
||||||
}
|
}
|
||||||
]
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将value数组字符串转换为对应的label拼接字符串
|
||||||
|
* @param {Array} options - 包含value和label的选项数组,格式如[{value: 'xxx', label: 'xxx'}, ...]
|
||||||
|
* @param {string} valueStr - 包含value的数组字符串,格式如'["dine","pickup"]'
|
||||||
|
* @param {string} separator - 标签拼接分隔符,默认值为'、'
|
||||||
|
* @returns {string} 拼接后的label字符串,如"堂食、自取"
|
||||||
|
*/
|
||||||
|
function convertValuesToLabels(valueStr, options, separator = '、') {
|
||||||
|
try {
|
||||||
|
options = [
|
||||||
|
{
|
||||||
|
value: 'dine',
|
||||||
|
label: '堂食'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'pickup',
|
||||||
|
label: '自取'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'deliv',
|
||||||
|
label: '配送'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'express',
|
||||||
|
label: '快递'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
// 验证输入参数
|
||||||
|
if (!Array.isArray(options)) {
|
||||||
|
throw new Error('options必须是数组');
|
||||||
|
}
|
||||||
|
if (typeof valueStr !== 'string') {
|
||||||
|
throw new Error('valueStr必须是字符串');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析value数组字符串
|
||||||
|
const values = JSON.parse(valueStr);
|
||||||
|
if (!Array.isArray(values)) {
|
||||||
|
throw new Error('解析后的valueStr必须是数组');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建value到label的映射表
|
||||||
|
const valueLabelMap = new Map();
|
||||||
|
options.forEach((item) => {
|
||||||
|
if (item && typeof item.value !== 'undefined' && typeof item.label !== 'undefined') {
|
||||||
|
valueLabelMap.set(item.value, item.label);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 匹配并收集label
|
||||||
|
const labels = values.map((value) => valueLabelMap.get(value)).filter(Boolean); // 过滤未匹配到的项
|
||||||
|
|
||||||
|
// 拼接结果
|
||||||
|
return labels.join(separator);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('转换失败:', error.message);
|
||||||
|
return ''; // 出错时返回空字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getCouponList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -235,6 +359,9 @@ page {
|
|||||||
border-radius: 18upx;
|
border-radius: 18upx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 28upx;
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
.top {
|
.top {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -322,7 +449,7 @@ page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.popup-list {
|
.popup-list {
|
||||||
height: 50vh;
|
max-height: 50vh;
|
||||||
.item {
|
.item {
|
||||||
height: 100upx;
|
height: 100upx;
|
||||||
border-radius: 12upx;
|
border-radius: 12upx;
|
||||||
@@ -336,6 +463,17 @@ page {
|
|||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.ul {
|
||||||
|
.li {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28upx;
|
||||||
|
padding: 8upx 0;
|
||||||
|
.t {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
98
pages/user/member/czzx.vue
Normal file
98
pages/user/member/czzx.vue
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<!-- 充值中心 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<up-navbar bgColor="transparent" title="充值中心" @leftClick="back"></up-navbar>
|
||||||
|
<view class="header-wrap">
|
||||||
|
<image class="bg" src="/static/czzx_header_bg.png" mode="aspectFill"></image>
|
||||||
|
<view class="select-shop">
|
||||||
|
<view class="select-btn">
|
||||||
|
<up-icon name="map" color="#333"></up-icon>
|
||||||
|
<text class="t">双屿Pisces</text>
|
||||||
|
<up-icon name="arrow-right" color="#333"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="balance-wrap">
|
||||||
|
<view class="left">
|
||||||
|
<text class="i t">余额</text>
|
||||||
|
<text class="n t">12223.53</text>
|
||||||
|
</view>
|
||||||
|
<view class="right">
|
||||||
|
<text class="t">明细</text>
|
||||||
|
<text class="t">密码设置</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btm-wrap">
|
||||||
|
<view class="">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
function back() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.header-wrap {
|
||||||
|
width: 100%;
|
||||||
|
height: 600upx;
|
||||||
|
padding: calc(var(--status-bar-height) + 180upx) 28upx 28upx;
|
||||||
|
position: relative;
|
||||||
|
.bg {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.select-shop {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
.select-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
.t {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.balance-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: relative;
|
||||||
|
padding-top: 40upx;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.t {
|
||||||
|
color: #5e3110;
|
||||||
|
&.i {
|
||||||
|
position: relative;
|
||||||
|
top: 10upx;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
&.n {
|
||||||
|
font-size: 64upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12upx;
|
||||||
|
.t {
|
||||||
|
color: #86491d;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
static/czzx_header_bg.png
Normal file
BIN
static/czzx_header_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
Reference in New Issue
Block a user